Browse Source

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002201 1 year ago
parent
commit
e458ef8d0f

+ 12 - 1
src/api/business/purchase/purchase-order.js

@@ -74,6 +74,16 @@ const getPrice = (data) => {
   });
 }
 
+// 采购订单-计算金额
+const calculateOrderAmount = (data) => {
+  return request({
+    url: `/pu/order/calculateOrderAmount`,
+    method: "post",
+    data,
+  });
+}
+
+
 // 采购订单退回
 const documentsReturn = (data) => {
   return request({
@@ -83,7 +93,7 @@ const documentsReturn = (data) => {
   });
 }
 
-// 采购订单退回
+// 采购订单整单关闭
 const close = (data) => {
   return request({
     url: `/pu/order/close`,
@@ -144,6 +154,7 @@ export default {
   revision,
   remove,
   getPrice,
+  calculateOrderAmount,
   documentsReturn,
   close,
   toNc,

+ 37 - 3
src/components/Refers/refers.vue

@@ -20,17 +20,21 @@
             <el-table :data="dataList" v-loading="loading" size="small" border ref="contractTable"
               @select="handleSelectionChange" @row-click="rowSelect" height="calc(100% - 40px)">
               <el-table-column show-overflow-tooltip type="selection" header-align="center" align="center" width="50"/>
-              <el-table-column show-overflow-tooltip prop="id" header-align="center" align="center" min-width="90" :label="reciveForm.title + 'id'"/>
-              <el-table-column show-overflow-tooltip prop="code" header-align="center" align="center" min-width="90" :label="reciveForm.title + '编码'"/>
-              <el-table-column show-overflow-tooltip prop="name" header-align="center" align="center" min-width="90" :label="reciveForm.title + '名称'"/>
+              <!-- <el-table-column show-overflow-tooltip prop="id" header-align="center" align="center" min-width="90" :label="reciveForm.title + 'id'"/> -->
+              <el-table-column show-overflow-tooltip prop="code" header-align="center" align="center" min-width="90" label="编码"/>
+              <el-table-column show-overflow-tooltip prop="name" header-align="center" align="center" min-width="90" label="名称"/>
+              <el-table-column show-overflow-tooltip v-if="warehouseAttributes" prop="warehouseAttributes" header-align="center" align="center" min-width="90" label="仓库属性"/>
               <el-table-column show-overflow-tooltip v-if="orgName" prop="orgName" header-align="center" align="center" min-width="90" label="所属组织"/>
               <el-table-column show-overflow-tooltip v-if="warehouseCode" prop="warehouseCode" header-align="center" align="center" min-width="90" label="所属仓库编码"/>
               <el-table-column show-overflow-tooltip v-if="warehouseName" prop="warehouseName" header-align="center" align="center" min-width="90" label="所属仓库"/>
+              <el-table-column show-overflow-tooltip v-if="warehouseProperty" prop="warehouseProperty" header-align="center" align="center" min-width="90" label="仓库属性" :formatter="cksx"/>
               <el-table-column show-overflow-tooltip v-if="contactsName" prop="contactsName" header-align="center" align="center" min-width="90" label="联系人"/>
               <el-table-column show-overflow-tooltip v-if="contactsPhone" prop="contactsPhone" header-align="center" align="center" min-width="90" label="联系人电话"/>
               <el-table-column show-overflow-tooltip v-if="address" prop="address" header-align="center" align="center" min-width="90" label="详细地址"/>
               <el-table-column show-overflow-tooltip v-if="materialClassifyName" prop="materialClassifyName" header-align="center" align="center" min-width="90" label="物料分类"/>
               <el-table-column show-overflow-tooltip v-if="remark" prop="remark" header-align="center" align="center" min-width="90" label="备注"/>
+              <el-table-column show-overflow-tooltip v-if="shortName" prop="shortName" header-align="center" align="center" min-width="90" label="简称"/>
+              <el-table-column show-overflow-tooltip v-if="mneCode" prop="mneCode" header-align="center" align="center" min-width="90" label="助记码"/>
             </el-table>
             <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
               :current-page="searchForm.pageNo" :page-sizes="[5, 10, 15, 20]" :page-size="searchForm.pageSize"
@@ -63,13 +67,17 @@ export default {
       dataList: [],
       total: 0,
       orgName: false,
+      warehouseAttributes: false,
       warehouseCode: false,
       warehouseName: false,
+      warehouseProperty: false,
       contactsName: false,
       contactsPhone: false,
       address: false,
       materialClassifyName: false,
       remark: false,
+      shortName: false,
+      mneCode: false,
       orders: [],
       loading: false,
       visible: false,
@@ -89,6 +97,20 @@ export default {
     }
   },
   methods: {
+    cksx(row) {
+      switch (row.warehouseProperty) {
+        case '1':
+          return '电商库存'
+        case '2':
+          return '区域分仓公共库存'
+        case '3':
+          return '各项目仓库存'
+        case '4':
+          return '中心仓公共库存'
+        case '5':
+          return '事业发展部仓库'
+      }
+    },
     init(val) {
       this.visible = true;
       console.log("🚀 ~ file: refers.vue:79 ~ init ~ init(val):", val)
@@ -110,8 +132,10 @@ export default {
         // 仓库里面加组织
         if(res.rows.length !== 0 && res.rows[0].orgName) {
           this.orgName = true
+          this.warehouseAttributes = true
         } else {
           this.orgName = false
+          this.warehouseAttributes = false
         }
         // 选择货位里面加仓库
         if(res.rows.length !== 0 && res.rows[0].warehouseCode) {
@@ -125,16 +149,26 @@ export default {
         if(res.rows.length !== 0 && res.rows[0].contactsName) {
           this.contactsName = true
           this.contactsPhone = true
+          this.warehouseProperty = true
           this.address = true
           this.materialClassifyName = true
           this.remark = true
         } else {
           this.contactsName = false
           this.contactsPhone = false
+          this.warehouseProperty = false
           this.address = false
           this.materialClassifyName = false
           this.remark = false
         }
+        // 补单供应商档案
+        if (res.rows.length !== 0 && res.rows[0].mneCode) {
+          this.shortName = true
+          this.mneCode = true
+        } else {
+          this.shortName = false
+          this.mneCode = false
+        }
         this.loading = false;
         this.$nextTick(() => {
           this.setSelectRow();

+ 73 - 19
src/views/material/basicFile/details.vue

@@ -142,7 +142,12 @@
                       <template v-if="f.show">
 
                         <!-- 多选框 -->
-                        <el-form-item v-if="f.attribute == 'checkbox'" style="text-align: left;" :prop="f.prop">
+                        <el-form-item 
+                          v-if="f.attribute == 'checkbox'" 
+                          style="text-align: left;" 
+                          :prop="f.prop"
+                          :key="f.required"
+                        >
 
                           <el-checkbox
                             :label="f.name" name="type"
@@ -159,6 +164,7 @@
                         <el-form-item v-else-if="f.attribute == 'select'"
                           :id="(updateButtonGroup && f.apiUrl) ? 'selected' : ''"
                           :prop="f.apiUrl ? `${f.prop}Name` : f.prop"
+                          :key="f.required"
                           :rules="[{ required: f.required ,message: `请选择${f.name}`, trigger: 'change' }]"
                         >
                           <template slot="label">
@@ -210,7 +216,7 @@
                         </el-form-item>
 
                         <!--attribute 文本 数字 文本域 为null -->
-                        <el-form-item v-else :prop="f.prop">
+                        <el-form-item v-else :prop="f.prop" :key="f.required">
                           <template slot="label">
                             <el-tooltip class="item" effect="dark" placement="top-start" :disabled="f.name.length < 10">
                               <span>{{ f.name }}</span>
@@ -220,8 +226,10 @@
                             </el-tooltip>
                           </template>
 
-                          <el-input size="mini" v-model="basicData.value[f.prop]" :type="f.attribute || 'text'"
-                                    :readonly="handleJudge(f)">
+                          <el-input size="mini" 
+                            v-model="basicData.value[f.prop]" 
+                            :type="f.attribute || 'text'"
+                            :readonly="handleJudge(f)">
                           </el-input>
                         </el-form-item>
 
@@ -261,6 +269,7 @@
                     <el-form v-if="activeViceTab == 'material_medcine'" 
                       :inline="true" 
                       label-position="right"
+                      ref="medcineRef"
                       :model="medcineData.value" 
                       class="md-vice-content"
                       :rules="medcineRules"
@@ -649,7 +658,7 @@
   import materialApi from '@/api/material/basic';
   import {getDicts as getDicts} from '@/api/system/dict/data'
   import arrayUtils from '../tools/arrayUtils';
-  import { initRules} from './init/index';
+  import { initRules, initParams} from './init/index';
   import { getDetail } from '@/api/classify/basic';
 
   export default {
@@ -816,7 +825,7 @@
           return !(this.updateButtonGroup && attribute.edit && this.basicData.value['isInventoryStatus'] == '0');
         }
           // 效期管理(expiryDateManagerment):控制一下几个是否可编辑
-        // expiryUnitId 效期单位  usefulLife 有效期 usefulLifeUnitId 有效期至单位  "recentWarningPeriod" 近效期预警天数
+        // expiryUnitId 效期单位  usefulLife 有效期 usefulLifeUnitId 有效期至单位  
 
         else if (attribute.prop == 'expiryUnitId'
           || attribute.prop == 'usefulLife'
@@ -1026,7 +1035,7 @@
           let {code, data} = res;
           if (code == 200) {
 
-            _this.basicData.value = data.data;
+            _this.basicData.value ={... _this.basicData.value,...data.data};
 
             for (const key in data.data) {
               _this.basicData.value[key] = (typeof data.data[key] === 'number') ? String(data.data[key]) : data.data[key];
@@ -1446,49 +1455,49 @@
           // 基本信息
           case 'material':
             this.getTagList('material', (form) => {
-              this.basicData.form = form;
+              this.basicData.form = [...form];
               this.getMaterialDetails(this.materialId, 'material');
             })
             break;
           // 财物信息
           case 'material_finance':
             this.getTagList('material_finance', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getFinanceList(this.materialId);
             });
             break;
           // 利润中心信息
           case 'profit_center':
             this.getTagList('profit_center', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getCenterList(this.materialId);
             });
             break;
           // 采购信息
           case 'material_purchase':
             this.getTagList('material_purchase', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getPurchaseList(this.materialId);
             });
             break;
           // 库存信息
           case 'material_inventory':
             this.getTagList('material_inventory', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getInventoryList(this.materialId);
             });
             break;
           // 计划信息
           case 'material_plan':
             this.getTagList('material_plan', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getPlanList(this.materialId);
             });
             break;
           // 成本信息
           case 'material_cost':
             this.getTagList('material_cost', (form) => {
-              this.mainMsg.form = form;
+              this.mainMsg.form = [...form];
               this.getCostList(this.materialId);
             });
             break;
@@ -1525,6 +1534,9 @@
       // 刷新
       handleRefresh() {
         console.log('刷新');
+
+        this.$refs.basicMessageRef.clearValidate();
+        this.$refs.medcineRef.clearValidate();
         this.handleRest();
       },
       // 过滤
@@ -1814,7 +1826,7 @@
         console.log('更新导入');
       },
       // 确认弹窗操作
-      handleComfirmOption() {
+      async handleComfirmOption() {
         console.log('确认弹窗操作');
 
         this.optionDialog.show = false;
@@ -1822,7 +1834,12 @@
         // 取消基本信息修改
         if (this.updateButtonGroup) {
           this.updateButtonGroup = false;
-          this.handleRest();
+          // this.handleRest();
+          await this.getMaterialDetails(this.materialId, 'material');
+       
+          await this.getMedcineDetails(this.materialId, 'material_medcine');
+          this.$refs.basicMessageRef.clearValidate();
+          this.$refs.medcineRef.clearValidate();
 
         }
 
@@ -2096,14 +2113,37 @@
         })
       },
 
+      judgeIsRequriedByProps(message){
+        // condiition:条件,tergetNames:目标porps数组,formName:表单,formRef:表单ref名,
+
+        this[message.formName].form.forEach(formItem => {
+
+          let target = message.tergetNames.filter(t => t === formItem.prop);
+
+          if(target && target.length){
+
+            (formItem.required = message.condiition ? false : true);
+          }
+
+        })
+
+        this.rules = initRules(this[message.formName].form);
+
+        this.$nextTick( ()=> {
+
+          message.condiition && this.$refs[message.formRef].clearValidate(message.tergetNames);
+        })
+
+      },
 
       // 重新加载
       async handleRest() {
         this.loading = true;
         // 基本信息
         await this.getTagList('material', (form) => {
-          this.basicData.form = form;
+          this.basicData.form = [...form];
           this.rules = initRules(form);
+          this.basicData.value = initParams(this.basicData.form,'prop')
           this.getMaterialDetails(this.materialId, 'material');
         })
         // 医疗行业
@@ -2112,12 +2152,13 @@
             this.medcineData.value[item.prop] = ''
           })
           this.medcineData.form = form;
+          this.medcineData.value = initParams(this.medcineData.form,'prop')
           this.medcineRules = initRules(form);
           this.getMedcineDetails(this.materialId, 'material_medcine');
         })
 
       },
-
+      
     },
 
     watch: {
@@ -2156,7 +2197,7 @@
 
           this.basicData.form = this.basicData.form.map(formItem => {
 
-            if (formItem.prop === "businessLine") {
+            if (formItem.prop === "businessLine" && nVal) {
 
               if ( nVal.includes('介入耗材&5') || nVal.includes('骨科耗材&2') ||
                   nVal.includes('普通耗材&3') || nVal.includes('医用设备&1') ||
@@ -2202,7 +2243,20 @@
         },
         deep: true,
       },
+      // 效期管理 expiryDateManagerment 控制 expiryUnitId 效期单位  usefulLife 有效期 usefulLifeUnitId 有效期至单位 必填
+      "basicData.value.expiryDateManagerment":{
 
+        handler(nVal, oVal) {
+
+          this.judgeIsRequriedByProps({
+            condiition:(nVal === '2'),
+            tergetNames:['expiryUnitId','usefulLife','usefulLifeUnitId','recentWarningPeriod'],
+            formName:'basicData',
+            formRef:'basicMessageRef',
+          })
+        },
+        deep: true,
+      },
     },
 
     created() {

+ 21 - 1
src/views/material/basicFile/init/index.js

@@ -10,4 +10,24 @@ export const initRules = (prop) => {
       ];
     });
   return rules;
-};
+};
+
+export const initParams = (prop, key = "key", value = "value") =>
+  Object.fromEntries(prop.map((item) => [item[key], item[value]]));
+
+// export const initParams = (prop, key = "key", value = "value") => {
+//   // get params
+//   const object1 = Object.fromEntries(
+//     prop.map(({ item, attr }) => [item[key], attr[value]])
+//   );
+//   // get mapping params
+//   const object2 = {};
+//   prop
+//     .filter((item) => item.attr.dataMapping)
+//     .map(({ attr: { dataMapping } }) => {
+//       for (let key in dataMapping) {
+//         object2[key] = null;
+//       }
+//     });
+//   return { ...object1, ...object2 };
+// };

+ 1 - 1
src/views/material/changeApply/add.vue

@@ -308,7 +308,7 @@
         </el-button>
       </el-col>
       <el-col :span="1.5" style="margin: 0 10px;">
-        <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'edit'">提交</el-button>
+        <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button type="primary" size="small" plain @click="back">返回</el-button>

+ 33 - 25
src/views/material/requisition/add.vue

@@ -610,7 +610,7 @@
           v-if="pageStu == 'add' || pageStu == 'edit' || pageStu ==='copy' ">保存</el-button>
       </el-col>
       <el-col :span="1.5" style="margin: 0 10px;">
-        <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'edit'">提交</el-button>
+        <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button type="primary" size="small" plain @click="back">返回</el-button>
@@ -1302,19 +1302,23 @@ export default {
           })
         })
         Promise.all([form1, form2]).then(() => {
-          this.$modal.loading("保存中...");
-          editReq(sparams).then(res => {
-            if (res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: 'success'
-              });
+          if(this.basicForm.isMedicine == '0' && this.sysMaterialMedcineItemApply.length == 0) {
+            this.$modal.notifyWarning("医药物料需要维护物料类别!");
+          } else {
+            this.$modal.loading("保存中...");
+            editReq(sparams).then(res => {
+              if (res.code === 200) {
+                this.$message({
+                  message: res.msg,
+                  type: 'success'
+                });
+                this.$modal.closeLoading();
+                this.back()
+              }
+            }).catch(err => {
               this.$modal.closeLoading();
-              this.back()
-            }
-          }).catch(err => {
-            this.$modal.closeLoading();
-          })
+            })
+          }
         })
       } else {
 
@@ -1340,19 +1344,23 @@ export default {
           })
         })
         Promise.all([form1, form2]).then(() => {
-          this.$modal.loading("保存中...");
-          addReq(sparams).then(res => {
-            if (res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: 'success'
-              });
+          if (this.basicForm.isMedicine == '0' && this.sysMaterialMedcineItemApply.length == 0) {
+            this.$modal.notifyWarning("医药物料需要维护物料类别!");
+          } else {
+            this.$modal.loading("保存中...");
+            addReq(sparams).then(res => {
+              if (res.code === 200) {
+                this.$message({
+                  message: res.msg,
+                  type: 'success'
+                });
+                this.$modal.closeLoading();
+                this.back()
+              }
+            }).catch(err => {
               this.$modal.closeLoading();
-              this.back()
-            }
-          }).catch(err => {
-            this.$modal.closeLoading();
-          })
+            })
+          }
         })
       }
     },

+ 163 - 20
src/views/purchase/PurchaseDemandList/add.vue

@@ -246,7 +246,7 @@
             <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
               <template slot-scope="scope">
                 <el-form-item class="hang">
-                  <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="scope.row.reservedQty = ''">
+                  <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="cleanYLSL(scope)">
                     <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
                     </el-option>
                   </el-select>
@@ -333,7 +333,7 @@
           </el-table-column> 
           <el-table-column show-overflow-tooltip label="采购备注" align="center"  prop="puRemark" width="150px"/>
           <!-- <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center"  prop="lastWarehouseQty" /> -->
-          <el-table-column show-overflow-tooltip label="调拨占有量" align="center"  prop="superiorAllotQty" width="150px"/>
+          <el-table-column show-overflow-tooltip label="调拨占有量" align="center"  prop="allotQty" width="150px"/>
           <el-table-column show-overflow-tooltip label="最终净需求量" align="center"  prop="resDemandQty" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
@@ -649,13 +649,7 @@ export default {
       customerOptions: [],
       pickerOptionsEnd: {
         disabledDate: (time) => {
-          let beginDateVal = this.basicForm.demandDate;
-          if (beginDateVal) {
-            return (
-              time.getTime() <
-              new Date(beginDateVal).getTime() - 8.64e7
-            );
-          }
+          return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
         }
       },
       isBDXQ: false,
@@ -744,6 +738,11 @@ export default {
       //   this.isYl = false
       // }
     },
+    // 清空
+    cleanYLSL(scope) {
+      scope.row.reservedQty = ''
+      scope.row.reservedPeriod = ''
+    },
     copy() {
       this.$modal.msgSuccess("复制成功");
       this.sonPageStu = 'add'
@@ -1148,7 +1147,7 @@ export default {
       }
       if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
         this.adjust.deliveryAddressName = selection[0].name
-        this.adjust.deliveryAddress = selection[0].code
+        this.adjust.deliveryAddress = selection[0].id
         this.adjust.contacts = selection[0].contactsName
         this.adjust.contactsPhone = selection[0].contactsPhone
         this.adjust.address = selection[0].address
@@ -1177,30 +1176,174 @@ export default {
       }
       if(this.referCondition.title == '选择收货地址') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
-        this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
+        this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
         this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
         this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
       }
     },
     // 粘贴来的数据
-    pasteMe(e, scope, index) {
+    async pasteMe(e, scope, index) {
       e.preventDefault() //阻止默认粘贴事件
       let source = e.clipboardData.getData("Text");
       console.log('scope', scope.column.property)
       console.log('eee:', source)
       // 首先对源头进行解析
       let rows = source.split("\r\n"); // 拆成一个数组
-      // rows.pop()
+      // 数组去除空字符串
+      rows = rows.filter(item => {
+        return item && item.trim()
+      })
       console.log('复制的数组',rows);
       console.log('列表的数组',this.basicForm.puDemandItemList)
-      rows.forEach(item => {
-        console.log('items',item)
-        // getRefer({ type: 'MATERIAL_PARAM', code: item }).then(res => {
-
-        // })
-        this.basicForm.puDemandItemList.push(this.basicForm.puDemandItemList[scope.$index])
-      })
+      let linArr = []
+      for (let i = 0; i<rows.length; i++) {
+        console.log('items',rows[i])
+        await getRefer({ type: 'MATERIAL_PARAM', code: rows[i] }).then(res => {
+          if (res.code === 200) {
+            let line = {
+              contacts: null,
+              id: null,
+              demandId: null,
+              status: null,
+              businessDept: null,
+              businessDeptName: null,
+              materialCategory: null,
+              buyer: null,
+              buyerName: null,
+              mateiralClassifyOne: null,
+              materialClassifyOneName: null,
+              materialClassifyTwo: null,
+              materialClassifyTwoName: null,
+              materialClassifyThree: null,
+              materialClassifyThreeName: null,
+              materialClassifyFour: null,
+              materialClassifyFourName: null,
+              materialCode: null,
+              material: null,
+              materialName: null,
+              classifyId: null,
+              specification: null,
+              unit: null,
+              unitName: null,
+              manufacturerName: null,
+              registrant: null,
+              puPeriod: null,
+              expiryUnit: null,
+              expiry: null,
+              minPackage: null,
+              minOrderQty: null,
+              minBatch: null,
+              safeStock: null,
+              averageQtyMonth: null,
+              qty: null,
+              adjustmentPersonal: null,
+              adjustmentTime: null,
+              manualRegulation: null,
+              updateCause: null,
+              reservedProportion: null,
+              reservedPeriod: null,
+              reservedQty: null,
+              demandPeriod: null,
+              forecastClassify: null,
+              onemonthAvgVolume: null,
+              threemonthAvgVolume: null,
+              deliveryDate: null,
+              isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
+              isReplenishment: this.basicForm.billType == 'BDXQ' ? 'Y' : 'N',
+              isBatchLock: 'N',
+              remark: null,
+              puRemark: null,
+              lastWarehouseQty: null,
+              resDemandQty: null,
+              lastWarehouse: null,
+              lastWarehouseName: null,
+              deliveryWarehouse: null,
+              deliveryWarehouseName: null,
+              lastAllocation: null,
+              lastAllocationName: null,
+              deliveryAllocation: null,
+              deliveryAllocationName: null,
+              passageOn: null,
+              puOrg: null,
+              purOrgName: null,
+              lastStockQty: null,
+              superiorCenterQty: null,
+              superiorAllotQty: null,
+              availableQty: null,
+              statusAllot: 'N',
+              additionalSupplier: null,
+              additionalSupplierName: null,
+              periodUnit: null,
+              demandCustomer: this.basicForm.customer,
+              demandCustomerName: this.basicForm.customerName,
+              businessDept: this.basicForm.demandDept,
+              businessDeptName: null,
+              lastStockOrg: null,
+              lastStockOrgName: null,
+              superiorStockOrg: null,
+              superiorStockOrgName: null,
+              allotCode: null,
+              deliveryAddress: null,
+              deliveryAddressName: null,
+              contacts: null,
+              contactsPhone: null,
+              address: null,
+              source: null,
+              priceType: 'order',
+              puManagerApprover: null,
+              puManagerApproverName: null,
+              processTime: null,
+              affirmer: null,
+              tenantId: null,
+              revision: null,
+              createBy: null,
+              createByName: null,
+              createTime: null,
+              updateBy: null,
+              updateByName: null,
+              updateTime: null,
+              delFlag: 0,
+              // 新增字段
+              model: null,
+              storageCondition: null,
+              transportationCondition: null,
+            }
+            line.businessDept = res.rows[0].businessDepartment
+            line.businessDeptName = res.rows[0].businessDepartmentName
+            line.materialCode = res.rows[0].code
+            line.material = res.rows[0].id
+            line.materialName = res.rows[0].name
+            line.classifyId = res.rows[0].classifyId
+            line.materialClassifyOneName = res.rows[0].oneClass
+            line.materialClassifyTwoName = res.rows[0].twoClass
+            line.materialClassifyThreeName = res.rows[0].threeClass
+            line.materialClassifyFourName = res.rows[0].fourClass
+            line.specification = res.rows[0].specification
+            line.model = res.rows[0].model
+            line.unit = res.rows[0].unitId
+            line.unitName = res.rows[0].unitIdName
+            line.registrant = res.rows[0].registrant
+            line.manufacturerName = res.rows[0].manufacturerIdName
+            line.puPeriod = res.rows[0].deliveryPeriod
+            line.expiry = res.rows[0].usefulLife
+            line.expiryUnit = res.rows[0].expiryUnitIdName
+            // line.minPackage = res.rows[0].usefulLife
+            line.minPackage = res.rows[0].minPackQty
+            line.minOrderQty = res.rows[0].minOrderQty
+            line.minBatch = res.rows[0].minBatchQty
+            line.safeStock = res.rows[0].safeStock
+            line.purOrgName = res.rows[0].purchasingOrganizationName
+            line.puOrg = res.rows[0].purchasingOrganization
+            // 物料存储条件和运输条件
+            line.transportationCondition = res.rows[0].transportationCondition
+            line.storageCondition = res.rows[0].storageCondition
+            linArr[i] = line
+          }
+        })
+        console.log('临时数组', linArr)
+      }
+      this.basicForm.puDemandItemList.push(...linArr)
       console.log('列表', this.basicForm.puDemandItemList)
       // this.basicForm.puDemandItemList.forEach(e => {
       //   rows.forEach(d => {

+ 1 - 1
src/views/purchase/PurchaseDemandList/index.vue

@@ -71,7 +71,7 @@
           <el-row :gutter="10">
             <el-col :span="1.5">
               <el-form-item label="需求部门">
-                <el-select clearable v-model="queryParams.demandDept" size="mini" :disabled="disable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
+                <el-select clearable v-model="queryParams.demandDept" size="mini" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
                   <el-option
                     v-for="item in deptOptions"
                     :key="item.id"

+ 8 - 0
src/views/purchase/purchase-order/add/column.js

@@ -515,6 +515,14 @@ export const TabColumns = [
         disabled:true,
         require:false,
       },
+      { 
+        key: "demandCode",
+        title:"采购需求单号",
+        inputType: "Input", 
+        width: 180,
+        disabled:true,
+        require:false,
+      },
       // { key: "orderId", title: "采购订单ID", inputType: "Input", width: 180 },
       // {key: "material",title: "物料",inputType: "Input",   },
       {

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

@@ -126,6 +126,7 @@ export default {
             if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
               this.params[key].forEach((v) => {
                 v.id = "";
+                v.demandCode = "";
               });
 
             }
@@ -311,7 +312,7 @@ export default {
           }
         ]
 
-      await  relevanceRefer.forEach(async (refer) =>{
+        await relevanceRefer.forEach(async (refer) =>{
 
           try {
 
@@ -333,6 +334,23 @@ export default {
           } catch (error) {}
           
         })
+
+        // 明细不为空的情况下进行询价
+        let detailList = this.params['puOrderItemList'].filter(item => (
+          item.material && item.material != '' 
+        ))
+
+        if(detailList.length){
+
+          this.params['puOrderItemList'] = this.params['puOrderItemList'].map(item => {
+            
+            item['whetherCompleteInquiry'] = false
+          
+            return item;
+          });
+
+          await this.handleGetPrice();
+        }
         
       }
 
@@ -452,9 +470,11 @@ export default {
     },
     // 询价 getPrice
     async handleGetPrice() {
-      try {
 
-        let { code, data } = await orderApi.getPrice({ ...this.params });
+      try {
+        
+        // action:insert(新增)、revise(修订)、update(编辑)
+        let { code, data } = await orderApi.getPrice({ ...this.params,action: 'insert' });
 
         if (code == 200) {
 

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

@@ -139,13 +139,14 @@ export const TabColumns = [
     tableColumns: [
       { key: "rowNo", title: "行号",width:80, },
       // { key: "orderId", title: "采购订单ID" },
+      { key: "demandCode", title:"采购需求单号"},
       { key: "material", title: "物料ID" },
       { key: "materialName", title: "物料名称",  },
       { key: "materialCode", title: "物料编码",  },
       // { key: "materialClassify", title: "物料分类",  },
       { key: "materialManufacturersCode", title: "厂家物料编码",  },
       { key: "specification", title: "规格",  },
-      { key: "model", title: "型号",  },
+      { key: "model", title: "型号",width: 120  },
       {
         key: "isMedcine",
         title: "医药物料",

+ 86 - 18
src/views/purchase/purchase-order/edit/index.vue

@@ -212,7 +212,7 @@ export default {
       this.judgeSaveCondition(async()=>{
         try {
             this.loading = true;
-            const { code, msg } = await (this.handleIsRevise(this.params.status) ?
+            const { code, msg } = await (this.handleIsRevise() ?
               orderApi.revision(this.params)
               : orderApi.edit(this.params)
             )
@@ -256,7 +256,7 @@ export default {
           }
         ]
 
-      await  relevanceRefer.forEach(async (refer) =>{
+        await relevanceRefer.forEach(async (refer) =>{
 
           try {
 
@@ -278,7 +278,23 @@ export default {
           } catch (error) {}
           
         })
+
+        // 明细不为空的情况下进行询价
+        let detailList = this.params['puOrderItemList'].filter(item => (
+          item.material && item.material != '' 
+        ))
         
+        if(detailList.length){
+
+          this.params['puOrderItemList'] = this.params['puOrderItemList'].map(item => {
+
+            item['whetherCompleteInquiry'] = false
+
+            return item;
+          });
+
+          await this.handleGetPrice();
+        }
       }
     },
     // 子表参照改变之后
@@ -330,8 +346,9 @@ export default {
 
      // 子表下拉框改变
      handleTabSelectChange(type,row){
-
-      if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+ 
+      // && row.qty
+      if(type == 'priceType' && row.material  && row.qty != ""){
 
         row['whetherCompleteInquiry'] = false;
 
@@ -341,15 +358,36 @@ export default {
     },
     // 子表inputNumber
     handleInputChange(row, type) {
+
+
       // 物料数量变化----询价
-      if (type == 'qty' && row.material) {
+      if (type == 'qty' && row.material ) {
 
-        row['whetherCompleteInquiry'] = false;
+        if(this.params.status === '2'){
+
+          // 修订
+          this.handleCalculateOrderAmount();
+
+        }else{
 
-        row.qty && this.handleGetPrice();
+          row['whetherCompleteInquiry'] = false;
+
+          row.qty && this.handleGetPrice();
+
+        }
 
       }
 
+      // // 物料数量变化----询价
+      // if (type == 'qty' && row.material) {
+
+      //   row['whetherCompleteInquiry'] = false;
+
+      //   // row.qty && this.handleGetPrice();
+      //   this.handleGetPrice();
+
+      // }
+
     },
     // 子表多选框改变
     handleTabCheckbox(type,source){
@@ -366,8 +404,11 @@ export default {
     // 询价 getPrice
     async handleGetPrice() {
       try {
-        // let { puOrg, priceType, customer, assignSupplier, material, } = data;
-        let { code, data } = await orderApi.getPrice({ ...this.params })
+        // action:insert(新增)、revise(修订)、update(编辑)
+        let { code, data } = await orderApi.getPrice({
+          ...this.params ,
+          action: this.handleIsRevise() ? 'revise':'update',
+        });
         if (code == 200) {
           this.params = data;
         }
@@ -377,11 +418,38 @@ export default {
 
       }
     },
+    // 修订——计算金额
+    async handleCalculateOrderAmount(){
+
+      try {
+        let { code, data } = await orderApi.calculateOrderAmount({ 
+          ...this.params,
+          action: this.handleIsRevise() ? 'revise':'update',
+        });
+        
+          code == 200 &&  (this.params = data);
+
+      } catch (error) {} 
+      finally {}
+
+    },
+
     // 判断修订还是编辑
-    handleIsRevise(status) {
-      return status == '2';
+    handleIsRevise() {
+      return this.params.status == '2';
+    },
+
+    // /handleIsRevise() ? scope.row[cColumn.key] : Infinity
+    getInputNumberMax(key,row){
+
+      if(key === 'qty'){
+
+        return this.handleIsRevise() ? row['originalQty'] : Infinity
+      
+      }
+
+      return Infinity;
     },
-    
   },
   created() {},
   mounted() { },
@@ -417,7 +485,7 @@ export default {
             justify-content: space-between;
             align-items: center;
           ">
-          <h3>{{ handleIsRevise(params.status) ? '修订' : '编辑' }}</h3>
+          <h3>{{ handleIsRevise() ? '修订' : '编辑' }}</h3>
           <div style="text-align: right">
             <el-button :size="size" @click="handleCancel">取 消</el-button>
             <el-button :size="size" type="danger" @click="handleSava">更 新</el-button>
@@ -463,7 +531,7 @@ export default {
               <el-input-number v-if="column.inputType === 'InputNumber'" 
                 v-model="params[column.key]"
                 :precision="column.precision"
-                :max="handleIsRevise(params.status) ? params[column.key] : Infinity"
+                :max="handleIsRevise() ? params[column.key] : Infinity"
                 :controls-position="column.controlsPosition" 
                 :placeholder="column.placeholder"
                 :clearable="column.clearable" 
@@ -523,7 +591,7 @@ export default {
               <file-upload-center v-if="column.inputType === 'Upload'" 
                 v-model="params[column.key]"
                 :file-type="column.fileType" 
-                :disabled="handleIsRevise(params.status)"
+                :disabled="handleIsRevise()"
                 ></file-upload-center>
             </el-form-item>
           </el-col>
@@ -622,7 +690,7 @@ export default {
                     v-model="scope.row[cColumn.key]"
                     :precision="cColumn.precision"
                     :controls-position="cColumn.controlsPosition"
-                    :max="handleIsRevise(params.status) ? scope.row[cColumn.key] : Infinity"
+                    :max="getInputNumberMax(cColumn.key, scope.row)"
                     @change="handleInputChange(scope.row, cColumn.key)" 
                     :placeholder="cColumn.placeholder"
                     :clearable="cColumn.clearable" 
@@ -641,7 +709,7 @@ export default {
               <el-table-column fixed="right" label="操作" width="120">
                 <template slot-scope="scope">
                   <el-button 
-                    v-if="params.source == '3' && !handleIsRevise(params.status)" 
+                    v-if="params.source == '3' && !handleIsRevise()" 
                     @click.native.prevent="delTableRow(params[tabName], scope.$index)" 
                     type="text" 
                     size="small"
@@ -653,7 +721,7 @@ export default {
           </el-tab-pane>
         </el-tabs>
         <el-row style="position: absolute; top: 20px; right: 20px">
-          <el-button v-if="params.source == '3' && !handleIsRevise(params.status)" :size="size"
+          <el-button v-if="params.source == '3' && !handleIsRevise()" :size="size"
             @click="addTableRow(params[tabName])">增行</el-button>
         </el-row>
       </el-card>

+ 3 - 2
src/views/purchase/purchase-order/edit/initColumn.js

@@ -57,7 +57,7 @@ export const forbidden = (isEdit,source) => {
     updateColumns.forEach(item => {
 
       if (item.key == 'buyerName' || item.key == 'puDeptName' || item.key == 'deductionMoney' ||
-        item.key == 'supplierContactsName' || item.key == 'agentName' || item.key == 'isInvoice' ||
+        item.key == 'supplierContactsName' || item.key == 'agentName' || 
         item.key == 'rebateMoney' || item.key == 'remark') {
         item.disabled = false;
         item.readonly = false;
@@ -73,7 +73,8 @@ export const forbidden = (isEdit,source) => {
         if (t.key == 'unit' || t.key == 'qty' ||
           t.key == 'place' || t.key == 'arrivalDatePlan' || t.key == 'storageCondition' ||
           t.key == 'carriageCondition' || t.key == 'customerName' || t.key == 'isBatchLock' ||
-          t.key == 'isReplenishment' || t.key == 'originalQty' || t.key == 'originalMoney' 
+          t.key == 'isReplenishment' || t.key == 'originalQty' || t.key == 'originalMoney' ||
+          t.key == 'taxPrice' || t.key == 'taxDeductMoneya'
         ) {
 
           t.disabled = false;

+ 55 - 7
src/views/purchase/purchase-order/index.vue

@@ -216,26 +216,73 @@ export default {
         this.loading = false;
       }
     },
+    // 批量提交
+    handleBatchSubmit(){
+
+      let inconformity = this.checkedList.filter(row => !(row.status == '0' || row.status == '3'));
+
+      console.log(inconformity,'inconformity--------');
+
+      if(!inconformity.length && this.checkedList.length){
+
+        let puOrderIds = this.checkedList.map( item => Number(item.id));
+
+        this.fetchSubmit(puOrderIds);
+      
+      }else{
+        this.$message({
+          message: '当前选中存在不满足提交条件的数据!',
+          type: 'warning'
+        });
+      }
+
+      
+    },
     // 提交
     handleSubmit(row) {
 
-      try {
+      let puOrderIds = [Number(row.id)];
+
+      this.fetchSubmit(puOrderIds);
+
+      // try {
 
-       this.handleConfirmTips(async()=>{
+      //  this.handleConfirmTips(async()=>{
 
-         let { code } = await orderApi.submit({ puOrderId: row.id });
+      //    let { code } = await orderApi.submit({ puOrderId: row.id });
  
-         if (code == 200) {
+      //    if (code == 200) {
  
-          this.handleRefreshList();
+      //     this.handleRefreshList();
  
-         }
+      //    }
+
+      //  })
+      // } catch (error) {
+      // } finally {
+      // }
+    },
+    fetchSubmit(puOrderIds){
+
+      try {
+
+        this.handleConfirmTips(async()=>{
+
+          let { code } = await orderApi.submit({ puOrderIds});
 
-       })
+          if (code == 200) {
+
+          this.handleRefreshList();
+
+          }
+
+        })
       } catch (error) {
       } finally {
       }
+      
     },
+
     // 判断“整单退回”按钮
     judgeIsAllReturn() {
       if (this.checkedList.length == 1) {
@@ -528,6 +575,7 @@ export default {
 
         <el-button-group style="margin-left: 10px">
           <el-button size="mini" :disabled="checkedList.length != 1" @click="handleCopy">复制</el-button>
+          <el-button size="mini" @click="handleBatchSubmit">批量提交</el-button>
         </el-button-group>
 
         <el-button-group style="margin-left: 10px" :key="checkedList.length + 1">

+ 1 - 0
src/views/purchase/purchase-order/purchaseReturn/index.vue

@@ -90,6 +90,7 @@ export default{
     handleDetailSelect(selection, row){
 
     },
+    handleReferChange(){}
 
 
   },