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