From 6416b40cf242340eaa163c498bd49d8103e73610 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 29 Jul 2024 17:01:52 +0800
Subject: [PATCH] 代码优化

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

diff --git a/src/views/publicSecurity/components/userHouseList.vue b/src/views/publicSecurity/components/userHouseList.vue
index 778dab7..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>
@@ -845,8 +845,12 @@
         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.query.parentId = 103
         this.onLoad(this.page, this.query)
       },
       onsubmit() {
@@ -899,7 +903,7 @@
         this.currentRow = item
         this.labelFlag = true
         let params = {
-          parentId: 103
+          parentId: this.query.parentId
         }
         // 查询标签
         getLabelList(Object.assign(params)).then(res => {
@@ -909,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
           })
         })
@@ -1126,4 +1131,4 @@
   .box .el-scrollbar__wrap {
     overflow: scroll;
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3