소스 검색

fix: 账户管理

Howie 1 년 전
부모
커밋
d20ed271a6
1개의 변경된 파일28개의 추가작업 그리고 23개의 파일을 삭제
  1. 28 23
      src/views/setting/account.vue

+ 28 - 23
src/views/setting/account.vue

@@ -263,7 +263,7 @@
             reserve-keyword
             :remote-method="remoteMethod"
             :loading="loading">
-            <el-option v-for="(item, index) in dealerList" :key="index" :label="item.name" :value="item.id" />
+            <el-option v-for="(item, index) in dealerList" :key="item.id + 'jingxiaoshang'" :label="item.name" :value="item.id" />
           </el-select>
         </el-form-item>
         <el-form-item v-show="roleObj.type === 1 || roleObj.type === 2" label="商户" prop="merchant">
@@ -291,7 +291,7 @@
             reserve-keyword
             :remote-method="remoteMethod2"
             :loading="loading2">
-            <el-option v-for="(item, index) in groupList" :key="index" :label="item.name" :value="item.id" />
+            <el-option v-for="(item, index) in groupList" :key="item.id + 'jituan'" :label="item.name" :value="item.id" />
           </el-select>
         </el-form-item>
         <el-form-item v-show="roleObj.type === 0 && roleObj.name === '经销商'" label="是否折让" prop="isDiscount">
@@ -651,9 +651,8 @@ export default {
       this.getDealerList(this.myID, e)
     },
     // 获取经销商列表
-    async getDealerList(id, e) {
-      const result = await new Promise((resolve, reject) => {
-        getDealerList({
+     getDealerList(id, e) {
+      getDealerList({
           pageNum: 1,
           pageSize: 300,
           bindUser: false,
@@ -663,22 +662,17 @@ export default {
           .then(res => {
             this.dealerList = res.data.records
             this.loading = false
-            resolve(res.data.records)
           })
           .catch(res => {
-            resolve([])
           })
-      })
-      return result
     },
     remoteMethod2(e) {
       this.loading2 = true
       this.getGroupList(this.myID, e)
     },
     // 获取集团列表
-    async getGroupList(id, e) {
-      const result = await new Promise((resolve, reject) => {
-        getDealerList({
+     getGroupList(id, e) {
+      getDealerList({
           pageNum: 1,
           pageSize: 300,
           keyword: e
@@ -686,13 +680,9 @@ export default {
           .then(res => {
             this.groupList = res.data.records
             this.loading2 = false
-            resolve(res.data.records)
           })
           .catch(res => {
-            resolve([])
           })
-      })
-      return result
     },
 
     // 获取部门列表
@@ -794,12 +784,6 @@ export default {
       if (type == 'edit') {
         this.editAccountId = id
         getAccountDetail({ adminUserId: id }).then(res => {
-               if (res.data.customerId) {
-            this.getDealerList(id, res.data.customerId)
-          }
-          if (res.data.groupCompanyId) {
-            this.getGroupList(id, res.data.groupCompanyId)
-          }
           this.AccountForm.account = res.data.userName
           this.AccountForm.role = res.data.roleId
           this.AccountForm.nickName = res.data.nickName
@@ -811,6 +795,12 @@ export default {
           this.AccountForm.correspondIds = res.data.stockCorrespondList
           this.AccountForm.k3CategoryIds = res.data.k3CategoryList
           this.AccountForm.isShangyong = res.data.isShangyong
+          if (this.AccountForm.dealer) {
+            this.getDealerList(id, this.AccountForm.dealer)
+          }
+          if (res.data.groupCompanyId) {
+            this.getGroupList(id, res.data.groupCompanyId)
+          }
           this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || [])
 
 
@@ -963,10 +953,25 @@ export default {
 
     // 取消重置密码
     cancelResetForm() {
+      this.$refs.resetForm.resetFields()
+      this.AccountForm ={
+        account: '', // 账号
+        nickName: '', // 用户名
+        merchant: '', // 商户
+        dealer: '', // 经销商
+        role: '', // 角色组
+        correspondIds: [], // 仓库
+        isGroup: false,
+        company: '',
+        isDiscount: true,
+        newPassword: '', // 新密码
+        confirmPassword: '', // 确认密码
+        k3CategoryIds: [],
+        isShangyong: false, // 是否商用经销商
+      }
       this.resetFormVisible = false
       this.passwordType1 = 'password'
       this.passwordType2 = 'password'
-      this.$refs.resetForm.resetFields()
     },
 
     // 提交重置密码