zhaoke 2 years ago
parent
commit
6938f16b35

+ 20 - 17
src/layout/mixin/publicFunc.js

@@ -52,22 +52,25 @@ export default {
             obj.Value = data[i]
             obj.filter = {}
             if (Array.isArray(key)) {
-              const keys = Object.keys(key[i])
-              const vals = Object.values(key[i])
+              const keys = []
+              const vals = []
               obj.filter = []
-              for (let j = 0; j < keys.length; j++) {
-                const nobj = {
-                  "left": "(",
-                  "column": `${key[i][keys[i]]}`,
-                  "comparator": "=",
-                  "value": `${key[i][vals[i]]}`,
-                  "right": ")",
-                  "connector": "and"
-                }
-                obj.filter.push(nobj)
-                if (obj.Value.hasOwnProperty(keys[j])) {
-                  delete obj.Value[keys[j]]
-                }
+              for (let j = 0; j < key.length; j++) {
+                const dep = key[i]
+                keys.push(Object.keys(dep))
+                vals.push(Object.values(dep))
+              }
+              const nobj = {
+                "left": "(",
+                "column": `${keys[i]}`,
+                "comparator": "=",
+                "value": `${vals[i]}`,
+                "right": ")",
+                "connector": "and"
+              }
+              obj.filter.push(nobj)
+              if (obj.Value.hasOwnProperty(keys[i])) {
+                delete obj.Value[keys[i]]
               }
             } else {
               obj.filter[key] = data[i][key]
@@ -105,7 +108,7 @@ export default {
       return datas
     },
     //查询
-    async getQueryList (id, dataContent = {}, pageIndex = 1, pageSize = 20) {
+    async getQueryList (id, dataContent = {}, pageIndex = 1, pageSize = 999) {
       try {
         const { code, rowcount, returnData } = await Query({
           serviceId: id,
@@ -159,7 +162,7 @@ export default {
       }
     },
     tipMsg (code, msg) {
-      if (code) {
+      if (code == 0 || code) {
         this.$message.success(msg ?? '操作成功')
       } else {
         this.$message.error(msg ?? '操作失败')

+ 67 - 56
src/views/newRole/index.vue

@@ -44,7 +44,7 @@
           <div class="demo-form">
             <el-form :inline="true" :model="formInline" class="flex-wrap">
               <el-form-item label="角色名称">
-                <el-input style="width:250px" clearable v-model="formInline.role_name" :disabled="activeIndex == null" size="small" placeholder="请输入角色名称"></el-input>
+                <el-input style="width:250px;margin-right: 50px;" clearable v-model="formInline.role_name" :disabled="activeIndex == null" size="small" placeholder="请输入角色名称"></el-input>
               </el-form-item>
               <el-form-item class="flex1" label="角色描述">
                 <el-input style="width:600px;" clearable v-model="formInline.comment" :disabled="activeIndex == null" size="small" placeholder="请输入角色描述"></el-input>
@@ -205,9 +205,11 @@ export default {
   methods: {
     //获取tree数据
     async setTreeData () {
-      const result = await this.getQueryList(SERVICE_ID.sysMenuId)
-      const treeMenu = setTree(result, 'up_auth_id', 'auth_id')
-      this.treeData[0].children = treeMenu
+      const { code, returnData } = await this.getQueryList(SERVICE_ID.sysMenuId)
+      if (code == 0) {
+        const treeMenu = setTree(returnData, 'up_auth_id', 'auth_id')
+        this.treeData[0].children = treeMenu
+      }
     },
     filterNode (value, data) {
       if (!value) return true;
@@ -280,21 +282,24 @@ export default {
     //获取角色已有权限
     async getRoleQuth (item) {
       this.$refs.tree.setCheckedKeys([])
-      const result = await this.getQueryList(SERVICE_ID.authTreeId, { role_id: item.role_ID }, 'role_id')
-      this.checkDatas.push(result)
-      if (result && result.length) {
-        const datas = []
-        result.forEach(item => {
-          datas.push(item.auth_id)
-        })
-        this.$refs.tree.setCheckedKeys(datas)
-        const treeDatas = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
-        const res = [...treeDatas, ...result].filter((item) => !(treeDatas.some((p) => item.auth_id == p.auth_id) && result.some((c) => item.auth_id == c.auth_id)))
-        setTimeout(() => {
-          res.forEach((item) => {
-            this.$refs.tree.setChecked(item.auth_id, false, false);
-          });
-        }, 50);
+      const { code, returnData } = await this.getQueryList(SERVICE_ID.authTreeId, { role_id: item.role_ID })
+      if (code == 0) {
+        const result = returnData
+        this.checkDatas.push(result)
+        if (result && result.length) {
+          const datas = []
+          result.forEach(item => {
+            datas.push(item.auth_id)
+          })
+          this.$refs.tree.setCheckedKeys(datas)
+          const treeDatas = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
+          const res = [...treeDatas, ...result].filter((item) => !(treeDatas.some((p) => item.auth_id == p.auth_id) && result.some((c) => item.auth_id == c.auth_id)))
+          setTimeout(() => {
+            res.forEach((item) => {
+              this.$refs.tree.setChecked(item.auth_id, false, false);
+            });
+          }, 50);
+        }
       }
     },
     //服务列表-点击
@@ -309,23 +314,23 @@ export default {
     //服务列表-保存
     async handleSave () {
       if (this.dataObj.role_ID && this.dataType == 'edit') {
-        const code = await this.getChangeList(this.queryId, this.formInline, 2, 'role_ID')
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.formInline, 2, 'role_ID')
+        if (code == 0) {
           this.resetTable()
           this.getQueryListCo(this.queryId)
         }
         this.tipMsg(code)
       } else if (this.dataType == 'add' && this.arrs[this.arrs.length - 1].role_ID) {
         this.formInline.role_ID = this.arrs[this.arrs.length - 1].role_ID
-        const code = await this.getChangeList(this.queryId, this.formInline, 2, 'role_ID')
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.formInline, 2, 'role_ID')
+        if (code == 0) {
           this.resetTable()
           this.getQueryListCo(this.queryId)
         }
         this.tipMsg(code)
       } else if (this.dataType == 'add') {
-        const code = await this.getChangeList(this.queryId, this.formInline, 1)
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.formInline, 1)
+        if (code == 0) {
           this.resetTable()
           this.getQueryListCo(this.queryId)
         }
@@ -337,8 +342,8 @@ export default {
     },
     async tableRemove () {
       if (this.dataObj.role_ID && this.dataType == 'edit') {
-        const code = await this.getChangeList(this.queryId, this.dataObj, 3)
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.dataObj, 3)
+        if (code == 0) {
           this.resetTable()
           this.getQueryListCo(this.queryId)
           this.activeIndex = null;
@@ -352,8 +357,8 @@ export default {
         }
         this.tipMsg(code)
       } else if (this.dataType == 'add' && this.arrs[this.arrs.length - 1].role_ID) {
-        const code = await this.getChangeList(this.queryId, this.arrs[this.arrs.length - 1], 3)
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.arrs[this.arrs.length - 1], 3)
+        if (code == 0) {
           this.resetTable()
           this.getQueryListCo(this.queryId)
           this.activeIndex = null;
@@ -413,16 +418,16 @@ export default {
         item.role_status = this.dataObj.role_status
       })
       if (type == 'add') {
-        const code = await this.getChangeList(SERVICE_ID.authTreeId, res, 1)
-        if (code) {
+        const { code } = await this.getChangeList(SERVICE_ID.authTreeId, res, 1)
+        if (code == 0) {
           setTimeout(() => {
             this.getRoleQuth(this.dataObj)
           }, 100);
         }
         this.tipMsg(code)
       } else {
-        const code = await this.getChangeList(SERVICE_ID.authTreeId, msgs, 3)
-        if (code) {
+        const { code } = await this.getChangeList(SERVICE_ID.authTreeId, msgs, 3)
+        if (code == 0) {
           setTimeout(() => {
             this.getRoleQuth(this.dataObj)
           }, 100);
@@ -433,27 +438,33 @@ export default {
     },
     async setItem (node, data) {
       if (this.dataObj.role_ID) {
-        const result = await this.getQueryList(SERVICE_ID.getTableColumnId, { serviceOutPutId: data.auth_id }, 'serviceOutPutId')
-        if (result && result) {
-          this.checkArrs = result
-          const res = await this.getQueryList(SERVICE_ID.authTreeId, [{ auth_id: data.auth_id }, { role_id: this.dataObj.role_ID }], ['auth_id', 'role_id'])
-          if (res && res.length) {
-            const resmsg = []
-            result.forEach((item) => {
-              res.forEach(p => {
-                if (item.queryTemplateColumnSetID == p.queryTemplateColumnSetID) {
-                  item.rowauth = p.rowauth
-                  resmsg.push(item)
+        const { code, returnData } = await this.getQueryList(SERVICE_ID.getTableColumnId, { serviceOutPutId: data.auth_id })
+        if (code == 0) {
+          const result = returnData
+          if (result && result) {
+            this.checkArrs = result
+            const { code, returnData } = await this.getQueryList(SERVICE_ID.authTreeId, [{ auth_id: data.auth_id }, { role_id: this.dataObj.role_ID }])
+            if (code == 0) {
+              const res = returnData
+              if (res && res.length) {
+                const resmsg = []
+                result.forEach((item) => {
+                  res.forEach(p => {
+                    if (item.queryTemplateColumnSetID == p.queryTemplateColumnSetID) {
+                      item.rowauth = p.rowauth
+                      resmsg.push(item)
+                    }
+                  })
+                })
+                if (resmsg && resmsg.length) {
+                  resmsg.forEach(row => {
+                    this.$refs.multipleTable.toggleRowSelection(row);
+                  });
                 }
-              })
-            })
-            if (resmsg && resmsg.length) {
-              resmsg.forEach(row => {
-                this.$refs.multipleTable.toggleRowSelection(row);
-              });
+                this.checkGroups = resmsg
+                this.multipleTable = resmsg
+              }
             }
-            this.checkGroups = resmsg
-            this.multipleTable = resmsg
           }
         }
       } else {
@@ -465,7 +476,7 @@ export default {
       if (this.checkGroups.length == 1) {
         const res = this.getColName(val)
         const result = this.sendCheckData(res)
-        const code = await this.getChangeList(SERVICE_ID.authTreeId, result, 1)
+        const { code } = await this.getChangeList(SERVICE_ID.authTreeId, result, 1)
         this.tipMsg(code)
       } else if (this.checkGroups.length > 1) {
         const data1 = this.checkGroups[this.checkGroups.length - 1]; //最后一条数据
@@ -474,10 +485,10 @@ export default {
         const cap = this.getColName(msg)
         const result = this.sendCheckData(cap)
         if (data1.length > data2.length) {
-          const code = this.getChangeList(SERVICE_ID.authTreeId, result, 1)
+          const { code } = await this.getChangeList(SERVICE_ID.authTreeId, result, 1)
           this.tipMsg(code)
         } else {
-          const code = this.getChangeList(SERVICE_ID.authTreeId, result, 3)
+          const { code } = await this.getChangeList(SERVICE_ID.authTreeId, result, 3)
           this.tipMsg(code)
         }
       }
@@ -529,7 +540,7 @@ export default {
       if (dis && dis.length) {
         await this.getChangeList(SERVICE_ID.authTreeId, dis, 3)
       }
-      const code = await this.getChangeList(SERVICE_ID.authTreeId, result, 1)
+      const { code } = await this.getChangeList(SERVICE_ID.authTreeId, result, 1)
       this.tipMsg(code)
     }
   }

+ 65 - 58
src/views/newUserManagement/index.vue

@@ -161,7 +161,7 @@
               label: 'role_name',
               children: 'role_ID',
             }" :default-checked-keys="checkedKeysTemp" @check="handleCheck" /> -->
-            <el-checkbox v-model="item.role_status"  v-for="(item, index) in tableCols" :key="index" @change="handleCheckedCitiesChange(item)">{{ item.role_name }}</el-checkbox>
+          <el-checkbox v-model="item.role_status" v-for="(item, index) in tableCols" :key="index" @change="handleCheckedCitiesChange(item)">{{ item.role_name }}</el-checkbox>
         </div>
         <div class="foot right t30">
           <!-- <el-button size="medium" class="r24" type="primary" @click="onCheck">确定</el-button> -->
@@ -193,7 +193,7 @@ import MD5 from 'blueimp-md5'
 export default {
   name: 'NewManageMent',
   components: { Dialog },
-  mixins: [pb,pf],
+  mixins: [pb, pf],
   data () {
     return {
       data: [
@@ -270,16 +270,13 @@ export default {
   },
   methods: {
     async getTreeData () {
-      const result = await this.getQueryList(this.queryId)
-      if (result && result.length) {
-        this.arrs = []
-        // this.dataList = result
-        this.arrs.push(...result)
-        // this.options = result
-        // this.data[0].children = result
-      } else {
-        this.arrs = []
+      const { code, returnData } = await this.getQueryList(this.queryId)
+      if (code == 0) {
+        if (returnData && returnData.length) {
+          this.arrs = [...returnData]
+        }
       }
+
     },
     handleAdd () {
       const datas = this.arrs.filter(item => item.user_group_name == '新建账号组')
@@ -288,7 +285,7 @@ export default {
       }
       this.arrs.push({ user_group_name: '新建账号组' })
       this.type = 'add'
-      this.activeIndex = this.arrs.length-1
+      this.activeIndex = this.arrs.length - 1
       this.treeCheckId = null
       this.tableData = []
       this.clearForm()
@@ -296,19 +293,23 @@ export default {
       // console.log(this.arrs)
       // this.treeCheckId = this.arrs[this.arrs.length-1].user_group_id
     },
-    async handleNodeClick (data,index) {
+    async handleNodeClick (data, index) {
       this.activeIndex = index
       if (data.user_group_id !== 0) {
         this.treeCheckId = data.user_group_id
         this.formInline = _.cloneDeep(data)
         this.type = 'edit'
-        const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
+        const { code, returnData } = await this.getQueryList(SERVICE_ID.getUserTableId, {
           user_group_id: data.user_group_id
-        }, 'user_group_id')
-        this.tableData = result
+        })
+        if (code == 0 && returnData && returnData.length) {
+          this.tableData = returnData
+        } else {
+          this.tableData = []
+        }
       } else {
         alert('不可选中')
-        return 
+        return
         // this.formInline.user_group_name = ''
         // this.formInline.user_group_comment = ''
       }
@@ -338,30 +339,31 @@ export default {
       this.ruleForm.user_pwd = '123!@#QWEqwe'
     },
     //树删除
-    handleRemove ( data) {
+    handleRemove (data) {
       this.rmTitle = data.user_group_name
       this.rmFlag = true
       this.rmObj = data
       this.rmType = '1'
     },
     async tableRemove () {
-      let code = null
       if (this.rmType == '1') {
-        code = await this.getChangeList(this.queryId, this.rmObj, 3)
-        if (code) {
+        const { code } = await this.getChangeList(this.queryId, this.rmObj, 3)
+        if (code == 0) {
           this.getTreeData()
           this.rmObj = {}
           this.clearForm()
         }
       } else {
-        code = await this.getChangeList(SERVICE_ID.getUserTableId, this.dataObj, 3)
-        if (code) {
-          const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
+        const { code } = await this.getChangeList(SERVICE_ID.getUserTableId, this.dataObj, 3)
+        if (code == 0) {
+          const { returnData } = await this.getQueryList(SERVICE_ID.getUserTableId, {
             user_group_id: this.dataObj.user_group_id
-          },'user_group_id')
-          this.tableData = result
-          this.dataObj = {}
-          this.clearTableForm()
+          })
+          if (returnData && returnData.length) {
+            this.tableData = returnData
+            this.dataObj = {}
+            this.clearTableForm()
+          }
         }
       }
       this.rmFlag = false
@@ -376,12 +378,14 @@ export default {
           if (this.type = 'edit') {
             const id = this.formInline.user_group_id
             if (id) {
-              code = await this.getChangeList(this.queryId, data, 2,'user_group_id')
+              const res = await this.getChangeList(this.queryId, data, 2, 'user_group_id')
+              code = res.code
             } else {
-              code = await this.getChangeList(this.queryId, data, 1)
+              const res = await this.getChangeList(this.queryId, data, 1)
+              code = res.code
             }
           }
-          if (code) {
+          if (code == 0) {
             if (this.type == 'add') {
               this.clearForm()
             }
@@ -413,21 +417,24 @@ export default {
     async handleTableAuth (row) {
       this.dialogFlag = true
       const result = await this.getQueryList(SERVICE_ID.roleListId)
-      const code = await this.getQueryList(SERVICE_ID.userAuthorizationId, {
+      const msg = await this.getQueryList(SERVICE_ID.userAuthorizationId, {
         user_id: row.user_id
-      }, 'user_id')
-      
-      this.tableCols = result
-      this.tableCols.forEach(element => {
-        element.user_id = row.user_id
-      });
-      code.forEach(element => {
-        this.tableCols.forEach(res => {
-          if (res.role_ID == element.role_id) {
-            res.role_status = true
-          }
+      })
+      if (result.code == 0 && result.returnData && result.returnData.length) {
+        this.tableCols = result.returnData
+        this.tableCols.forEach(element => {
+          element.user_id = row.user_id
         });
-      });
+      }
+      if (msg.code == 0 && msg.returnData && msg.returnData.length) {
+        msg.returnData.forEach(element => {
+          this.tableCols.forEach(res => {
+            if (res.role_ID == element.role_id) {
+              res.role_status = true
+            }
+          });
+        });
+      }
       // console.log(this.tableCols)
       // console.log(code)
     },
@@ -445,23 +452,23 @@ export default {
       this.rmType = '2'
     },
     async handleCheckedCitiesChange (data) {
-      let code = null
       let arr = {}
       let event = null
       if (data.role_status == true) {
         event = 1
         arr = {
           role_id: data.role_ID,
-          user_id:  data.user_id
+          user_id: data.user_id
         }
-      } else if (data.role_status == false){
+      } else if (data.role_status == false) {
         event = 3
         arr = {
           role_id: data.role_ID,
-          user_id:  data.user_id
+          user_id: data.user_id
         }
       }
-      code = await this.getChangeList(SERVICE_ID.userAuthorizationId,arr, event)
+      const { code } = await this.getChangeList(SERVICE_ID.userAuthorizationId, arr, event)
+      this.tipMsg(code)
     },
     hide () {
       this.dialogFlag = false
@@ -469,26 +476,26 @@ export default {
     async handleOk (data) {
       this.$refs[data].validate(async (valid) => {
         if (valid) {
-          let code = null
           // this.ruleForm.user_pwd= MD5(this.ruleForm.user_pwd)
           if (this.dataType == 'add') {
             const data = this.ruleForm
-            code = await this.getChangeList(SERVICE_ID.getUserTableId, data, 1,'user_id')
+            const { code } = await this.getChangeList(SERVICE_ID.getUserTableId, data, 1)
+            this.tipMsg(code)
           } else {
             const id = this.ruleForm.user_group_id
             if (id) {
               this.ruleForm.user_id = this.userId
-              this.ruleForm.user_pwd= MD5(this.ruleForm.user_pwd)
+              this.ruleForm.user_pwd = MD5(this.ruleForm.user_pwd)
               const data = this.ruleForm
-              code = await this.getChangeList(SERVICE_ID.getUserTableId, data, 2,'user_id')
+              const { code } = await this.getChangeList(SERVICE_ID.getUserTableId, data, 2, 'user_id')
+              this.tipMsg(code)
             }
           }
           this.clearTableForm()
-            const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
-              user_group_id: this.arrs[this.activeIndex].user_group_id
-            }, 'user_group_id')
-            this.tableData = result
-            this.tipMsg(code)
+          const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
+            user_group_id: this.arrs[this.activeIndex].user_group_id
+          })
+          this.tableData = result.returnData
           // if (code) {
           //   // if (this.dataType == 'add') {
           //   //   this.clearTableForm()

+ 6 - 4
src/views/systemSettings/views/newAuth/components/table.vue

@@ -297,8 +297,10 @@ export default {
     },
   },
   async mounted () {
-    const result = await this.getQueryList(SERVICE_ID.sysAllMenuId, { serviceType: 1 }, 'serviceType')
-    this.authArrs = result
+    const { code, returnData } = await this.getQueryList(SERVICE_ID.sysAllMenuId, { serviceType: 1 })
+    if (code == 0) {
+      this.authArrs = returnData
+    }
   },
   methods: {
     //清空表单
@@ -325,8 +327,8 @@ export default {
     //表格数据提交
     async handleOk () {
       this.tableForm.serviceOutPutId = this.form.auth_id
-      const code = await this.getChangeList(SERVICE_ID.getTableColumnId, this.tableForm, 2, 'queryTemplateColumnSetID')
-      if (code) {
+      const { code } = await this.getChangeList(SERVICE_ID.getTableColumnId, this.tableForm, 2, 'queryTemplateColumnSetID')
+      if (code == 0) {
         this.$message.success('操作成功')
       } else {
         this.$message.error('操作失败')

+ 61 - 24
src/views/systemSettings/views/newAuth/index.vue

@@ -226,8 +226,17 @@ export default {
           mulu[listIndex - 1].show_index = listIndex - 1
           mulu[listIndex] = lastObj
           mulu[listIndex].show_index = listIndex
-          const code = await this.getChangeList(this.queryId, mulu, 2, 'auth_id')
-          if (code) {
+          const delArr = []
+          mulu.forEach(item => {
+            if (item.children) {
+              delete item.children
+            }
+            delArr.push({
+              auth_id: item.auth_id
+            })
+          })
+          const { code } = await this.getChangeList(this.queryId, mulu, 2, delArr)
+          if (code == 0) {
             this.$message.success('操作成功')
             this.setTreeData()
           } else {
@@ -256,8 +265,17 @@ export default {
           caidanArr[listIndex - 1].show_index = listIndex - 1
           caidanArr[listIndex] = lastObj
           caidanArr[listIndex].show_index = listIndex
-          const code = await this.getChangeList(this.queryId, caidanArr, 2, 'auth_id')
-          if (code) {
+          const delArr = []
+          caidanArr.forEach(item => {
+            if (item.children) {
+              delete item.children
+            }
+            delArr.push({
+              auth_id: item.auth_id
+            })
+          })
+          const { code } = await this.getChangeList(this.queryId, caidanArr, 2, delArr)
+          if (code == 0) {
             this.$message.success('操作成功')
             this.setTreeData()
           } else {
@@ -292,8 +310,17 @@ export default {
           mulu[listIndex + 1].show_index = listIndex + 1
           mulu[listIndex] = lastObj
           mulu[listIndex].show_index = listIndex
-          const code = await this.getChangeList(this.queryId, mulu, 2, 'auth_id')
-          if (code) {
+          const delArr = []
+          mulu.forEach(item => {
+            if (item.children) {
+              delete item.children
+            }
+            delArr.push({
+              auth_id: item.auth_id
+            })
+          })
+          const { code } = await this.getChangeList(this.queryId, mulu, 2, delArr)
+          if (code == 0) {
             this.$message.success('操作成功')
             this.setTreeData()
           } else {
@@ -322,8 +349,17 @@ export default {
           caidanArr[listIndex + 1].show_index = listIndex + 1
           caidanArr[listIndex] = lastObj
           caidanArr[listIndex].show_index = listIndex
-          const code = await this.getChangeList(this.queryId, caidanArr, 2, 'auth_id')
-          if (code) {
+          const delArr = []
+          caidanArr.forEach(item => {
+            if (item.children) {
+              delete item.children
+            }
+            delArr.push({
+              auth_id: item.auth_id
+            })
+          })
+          const { code } = await this.getChangeList(this.queryId, caidanArr, 2, delArr)
+          if (code == 0) {
             this.$message.success('操作成功')
             this.setTreeData()
           } else {
@@ -334,8 +370,9 @@ export default {
     },
     //树删除-确定
     async tableRemove () {
-      const code = await this.getChangeList(this.queryId, this.rmObj, 3)
-      if (code) {
+      const { code } = await this.getChangeList(this.queryId, this.rmObj, 3)
+      if (code == 0) {
+        this.$message.success('操作成功')
         this.setTreeData()
         this.rmObj = {}
         this.authObj = {}
@@ -347,7 +384,6 @@ export default {
     handleSave () {
       this.$refs['form'].validate(async (valid) => {
         if (valid) {
-          let code = null
           const child = this.$refs['dataChild'].form
           const data = _.merge(child, this.form)
           if (data.pass_parameters && data.pass_parameters.length) {
@@ -363,20 +399,21 @@ export default {
             }
           }
           if (this.dataType == 'add') {
-            code = await this.getChangeList(this.queryId, data, 1)
-            // if (res && res.length) {
-            //   const { auth_id, Value } = res[0]
-            //   Value.auth_id = auth_id
-            //   this.authObj = Value
-            // }
-          } else {
-            code = await this.getChangeList(this.queryId, data, 2, 'auth_id')
-          }
-          if (code) {
-            this.$message.success('操作成功')
-            this.setTreeData()
+            const { code } = await this.getChangeList(this.queryId, data, 1)
+            if (code == 0) {
+              this.$message.success('操作成功')
+              this.setTreeData()
+            } else {
+              this.$message.error('操作失败')
+            }
           } else {
-            this.$message.error('操作失败')
+            const { code } = await this.getChangeList(this.queryId, data, 2, 'auth_id')
+            if (code == 0) {
+              this.$message.success('操作成功')
+              this.setTreeData()
+            } else {
+              this.$message.error('操作失败')
+            }
           }
         } else {
           return false