Commit 5a8d0ae4e3087031bdbee955fd34f41ecd1f05bd

Authored by 张红振
1 parent 65e404ec

新增查询条件

src/views/community/housekeeper/index.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { reactive, onMounted, ref, getCurrentInstance, watchEffect } from "vue"; 2 import { reactive, onMounted, ref, getCurrentInstance, watchEffect } from "vue";
3 import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; 3 import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts";
  4 +import * as residence from "@/api/community/residence.ts";
4 import { parseTime } from "@/utils/tool.ts"; 5 import { parseTime } from "@/utils/tool.ts";
5 import HouseDetail from "./houseDetail.vue"; 6 import HouseDetail from "./houseDetail.vue";
6 import ChangeAdmin from "./changeAdmin.vue"; 7 import ChangeAdmin from "./changeAdmin.vue";
@@ -29,6 +30,7 @@ const data = reactive({ @@ -29,6 +30,7 @@ const data = reactive({
29 loading: false, 30 loading: false,
30 title: "新增楼宇", 31 title: "新增楼宇",
31 formObj: {}, 32 formObj: {},
  33 + communityList: [],
32 }); 34 });
33 // 更换楼管相关数据属性 35 // 更换楼管相关数据属性
34 const changeObj = reactive({ 36 const changeObj = reactive({
@@ -53,6 +55,17 @@ const search = (): void =&gt; { @@ -53,6 +55,17 @@ const search = (): void =&gt; {
53 data.loading = false; 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 * @param { Object } 列表对象 71 * @param { Object } 列表对象
@@ -94,7 +107,6 @@ const changeData: void = () =&gt; { @@ -94,7 +107,6 @@ const changeData: void = () =&gt; {
94 * 弹框关闭 107 * 弹框关闭
95 */ 108 */
96 const dialogClose: void = () => { 109 const dialogClose: void = () => {
97 - console.log(111);  
98 data.title = "新增楼宇"; 110 data.title = "新增楼宇";
99 data.formObj = {}; 111 data.formObj = {};
100 houseDetailRef.value.resetForm(); 112 houseDetailRef.value.resetForm();
@@ -141,15 +153,34 @@ watchEffect(() =&gt; { @@ -141,15 +153,34 @@ watchEffect(() =&gt; {
141 search(); 153 search();
142 } 154 }
143 }); 155 });
  156 +
  157 +onMounted(() => {
  158 + getSelectList();
  159 +});
144 </script> 160 </script>
145 161
146 <template> 162 <template>
147 <div class="app-container"> 163 <div class="app-container">
148 <!-- 搜索 --> 164 <!-- 搜索 -->
149 <el-form :inline="true" :model="searchData" @submit.native.prevent> 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 <el-form-item> 181 <el-form-item>
151 <el-input 182 <el-input
152 - placeholder="请输入楼宇名称/楼管姓名" 183 + placeholder="请输入楼管姓名"
153 v-model="searchData.name" 184 v-model="searchData.name"
154 clearable 185 clearable
155 ></el-input> 186 ></el-input>
@@ -183,22 +214,44 @@ watchEffect(() =&gt; { @@ -183,22 +214,44 @@ watchEffect(() =&gt; {
183 <span>{{ scope.row.neighborhood.name }}</span></template 214 <span>{{ scope.row.neighborhood.name }}</span></template
184 > 215 >
185 </el-table-column> 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 <el-table-column label="建成日期" prop="createTime"> 232 <el-table-column label="建成日期" prop="createTime">
190 <template #default="scope"> 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 </template> 239 </template>
193 </el-table-column> 240 </el-table-column>
194 <el-table-column label="建筑面积" prop="grossArea" align="center"> 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 </template> 246 </template>
198 </el-table-column> 247 </el-table-column>
199 <el-table-column label="使用面积" prop="employArea" align="center"> 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 </template> 255 </template>
203 </el-table-column> 256 </el-table-column>
204 <el-table-column label="楼管姓名" align="center"> 257 <el-table-column label="楼管姓名" align="center">
src/views/community/houses/index.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { reactive, onMounted, getCurrentInstance, watchEffect } from "vue"; 2 import { reactive, onMounted, getCurrentInstance, watchEffect } from "vue";
3 import { getTableList, deleteHouse, getHouse } from "@/api/community/houses.ts"; 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 import { parseTime } from "@/utils/tool.ts"; 6 import { parseTime } from "@/utils/tool.ts";
5 import Detail from "./detail.vue"; 7 import Detail from "./detail.vue";
6 import BuildOwner from "./buildOwner.vue"; 8 import BuildOwner from "./buildOwner.vue";
@@ -18,6 +20,7 @@ const searchData = reactive({ @@ -18,6 +20,7 @@ const searchData = reactive({
18 roomNumber: null, 20 roomNumber: null,
19 page: 1, 21 page: 1,
20 pageSize: 10, 22 pageSize: 10,
  23 + neighborhoodId: null,
21 }); 24 });
22 // 展示 25 // 展示
23 const data = reactive({ 26 const data = reactive({
@@ -27,6 +30,8 @@ const data = reactive({ @@ -27,6 +30,8 @@ const data = reactive({
27 loading: false, 30 loading: false,
28 title: "房屋详情", 31 title: "房屋详情",
29 formObj: {}, 32 formObj: {},
  33 + communityList: [],
  34 + buildingList: [],
30 }); 35 });
31 // 绑定业主相关变量 36 // 绑定业主相关变量
32 const build = reactive({ 37 const build = reactive({
@@ -61,6 +66,40 @@ const search = (): void =&gt; { @@ -61,6 +66,40 @@ const search = (): void =&gt; {
61 data.loading = false; 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 * @param { number } houseId 房屋ID 105 * @param { number } houseId 房屋ID
@@ -121,12 +160,48 @@ watchEffect(() =&gt; { @@ -121,12 +160,48 @@ watchEffect(() =&gt; {
121 search(); 160 search();
122 } 161 }
123 }); 162 });
  163 +
  164 +onMounted(() => {
  165 + getSelectList();
  166 +});
124 </script> 167 </script>
125 168
126 <template> 169 <template>
127 <div class="app-container"> 170 <div class="app-container">
128 <!-- 搜索 --> 171 <!-- 搜索 -->
129 <el-form :inline="true" :model="searchData" @submit.native.prevent> 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 <el-form-item> 205 <el-form-item>
131 <el-input 206 <el-input
132 placeholder="请输入房间号" 207 placeholder="请输入房间号"
@@ -134,6 +209,7 @@ watchEffect(() =&gt; { @@ -134,6 +209,7 @@ watchEffect(() =&gt; {
134 clearable 209 clearable
135 ></el-input> 210 ></el-input>
136 </el-form-item> 211 </el-form-item>
  212 +
137 <el-form-item 213 <el-form-item
138 ><el-button type="primary" @click="search" 214 ><el-button type="primary" @click="search"
139 >查询</el-button 215 >查询</el-button
@@ -161,8 +237,16 @@ watchEffect(() =&gt; { @@ -161,8 +237,16 @@ watchEffect(() =&gt; {
161 <span>{{ scope.row.building?.buildingName }}</span></template 237 <span>{{ scope.row.building?.buildingName }}</span></template
162 > 238 >
163 </el-table-column> 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 <el-table-column label="建筑面积" prop="grossArea" align="center"> 250 <el-table-column label="建筑面积" prop="grossArea" align="center">
167 <template #default="scope"> 251 <template #default="scope">
168 <span>{{ 252 <span>{{