From f2e4a9d500d2ae2a0ca0fe9ff8cb050c90ccaa2e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 05 Jan 2024 18:02:00 +0800
Subject: [PATCH] 所有图片字段需要调整

---
 src/views/userHouse/houseList.vue |  247 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 211 insertions(+), 36 deletions(-)

diff --git a/src/views/userHouse/houseList.vue b/src/views/userHouse/houseList.vue
index df8ddf2..fe280c0 100644
--- a/src/views/userHouse/houseList.vue
+++ b/src/views/userHouse/houseList.vue
@@ -40,6 +40,12 @@
                         <el-tag>{{ row.userTypeName }}</el-tag>
                     </template>
 
+                    <template slot-scope="{row}" slot="phone">
+                        <el-button type="text" @click="showStringDispose(row, 'phoneflag')">
+                            {{ textDispose(row, 'phoneflag', 'phone') }}
+                        </el-button>
+                    </template>
+
                     <template slot-scope="{row}" slot="userHouseLabelVOList">
                         {{ labelDispose(row.userHouseLabelVOList) }}
                     </template>
@@ -58,8 +64,8 @@
 
                 <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
                     <div id="" class="grid-container2">
-                        <div class="grid-item" :style="{ backgroundColor: item.color }" v-for="(item, index) in labelData "
-                            @click="changLabel(item)">
+                        <div class="grid-item" :style="{ backgroundColor: item.color }" v-for="(item, index) in labelData"
+                            :key="index" @click="changLabel(item)">
                             {{ item.name }}
                         </div>
                     </div>
@@ -88,6 +94,7 @@
                         </template>
                     </avue-form>
                 </el-dialog>
+
                 <el-dialog title="住户管理" append-to-body :visible.sync="householdManagerVisible" width="70%" height="60%">
                     <householdManager ref="householdManager" />
                 </el-dialog>
@@ -196,7 +203,7 @@
                 calcHeight: 80,
                 tip: false,
                 searchShow: true,
-                searchMenuSpan: 6,
+                searchMenuSpan: 3,
                 border: true,
                 index: true,
                 selection: true,
@@ -205,21 +212,6 @@
                 dialogClickModal: false,
                 menuWidth: 340,
                 column: [
-                    {
-                        width: 96,
-                        label: "所属街道",
-                        prop: "townStreetName",
-                    },
-                    {
-                        width: 160,
-                        label: "所属社区",
-                        prop: "neiName",
-                    },
-                    {
-                        width: 96,
-                        label: "所属网格",
-                        prop: "gridName",
-                    },
                     {
                         label: "房屋编号",
                         prop: "houseCode",
@@ -233,40 +225,155 @@
                         width: 180,
                         display: false
                     },
+
                     {
-                        width: 132,
-                        label: "小区",
-                        prop: "districtName",
-                        search: true,
-                        rules: [{
-                            required: true,
-                            message: "请选择小区",
-                            trigger: "blur",
-                        },],
+                        hide: true,
+                        parent: false,
+                        label: "小区名称",
+                        prop: "districtCode",
+                        type: 'tree',
+                        dicUrl: `/api/blade-district/district/getDistrictTree`,
+                        props: {
+                            label: "name",
+                            value: "id"
+                        },
+                        defaultExpandedKeys: ["361102003"],
+                        span: 12,
+                        width: 220,
+                        overHidden: true,
                     },
+
                     {
-                        label: "手机",
-                        prop: "phone",
+                        width: 220,
+                        overHidden: true,
+                        label: '小区名称',
+                        parent: false,
+                        prop: "districtName",
+                        searchSpan: 4,
+                        display: false,
+                        search: true,
+                    },
+
+                    {
+                        width: 110,
+                        label: "所属街道",
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        prop: "townStreetName",
+                        search: true,
+                        searchSpan: 4
+                    },
+
+                    {
+                        width: 156,
+                        overHidden: true,
+                        label: "所属社区",
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        prop: "neiName",
+                        search: true,
+                        searchSpan: 4,
                         rules: [{
                             required: true,
-                            message: "请输入绑定手机",
+                            message: "请选择所属社区",
                             trigger: "blur",
-                        },],
+                        }],
+                    },
+
+                    {
+                        hide: true,
+                        parent: false,
+                        label: "所属社区",
+                        prop: "neiCode",
+                        search: false,
+                        type: "tree",
+                        dicUrl: "/api/blade-system/region/tree",
+                        props: {
+                            label: "name",
+                            value: "id",
+                        },
+                        cascader: ["gridId"],
+                        rules: [
+                            {
+                                required: true,
+                                message: "请选择所属社区",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+
+                    {
+                        width: 110,
+                        overHidden: true,
+                        label: "所属网格",
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        prop: "gridName",
+                        rules: [{
+                            required: true,
+                            message: "请选择所属网格",
+                            trigger: "blur",
+                        }],
+                    },
+
+                    {
+                        hide: true,
+                        label: "所属网格",
+                        prop: "gridId",
+                        type: "tree",
+                        cell: true,
+                        props: {
+                            label: "gridName",
+                            value: "id",
+                        },
+                        dicUrl:
+                            "/api/blade-grid/grid/getGridList?communityCode={{neiCode}}",
+                        rules: [
+                            {
+                                required: true,
+                                message: "请选择所属网格",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+
+                    {
+                        label: "房屋照片",
+                        prop: "imageUrls",
+                        width: 80,
+                        type: "upload",
+                        listType: "picture-card",
+                        dataType: "string",
+                        multiple: true,
+                        action: "/api/blade-resource/oss/endpoint/put-file",
+                        propsHttp: {
+                            res: "data",
+                            name: 'name',
+                            url: "link",
+                        },
+                        span: 24,
+                    },
+
+                    {
+                        width: 110,
+                        label: "电话",
+                        prop: "phone",
+                        slot: true,
                     },
                     {
                         label: "幢",
                         prop: "building",
-                        hide: true
                     },
                     {
                         label: "单元",
                         prop: "unit",
-                        hide: true
                     },
                     {
                         label: "室",
                         prop: "room",
-                        hide: true
                     },
                     {
                         label: "楼层",
@@ -366,6 +473,20 @@
             }
         },
 
+        textDispose () {
+            return (row, flag, type) => {
+                if (row[flag] || row[type] == null) {
+                    return row[type]
+                } else {
+                    if (type == 'idCard') {
+                        return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
+                    } else {
+                        return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
+                    }
+                }
+            }
+        },
+
         labelDispose () {
             return (list) => {
                 return list.map(item => item.labelName).join(',')
@@ -414,6 +535,7 @@
             this.labelForm.remark = item.remark
         },
         manageLabel (item) {
+            this.loading = true
             this.currentRow = item
             this.labelFlag = true
             let params = {
@@ -422,7 +544,6 @@
             // 查询标签
             getLabelList(Object.assign(params)).then(res => {
                 const data = res.data.data
-                this.loading = false
                 // 查询详情
                 getDetatils({
                     houseCode: item.houseCode
@@ -443,6 +564,7 @@
                         })
                     }
                     this.labelData = data
+                    this.loading = false
                 })
             })
         },
@@ -454,6 +576,16 @@
             })
         },
         rowSave (row, done, loading) {
+            if (row.imageUrls.length > 0) {
+                var urls = []
+                var split = row.imageUrls.split(",")
+                split.forEach(url => {
+                    var names = url.split("jczz/")
+                    urls.push(names[1])
+                })
+                row.imageUrls = urls.join(",")
+            }
+
             add(row).then(() => {
                 this.initFlag = false
                 this.onLoad(this.page)
@@ -468,6 +600,16 @@
             })
         },
         rowUpdate (row, index, done, loading) {
+            if (row.imageUrls.length > 0) {
+                var urls = []
+                var split = row.imageUrls.split(",")
+                split.forEach(url => {
+                    var names = url.split("jczz/")
+                    urls.push(names[1])
+                })
+                row.imageUrls = urls.join(",")
+            }
+
             update(row).then(() => {
                 this.initFlag = false
                 this.onLoad(this.page)
@@ -577,6 +719,17 @@
                     id: this.form.id
                 }).then(res => {
                     this.form = res.data.data
+
+                    if (this.form.imageUrls) {
+                        if (this.form.imageUrls.length > 0) {
+                            var urls = []
+                            var names = this.form.imageUrls.split(",")
+                            names.forEach(name => {
+                                urls.push(website.minioUrl + name)
+                            })
+                            this.form.imageUrls = urls.join(",")
+                        }
+                    }
                 })
             }
             this.initFlag = true
@@ -594,12 +747,34 @@
         onLoad (page, params = {}) {
             this.loading = true
             getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-                const data = res.data.data
+                const data = {
+                    ...res.data.data,
+                    records: res.data.data.records.map(item => {
+                        if (item.imageUrls) {
+                            if (item.imageUrls.length > 0) {
+                                var urls = []
+                                var names = item.imageUrls.split(",")
+                                names.forEach(name => {
+                                    urls.push(website.minioUrl + name)
+                                })
+                                item.imageUrls = urls.join(",")
+                            }
+                        }
+
+                        return {
+                            ...item,
+                            'phoneflag': false,
+                        }
+                    })
+                }
                 this.page.total = data.total
                 this.data = data.records
                 this.loading = false
                 this.selectionClear()
             })
+        },
+        showStringDispose (row, type) {
+            row[type] = !row[type]
         }
     }
 }

--
Gitblit v1.9.3