From fc0666d8d3d1b386eda20e35103b4e2f9018a451 Mon Sep 17 00:00:00 2001
From: 13176889840 <13176889840@163.com>
Date: Fri, 19 Nov 2021 14:30:04 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=88=86=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 src/views/modules/workSys/demandCate.vue | 159 +++++++++++++++++------
 1 file changed, 120 insertions(+), 39 deletions(-)
diff --git a/src/views/modules/workSys/demandCate.vue b/src/views/modules/workSys/demandCate.vue
index 62357f83d..3859c5441 100644
--- a/src/views/modules/workSys/demandCate.vue
+++ b/src/views/modules/workSys/demandCate.vue
@@ -12,12 +12,12 @@
         
       
       
-        新增分类
+        新增分类
       
       
       
           
             {{ handleFilterSpan(scope.row, item) }}
@@ -40,6 +40,7 @@
         
           
             {{(scope.row.usableFlag&&'禁用') || '启用'}}
             添加二级分类
+            
       
         
-          
+          
         
         
-        
+        
+        
           
         
       
@@ -121,6 +130,8 @@ export default {
       total: null,
       conditions: [],
       tableData: [],
+      addLevel: '1',
+      addType: 'add',
       value: '',
       options: [
         {
@@ -134,10 +145,12 @@ export default {
       tableHeader: [
         {
           label: '分类名称',
+          align: 'left',
           columnName: 'categoryName'
         }, {
           label: '状态',
           columnName: 'usableFlag',
+          align: 'center',
           options: [{
             value: true,
             label: '启用'
@@ -191,21 +204,22 @@ export default {
       this.conditions = val
       this.getTableData()
     },
-    
+    handleAdd(type, addType, row) {
+      this.addLevel = type
+      this.addType = addType
+      if (type == '2') this.form = { ...row, categoryName: '' }
+      this.dialogVisible = true
+    },
     handlerCancle() {
       this.dialogVisible = false
     },
     async handleLook(row) {
-      const _show = {
-        show: 'hidden',
-        hidden: 'show'
-      }
       const params = {
-        id: row.id,
-        status: _show[row.status]
+        categoryId: row.categoryId,
+        usableFlag: !row.usableFlag
       }
       this.$http
-        .post('/oper/customize/resicategorystatsconfig/updatestatus', params)
+        .post('/heart/icresidemanddict/updatestatus', params)
         .then(({ data: res }) => {
           if (res.code !== 0) {
             return this.$message.error(res.msg)
@@ -217,33 +231,87 @@ export default {
           return this.$message.error('网络错误')
         })
     },
-    async handleEdit(row) {
+    async handleEdit(row, addType) {
       
       this.form = { ...row }
+      this.addLevel = row.level
+      this.addType = addType
       this.dialogVisible = true
     },
-    async handleSUbmit() {
+    async addLevelFirst() {
+      const _form = {
+        customerId: localStorage.getItem('customerId'),
+        categoryName: this.form.categoryName
+      }
+      await this.$http
+        .post('/heart/icresidemanddict/addfirst', _form)
+        .then(({ data: res }) => {
+          if (res.code !== 0) {
+            return this.$message.error(res.msg)
+          } else {
+            this.dialogVisible = false
+            this.getTableData()
+          } 
+        })
+        .catch(() => {
+          return this.$message.error('网络错误')
+        })
+        this.btnLoading = false
+    },
+    async addLevelChild () {
+      const _form = {
+        customerId: localStorage.getItem('customerId'),
+        categoryName: this.form.categoryName,
+        parentCategoryCode: this.form.categoryCode,
+        awardPoint: this.form.awardPoint
+      }
+      await this.$http
+        .post('/heart/icresidemanddict/addchild', _form)
+        .then(({ data: res }) => {
+          if (res.code !== 0) {
+            return this.$message.error(res.msg)
+          } else {
+            this.dialogVisible = false
+            this.getTableData()
+          } 
+        })
+        .catch(() => {
+          return this.$message.error('网络错误')
+        })
+        this.btnLoading = false
+    },
+    async editCate() {
+      const _form = {
+        customerId: localStorage.getItem('customerId'),
+        categoryName: this.form.categoryName,
+        categoryId: this.form.categoryId,
+        level: this.form.level,
+        awardPoint: this.form.awardPoint
+      }
+      await this.$http
+        .post('/heart/icresidemanddict/update', _form)
+        .then(({ data: res }) => {
+          if (res.code !== 0) {
+            return this.$message.error(res.msg)
+          } else {
+            this.dialogVisible = false
+            this.getTableData()
+          } 
+        })
+        .catch(() => {
+          return this.$message.error('网络错误')
+        })
+        this.btnLoading = false
+    },
+    handleSUbmit() {
       this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           this.btnLoading = true
-          const _form = {
-            ...this.form,
-            warn: (this.form.warn && 1) || 0
-          }
-          await this.$http
-            .post('/oper/customize/resicategorystatsconfig/update', _form)
-            .then(({ data: res }) => {
-              if (res.code !== 0) {
-                return this.$message.error(res.msg)
-              } else {
-                this.dialogVisible = false
-                this.getTableData()
-              } 
-            })
-            .catch(() => {
-              return this.$message.error('网络错误')
-            })
-            this.btnLoading = false
+          if (this.addType == 'add') {
+            if (this.addLevel == '1') this.addLevelFirst()
+            else this.addLevelChild()
+          } else this.editCate()
+          
         } else {
           console.log('error submit!!');
           return false;
@@ -299,16 +367,29 @@ export default {
       this.tableLoading = true
       let params = {
         // formCode: 'resi_base_info',
+        customerId: localStorage.getItem('customerId'),
         pageNo: this.currentPage,
-        pageSize: this.pageSize
+        pageSize: this.pageSize,
+        firstCategoryCode: ''
       }
       await this.$http
-        .post('/epmetuser/icresidemanddict/pagelist', params)
+        .post('/heart/icresidemanddict/pagelist', params)
         .then(({ data: res }) => {
           if (res.code !== 0) {
             return this.$message.error(res.msg)
           } else {
-            this.tableData = res.data.list
+            this.tableData = res.data.list.map(item => {
+              return {
+                ...item,
+                hasBtn: true,
+                children: item.children.map(n => {
+                  return {
+                    ...n,
+                    hasBtn: item.usableFlag
+                  }
+                })
+              }
+            })
             this.total = res.data.total
           }
         })
From 00f4a31177d1b29f316e60e049516a75005ea159 Mon Sep 17 00:00:00 2001
From: 13176889840 <13176889840@163.com>
Date: Fri, 19 Nov 2021 14:31:11 +0800
Subject: [PATCH 2/2] dd
---
 src/views/modules/workSys/resiCate.vue | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/views/modules/workSys/resiCate.vue b/src/views/modules/workSys/resiCate.vue
index 9c83dea44..4eb670df9 100644
--- a/src/views/modules/workSys/resiCate.vue
+++ b/src/views/modules/workSys/resiCate.vue
@@ -1,8 +1,7 @@
 
   
     
-      
+      
       
@@ -509,11 +506,7 @@ export default {