From 3c8ce26ad8f5d894944c8d6eca630ee66a06f4d1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 17 Jan 2024 14:08:39 +0800
Subject: [PATCH] 新增报错

---
 src/views/place/index.vue                  |   14 ---
 src/views/place/components/baseAllInfo.vue |  202 ++++++++++++++++++++++++++++---------------------
 2 files changed, 117 insertions(+), 99 deletions(-)

diff --git a/src/views/place/components/baseAllInfo.vue b/src/views/place/components/baseAllInfo.vue
index 70ee993..197bb33 100644
--- a/src/views/place/components/baseAllInfo.vue
+++ b/src/views/place/components/baseAllInfo.vue
@@ -1,26 +1,34 @@
 <template>
-    <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"></avue-form>
+    <el-dialog class="place-info-box" title="场所维护" append-to-body :visible.sync="roleBox" center @close="roleBoxClose">
 
-            <box-title class="m10" :classVal="9" :title="'其他信息'"></box-title>
-            <avue-form ref="restForm" :option="optionDetail" v-model="placeForm"></avue-form>
+        <div class="cur-container-box">
 
-            <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>
+            <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>
+
+                <box-title class="m10" :classVal="9" :title="'其他信息'"></box-title>
+                <avue-form 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"
+                    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>
+
+            </div>
+
+            <div class="footer-btn-box">
+                <el-button size="small" type="primary" @click="dataUpdate">保 存</el-button>
+
+                <el-button size="small" @click="roleBoxClose">关 闭</el-button>
+            </div>
         </div>
 
-        <div class="footer-btn-box">
-            <el-button size="small" type="primary" @click="dataUpdate">保 存</el-button>
-
-            <el-button size="small" @click="closeRowDetails">关 闭</el-button>
-        </div>
-    </div>
+    </el-dialog>
 </template>
 
 <script>
@@ -57,6 +65,9 @@
         }
 
         return {
+            reload: Math.random(),
+            roleBox: false,
+
             placeExt: [],
 
             form: {},
@@ -129,6 +140,7 @@
                         prop: "neiCode",
                         search: false,
                         type: "tree",
+                        dataType: 'string',
                         dicUrl: "/api/blade-system/region/tree",
                         props: {
                             label: "name",
@@ -153,6 +165,7 @@
                             label: "gridName",
                             value: "id",
                         },
+                        dataType: 'string',
                         dicUrl:
                             "/api/blade-grid/grid/getGridList?communityCode={{neiCode}}",
                         rules: [
@@ -169,7 +182,7 @@
                         span: 7,
                         label: "场所标签",
                         prop: "label",
-                        type: "cascader",
+                        type: "select",
                         dicUrl: "/api/blade-category/category/getCategory?level=2",
                         cascader: ["smallLabel"],
                         props: {
@@ -189,7 +202,7 @@
                         label: "",
                         labelWidth: 20,
                         prop: "smallLabel",
-                        type: "cascader",
+                        type: "select",
                         dicUrl: "/api/blade-category/category/getCategory?parentNo={{label}}",
                         props: {
                             label: "categoryName",
@@ -203,7 +216,7 @@
                         span: 12,
                         label: "标签颜色",
                         prop: "color",
-                        type: "cascader",
+                        type: "select",
                         dicData: [
                             {
                                 label: '绿',
@@ -356,6 +369,7 @@
                 total: 0,
             },
             houseHoldForm: {},
+
         }
     },
 
@@ -363,69 +377,77 @@
 
     inject: ["placeElement"],
 
-    watch: {
-        'placeElement.curRow': {
-            handler (newData) {
-                const that = this
-                if (newData && 'id' in newData && newData['id'] != null && newData['id'] != '') {
-
-                    that.$axios.all([
-                        getPlace(newData['id']),
-                        getPlaceExt({ placeId: newData['id'] }),
-                    ]).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)
-                        }
-
-                        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.holdOnLoad(this.holdPage)
-                }
-            },
-            immediate: true
-        }
-    },
+    watch: {},
 
     methods: {
+        initOpen (newData) {
+            this.curRow = newData
+            this.roleBox = true
+
+            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.$nextTick(() => that.$refs.baseForm.dicInit('cascader'))
+
+                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)
+                }
+
+                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(',')
 
@@ -481,7 +503,7 @@
         houseHoldRowSave (row, done, loading) {
             holdAdd({
                 ...row,
-                placeId: this.placeElement.curRow.id
+                placeId: this.curRow.id
             }).then(
                 () => {
                     this.holdOnLoad(this.holdPage)
@@ -504,11 +526,11 @@
         },
 
         holdOnLoad (holdPage, params = {}) {
-            if (!this.placeElement.curRow.id) return
+            if (!this.curRow.id) return
 
             let values = {
                 ...params,
-                placeId: this.placeElement.curRow.id
+                placeId: this.curRow.id
             }
 
             getHoldList(holdPage.currentPage, holdPage.pageSize, values).then((res) => {
@@ -583,8 +605,14 @@
             })
         },
 
-        closeRowDetails () {
-            this.placeElement.roleBox = false
+        roleBoxClose () {
+            this.form = {}
+            this.placeForm = {}
+
+            this.$refs.baseForm && this.$refs.baseForm.resetForm()
+            this.$refs.restForm && this.$refs.restForm.resetForm()
+
+            this.roleBox = false
         }
     },
 }
diff --git a/src/views/place/index.vue b/src/views/place/index.vue
index 75455d0..e453047 100644
--- a/src/views/place/index.vue
+++ b/src/views/place/index.vue
@@ -48,9 +48,7 @@
             </template>
         </avue-crud>
 
-        <el-dialog class="place-info-box" title="场所维护" append-to-body :visible.sync="roleBox" center @close="roleBoxClose">
-            <baseAllInfo></baseAllInfo>
-        </el-dialog>
+        <baseAllInfo ref="BaseAllInfo"></baseAllInfo>
 
         <el-dialog class="place-info-box audit-info-box" title="审核" append-to-body :visible.sync="auditBasePopup"
             width="30%">
@@ -93,9 +91,6 @@
         }
 
         return {
-            curRow: {},
-            roleBox: false,
-
             form: {},
             query: {},
             loading: true,
@@ -548,13 +543,8 @@
             this.auditBasePopup = true
         },
 
-        roleBoxClose () {
-            this.curRow = {}
-        },
-
         ManageTenants (item) {
-            this.curRow = item
-            this.roleBox = true
+            this.$refs.BaseAllInfo.initOpen(item)
         },
 
         rowSave (row, done, loading) {

--
Gitblit v1.9.3