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/place/components/baseAllInfo.vue |  541 +++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 351 insertions(+), 190 deletions(-)

diff --git a/src/views/place/components/baseAllInfo.vue b/src/views/place/components/baseAllInfo.vue
index 197bb33..8531e72 100644
--- a/src/views/place/components/baseAllInfo.vue
+++ b/src/views/place/components/baseAllInfo.vue
@@ -1,15 +1,12 @@
 <template>
     <el-dialog class="place-info-box" title="场所维护" append-to-body :visible.sync="roleBox" center @close="roleBoxClose">
-
         <div class="cur-container-box">
-
             <div class="content-box">
-
                 <box-title class="m10" :classVal="9" :title="'基本信息'"></box-title>
-                <avue-form ref="baseForm" :option="option" v-model="form" :key="reload"></avue-form>
+                <avue-form v-if="baseShow" ref="baseForm" :option="option" v-model="form"></avue-form>
 
                 <box-title class="m10" :classVal="9" :title="'其他信息'"></box-title>
-                <avue-form ref="restForm" :option="optionDetail" v-model="placeForm"></avue-form>
+                <avue-form v-if="restShow" ref="restForm" :option="optionDetail" v-model="placeForm"></avue-form>
 
                 <box-title class="m10" :classVal="9" :title="'从业人员'"></box-title>
                 <avue-crud :option="placeOption" :table-loading="loading" :data="placeExt" ref="crud"
@@ -18,7 +15,6 @@
                     @current-change="holdCurrentChange" @size-change="holdSizeChange" @refresh-change="refreshHoldChange"
                     @on-load="holdOnLoad">
                 </avue-crud>
-
             </div>
 
             <div class="footer-btn-box">
@@ -27,7 +23,6 @@
                 <el-button size="small" @click="roleBoxClose">关 闭</el-button>
             </div>
         </div>
-
     </el-dialog>
 </template>
 
@@ -35,28 +30,25 @@
 import {
     getPlace,
     getPlaceExt,
-
     holdRemove,
     holdAdd,
     holdUpdate,
     getHoldList,
-
     update,
     updatePlaceExt,
 } from "@/api/place/place"
 
-import website from '@/config/website'
+import website from "@/config/website"
 
-import boxTitle from './boxTitle'
+import boxTitle from "./boxTitle"
 
 export default {
-    data () {
-
+    data() {
         //手机号格式校验
         let validatorPhone = function (rule, value, callback) {
             if (value) {
                 if (!/^1[3456789]\d{9}$/.test(value)) {
-                    callback(new Error('手机号格式有误!'))
+                    callback(new Error("手机号格式有误!"))
                 } else {
                     callback()
                 }
@@ -65,8 +57,9 @@
         }
 
         return {
-            reload: Math.random(),
             roleBox: false,
+            baseShow: false,
+            restShow: false,
 
             placeExt: [],
 
@@ -80,41 +73,27 @@
                         span: 12,
                         label: "场所名称",
                         prop: "placeName",
-                        rules: [{
-                            required: true,
-                            message: "请输入场所名称",
-                            trigger: "blur",
-                        }],
-                    },
-
-
-                    {
-                        width: 160,
-                        overHidden: true,
-                        slot: true,
-                        label: "地址",
-                        prop: "location",
-                        type: 'map',
-                        dataType: "string",
-                        span: 12,
-                        value: [117.966460, 28.431002, ""],
                         rules: [
                             {
                                 required: true,
-                                message: "请选择地址",
+                                message: "请输入场所名称",
                                 trigger: "blur",
                             },
                         ],
                     },
 
+                    
+
                     {
                         label: "负责人",
                         prop: "principal",
-                        rules: [{
-                            required: false,
-                            message: "请输入负责人",
-                            trigger: "blur",
-                        }],
+                        rules: [
+                            {
+                                required: false,
+                                message: "请输入负责人",
+                                trigger: "blur",
+                            },
+                        ],
                     },
 
                     {
@@ -128,7 +107,23 @@
                         rules: [
                             {
                                 validator: validatorPhone,
-                                trigger: 'blur'
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+                    {
+                        width: 120,
+                        overHidden: true,
+                        label: "身份证号",
+                        prop: "principalIdCard",
+                        search: true,
+                        searchSpan: 4,
+                        slot: true,
+                        rules: [
+                            {
+                                required: false,
+                                message: "请输身份证号",
+                                trigger: "blur",
                             }
                         ],
                     },
@@ -140,13 +135,15 @@
                         prop: "neiCode",
                         search: false,
                         type: "tree",
-                        dataType: 'string',
                         dicUrl: "/api/blade-system/region/tree",
                         props: {
                             label: "name",
                             value: "id",
                         },
-                        cascader: ["gridId"],
+                        cascader: ["gridCode"],
+                        // dicFormatter: (res) => {
+                        //  return dsposeData(res.data)
+                        // },
                         rules: [
                             {
                                 required: true,
@@ -158,14 +155,14 @@
                     {
                         hide: true,
                         label: "所属网格",
-                        prop: "gridId",
+                        prop: "gridCode",
                         type: "tree",
                         cell: true,
                         props: {
                             label: "gridName",
-                            value: "id",
+                            value: "gridCode",
                         },
-                        dataType: 'string',
+                        // dataType: 'string',
                         dicUrl:
                             "/api/blade-grid/grid/getGridList?communityCode={{neiCode}}",
                         rules: [
@@ -177,7 +174,6 @@
                         ],
                     },
 
-
                     {
                         span: 7,
                         label: "场所标签",
@@ -187,15 +183,17 @@
                         cascader: ["smallLabel"],
                         props: {
                             label: "categoryName",
-                            value: "categoryNo"
+                            value: "categoryNo",
                         },
                         dataType: "string",
                         hide: true,
-                        rules: [{
-                            required: true,
-                            message: "请输入场所标签",
-                            trigger: "blur",
-                        },],
+                        rules: [
+                            {
+                                required: true,
+                                message: "请输入场所标签",
+                                trigger: "blur",
+                            },
+                        ],
                     },
                     {
                         span: 5,
@@ -203,10 +201,11 @@
                         labelWidth: 20,
                         prop: "smallLabel",
                         type: "select",
-                        dicUrl: "/api/blade-category/category/getCategory?parentNo={{label}}",
+                        dicUrl:
+                            "/api/blade-category/category/getCategory?parentNo={{label}}",
                         props: {
                             label: "categoryName",
-                            value: "categoryNo"
+                            value: "categoryNo",
                         },
                         dataType: "string",
                         hide: true,
@@ -219,23 +218,87 @@
                         type: "select",
                         dicData: [
                             {
-                                label: '绿',
-                                value: 'green'
-                            }, {
-                                label: '黄',
-                                value: 'yellow'
-                            }, {
-                                label: '红',
-                                value: 'red'
-                            }
+                                label: "绿",
+                                value: "green",
+                            },
+                            {
+                                label: "黄",
+                                value: "yellow",
+                            },
+                            {
+                                label: "红",
+                                value: "red",
+                            },
                         ],
                         props: {
                             label: "label",
-                            value: "value"
+                            value: "value",
                         },
                         hide: true,
                     },
-
+                    {
+                        span: 12,
+                        label: "九小场所",
+                        prop: "isNine",
+                        type: "select",
+                        dicData: [
+                            {
+                                label: "是",
+                                value: 1,
+                            },
+                            {
+                                label: "否",
+                                value: 2,
+                            }
+                        ],
+                        hide: true,
+                    },
+                    {
+                        span: 12,
+                        label: "九小分类",
+                        prop: "nineType",
+                        type: "select",
+                        display:false,
+                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=nineType",
+                        dataType: "number",
+                        hide: true,
+                        props: {
+                            label: "dictValue",
+                            value: "dictKey",
+                        },
+                    },
+                    {
+                        span: 12,
+                        label: "阵地",
+                        prop: "isFront",
+                        type: "select",
+                        dicData: [
+                            {
+                                label: "是",
+                                value: 1,
+                            },
+                            {
+                                label: "否",
+                                value: 2,
+                            }
+                        ],
+                        hide: true,
+                    },
+                    {
+                        span: 12,
+                        label: "阵地类型",
+                        prop: "frontType",
+                        type: "select",
+                        display:false,
+                        row: true,
+                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=frontType",
+                        dataType: "number",
+                        hide: true,
+                        props: {
+                            label: "dictValue",
+                            value: "dictKey",
+                        },
+                    },
                     {
                         label: "场所照片",
                         prop: "imageUrls",
@@ -247,12 +310,44 @@
                         action: "/api/blade-resource/oss/endpoint/put-file",
                         propsHttp: {
                             res: "data",
-                            name: 'name',
+                            name: "name",
                             url: "link",
                         },
-                        span: 24,
+                        span: 12,
                     },
-                ]
+                    {
+                        width: 160,
+                        overHidden: true,
+                        slot: true,
+                        label: "地址",
+                        prop: "location",
+                        type: "map",
+                        dataType: "string",
+                        span: 12,
+                        value: [117.96646, 28.431002, ""],
+                        rules: [
+                            {
+                                required: true,
+                                message: "请选择地址",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+                    {
+                        label: "备注",
+                        prop: "remark",
+                        type: 'textarea',
+                        hide:true,
+                        span: 24,
+                        rules: [
+                            {
+                                required: true,
+                                message: "请输入场所备注",
+                                trigger: "blur",
+                            },
+                        ],
+                    },
+                ],
             },
 
             placeForm: {},
@@ -261,8 +356,8 @@
                 emptyBtn: false,
                 column: [
                     {
-                        label: '法人信息',
-                        prop: 'legalPerson'
+                        label: "法人信息",
+                        prop: "legalPerson",
                     },
 
                     {
@@ -276,8 +371,8 @@
                         rules: [
                             {
                                 validator: validatorPhone,
-                                trigger: 'blur'
-                            }
+                                trigger: "blur",
+                            },
                         ],
                     },
 
@@ -292,7 +387,7 @@
                         action: "/api/blade-resource/oss/endpoint/put-file",
                         propsHttp: {
                             res: "data",
-                            name: 'name',
+                            name: "name",
                             url: "link",
                         },
                         span: 24,
@@ -309,13 +404,12 @@
                         action: "/api/blade-resource/oss/endpoint/put-file",
                         propsHttp: {
                             res: "data",
-                            name: 'name',
+                            name: "name",
                             url: "link",
                         },
                         span: 24,
                     },
-
-                ]
+                ],
             },
 
             loading: true,
@@ -351,8 +445,8 @@
                         rules: [
                             {
                                 validator: validatorPhone,
-                                trigger: 'blur'
-                            }
+                                trigger: "blur",
+                            },
                         ],
                     },
 
@@ -361,7 +455,8 @@
                         prop: "tempAddress",
                         searchSpan: 4,
                         search: true,
-                    },]
+                    },
+                ],
             },
             holdPage: {
                 pageSize: 20,
@@ -369,7 +464,6 @@
                 total: 0,
             },
             houseHoldForm: {},
-
         }
     },
 
@@ -377,94 +471,141 @@
 
     inject: ["placeElement"],
 
-    watch: {},
+    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(newData) {
             this.curRow = newData
             this.roleBox = true
+            this.baseShow = false
+            this.restShow = false
+            this.form = {}
+            this.placeForm = {}
 
             const that = this
 
-            that.$axios.all([
-                getPlace(newData['id']),
-                getPlaceExt({ placeId: newData['id'] }),
-            ]).then(that.$axios.spread(function (baseInfo, restInfo) {
-                that.form = {
-                    ...baseInfo.data.data,
-                    neiCode: String(baseInfo.data.data.neiCode),
-                    gridId: String(baseInfo.data.data.gridId),
-                }
-                console.log(that.form, 90999)
+            that.$axios
+                .all([getPlace(newData["id"]), getPlaceExt({ placeId: newData["id"] })])
+                .then(
+                    that.$axios.spread(function (baseInfo, restInfo) {
+                        that.form = baseInfo.data.data
 
-                // that.$nextTick(() => that.$refs.baseForm.dicInit('cascader'))
+                        that.form.location = [
+                            that.form.lng,
+                            that.form.lat,
+                            that.form.location,
+                        ].join(",")
 
-                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.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 (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
                     })
-
-                    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)
-                }
-
-                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.$nextTick(() => {
-                //     that.$refs.baseForm.dicInit('select')
-                // })
-            }))
-
-            that.holdOnLoad(this.holdPage)
+                )
         },
 
-        locationDispose (data) {
-            data = data.split(',')
+        locationDispose(data) {
+            data = data.split(",")
 
             return {
                 longitude: data[0],
                 latitude: data[1],
-                location: data[2]
+                location: data[2],
             }
         },
 
-        selectionClear () {
+        selectionClear() {
             this.$nextTick(() => {
                 this.$refs.crud && this.$refs.crud.toggleSelection()
             })
         },
 
-        houseHoldRowUpdate (row, index, done, loading) {
+        houseHoldRowUpdate(row, index, done, loading) {
             holdUpdate(row).then(
                 () => {
                     this.holdOnLoad(this.holdPage)
@@ -481,7 +622,7 @@
             )
         },
 
-        houseHoldRowDel (row) {
+        houseHoldRowDel(row) {
             this.$confirm("确定将选择数据删除?", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
@@ -500,10 +641,10 @@
                 })
         },
 
-        houseHoldRowSave (row, done, loading) {
+        houseHoldRowSave(row, done, loading) {
             holdAdd({
                 ...row,
-                placeId: this.curRow.id
+                placeId: this.curRow.id,
             }).then(
                 () => {
                     this.holdOnLoad(this.holdPage)
@@ -521,99 +662,119 @@
             )
         },
 
-        refreshHoldChange () {
+        refreshHoldChange() {
             this.holdOnLoad(this.holdPage)
         },
 
-        holdOnLoad (holdPage, params = {}) {
+        holdOnLoad(holdPage, params = {}) {
             if (!this.curRow.id) return
 
             let values = {
                 ...params,
-                placeId: this.curRow.id
+                placeId: this.curRow.id,
             }
 
-            getHoldList(holdPage.currentPage, holdPage.pageSize, values).then((res) => {
-                const data = res.data.data
+            getHoldList(holdPage.currentPage, holdPage.pageSize, values).then(
+                (res) => {
+                    const data = res.data.data
 
-                this.holdPage.total = data.total
-                this.placeExt = data.records
+                    this.holdPage.total = data.total
+                    this.placeExt = data.records
 
-                this.loading = false
-                this.selectionClear()
-            })
+                    this.loading = false
+                    this.selectionClear()
+                }
+            )
         },
 
-        holdCurrentChange (currentPage) {
+        holdCurrentChange(currentPage) {
             this.holdPage.currentPage = currentPage
         },
 
-        holdSizeChange (pageSize) {
+        holdSizeChange(pageSize) {
             this.holdPage.pageSize = pageSize
         },
 
-        dataUpdate () {
-            const that = this
-
-            let imageUrls = this.form.imageUrls
-
-            if (imageUrls.length > 0) {
+        desposeImage(data) {
+            if (data.length > 0) {
                 var urls = []
-                var split = imageUrls.split(",").filter(item => item != '')
-                split.forEach(url => {
+                var split = data.split(",").filter((item) => item != "")
+                split.forEach((url) => {
                     var names = url.split("jczz/")
                     urls.push(names[1])
                 })
-                imageUrls = urls.join(",")
+                data = urls.join(",")
             }
+
+            return data
+        },
+
+        dataUpdate() {
+            const that = this
+
+            let imageUrls = this.desposeImage(this.form.imageUrls)
+            let placeImages = this.desposeImage(this.placeForm.imageUrls)
+            let placePlanImageUrls = this.desposeImage(this.placeForm.planImageUrls)
 
             let label = this.form.label
 
-            if (this.form.smallLabel != '') {
-                label = label + ',' + this.form.smallLabel
+            if (this.form.smallLabel != "") {
+                label = label + "," + this.form.smallLabel
             }
 
             delete this.form.smallLabel
 
             this.$refs.baseForm.validate((valid, done, msg) => {
                 if (valid) {
-                    that.$axios.all([
-                        update({
-                            // ...this.placeElement.curRow,
-                            ...this.form,
-                            imageUrls,
-                            label,
-                            ...this.locationDispose(this.form.location)
-                        }),
-                        updatePlaceExt(this.placeForm)
-                    ]).then(that.$axios.spread(function () {
-                        that.$message({
-                            type: "success",
-                            message: "操作成功!",
-                        })
+                    that.$axios
+                        .all([
+                            update({
+                                // ...this.placeElement.curRow,
+                                ...this.form,
+                                imageUrls,
+                                label,
+                                ...this.locationDispose(this.form.location),
+                            }),
+                            updatePlaceExt({
+                                ...this.placeForm,
+                                imageUrls: placeImages,
+                                planImageUrls: placePlanImageUrls,
+                            }),
+                        ])
+                        .then(
+                            that.$axios.spread(function () {
+                                that.$message({
+                                    type: "success",
+                                    message: "操作成功!",
+                                })
 
-                        that.closeRowDetails()
+                                that.roleBoxClose()
 
-                        that.placeElement.onLoad(that.placeElement.page, that.placeElement.query)
+                                that.placeElement.onLoad(
+                                    that.placeElement.page,
+                                    that.placeElement.query
+                                )
 
-                        done()
-                    }))
+                                done()
+                            })
+                        )
                 } else {
-                    console.log('error submit!!')
+                    console.log("error submit!!")
                     return false
                 }
             })
         },
 
-        roleBoxClose () {
+        roleBoxClose() {
             this.form = {}
             this.placeForm = {}
 
             this.$refs.baseForm && this.$refs.baseForm.resetForm()
             this.$refs.restForm && this.$refs.restForm.resetForm()
-
+            this.baseShow = false
+            this.restShow = false
             this.roleBox = false
-        }
+        },
     },
 }
 </script>

--
Gitblit v1.9.3