浏览代码

Finish Hotfix-mo-190

莫绍宝 3 年之前
父节点
当前提交
e709142d78
共有 1 个文件被更改,包括 41 次插入3 次删除
  1. 41 3
      src/views/supply/engin/components/commerce_form.vue

+ 41 - 3
src/views/supply/engin/components/commerce_form.vue

@@ -52,8 +52,15 @@
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="16">
-          <el-form-item label="经销商名称" prop="jxsName">
-            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
+          <el-form-item label="经销商名称" prop="jxsNum">
+            <el-select v-model="mainForm.jxsNum" placeholder="选择经销商" size="small" filterable clearable style="width: 100%" @change="changeDealer" :disabled="listItem != undefined || isDealer">
+              <el-option
+                v-for="item in dealerList"
+                :key="item.number"
+                :label="item.name"
+                :value="item.number">
+              </el-option>
+            </el-select>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
@@ -378,7 +385,7 @@
 
 <script>
 import { getOrderDetail, getComLoginList, getComLoginDetail, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
-import { getDictList, getTypeList, getSalesmanList } from '@/api/common'
+import { getDictList, getTypeList, getSalesmanList, getDealerList } from '@/api/common'
 import { findElem } from '@/utils/util'
 
 let that
@@ -409,6 +416,7 @@ export default {
         // type: '',
         jxsNum: '',
         jxsName: '',
+        jxsId: '',
         enginOrderNum: '',
         projectName: '',
         projectType: '',
@@ -453,6 +461,7 @@ export default {
       goodsList: [],
       powerList: [],
       multipleSelection: [],
+      dealerList: [],
 
       isShowDialog: false, // 工程登录列表 - 弹窗
       screenForm: {
@@ -529,6 +538,7 @@ export default {
     await this.getSalesmanList();
     this.getDictList();
     this.getWarehouseList();
+    this.getDealerList();
 
     if(this.listItem) {
       this.isFirst = true;
@@ -594,6 +604,28 @@ export default {
       this.salesmanList = res.data.records;
     },
 
+    // 获取经销商列表
+    getDealerList() {
+      getDealerList({
+        pageNum: 1,
+        pageSize: -1,
+        // bindUser: false
+      }).then(res => {
+        this.dealerList = res.data.records;
+      })
+    },
+
+    changeDealer() {
+      if(this.mainForm.jxsNum) {
+        let jxsItem = this.dealerList.find(o => o.number == this.mainForm.jxsNum);
+        this.mainForm.jxsName = jxsItem.name;
+        this.mainForm.jxsId = jxsItem.id;
+      }else {
+        this.mainForm.jxsName = '';
+        this.mainForm.jxsId = '';
+      }
+    },
+
     // 获取详情
     getDetail() {
       getOrderDetail({id: this.editId}).then(res => {
@@ -910,6 +942,9 @@ export default {
                 this.$parent.getList();
               })
             }else {
+              params.customerNumber = this.mainForm.jxsNum;
+              params.customerName = this.mainForm.jxsName;
+              params.customerId = this.mainForm.jxsId;
               addCom(params).then(res => {
                 this.$successMsg('新增成功');
                 this.goBack();
@@ -917,6 +952,9 @@ export default {
               })
             }
           }else if(type === 2) {
+            params.customerNumber = this.mainForm.jxsNum;
+            params.customerName = this.mainForm.jxsName;
+            params.customerId = this.mainForm.jxsId;
             submitCom(params).then(res => {
               this.$successMsg('提交审核成功');
               this.goBack();