yusheng 1 rok temu
rodzic
commit
f454273a1d

+ 31 - 20
src/views/purchasingManage/inquiryManage/components/addDialog.vue

@@ -166,6 +166,7 @@
         :obj="item"
         :isUpdate="isUpdate"
         @deliveryDateChange="deliveryDateChange"
+        @setIsInquiry="setIsInquiry"
       ></inquiryTable>
       <process-submit-dialog
         api-fun-name="purchaseinquiryStatusAPI"
@@ -341,8 +342,8 @@
         }
       },
       deliveryDateChange(fn) {
-          let data=this.$refs.inventoryTable.getTableValue()||[]
-           fn(data)
+        let data = this.$refs.inventoryTable.getTableValue() || [];
+        fn(data);
       },
 
       //获取计划详情
@@ -356,10 +357,7 @@
         if (data) {
           let categoryIds = [...data.detailList].map((item) => item.productId);
           let supplierObj = await contactQueryByCategoryIdsAPI({ categoryIds });
-          [
-            ...data.detailList
-
-          ].forEach((item) => {
+          [...data.detailList].forEach((item) => {
             if (item.arrivalWay == 2 && item.arrivalBatch.length > 0) {
               item.expectReceiveDate =
                 item.arrivalBatch[item.arrivalBatch.length - 1].arriveDate;
@@ -375,7 +373,7 @@
           this.form.planCode = data.planCode;
           this.form.planName = data.planName;
           this.form.isFirstProcess = data.isFirstProcess;
-          this.form.inquiryName=data.planName
+          this.form.inquiryName = data.planName;
 
           // if (type == 'change') {
           //   this.supplierList.forEach((item) => {
@@ -392,11 +390,10 @@
             ...data.rawDetailList,
             ...data.outputDetailList
           ];
-          data.detailList.forEach(item=>{
-            item.isWinner=1
-          })
+          data.detailList.forEach((item) => {
+            item.isWinner = 1;
+          });
           this.$nextTick(() => {
-
             this.$refs.inventoryTable &&
               this.$refs.inventoryTable.putTableValue(data.detailList);
             // this.$refs.rawDetailListRef &&
@@ -471,6 +468,7 @@
         this.supplierList = this.supplierList.filter(
           (item) => item.supplierId != supplierId
         );
+        this.setIsInquiry()
       },
 
       //选择产品
@@ -485,6 +483,10 @@
         this.getplanData(data.id, 'change');
       },
       async supplierSelect(row) {
+        if (!row) {
+          this.$message.warning('请选择供应商');
+          return;
+        }
         let supplierIds = Object.keys(this.supplierProducts);
         const promises = [];
         row.supplierIds.forEach((item) => {
@@ -501,6 +503,19 @@
           });
         });
       },
+
+      setIsInquiry() {
+        let supplierList = [];
+
+        this.$nextTick(() => {
+          this.supplierList.forEach((item) => {
+            supplierList.push(
+              this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
+            );
+          });
+          this.$refs.inventoryTable.setIsInquiry(supplierList)
+        });
+      },
       productSetSupplier(data, row) {
         let obj = deepClone(row);
         obj.supplierProductName = data.productList.find(
@@ -560,24 +575,20 @@
           item['totalPrice'] = '';
           item['resultList'] = copyObj(this.$refs.inventoryTable.selection);
           item['resultList'].forEach((val) => {
-            item['deliveryDate']=val.expectReceiveDate
+            item['deliveryDate'] = val.expectReceiveDate;
             val['remark'] = '';
-            val.supplierName = item.name; 
-            val.supplierProductCode = val.productCode; 
-            val.supplierProductName = val.productName; 
+            val.supplierName = item.name;
+            val.supplierProductCode = val.productCode;
+            val.supplierProductName = val.productName;
             val.isWinner = 1;
           });
 
           let supplierIndex = supplierIds.indexOf(item.supplierId);
           if (supplierIndex == -1) {
-  
             this.supplierList.push(item);
-
-          
           } else {
-            console.log(1)
+            console.log(1);
             item['resultList'].forEach((val) => {
-  
               let isHave = this.supplierList[supplierIndex].resultList.some(
                 (i) => i.productCode == val.productCode
               );

+ 29 - 23
src/views/purchasingManage/inquiryManage/components/inquiryTable.vue

@@ -205,10 +205,7 @@
           style="margin-bottom: 20px"
           :prop="'resultList.' + scope.$index + '.deliveryDays'"
         >
-          <el-input
-            v-model="scope.row.deliveryDays"
-            disabled
-          ></el-input>
+          <el-input v-model="scope.row.deliveryDays" disabled></el-input>
         </el-form-item>
       </template>
       <template v-slot:guaranteePeriod="scope" v-if="status !== 'Detail'">
@@ -343,8 +340,6 @@
       <template v-slot:isRequired="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
-
-
     </ele-pro-table>
   </el-form>
 </template>
@@ -664,28 +659,34 @@
     },
 
     created() {
-      this.obj.resultList.forEach(item=>{
-        this.obj['deliveryDate']=this.obj.deliveryDate||item.expectReceiveDate
-      })
+      this.obj.resultList.forEach((item) => {
+        this.obj['deliveryDate'] =
+          this.obj.deliveryDate || item.expectReceiveDate;
+      });
       this.form = copyObj(this.obj);
 
       this.radio1 = this.radio;
       this.getSpanArr();
-      this.setDeliveryDays()
+      this.setDeliveryDays();
+      this.setIsInquiry();
       // this.dataList=copyObj(this.list)
     },
     methods: {
       //计算交期
-      setDeliveryDays(){
+      setDeliveryDays() {
+        this.form.resultList.forEach((item) => {
+          let day =
+            this.form.deliveryDate &&
+            (new Date(this.form.deliveryDate).getTime() -
+              new Date().getTime()) /
+              1000 /
+              60 /
+              60 /
+              24;
 
-        this.form.resultList.forEach(item=>{
-          let day=this.form.deliveryDate&&((new Date(this.form.deliveryDate).getTime()-new Date().getTime())/1000/60/60/24)
-     
-          item.deliveryDays=Math.ceil(day)||1
-        })
-        this.$forceUpdate()
-      
-        
+          item.deliveryDays = Math.ceil(day) || 1;
+        });
+        this.$forceUpdate();
       },
       objectSpanMethod({ row, column, rowIndex, columnIndex }) {
         if (this.columns[columnIndex]?.isMerge) {
@@ -701,10 +702,12 @@
           colspan: 1
         };
       },
+      setIsInquiry() {
+        this.$emit('setIsInquiry');
+      },
       deliveryDateChange(row) {
         this.$emit('deliveryDateChange', (data) => {
           let is = false;
-       
 
           if (data.length > 0) {
             data.forEach((item) => {
@@ -719,9 +722,8 @@
           if (is) {
             this.$message.error('交货日期大于到货日期');
           }
-       
         });
-        this.setDeliveryDays()
+        this.setDeliveryDays();
       },
       getSpanArr() {
         let pos = 0;
@@ -817,7 +819,9 @@
       //修改回显
       putTableValue(data) {
         this.form.resultList = copyObj(data);
-        this.setDeliveryDays()
+        this.setDeliveryDays();
+        this.setIsInquiry();
+        
       },
 
       remove(productCode) {
@@ -825,6 +829,8 @@
           (item) => item.productCode == productCode
         );
         this.form.resultList.splice(index, 1);
+        this.setIsInquiry();
+
         this.setSort();
       },
       removeSupplier() {

+ 24 - 0
src/views/purchasingManage/inquiryManage/components/inventoryTable.vue

@@ -197,6 +197,15 @@
             fixed: 'left',
             align: 'center'
           },
+          {
+            minWidth: 100,
+            label: '状态',
+            fixed: 'left',
+            formatter: (row, column) => {
+              return row.isInquiry==1?'已核价':'未核价'
+            },
+            align: 'center'
+          },
           {
             minWidth: 100,
             prop: 'productCategoryName',
@@ -406,6 +415,21 @@
           };
         });
       },
+      setIsInquiry(list){
+        let codeS=[]
+        list.forEach(item=>{
+          item.resultList.forEach(val=>{
+            codeS.push(val.productCode)
+          })
+          
+        }) 
+        this.form.datasource.forEach((item,index)=>{
+          this.$set(this.form.datasource[index],'isInquiry',codeS.includes(item.productCode)?1:0)
+        })
+        
+        console.log(codeS,'codeS')
+
+      },
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },