chenrui  2 年之前
父節點
當前提交
d089b4eb45
共有 1 個文件被更改,包括 25 次插入16 次删除
  1. 25 16
      src/views/newUserManagement/index.vue

+ 25 - 16
src/views/newUserManagement/index.vue

@@ -120,7 +120,7 @@
           <el-form ref="ruleForm" :model="ruleForm" :rules="tableRules" label-width="100px" class="demo-ruleForm">
             <el-form-item label="账号组关联" prop="user_gropu_id">
               <el-select style="width: 100%" size="small" v-model="ruleForm.user_group_id" placeholder="请选择">
-                <el-option v-for="item in options" :key="item.user_group_id" :label="item.user_group_name" :value="item.user_group_id"> </el-option>
+                <el-option v-for="item in arrs" :key="item.user_group_id" :label="item.user_group_name" :value="item.user_group_id"> </el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="账号名称" prop="user_name">
@@ -292,6 +292,9 @@ export default {
       this.treeCheckId = null
       this.tableData = []
       this.clearForm()
+      this.formInline.user_group_name = '新建账号组'
+      // console.log(this.arrs)
+      // this.treeCheckId = this.arrs[this.arrs.length-1].user_group_id
     },
     async handleNodeClick (data,index) {
       this.activeIndex = index
@@ -391,13 +394,11 @@ export default {
       })
     },
     handleTableAdd () {
-      if (this.treeCheckId !=0) {
-        this.tableFlag = true
-        this.dataType = 'add'
-        this.dataTitle = '新增账号'
-        this.clearTableForm()
-        this.ruleForm.user_group_id = this.treeCheckId
-      }
+      this.tableFlag = true
+      this.dataType = 'add'
+      this.dataTitle = '新增账号'
+      this.clearTableForm()
+      this.ruleForm.user_group_id = this.arrs[this.activeIndex].user_group_id
     },
     handleTableEdit (row) {
       this.tableFlag = true
@@ -466,26 +467,34 @@ export default {
       this.$refs['ruleForm'].validate(async (valid) => {
         if (valid) {
           let code = null
-          const data = this.ruleForm
-          this.ruleForm.user_id = this.userId
           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')
           } else {
             const id = this.ruleForm.user_group_id
             if (id) {
+              this.ruleForm.user_id = this.userId
+              const data = this.ruleForm
               code = await this.getChangeList(SERVICE_ID.getUserTableId, data, 2,'user_id')
             }
           }
-          if (code) {
-            if (this.dataType == 'add') {
-              this.clearTableForm()
-            }
+          this.clearTableForm()
             const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
-              user_group_id: this.formInline.user_group_id
+              user_group_id: this.arrs[this.activeIndex].user_group_id
             }, 'user_group_id')
             this.tableData = result
-          }
+            console.log(this.tableData)
+          // if (code) {
+          //   // if (this.dataType == 'add') {
+          //   //   this.clearTableForm()
+          //   // }
+          //   this.clearTableForm()
+          //   const result = await this.getQueryList(SERVICE_ID.getUserTableId, {
+          //     user_group_id: this.formInline.user_group_id
+          //   }, 'user_group_id')
+          //   this.tableData = result
+          // }
           this.tableFlag = false
           this.paswordFlag = false
         }