From 18b8c4bc2f30fc59a47134cd7dae2fd35ce21294 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Mon, 11 Mar 2024 11:20:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/userHouse/hireInfoList.vue         |   32 +++-
 src/views/gzll/owners.vue                    |   52 +++---
 src/api/userHouse/list/houseRental.js        |   11 +
 src/views/userHouse/components/retalInfo.vue |  363 ++++++++++++++++++++++----------------------
 4 files changed, 241 insertions(+), 217 deletions(-)

diff --git a/src/api/userHouse/list/houseRental.js b/src/api/userHouse/list/houseRental.js
index b30272b..f4c226d 100644
--- a/src/api/userHouse/list/houseRental.js
+++ b/src/api/userHouse/list/houseRental.js
@@ -50,6 +50,17 @@
   })
 }
 
+
+export const updateInfo = (row) => {
+  return request({
+    url: '/api/blade-houseRental/houseRental/updateHouseRental',
+    method: 'post',
+    data: row
+  })
+}
+
+
+
 export const getDetatil = (id) => {
   return request({
     url: '/api/blade-houseRental/houseRental/detail',
diff --git a/src/views/gzll/owners.vue b/src/views/gzll/owners.vue
index 57b36b0..ae7209f 100644
--- a/src/views/gzll/owners.vue
+++ b/src/views/gzll/owners.vue
@@ -22,7 +22,7 @@
             </template>
         </avue-crud>
 
-        <el-drawer title="业委会成员" size="40%" append-to-body :visible.sync="memberFlag" :direction="'rtl'">
+        <el-drawer title="业委会成员" size="60%" append-to-body :visible.sync="memberFlag" :direction="'rtl'">
             <ownersMemberManager ref="ownersMemberManager" />
         </el-drawer>
     </basic-container>
@@ -282,31 +282,31 @@
                     value: 1
                 },
 
-                {
-                    width: 100,
-                    span: 12,
-                    label: "状态",
-                    slot: true,
-                    prop: "status",
-                    type: 'switch',
-                    activeColor: "#13ce66",
-                    inactiveColor: "#ccc",
-                    dicData: [{
-                        label: "关闭",
-                        value: 1
-                    },
-                    {
-                        label: "正常",
-                        value: 0
-                    },
-                    ],
-                    value: 0,
-                    rules: [{
-                        required: true,
-                        message: "请输入排序",
-                        trigger: "blur",
-                    },],
-                },
+                // {
+                //     width: 100,
+                //     span: 12,
+                //     label: "状态",
+                //     slot: true,
+                //     prop: "status",
+                //     type: 'switch',
+                //     activeColor: "#13ce66",
+                //     inactiveColor: "#ccc",
+                //     dicData: [{
+                //         label: "关闭",
+                //         value: 1
+                //     },
+                //     {
+                //         label: "正常",
+                //         value: 0
+                //     },
+                //     ],
+                //     value: 0,
+                //     rules: [{
+                //         required: true,
+                //         message: "请输入排序",
+                //         trigger: "blur",
+                //     },],
+                // },
 
                 {
                     span: 20,
diff --git a/src/views/userHouse/components/retalInfo.vue b/src/views/userHouse/components/retalInfo.vue
index 851f6a2..b297345 100644
--- a/src/views/userHouse/components/retalInfo.vue
+++ b/src/views/userHouse/components/retalInfo.vue
@@ -7,13 +7,12 @@
                 </avue-form>
 
 
-                <!-- <box-title class="m10" :classVal="9" :title="'租客信息'"></box-title>
-                <avue-crud :option="placeOption" :table-loading="loading" :data="placeExt" ref="crud"
-                    v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel"
-                    @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave" :page.sync="holdPage"
-                    @current-change="holdCurrentChange" @size-change="holdSizeChange"
-                    @refresh-change="refreshHoldChange" @on-load="holdOnLoad">
-                </avue-crud> -->
+                <box-title class="m10" :classVal="9" :title="'租客信息'"></box-title>
+                <avue-crud :option="placeOption" :data="houseRental" ref="tenantForm" v-model="houseHoldForm"
+                    :permission="permissionList" @row-del="houseHoldRowDel" @row-update="houseHoldRowUpdate"
+                    @row-save="houseHoldRowSave" :page.sync="holdPage" @current-change="holdCurrentChange"
+                    @size-change="holdSizeChange" @refresh-change="refreshHoldChange">
+                </avue-crud>
             </div>
 
             <div class="footer-btn-box">
@@ -44,13 +43,21 @@
 
 import {
     getList as getHouseList,
-    getDetatil as getHouseDetail 
+    getDetatil as getHouseDetail
 } from "@/api/userHouse/list/house.js"
 
 import {
     getDetatil,
-    update 
+    updateInfo,
+    add as addHouseRental
 } from "@/api/userHouse/list/houseRental.js"
+
+
+import {
+    getList as getHouseholdList,
+} from "@/api/userHouse/list/houseHold.js"
+
+
 
 import boxTitle from "./boxTitle"
 
@@ -133,7 +140,7 @@
                             data
                         }, callback) => {
                             //首次加载去查询对应的值
-                            if (value) {
+                            if (value && this.isEdit) {
                                 getHouseDetail({
                                     houseCode: value
                                 }).then(res => {
@@ -143,7 +150,7 @@
                                     return
                                 })
                             }
-                            if (page) {
+                            if (page && this.isEdit) {
                                 this.loading = true
                                 getHouseList(page.currentPage, page.pageSize, Object.assign(data)).then(res => {
                                     const resData = res.data.data
@@ -400,6 +407,11 @@
                     prop: "name",
                     // search: true,
                     searchSpan: 4,
+                    rules: [{
+                        required: true,
+                        message: "请输入姓名",
+                        trigger: "blur",
+                    },],
                 },
                 {
                     label: "电话",
@@ -414,52 +426,59 @@
                     width: 160,
                     // search: true,
                     searchSpan: 4,
-                },
-                {
-                    label: "性别",
-                    prop: "gender",
-                    type: "select",
-                    dicData: [{
-                        label: "男",
-                        value: 1
-                    },
-                    {
-                        label: "女",
-                        value: 0
-                    },
-                    {
-                        label: "未知",
-                        value: 1
-                    }
+                    rules: [
+                        {
+                            required: true,
+                            message: "请输身份证号",
+                            trigger: "blur",
+                        }
                     ],
                 },
-                {
-                    label: "关系",
-                    prop: "relationship",
-                    type: "select",
-                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
-                    dataType: "number",
-                    props: {
-                        label: "dictValue",
-                        value: "dictKey",
-                    },
-                    display: false
-                },
+                // {
+                //     label: "性别",
+                //     prop: "gender",
+                //     type: "select",
+                //     dicData: [{
+                //         label: "男",
+                //         value: 1
+                //     },
+                //     {
+                //         label: "女",
+                //         value: 0
+                //     },
+                //     {
+                //         label: "未知",
+                //         value: 1
+                //     }
+                //     ],
+                // },
+                // {
+                //     label: "关系",
+                //     prop: "relationship",
+                //     type: "select",
+                //     dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
+                //     dataType: "number",
+                //     props: {
+                //         label: "dictValue",
+                //         value: "dictKey",
+                //     },
+                //     display: false
+                // },
                 {
                     width: 220,
-                    overHidden: true,
-                    label: '小区名称',
-                    prop: "aoiName",
+                    // overHidden: true,
+                    label: '工作单位',
+                    prop: "employer",
                     // search: true,
                     searchSpan: 4,
-                    display: false
+
                 },
                 {
-                    label: "地址",
-                    prop: "address",
+                    label: "户籍地址",
+                    prop: "hukouRegistration",
                     minWidth: 160,
-                    overHidden: true,
-                    display: false
+                    // overHidden: true,
+
                 },
                 ]
             },
@@ -469,6 +488,13 @@
                 total: 0,
             },
             houseHoldForm: {},
+            houseRental: [],
+            holdPage: {
+                pageSize: 100,
+                currentPage: 1,
+                total: 0,
+            },
+            idEdit: false
         }
     },
 
@@ -478,44 +504,17 @@
 
     inject: ["placeElement"],
 
-    watch: {
-        'form.isNine': {
-            handler(newData) {
-                if (newData) {
-                    let nineTypeColumn = this.findObject(
-                        this.option.column,
-                        'nineType'
-                    )
-
-                    if (newData == 1) {
-                        nineTypeColumn.display = true
-                    } else {
-                        nineTypeColumn.display = false
-                    }
-                }
-            },
-        },
-        'form.isFront': {
-            handler(newData) {
-                if (newData) {
-                    let frontTypeColumn = this.findObject(
-                        this.option.column,
-                        'frontType'
-                    )
-
-                    if (newData == 1) {
-                        frontTypeColumn.display = true
-                    } else {
-                        frontTypeColumn.display = false
-                    }
-                }
-            },
-        }
-    },
     methods: {
-        initOpen(newData) {
+        initOpen(type, newData) {
+            if (type == 2) {
+                this.isEdit = true;
+                this.getInfo(newData);
+                this.onLoadHouseHold(newData);
+            } else {
+                this.houseRental = [];
+                this.houseHoldForm = {};
+            }
 
-            this.getInfo(newData);
             this.roleBox = true
             this.baseShow = true
             this.restShow = false
@@ -528,85 +527,12 @@
             this.form = {}
             this.placeForm = {}
 
-            const that = this
 
-            that.$axios
-                .all([getPlace(newData["id"]), getPlaceExt({
-                    placeId: newData["id"]
-                }), getPlaceList()])
-                .then(
-                    that.$axios.spread(function (baseInfo, restInfo) {
-                        that.form = baseInfo.data.data
-
-                        that.form.location = [
-                            that.form.lng,
-                            that.form.lat,
-                            that.form.location,
-                        ].join(",")
-
-                        if (that.form.imageUrls && that.form.imageUrls.length) {
-                            that.form.imageUrls = that.form.imageUrls
-                                .split(",")
-                                .filter((item) => item != "")
-                                .map((item) => website.minioUrl + item)
-                                .join(",")
-                        }
-
-                        if (
-                            that.form.placePoiLabelVOList &&
-                            that.form.placePoiLabelVOList.length
-                        ) {
-                            let lebelTwo = that.form.placePoiLabelVOList.find((item) => {
-                                return item.type == 2
-                            })
-
-                            if (lebelTwo) that.form.label = String(lebelTwo.poiCode)
-
-                            let lebelThree = that.form.placePoiLabelVOList.find((item) => {
-                                return item.type == 3
-                            })
-
-                            if (lebelThree) that.form.smallLabel = String(lebelThree.poiCode)
-                        }
-
-                        that.baseShow = true
-                        const data = restInfo.data.data
-
-                        if (data) {
-                            let imageUrls = data.imageUrls
-                            let planImageUrls = data.planImageUrls
-
-                            if (imageUrls && imageUrls.length) {
-                                imageUrls = imageUrls
-                                    .split(",")
-                                    .filter((item) => item != "")
-                                    .map((item) => website.minioUrl + item)
-                                    .join(",")
-                            }
-
-                            if (planImageUrls && planImageUrls.length) {
-                                planImageUrls = planImageUrls
-                                    .split(",")
-                                    .filter((item) => item != "")
-                                    .map((item) => website.minioUrl + item)
-                                    .join(",")
-                            }
-
-                            that.placeForm = {
-                                ...data,
-                                imageUrls,
-                                planImageUrls,
-                            }
-                        }
-
-                        that.restShow = true
-                    })
-                )
         },
 
         getInfo(id) {
             getDetatil(id).then(res => {
-                this.form = res.data.data 
+                this.form = res.data.data
                 if (this.form.fileUrls.length > 0) {
                     var urls = []
                     var names = this.form.fileUrls.split(",")
@@ -617,6 +543,18 @@
                 }
             })
         },
+
+        onLoadHouseHold(id) {
+            let params = {
+                housingRentalId: id
+            }
+            getHouseholdList(this.holdPage.currentPage, this.holdPage.pageSize, Object.assign(params)).then(res => {
+                const data = res.data.data
+                this.houseRental = data.records
+                this.loading = false
+            })
+        },
+
 
 
         locationDispose(data) {
@@ -636,6 +574,12 @@
         },
 
         houseHoldRowUpdate(row, index, done, loading) {
+            let item = this.houseRental[index];
+            item = row
+            this.$set(this.houseRental, index, item)
+            // this.houseRental[index] = row
+            done();
+            return;
             holdUpdate(row).then(
                 () => {
                     this.holdOnLoad(this.holdPage)
@@ -652,26 +596,39 @@
             )
         },
 
-        houseHoldRowDel(row) {
+        houseHoldRowDel(row, index) {
             this.$confirm("确定将选择数据删除?", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
             })
                 .then(() => {
-                    return holdRemove(row.id)
+                    // return holdRemove(row.id)
+                    this.houseRental.splice(index, 1);
                 })
-                .then(() => {
-                    this.holdOnLoad(this.holdPage)
 
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!",
-                    })
-                })
+
+
+            // .then(() => {
+            //     this.holdOnLoad(this.holdPage)
+
+            //     this.$message({
+            //         type: "success",
+            //         message: "操作成功!",
+            //     })
+            // })
         },
 
-        houseHoldRowSave(row, done, loading) {
+        houseHoldRowSave(row) {
+            console.log("===>", row)
+
+            this.$refs.tenantForm.validate((valid, done, msg) => {
+                if (valid) {
+                    this.houseRental.push(row);
+                    done();
+                }
+            })
+            return;
             holdAdd({
                 ...row,
                 placeId: this.curRow.id,
@@ -746,14 +703,56 @@
             this.$refs.baseForm.validate((valid, done, msg) => {
                 if (valid) {
                     if (this.form.fileUrls.length > 0) {
-                var urls = []
-                var split = this.form.fileUrls.split(",")
-                split.forEach(url => {
-                    var names = url.split("jczz/")
-                    urls.push(names[1])
+                        var urls = []
+                        var split = this.form.fileUrls.split(",")
+                        split.forEach(url => {
+                            var names = url.split("jczz/")
+                            urls.push(names[1])
+                        })
+                        this.form.fileUrls = urls.join(",")
+                    }
+                    this.form.householdVOList = this.houseRental;
+                    console.log("=====>", this.form);
+
+                    updateInfo(this.form).then(() => {
+                        this.$message({
+                            type: "success",
+                            message: "操作成功!"
+                        })
+                        this.getInfo(this.form.id);
+
+                        done()
+                        this.roleBoxClose()
+
+                    }, error => {
+                        window.console.log(error)
+                        loading()
+                    })
+                } else {
+                    console.log("error submit!!")
+                    return false
+                }
+            })
+        },
+
+        addRequest() {
+            addHouseRental(this.form).then(() => {
+                this.$message({
+                    type: "success",
+                    message: "操作成功!"
                 })
-                this.form.fileUrls = urls.join(",")
-            }
+                this.getInfo(this.form.id);
+
+                done()
+                this.roleBoxClose()
+
+            }, error => {
+                window.console.log(error)
+                loading()
+            })
+        },
+
+        updateRequest() {
             update(this.form).then(() => {
                 this.$message({
                     type: "success",
@@ -762,23 +761,21 @@
                 this.getInfo(this.form.id);
 
                 done()
+                this.roleBoxClose()
+
             }, error => {
                 window.console.log(error)
                 loading()
             })
-                } else {
-                    console.log("error submit!!")
-                    return false
-                }
-            })
         },
+
+
 
         roleBoxClose() {
             this.form = {}
-            this.placeForm = {}
-
+            this.houseHoldForm = {}
             this.$refs.baseForm && this.$refs.baseForm.resetForm()
-            this.$refs.restForm && this.$refs.restForm.resetForm()
+            this.$refs.tenantForm && this.$refs.tenantForm.resetForm()
             this.baseShow = false
             this.restShow = false
             this.roleBox = false
diff --git a/src/views/userHouse/hireInfoList.vue b/src/views/userHouse/hireInfoList.vue
index 28b301d..5d0b714 100644
--- a/src/views/userHouse/hireInfoList.vue
+++ b/src/views/userHouse/hireInfoList.vue
@@ -14,6 +14,9 @@
                     </template>
 
                     <template slot="menuLeft">
+                        <el-button type="primary" size="small" plain icon="el-icon-plus"
+                            v-if="permission.houseRental_add" @click="showEditMoel(1)">新 增
+                        </el-button>
                         <el-button type="danger" size="small" plain icon="el-icon-delete"
                             v-if="permission.houseRental_delete" @click="handleDelete">删 除
                         </el-button>
@@ -21,14 +24,20 @@
                     </template>
 
                     <template slot-scope="{row, size}" slot="menu">
-                        <!-- <el-button type="text" :size="size" icon="el-icon-edit" v-if="permission.houseRental_edit"
-                            @click="showEditMoel(row)">编 辑
-                        </el-button> -->
+                        <el-button type="text" :size="size" icon="el-icon-edit" v-if="permission.houseRental_edit"
+                            @click="showEditMoel(2,row)">编 辑
+                        </el-button>
 
 
                         <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
                             v-if="permission.househould_manager" @click="ManageTenants(row)">管理租户
                         </el-button>
+
+                        <!-- <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
+                             @click="ManageTenants(row)">管理租户
+                        </el-button> -->
+
+
                         <!--  <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入
             </el-button>
             <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
@@ -227,21 +236,23 @@
                 index: true,
                 selection: true,
                 viewBtn: true,
-                addBtn: true,
-                // editBtn: false,
+                addBtn: false,
+                editBtn: false,
                 dialogType: 'drawer',
                 dialogClickModal: false,
                 column: [
                     {
                         label: "房屋",
                         prop: "houseName",
-                        display: false
+                        display: false,
+                        width:120
                     },
                     {
                         label: "房屋",
                         prop: "houseCode",
                         hide: true,
                         type: "table",
+
                         children: {
                             border: true,
                             height: 400,
@@ -812,8 +823,13 @@
             })
         },
 
-        showEditMoel(item) {
-            this.$refs.RetalInfo.initOpen(item.id)
+        showEditMoel(type,item) {
+            if(type == 1){
+                this.$refs.RetalInfo.initOpen(type)
+            }else {
+                this.$refs.RetalInfo.initOpen(type,item.id)
+            }
+            
         },
     }
 }

--
Gitblit v1.9.3