Commit 5a8d0ae4e3087031bdbee955fd34f41ecd1f05bd
1 parent
65e404ec
新增查询条件
Showing
2 changed files
with
149 additions
and
12 deletions
src/views/community/housekeeper/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { reactive, onMounted, ref, getCurrentInstance, watchEffect } from "vue"; |
| 3 | 3 | import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; |
| 4 | +import * as residence from "@/api/community/residence.ts"; | |
| 4 | 5 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | 6 | import HouseDetail from "./houseDetail.vue"; |
| 6 | 7 | import ChangeAdmin from "./changeAdmin.vue"; |
| ... | ... | @@ -29,6 +30,7 @@ const data = reactive({ |
| 29 | 30 | loading: false, |
| 30 | 31 | title: "新增楼宇", |
| 31 | 32 | formObj: {}, |
| 33 | + communityList: [], | |
| 32 | 34 | }); |
| 33 | 35 | // 更换楼管相关数据属性 |
| 34 | 36 | const changeObj = reactive({ |
| ... | ... | @@ -53,6 +55,17 @@ const search = (): void => { |
| 53 | 55 | data.loading = false; |
| 54 | 56 | }); |
| 55 | 57 | }; |
| 58 | + | |
| 59 | +/** | |
| 60 | + * 小区下拉列表查询 | |
| 61 | + */ | |
| 62 | +const getSelectList = (): void => { | |
| 63 | + residence.getTableList({ page: 1, pageSize: 10000, type: 0 }).then((res) => { | |
| 64 | + console.log(res); | |
| 65 | + data.communityList = res.data.data.list; | |
| 66 | + }); | |
| 67 | +}; | |
| 68 | + | |
| 56 | 69 | /** |
| 57 | 70 | * 编辑 |
| 58 | 71 | * @param { Object } 列表对象 |
| ... | ... | @@ -94,7 +107,6 @@ const changeData: void = () => { |
| 94 | 107 | * 弹框关闭 |
| 95 | 108 | */ |
| 96 | 109 | const dialogClose: void = () => { |
| 97 | - console.log(111); | |
| 98 | 110 | data.title = "新增楼宇"; |
| 99 | 111 | data.formObj = {}; |
| 100 | 112 | houseDetailRef.value.resetForm(); |
| ... | ... | @@ -141,15 +153,34 @@ watchEffect(() => { |
| 141 | 153 | search(); |
| 142 | 154 | } |
| 143 | 155 | }); |
| 156 | + | |
| 157 | +onMounted(() => { | |
| 158 | + getSelectList(); | |
| 159 | +}); | |
| 144 | 160 | </script> |
| 145 | 161 | |
| 146 | 162 | <template> |
| 147 | 163 | <div class="app-container"> |
| 148 | 164 | <!-- 搜索 --> |
| 149 | 165 | <el-form :inline="true" :model="searchData" @submit.native.prevent> |
| 166 | + <el-form-item prop="neighborhoodId"> | |
| 167 | + <el-select | |
| 168 | + v-model="searchData.neighborhoodId" | |
| 169 | + placeholder="请选择所属小区" | |
| 170 | + clearable | |
| 171 | + > | |
| 172 | + <el-option | |
| 173 | + v-for="item in data.communityList" | |
| 174 | + :key="item.id" | |
| 175 | + :label="item.name" | |
| 176 | + :value="item.id" | |
| 177 | + > | |
| 178 | + </el-option> | |
| 179 | + </el-select> | |
| 180 | + </el-form-item> | |
| 150 | 181 | <el-form-item> |
| 151 | 182 | <el-input |
| 152 | - placeholder="请输入楼宇名称/楼管姓名" | |
| 183 | + placeholder="请输入楼管姓名" | |
| 153 | 184 | v-model="searchData.name" |
| 154 | 185 | clearable |
| 155 | 186 | ></el-input> |
| ... | ... | @@ -183,22 +214,44 @@ watchEffect(() => { |
| 183 | 214 | <span>{{ scope.row.neighborhood.name }}</span></template |
| 184 | 215 | > |
| 185 | 216 | </el-table-column> |
| 186 | - <el-table-column label="楼宇名称" prop="buildingName" align="center"></el-table-column> | |
| 187 | - <el-table-column label="单元数" prop="unitCount" align="center"></el-table-column> | |
| 188 | - <el-table-column label="总房屋数量" prop="houseCount" align="center"></el-table-column> | |
| 217 | + <el-table-column | |
| 218 | + label="楼宇名称" | |
| 219 | + prop="buildingName" | |
| 220 | + align="center" | |
| 221 | + ></el-table-column> | |
| 222 | + <el-table-column | |
| 223 | + label="单元数" | |
| 224 | + prop="unitCount" | |
| 225 | + align="center" | |
| 226 | + ></el-table-column> | |
| 227 | + <el-table-column | |
| 228 | + label="总房屋数量" | |
| 229 | + prop="houseCount" | |
| 230 | + align="center" | |
| 231 | + ></el-table-column> | |
| 189 | 232 | <el-table-column label="建成日期" prop="createTime"> |
| 190 | 233 | <template #default="scope"> |
| 191 | - <span>{{ parseTime(new Date(scope.row.createTime).getTime()).split(' ')[0].split('-')[0] }}</span> | |
| 234 | + <span>{{ | |
| 235 | + parseTime(new Date(scope.row.createTime).getTime()) | |
| 236 | + .split(" ")[0] | |
| 237 | + .split("-")[0] | |
| 238 | + }}</span> | |
| 192 | 239 | </template> |
| 193 | 240 | </el-table-column> |
| 194 | 241 | <el-table-column label="建筑面积" prop="grossArea" align="center"> |
| 195 | - <template #default="scope"> | |
| 196 | - <span>{{ [0,null].includes(scope.row.grossArea) ?'--':scope.row.grossArea }}</span> | |
| 242 | + <template #default="scope"> | |
| 243 | + <span>{{ | |
| 244 | + [0, null].includes(scope.row.grossArea) ? "--" : scope.row.grossArea | |
| 245 | + }}</span> | |
| 197 | 246 | </template> |
| 198 | 247 | </el-table-column> |
| 199 | 248 | <el-table-column label="使用面积" prop="employArea" align="center"> |
| 200 | - <template #default="scope"> | |
| 201 | - <span>{{ [0,null].includes(scope.row.employArea) ?'--':scope.row.employArea }}</span> | |
| 249 | + <template #default="scope"> | |
| 250 | + <span>{{ | |
| 251 | + [0, null].includes(scope.row.employArea) | |
| 252 | + ? "--" | |
| 253 | + : scope.row.employArea | |
| 254 | + }}</span> | |
| 202 | 255 | </template> |
| 203 | 256 | </el-table-column> |
| 204 | 257 | <el-table-column label="楼管姓名" align="center"> | ... | ... |
src/views/community/houses/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { reactive, onMounted, getCurrentInstance, watchEffect } from "vue"; |
| 3 | 3 | import { getTableList, deleteHouse, getHouse } from "@/api/community/houses.ts"; |
| 4 | +import * as residence from "@/api/community/residence.ts"; | |
| 5 | +import * as housekeeper from "@/api/community/housekeeper.ts"; | |
| 4 | 6 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | 7 | import Detail from "./detail.vue"; |
| 6 | 8 | import BuildOwner from "./buildOwner.vue"; |
| ... | ... | @@ -18,6 +20,7 @@ const searchData = reactive({ |
| 18 | 20 | roomNumber: null, |
| 19 | 21 | page: 1, |
| 20 | 22 | pageSize: 10, |
| 23 | + neighborhoodId: null, | |
| 21 | 24 | }); |
| 22 | 25 | // 展示 |
| 23 | 26 | const data = reactive({ |
| ... | ... | @@ -27,6 +30,8 @@ const data = reactive({ |
| 27 | 30 | loading: false, |
| 28 | 31 | title: "房屋详情", |
| 29 | 32 | formObj: {}, |
| 33 | + communityList: [], | |
| 34 | + buildingList: [], | |
| 30 | 35 | }); |
| 31 | 36 | // 绑定业主相关变量 |
| 32 | 37 | const build = reactive({ |
| ... | ... | @@ -61,6 +66,40 @@ const search = (): void => { |
| 61 | 66 | data.loading = false; |
| 62 | 67 | }); |
| 63 | 68 | }; |
| 69 | + | |
| 70 | +/** | |
| 71 | + * 小区下拉列表查询 | |
| 72 | + */ | |
| 73 | +const getSelectList = (): void => { | |
| 74 | + residence.getTableList({ page: 1, pageSize: 10000, type: 0 }).then((res) => { | |
| 75 | + console.log(res); | |
| 76 | + data.communityList = res.data.data.list; | |
| 77 | + }); | |
| 78 | +}; | |
| 79 | + | |
| 80 | +/** | |
| 81 | + * 监听小区改变 | |
| 82 | + */ | |
| 83 | +const getHousekeeper = (event: Event): void => { | |
| 84 | + console.log(event); | |
| 85 | + if (event) { | |
| 86 | + housekeeper | |
| 87 | + .getTableList({ | |
| 88 | + page: 1, | |
| 89 | + pageSize: 10000, | |
| 90 | + type: 0, | |
| 91 | + neighborhoodId: event, | |
| 92 | + }) | |
| 93 | + .then((res) => { | |
| 94 | + data.buildingList = res.data.data.list; | |
| 95 | + searchData.buildingId = data.buildingList[0].id; | |
| 96 | + console.log(res); | |
| 97 | + }); | |
| 98 | + } else { | |
| 99 | + data.buildingList = []; | |
| 100 | + searchData.buildingId = null; | |
| 101 | + } | |
| 102 | +}; | |
| 64 | 103 | /** |
| 65 | 104 | * 详情 |
| 66 | 105 | * @param { number } houseId 房屋ID |
| ... | ... | @@ -121,12 +160,48 @@ watchEffect(() => { |
| 121 | 160 | search(); |
| 122 | 161 | } |
| 123 | 162 | }); |
| 163 | + | |
| 164 | +onMounted(() => { | |
| 165 | + getSelectList(); | |
| 166 | +}); | |
| 124 | 167 | </script> |
| 125 | 168 | |
| 126 | 169 | <template> |
| 127 | 170 | <div class="app-container"> |
| 128 | 171 | <!-- 搜索 --> |
| 129 | 172 | <el-form :inline="true" :model="searchData" @submit.native.prevent> |
| 173 | + <el-form-item prop="neighborhoodId"> | |
| 174 | + <el-select | |
| 175 | + v-model="searchData.neighborhoodId" | |
| 176 | + placeholder="请选择所属小区" | |
| 177 | + @change="getHousekeeper" | |
| 178 | + clearable | |
| 179 | + > | |
| 180 | + <el-option | |
| 181 | + v-for="item in data.communityList" | |
| 182 | + :key="item.id" | |
| 183 | + :label="item.name" | |
| 184 | + :value="item.id" | |
| 185 | + > | |
| 186 | + </el-option> | |
| 187 | + </el-select> | |
| 188 | + </el-form-item> | |
| 189 | + <el-form-item prop="buildingId"> | |
| 190 | + <el-select | |
| 191 | + v-model="searchData.buildingId" | |
| 192 | + placeholder="请选择楼宇" | |
| 193 | + @change="getHousekeeper" | |
| 194 | + clearable | |
| 195 | + > | |
| 196 | + <el-option | |
| 197 | + v-for="item in data.buildingList" | |
| 198 | + :key="item.id" | |
| 199 | + :label="item.buildingName" | |
| 200 | + :value="item.id" | |
| 201 | + > | |
| 202 | + </el-option> | |
| 203 | + </el-select> | |
| 204 | + </el-form-item> | |
| 130 | 205 | <el-form-item> |
| 131 | 206 | <el-input |
| 132 | 207 | placeholder="请输入房间号" |
| ... | ... | @@ -134,6 +209,7 @@ watchEffect(() => { |
| 134 | 209 | clearable |
| 135 | 210 | ></el-input> |
| 136 | 211 | </el-form-item> |
| 212 | + | |
| 137 | 213 | <el-form-item |
| 138 | 214 | ><el-button type="primary" @click="search" |
| 139 | 215 | >查询</el-button |
| ... | ... | @@ -161,8 +237,16 @@ watchEffect(() => { |
| 161 | 237 | <span>{{ scope.row.building?.buildingName }}</span></template |
| 162 | 238 | > |
| 163 | 239 | </el-table-column> |
| 164 | - <el-table-column label="单元" prop="unitNumber" align="center"></el-table-column> | |
| 165 | - <el-table-column label="房间号" prop="roomNumber" align="center"></el-table-column> | |
| 240 | + <el-table-column | |
| 241 | + label="单元" | |
| 242 | + prop="unitNumber" | |
| 243 | + align="center" | |
| 244 | + ></el-table-column> | |
| 245 | + <el-table-column | |
| 246 | + label="房间号" | |
| 247 | + prop="roomNumber" | |
| 248 | + align="center" | |
| 249 | + ></el-table-column> | |
| 166 | 250 | <el-table-column label="建筑面积" prop="grossArea" align="center"> |
| 167 | 251 | <template #default="scope"> |
| 168 | 252 | <span>{{ | ... | ... |