chenrui  2 tahun lalu
induk
melakukan
71f56fbfaf
1 mengubah file dengan 16 tambahan dan 11 penghapusan
  1. 16 11
      src/views/newUserManagement/index.vue

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

@@ -98,7 +98,7 @@
       <div class="dialog-content">
         <div class="title">{{ dataTitle }}</div>
         <div class="contents">
-          <el-form ref="ruleForm" :model="ruleForm" :rules="tableRules" label-width="100px" class="demo-ruleForm">
+          <el-form ref="ruleForms" :model="ruleForm" :rules="tableRules" label-width="100px" class="demo-ruleForm">
             <el-form-item label="账号密码" prop="user_pwd">
               <div class="flex-wrap">
                 <el-input v-model="ruleForm.user_pwd" class="r25" size="small" placeholder="请输入密码" />
@@ -108,7 +108,7 @@
           </el-form>
         </div>
         <div class="foot right">
-          <el-button size="small" @click="handleOk" class="r24" type="primary">确定</el-button>
+          <el-button size="small" @click="handleOk('ruleForms')" class="r24" type="primary">确定</el-button>
           <el-button @click="eledite" size="small">取消</el-button>
         </div>
       </div>
@@ -148,7 +148,7 @@
           </el-form>
         </div>
         <div class="foot right">
-          <el-button size="small" @click="handleOk" class="r24" type="primary">确定</el-button>
+          <el-button size="small" @click="handleOk('ruleForm')" class="r24" type="primary">确定</el-button>
           <el-button @click="eledite" size="small">取消</el-button>
         </div>
       </div>
@@ -387,6 +387,7 @@ export default {
             }
             this.getTreeData()
           }
+          this.tipMsg(code)
         }
         else {
           return false
@@ -394,11 +395,13 @@ export default {
       })
     },
     handleTableAdd () {
-      this.tableFlag = true
-      this.dataType = 'add'
-      this.dataTitle = '新增账号'
-      this.clearTableForm()
-      this.ruleForm.user_group_id = this.arrs[this.activeIndex].user_group_id
+      if (this.activeIndex) {
+        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
@@ -463,11 +466,11 @@ export default {
     hide () {
       this.dialogFlag = false
     },
-    async handleOk () {
-      this.$refs['ruleForm'].validate(async (valid) => {
+    async handleOk (data) {
+      this.$refs[data].validate(async (valid) => {
         if (valid) {
           let code = null
-          this.ruleForm.user_pwd= MD5(this.ruleForm.user_pwd)
+          // 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')
@@ -475,6 +478,7 @@ export default {
             const id = this.ruleForm.user_group_id
             if (id) {
               this.ruleForm.user_id = this.userId
+              this.ruleForm.user_pwd= MD5(this.ruleForm.user_pwd)
               const data = this.ruleForm
               code = await this.getChangeList(SERVICE_ID.getUserTableId, data, 2,'user_id')
             }
@@ -484,6 +488,7 @@ export default {
               user_group_id: this.arrs[this.activeIndex].user_group_id
             }, 'user_group_id')
             this.tableData = result
+            this.tipMsg(code)
           // if (code) {
           //   // if (this.dataType == 'add') {
           //   //   this.clearTableForm()