Parcourir la source

流程审批组件数据回显

cz il y a 1 an
Parent
commit
9ee75177e9

+ 105 - 14
src/components/process/ReturnGood.vue

@@ -1,39 +1,83 @@
 <template>
   <div style="width: 100%; padding: 0px 15px">
-    <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
+    <byForm
+      :formConfig="formConfig"
+      :formOption="formOption"
+      v-model="formData.data"
+      :rules="rules"
+      ref="formDom"
+    >
       <template #details>
         <div style="width: 100%">
-          <el-button type="primary" @click="openProduct = true" style="margin-bottom: 10px"> 添加物品 </el-button>
+          <el-button
+            type="primary"
+            @click="openProduct = true"
+            style="margin-bottom: 10px"
+          >
+            添加物品
+          </el-button>
           <el-table :data="formData.data.salesReturnDetailList">
             <el-table-column prop="productCode" label="货品编码" />
             <el-table-column prop="productName" label="货品名称" />
             <el-table-column prop="productSpec" label="规格型号" />
-            <el-table-column prop="productUnit" label="单位" />
+            <el-table-column
+              prop="productUnit"
+              label="单位"
+              :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+            />
             <el-table-column prop="count" label="退货数量" min-width="150">
               <template #default="{ row, $index }">
-                <el-form-item :prop="'salesReturnDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
-                  <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="0" />
+                <el-form-item
+                  :prop="'salesReturnDetailList.' + $index + '.count'"
+                  :rules="rules.count"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    onmousewheel="return false;"
+                    v-model="row.count"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                  />
                 </el-form-item>
               </template>
             </el-table-column>
             <el-table-column prop="remark" label="退货原因" min-width="150">
               <template #default="{ row, $index }">
-                <el-form-item :prop="'salesReturnDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
-                  <el-input v-model="row.remark" placeholder="请输入" />
+                <el-form-item
+                  :prop="'salesReturnDetailList.' + $index + '.remark'"
+                  :rules="rules.remark"
+                  :inline-message="true"
+                >
+                  <el-input
+                    v-model="row.remark"
+                    placeholder="请输入"
+                    type="textarea"
+                  />
                 </el-form-item>
               </template>
             </el-table-column>
             <el-table-column prop="zip" label="操作" width="100">
               <template #default="{ $index }">
-                <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+                <el-button type="primary" link @click="handleRemove($index)"
+                  >删除</el-button
+                >
               </template>
             </el-table-column>
           </el-table>
         </div>
       </template>
     </byForm>
-    <el-dialog v-model="openProduct" title="选择货品" width="70%" append-to-body>
-      <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    <el-dialog
+      v-model="openProduct"
+      title="选择货品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
     </el-dialog>
   </div>
 </template>
@@ -44,6 +88,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import SelectGoods from "@/components/product/SelectGoods";
 import useUserStore from "@/store/modules/user";
 const { proxy } = getCurrentInstance();
+const route = useRoute();
 
 let formData = reactive({
   data: {
@@ -52,6 +97,7 @@ let formData = reactive({
     returnName: "",
   },
 });
+
 let rules = ref({
   supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
   count: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
@@ -161,7 +207,8 @@ const pushGoods = (goods) => {
     bussinessId: x.id,
     remark: "",
   }));
-  formData.data.salesReturnDetailList = formData.data.salesReturnDetailList.concat(arr);
+  formData.data.salesReturnDetailList =
+    formData.data.salesReturnDetailList.concat(arr);
   openProduct.value = false;
   return ElMessage({
     message: "添加成功!",
@@ -177,10 +224,54 @@ const props = defineProps({
 // 获取用户信息并赋默认值
 const userInfo = useUserStore().user;
 onMounted(() => {
-  formData.data.purchaseTime = proxy.parseTime(new Date());
-  formData.data.returnDept = userInfo.dept.deptName;
-  formData.data.returnName = userInfo.nickName;
+  if (!route.query.processType) {
+    formData.data.purchaseTime = proxy.parseTime(new Date());
+    formData.data.returnDept = userInfo.dept.deptName;
+    formData.data.returnName = userInfo.nickName;
+  }
 });
+
+const judgeStatus = () => {
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+
+watch(
+  props.queryData,
+  () => {
+    formOption.disabled = judgeStatus();
+    if (
+      props.queryData &&
+      (route.query.processType == 10 || route.query.processType == 20)
+    ) {
+      for (const key in props.queryData) {
+        formData.data[key] = props.queryData[key];
+      }
+    }
+  },
+  {
+    deep: true,
+  }
+);
+
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+
 // 向父组件暴露
 defineExpose({
   submitData: formData.data,

+ 58 - 7
src/components/process/SendPurchase.vue

@@ -5,6 +5,7 @@
       :rules="rules"
       ref="formDom"
       label-position="top"
+      :disabled="judgeStatus()"
     >
       <div class="_t">基础信息</div>
       <el-row :gutter="10">
@@ -77,7 +78,11 @@
           <el-table-column prop="productCode" label="货品编码" />
           <el-table-column prop="productName" label="货品名称" />
           <el-table-column prop="productSpec" label="规格型号" />
-          <el-table-column prop="productUnit" label="单位" />
+          <el-table-column
+            prop="productUnit"
+            label="单位"
+            :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+          />
           <el-table-column
             prop="subscribeCount"
             label="申购数量"
@@ -165,7 +170,12 @@ import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage, ElMessageBox } from "element-plus";
 import useUserStore from "@/store/modules/user";
 
+const route = useRoute();
 const { proxy } = getCurrentInstance();
+// 接收父组件的传值
+const props = defineProps({
+  queryData: String,
+});
 
 let formData = reactive({
   data: {
@@ -278,11 +288,6 @@ onMounted(() => {
   }
 });
 
-// 接收父组件的传值
-const props = defineProps({
-  queryData: String,
-});
-
 const ids = ref([]);
 const getDetails = () => {
   if (props.queryData.type && props.queryData.type === "handoverSlip") {
@@ -302,7 +307,13 @@ const getDetails = () => {
   } else {
     proxy.post("/subscribeDetail/detail", { ids: ids.value }).then((res) => {
       formData.data.purchaseDetailList = res.map((x) => ({
-        ...x,
+        bussinessId: x.bussinessId,
+        goodType: x.productDefinition,
+        productCode: x.productCode,
+        productName: x.productName,
+        productSpec: x.productSpec,
+        productUnit: x.productUnit,
+        purchaseCount: x.purchaseCount,
         subscribeCount: x.count,
         count: 0,
         price: null,
@@ -334,6 +345,46 @@ const handleChangeAmount = () => {
   }
   formData.data.amount = sum;
 };
+
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+
+watch(
+  props.queryData,
+  () => {
+    if (
+      props.queryData &&
+      (route.query.processType == 10 || route.query.processType == 20)
+    ) {
+      for (const key in props.queryData) {
+        formData.data[key] = props.queryData[key];
+      }
+    }
+  },
+  {
+    deep: true,
+  }
+);
+const judgeStatus = () => {
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+
 // 向父组件暴露
 defineExpose({
   submitData: formData.data,

+ 141 - 22
src/components/process/SendSubscribe.vue

@@ -1,60 +1,124 @@
 <template>
   <div style="width: 100%; padding: 0px 15px">
-    <el-form :model="formData.data" :rules="rules" ref="formDom" label-position="top">
+    <el-form
+      :model="formData.data"
+      :rules="rules"
+      ref="formDom"
+      label-position="top"
+      :disabled="judgeStatus()"
+    >
       <div class="_t">申购信息</div>
       <el-row :gutter="10">
         <el-col :span="6">
           <el-form-item label="申购部门" prop="deptName">
-            <el-input v-model="formData.data.deptName" placeholder="请输入"> </el-input>
+            <el-input
+              v-model="formData.data.deptName"
+              placeholder="请输入"
+              disabled
+            >
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="申购人" prop="subcribeName">
-            <el-input v-model="formData.data.subcribeName" placeholder="请输入"> </el-input>
+            <el-input
+              v-model="formData.data.subcribeName"
+              placeholder="请输入"
+              disabled
+            >
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="申购时间" prop="subcribeTime">
-            <el-date-picker v-model="formData.data.subcribeTime" type="datetime" placeholder="请选择" />
+            <el-date-picker
+              v-model="formData.data.subcribeTime"
+              type="datetime"
+              placeholder="请选择"
+              disabled
+            />
           </el-form-item>
         </el-col>
       </el-row>
       <el-form-item label="申购说明" prop="subcribeContent">
-        <el-input v-model="formData.data.subcribeContent" placeholder="请输入" type="textarea"> </el-input>
+        <el-input
+          v-model="formData.data.subcribeContent"
+          placeholder="请输入"
+          type="textarea"
+        >
+        </el-input>
       </el-form-item>
       <div class="_t">申购明细</div>
       <el-form-item>
-        <el-button type="primary" @click="openProduct = true" style="margin: 10px 0"> 添加货品 </el-button>
+        <el-button
+          type="primary"
+          @click="openProduct = true"
+          style="margin: 10px 0"
+        >
+          添加货品
+        </el-button>
         <el-table :data="formData.data.subscribeDetailList">
-          <el-table-column prop="goodType" label="货品类型" :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')" />
+          <el-table-column
+            prop="goodType"
+            label="货品类型"
+            :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+          />
           <el-table-column prop="code" label="货品编码" />
           <el-table-column prop="name" label="货品名称" min-width="150" />
           <el-table-column prop="spec" label="规格型号" />
-          <el-table-column prop="unit" label="单位" />
+          <el-table-column
+            prop="unit"
+            label="单位"
+            :formatter="(row) => dictValueLabel(row.unit, productUnit)"
+          />
           <el-table-column prop="count" label="申购数量" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'subscribeDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
-                <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="1" />
+              <el-form-item
+                :prop="'subscribeDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-input-number
+                  onmousewheel="return false;"
+                  v-model="row.count"
+                  :precision="4"
+                  :controls="false"
+                  :min="1"
+                />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="remark" label="备注" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'subscribeDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
+              <el-form-item
+                :prop="'subscribeDetailList.' + $index + '.remark'"
+                :rules="rules.remark"
+                :inline-message="true"
+              >
                 <el-input v-model="row.remark" placeholder="请输入" />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="zip" label="操作" width="100">
             <template #default="{ $index }">
-              <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+              <el-button type="primary" link @click="handleRemove($index)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
       </el-form-item>
     </el-form>
-    <el-dialog v-model="openProduct" title="选择货品" width="70%" append-to-body>
-      <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    <el-dialog
+      v-model="openProduct"
+      title="选择货品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
     </el-dialog>
   </div>
 </template>
@@ -63,8 +127,12 @@
 import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage, ElMessageBox } from "element-plus";
 import useUserStore from "@/store/modules/user";
-
+const route = useRoute();
 const { proxy } = getCurrentInstance();
+// 接收父组件的传值
+const props = defineProps({
+  queryData: String,
+});
 
 let formData = reactive({
   data: {
@@ -74,8 +142,12 @@ let formData = reactive({
 });
 let rules = ref({
   deptName: [{ required: true, message: "请输入申购部门", trigger: "blur" }],
-  subcribeName: [{ required: true, message: "请输入申购人名称", trigger: "blur" }],
-  subcribeTime: [{ required: true, message: "请选择申购时间", trigger: "change" }],
+  subcribeName: [
+    { required: true, message: "请输入申购人名称", trigger: "blur" },
+  ],
+  subcribeTime: [
+    { required: true, message: "请选择申购时间", trigger: "change" },
+  ],
   // subcribeContent: [
   //   { required: true, message: "请输入申购事由", trigger: "blur" },
   // ],
@@ -95,12 +167,17 @@ const handleRemove = (index) => {
 
 const pushGoods = (goods) => {
   const arr = goods.map((x) => ({
-    ...x,
+    goodType: x.goodType,
+    code: x.code,
+    name: x.name,
+    spec: x.spec,
+    unit: x.unit,
     bussinessId: x.id,
     count: "",
     remark: "",
   }));
-  formData.data.subscribeDetailList = formData.data.subscribeDetailList.concat(arr);
+  formData.data.subscribeDetailList =
+    formData.data.subscribeDetailList.concat(arr);
   openProduct.value = false;
   return ElMessage({
     message: "添加成功!",
@@ -127,11 +204,53 @@ const handleSubmit = async () => {
 
 const userInfo = useUserStore().user;
 onMounted(() => {
-  formData.data.subcribeTime = proxy.parseTime(new Date());
-  formData.data.deptName = userInfo.dept.deptName;
-  formData.data.subcribeName = userInfo.nickName;
+  if (!route.query.processType) {
+    formData.data.subcribeTime = proxy.parseTime(new Date());
+    formData.data.deptName = userInfo.dept.deptName;
+    formData.data.subcribeName = userInfo.nickName;
+  } else {
+  }
 });
 
+const judgeStatus = () => {
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+
+watch(
+  props.queryData,
+  () => {
+    if (
+      props.queryData &&
+      (route.query.processType == 10 || route.query.processType == 20)
+    ) {
+      for (const key in props.queryData) {
+        formData.data[key] = props.queryData[key];
+      }
+    }
+  },
+  {
+    deep: true,
+  }
+);
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+
 defineExpose({
   submitData: formData.data,
   handleSubmit,

+ 13 - 2
src/views/purchaseManage/purchaseManage/purchase/index.vue

@@ -226,6 +226,9 @@ const config = computed(() => {
         label: "单位",
         prop: "productUnit",
       },
+      render(unit) {
+        return proxy.dictDataEcho(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -263,8 +266,8 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "200",
-        align: "right",
+        width: "100",
+        align: "center",
       },
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
@@ -447,6 +450,14 @@ const selectData = ref([]);
 const selectRow = (data) => {
   selectData.value = data;
 };
+const productUnit = ref([]);
+
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"];
+  });
+};
+getDict();
 
 const start = () => {
   if (selectData.value.length > 0) {

+ 44 - 29
src/views/purchaseManage/purchaseManage/returnGoods/index.vue

@@ -146,24 +146,37 @@ let rules = ref({
   count: [{ required: true, message: "请输入本次到货", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
+const statusData = ref([
+  {
+    label: "审批中",
+    value: "10",
+  },
+  {
+    label: "驳回",
+    value: "15",
+  },
+  {
+    label: "待退货",
+    value: "20",
+  },
+  {
+    label: "部分退货",
+    value: "30",
+  },
+  {
+    label: "已退货",
+    value: "40",
+  },
+  {
+    label: "已结束",
+    value: "50",
+  },
+]);
 const selectConfig = reactive([
   {
     label: "退货状态",
     prop: "status",
-    data: [
-      {
-        label: "审批中",
-        value: "10",
-      },
-      {
-        label: "驳回",
-        value: "15",
-      },
-      {
-        label: "待退货",
-        value: "20",
-      },
-    ],
+    data: statusData.value,
   },
 ]);
 const config = computed(() => {
@@ -198,6 +211,9 @@ const config = computed(() => {
         label: "单位",
         prop: "productUnit",
       },
+      render(unit) {
+        return proxy.dictDataEcho(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -211,13 +227,7 @@ const config = computed(() => {
         prop: "status",
       },
       render(status) {
-        return status == 10
-          ? "审批中"
-          : status == 15
-          ? "驳回"
-          : status == 20
-          ? "待退货"
-          : "";
+        return proxy.dictValueLabel(status, statusData.value);
       },
     },
     {
@@ -413,13 +423,7 @@ const handleEdit = (row, status) => {
 
 // 获取供应商数据
 const supplierData = ref([]);
-const getSupplierList = async (req) => {
-  proxy
-    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
-    .then((res) => {
-      supplierData.value = res.rows;
-    });
-};
+const productUnit = ref([]);
 const handleArrival = (row) => {
   proxy.post("/purchase/detail", { id: row.id }).then((res) => {
     formData.data = {
@@ -438,8 +442,19 @@ const handleArrival = (row) => {
   });
 };
 
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"];
+  });
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      supplierData.value = res.rows;
+    });
+};
+
 getList();
-getSupplierList();
+getDict();
 const start = () => {
   proxy.$router.replace({
     path: "/platform_manage/process/processApproval",

+ 56 - 41
src/views/purchaseManage/purchaseManage/subscribe/index.vue

@@ -167,7 +167,7 @@ const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "货品类型",
-    prop: "productType",
+    prop: "definition",
     data: [
       {
         label: "产品",
@@ -196,10 +196,10 @@ const config = computed(() => {
     {
       attrs: {
         label: "货品类型",
-        prop: "productType",
+        prop: "productDefinition",
       },
-      render(productType) {
-        return productType == 1 ? "产品" : "物料";
+      render(productDefinition) {
+        return productDefinition == 1 ? "产品" : "物料";
       },
     },
     {
@@ -224,6 +224,10 @@ const config = computed(() => {
       attrs: {
         label: "单位",
         prop: "productUnit",
+        width: 60,
+      },
+      render(unit) {
+        return proxy.dictValueLabel(unit, productUnit.value);
       },
     },
     {
@@ -240,7 +244,7 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "状态",
+        label: "采购状态",
         prop: "status",
       },
       render(status) {
@@ -256,8 +260,8 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "200",
-        align: "right",
+        width: "80",
+        align: "center",
       },
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
@@ -273,41 +277,42 @@ const config = computed(() => {
           //     getDtl(row);
           //   },
           // },
-          {
-            attrs: {
-              label: "作废",
-              type: "danger",
-              text: true,
-              disabled: row.status != 30,
-            },
-            el: "button",
-            click() {
-              // 弹窗提示是否删除
-              ElMessageBox.confirm(
-                "此操作将永久作废该数据, 是否继续?",
-                "提示",
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                }
-              ).then(() => {
-                // 删除
-                proxy
-                  .post("/subscribeDetail/edit", {
-                    ...row,
-                    status: 99,
-                  })
-                  .then((res) => {
-                    ElMessage({
-                      message: "作废成功",
-                      type: "success",
-                    });
-                    getList();
+          row.status == 15
+            ? {
+                attrs: {
+                  label: "作废",
+                  type: "danger",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  // 弹窗提示是否删除
+                  ElMessageBox.confirm(
+                    "此操作将永久作废该数据, 是否继续?",
+                    "提示",
+                    {
+                      confirmButtonText: "确定",
+                      cancelButtonText: "取消",
+                      type: "warning",
+                    }
+                  ).then(() => {
+                    // 删除
+                    proxy
+                      .post("/subscribeDetail/edit", {
+                        ...row,
+                        status: 99,
+                      })
+                      .then((res) => {
+                        ElMessage({
+                          message: "作废成功",
+                          type: "success",
+                        });
+                        getList();
+                      });
                   });
-              });
-            },
-          },
+                },
+              }
+            : {},
         ];
       },
     },
@@ -496,6 +501,16 @@ const statusData = ref([
   },
 ]);
 selectConfig[1].data = statusData.value;
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
 getList();
 </script>
   

+ 37 - 20
src/views/salesMange/shipmentMange/packing/index.vue

@@ -836,27 +836,44 @@ const handleClickPacking = () => {
 };
 
 const handleChangePackQuantity = (val, index) => {
-  if (formData.data.contractProductData.length > 0 && val && val > 0) {
-    for (let j = 0; j < formData.data.contractProductData.length; j++) {
-      const e = formData.data.contractProductData[j];
-      e.waitQuantity = Number(e.cpQuantity) - Number(e.sumPackQuantity);
-      let quantity = e.waitQuantity - val * Number(e.quantity);
-      if (quantity < 0) {
-        formData.data.packDetailList[index].packQuantity = undefined;
-        return ElMessage({
-          message: "装箱数量 * 箱数不可大于待装箱数量",
-          type: "info",
-        });
-      } else {
-        e.waitQuantity = quantity;
-      }
-    }
-  } else {
-    for (let j = 0; j < formData.data.contractProductData.length; j++) {
-      const e = formData.data.contractProductData[j];
-      e.waitQuantity = Number(e.cpQuantity) - Number(e.sumPackQuantity);
-    }
+  console.log(formData.data.contractProductData, "aa");
+  console.log(formData.data.packDetailList, "bb");
+  if (val && val > 0) {
+    // for (let i = 0; i < formData.data.contractProductData.length; i++) {
+    //   const iele = formData.data.contractProductData[i];
+    //   iele.waitQuantity =
+    //     Number(iele.cpQuantity) - Number(iele.sumPackQuantity);
+    //   let quantity = e.waitQuantity;
+    //   for (let j = 0; j < formData.data.packDetailList.length; j++) {
+    //     const jele = formData.data.packDetailList[j];
+    //   }
+    // }
   }
+  // if (formData.data.contractProductData.length > 0 && val && val > 0) {
+  //   for (let j = 0; j < formData.data.contractProductData.length; j++) {
+  //     const e = formData.data.contractProductData[j];
+  //     e.waitQuantity = Number(e.cpQuantity) - Number(e.sumPackQuantity);
+  //     let quantity = e.waitQuantity;
+  //     for (let i = 0; i < formData.data.packDetailList.length; i++) {
+  //       const iele = formData.data.packDetailList[i];
+  //       quantity -= iele.quantity * Number(e.quantity);
+  //       if (quantity < 0) {
+  //         formData.data.packDetailList[i].packQuantity = undefined;
+  //         return ElMessage({
+  //           message: "装箱数量 * 箱数不可大于待装箱数量",
+  //           type: "info",
+  //         });
+  //       } else {
+  //         e.waitQuantity = quantity;
+  //       }
+  //     }
+  //   }
+  // } else {
+  //   for (let j = 0; j < formData.data.contractProductData.length; j++) {
+  //     const e = formData.data.contractProductData[j];
+  //     e.waitQuantity = Number(e.cpQuantity) - Number(e.sumPackQuantity);
+  //   }
+  // }
 };
 
 const handleCustomPush = (index) => {