Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/business/outsource/form.vue
guoyujia 1 rok temu
rodzic
commit
4b36c85106
1 zmienionych plików z 138 dodań i 81 usunięć
  1. 138 81
      src/views/business/outsource/form.vue

+ 138 - 81
src/views/business/outsource/form.vue

@@ -30,6 +30,15 @@
           v-hasPermi="['business:outsource:export']"
           >导出</el-button
         >
+        <el-button
+          v-if="!editStatus"
+          type="warning"
+          icon="Download"
+          @click="handlePrint"
+          v-hasPermi="['business:outsource:export']"
+        >
+          打印
+        </el-button>
         <el-button
           v-if="editStatus"
           type="primary"
@@ -194,7 +203,7 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="总箱数" prop="remark">
-              <span >{{ totalCarriersNum }}</span>
+              <span>{{ totalCarriersNum }}</span>
             </el-form-item>
           </el-col>
         </el-row>
@@ -238,7 +247,12 @@
               prop="productDescription"
               width="320"
             />
-            <el-table-column label="产品数" align="center" width="160" prop="productNum">
+            <el-table-column
+              label="产品数"
+              align="center"
+              width="160"
+              prop="productNum"
+            >
               <template #default="scope">
                 <el-input-number
                   v-if="editStatus"
@@ -268,7 +282,14 @@
               width="320"
             >
               <template #default="scope">
-                <el-button link type="primary" icon="Refresh" v-if="!scope.row.editStatus && editStatus" @click="handleChangeCarrier(scope.row)">换箱</el-button>
+                <el-button
+                  link
+                  type="primary"
+                  icon="Refresh"
+                  v-if="!scope.row.editStatus && editStatus"
+                  @click="handleChangeCarrier(scope.row)"
+                  >换箱</el-button
+                >
                 <el-select
                   v-if="editStatus && scope.row.editStatus"
                   v-model="scope.row.carrierIds"
@@ -278,7 +299,8 @@
                   reserve-keyword
                   placeholder="请选择箱号"
                   :remote-method="
-                    (arg) => remoteCarriers(arg, scope.row.newCarriers,scope.row)
+                    (arg) =>
+                      remoteCarriers(arg, scope.row.newCarriers, scope.row)
                   "
                   :loading="loadingCarrier"
                   @change="(arg) => handleCarrierChange(arg, scope.row)"
@@ -384,7 +406,9 @@
     />
     <!-- 历史记录弹窗 -->
     <dialog-outsourced-records ref="dialogOutsourcedRecordsRef"/>
-  </el-drawer>
+   <!-- 收回明细带回 -->
+      <!-- <form-details-recycling ref="formDetailsRecyclingRef" :singleSelected="handleSingleSelectedRecycling"/> -->
+   </el-drawer>
 </template>
 <script setup>
 import {
@@ -393,6 +417,7 @@ import {
   carrierForOutsource,
   submitOrder,
   exportOutsource,
+  printOutsource,
   submitDetails
 } from "@/api/business/outsourcedOrder";
 import dialogCarrier from "./DialogCarrier";
@@ -400,6 +425,7 @@ import dialogSuppliers from "./DialogSuppliers";
 import dialogProducts from "./DialogProducts";
 import dialogProcesses from "./DialogProcesses";
 import dialogOutsourcedRecords from "./DialogOutsourcedRecords"
+// import FormDetailsRecycling from "./detailsRecyclingForm";
 const { proxy } = getCurrentInstance();
 /** 父组件传参 */
 const props = defineProps({
@@ -429,8 +455,9 @@ const loading = ref(false);
 const multiple = ref(true);
 const visible = ref(false);
 const editStatus = ref(true);
+const isFullscreen = ref(false);
+const totalCarriersNum = ref(0);
 const detailInfo = ref({});
-const totalCarriersNum = ref(0)
 const loadingCarrier = ref(false);
 const carriers = ref([]);
 const webHost = import.meta.env.VITE_APP_BASE_API;
@@ -449,6 +476,11 @@ function handleExport() {
   exportOutsource({ id: form.value.id });
 }
 
+/** 打印按钮操作 */
+function handlePrint() {
+  printOutsource({ id: form.value.id });
+}
+
 /** 打开抽屉 */
 function open(row) {
   reset();
@@ -468,21 +500,21 @@ function open(row) {
 function getForm() {
   loading.value = true;
   getOrder(form.value.id).then((response) => {
-    form.value = response.data
-    console.log(form.value.details)
-    form.value.details.forEach(item =>{
-      item.editStatus = false
-     if(!form.value.id) {
-        item.carrierNum = item.originalCarrier.split(",").length
-      }else {
-        if(item.newCarrier !=null) {
-        item.carrierNum = item.newCarrier.split(",").length
-      }else {
-        item.carrierNum = item.originalCarrier.split(",").length
-      }
+    form.value = response.data;
+    console.log(form.value.details);
+    form.value.details.forEach((item) => {
+      item.editStatus = false;
+      if (!form.value.id) {
+        item.carrierNum = item.originalCarrier.split(",").length;
+      } else {
+        if (item.newCarrier != null) {
+          item.carrierNum = item.newCarrier.split(",").length;
+        } else {
+          item.carrierNum = item.originalCarrier.split(",").length;
+        }
       }
-      totalCarriersNum.value += item.carrierNum
-    })
+      totalCarriersNum.value += item.carrierNum;
+    });
 
     editStatus.value = form.value.isSubmit == 1;
     if(!detailInfo.value.flag) {
@@ -529,10 +561,10 @@ function handleChangePackagingMethod() {
 }
 //改变送货方式
 function handleChangeDeliveryMethod() {
-  if(form.value.deliveryMethod == 1) {
-    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
-  }else {
-    form.value.freightAmount = 0.0
+  if (form.value.deliveryMethod == 1) {
+    form.value.freightAmount = form.value.freightPrice * totalCarriersNum.value;
+  } else {
+    form.value.freightAmount = 0.0;
   }
  
 }
@@ -554,11 +586,11 @@ function cancel() {
 }
 
 const handleDelete = (index) => {
-  totalCarriersNum.value -=form.value.details[index].carrierNum
-  if(form.value.deliveryMethod == 1) {
-    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
-  }else {
-    form.value.freightAmount = 0.0
+  totalCarriersNum.value -= form.value.details[index].carrierNum;
+  if (form.value.deliveryMethod == 1) {
+    form.value.freightAmount = form.value.freightPrice * totalCarriersNum.value;
+  } else {
+    form.value.freightAmount = 0.0;
   }
   form.value.details.splice(index, 1);
 };
@@ -649,7 +681,7 @@ function submitFrom() {
           }
         }
         if (valid) {
-          console.log(form.value)
+          console.log(form.value);
           submitOrder(form.value).then((response) => {
             proxy.$modal.msgSuccess("提交成功");
             visible.value = false;
@@ -746,14 +778,20 @@ const handleSingleSelectedSupplier = (data) => {
   form.value.lossLimit = data.lossLimit;
   form.value.supplierName = data.name;
   form.value.deliveryMethod = data.deliveryMethod;
-  form.value.freightPrice = data.freightPrice
+  form.value.freightPrice = data.freightPrice;
   form.value.settlementType = data.settlementType;
-  if(form.value.deliveryMethod == 1) {
-    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
-  }else {
-    form.value.freightAmount = 0.0
+  if (form.value.deliveryMethod == 1) {
+    form.value.freightAmount = form.value.freightPrice * totalCarriersNum.value;
+  } else {
+    form.value.freightAmount = 0.0;
   }
 };
+/***************************** 外协收回明细相关 *****************************/
+//打开收回明细表单
+function handleDetailsRecycling() {
+  proxy.$refs.formDetailsRecyclingRef.open(row);
+}
+function handleSingleSelectedRecycling() {}
 /***************************** 产品对话框相关 *****************************/
 // 打开产品选择对话框
 const handleShowDialogProducts = () => {
@@ -774,12 +812,12 @@ const handleMultipleSelectedProducts = (selection) => {
       technologyVersion: item.technologyVersion,
       originalCarrier: item.originalCarrier,
       originalCarrierCount: item.originalCarrier.split(",").length,
-      carrierNum:item.originalCarrier.split(",").length,
-      originalCarrierList:item.originalCarrierList,
+      carrierNum: item.originalCarrier.split(",").length,
+      originalCarrierList: item.originalCarrierList,
       productNum: item.productNum,
       productCode: item.productCode,
       newCarrier: "",
-      carriers:[],
+      carriers: [],
       newCarrierCount: 0,
       newCarriers: [],
       processNames: "",
@@ -787,13 +825,14 @@ const handleMultipleSelectedProducts = (selection) => {
       processes: [],
     };
     form.value.details.push(newDetail);
-    console.log(newDetail)
-    totalCarriersNum.value += newDetail.originalCarrierCount
-    if(form.value.deliveryMethod == 1) {
-    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
-    }else {
-    form.value.freightAmount = 0.0
-  }
+    console.log(newDetail);
+    totalCarriersNum.value += newDetail.originalCarrierCount;
+    if (form.value.deliveryMethod == 1) {
+      form.value.freightAmount =
+        form.value.freightPrice * totalCarriersNum.value;
+    } else {
+      form.value.freightAmount = 0.0;
+    }
     // console.log("form.value.details", form.value.details);
   });
 };
@@ -802,13 +841,13 @@ const handleMultipleSelectedProducts = (selection) => {
 // 打开外协箱子选择对话框
 const handleShowDialogOutsourceCarriers = (row) => {};
 
-function remoteCarriers(code, newCarrier,row) {
+function remoteCarriers(code, newCarrier, row) {
   loadingCarrier.value = true;
   // console.log(row, carriers.value)
   console.log("row", row);
   // if (true) {
   //   carriers.value = [{ value: '"1747500987856662535"', label: '000319' }]
-  //   return 
+  //   return
   // }
   let categoryId;
   if (form.value.packagingMethod == 1) {
@@ -844,49 +883,67 @@ function remoteCarriers(code, newCarrier,row) {
 }
 //换箱
 function handleChangeCarrier(row) {
-  console.log(row)
-  if(editStatus.value && !form.value.id){
-  if(form.value.packagingMethod == 0) {
-    row.newCarriers.push(...row.originalCarrierList.map(v => ({ id: v.carrierId, code: v.carrierCode })))
-    row.carriers.push( ...row.originalCarrierList.map((v) => ({ value: v.carrierId, label: v.carrierCode })))
-    row.carrierIds = row.originalCarrierList.map(info => { return info.carrierId })
-  }else{
-    row.newCarriers = null
+  console.log(row);
+  if (editStatus.value && !form.value.id) {
+    if (form.value.packagingMethod == 0) {
+      row.newCarriers.push(
+        ...row.originalCarrierList.map((v) => ({
+          id: v.carrierId,
+          code: v.carrierCode,
+        }))
+      );
+      row.carriers.push(
+        ...row.originalCarrierList.map((v) => ({
+          value: v.carrierId,
+          label: v.carrierCode,
+        }))
+      );
+      row.carrierIds = row.originalCarrierList.map((info) => {
+        return info.carrierId;
+      });
+    } else {
+      row.newCarriers = null;
+    }
+  }
+  if (editStatus.value && form.value.id) {
+    row.carriers = [];
+    row.newCarriers.map((v) => ({ id: v.value, code: v.label }));
+    console.log(row.newCarriers);
+    row.carriers = row.newCarriers.map((v) => ({ value: v.id, label: v.code }));
+    row.carrierIds = row.newCarriers.map((info) => {
+      return info.id;
+    });
+    console.log(row);
   }
-}
-if(editStatus.value && form.value.id){
-  row.carriers = []
-    row.newCarriers.map(v => ({ id: v.value, code: v.label }))
-    console.log(row.newCarriers)
-    row.carriers = row.newCarriers.map((v) => ({ value: v.id, label: v.code }))
-    row.carrierIds = row.newCarriers.map(info => { return info.id })
-    console.log(row)
-}
   row.editStatus = true;
 }
 function handleCarrierChange(arg, item) {
-  totalCarriersNum.value = 0
+  totalCarriersNum.value = 0;
   item.newCarriers = item.carriers
     .filter((v) => arg.includes(v.value))
     .map((v) => ({ id: v.value, code: v.label }));
-    console.log(item.newCarriers)
-    item.carrierNum = item.newCarriers.length
+  console.log(item.newCarriers);
+  item.carrierNum = item.newCarriers.length;
 
-    for(let i = 0;i<form.value.details.length;i++) {
-    if(form.value.packagingMethod == 1) {
-        form.value.details[i].carrierNum =form.value.details[i].newCarriers? form.value.details[i].newCarriers.length:0
-      }else {
-        //原厂蓝箱
-        form.value.details[i].carrierNum =form.value.details[i].newCarriers? form.value.details[i].newCarriers.length:form.value.details[i].originalCarrier.split(",").length
-      }
-      console.log(form.value.details)
-      totalCarriersNum.value += form.value.details[i].carrierNum
+  for (let i = 0; i < form.value.details.length; i++) {
+    if (form.value.packagingMethod == 1) {
+      form.value.details[i].carrierNum = form.value.details[i].newCarriers
+        ? form.value.details[i].newCarriers.length
+        : 0;
+    } else {
+      //原厂蓝箱
+      form.value.details[i].carrierNum = form.value.details[i].newCarriers
+        ? form.value.details[i].newCarriers.length
+        : form.value.details[i].originalCarrier.split(",").length;
+    }
+    console.log(form.value.details);
+    totalCarriersNum.value += form.value.details[i].carrierNum;
+  }
+  if (form.value.deliveryMethod == 1) {
+    form.value.freightAmount = form.value.freightPrice * totalCarriersNum.value;
+  } else {
+    form.value.freightAmount = 0.0;
   }
-       if(form.value.deliveryMethod == 1) {
-        form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
-        }else {
-          form.value.freightAmount = 0.0
-        }
 }
 
 /** 使用新方式 */