Quellcode durchsuchen

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!213
黄梓星 vor 1 Jahr
Ursprung
Commit
0d4076c65a

+ 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();

+ 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();
-          })
+            })
+          }
         })
       }
     },

+ 4 - 2
src/views/purchase/purchase-order/add/index.vue

@@ -470,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) {
 

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

@@ -146,7 +146,7 @@ export const TabColumns = [
       // { key: "materialClassify", title: "物料分类",  },
       { key: "materialManufacturersCode", title: "厂家物料编码",  },
       { key: "specification", title: "规格",  },
-      { key: "model", title: "型号",  },
+      { key: "model", title: "型号",width: 120  },
       {
         key: "isMedcine",
         title: "医药物料",

+ 69 - 17
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)
             )
@@ -346,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;
 
@@ -357,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'){
 
-        row.qty && this.handleGetPrice();
+          // 修订
+          this.handleCalculateOrderAmount();
+
+        }else{
+
+          row['whetherCompleteInquiry'] = false;
+
+          row.qty && this.handleGetPrice();
+
+        }
 
       }
 
+      // // 物料数量变化----询价
+      // if (type == 'qty' && row.material) {
+
+      //   row['whetherCompleteInquiry'] = false;
+
+      //   // row.qty && this.handleGetPrice();
+      //   this.handleGetPrice();
+
+      // }
+
     },
     // 子表多选框改变
     handleTabCheckbox(type,source){
@@ -382,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;
         }
@@ -393,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() { },
@@ -433,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>
@@ -479,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" 
@@ -539,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>
@@ -638,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" 
@@ -657,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"
@@ -669,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;