Commit e651226a8580bc3451b8d39a2854eefe643006ee
1 parent
031bdd9c
fix bug
Showing
5 changed files
with
90 additions
and
43 deletions
src/views/community/housekeeper/houseDetail.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | 2 | +import { |
| 3 | + reactive, | ||
| 4 | + ref, | ||
| 5 | + onMounted, | ||
| 6 | + getCurrentInstance, | ||
| 7 | + defineExpose, | ||
| 8 | +} from "vue"; | ||
| 3 | import { addOrUpdate } from "@/api/community/housekeeper.ts"; | 9 | import { addOrUpdate } from "@/api/community/housekeeper.ts"; |
| 4 | import { getTableList } from "@/api/community/residence.ts"; | 10 | import { getTableList } from "@/api/community/residence.ts"; |
| 5 | 11 | ||
| 6 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | 12 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 7 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | 13 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 8 | 14 | ||
| 9 | - | ||
| 10 | // 声明props | 15 | // 声明props |
| 11 | const props = defineProps({ | 16 | const props = defineProps({ |
| 12 | formObj: { | 17 | formObj: { |
| @@ -102,6 +107,12 @@ const emit = defineEmits<{ | @@ -102,6 +107,12 @@ const emit = defineEmits<{ | ||
| 102 | }>(); | 107 | }>(); |
| 103 | 108 | ||
| 104 | /** | 109 | /** |
| 110 | + * 重置 | ||
| 111 | + */ | ||
| 112 | +let resetForm = () => { | ||
| 113 | + ruleFormRef.value.resetFields(); | ||
| 114 | +}; | ||
| 115 | +/** | ||
| 105 | * 表单提交 | 116 | * 表单提交 |
| 106 | * @param {ElForm | undefined} formEl 表单对象 | 117 | * @param {ElForm | undefined} formEl 表单对象 |
| 107 | */ | 118 | */ |
| @@ -110,14 +121,14 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -110,14 +121,14 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 110 | if (!formEl) return; | 121 | if (!formEl) return; |
| 111 | formEl.validate((valid) => { | 122 | formEl.validate((valid) => { |
| 112 | if (valid) { | 123 | if (valid) { |
| 113 | - console.log("111"); | ||
| 114 | - addOrUpdate(props.formObj).then((res) => { | ||
| 115 | - console.log(111) | ||
| 116 | - loading.value = false; | ||
| 117 | - emit("success"); | ||
| 118 | - }).catch((err) => { | ||
| 119 | - console.log(err) | ||
| 120 | - }) | 124 | + addOrUpdate(props.formObj) |
| 125 | + .then((res) => { | ||
| 126 | + loading.value = false; | ||
| 127 | + emit("success"); | ||
| 128 | + }) | ||
| 129 | + .catch((err) => { | ||
| 130 | + console.log(err); | ||
| 131 | + }); | ||
| 121 | } else { | 132 | } else { |
| 122 | instance?.proxy?.$message.error("请完善信息"); //调用 | 133 | instance?.proxy?.$message.error("请完善信息"); //调用 |
| 123 | loading.value = false; | 134 | loading.value = false; |
| @@ -132,6 +143,10 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -132,6 +143,10 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 132 | const cancel: void = () => { | 143 | const cancel: void = () => { |
| 133 | emit("cancel"); | 144 | emit("cancel"); |
| 134 | }; | 145 | }; |
| 146 | + | ||
| 147 | +defineExpose({ | ||
| 148 | + resetForm, | ||
| 149 | +}); | ||
| 135 | </script> | 150 | </script> |
| 136 | 151 | ||
| 137 | <template> | 152 | <template> |
src/views/community/housekeeper/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, getCurrentInstance } from "vue"; | 2 | +import { reactive, onMounted, ref, getCurrentInstance } from "vue"; |
| 3 | import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; | 3 | import { getTableList, deleteBuilding } 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"; |
| @@ -7,7 +7,7 @@ import Pagination from "@/components/Pagination/index.vue"; | @@ -7,7 +7,7 @@ import Pagination from "@/components/Pagination/index.vue"; | ||
| 7 | import { useRoute } from "vue-router"; | 7 | import { useRoute } from "vue-router"; |
| 8 | 8 | ||
| 9 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | 9 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 10 | - | 10 | +const houseDetailRef = ref(null); |
| 11 | let route = useRoute(); // 路由 | 11 | let route = useRoute(); // 路由 |
| 12 | 12 | ||
| 13 | // 数据筛选 | 13 | // 数据筛选 |
| @@ -50,9 +50,9 @@ const search = (): void => { | @@ -50,9 +50,9 @@ const search = (): void => { | ||
| 50 | * @param { Object } 列表对象 | 50 | * @param { Object } 列表对象 |
| 51 | */ | 51 | */ |
| 52 | const edit = (row: Object) => { | 52 | const edit = (row: Object) => { |
| 53 | + data.title = "编辑楼宇"; | ||
| 53 | data.formObj = row; | 54 | data.formObj = row; |
| 54 | data.dialogVisible = true; | 55 | data.dialogVisible = true; |
| 55 | - console.log(data.formObj); | ||
| 56 | }; | 56 | }; |
| 57 | /** | 57 | /** |
| 58 | * 删除 | 58 | * 删除 |
| @@ -84,7 +84,9 @@ const changeData: void = () => { | @@ -84,7 +84,9 @@ const changeData: void = () => { | ||
| 84 | * 弹框关闭 | 84 | * 弹框关闭 |
| 85 | */ | 85 | */ |
| 86 | const dialogClose: void = () => { | 86 | const dialogClose: void = () => { |
| 87 | + data.title = "新增楼宇"; | ||
| 87 | data.formObj = {}; | 88 | data.formObj = {}; |
| 89 | + houseDetailRef.value.resetForm(); | ||
| 88 | }; | 90 | }; |
| 89 | onMounted(() => { | 91 | onMounted(() => { |
| 90 | searchData.neighborhoodId = route.query.neighborhoodId | 92 | searchData.neighborhoodId = route.query.neighborhoodId |
| @@ -145,7 +147,14 @@ onMounted(() => { | @@ -145,7 +147,14 @@ onMounted(() => { | ||
| 145 | <el-table-column label="操作"> | 147 | <el-table-column label="操作"> |
| 146 | <template #default="scope"> | 148 | <template #default="scope"> |
| 147 | <el-button type="text" size="mini">更换楼管</el-button> | 149 | <el-button type="text" size="mini">更换楼管</el-button> |
| 148 | - <el-button type="text" size="mini">房屋管理</el-button> | 150 | + <router-link |
| 151 | + :to="{ | ||
| 152 | + name: 'houses', | ||
| 153 | + query: { buildingId: scope.row.id }, | ||
| 154 | + }" | ||
| 155 | + > | ||
| 156 | + <el-button type="text" size="mini">房屋管理</el-button> | ||
| 157 | + </router-link> | ||
| 149 | <el-button type="text" size="mini" @click="edit(scope.row)" | 158 | <el-button type="text" size="mini" @click="edit(scope.row)" |
| 150 | >编辑</el-button | 159 | >编辑</el-button |
| 151 | > | 160 | > |
| @@ -173,6 +182,7 @@ onMounted(() => { | @@ -173,6 +182,7 @@ onMounted(() => { | ||
| 173 | @close="dialogClose" | 182 | @close="dialogClose" |
| 174 | > | 183 | > |
| 175 | <HouseDetail | 184 | <HouseDetail |
| 185 | + ref="houseDetailRef" | ||
| 176 | @cancel="data.dialogVisible = false" | 186 | @cancel="data.dialogVisible = false" |
| 177 | @success="changeData" | 187 | @success="changeData" |
| 178 | :formObj="data.formObj" | 188 | :formObj="data.formObj" |
src/views/community/houses/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted,getCurrentInstance } from "vue"; | ||
| 3 | -import { getTableList, deleteHouse,getHouse } from "@/api/community/houses.ts"; | 2 | +import { reactive, onMounted, getCurrentInstance } from "vue"; |
| 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 { useRoute } from "vue-router"; | ||
| 7 | 8 | ||
| 8 | -let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例 | 9 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 10 | +let route = useRoute(); // 路由 | ||
| 9 | // 数据筛选 | 11 | // 数据筛选 |
| 10 | const searchData = reactive({ | 12 | const searchData = reactive({ |
| 11 | - buildingId: 1, | 13 | + buildingId: null, |
| 12 | type: 0, | 14 | type: 0, |
| 13 | roomNumber: null, | 15 | roomNumber: null, |
| 14 | pageNum: 1, | 16 | pageNum: 1, |
| @@ -48,7 +50,7 @@ const search = (): void => { | @@ -48,7 +50,7 @@ const search = (): void => { | ||
| 48 | const check = (houseId: number) => { | 50 | const check = (houseId: number) => { |
| 49 | getHouse({ houseId: houseId }).then((res) => { | 51 | getHouse({ houseId: houseId }).then((res) => { |
| 50 | data.formObj = res.data.data; | 52 | data.formObj = res.data.data; |
| 51 | - data.dialogVisible=true; | 53 | + data.dialogVisible = true; |
| 52 | }); | 54 | }); |
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| @@ -57,13 +59,24 @@ const check = (houseId: number) => { | @@ -57,13 +59,24 @@ const check = (houseId: number) => { | ||
| 57 | * @param { number } houseId 房屋ID | 59 | * @param { number } houseId 房屋ID |
| 58 | */ | 60 | */ |
| 59 | const remove = (houseId: number) => { | 61 | const remove = (houseId: number) => { |
| 60 | - deleteHouse({ houseId: houseId }).then((res) => { | ||
| 61 | - instance?.proxy?.$message.success('操作成功')//调用 | ||
| 62 | - search(); | ||
| 63 | - }); | 62 | + instance?.proxy?.$messageBox |
| 63 | + .confirm("确认要进行此操作?", "提示", { | ||
| 64 | + confirmButtonText: "确定", | ||
| 65 | + cancelButtonText: "取消", | ||
| 66 | + }) | ||
| 67 | + .then(() => { | ||
| 68 | + deleteHouse({ houseId: houseId }).then((res) => { | ||
| 69 | + instance?.proxy?.$message.success("操作成功"); //调用 | ||
| 70 | + search(); | ||
| 71 | + }); | ||
| 72 | + }) | ||
| 73 | + .catch((err) => {}); | ||
| 64 | }; | 74 | }; |
| 65 | 75 | ||
| 66 | onMounted(() => { | 76 | onMounted(() => { |
| 77 | + searchData.buildingId = route.query.buildingId | ||
| 78 | + ? route.query.buildingId | ||
| 79 | + : null; | ||
| 67 | search(); | 80 | search(); |
| 68 | }); | 81 | }); |
| 69 | </script> | 82 | </script> |
| @@ -100,7 +113,7 @@ onMounted(() => { | @@ -100,7 +113,7 @@ onMounted(() => { | ||
| 100 | > | 113 | > |
| 101 | </el-table-column> | 114 | </el-table-column> |
| 102 | <el-table-column label="楼宇名称" prop="buildingName"> | 115 | <el-table-column label="楼宇名称" prop="buildingName"> |
| 103 | - <template #default="scope"> | 116 | + <template #default="scope"> |
| 104 | <span>{{ scope.row.building.buildingName }}</span></template | 117 | <span>{{ scope.row.building.buildingName }}</span></template |
| 105 | > | 118 | > |
| 106 | </el-table-column> | 119 | </el-table-column> |
| @@ -110,10 +123,13 @@ onMounted(() => { | @@ -110,10 +123,13 @@ onMounted(() => { | ||
| 110 | <el-table-column label="使用面积" prop="useArea"></el-table-column> | 123 | <el-table-column label="使用面积" prop="useArea"></el-table-column> |
| 111 | <el-table-column label="操作" width="350px"> | 124 | <el-table-column label="操作" width="350px"> |
| 112 | <template #default="scope"> | 125 | <template #default="scope"> |
| 113 | - <el-button type="text" size="mini">更换楼管</el-button> | ||
| 114 | - <el-button type="text" size="mini">房屋管理</el-button> | 126 | + <el-button type="text" size="mini">绑定业主</el-button> |
| 127 | + <el-button type="text" size="mini">取消绑定</el-button> | ||
| 128 | + | ||
| 129 | + <el-button type="text" size="mini" @click="check(scope.row.id)" | ||
| 130 | + >查看房屋</el-button | ||
| 131 | + > | ||
| 115 | <el-button type="text" size="mini">查看业主</el-button> | 132 | <el-button type="text" size="mini">查看业主</el-button> |
| 116 | - <el-button type="text" size="mini" @click="check(scope.row.id)">查看房屋</el-button> | ||
| 117 | <!-- <el-button type="text" size="mini" @click="edit(scope.row)" | 133 | <!-- <el-button type="text" size="mini" @click="edit(scope.row)" |
| 118 | >编辑</el-button | 134 | >编辑</el-button |
| 119 | > --> | 135 | > --> |
| @@ -140,9 +156,7 @@ onMounted(() => { | @@ -140,9 +156,7 @@ onMounted(() => { | ||
| 140 | width="40%" | 156 | width="40%" |
| 141 | @close="data.dialogClose" | 157 | @close="data.dialogClose" |
| 142 | > | 158 | > |
| 143 | - <Detail | ||
| 144 | - :formObj="data.formObj" | ||
| 145 | - ></Detail> | 159 | + <Detail :formObj="data.formObj"></Detail> |
| 146 | </el-dialog> | 160 | </el-dialog> |
| 147 | </div> | 161 | </div> |
| 148 | </template> | 162 | </template> |
src/views/community/residence/communityDetail.vue
| @@ -82,10 +82,9 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -82,10 +82,9 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 82 | if (!formEl) return; | 82 | if (!formEl) return; |
| 83 | formEl.validate((valid) => { | 83 | formEl.validate((valid) => { |
| 84 | if (valid) { | 84 | if (valid) { |
| 85 | - console.log("111") | ||
| 86 | addOrUpdate(props.formObj).then((res) => { | 85 | addOrUpdate(props.formObj).then((res) => { |
| 87 | loading.value = false; | 86 | loading.value = false; |
| 88 | - emit("success"); | 87 | + emit("success"); |
| 89 | }); | 88 | }); |
| 90 | } else { | 89 | } else { |
| 91 | instance?.proxy?.$message.error('请完善信息')//调用 | 90 | instance?.proxy?.$message.error('请完善信息')//调用 |
src/views/ownerManagement/owner/index.vue
| @@ -19,6 +19,11 @@ const data = reactive({ | @@ -19,6 +19,11 @@ const data = reactive({ | ||
| 19 | loading: false, | 19 | loading: false, |
| 20 | title: "新增小区", | 20 | title: "新增小区", |
| 21 | formObj: {}, | 21 | formObj: {}, |
| 22 | + options:[ | ||
| 23 | + {label:'业主',value:1}, | ||
| 24 | + {label:'租户',value:2}, | ||
| 25 | + {label:'住户',value:3} | ||
| 26 | + ] | ||
| 22 | }); | 27 | }); |
| 23 | 28 | ||
| 24 | /** | 29 | /** |
| @@ -80,11 +85,15 @@ onMounted(() => { | @@ -80,11 +85,15 @@ onMounted(() => { | ||
| 80 | <!-- 搜索 --> | 85 | <!-- 搜索 --> |
| 81 | <el-form :inline="true" :model="searchData" v-loading="data.loading"> | 86 | <el-form :inline="true" :model="searchData" v-loading="data.loading"> |
| 82 | <el-form-item> | 87 | <el-form-item> |
| 83 | - <el-input | ||
| 84 | - placeholder="请输入社区名称" | ||
| 85 | - v-model="searchData.name" | ||
| 86 | - clearable | ||
| 87 | - ></el-input> | 88 | + <el-select v-model="searchData.isOwner" placeholder="请选择类型"> |
| 89 | + <el-option | ||
| 90 | + v-for="item in data.options" | ||
| 91 | + :key="item.value" | ||
| 92 | + :label="item.label" | ||
| 93 | + :value="item.value" | ||
| 94 | + > | ||
| 95 | + </el-option> | ||
| 96 | + </el-select> | ||
| 88 | </el-form-item> | 97 | </el-form-item> |
| 89 | <el-form-item | 98 | <el-form-item |
| 90 | ><el-button type="primary" @click="search" | 99 | ><el-button type="primary" @click="search" |
| @@ -104,12 +113,12 @@ onMounted(() => { | @@ -104,12 +113,12 @@ onMounted(() => { | ||
| 104 | 113 | ||
| 105 | <!-- 表格 --> | 114 | <!-- 表格 --> |
| 106 | <el-table border :data="data.tableList"> | 115 | <el-table border :data="data.tableList"> |
| 107 | - <el-table-column label="小区名称" prop="name"></el-table-column> | ||
| 108 | - <el-table-column label="楼座数" prop="buildingCount"></el-table-column> | ||
| 109 | - <el-table-column label="储藏室数" prop="storeroomCount"></el-table-column> | ||
| 110 | - <el-table-column label="车位数" prop="truckSpaceCount"></el-table-column> | ||
| 111 | - <el-table-column label="所在地区" prop="locality"></el-table-column> | ||
| 112 | - <el-table-column label="详细地址" prop="address"></el-table-column> | 116 | + <el-table-column label="房产名称" prop="name"></el-table-column> |
| 117 | + <el-table-column label="姓名" prop="buildingCount"></el-table-column> | ||
| 118 | + <el-table-column label="手机号" prop="storeroomCount"></el-table-column> | ||
| 119 | + <el-table-column label="身份证" prop="truckSpaceCount"></el-table-column> | ||
| 120 | + <el-table-column label="绑定日期" prop="locality"></el-table-column> | ||
| 121 | + <el-table-column label="类型" prop="address"></el-table-column> | ||
| 113 | <el-table-column label="操作"> | 122 | <el-table-column label="操作"> |
| 114 | <template #default="scope"> | 123 | <template #default="scope"> |
| 115 | <el-button type="text" size="mini" @click="edit(scope.row)" | 124 | <el-button type="text" size="mini" @click="edit(scope.row)" |