yusheng 10 месяцев назад
Родитель
Сommit
aa2e355e5e

+ 44 - 26
src/views/purchasingManage/inquiryManage/components/addDialog.vue

@@ -4,7 +4,16 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <headerTitle title="基本信息">
           <template slot-scope="right">
-            <div style="padding-bottom: 10px;position: fixed;right: 0;width: 250px;background: #fff;z-index: 999;">
+            <div
+              style="
+                padding-bottom: 10px;
+                position: fixed;
+                right: 0;
+                width: 250px;
+                background: #fff;
+                z-index: 999;
+              "
+            >
               <el-button @click="cancel">返回</el-button>
               <el-button type="primary" @click="save">保存</el-button>
               <el-button
@@ -35,7 +44,7 @@
               <el-input v-model="form.inquiryName"></el-input>
             </el-form-item>
           </el-col>
- 
+
           <el-col :span="8">
             <el-form-item
               prop="remark"
@@ -74,7 +83,6 @@
           <el-col :span="8">
             <el-form-item prop="files" label="附件">
               <fileMain v-model="form.files" type="view"></fileMain>
-
             </el-form-item>
           </el-col>
         </el-row>
@@ -87,6 +95,13 @@
         v-click-once
         >新增报价单</el-button
       >
+      <el-button
+        type="primary"
+        style="margin-bottom: 10px"
+        @click="supplierSelectAll"
+        v-click-once
+        >批量生成报价单</el-button
+      >
       <inventoryTable
         ref="inventoryTable"
         @delList="delList"
@@ -171,7 +186,7 @@
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
 
   export default {
-    name: "eomInquiryManageAddDialog",
+    name: 'eomInquiryManageAddDialog',
     props: {
       categoryTreeList: Array
     },
@@ -315,7 +330,7 @@
                 item.arrivalBatch[item.arrivalBatch.length - 1].arriveDate;
             }
             item.supplierList = supplierObj[item.productId] || [];
-            if (item.supplierList.length === 1) {
+            if (item.supplierList?.length) {
               item.supplierIds = [item.supplierList[0].id];
               // this.supplierSelect(item);
             }
@@ -434,13 +449,19 @@
 
         this.getplanData(data.id, 'change');
       },
+      supplierSelectAll() {
+        if (!this.$refs.inventoryTable.selection.length)
+          return this.$message.warning('请选择产品');
+        this.$refs.inventoryTable.selection.forEach((item) => {
+          this.supplierSelect(item);
+        });
+      },
       async supplierSelect(row) {
-        console.log(row);
-
-        if (!row) {
-          this.$message.warning('请选择供应商');
-          return;
-        }
+        console.log(row)
+        // if (!row) {
+        //   this.$message.warning('请选择供应商');
+        //   return;
+        // }
         let supplierIds = Object.keys(this.supplierProducts);
         const promises = [];
         row.supplierIds.forEach((item) => {
@@ -459,8 +480,6 @@
       },
 
       setIsInquiry(supplierList) {
-     
-
         this.$nextTick(() => {
           // this.supplierList.forEach((item) => {
           //   supplierList.push(
@@ -479,7 +498,7 @@
           (item) => item.productCode == row.productCode
         )?.productCode;
         obj.supplierName = data.base.name;
-        obj.reqTotalCount=obj.totalCount
+        obj.reqTotalCount = obj.totalCount;
         let params = {
           ...data.base,
           supplierId: data.base.id,
@@ -538,7 +557,6 @@
             val.supplierProductName = val.productName;
             val.reqTotalCount = val.totalCount;
             val.isWinner = 1;
-            
           });
 
           let supplierIndex = supplierIds.indexOf(item.supplierId);
@@ -552,16 +570,16 @@
               );
               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.$nextTick(() => {
-                  this.$refs['inquiryTable' + item.id][0]?.getSpanArr();
-                });
+              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();
+              });
               // }
             });
           }
@@ -571,7 +589,7 @@
       async save(type) {
         try {
           await this.getValidate();
-         
+
           let supplierList = [];
 
           this.supplierList.forEach((item) => {

+ 14 - 12
src/views/purchasingManage/inquiryManage/components/inquiryTable.vue

@@ -214,7 +214,7 @@
           }"
         >
           <el-input
-            @blur="changeCount(scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             v-model="scope.row.singlePrice"
             :disabled="status == 'Detail'"
             type="number"
@@ -246,7 +246,7 @@
           }"
         >
           <el-input
-            @blur="changeCount(scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             v-model="scope.row.totalCount"
             :disabled="status == 'Detail'"
             placeholder="请输入"
@@ -255,11 +255,11 @@
         </el-form-item>
       </template>
 
-      <template v-slot:totalPrice="scope">
+      <!-- <template v-slot:totalPrice="scope">
         <span>{{
           totalPrice(scope.row.totalCount, scope.row.singlePrice, scope.row)
         }}</span>
-      </template>
+      </template> -->
       <template v-slot:provenance="scope">
         <el-form-item>
           <DictSelection
@@ -887,6 +887,7 @@
           })
         );
         this.getNotaxSinglePrice();
+        this.totalPriceAll()
         this.$forceUpdate();
       },
       //计算不含税单价
@@ -985,14 +986,14 @@
       //   this.getNotaxSinglePrice();
       // },
       //计算销售金额
-      totalPrice(a, b, row) {
-        if (!a || !b) {
-          return;
-        }
-        row.totalPrice = parseFloat((a * b).toFixed(2));
-        this.totalPriceAll();
-        return row.totalPrice;
-      },
+      // totalPrice(a, b, row) {
+      //   if (!a || !b) {
+      //     return;
+      //   }
+      //   row.totalPrice = parseFloat((a * b).toFixed(2));
+      //   this.totalPriceAll();
+      //   return row.totalPrice;
+      // },
       //计算销售总价
       totalPriceAll() {
         let num = 0;
@@ -1000,6 +1001,7 @@
           num += item.totalPrice || 0;
         });
         this.form.totalPrice = parseFloat(num.toFixed(2));
+        this.form.preferentialPrice=this.form.totalPrice
       },
       // 返回列表数据
       getTableValue() {

+ 1 - 1
src/views/purchasingManage/inquiryManage/components/inventoryTable.vue

@@ -88,7 +88,7 @@
       <template v-slot:add="scope">
         <el-form-item style="margin-bottom: 20px">
           <el-button type="primary" @click="openSupplier(scope.row)"
-            >新增报价单</el-button
+            >生成报价单</el-button
           >
         </el-form-item>
       </template>

+ 1 - 1
src/views/purchasingManage/purchaseOrder/components/searchTable.vue

@@ -17,7 +17,7 @@ export default {
           label: '关键字:',
           value: 'searchName',
           type: 'input',
-          placeholder: '订单编码/采购联系人/名称/编码'
+          placeholder: '订单编码/供应商名称/合同编号/产品名称'
         },
         {
           label: '订单编码:',

+ 5 - 1
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -1059,7 +1059,11 @@
           }
           this.$set(parasm, 'provenance', item.purchaseOrigins || []);
           this.form.datasource.push(row);
-          this.warehouseChange(index, parasm);
+        });
+        this.form.datasource.forEach((item, index) => {
+          if (!item.warehouseId) {
+            this.warehouseChange(index, item);
+          }
         });
       },
       getTotalCount(row) {

+ 59 - 34
src/views/saleManage/saleOrder/entrustedReceive/components/inventoryTable.vue

@@ -7,6 +7,7 @@
       @columns-change="handleColumnChange"
       :cache-key="cacheKeyUrl"
       :datasource="form.datasource"
+      :selection.sync="selection"
       class="time-form"
     >
       <!-- 表头工具栏 -->
@@ -21,6 +22,10 @@
           >
             新增
           </el-button>
+          <warehouseAll
+            @success="warehouseAllChange"
+            :disabled="!selection.length"
+          ></warehouseAll>
         </div>
       </template>
       <template v-slot:technicalDrawings="{ row, $index }">
@@ -177,7 +182,7 @@
   </el-form>
 </template>
 <script>
-  import { emailReg, phoneReg, numberReg } from 'ele-admin';
+  import { numberReg } from 'ele-admin';
   import dictMixins from '@/mixins/dictMixins';
   import productList from '@/BIZComponents/product-list.vue';
 
@@ -186,9 +191,8 @@
     getWarehouseOutStock
   } from '@/api/saleManage/saleorder';
 
-  import { copyObj } from '@/utils/util';
-  import { getFile } from '@/api/system/file';
-  // import fileMain from '@/components/addDoc/index.vue';
+  import warehouseAll from '@/BIZComponents/warehouseAll.vue';
+
   import tabMixins from '@/mixins/tableColumnsMixin';
 
   export default {
@@ -202,7 +206,7 @@
       pricingWay: [Number, String]
     },
     components: {
-      // fileMain,
+      warehouseAll,
       productList
     },
     data() {
@@ -301,13 +305,13 @@
             headerSlot: 'headerWarehouseId',
             align: 'center'
           },
-          {
-            minWidth: 80,
-            prop: 'warehouseNum',
-            label: '库存',
-            slot: 'warehouseNum',
-            align: 'center'
-          },
+          // {
+          //   minWidth: 80,
+          //   prop: 'warehouseNum',
+          //   label: '库存',
+          //   slot: 'warehouseNum',
+          //   align: 'center'
+          // },
           {
             width: 110,
             prop: 'orderTotalCount',
@@ -530,20 +534,38 @@
       }
     },
     methods: {
-      async warehouseChange(index, row, data) {
-        this.$set(this.form.datasource[index], 'warehouseName', data.name);
-        this.$set(this.form.datasource[index], 'warehouseCode', data.code);
-        const warehouseOutStock = await getWarehouseOutStock({
-          warehouseId: data.id,
-          code: row.productCode
+      async warehouseChange(index, row) {
+        let data = null;
+        if (row.warehouseId) {
+          data = this.warehouseList.find((item) => item.id == row.warehouseId);
+        } else {
+          data = this.warehouseList.find(
+            (item) => item.inventoryType == row.categoryRootLevelId
+          );
+        }
+        if (data) {
+          this.$set(this.form.datasource[index], 'warehouseName', data.name);
+          this.$set(this.form.datasource[index], 'warehouseCode', data.code);
+          this.$set(this.form.datasource[index], 'warehouseId', data.id);
+          // const warehouseOutStock = await getWarehouseOutStock({
+          //   warehouseId: data.id,
+          //   code: row.productCode
+          // });
+          // this.$set(
+          //   this.form.datasource[index],
+          //   'warehouseNum',
+          //   warehouseOutStock
+          // );
+        }
+      },
+      warehouseAllChange(data) {
+        let keyS = this.selection.map((item) => item.key - 1);
+        keyS.forEach((key) => {
+          this.$set(this.form.datasource[key], 'warehouseName', data.name);
+          this.$set(this.form.datasource[key], 'warehouseCode', data.code);
+          this.$set(this.form.datasource[key], 'warehouseId', data.id);
         });
-        this.$set(
-          this.form.datasource[index],
-          'warehouseNum',
-          warehouseOutStock
-        );
       },
-
       //修改数量更新合计
       changeNum(val, row, index) {
         this.$set(
@@ -622,16 +644,10 @@
         if (data) {
           this.form.datasource = data;
           data.forEach(async (item, index) => {
-            if (item.warehouseId) {
-              this.$set(
-                this.form.datasource[index],
-                'warehouseNum',
-                await getWarehouseOutStock({
-                  warehouseId: item.warehouseId,
-                  code: item.productCode
-                })
-              );
+            if (!item.warehouseId) {
+              this.warehouseChange(index, item);
             }
+
             //发货数量因已发货数量被修改需要重新计算金额,总重
             this.changeNum(item.totalCount, item, index);
           });
@@ -683,7 +699,11 @@
 
           this.$set(parasm, 'imgCode', item.imgCode);
           this.$set(parasm, 'produceType', item.componentAttribute);
-
+          this.$set(
+            parasm,
+            'categoryRootLevelId',
+            item.categoryLevelPathIdParent
+          );
           this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
           this.$set(
             parasm,
@@ -697,6 +717,11 @@
             this.form.datasource.push(row);
           }
         });
+        this.form.datasource.forEach((item, index) => {
+          if (!item.warehouseId) {
+            this.warehouseChange(index, item);
+          }
+        });
       },
       validateForm(callback) {
         //开始表单校验