Commit 55bc0c23002d5a4f947671805aaa46ebd0702d17

Authored by 张红振
1 parent 861809b7

fix bug

src/style/element.scss
... ... @@ -10,5 +10,5 @@
10 10 width: 100%;
11 11 }
12 12 .el-form--inline .el-form-item {
13   - margin-right: 0;
  13 + // margin-right: 0;
14 14 }
15 15 \ No newline at end of file
... ...
src/views/community/housekeeper/houseDetail.vue
1 1 <script setup lang="ts">
2   -import { reactive, ref, watch, onMounted } from "vue";
  2 +import { reactive, ref, onMounted, getCurrentInstance } from "vue";
3 3 import type { ElForm } from "element-plus";
4   -import { ElMessage } from "element-plus";
5 4 import { addOrUpdate } from "@/api/community/housekeeper.ts";
6 5 import { getTableList } from "@/api/community/residence.ts";
  6 +
7 7 const ruleFormRef = ref<InstanceType<typeof ElForm>>();
  8 +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例
8 9 // 声明props
9 10 const props = defineProps({
10 11 formObj: {
... ... @@ -30,7 +31,7 @@ let data = reactive({
30 31 * 获取下拉数据
31 32 */
32 33 const getSelectList: void = () => {
33   - getTableList({ pageNum: 1, pageSize: 1000,type:0 })
  34 + getTableList({ pageNum: 1, pageSize: 1000, type: 0 })
34 35 .then((res) => {
35 36 data.options = res.data.data.list;
36 37 })
... ... @@ -39,8 +40,8 @@ const getSelectList: void = () =&gt; {
39 40 });
40 41 };
41 42 onMounted(() => {
42   - getSelectList()
43   -})
  43 + getSelectList();
  44 +});
44 45 // 表单验证
45 46 const rules = reactive({
46 47 neighborhoodId: [
... ... @@ -114,10 +115,8 @@ let submitForm = (formEl: InstanceType&lt;typeof ElForm&gt; | undefined) =&gt; {
114 115 emit("success");
115 116 });
116 117 } else {
117   - ElMessage({
118   - message: "请完善信息",
119   - type: "error",
120   - });
  118 + instance?.proxy?.$message.error("请完善信息"); //调用
  119 +
121 120 loading.value = false;
122 121 return false;
123 122 }
... ...
src/views/community/housekeeper/index.vue
1 1 <script setup lang="ts">
2   -import { reactive, onMounted, ref } from "vue";
3   -import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts";
  2 +import { reactive, onMounted } from "vue";
  3 +import { getTableList, deleteBuilding,getCurrentInstance } from "@/api/community/housekeeper.ts";
4 4 import { parseTime } from "@/utils/tool.ts";
5 5 import HouseDetail from "./houseDetail.vue";
6 6 import Pagination from "@/components/Pagination/index.vue";
7   -import { ElMessage } from "element-plus";
  7 +
  8 +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例
8 9 // 数据筛选
9 10 const searchData = reactive({
10 11 neighborhoodId: null,
... ... @@ -55,7 +56,7 @@ const edit = (row: Object) =&gt; {
55 56 */
56 57 const remove = (buildingId: number) => {
57 58 deleteBuilding({ buildingId: buildingId }).then((res) => {
58   - ElMessage.success("操作成功");
  59 + instance?.proxy?.$message.success('操作成功')//调用
59 60 search();
60 61 });
61 62 };
... ...
src/views/community/houses/detail.vue
1 1 <script setup lang="ts">
2   -import { reactive, ref, onMounted } from "vue";
  2 +import { reactive, onMounted } from "vue";
3 3 import { getHouse } from "@/api/community/houses.ts";
4 4  
5 5 // 声明props
... ... @@ -9,7 +9,6 @@ const props = defineProps({
9 9 default: {},
10 10 },
11 11 });
12   -console.log(props.formObj);
13 12 </script>
14 13  
15 14 <template>
... ...
src/views/community/houses/index.vue
1 1 <script setup lang="ts">
2   -import { reactive, onMounted, ref } from "vue";
  2 +import { reactive, onMounted,getCurrentInstance } from "vue";
3 3 import { getTableList, deleteHouse,getHouse } from "@/api/community/houses.ts";
4 4 import { parseTime } from "@/utils/tool.ts";
5 5 import Detail from "./detail.vue";
6 6 import Pagination from "@/components/Pagination/index.vue";
7   -import { ElMessage } from "element-plus";
  7 +
  8 +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例
8 9 // 数据筛选
9 10 const searchData = reactive({
10 11 buildingId: 1,
... ... @@ -57,7 +58,7 @@ const check = (houseId: number) =&gt; {
57 58 */
58 59 const remove = (houseId: number) => {
59 60 deleteHouse({ houseId: houseId }).then((res) => {
60   - ElMessage.success("操作成功");
  61 + instance?.proxy?.$message.success('操作成功')//调用
61 62 search();
62 63 });
63 64 };
... ...
src/views/community/residence/communityDetail.vue
1 1 <script setup lang="ts">
2   -import { reactive, ref, watch, onMounted } from "vue";
  2 +import { reactive, ref, onMounted,getCurrentInstance } from "vue";
3 3 import type { ElForm } from "element-plus";
4 4 import { ElMessage } from "element-plus";
5 5 import { addOrUpdate } from "@/api/community/residence.ts";
6 6 const ruleFormRef = ref<InstanceType<typeof ElForm>>();
  7 +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例
7 8 // 声明props
8 9 const props = defineProps({
9 10 formObj: {
... ... @@ -83,14 +84,10 @@ let submitForm = (formEl: InstanceType&lt;typeof ElForm&gt; | undefined) =&gt; {
83 84 if (valid) {
84 85 console.log("111")
85 86 addOrUpdate(props.formObj).then((res) => {
86   - console.log(res);
87 87 emit("success");
88 88 });
89 89 } else {
90   - ElMessage({
91   - message: "请完善信息",
92   - type: "error",
93   - });
  90 + instance?.proxy?.$message.error('请完善信息')//调用
94 91 loading.value = false;
95 92 return false;
96 93 }
... ...
src/views/community/residence/index.vue
1 1 <script setup lang="ts">
2   -import { reactive, onMounted, ref } from "vue";
  2 +import { reactive, onMounted,getCurrentInstance } from "vue";
3 3 import { getTableList, deleteNeighborhood } from "@/api/community/residence.ts";
4 4 import CommunityDetail from "./communityDetail.vue";
5 5 import Pagination from "@/components/Pagination/index.vue";
6   -import { ElMessage } from "element-plus";
  6 +
  7 +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例
7 8 // 数据筛选
8 9 const searchData = reactive({
9 10 propertyId: 1,
... ... @@ -46,7 +47,6 @@ const search = (): void =&gt; {
46 47 const edit = (row: Object) => {
47 48 data.formObj = row;
48 49 data.dialogVisible = true;
49   - console.log(data.formObj);
50 50 };
51 51 /**
52 52 * 删除
... ... @@ -54,7 +54,7 @@ const edit = (row: Object) =&gt; {
54 54 */
55 55 const remove = (neighborhoodId: number) => {
56 56 deleteNeighborhood({ neighborhoodId: neighborhoodId }).then((res) => {
57   - ElMessage.success("操作成功");
  57 + instance?.proxy?.$message.success('操作成功')//调用
58 58 search();
59 59 });
60 60 };
... ...