From ab701df859cd79ae036f8cc86268137d2c8da8ee Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Thu, 22 Feb 2024 18:00:56 +0800
Subject: [PATCH] 消防自查导出、消防自查和场所检查增加场所类别字段

---
 src/views/cGovernance/gridWorkLog.vue |  147 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 98 insertions(+), 49 deletions(-)

diff --git a/src/views/cGovernance/gridWorkLog.vue b/src/views/cGovernance/gridWorkLog.vue
index 9edb103..52bafe8 100644
--- a/src/views/cGovernance/gridWorkLog.vue
+++ b/src/views/cGovernance/gridWorkLog.vue
@@ -15,12 +15,19 @@
                     @click="handleDelete">删 除
                 </el-button>
             </template>
+
+            <template slot-scope="{row, size}" slot="phone">
+                <el-button :size="size" type="text" @click="showStringDispose(row, 'phoneflag')"
+                    v-text="textDispose(row, 'phoneflag', 'phone')">
+                </el-button>
+            </template>
         </avue-crud>
     </basic-container>
 </template>
 
 <script>
-import { getAllHouseHold } from "@/api/userHouse/list/houseHold"
+import { getPersonPublicSelect } from "@/api/public"
+import { getDetatils as householdDetail } from "@/api/userHouse/list/houseHold"
 import { getList, remove, update, add, getGridWorkLog } from "@/api/grid/gridWorkLog"
 import { getList as getHouseholdList, getDetatils as getHouseholdDetail } from "@/api/userHouse/list/houseHold"
 import { mapGetters } from "vuex"
@@ -42,14 +49,15 @@
             option: {
                 labelWidth: 120,
                 searchLabelWidth: 96,
+                searchShow: true,
+                searchMenuSpan: 3,
+                menuWidth: 210,
+
                 height: "auto",
                 calcHeight: 54,
                 dialogWidth: 950,
                 tip: false,
-                searchShow: true,
-                searchMenuSpan: 3,
-                menuWidth: 280,
-                border: false,
+                border: true,
                 //stripe:true,
                 index: true,
                 viewBtn: true,
@@ -58,11 +66,13 @@
                 dialogClickModal: false,
                 column: [
                     {
+                        width: 120,
                         label: "走访类型",
                         prop: "type",
                         span: 12,
                         searchSpan: 4,
                         search: true,
+                        searchLabelWidth: 76,
                         type: "select",
                         dicUrl: "/api/blade-system/dict-biz/dictionary?code=haveType",
                         dataType: "number",
@@ -127,12 +137,6 @@
                             value: 'id',
                         },
                         dicData: [],
-                        formatter: (row) => {
-                            this.form.phone = row.phoneNumber
-                            this.form.address = row.currentAddress
-
-                            return row.name
-                        },
                         rules: [
                             {
                                 required: true,
@@ -150,7 +154,9 @@
                         disabled: true,
                         searchSpan: 4,
                         search: true,
+                        slot: true
                     },
+
                     {
                         width: 156,
                         overHidden: true,
@@ -184,6 +190,23 @@
                         display: false,
                         prop: "gridName",
                     },
+                    {
+                        width: 144,
+                        label: "走访时间",
+                        prop: "workTime",
+                        searchLabelWidth: 120,
+                        type: "date",
+                        row: true,
+                        format: "yyyy-MM-dd HH:mm:ss",
+                        valueFormat: "yyyy-MM-dd HH:mm:ss",
+                        rules: [
+                            {
+                                required: true,
+                                message: "请输入走访时间",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
 
                     {
                         overHidden: true,
@@ -191,6 +214,13 @@
                         prop: "context",
                         type: "textarea",
                         span: 24,
+                        rules: [
+                            {
+                                required: true,
+                                message: "请输入走访内容",
+                                trigger: "blur",
+                            },
+                        ],
                     },
 
                     {
@@ -217,24 +247,10 @@
                         prop: "createUserName",
                     },
 
-                    {
-                        width: 144,
-                        label: "走访时间",
-                        prop: "workTime",
-                        searchLabelWidth: 120,
-                        type: "date",
-                        format: "yyyy-MM-dd HH:mm:ss",
-                        valueFormat: "yyyy-MM-dd HH:mm:ss",
-                        rules: [
-                            {
-                                required: true,
-                                message: "请输入走访时间",
-                                trigger: "blur",
-                            },
-                        ],
-                    },
+
 
                     {
+                        display: false,
                         width: 144,
                         label: "上报时间",
                         prop: "createTime",
@@ -257,6 +273,21 @@
     },
 
     watch: {
+        "form.householdId": {
+            handler (val) {
+                if (val) {
+
+                    householdDetail(val).then(res => {
+                        let data = res.data.data
+
+                        this.form.phone = data.phoneNumber
+                        this.form.address = data.currentAddress
+                    })
+
+                }
+            }
+        },
+
         'form.personType': {
             handler (newData) {
                 let householdIdColumn = this.findObject(
@@ -321,6 +352,20 @@
 
                 return data.name
             }
+        },
+
+        textDispose () {
+            return (row, flag, type) => {
+                if (row[flag] || row[type] == null) {
+                    return row[type]
+                } else {
+                    if (type == 'principalIdCard') {
+                        return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
+                    } else {
+                        return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
+                    }
+                }
+            }
         }
     },
 
@@ -329,12 +374,14 @@
     },
 
     methods: {
+        showStringDispose (row, type) {
+            row[type] = !row[type]
+        },
+
         getUserList (param = '') {
-            let dicUrl = `/blade-household/household/selectHouseholdList?labelId=${param}&searchKey={{key}}`
+            let dicUrl = `/api/blade-household/household/selectHouseholdList?labelId=${param}&searchKey={{key}}&limit=20`
             const column = this.findObject(this.option.column, "householdId")
             column.dicUrl = dicUrl
-
-            console.log(param, this.option.column, 9999)
         },
 
         rowSave (row, done, loading) {
@@ -447,20 +494,19 @@
             if (["edit", "view"].includes(type)) {
                 getGridWorkLog(this.form.id).then((res) => {
                     this.form = res.data.data
-                    if (this.form.url.length > 0) {
-                        var urls = []
-                        var names = this.form.url.split(",")
-                        names.forEach(name => {
-                            urls.push(website.minioUrl + name)
-                        })
-                        this.form.url = urls.join(",")
+                    if (this.form.url) {
+                        if (this.form.url.length > 0) {
+                            var urls = []
+                            var names = this.form.url.split(",")
+                            names.forEach(name => {
+                                urls.push(website.minioUrl + name)
+                            })
+                            this.form.url = urls.join(",")
+                        }
                     }
-
-                    let params = {
+                    getPersonPublicSelect({
                         id: this.form.householdId
-                    }
-
-                    getAllHouseHold(params).then(res => {
+                    }).then(res => {
                         const column = this.findObject(this.option.column, "householdId")
                         column.dicData = res.data.data
                     })
@@ -498,13 +544,16 @@
                 this.page.total = data.total
                 this.data = data.records
                 this.data.forEach(item => {
-                    if (item.url.length > 0) {
-                        var urls = []
-                        var names = item.url.split(",")
-                        names.forEach(name => {
-                            urls.push(website.minioUrl + name)
-                        })
-                        item.url = urls.join(",")
+                    this.$set(item, 'phoneflag', false)
+                    if (item.url) {
+                        if (item.url.length > 0) {
+                            var urls = []
+                            var names = item.url.split(",")
+                            names.forEach(name => {
+                                urls.push(website.minioUrl + name)
+                            })
+                            item.url = urls.join(",")
+                        }
                     }
                 })
                 this.loading = false

--
Gitblit v1.9.3