Browse Source

产品可以指定分公司

Long 2 weeks ago
parent
commit
91c62a123b
1 changed files with 26 additions and 1 deletions
  1. 26 1
      src/views/store/storeProduct/index.vue

+ 26 - 1
src/views/store/storeProduct/index.vue

@@ -516,6 +516,16 @@
                   />
             </el-select>
         </el-form-item>
+        <el-form-item label="所属公司">
+          <el-select style="width: 240px" v-model="form.companyIds" multiple placeholder="请选择企业" clearable size="small" >
+            <el-option
+                    v-for="item in companyOptions"
+                    :key="item.companyId"
+                    :label="item.companyName"
+                    :value="item.companyId"
+                  />
+            </el-select>
+        </el-form-item>
         <el-form-item label="国药准字" v-if="form.productType==2" prop="prescribeCode">
           <el-input v-model="form.prescribeCode" placeholder="请输入国药准字" />
         </el-form-item>
@@ -577,6 +587,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import Editor from '@/components/Editor/wang';
 import Material from '@/components/Material'
 import singleImg from '@/components/Material/single'
+import { getCompanyList } from "@/api/company/company";
 export default {
   name: "StoreProduct",
   components: {
@@ -652,6 +663,8 @@ export default {
       isHotOptions:[],
       isShowOptions:[],
       categoryOptions:[],
+      // 企业列表
+      companyOptions:[],
       // 遮罩层
       loading: true,
       // 选中数组
@@ -750,6 +763,9 @@ export default {
     getAllStoreProductRule().then(response => {
       this.ruleList =response.data;
     });
+    getCompanyList().then(response => {
+      this.companyOptions = response.data;
+    });
     this.getTreeselect();
     this.getList();
   },
@@ -1003,7 +1019,8 @@ export default {
         prescribeSpec: null,
         prescribeFactory: null,
         prescribeName: null,
-        isDisplay:"1"
+        isDisplay:"1",
+        companyIds:[]
       };
       this.resetForm("form");
       this.oneFormValidate = [
@@ -1078,6 +1095,10 @@ export default {
              that.attrs.push(data);
           });
         }
+        // 组装companyIds
+        if (response.data.companyIds != null) {
+          this.form.companyIds = response.data.companyIds.split(',').map(Number);
+        }
         setTimeout(() => {
           that.generate();
         }, 200);
@@ -1135,6 +1156,10 @@ export default {
           if(this.form.specType === 1 && this.manyFormValidate.length===0){
             return this.$message.warning('请点击生成规格!');
           }
+          // 组装companyIds
+          if (this.form.companyIds.length != 0) {
+            this.form.companyIds = this.form.companyIds.join(',');
+          }
           addOrEdit(this.form).then(response => {
             if (response.code === 200) {
               this.msgSuccess("修改成功");