Procházet zdrojové kódy

新装箱出货bug

cz před 1 rokem
rodič
revize
864ce3953b

+ 2 - 1
src/views/salesMange/shipmentMange/document/index.vue

@@ -123,9 +123,10 @@
                         v-model="row.quantity"
                         placeholder="请输入数量"
                         style="width: 100%"
-                        :precision="0"
+                        :precision="2"
                         :controls="false"
                         :min="0"
+                        onmousewheel="return false;"
                       />
                     </el-form-item>
                   </div>

+ 416 - 200
src/views/salesMange/shipmentMange/packing/index.vue

@@ -25,17 +25,24 @@
             action: () => openModal(),
           },
         ]"
-        @get-list="getList">
+        @get-list="getList"
+      >
         <template #code="{ item }">
           <div>
-            <div v-for="(item, index) in getData(item.codeAPName, 'code')" :key="index">
+            <div
+              v-for="(item, index) in getData(item.codeAPName, 'code')"
+              :key="index"
+            >
               {{ item }}
             </div>
           </div>
         </template>
         <template #productName="{ item }">
           <div>
-            <div v-for="(item, index) in getData(item.codeAPName, 'productName')" :key="index">
+            <div
+              v-for="(item, index) in getData(item.codeAPName, 'productName')"
+              :key="index"
+            >
               {{ item }}
             </div>
           </div>
@@ -84,11 +91,22 @@
         </template>
       </byTable>
     </div>
-    <el-dialog title="产品装箱" v-model="dtlModalType" width="80%" v-loading="loading">
+
+    <el-dialog
+      title="产品装箱"
+      v-model="dtlModalType"
+      width="80%"
+      v-loading="loading"
+    >
       <el-row :gutter="10">
         <el-col :span="8">
           <div class="common-title">箱规</div>
-          <el-form :model="boxFormData" :rules="rules" ref="formDom" label-position="top">
+          <el-form
+            :model="boxFormData"
+            :rules="rules"
+            ref="formDom"
+            label-position="top"
+          >
             <el-form-item label="尺寸(cm³)" required>
               <el-col :span="7">
                 <el-form-item label="" :prop="'boxLong'" :rules="rules.boxLong">
@@ -98,8 +116,9 @@
                     :precision="2"
                     :controls="false"
                     :min="0"
-                    @change='computeBomVolume'
-                    onmousewheel="return false;"></el-input-number>
+                    @change="computeBomVolume"
+                    onmousewheel="return false;"
+                  ></el-input-number>
                 </el-form-item>
               </el-col>
               <el-col :span="1" style="text-align: center"> * </el-col>
@@ -111,8 +130,9 @@
                     :precision="2"
                     :controls="false"
                     :min="0"
-                    @change='computeBomVolume'
-                    onmousewheel="return false;"></el-input-number>
+                    @change="computeBomVolume"
+                    onmousewheel="return false;"
+                  ></el-input-number>
                 </el-form-item>
               </el-col>
               <el-col :span="1" style="text-align: center"> * </el-col>
@@ -124,8 +144,9 @@
                     :precision="2"
                     :controls="false"
                     :min="0"
-                    @change='computeBomVolume'
-                    onmousewheel="return false;"></el-input-number>
+                    @change="computeBomVolume"
+                    onmousewheel="return false;"
+                  ></el-input-number>
                 </el-form-item>
               </el-col>
             </el-form-item>
@@ -137,132 +158,266 @@
                 :controls="false"
                 :min="0"
                 disabled
-                onmousewheel="return false;"></el-input-number>
+                onmousewheel="return false;"
+              ></el-input-number>
             </el-form-item>
-            <el-form-item label="净重(kg)" :prop="'netWeight'" :rules="rules.netWeight">
+            <el-form-item
+              label="净重(kg)"
+              :prop="'netWeight'"
+              :rules="rules.netWeight"
+            >
               <el-input-number
                 v-model="boxFormData.netWeight"
                 :precision="2"
                 :controls="false"
                 :min="0"
                 placeholder="请输入"
-                onmousewheel="return false;"></el-input-number>
+                onmousewheel="return false;"
+              ></el-input-number>
             </el-form-item>
-            <el-form-item label="毛重(kg)" :prop="'roughWeight'" :rules="rules.roughWeight">
+            <el-form-item
+              label="毛重(kg)"
+              :prop="'roughWeight'"
+              :rules="rules.roughWeight"
+            >
               <el-input-number
                 v-model="boxFormData.roughWeight"
                 :precision="2"
                 :controls="false"
                 :min="0"
                 placeholder="请输入"
-                onmousewheel="return false;"></el-input-number>
+                onmousewheel="return false;"
+              ></el-input-number>
             </el-form-item>
-            <el-form-item label="总箱数" :prop="'packQuantity'" :rules="rules.packQuantity">
+            <el-form-item
+              label="总箱数"
+              :prop="'packQuantity'"
+              :rules="rules.packQuantity"
+            >
               <el-input-number
                 v-model="boxFormData.packQuantity"
                 :precision="0"
                 :controls="false"
                 :min="1"
                 placeholder="请输入"
-                onmousewheel="return false;"></el-input-number>
+                onmousewheel="return false;"
+              ></el-input-number>
             </el-form-item>
           </el-form>
         </el-col>
         <el-col :span="16">
           <!-- 添加行 -->
-          <div class="add-box" style="margin-bottom: 20px;">
-            <el-button type="primary" @click="packDetailProductListPush(boxIndex)"> 添加行 </el-button>
-            <el-button type="primary" @click="openCustom('2')" v-if='encasementType == "1"'> 自定义装箱 </el-button>
-            <el-button type="primary" @click="openCustom('1')" v-if='encasementType == "2"'> 标准装箱 </el-button>
+          <div class="add-box" style="margin-bottom: 20px">
+            <el-button
+              type="primary"
+              @click="packDetailProductListPush(boxIndex)"
+            >
+              添加行
+            </el-button>
+            <el-button
+              type="primary"
+              @click="openCustom('2')"
+              v-if="encasementType == '1'"
+            >
+              自定义装箱
+            </el-button>
+            <el-button
+              type="primary"
+              @click="openCustom('1')"
+              v-if="encasementType == '2'"
+            >
+              标准装箱
+            </el-button>
           </div>
-          <el-table :data="boxFormData.packDetailGoodsList" ref="tableDom2" v-if='encasementType == "2"'>
+          <el-table
+            :data="boxFormData.packDetailGoodsList"
+            ref="tableDom2"
+            v-if="encasementType == '2'"
+          >
             <el-table-column prop="remark" label="货品描述" min-width="180">
               <template #default="{ row, $index }">
-                   <el-form-item prop="remark" :inline-message="true">
-                     <el-input  v-model="boxFormData.packDetailGoodsList[$index].remark"  onmousewheel="return false;" />
-                   </el-form-item>
-               </template>
+                <el-form-item prop="remark" :inline-message="true">
+                  <el-input
+                    v-model="boxFormData.packDetailGoodsList[$index].remark"
+                    onmousewheel="return false;"
+                  />
+                </el-form-item>
+              </template>
             </el-table-column>
             <el-table-column prop="unit" label="单位" min-width="180">
               <template #default="{ row, $index }">
-                   <el-form-item prop="unit" :inline-message="true">
-                     <el-input  v-model="boxFormData.packDetailGoodsList[$index].unit"  onmousewheel="return false;" />
-                   </el-form-item>
-               </template>
+                <el-form-item prop="unit" :inline-message="true">
+                  <el-input
+                    v-model="boxFormData.packDetailGoodsList[$index].unit"
+                    onmousewheel="return false;"
+                  />
+                </el-form-item>
+              </template>
             </el-table-column>
             <el-table-column prop="quantity" label="入箱数" min-width="180">
               <template #default="{ row, $index }">
-                   <el-form-item prop="quantity" :inline-message="true">
-                     <el-input-number v-model="boxFormData.packDetailGoodsList[$index].quantity" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
-                   </el-form-item>
-               </template>
+                <el-form-item prop="quantity" :inline-message="true">
+                  <el-input-number
+                    v-model="boxFormData.packDetailGoodsList[$index].quantity"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                    onmousewheel="return false;"
+                  />
+                </el-form-item>
+              </template>
             </el-table-column>
           </el-table>
-          <el-table v-else :data="boxFormData.packDetailProductList" @select="handleSelectProduct" @select-all="handleSelectProduct" ref="tableDom">
-              <el-table-column prop="productName" label="产品名称" min-width="180">
-                <template #default="{ row, $index }">
-                  <!-- 选择产品 -->
-                    <el-form-item 
-                      prop="mathId"  
-                      style="margin-bottom:0px" :inline-message="true">
-                      <el-select
-                        :model-value="boxFormData.packDetailProductList[$index].mathId" 
-                        placeholder="请选择" 
-                        @change="(e) => selectProduct(e,$index)" 
-                        filterable style="width: 100%"
-                        >
-                        <el-option v-for="item in formData.data.contractProductData" :disabled='item.disabled' :label="item.productName" :value="item.mathId"> </el-option>
-                      </el-select>
-                    </el-form-item>
-                  
-                </template>
-              </el-table-column>
-              <el-table-column prop="productSpec" label="规格型号" min-width="100" />
-              <el-table-column prop="cpQuantity" label="合同数量" width="100" />
-              <el-table-column prop="waitQuantity" label="待装箱数量" width="100" />
-              <el-table-column prop="quantity" label="装箱数量" width="100">
-                <template #default="{ row, $index }">
-                   
-                    <el-form-item prop="quantity" :inline-message="true">
-                      <el-input-number :max="row.waitQuantity" v-model="boxFormData.packDetailProductList[$index].quantity" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
-                    </el-form-item>
-                </template>
-              </el-table-column>
-              <!-- 删除按钮 -->
-              <el-table-column prop="quantity" label="操作" width="100">
-                <template #default="{ row, $index }">
-                  <el-button type="danger" @click="boxFormData.packDetailProductList.splice($index,1)"> 删除 </el-button>
-                </template>
-              </el-table-column>
+          <el-table
+            v-else
+            :data="boxFormData.packDetailProductList"
+            @select="handleSelectProduct"
+            @select-all="handleSelectProduct"
+            ref="tableDom"
+          >
+            <el-table-column
+              prop="productName"
+              label="产品名称"
+              min-width="180"
+            >
+              <template #default="{ row, $index }">
+                <!-- 选择产品 -->
+                <el-form-item
+                  prop="mathId"
+                  style="margin-bottom: 0px"
+                  :inline-message="true"
+                >
+                  <el-select
+                    :model-value="
+                      boxFormData.packDetailProductList[$index].mathId
+                    "
+                    placeholder="请选择"
+                    @change="(e) => selectProduct(e, $index)"
+                    filterable
+                    style="width: 100%"
+                  >
+                    <el-option
+                      v-for="item in formData.data.contractProductData"
+                      :disabled="item.disabled"
+                      :label="item.productName"
+                      :value="item.mathId"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="productSpec"
+              label="规格型号"
+              min-width="100"
+            />
+            <el-table-column prop="cpQuantity" label="合同数量" width="100" />
+            <el-table-column
+              prop="waitQuantity"
+              label="待装箱数量"
+              width="100"
+            />
+            <el-table-column prop="quantity" label="装箱数量" width="100">
+              <template #default="{ row, $index }">
+                <el-form-item prop="quantity" :inline-message="true">
+                  <el-input-number
+                    :max="row.waitQuantity"
+                    v-model="boxFormData.packDetailProductList[$index].quantity"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                    onmousewheel="return false;"
+                  />
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <!-- 删除按钮 -->
+            <el-table-column prop="quantity" label="操作" width="100">
+              <template #default="{ row, $index }">
+                <el-button
+                  type="danger"
+                  @click="boxFormData.packDetailProductList.splice($index, 1)"
+                >
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
           </el-table>
         </el-col>
       </el-row>
       <template #footer>
-        <el-button type="primary" @click="submitBox()" size="large" :loading="submitLoading"> 确 定 </el-button>
+        <el-button
+          type="primary"
+          @click="submitBox()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
       </template>
     </el-dialog>
-    <el-dialog title="产品装箱" v-model="dialogVisible" width="600" v-loading="loading">
-      <el-form :model="formData.data" :rules="rules" ref="formDom" label-position="top">
+
+    <el-dialog
+      title="产品装箱"
+      v-model="dialogVisible"
+      width="600"
+      v-loading="loading"
+    >
+      <el-form
+        :model="formData.data"
+        :rules="rules"
+        ref="formDom"
+        label-position="top"
+      >
         <el-row :gutter="10">
           <el-col :span="8">
             <el-form-item label="客户名称" prop="customerId">
-              <el-select v-model="formData.data.customerId" placeholder="请选择" @change="handleChangeCustomer" filterable style="width: 100%">
-                <el-option v-for="item in customerList" :label="item.name" :value="item.id"> </el-option>
+              <el-select
+                v-model="formData.data.customerId"
+                placeholder="请选择"
+                @change="handleChangeCustomer"
+                filterable
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in customerList"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
         <el-form-item label="选择合同" prop="contractIds">
-          <el-select v-model="formData.data.contractIds" placeholder="请选择" @change="handleChangeContract" filterable style="width: 100%" multiple>
-            <el-option v-for="item in contractData" :label="item.code" :value="item.id"> </el-option>
+          <el-select
+            v-model="formData.data.contractIds"
+            placeholder="请选择"
+            @change="handleChangeContract"
+            filterable
+            style="width: 100%"
+            multiple
+          >
+            <el-option
+              v-for="item in contractData"
+              :label="item.code"
+              :value="item.id"
+            >
+            </el-option>
           </el-select>
         </el-form-item>
         <div class="box-icon-warp">
-          <div class="box-content"  v-for="(i,index) in formData.data.packDetailList"  :key="i.id" @click="openDtlUpdata(index)">
+          <div
+            class="box-content"
+            v-for="(i, index) in formData.data.packDetailList"
+            :key="i.id"
+            @click="openDtlUpdata(index)"
+          >
             <div class="box-icon">
               <i class="iconfont icon-iconm_daick"></i>
             </div>
-            <div class="box-text"> * {{i.packQuantity}}</div>
+            <div class="box-text">* {{ i.packQuantity }}</div>
           </div>
           <div class="add-box">
             <i class="iconfont icon-iconm_tianjia1" @click="openDtlModal"></i>
@@ -271,14 +426,42 @@
       </el-form>
       <template #footer>
         <el-button @click="handleClose" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm()" size="large" :loading="submitLoading"> 确 定 </el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
       </template>
     </el-dialog>
-    <el-dialog title="合并出货" v-model="dialogVisibleOne" width="400" v-loading="loadingOne">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.dataOne" :rules="rules" ref="byform"> </byForm>
+    <el-dialog
+      title="合并出货"
+      v-model="dialogVisibleOne"
+      width="400"
+      v-loading="loadingOne"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.dataOne"
+        :rules="rules"
+        ref="byform"
+      >
+      </byForm>
       <template #footer>
-        <el-button @click="dialogVisibleOne = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitFormOne()" size="large" :loading="submitLoading"> 确 定 </el-button>
+        <el-button @click="dialogVisibleOne = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitFormOne()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
       </template>
     </el-dialog>
   </div>
@@ -293,7 +476,6 @@ import FileUpload from "@/components/FileUpload/index";
 import { computed, defineComponent, ref } from "vue";
 import { getToken } from "@/utils/auth";
 
-
 const loading = ref(false);
 const loadingOne = ref(false);
 const dtlModalType = ref(false);
@@ -308,24 +490,31 @@ const sourceList = ref({
   },
 });
 
-
 const computeBomVolume = () => {
-  if(boxFormData.value.boxLong && boxFormData.value.boxWide && boxFormData.value.boxHigh) {
-    boxFormData.value.bomVolume = (boxFormData.value.boxLong * boxFormData.value.boxWide * boxFormData.value.boxHigh) / 1000000
+  if (
+    boxFormData.value.boxLong &&
+    boxFormData.value.boxWide &&
+    boxFormData.value.boxHigh
+  ) {
+    boxFormData.value.bomVolume =
+      (boxFormData.value.boxLong *
+        boxFormData.value.boxWide *
+        boxFormData.value.boxHigh) /
+      1000000;
   }
-}
+};
 
 const openDtlUpdata = (index) => {
-  boxFormType = 'updata'
+  boxFormType = "updata";
   boxIndex.value = index;
-  boxFormData.value = {...formData.data.packDetailList[index]}
+  boxFormData.value = { ...formData.data.packDetailList[index] };
   formData.data.contractProductData.forEach((item) => {
-    item.disabled = false
+    item.disabled = false;
     boxFormData.value.packDetailProductList.forEach((item1) => {
-      if(item.mathId == item1.mathId){
-        item.disabled = true
+      if (item.mathId == item1.mathId) {
+        item.disabled = true;
       }
-    })
+    });
   });
   dtlModalType.value = true;
 };
@@ -345,7 +534,7 @@ let boxFormData = ref({
 });
 
 const openCustom = (type) => {
-  if(type == '2' && boxFormData.value.packDetailGoodsList.length == 0) {
+  if (type == "2" && boxFormData.value.packDetailGoodsList.length == 0) {
     for (let i = 0; i < boxFormData.value.packDetailProductList.length; i++) {
       const item = boxFormData.value.packDetailProductList[i];
       if (item.quantity == null) {
@@ -353,24 +542,27 @@ const openCustom = (type) => {
         return;
       }
       if (item.productId == null) {
-          ElMessage.error("请填写选择产品");
-          return;
+        ElMessage.error("请填写选择产品");
+        return;
       }
     }
-    boxFormData.value.packDetailGoodsList = boxFormData.value.packDetailProductList.map(item => {
-      return {
-        remark:item.productName,
-        unit:null,
-        quantity:item.quantity
-      }
-    })
+    boxFormData.value.packDetailGoodsList =
+      boxFormData.value.packDetailProductList.map((item) => {
+        return {
+          remark: item.productName,
+          unit: null,
+          quantity: item.quantity,
+        };
+      });
   }
-  encasementType.value = type
-}
+  encasementType.value = type;
+};
 
 const openDtlModal = () => {
-  console.log(formData.data.contractProductData)
-  if(!formData.data.contractProductData || formData.data.contractProductData.length == 0) {
+  if (
+    !formData.data.contractProductData ||
+    formData.data.contractProductData.length == 0
+  ) {
     ElMessage.error("请先选择合同");
     return;
   }
@@ -387,31 +579,29 @@ const openDtlModal = () => {
     //生成唯一id
     id: Math.random().toString(36).substr(2),
   };
-  boxFormType = 'add'
+  boxFormType = "add";
   boxIndex.value = formData.data.packDetailList.length;
   formData.data.contractProductData.forEach((item) => {
-    item.disabled = false
+    item.disabled = false;
     boxFormData.value.packDetailProductList.forEach((item1) => {
-      if(item.mathId == item1.mathId){
-        item.disabled = true
+      if (item.mathId == item1.mathId) {
+        item.disabled = true;
       }
-    })
+    });
   });
   dtlModalType.value = true;
-
 };
 
-
 const boxIndex = ref(0);
 
 const packDetailProductListPush = (index) => {
-  if(encasementType.value == '2') {
+  if (encasementType.value == "2") {
     boxFormData.value.packDetailGoodsList.push({
-      remark:null,
-      unit:null,
-      quantity:null,
-    })
-  }else{
+      remark: null,
+      unit: null,
+      quantity: null,
+    });
+  } else {
     boxFormData.value.packDetailProductList.push({
       contractId: null,
       productName: null,
@@ -419,18 +609,17 @@ const packDetailProductListPush = (index) => {
       quantity: null,
       productId: null,
       productModel: null,
-      remark:null,
+      remark: null,
     });
   }
-  
 };
 
-let boxFormType = 'add'
+let boxFormType = "add";
 
 const submitBox = () => {
   formDom.value.validate((vaild) => {
     if (vaild) {
-      if(boxFormData.value.packDetailProductList.length == 0){
+      if (boxFormData.value.packDetailProductList.length == 0) {
         ElMessage.error("请添加产品");
         return;
       }
@@ -439,46 +628,55 @@ const submitBox = () => {
         if (item.quantity == null) {
           ElMessage.error("请填写装箱数量");
           return;
+        } else {
+          if (
+            item.quantity * boxFormData.value.packQuantity >
+            item.waitQuantity
+          ) {
+            return ElMessage({
+              message: "装箱数量 * 总箱数不可大于待装箱数量",
+              type: "info",
+            });
+          }
         }
         if (item.productId == null) {
-            ElMessage.error("请填写选择产品");
-            return;
+          ElMessage.error("请填写选择产品");
+          return;
         }
       }
       dtlModalType.value = false;
-      if(boxFormType == 'add') {
-        formData.data.packDetailList.push(
-          {...boxFormData.value}
-        )
-        console.log(formData.data.packDetailList)
+      if (boxFormType == "add") {
+        formData.data.packDetailList.push({ ...boxFormData.value });
       } else {
-        formData.data.packDetailList[boxIndex.value] = {...boxFormData.value}
+        formData.data.packDetailList[boxIndex.value] = { ...boxFormData.value };
       }
     }
-  })
+  });
 };
 
 const dtlformData = reactive({
   data: {
-    customerId:null,
-    contractIds:null,
-    packQuantity:null,
-    netWeight:null,
-    roughWeight:null,
-    boxLong:null,
-    boxWide:null,
-    boxHigh:null,
-    remark:null,
-    packDetailGoodsList:[],
-    packDetailProductList:[],
-    bomVolume:null,
+    customerId: null,
+    contractIds: null,
+    packQuantity: null,
+    netWeight: null,
+    roughWeight: null,
+    boxLong: null,
+    boxWide: null,
+    boxHigh: null,
+    remark: null,
+    packDetailGoodsList: [],
+    packDetailProductList: [],
+    bomVolume: null,
   },
 });
 
-const selectProduct = (val,index) => {
-  let msg  = {...formData.data.contractProductData.find((item) => item.mathId == val)}
+const selectProduct = (val, index) => {
+  let msg = {
+    ...formData.data.contractProductData.find((item) => item.mathId == val),
+  };
   //根据val 禁用相应的下拉数据
-  
+
   boxFormData.value.packDetailProductList[index] = {
     productId: msg.productId,
     productName: msg.productName,
@@ -491,20 +689,17 @@ const selectProduct = (val,index) => {
     mathId: msg.mathId,
     contractId: msg.contractId,
     contractProductId: msg.id,
-  }
-  console.log(boxFormData.value.packDetailProductList)
+  };
   formData.data.contractProductData.forEach((item) => {
-    item.disabled = false
+    item.disabled = false;
     boxFormData.value.packDetailProductList.forEach((item1) => {
-      if(item.mathId == item1.mathId){
-        item.disabled = true
+      if (item.mathId == item1.mathId) {
+        item.disabled = true;
       }
-    })
+    });
   });
-  console.log(formData.data.packDetailList)
 };
 
-
 let dialogVisible = ref(false);
 let dialogVisibleOne = ref(false);
 
@@ -689,11 +884,15 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              ElMessageBox.confirm("此操作将永久作废该数据, 是否继续?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-              }).then(() => {
+              ElMessageBox.confirm(
+                "此操作将永久作废该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
                 // 删除
                 proxy
                   .post("/pack/delete", {
@@ -737,7 +936,7 @@ const formConfig = reactive([
   },
 ]);
 
-const encasementType = ref('1')
+const encasementType = ref("1");
 
 const getList = async (req) => {
   selectData.value = [];
@@ -816,7 +1015,7 @@ const submitForm = () => {
       }
       submitLoading.value = true;
       loadingOne.value = true;
-      
+
       formData.data.contractIds = formData.data.contractIds.join(",");
       for (let i = 0; i < formData.data.packDetailList.length; i++) {
         const e = formData.data.packDetailList[i];
@@ -824,19 +1023,18 @@ const submitForm = () => {
         e.contractIds = formData.data.contractIds;
         e.customerId = formData.data.customerId;
       }
-      console.log(formData.data.packDetailList)
       formData.data.packDetailList.map((x) => {
-        return{
+        return {
           ...x,
-          customerId:formData.data.customerId,
-          contractIds:formData.data.contractIds,
-        }
+          customerId: formData.data.customerId,
+          contractIds: formData.data.contractIds,
+        };
       });
-      let reqData = {...formData.data}
+      let reqData = { ...formData.data };
       //删除 reqData.packDetailList 里的id
       reqData.packDetailList.forEach((item) => {
-        delete item.id
-      })
+        delete item.id;
+      });
       proxy.post("/pack/" + modalType.value, reqData).then(
         (res) => {
           ElMessage({
@@ -923,7 +1121,9 @@ const handleClickPacking = () => {
       productName: x.productName,
     }));
     const customerId = formData.data.customerId ? formData.data.customerId : "";
-    const contractIds = formData.data.contractIds ? formData.data.contractIds.join(",") : "";
+    const contractIds = formData.data.contractIds
+      ? formData.data.contractIds.join(",")
+      : "";
     let item = {
       customerId: customerId,
       contractIds: contractIds,
@@ -940,7 +1140,10 @@ const handleClickPacking = () => {
       isShow: false,
     };
     formData.data.packDetailList.push(item);
-    handleChangePackQuantity(item.packQuantity, formData.data.packDetailList.length - 1);
+    handleChangePackQuantity(
+      item.packQuantity,
+      formData.data.packDetailList.length - 1
+    );
     tableDom.value.clearSelection();
     selectProductData.value = [];
     table.value.clearSelection();
@@ -956,14 +1159,18 @@ const handleChangePackQuantity = (val, index) => {
   const obj = {};
   for (let i = 0; i < formData.data.contractProductData.length; i++) {
     const e = formData.data.contractProductData[i];
-    obj[e.contractId + "_" + e.productId + ""] = (Number(e.cpQuantity) - Number(e.sumPackQuantity)).toFixed(2);
+    obj[e.contractId + "_" + e.productId + ""] = (
+      Number(e.cpQuantity) - Number(e.sumPackQuantity)
+    ).toFixed(2);
   }
   // 计算数量 即装箱数量 * 箱数 新增字段放在最外层
   for (let i = 0; i < formData.data.packDetailList.length; i++) {
     const ele = formData.data.packDetailList[i];
     for (let j = 0; j < ele.packDetailProductList.length; j++) {
       const jele = ele.packDetailProductList[j];
-      ele[jele.contractId + "_" + jele.productId + ""] = (Number(ele.packQuantity) * jele.quantity).toFixed(2);
+      ele[jele.contractId + "_" + jele.productId + ""] = (
+        Number(ele.packQuantity) * jele.quantity
+      ).toFixed(2);
     }
   }
   // 计算新的待装箱数量
@@ -1020,23 +1227,32 @@ const getSelectData = () => {
 };
 const contractData = ref([]);
 const handleChangeCustomer = (val) => {
-  proxy.get(`/contract/getNoPackContractByCustomerId?customerId=${val}`).then((res) => {
-    contractData.value = res.data;
-    formData.data.contractIds = [];
-  });
+  proxy
+    .get(`/contract/getNoPackContractByCustomerId?customerId=${val}`)
+    .then((res) => {
+      contractData.value = res.data;
+      formData.data.contractIds = [];
+      formData.data.packDetailList = [];
+    });
 };
 const handleChangeContract = (val) => {
   const customerId = formData.data.customerId ? formData.data.customerId : "";
-  proxy.get(`/contractProduct/getNoPackContractProductById?customerId=${customerId}&contractIds=${val}`).then((res) => {
-    formData.data.contractProductData = res.data.map((x) => ({
-      ...x,
-      waitQuantity: (Number(x.cpQuantity) - Number(x.sumPackQuantity)).toFixed(2),
-      quantity: null,
-      mathId: Math.random().toString(36).substr(2),
-      disabled: false,
-    }));
-    handleChangePackQuantity();
-  });
+  proxy
+    .get(
+      `/contractProduct/getNoPackContractProductById?customerId=${customerId}&contractIds=${val}`
+    )
+    .then((res) => {
+      formData.data.contractProductData = res.data.map((x) => ({
+        ...x,
+        waitQuantity: (
+          Number(x.cpQuantity) - Number(x.sumPackQuantity)
+        ).toFixed(2),
+        quantity: null,
+        mathId: Math.random().toString(36).substr(2),
+        disabled: false,
+      }));
+      handleChangePackQuantity();
+    });
 };
 
 const getData = (data, type) => {
@@ -1082,39 +1298,39 @@ const clickDelete = (index) => {
   border: none;
 }
 
-.box-icon-warp{
+.box-icon-warp {
   width: 100%;
   display: flex;
-  .add-box{
+  .add-box {
     width: 33.33%;
     height: 100px;
     border-radius: 50%;
     display: flex;
     justify-content: center;
-    i{
+    i {
       display: block;
       width: 100px;
       height: 100px;
-      border:1px solid #dcdcdc;
+      border: 1px solid #dcdcdc;
       text-align: center;
       line-height: 100px;
       cursor: pointer;
     }
   }
-  .box-content{
+  .box-content {
     width: 33.33%;
     height: 100px;
     border-radius: 50%;
     display: flex;
     justify-content: center;
     align-items: center;
-    .box-icon{
-      i{
+    .box-icon {
+      i {
         font-size: 60px;
       }
       color: #f5a623;
     }
-    .box-text{
+    .box-text {
       font-size: 20px;
       color: #f5a623;
     }