From f0e42f85846f06065f1e63a6ee9cac0b4d87cbb6 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 15 Dec 2023 17:59:25 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jczz_web

---
 src/views/userHouse/houseHoldList.vue |  142 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 106 insertions(+), 36 deletions(-)

diff --git a/src/views/userHouse/houseHoldList.vue b/src/views/userHouse/houseHoldList.vue
index d218f5b..3e3992e 100644
--- a/src/views/userHouse/houseHoldList.vue
+++ b/src/views/userHouse/houseHoldList.vue
@@ -22,10 +22,6 @@
             <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
               @click="manageLabel(scope.row)">标签
             </el-button>
-            <!--  <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入
-            </el-button>
-            <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
-            </el-button> -->
           </template>
           <template slot-scope="{row}" slot="tenantName">
             <el-tag>{{ row.tenantName }}</el-tag>
@@ -52,20 +48,21 @@
           </span>
         </el-dialog>
 
-        <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center   width="600px">
-          <div id="" v-for="(item1,index1) in labelData">
+        <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
+          <div id="" v-for="(item,index) in labelData">
             <el-row>
               <el-col :span="24">
                 <div>
-                  <el-divider content-position="left">{{item1.name}}</el-divider>
+                  <el-divider content-position="left">{{item.name}}</el-divider>
                 </div>
               </el-col>
             </el-row>
-            <div id="" class="grid-container2" v-if="item1.children">
-              
-                <div class="grid-item"  v-for="(item2,index2) in item1.children "    @click="changLabel(item2)">
-                  {{item2.name}}
-                </div>
+            <div id="" class="grid-container2" v-if="item.children">
+
+              <div class="grid-item" :style="{ backgroundColor: item2.color}" v-for="(item2,index2) in item.children "
+                @click="changLabel(item2)">
+                {{item2.name}}
+              </div>
             </div>
           </div>
 
@@ -76,12 +73,13 @@
           </span>
         </el-dialog>
 
-        <el-dialog :title="'编辑标签' +  currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
-          <avue-form :option="labelOption" v-model="excelForm">
-            <template slot="excelTemplate">
-
-            </template>
+        <el-dialog :title="'编辑标签   ' +  currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
+          <avue-form :option="labelOption" v-model="labelForm" :submit="onsubmit">
           </avue-form>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="editLabelFlge = false">取 消</el-button>
+            <el-button type="primary" @click="onsubmit">确 定</el-button>
+          </span>
         </el-dialog>
 
 
@@ -105,8 +103,13 @@
     remove,
     add,
     update,
-    getDetatil
+    getDetatil,
+    getDetatils
   } from "@/api/userHouse/list/houseHold.js";
+  import {
+    removeHouseholdLabel,
+    saveOrUpdateHouseholdLabel
+  } from "@/api/userHouse/list/userHouseList.js";
   import {
     getLabelList,
   } from '@/api/label/label'
@@ -223,30 +226,38 @@
         data: [],
 
         excelForm: {},
+        labelForm: {},
         labelOption: {
+          submitBtn: false,
+          emptyBtn: false,
           column: [{
             label: '级别',
-            prop: 'radio',
+            prop: 'color',
             type: 'radio',
             button: true,
             row: true,
             dicData: [{
               label: '撤销',
-              value: -1
+              value: '#EBEDF0'
             }, {
               label: '绿',
-              value: 0
+              value: '#30D17C'
             }, {
               label: '黄',
-              value: 1
+              value: '#FFB42B'
             }, {
               label: '红',
-              value: ''
+              value: '#EA1F1F'
+            }],
+            rules: [{
+              required: true,
+              message: "请选择",
+              trigger: "blur"
             }]
           }, {
             row: true,
             label: '备注',
-            prop: 'input',
+            prop: 'remark',
             type: 'input'
           }]
         },
@@ -297,7 +308,9 @@
             }
           ]
         },
-        currentLabel:""
+        currentLabel: {},
+        currentRow: {},
+        householdLabelList: [],
       };
     },
     watch: {},
@@ -315,19 +328,74 @@
     mounted() {},
     methods: {
 
+      onsubmit() {
+        if (this.labelForm.color === '#EBEDF0') {
+          let params = {
+            householdId: this.currentRow.id,
+            labelId: this.currentLabel.id
+          }
+          removeHouseholdLabel(params).then(res => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.editLabelFlge = false
+            this.manageLabel(this.currentRow)
+            this.loading = false;
+          })
+        } else {
+          this.labelForm.houseCode = this.currentRow.houseCode
+          this.labelForm.householdId = this.currentRow.id
+          this.labelForm.labelId = this.currentLabel.id
+          this.labelForm.lableType = 1
+          saveOrUpdateHouseholdLabel(this.labelForm).then(res => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.editLabelFlge = false
+            this.manageLabel(this.currentRow)
+            this.loading = false;
+          })
+        }
+      },
+
       changLabel(item) {
         this.editLabelFlge = true
         this.currentLabel = item;
+        this.labelForm.color = item.color
+        this.labelForm.remark = item.remark
       },
-      manageLabel() {
+      manageLabel(item) {
+        this.currentRow = item
         this.labelFlag = true
         let params = {
           parentId: 1000
         }
+        // 查询标签
         getLabelList(Object.assign(params)).then(res => {
           const data = res.data.data;
-          this.labelData = data;
+          // this.labelData = data;
           this.loading = false;
+          // 查询详情
+          getDetatils(item.id).then(res => {
+            this.householdLabelList = res.data.data.householdLabelList;
+            this.loading = false;
+            // 将细类放到一起
+            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
+                    }
+                  })
+                }
+              })
+            })
+            this.labelData = data;
+          });
         });
       },
       rowSave(row, done, loading) {
@@ -491,18 +559,20 @@
     grid-gap: 10px; */
     display: flex;
     flex-wrap: wrap;
-    padding-bottom:20px;
+    padding-bottom: 20px;
   }
-  .grid-item{
-    padding:8px 14px;
-    border:1px solid #dcdfe6;
-    margin-right:10px;
-    margin-bottom:10px;
+
+  .grid-item {
+    padding: 8px 14px;
+    border: 1px solid #dcdfe6;
+    margin-right: 10px;
+    margin-bottom: 10px;
     border-radius: 20px;
   }
-  .grid-item:hover{
+
+  .grid-item:hover {
     background-color: #e8f4ff;
-    color:#017BFC;
+    color: #017BFC;
     cursor: pointer;
   }
 
@@ -513,4 +583,4 @@
   .box .el-scrollbar__wrap {
     overflow: scroll;
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3