From d16d10d94fddff86bdfd87113e7fd2cebe8b7cd7 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 24 Jan 2024 18:15:06 +0800
Subject: [PATCH] 居民监管样式调整

---
 src/views/cGovernance/gridWorkLog.vue |  160 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 91 insertions(+), 69 deletions(-)

diff --git a/src/views/cGovernance/gridWorkLog.vue b/src/views/cGovernance/gridWorkLog.vue
index 9edb103..2cb7bee 100644
--- a/src/views/cGovernance/gridWorkLog.vue
+++ b/src/views/cGovernance/gridWorkLog.vue
@@ -20,14 +20,15 @@
 </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"
 import website from '@/config/website'
 
 export default {
-    data () {
+    data() {
         return {
             form: {},
             query: {},
@@ -42,13 +43,14 @@
             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,
                 //stripe:true,
                 index: true,
@@ -58,6 +60,7 @@
                 dialogClickModal: false,
                 column: [
                     {
+                        width: 120,
                         label: "走访类型",
                         prop: "type",
                         span: 12,
@@ -127,12 +130,6 @@
                             value: 'id',
                         },
                         dicData: [],
-                        formatter: (row) => {
-                            this.form.phone = row.phoneNumber
-                            this.form.address = row.currentAddress
-
-                            return row.name
-                        },
                         rules: [
                             {
                                 required: true,
@@ -151,6 +148,7 @@
                         searchSpan: 4,
                         search: true,
                     },
+
                     {
                         width: 156,
                         overHidden: true,
@@ -184,6 +182,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 +206,13 @@
                         prop: "context",
                         type: "textarea",
                         span: 24,
+                        rules: [
+                            {
+                                required: true,
+                                message: "请输入走访内容",
+                                trigger: "blur",
+                            },
+                        ],
                     },
 
                     {
@@ -217,24 +239,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,8 +265,23 @@
     },
 
     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) {
+            handler(newData) {
                 let householdIdColumn = this.findObject(
                     this.option.column,
                     'householdId'
@@ -273,7 +296,7 @@
         },
 
         'form.type': {
-            handler (newData) {
+            handler(newData) {
                 let householdIdColumn = this.findObject(
                     this.option.column,
                     'householdId'
@@ -297,7 +320,7 @@
 
     computed: {
         ...mapGetters(["permission", "userInfo"]),
-        permissionList () {
+        permissionList() {
             return {
                 addBtn: this.vaildData(this.permission.gridWorkLog_add, true),
                 viewBtn: this.vaildData(this.permission.gridWorkLog_view, true),
@@ -305,7 +328,7 @@
                 editBtn: this.vaildData(this.permission.gridWorkLog_edit, true),
             }
         },
-        ids () {
+        ids() {
             let ids = []
             this.selectionList.forEach((ele) => {
                 ids.push(ele.id)
@@ -313,7 +336,7 @@
             return ids.join(",")
         },
 
-        showNamePhone () {
+        showNamePhone() {
             return (data) => {
                 if (data.phoneNumber && data.phoneNumber.trim() != '') {
                     return `${data.name}(${data.phoneNumber})`
@@ -324,20 +347,18 @@
         }
     },
 
-    created () {
+    created() {
         this.getUserList()
     },
 
     methods: {
-        getUserList (param = '') {
-            let dicUrl = `/blade-household/household/selectHouseholdList?labelId=${param}&searchKey={{key}}`
+        getUserList(param = '') {
+            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) {
+        rowSave(row, done, loading) {
             if (row.url.length > 0) {
                 var urls = []
                 var split = row.url.split(",")
@@ -362,7 +383,7 @@
                 }
             )
         },
-        rowUpdate (row, index, done, loading) {
+        rowUpdate(row, index, done, loading) {
             if (row.url.length > 0) {
                 var urls = []
                 var split = row.url.split(",")
@@ -387,7 +408,7 @@
                 }
             )
         },
-        rowDel (row) {
+        rowDel(row) {
             this.$confirm("确定将选择数据删除?", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
@@ -404,24 +425,24 @@
                     })
                 })
         },
-        searchReset () {
+        searchReset() {
             this.query = {}
             this.onLoad(this.page)
         },
-        searchChange (params, done) {
+        searchChange(params, done) {
             this.query = params
             this.page.currentPage = 1
             this.onLoad(this.page, params)
             done()
         },
-        selectionChange (list) {
+        selectionChange(list) {
             this.selectionList = list
         },
-        selectionClear () {
+        selectionClear() {
             this.selectionList = []
             this.$refs.crud.toggleSelection()
         },
-        handleDelete () {
+        handleDelete() {
             if (this.selectionList.length === 0) {
                 this.$message.warning("请选择至少一条数据")
                 return
@@ -443,24 +464,23 @@
                     this.$refs.crud.toggleSelection()
                 })
         },
-        beforeOpen (done, type) {
+        beforeOpen(done, type) {
             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
                     })
@@ -469,16 +489,16 @@
             // con
             done()
         },
-        currentChange (currentPage) {
+        currentChange(currentPage) {
             this.page.currentPage = currentPage
         },
-        sizeChange (pageSize) {
+        sizeChange(pageSize) {
             this.page.pageSize = pageSize
         },
-        refreshChange () {
+        refreshChange() {
             this.onLoad(this.page, this.query)
         },
-        onLoad (page, params = {}) {
+        onLoad(page, params = {}) {
             const { dateTime } = this.query
             let values = {
                 ...params,
@@ -498,13 +518,15 @@
                 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(",")
+                    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