Commit e651226a8580bc3451b8d39a2854eefe643006ee

Authored by 张红振
1 parent 031bdd9c

fix bug

src/views/community/housekeeper/houseDetail.vue
1 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 9 import { addOrUpdate } from "@/api/community/housekeeper.ts";
4 10 import { getTableList } from "@/api/community/residence.ts";
5 11  
6 12 const ruleFormRef = ref<InstanceType<typeof ElForm>>();
7 13 let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例
8 14  
9   -
10 15 // 声明props
11 16 const props = defineProps({
12 17 formObj: {
... ... @@ -102,6 +107,12 @@ const emit = defineEmits&lt;{
102 107 }>();
103 108  
104 109 /**
  110 + * 重置
  111 + */
  112 +let resetForm = () => {
  113 + ruleFormRef.value.resetFields();
  114 +};
  115 +/**
105 116 * 表单提交
106 117 * @param {ElForm | undefined} formEl 表单对象
107 118 */
... ... @@ -110,14 +121,14 @@ let submitForm = (formEl: InstanceType&lt;typeof ElForm&gt; | undefined) =&gt; {
110 121 if (!formEl) return;
111 122 formEl.validate((valid) => {
112 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 132 } else {
122 133 instance?.proxy?.$message.error("请完善信息"); //调用
123 134 loading.value = false;
... ... @@ -132,6 +143,10 @@ let submitForm = (formEl: InstanceType&lt;typeof ElForm&gt; | undefined) =&gt; {
132 143 const cancel: void = () => {
133 144 emit("cancel");
134 145 };
  146 +
  147 +defineExpose({
  148 + resetForm,
  149 +});
135 150 </script>
136 151  
137 152 <template>
... ...
src/views/community/housekeeper/index.vue
1 1 <script setup lang="ts">
2   -import { reactive, onMounted, getCurrentInstance } from "vue";
  2 +import { reactive, onMounted, ref, getCurrentInstance } from "vue";
3 3 import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts";
4 4 import { parseTime } from "@/utils/tool.ts";
5 5 import HouseDetail from "./houseDetail.vue";
... ... @@ -7,7 +7,7 @@ import Pagination from &quot;@/components/Pagination/index.vue&quot;;
7 7 import { useRoute } from "vue-router";
8 8  
9 9 let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例
10   -
  10 +const houseDetailRef = ref(null);
11 11 let route = useRoute(); // 路由
12 12  
13 13 // 数据筛选
... ... @@ -50,9 +50,9 @@ const search = (): void =&gt; {
50 50 * @param { Object } 列表对象
51 51 */
52 52 const edit = (row: Object) => {
  53 + data.title = "编辑楼宇";
53 54 data.formObj = row;
54 55 data.dialogVisible = true;
55   - console.log(data.formObj);
56 56 };
57 57 /**
58 58 * 删除
... ... @@ -84,7 +84,9 @@ const changeData: void = () =&gt; {
84 84 * 弹框关闭
85 85 */
86 86 const dialogClose: void = () => {
  87 + data.title = "新增楼宇";
87 88 data.formObj = {};
  89 + houseDetailRef.value.resetForm();
88 90 };
89 91 onMounted(() => {
90 92 searchData.neighborhoodId = route.query.neighborhoodId
... ... @@ -145,7 +147,14 @@ onMounted(() =&gt; {
145 147 <el-table-column label="操作">
146 148 <template #default="scope">
147 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 158 <el-button type="text" size="mini" @click="edit(scope.row)"
150 159 >编辑</el-button
151 160 >
... ... @@ -173,6 +182,7 @@ onMounted(() =&gt; {
173 182 @close="dialogClose"
174 183 >
175 184 <HouseDetail
  185 + ref="houseDetailRef"
176 186 @cancel="data.dialogVisible = false"
177 187 @success="changeData"
178 188 :formObj="data.formObj"
... ...
src/views/community/houses/index.vue
1 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 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 { 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 12 const searchData = reactive({
11   - buildingId: 1,
  13 + buildingId: null,
12 14 type: 0,
13 15 roomNumber: null,
14 16 pageNum: 1,
... ... @@ -48,7 +50,7 @@ const search = (): void =&gt; {
48 50 const check = (houseId: number) => {
49 51 getHouse({ houseId: houseId }).then((res) => {
50 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) =&gt; {
57 59 * @param { number } houseId 房屋ID
58 60 */
59 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 76 onMounted(() => {
  77 + searchData.buildingId = route.query.buildingId
  78 + ? route.query.buildingId
  79 + : null;
67 80 search();
68 81 });
69 82 </script>
... ... @@ -100,7 +113,7 @@ onMounted(() =&gt; {
100 113 >
101 114 </el-table-column>
102 115 <el-table-column label="楼宇名称" prop="buildingName">
103   - <template #default="scope">
  116 + <template #default="scope">
104 117 <span>{{ scope.row.building.buildingName }}</span></template
105 118 >
106 119 </el-table-column>
... ... @@ -110,10 +123,13 @@ onMounted(() =&gt; {
110 123 <el-table-column label="使用面积" prop="useArea"></el-table-column>
111 124 <el-table-column label="操作" width="350px">
112 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 132 <el-button type="text" size="mini">查看业主</el-button>
116   - <el-button type="text" size="mini" @click="check(scope.row.id)">查看房屋</el-button>
117 133 <!-- <el-button type="text" size="mini" @click="edit(scope.row)"
118 134 >编辑</el-button
119 135 > -->
... ... @@ -140,9 +156,7 @@ onMounted(() =&gt; {
140 156 width="40%"
141 157 @close="data.dialogClose"
142 158 >
143   - <Detail
144   - :formObj="data.formObj"
145   - ></Detail>
  159 + <Detail :formObj="data.formObj"></Detail>
146 160 </el-dialog>
147 161 </div>
148 162 </template>
... ...
src/views/community/residence/communityDetail.vue
... ... @@ -82,10 +82,9 @@ let submitForm = (formEl: InstanceType&lt;typeof ElForm&gt; | undefined) =&gt; {
82 82 if (!formEl) return;
83 83 formEl.validate((valid) => {
84 84 if (valid) {
85   - console.log("111")
86 85 addOrUpdate(props.formObj).then((res) => {
87 86 loading.value = false;
88   - emit("success");
  87 + emit("success");
89 88 });
90 89 } else {
91 90 instance?.proxy?.$message.error('请完善信息')//调用
... ...
src/views/ownerManagement/owner/index.vue
... ... @@ -19,6 +19,11 @@ const data = reactive({
19 19 loading: false,
20 20 title: "新增小区",
21 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(() =&gt; {
80 85 <!-- 搜索 -->
81 86 <el-form :inline="true" :model="searchData" v-loading="data.loading">
82 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 97 </el-form-item>
89 98 <el-form-item
90 99 ><el-button type="primary" @click="search"
... ... @@ -104,12 +113,12 @@ onMounted(() =&gt; {
104 113  
105 114 <!-- 表格 -->
106 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 122 <el-table-column label="操作">
114 123 <template #default="scope">
115 124 <el-button type="text" size="mini" @click="edit(scope.row)"
... ...