yusheng 1 жил өмнө
parent
commit
a458e1dbba

+ 10 - 0
src/api/bpm/components/saleManage/contact.js

@@ -104,3 +104,13 @@ export async function cancel(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 获取供应商最小订购数量
+ */
+export async function listByContactId(data) {
+  const res = await request.post('/eom/contactproduct/listByContactId',  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 18 - 6
src/views/bpm/collaborative/index.vue

@@ -84,9 +84,9 @@
                         </el-form-item>
                       </el-col>
                       <el-col v-bind="{ span: 10 }">
-                        <el-form-item label="创建时间:" prop="createTime" label-width="90px">
+                        <el-form-item label="创建时间:" prop="createTime1" label-width="90px">
                           <el-date-picker
-                            v-model="params.createTime"
+                            v-model="createTime1"
                             style="width: 100%"
                             value-format="yyyy-MM-dd HH:mm:ss"
                             type="daterange"
@@ -243,9 +243,9 @@
                         </el-form-item>
                       </el-col>
                       <el-col v-bind="{ span: 6 }">
-                        <el-form-item label="创建时间:" prop="createTime" label-width="90px">
+                        <el-form-item label="创建时间:" prop="createTime1" label-width="90px">
                           <el-date-picker
-                            v-model="params.createTime"
+                            v-model="createTime1"
                             style="width: 100%"
                             value-format="yyyy-MM-dd HH:mm:ss"
                             type="daterange"
@@ -399,9 +399,9 @@
                         </el-form-item>
                       </el-col>
                       <el-col v-bind="{ span: 6 }">
-                        <el-form-item label="创建时间:" prop="createTime" label-width="90px">
+                        <el-form-item label="创建时间:" prop="createTime1" label-width="90px">
                           <el-date-picker
-                            v-model="params.createTime"
+                            v-model="createTime1"
                             style="width: 100%"
                             value-format="yyyy-MM-dd HH:mm:ss"
                             type="daterange"
@@ -546,6 +546,7 @@ export default {
       params: {...defaultParams},
       statusList: [],
       formColumnList: [],
+      createTime1:[]
     }
   },
   computed: {
@@ -836,11 +837,14 @@ export default {
     },
     /* 表格数据源 */
     async datasource({page, limit, where, order}) {
+     let [createTimeBegin,createTimeEnd]=this.createTime1||[]
+
       let data = await getProcessInstancePage({
         pageNo: page,
         pageSize: limit,
         ...this.params,
         processType: '1',
+        createTimeBegin,createTimeEnd
       });
       data = data.list.map(item => {
         return {
@@ -864,12 +868,14 @@ export default {
     /*  重置 */
     reset() {
       this.params = {...defaultParams};
+      this.createTime1=[]
       this.params.formId = this.defaultTemplateList[0]?.id
       this.params.dictType = this.dictList['collaborative_type'][0].value;
       this.reload();
     },
     /* 表格数据源 */
     async deptDatasource({page, limit, where, order}) {
+      let [createTimeBegin,createTimeEnd]=this.createTime1||[]
       let data = await getProcessInstanceDeptPage({
         pageNo: page,
         pageSize: limit,
@@ -891,17 +897,21 @@ export default {
       let find = this.defaultTemplateList.find(item => item.id == this.params.formId) || {};
       let makingJson = JSON.parse(find.formJson.makingJson) || {}
       this.formColumnList = makingJson.list
+
       this.$refs.deptTable.reload({page: 1, where});
     },
     /*  重置 */
     deptReset() {
       this.params = {...defaultParams};
+      this.createTime1=[]
       this.params.formId = this.defaultTemplateList[0]?.id
       this.params.dictType = this.dictList['collaborative_type'][0].value;
       this.deptReload();
     },
     /* 表格数据源 */
     async noticeDatasource({page, limit, where, order}) {
+      let [createTimeBegin,createTimeEnd]=this.createTime1||[]
+
       let data = await getProcessInstanceNoticePage({
         pageNo: page,
         pageSize: limit,
@@ -928,6 +938,8 @@ export default {
     /*  重置 */
     noticeReset() {
       this.params = {...defaultParams};
+      this.createTime1=[]
+
       this.params.formId = this.defaultTemplateList[0]?.id
       this.params.dictType = this.dictList['collaborative_type'][0].value;
       this.noticeReload();

+ 1 - 1
src/views/bpm/handleTask/components/financialManage/payableManage/components/detailDialog.vue

@@ -64,7 +64,7 @@
             label="来源类型"
             prop="sourceType"
             style="margin-bottom: 22px">
-            <el-input value="销售订单" disabled></el-input>
+            <el-input :value="form.sourceType==2?'合同':form.sourceType==3?'采购订单':'对账单'" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">

+ 1 - 1
src/views/bpm/handleTask/components/financialManage/receivableManage/components/detailDialog.vue

@@ -64,7 +64,7 @@
             label="来源类型"
             prop="sourceType"
             style="margin-bottom: 22px">
-            <el-input value="销售订单" disabled></el-input>
+            <el-input :value="form.sourceType==2?'合同':form.sourceType==3?'销售订单':'对账单'" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">

+ 84 - 61
src/views/bpm/handleTask/components/inquiryManage/addDialog.vue

@@ -22,9 +22,7 @@
             prop="inquiryName"
             style="margin-bottom: 22px"
           >
-            <el-input
-              v-model="form.inquiryName"
-            ></el-input>
+            <el-input v-model="form.inquiryName"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -47,13 +45,13 @@
         </el-col>
         <el-col :span="12">
           <el-form-item prop="files" label="附件">
-            <fileMain v-model="form.files" ></fileMain>
-<!--            <fileUpload-->
-<!--              v-model="form.files"-->
-<!--              module="main"-->
-<!--              :showLib="false"-->
-<!--              :limit="1"-->
-<!--            />-->
+            <fileMain v-model="form.files"></fileMain>
+            <!--            <fileUpload-->
+            <!--              v-model="form.files"-->
+            <!--              module="main"-->
+            <!--              :showLib="false"-->
+            <!--              :limit="1"-->
+            <!--            />-->
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -86,7 +84,6 @@
       @changeInquiryManageList="changeInquiryManageList"
       @supplierSelect="supplierSelect"
       @supplierManageChange="supplierManageChange"
-
     ></inquiryManageList>
     <supplierManageDialog
       ref="supplierManageDialogRef"
@@ -101,8 +98,6 @@
       :obj="item"
       :isUpdate="isUpdate"
       @deliveryDateChange="deliveryDateChange"
-
-
     ></inquiryTable>
   </div>
 </template>
@@ -116,7 +111,7 @@
 
   import fileUpload from '@/components/upload/fileUpload';
   import dictMixins from '@/mixins/dictMixins';
-  import {deepClone} from "@/utils";
+  import { deepClone } from '@/utils';
   import { getplanDetail } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
   import {
     getpurchaseinquiry,
@@ -126,9 +121,9 @@
   import { copyObj } from '@/utils/util';
 
   import { getFile } from '@/api/system/file';
-  import {contactQueryByCategoryIdsAPI} from "@/api/bpm/components/supplierManage/contact";
-  import {contactDetail} from "@/api/bpm/components/saleManage/contact";
-  import fileMain from "@/components/addDoc/index.vue";
+  import { contactQueryByCategoryIdsAPI } from '@/api/bpm/components/supplierManage/contact';
+  import { contactDetail } from '@/api/bpm/components/saleManage/contact';
+  import fileMain from '@/components/addDoc/index.vue';
 
   export default {
     mixins: [dictMixins],
@@ -170,8 +165,8 @@
         delDetailIds: [],
         supplierProducts: {},
         formDef,
-        rawList:[],
-        outputList:[],
+        rawList: [],
+        outputList: [],
 
         acceptUnpackList: [
           {
@@ -193,7 +188,7 @@
           ],
           inquiryName: [
             { required: true, message: '请输入询价单名称', trigger: 'blur' }
-          ],
+          ]
         },
 
         // 提交状态
@@ -222,9 +217,12 @@
         if (data) {
           this.form = data;
           this.supplierList = data.supplierList;
-          let supplierObj = await this.getSupplierObj(data.detailList,'productId');
+          let supplierObj = await this.getSupplierObj(
+            data.detailList,
+            'productId'
+          );
           data.detailList.forEach((item) => {
-            item.supplierList = supplierObj[item.productId] || []
+            item.supplierList = supplierObj[item.productId] || [];
           });
           this.list = [...data.detailList, ...data.rawList, ...data.outputList];
           this.rawList = data.rawList;
@@ -233,8 +231,7 @@
           this.$nextTick(() => {
             this.$refs.inventoryTable &&
               this.$refs.inventoryTable.putTableValue(data.detailList);
-              // this.setIsInquiry()
-
+            // this.setIsInquiry()
           });
           if (type == 'init') {
             this.getplanData(data.planId, type);
@@ -259,7 +256,7 @@
               this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
             );
           });
-          this.$refs.inventoryTable.setIsInquiry(supplierList)
+          this.$refs.inventoryTable.setIsInquiry(supplierList);
         });
       },
       //获取计划详情
@@ -270,15 +267,18 @@
         this.outputList = data.outputDetailList;
         this.loading = false;
         if (data) {
-          let supplierObj = await this.getSupplierObj(data.detailList,'productId');
+          let supplierObj = await this.getSupplierObj(
+            data.detailList,
+            'productId'
+          );
           data.detailList.forEach((item) => {
             if (item.arrivalWay == 2 && item.arrivalBatch.length > 0) {
               item.expectReceiveDate =
                 item.arrivalBatch[item.arrivalBatch.length - 1].arriveDate;
             }
-            item.supplierList = supplierObj[item.productId] || []
-            if(item.supplierList.length === 1){
-              item.supplierIds = [item.supplierList[0].id]
+            item.supplierList = supplierObj[item.productId] || [];
+            if (item.supplierList.length === 1) {
+              item.supplierIds = [item.supplierList[0].id];
               // this.supplierSelect(item)
             }
           });
@@ -308,14 +308,14 @@
           });
         }
       },
-      async getSupplierObj(productList,queryName){
+      async getSupplierObj(productList, queryName) {
         try {
-          let categoryIds =  productList.map(item => item[queryName])
-          return await contactQueryByCategoryIdsAPI({categoryIds})
-        }catch (e) {
+          let categoryIds = productList.map((item) => item[queryName]);
+          return await contactQueryByCategoryIdsAPI({ categoryIds });
+        } catch (e) {
           return Promise.resolve({});
         }
-      } ,
+      },
       getValidate() {
         let promises = [];
         this.supplierList.forEach((item) => {
@@ -358,7 +358,6 @@
           (item) => item.supplierId != supplierId
         );
         // this.setIsInquiry()
-
       },
 
       //选择产品
@@ -372,25 +371,29 @@
       async supplierSelect(row) {
         let supplierIds = Object.keys(this.supplierProducts);
         const promises = [];
-        row.supplierIds.forEach(item => {
+        row.supplierIds.forEach((item) => {
           if (!supplierIds.includes(item)) {
             promises.push(contactDetail(item));
           } else {
-            this.productSetSupplier(this.supplierProducts[item], row)
+            this.productSetSupplier(this.supplierProducts[item], row);
           }
         });
-        Promise.all(promises).then(results => {
+        Promise.all(promises).then((results) => {
           results.forEach((data, index) => {
             this.supplierProducts[data.base.id] = data;
-            this.productSetSupplier(this.supplierProducts[data.base.id], row)
+            this.productSetSupplier(this.supplierProducts[data.base.id], row);
           });
         });
       },
       productSetSupplier(data, row) {
         let obj = deepClone(row);
-        obj.supplierProductName = data.productList.find(item => item.productCode == row.productCode)?.productName
-        obj.supplierProductCode = data.productList.find(item => item.productCode == row.productCode)?.productCode
-        obj.supplierName = data.base.name
+        obj.supplierProductName = data.productList.find(
+          (item) => item.productCode == row.productCode
+        )?.productName;
+        obj.supplierProductCode = data.productList.find(
+          (item) => item.productCode == row.productCode
+        )?.productCode;
+        obj.supplierName = data.base.name;
         let params = {
           ...data.base,
           supplierId: data.base.id,
@@ -402,22 +405,29 @@
           settlementModeName: '',
           taxRate: '',
           totalPrice: '',
-          resultList: [obj],
-        }
+          resultList: [obj]
+        };
         let supplierIds = this.supplierList.map((item) => item.supplierId);
-        let supplierIndex = supplierIds.indexOf(data.base.id)
+        let supplierIndex = supplierIds.indexOf(data.base.id);
         if (supplierIndex == -1) {
           this.supplierList.push(params);
         } else {
-          let isHave = this.supplierList[supplierIndex].resultList.some(item => item.productCode == obj.productCode)
+          let isHave = this.supplierList[supplierIndex].resultList.some(
+            (item) => item.productCode == obj.productCode
+          );
           if (!isHave) {
             // putTableValue
             //this.supplierList[supplierIndex].resultList.push(obj)
-            this.$set(this.supplierList[supplierIndex],'resultList',[ ...this.supplierList[supplierIndex].resultList,obj])
+            this.$set(this.supplierList[supplierIndex], 'resultList', [
+              ...this.supplierList[supplierIndex].resultList,
+              obj
+            ]);
             this.$nextTick(() => {
-              this.$refs['inquiryTable' + data.base.id][0]?.putTableValue(this.supplierList[supplierIndex].resultList)
+              this.$refs['inquiryTable' + data.base.id][0]?.putTableValue(
+                this.supplierList[supplierIndex].resultList
+              );
               this.$refs['inquiryTable' + data.base.id][0]?.getSpanArr();
-            })
+            });
           }
         }
       },
@@ -432,47 +442,60 @@
           item['settlementModeName'] = '';
           item['taxRate'] = '';
           item['totalPrice'] = '';
-          item['resultList'] = copyObj(this.$refs.inventoryTable.selection)
+          item['resultList'] = copyObj(this.$refs.inventoryTable.selection);
           item['resultList'].forEach((val) => {
             val['remark'] = '';
             item['deliveryDate'] = val.expectReceiveDate;
             val.supplierName = item.name;
           });
 
-          let supplierIndex = supplierIds.indexOf(item.supplierId)
+          let supplierIndex = supplierIds.indexOf(item.supplierId);
           if (supplierIndex == -1) {
             this.supplierList.push(item);
           } else {
             item['resultList'].forEach((val) => {
-              let isHave = this.supplierList[supplierIndex].resultList.some(i => i.productCode == val.productCode)
-              console.log(isHave,supplierIndex);
+              let isHave = this.supplierList[supplierIndex].resultList.some(
+                (i) => i.productCode == val.productCode
+              );
+              console.log(isHave, supplierIndex);
               if (!isHave) {
-
-                this.$set(this.supplierList[supplierIndex],'resultList',[ ...this.supplierList[supplierIndex].resultList,val])
-                this.$refs['inquiryTable' + item.id][0]?.putTableValue(this.supplierList[supplierIndex].resultList)
+                this.$set(this.supplierList[supplierIndex], 'resultList', [
+                  ...this.supplierList[supplierIndex].resultList,
+                  val
+                ]);
+                this.$refs['inquiryTable' + item.id][0]?.putTableValue(
+                  this.supplierList[supplierIndex].resultList
+                );
                 this.$nextTick(() => {
                   this.$refs['inquiryTable' + item.id][0]?.getSpanArr();
-                })
+                });
               }
-            })
+            });
           }
         });
       },
 
       async getTableValue() {
         let supplierList = [];
-        this.setIsInquiry()
+        this.setIsInquiry();
         this.supplierList.forEach((item) => {
           supplierList.push(
             this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
           );
         });
+        let is = false;
         supplierList.forEach((item) => {
           item.resultList.forEach((val) => {
             val['technicalDrawings'] = [];
+            if (val.minimumOrderQuantity > val.totalCount) {
+              is = true;
+            }
           });
         });
-
+        if (is) {
+          this.$message.warning('购买数量不能小于最低订购量!');
+          return;
+        }
         this.form.detailList = this.list;
         this.form.supplierList = supplierList;
 
@@ -485,7 +508,7 @@
             this.$message.warning('物品清单不能为空');
             return;
           }
-          
+
           this.form.supplierList.forEach((item) => {
             item.resultList = [
               ...item.resultList,

+ 39 - 7
src/views/bpm/handleTask/components/inquiryManage/inquiryTable.vue

@@ -326,7 +326,6 @@
             dictName="产地"
             clearable
             :disabled="status == 'Detail'"
-
             v-model="scope.row.provenance"
             multiple
           >
@@ -357,7 +356,7 @@
   import { getFile } from '@/api/system/file';
   import fileMain from '@/components/addDoc/index.vue';
   import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
-
+  import { listByContactId } from '@/api/bpm/components/saleManage/contact';
   // import headList from '@/views/saleManage/businessOpportunity/components/headList.vue';
   const defaultColumns = [
     {
@@ -470,6 +469,12 @@
       headerSlot: 'isRequired',
       align: 'center'
     },
+    {
+      minWidth: 120,
+      prop: 'minimumOrderQuantity',
+      label: '最低订购量',
+      align: 'center'
+    },
     {
       minWidth: 80,
       prop: 'availableCountBase',
@@ -681,12 +686,12 @@
       this.setDeliveryDays();
       this.setIsInquiry();
       this.getInventoryTotalAPI();
-
+      this.getListByContactId()
     },
     methods: {
       //计算交期
       setDeliveryDays() {
-        this.form.resultList.forEach((item,index) => {
+        this.form.resultList.forEach((item, index) => {
           let day =
             this.form.deliveryDate &&
             (new Date(this.form.deliveryDate).getTime() -
@@ -696,7 +701,11 @@
               60 /
               24;
 
-              this.$set(this.form.resultList[index],'deliveryDays', Math.ceil(day) || 1)
+          this.$set(
+            this.form.resultList[index],
+            'deliveryDays',
+            Math.ceil(day) || 1
+          );
         });
         this.$forceUpdate();
       },
@@ -730,6 +739,30 @@
           );
         });
       },
+      //获取最新订购量
+      async getListByContactId() {
+        let productIds = this.form.resultList
+          .filter((item) => item.productId)
+          .map((item) => item.productId);
+        if (productIds?.length > 0) {
+          const data = await listByContactId({
+            contactId: this.form.supplierId,
+            productIds
+          });
+          this.form.resultList
+            .filter((item) => item.productCode)
+            .forEach((item, index) => {
+              let pData = data.find((val) => val.productId == item.productId);
+              if (pData) {
+                this.$set(
+                  this.form.resultList[index],
+                  'minimumOrderQuantity',
+                  pData.minimumOrderQuantity
+                );
+              }
+            });
+        }
+      },
       getSpanArr() {
         let pos = 0;
         this.spanArr = [];
@@ -781,7 +814,7 @@
         });
       },
       setIsInquiry() {
-        return
+        return;
         this.$emit('setIsInquiry');
       },
       deliveryDateChange(row) {
@@ -851,7 +884,6 @@
         this.form.resultList = copyObj(data);
         this.setDeliveryDays();
         this.setIsInquiry();
-        
       },
 
       remove(productCode) {