Преглед на файлове

【新增】添加账号物料分类

howie преди 3 години
родител
ревизия
806fd22638
променени са 1 файла, в които са добавени 43 реда и са изтрити 3 реда
  1. 43 3
      src/views/setting/account.vue

+ 43 - 3
src/views/setting/account.vue

@@ -171,7 +171,12 @@
           </el-select>
 
         </el-form-item>
+           <el-form-item label="物料分类" prop="k3CategoryIds">
+            <el-select multiple v-model="AccountForm.k3CategoryIds" placeholder="请选择物料分类" style="width: 100%;" filterable>
+              <el-option :label="item.name" :value="item.id" v-for="(item, index) in categoryList" :key="index"></el-option>
+            </el-select>
 
+          </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="cancelAccountForm">取 消</el-button>
@@ -218,7 +223,7 @@ import {
   changeAccountStatus,
   resetPassword,
 } from "@/api/setting";
-import { getDealerList } from "@/api/common";
+import { getDealerList ,getCategoryList } from "@/api/common";
 import { findElem, downloadFiles, handleImportTwo } from "@/utils/util";
 
 export default {
@@ -296,6 +301,7 @@ export default {
         isDiscount: true,
         newPassword: "", // 新密码
         confirmPassword: "", // 确认密码
+        k3CategoryIds:[]
       },
       AccountFormRules: {
         account: [{ required: true, message: "请输入账号", trigger: "blur" }],
@@ -306,6 +312,9 @@ export default {
         correspondIds: [
           { required: true, message: "请选择可用仓库", trigger: "change" },
         ],
+         k3CategoryIds: [
+          { required: true, message: "请选择物料分类", trigger: "change" },
+        ],
         newPassword: [
           { required: true, validator: validatePass3, trigger: "blur" },
         ],
@@ -314,7 +323,7 @@ export default {
         ],
       },
       editAccountId: null,
-
+categoryList:[],
       filterText: "",
       departmentList: [],
       defaultProps: {
@@ -414,7 +423,20 @@ export default {
       });
       return result;
     },
-
+ // 获
+    async getCategoryList() {
+      const result = await new Promise((resolve, reject) => {
+        getCategoryList({ pageNum: 1, pageSize: -1 })
+          .then((res) => {
+            this.categoryList = res.data.records;
+            resolve(res.data);
+          })
+          .catch((res) => {
+            resolve([]);
+          });
+      });
+      return result;
+    },
     // 获取商户列表
     async getMerchantList() {
       const result = await new Promise((resolve, reject) => {
@@ -542,6 +564,8 @@ export default {
       await this.getMerchantList();
       await this.getDealerList();
       await this.getRoleList();
+      await this.getCategoryList()
+
       if (type == "add") {
         if (this.selectDepartment) {
           this.$refs.tree.setCheckedKeys([this.selectDepartment.adminWebsitId]);
@@ -561,6 +585,7 @@ export default {
           this.AccountForm.company = res.data.parentCustomerId;
           this.AccountForm.isDiscount = res.data.isZr;
           this.AccountForm.correspondIds = res.data.stockCorrespondList;
+          this.AccountForm.k3CategoryIds =res.data.k3CategoryList
           this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
         });
       }
@@ -579,13 +604,28 @@ export default {
       console.log(this.AccountForm.correspondIds);
       this.$refs.AccountForm.validate((valid) => {
         if (valid) {
+      const  categoryIds=[]
+      this.categoryList.map(k=>{
+        this.AccountForm.k3CategoryIds.map(i=>{
+              if (i==k.id) {
+                categoryIds.push({
+                  k3CategoryId:k.id,
+                  k3CategoryName:k.name,
+                  k3CategoryNumber:k.number
+                })
+              }
+        })
+      })
+
           let params = {
             userName: this.AccountForm.account,
             nickName: this.AccountForm.nickName,
             roleId: this.AccountForm.role,
             password: this.AccountForm.newPassword,
             correspondIds: this.AccountForm.correspondIds,
+            categoryIds
           };
+
           if (this.roleObj.type === 0) {
             params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
             if (this.roleObj.name === "经销商") {