Jelajahi Sumber

批量按钮

yusheng 11 bulan lalu
induk
melakukan
4df6f6c4fd

+ 35 - 8
src/views/saleManage/saleOrder/index.vue

@@ -55,6 +55,19 @@
                 >
                   批量删除
                 </el-button>
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="el-icon-plus"
+                  class="ele-btn-icon"
+                v-if="$hasPermission('eom:saleManage:invoiceAll')"
+
+                  @click="invoiceAll"
+               
+                  :disabled="selection?.length === 0"
+                >
+                  批量发货
+                </el-button>
                 <el-button
                   type="primary"
                   size="small"
@@ -421,7 +434,7 @@
                   ? '不定向订单'
                   : '库存式订单';
 
-              return businessType
+              return businessType;
             }
           },
           {
@@ -558,7 +571,11 @@
                 ? _row.arrivalWays
                     .split(',')
                     .map((val) => {
-                      return val == 1 ? '一次性到货' :val == 2?  '分批到货':'';
+                      return val == 1
+                        ? '一次性到货'
+                        : val == 2
+                        ? '分批到货'
+                        : '';
                     })
                     .toString()
                 : '';
@@ -638,6 +655,21 @@
           });
         }
       },
+
+      invoiceAll(){
+        let partaIds = this.selection.map((item) => item.partaId);
+          if (new Set(partaIds).size != 1) {
+            return this.$message.warning('请选择相同客户的订单!');
+          }
+          if (
+            this.selection.filter((item) => item.needProduce == 4)?.length &&
+            this.selection.filter((item) => item.needProduce == 4)?.length !=
+              this.selection.length
+          ) {
+            return this.$message.warning('不定向订单不能与其它类型的订单一起创建发货单!');
+          }
+        this.$refs.invoiceDialogRef.open('add', {}, this.selection.map((item) => item.id));
+      },
       //点击左边分类
       handleNodeClick(data, node) {
         // this.curNodeData = data;
@@ -720,7 +752,7 @@
             variables: {
               businessCode: data.orderNo,
               businessName: data.partaName,
-              businessType:businessType
+              businessType: businessType
             }
           };
           this.$refs.processSubmitDialogRef.init(params);
@@ -728,11 +760,6 @@
       },
       saleOrderSubmitOrGenerate(res) {
         this.saleOrderSubmit(res.id);
-        // if (res.needProduce == 1) {
-        //   this.handleAutoGenerate(res.id, true);
-        // } else {
-        //   this.saleOrderSubmit(res.id);
-        // }
       },
       //生成
       handleAutoGenerate(id, isAuto = false) {

+ 1 - 1
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -609,7 +609,7 @@
         this.carList = await carBookPageListAPI({ pageNum: 1, size: 100 });
 
         if (orderId) {
-          await this.getSaleOrderDetails([orderId]);
+          await this.getSaleOrderDetails(orderId);
         }
         if (this.saleOrderData.id) {
           await this.getSaleOrderDetails([this.saleOrderData.id]);