From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化

---
 src/views/publicSecurity/components/userHouseList.vue |   44 ++++++++++++++++++++++++++++----------------
 1 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/views/publicSecurity/components/userHouseList.vue b/src/views/publicSecurity/components/userHouseList.vue
index 60c580c..18e5980 100644
--- a/src/views/publicSecurity/components/userHouseList.vue
+++ b/src/views/publicSecurity/components/userHouseList.vue
@@ -41,8 +41,8 @@
         <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
           <div>
             <div class="grid-container2">
-              <div class="grid-item" :style="{ backgroundColor: item2.color }" v-for="(item2, index2) in labelData"
-                @click="changLabel(item2)" :key="index2">
+              <div class="grid-item" :style="{ backgroundColor: item2.color,color: item2.fontColor}"
+                v-for="(item2, index2) in labelData" @click="changLabel(item2)" :key="index2">
                 {{ item2.name }}
               </div>
             </div>
@@ -839,8 +839,18 @@
     mounted() {},
     methods: {
       init(row) {
-        console.log(JSON.stringify(row))
-        this.query.regionCode = row.communityCode
+        if (row.regionCode) {
+          this.query.regionCode = row.regionCode.slice(0, 10)
+        }
+        if (row.communityCode) {
+          this.query.regionCode = row.communityCode
+        }
+        if (row.parentId) {
+          this.query.parentId = row.parentId
+        } else {
+          this.query.parentId = 103
+        }
+        this.query.labelId = row.labelId
         this.onLoad(this.page, this.query)
       },
       onsubmit() {
@@ -864,6 +874,7 @@
           this.labelForm.houseCode = this.currentRow.houseCode
           this.labelForm.householdId = this.currentRow.id
           this.labelForm.labelId = this.currentLabel.id
+          this.labelForm.userId = this.currentRow.associatedUserId
           this.labelForm.lableType = 1
 
           saveOrUpdateHouseholdLabel(this.labelForm).then(res => {
@@ -892,7 +903,7 @@
         this.currentRow = item
         this.labelFlag = true
         let params = {
-          parentId: 103
+          parentId: this.query.parentId
         }
         // 查询标签
         getLabelList(Object.assign(params)).then(res => {
@@ -902,19 +913,20 @@
           getDetatils(item.id).then(res => {
             this.householdLabelList = res.data.data.householdLabelList
             // 将细类放到一起
-            data.forEach(e => {
-              e.children.forEach(f => {
-                if (this.householdLabelList.length > 0) {
-                  this.householdLabelList.forEach(h => {
-                    if (Number(f.id) == h.labelId) {
-                      f['color'] = h.color
-                      f['remark'] = h.remark
-                    }
-                  })
-                }
-              })
+            console.log("*********123*********", res.data.data.householdLabelList)
+            data.forEach(f => {
+              if (this.householdLabelList.length > 0) {
+                this.householdLabelList.forEach(h => {
+                  if (f.id == h.labelId) {
+                    f.color = h.color
+                    f.fontColor = '#080808'
+                    // f['remark'] = h.remark
+                  }
+                })
+              }
             })
             this.labelData = data
+            console.log("******************", data)
             this.loading = false
           })
         })

--
Gitblit v1.9.3