ソースを参照

1.变更单导入
2.采购订单根据订单类型控制WMS仓库与货位是否必填

002390 1 年間 前
コミット
aaa2f4f8c2

+ 19 - 1
src/api/changeApply/basic.js

@@ -104,4 +104,22 @@ export function toOA(userName, fdId) {
     url: `/oaflow/redirectToOa/${userName}/${fdId}`,
     method: 'get',
   })
-}
+}
+
+
+// 行模板下载
+export function downloadInner(data) {
+  return request({
+    url: `/material/change/downloadInner`,
+    method: 'post',
+    data: data
+  })
+}
+// 行模板下载
+export function importInner(data) {
+  return request({
+    url: `/material/change/importInner`,
+    method: 'post',
+    data: data
+  })
+}

+ 169 - 123
src/views/material/changeApply/add/index.vue

@@ -1,7 +1,7 @@
 <!-- 批量新增 -->
 <script>
 import useColumns from "./column";
-import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic';
+import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList,importInner} from '@/api/changeApply/basic';
 
 
 export default {
@@ -22,6 +22,7 @@ export default {
     ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
     ElPopoverTreeSelect: () =>
       import("@/components/popover-tree-select/index.vue"),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
   },
 
   data() {
@@ -101,13 +102,12 @@ export default {
         this.params.status = '0';
         console.log(this.$store.state.user,'user');
         this.params.orgName = '德荣集团';
-        this.useRowAdd(this.tabName);
+        // this.useRowAdd(this.tabName);
       }
     },
 
     //
     async fetchItem(prop) {
-      console.log(prop,'prop----------------');
       try {
         // try
         this.loading = true;
@@ -227,6 +227,42 @@ export default {
         // await;
       })
     },
+
+    async handelImport(fileList){
+
+      try {
+
+        let formData = new FormData();
+
+        formData.append('file',fileList[0].raw);
+
+        this.$modal.loading("正在上传文件,请稍候...");
+
+        let {code,data} = await importInner(formData);
+
+        if(code == 200) {
+
+          this.params['materialBasic'].push(...data)
+
+          let {setVisible} =  this.$refs.batchImport;
+
+          setVisible(false);
+
+        }
+        
+      } catch (error) {
+        
+      }finally{
+        this.$modal.closeLoading();
+      }
+
+      },
+
+    async handleTemDownload(){
+
+      this.download('/material/change/downloadInner',{}, `物料信息模板${new Date().getTime()}.xlsx`);
+    },
+
   },
   created() {
   },
@@ -290,135 +326,145 @@ export default {
       </el-super-form>
 
 
-      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
-        <el-tab-pane
-          v-for="({ item, TableColumns: columns }, index) in TabColumns"
-          :key="index"
-          :label="item.title"
-          :name="item.key"
-          lazy
-        >
-          <div style="height: 420px;display:flex">
-            <el-super-table
-              v-model="materialInfo[item.key]"
-              :dict="dict"
-              :ref="tabName"
-              :columns="columns"
-              :size="$attrs.size"
-            >
-              <template slot="materialName" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                >
-                </component>
-              </template>
-              <!-- 判断是否禁用 -->
-              <template slot="drug" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial ==='0') "
-                >
-                <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+      <div style="position: relative;">
+        <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+          <el-tab-pane
+            v-for="({ item, TableColumns: columns }, index) in TabColumns"
+            :key="index"
+            :label="item.title"
+            :name="item.key"
+            lazy
+          >
+            <div style="height: 420px;display:flex">
+              <el-super-table
+                v-model="materialInfo[item.key]"
+                :dict="dict"
+                :ref="tabName"
+                :columns="columns"
+                :size="$attrs.size"
+              >
+                <template slot="materialName" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
+                    :size="$attrs.size"
+                    :source.sync="scope.row"
+                  >
+                  </component>
+                </template>
+                <!-- 判断是否禁用 -->
+                <template slot="drug" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
+                    :size="$attrs.size"
+                    :source.sync="scope.row"
+                    :disabled="!(scope.row.medicineMaterial ==='0') "
                   >
-                  </el-option>
-                </component>
-              </template>
-
-              <template slot="registrationNo" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial ==='0') "
-                >
-                </component>
-              </template>
-
-              <template slot="medicalDevices" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial ==='0') "
-                >
-                <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                  <el-option
+                      v-for="item in dict.type[scope.attr.dictName]"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </component>
+                </template>
+  
+                <template slot="registrationNo" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
+                    :size="$attrs.size"
+                    :source.sync="scope.row"
+                    :disabled="!(scope.row.medicineMaterial ==='0') "
                   >
-                  </el-option>
-                </component>
-              </template>
-              <template slot="maintenanceType" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial ==='0') "
-                >
-                <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                  </component>
+                </template>
+  
+                <template slot="medicalDevices" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
+                    :size="$attrs.size"
+                    :source.sync="scope.row"
+                    :disabled="!(scope.row.medicineMaterial ==='0') "
                   >
-                  </el-option>
-                </component>
-              </template>
-              <template slot="dosageFromName" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial ==='0') "
-                >
-                </component>
-              </template>
-
-
-              <el-table-column fixed="right" label="操作" width="120" align="center">
-                <template slot="header" slot-scope="scope">
-                  <el-button
-                    type="text"
+                  <el-option
+                      v-for="item in dict.type[scope.attr.dictName]"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </component>
+                </template>
+                <template slot="maintenanceType" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
                     :size="$attrs.size"
-                    @click="useRowAdd(tabName)"
+                    :source.sync="scope.row"
+                    :disabled="!(scope.row.medicineMaterial ==='0') "
                   >
-                    增行
-                  </el-button>
+                  <el-option
+                      v-for="item in dict.type[scope.attr.dictName]"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </component>
                 </template>
-                <template slot-scope="scope">
-                  <el-button
-                    type="text"
+                <template slot="dosageFromName" slot-scope="scope">
+                  <component
+                    v-bind="scope.attr"
+                    v-model="scope.row[scope.item.key]"
                     :size="$attrs.size"
-                    @click.native.prevent="useRowRemove(tabName, scope)"
+                    :source.sync="scope.row"
+                    :disabled="!(scope.row.medicineMaterial ==='0') "
                   >
-                  删除
-                  </el-button>
-                  <AmendantRecord
-                    v-if=" tabName ==='materialBasic' && addType === 'edit' && scope.row.id"
-                    v-model="scope.row"
-                  ></AmendantRecord>
+                  </component>
                 </template>
-              </el-table-column>
-            </el-super-table>
-          </div>
-        </el-tab-pane>
-      </el-tabs>
+  
+  
+                <el-table-column fixed="right" label="操作" width="120" align="center">
+                  <template slot="header" slot-scope="scope">
+                    <el-button
+                      type="text"
+                      :size="$attrs.size"
+                      @click="useRowAdd(tabName)"
+                    >
+                      增行
+                    </el-button>
+                  </template>
+                  <template slot-scope="scope">
+                    <el-button
+                      type="text"
+                      :size="$attrs.size"
+                      @click.native.prevent="useRowRemove(tabName, scope)"
+                    >
+                    删除
+                    </el-button>
+                    <AmendantRecord
+                      v-if=" tabName ==='materialBasic' && addType === 'edit' && scope.row.id"
+                      v-model="scope.row"
+                    ></AmendantRecord>
+                  </template>
+                </el-table-column>
+              </el-super-table>
+            </div>
+          </el-tab-pane>
+        </el-tabs>
+        <el-row style="position: absolute; top: 0px; right: 20px">
+          
+          <BatchImport
+            ref="batchImport"
+            @import="handelImport"
+            @temDownload="handleTemDownload"
+          ></BatchImport>
+        </el-row>
+      </div>
 
 
 

+ 2 - 1
src/views/purchase/purchase-order/add/column.js

@@ -209,7 +209,8 @@ export const Columns = [
       pkOrg: params.puOrg,
     }),
     isShow:true,
-    require: true,
+    
+    // require: true,
   },
   {
     key: "goodsAllocationName",

+ 23 - 3
src/views/purchase/purchase-order/add/index.vue

@@ -33,7 +33,7 @@ export default {
       loading:false,
       columns: NewColumns,
       rules: initRules(NewColumns),
-
+      count:0,
       params: {
         ...initParams(NewColumns),
         puOrderItemList: [],
@@ -66,6 +66,25 @@ export default {
       },
       deep: true,
     },
+    "params.billType":{
+      handler(nVal, oVal){
+
+        if((nVal === '21-Cxx-02' || nVal === '21-Cxx-04'  || nVal === '21-Cxx-10')){
+
+          this.rules.warehouseName = [
+            { required: true, message: "WMS入库仓库不能为空", trigger: "change" },
+          ];
+
+          this.rules.goodsAllocationName = [
+            { required: true, message: "货位不能为空", trigger: "change" },
+          ];
+        }else{
+          this.rules.warehouseName = null;
+          this.rules.goodsAllocationName = null;
+        }
+        this.count++;
+      }
+    }
   },
   methods: {
     beforeOpen() {
@@ -81,7 +100,7 @@ export default {
         this.params.puDeptName = deptName;
         this.params.billDate = new Date().Format('yyyy-MM-dd');
         console.log(this.params,'this.params');
-        this.addTableRow();
+        // this.addTableRow();
       }
     },
     setVisible(prop,iscopy) {
@@ -567,6 +586,7 @@ export default {
       label-width="140px"
       :model="params"
       :rules="rules"
+      :key="count"
     >
       <el-card
         :body-style="{
@@ -611,7 +631,7 @@ export default {
                 :placeholder="column.placeholder"
                 :clearable="column.clearable"
                 :disabled="column.disabled"
-                style="width: 100%"
+                style="width: 100%;"
               >
               </el-input>
               <dr-popover-select