cz 2 жил өмнө
parent
commit
40c5008299

+ 2 - 1
src/components/WDLY/process/SendPurchaseWDLY.vue

@@ -436,9 +436,10 @@ const handleChangeSupplier = (val) => {
         for (const key in res) {
           if (e.bussinessId === key) {
             e.price = Number(res[key]);
-          }
+          } else e.price = null;
         }
       }
+      handleChangeAmount();
     });
 };
 // 计算采购总金额

+ 2 - 2
src/components/process/SendFunds.vue

@@ -25,7 +25,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="10">
           <el-form-item label="归属部门" prop="departmentId">
             <el-cascader
               v-model="formData.data.departmentId"
@@ -388,7 +388,7 @@ const getDictData = () => {
     })
     .then((message) => {
       recursive(message.data);
-      deptTreeData.value = proxy.handleTree(message.data, "corporationId");
+      deptTreeData.value = proxy.handleTree(message.data, "deptId");
     });
   // 请款类型数据
   proxy

+ 117 - 37
src/views/finance/fundManage/funds/index.vue

@@ -14,42 +14,80 @@
             action: () => openModal(),
           },
         ]"
-        @get-list="getList">
+        @get-list="getList"
+      >
         <template #fileSlot="{ item }">
-          <div style="cursor: pointer; color: #409eff" @click="handleClickFile(item)">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickFile(item)"
+          >
             {{ item.fileName }}
           </div>
         </template>
       </byTable>
     </div>
 
-    <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="680px" v-loading="loadingPrint">
+    <el-dialog
+      title="打印"
+      v-if="openPrint"
+      v-model="openPrint"
+      width="680px"
+      v-loading="loadingPrint"
+    >
       <div id="pdfDom" style="width: 616px">
-        <div style="margin: 16px 8px; border: 1px solid #909399; font-size: 12px !important; color: black">
-          <div style="font-size: 16px; font-weight: 700; text-align: center; padding: 8px">
+        <div
+          style="
+            margin: 16px 8px;
+            border: 1px solid #909399;
+            font-size: 12px !important;
+            color: black;
+          "
+        >
+          <div
+            style="
+              font-size: 16px;
+              font-weight: 700;
+              text-align: center;
+              padding: 8px;
+            "
+          >
             <span>{{ printDetails.corporationName }}</span>
-            <span style="margin-left: 16px">{{ dictDataEcho(printDetails.type, fundsType) }}审批单</span>
+            <span style="margin-left: 16px"
+              >{{ dictDataEcho(printDetails.type, fundsType) }}审批单</span
+            >
           </div>
           <div class="baseRow"></div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">请款部门</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.deptName }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.deptName }}
+            </div>
             <div class="contentRow" style="width: 80px">货币</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ dictDataEcho(printDetails.currency, accountCurrency) }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ dictDataEcho(printDetails.currency, accountCurrency) }}
+            </div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">请款时间</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.createTime }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.createTime }}
+            </div>
             <div class="contentRow" style="width: 80px">发票类型</div>
             <div class="contentRow" style="width: calc(50% - 80px)"></div>
           </div>
-          <div class="baseRow" style="display: flex" v-if="printDetails.type == '2'">
+          <div
+            class="baseRow"
+            style="display: flex"
+            v-if="printDetails.type == '2'"
+          >
             <div class="contentRow" style="width: 80px">预支单</div>
             <div class="contentRow" style="width: calc(100% - 80px)"></div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">请款说明</div>
-            <div class="contentRow" style="width: calc(100% - 80px)">{{ printDetails.paymentRemarks }}</div>
+            <div class="contentRow" style="width: calc(100% - 80px)">
+              {{ printDetails.paymentRemarks }}
+            </div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">凭证</div>
@@ -58,8 +96,16 @@
           <div class="specialRow">
             <span>请款明细</span>
           </div>
-          <div v-if="printDetails.accountRequestFundsDetailList && printDetails.accountRequestFundsDetailList.length > 0">
-            <div v-for="item in printDetails.accountRequestFundsDetailList" :key="item.id">
+          <div
+            v-if="
+              printDetails.accountRequestFundsDetailList &&
+              printDetails.accountRequestFundsDetailList.length > 0
+            "
+          >
+            <div
+              v-for="item in printDetails.accountRequestFundsDetailList"
+              :key="item.id"
+            >
               <div class="baseRow" style="display: flex">
                 <div class="contentRow" style="width: 25%">费用类型</div>
                 <div class="contentRow" style="width: 25%">关联合同</div>
@@ -67,10 +113,16 @@
                 <div class="contentRow" style="width: 25%">请款金额</div>
               </div>
               <div class="baseRow" style="display: flex">
-                <div class="contentRow" style="width: 25%">{{ dictDataEcho(item.costType, fundsCostType) }}</div>
+                <div class="contentRow" style="width: 25%">
+                  {{ dictDataEcho(item.costType, fundsCostType) }}
+                </div>
                 <div class="contentRow" style="width: 25%"></div>
-                <div class="contentRow" style="width: 25%">{{ item.remarks }}</div>
-                <div class="contentRow" style="width: 25%">{{ item.amount }}</div>
+                <div class="contentRow" style="width: 25%">
+                  {{ item.remarks }}
+                </div>
+                <div class="contentRow" style="width: 25%">
+                  {{ item.amount }}
+                </div>
               </div>
             </div>
           </div>
@@ -90,9 +142,13 @@
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">请款总额</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.total }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.total }}
+            </div>
             <div class="contentRow" style="width: 80px">单证数量</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.quantity }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.quantity }}
+            </div>
           </div>
           <!-- <div v-if="printDetails.type == '2'">
             <div class="baseRow" style="display: flex">
@@ -127,21 +183,33 @@
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">付款方式</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ dictDataEcho(printDetails.paymentMethod, fundsPaymentMethod) }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ dictDataEcho(printDetails.paymentMethod, fundsPaymentMethod) }}
+            </div>
             <div class="contentRow" style="width: 80px">付款账户</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.accountManagementName }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.accountManagementName }}
+            </div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">户名</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.name }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.name }}
+            </div>
             <div class="contentRow" style="width: 80px">开户银行</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.openingBank }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.openingBank }}
+            </div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: 80px">账号</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.accountOpening }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.accountOpening }}
+            </div>
             <div class="contentRow" style="width: 80px">联行号</div>
-            <div class="contentRow" style="width: calc(50% - 80px)">{{ printDetails.interbankNumber }}</div>
+            <div class="contentRow" style="width: calc(50% - 80px)">
+              {{ printDetails.interbankNumber }}
+            </div>
           </div>
           <div class="specialRow">
             <span>审批记录</span>
@@ -165,7 +233,9 @@
       </div>
       <template #footer>
         <el-button @click="openPrint = false" size="large">取消</el-button>
-        <el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
+        <el-button type="primary" @click="clickDownload()" size="large"
+          >下载PDF</el-button
+        >
       </template>
     </el-dialog>
   </div>
@@ -276,7 +346,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "付款账户",
-        prop: "accountManagementId",
+        prop: "accountManagementName",
       },
     },
     {
@@ -285,7 +355,13 @@ const config = computed(() => {
         prop: "status",
       },
       render(status) {
-        return status == 10 ? "审批中" : status == 20 ? "驳回" : status == 30 ? "已通过" : "";
+        return status == 10
+          ? "审批中"
+          : status == 20
+          ? "驳回"
+          : status == 30
+          ? "已通过"
+          : "";
       },
     },
     {
@@ -293,9 +369,9 @@ const config = computed(() => {
         label: "放款状态",
         prop: "subscribeContent",
       },
-      render(subscribeContent) {
-        return proxy.dictDataEcho(subscribeContent, fundsPaymentMethod.value);
-      },
+      // render(subscribeContent) {
+      //   return proxy.dictDataEcho(subscribeContent, fundsPaymentMethod.value);
+      // },
     },
     {
       attrs: {
@@ -324,19 +400,23 @@ const config = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/accountRequestFunds/page", sourceList.value.pagination).then((message) => {
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/accountRequestFunds/page", sourceList.value.pagination)
+    .then((message) => {
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 const openModal = () => {
+  const flowName = `${userInfo.nickName}的请款申请(发起)`;
   proxy.$router.replace({
     path: "/platform_manage/process/processApproval",
     query: {
       flowKey: "account_request_funds_flow",
+      flowName,
     },
   });
 };

+ 52 - 15
src/views/salesMange/saleContract/claim/index.vue

@@ -36,7 +36,10 @@
       >
         <template #detail>
           <div style="width: 100%">
-            <el-button type="primary" style="margin-bottom: 10px"
+            <el-button
+              type="primary"
+              style="margin-bottom: 10px"
+              @click="dialogVisibleOne = true"
               >选择合同</el-button
             >
             <el-table :data="formData.data.claimContractList">
@@ -112,6 +115,18 @@
         </el-button>
       </template>
     </el-dialog>
+
+    <el-dialog
+      title="合同选择"
+      v-model="dialogVisibleOne"
+      width="80%"
+      v-loading="loading"
+      destroy-on-close
+    >
+      <ContractSelect
+        @handleSelectContrct="handleSelectContrct"
+      ></ContractSelect>
+    </el-dialog>
   </div>
 </template>
   
@@ -123,6 +138,9 @@ import byForm from "@/components/byForm/index";
 import { computed, defineComponent, ref } from "vue";
 import useUserStore from "@/store/modules/user";
 import { getToken } from "@/utils/auth";
+
+import ContractSelect from "@/views/salesMange/saleContract/contractSelect/index";
+
 const headers = ref({ Authorization: "Bearer " + getToken() });
 const uploadData = ref({});
 let fileList = ref([]);
@@ -140,7 +158,7 @@ const sourceList = ref({
   },
 });
 let dialogVisible = ref(false);
-let roomDialogVisible = ref(false);
+let dialogVisibleOne = ref(false);
 let modalType = ref("add");
 let rules = ref({
   money: [{ required: true, message: "请输入关联金额", trigger: "blur" }],
@@ -441,6 +459,11 @@ const submitForm = () => {
         type: "info",
       });
     }
+    formData.data.fileList =
+      fileListCopy.value.map((x) => ({
+        id: x.id,
+        fileName: x.fileName,
+      })) || [];
     submitLoading.value = true;
     proxy.post("/claim/add", formData.data).then(
       (res) => {
@@ -468,13 +491,7 @@ const getDtl = (row) => {
     accountManagementId: row.accountManagementId,
     accountManagementName: row.accountManagementName,
     claimTime: proxy.parseTime(new Date()),
-    claimContractList: [
-      {
-        contractId: "1647884197353783298",
-        contractCode: "SC2304-001",
-        money: 0,
-      },
-    ],
+    claimContractList: [],
   };
   dialogVisible.value = true;
 };
@@ -511,12 +528,12 @@ const handleBeforeUpload = async (file) => {
 };
 
 const handleClose = (index) => {
-  if (fileListCopy.value.length === 1) {
-    return ElMessage({
-      message: "最后一个附件啦!",
-      type: "info",
-    });
-  }
+  // if (fileListCopy.value.length === 1) {
+  //   return ElMessage({
+  //     message: "最后一个附件啦!",
+  //     type: "info",
+  //   });
+  // }
   fileList.value.splice(index, 1);
   fileListCopy.value.splice(index, 1);
 };
@@ -529,6 +546,26 @@ const handleRemove = (index) => {
   });
 };
 
+const handleSelectContrct = (row) => {
+  const flag = formData.data.claimContractList.some(
+    (x) => x.contractId === row.id
+  );
+  if (flag)
+    return ElMessage({
+      message: "该合同已选择",
+      type: "info",
+    });
+  formData.data.claimContractList.push({
+    contractId: row.id,
+    contractCode: row.code,
+    money: 0,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
 getList();
 getDict();
 onMounted(() => {});

+ 322 - 0
src/views/salesMange/saleContract/contractSelect/index.vue

@@ -0,0 +1,322 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :selectConfig="selectConfig"
+        highlight-current-row
+        :action-list="[]"
+        @get-list="getList"
+      >
+        <template #amount="{ item }">
+          <div>
+            <span style="padding-right: 4px">{{ item.currency }}</span>
+            <span>{{ moneyFormat(item.amount, 2) }}</span>
+          </div>
+        </template>
+        <template #refundMoney="{ item }">
+          <div>
+            <span style="padding-right: 4px">{{ item.currency }}</span>
+            <span>{{ moneyFormat(item.refundMoney, 2) }}</span>
+          </div>
+        </template>
+        <template #advanceRatio="{ item }">
+          <div>
+            <span>{{ item.advanceRatio }}%</span>
+          </div>
+        </template>
+      </byTable>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import useUserStore from "@/store/modules/user";
+import { ElMessage, ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const contractType = ref([]);
+const corporationList = ref([]);
+const customerList = ref([]);
+const status = ref([
+  {
+    label: "草稿",
+    value: 0,
+  },
+  {
+    label: "审批中",
+    value: 10,
+  },
+  {
+    label: "驳回",
+    value: 20,
+  },
+  {
+    label: "审批通过",
+    value: 30,
+  },
+  {
+    label: "终止",
+    value: 99,
+  },
+]);
+const refundStatus = ref([
+  {
+    label: "未到款",
+    value: 0,
+  },
+  {
+    label: "部分到款",
+    value: 10,
+  },
+  {
+    label: "已到款",
+    value: 20,
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "30",
+    sellCorporationId: "",
+  },
+});
+const loading = ref(false);
+const selectConfig = computed(() => {
+  return [
+    // {
+    //   label: "审批状态",
+    //   prop: "status",
+    //   data: status.value,
+    // },
+    {
+      label: "到款状态",
+      prop: "refundStatus",
+      data: refundStatus.value,
+    },
+    // {
+    //   label: "归属公司",
+    //   prop: "sellCorporationId",
+    //   data: corporationList.value,
+    // },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "归属公司",
+        prop: "sellCorporationId",
+        "min-width": 220,
+      },
+      render(type) {
+        let text = "";
+        if (corporationList.value && corporationList.value.length > 0) {
+          let data = corporationList.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
+    },
+    {
+      attrs: {
+        label: "合同类型",
+        prop: "contractType",
+        width: 120,
+      },
+      render(type) {
+        let text = "";
+        if (contractType.value && contractType.value.length > 0) {
+          let data = contractType.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
+    },
+    {
+      attrs: {
+        label: "合同编码",
+        prop: "code",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
+        label: "客户",
+        prop: "buyCorporationId",
+        "min-width": 220,
+      },
+      render(type) {
+        let text = "";
+        if (customerList.value && customerList.value.length > 0) {
+          let data = customerList.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
+    },
+    {
+      attrs: {
+        label: "版本号",
+        prop: "version",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "合同金额",
+        slot: "amount",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "已到账金额",
+        slot: "refundMoney",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "业务员",
+        prop: "userName",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "审批状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        let text = "";
+        if (status.value && status.value.length > 0) {
+          let data = status.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "120",
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "选择",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleSelect(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      dictCode: "contract_type",
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        contractType.value = res.rows.map((item) => {
+          return {
+            label: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
+    });
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    corporationList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    customerList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+getList();
+const newContract = () => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "contract_flow",
+      flowName: "销售合同审批流程",
+    },
+  });
+};
+
+const handleSelect = (row) => {
+  proxy.$emit("handleSelectContrct", row);
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>

+ 238 - 50
src/views/salesMange/shipmentMange/packing/index.vue

@@ -18,7 +18,7 @@
           {
             text: '出货',
             disabled: selectData.length === 0,
-            action: () => openModal(),
+            action: () => openModalOne(),
           },
           {
             text: '产品装箱',
@@ -27,12 +27,24 @@
         ]"
         @get-list="getList"
       >
-        <template #fileSlot="{ item }">
-          <div
-            style="cursor: pointer; color: #409eff"
-            @click="handleClickFile(item)"
-          >
-            {{ item.fileName }}
+        <template #code="{ item }">
+          <div>
+            <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"
+            >
+              {{ item }}
+            </div>
           </div>
         </template>
       </byTable>
@@ -76,6 +88,7 @@
             @change="handleChangeContract"
             filterable
             style="width: 100%"
+            multiple
           >
             <el-option
               v-for="item in contractData"
@@ -175,10 +188,13 @@
                         :prop="'packDetailList.' + index + '.boxLong'"
                         :rules="rules.boxLong"
                       >
-                        <el-input
+                        <el-input-number
                           v-model="item.boxLong"
                           placeholder="长"
-                        ></el-input>
+                          :precision="2"
+                          :controls="false"
+                          :min="0"
+                        ></el-input-number>
                       </el-form-item>
                     </el-col>
                     <el-col :span="1" style="text-align: center"> * </el-col>
@@ -188,10 +204,13 @@
                         :prop="'packDetailList.' + index + '.boxWide'"
                         :rules="rules.boxWide"
                       >
-                        <el-input
+                        <el-input-number
                           v-model="item.boxWide"
                           placeholder="宽"
-                        ></el-input>
+                          :precision="2"
+                          :controls="false"
+                          :min="0"
+                        ></el-input-number>
                       </el-form-item>
                     </el-col>
                     <el-col :span="1" style="text-align: center"> * </el-col>
@@ -201,10 +220,13 @@
                         :prop="'packDetailList.' + index + '.boxHigh'"
                         :rules="rules.boxHigh"
                       >
-                        <el-input
+                        <el-input-number
                           v-model="item.boxHigh"
                           placeholder="高"
-                        ></el-input>
+                          :precision="2"
+                          :controls="false"
+                          :min="0"
+                        ></el-input-number>
                       </el-form-item>
                     </el-col>
                   </el-form-item>
@@ -219,8 +241,8 @@
                   v-for="(product, j) in item.packDetailProductList"
                   :key="j"
                 >
-                  <div>合同编码:{{ product.code }}</div>
-                  <div>产品名称:{{ product.name }}</div>
+                  <div>合同编码:{{ product.contractCode }}</div>
+                  <div>产品名称:{{ product.productName }}</div>
                   <div>每箱数量:{{ product.quantity }}</div>
                 </div>
               </div>
@@ -280,12 +302,7 @@
                       :rules="rules.unit"
                       :inline-message="true"
                     >
-                      <el-input-number
-                        v-model="row.unit"
-                        :precision="4"
-                        :controls="false"
-                        :min="0"
-                      />
+                      <el-input v-model="row.unit" placeholder="请输入" />
                     </el-form-item>
                   </template>
                 </el-table-column>
@@ -338,6 +355,34 @@
         </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>
+      <template #footer>
+        <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>
 </template>
   
@@ -354,6 +399,8 @@ const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
 const headers = ref({ Authorization: "Bearer " + getToken() });
 const uploadData = ref({});
 const loading = ref(false);
+const loadingOne = ref(false);
+
 const submitLoading = ref(false);
 const sourceList = ref({
   data: [],
@@ -365,6 +412,8 @@ const sourceList = ref({
   },
 });
 let dialogVisible = ref(false);
+let dialogVisibleOne = ref(false);
+
 let modalType = ref("add");
 let fileList = ref([]);
 let rules = ref({
@@ -378,7 +427,10 @@ let rules = ref({
   quantityOne: [{ required: true, message: "请输入数量", trigger: "blur" }],
   unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
   remark: [{ required: true, message: "请输入货物描述", trigger: "blur" }],
+
+  contractId: [{ required: true, message: "请选择主合同", trigger: "change" }],
 });
+
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
@@ -407,13 +459,15 @@ const config = computed(() => {
     {
       attrs: {
         label: "合同号",
-        prop: "subscribeCode",
+        prop: "codeAPName",
+        slot: "code",
       },
     },
     {
       attrs: {
         label: "产品名称",
-        prop: "subscribeCode",
+        prop: "codeAPName",
+        slot: "productName",
       },
     },
 
@@ -428,18 +482,28 @@ const config = computed(() => {
         label: "净重",
         prop: "netWeight",
       },
+      render(netWeight) {
+        return netWeight + "kg";
+      },
     },
     {
       attrs: {
         label: "毛重",
         prop: "roughWeight",
       },
+
+      render(roughWeight) {
+        return roughWeight + "kg";
+      },
     },
     {
       attrs: {
         label: "长",
         prop: "boxLong",
       },
+      render(boxLong) {
+        return boxLong + "cm";
+      },
     },
 
     {
@@ -447,27 +511,41 @@ const config = computed(() => {
         label: "宽",
         prop: "boxWide",
       },
+      render(boxWide) {
+        return boxWide + "cm";
+      },
     },
     {
       attrs: {
         label: "高",
         prop: "boxHigh",
       },
+      render(boxHigh) {
+        return boxHigh + "cm";
+      },
     },
     {
       attrs: {
         label: "总体积",
         prop: "bomVolume",
       },
+      render(bomVolume) {
+        return bomVolume + "m³";
+      },
     },
-
     {
       attrs: {
         label: "出货状态",
         prop: "shipmentStatus",
       },
       render(status) {
-        return status == 1 ? "出货" : "未出货";
+        return status == 1 ? "出货" : status == 0 ? "未出货" : "";
+      },
+    },
+    {
+      attrs: {
+        label: "出货时间",
+        prop: "shipmentTime",
       },
     },
 
@@ -534,7 +612,25 @@ const config = computed(() => {
 const formDom = ref(null);
 let formData = reactive({
   data: {},
+  dataOne: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
 });
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = reactive([
+  {
+    type: "select",
+    prop: "contractId",
+    label: "主合同",
+    required: true,
+    data: [],
+  },
+]);
 
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
@@ -543,10 +639,7 @@ const getList = async (req) => {
     .post("/packDetail/page", sourceList.value.pagination)
     .then((message) => {
       console.log(message);
-      sourceList.value.data = message.rows.map((x) => ({
-        ...x,
-        ...JSON.parse(x.victoriatouristJson),
-      }));
+      sourceList.value.data = message.rows;
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
         loading.value = false;
@@ -555,40 +648,92 @@ const getList = async (req) => {
 };
 
 const openModal = () => {
+  modalType.value = "add";
   formData.data = {
     packDetailList: [],
+    contractIds: [],
   };
   dialogVisible.value = true;
-  // handleChangeCustomer("");
+  handleChangeCustomer("");
 };
 
-const submitForm = () => {
-  console.log(formData.data, "qwdads");
+const openModalOne = () => {
+  formData.dataOne = {
+    ids: [],
+    contractId: "",
+  };
+  let ids = []; //合同id
+  let idsOne = []; //包装id
+  const list = selectData.value;
+  for (let i = 0; i < list.length; i++) {
+    const e = list[i];
+    ids = [...ids, ...e.contractIds.split(",")];
+    idsOne.push(e.id);
+  }
+  formData.dataOne.ids = idsOne;
+  proxy.post(`/contract/getByIds`, ids).then((res) => {
+    formConfig[0].data = res.map((x) => ({
+      label: x.code,
+      value: x.id,
+    }));
+    dialogVisibleOne.value = true;
+  });
+};
 
+const submitForm = () => {
   formDom.value.validate((vaild) => {
     if (vaild) {
-      console.log(formData.data, "qwdads");
       submitLoading.value = true;
-      proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
+      loadingOne.value = true;
+      for (let i = 0; i < formData.data.packDetailList.length; i++) {
+        const e = formData.data.packDetailList[i];
+        e.bomVolume = (e.boxLong * e.boxWide * e.boxHigh) / 1000000;
+      }
+      formData.data.contractIds = formData.data.contractIds.join(",");
+      proxy.post("/pack/" + modalType.value, formData.data).then(
         (res) => {
           ElMessage({
             message: modalType.value == "add" ? "添加成功" : "编辑成功",
             type: "success",
           });
-          fileList.value = [];
           dialogVisible.value = false;
           submitLoading.value = false;
+          loadingOne.value = false;
           getList();
         },
         (err) => {
-          console.log(err, "aswwwww");
           submitLoading.value = false;
+          loading.value = false;
         }
       );
     }
   });
 };
 
+const submitFormOne = () => {
+  byform.value.handleSubmit((valid) => {
+    loading.value = true;
+    submitLoading.value = true;
+    proxy.post("/packDetail/shipment", formData.dataOne).then(
+      (res) => {
+        ElMessage({
+          message: "出货成功",
+          type: "success",
+        });
+        dialogVisibleOne.value = false;
+        submitLoading.value = false;
+        loading.value = false;
+        getList();
+        selectData.value = [];
+      },
+      (err) => {
+        submitLoading.value = false;
+        loading.value = false;
+      }
+    );
+  });
+};
+
 const selectData = ref([]);
 const selectRow = (data) => {
   selectData.value = data;
@@ -609,31 +754,55 @@ const handleClickPacking = () => {
         });
       }
     }
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      for (let j = 0; j < formData.data.contractProductData.length; j++) {
+        const jele = formData.data.contractProductData[j];
+        if (e.id === jele.id && e.quantity > Number(jele.waitQuantity)) {
+          return ElMessage({
+            message: "装箱数量不可大于袋装箱数量",
+            type: "info",
+          });
+        }
+      }
+    }
     const packDetailProductList = list.map((x) => ({
-      contractId: x.id,
-      contractProductId: x.contractProductId,
+      contractCode: x.contractCode,
+      contractId: x.contractId,
+      contractProductId: x.id,
       quantity: x.quantity,
-      productId: x.contractProductId,
-      productName: "",
-      productModel: "",
-      remark: "",
+      productId: x.productId,
+      productName: x.productName,
     }));
+    const customerId = formData.data.customerId ? formData.data.customerId : "";
+    const contractIds = formData.data.contractIds
+      ? formData.data.contractIds.join(",")
+      : "";
     formData.data.packDetailList.push({
-      customerId: "",
-      contractIds: "",
+      customerId: customerId,
+      contractIds: contractIds,
       packQuantity: "",
       netWeight: "",
       roughWeight: "",
-      boxLong: "",
-      boxWide: "",
-      boxHigh: "",
+      boxLong: undefined,
+      boxWide: undefined,
+      boxHigh: undefined,
       bomVolume: "",
       remark: "",
       packDetailGoodsList: [],
       packDetailProductList: packDetailProductList,
       isShow: false,
     });
-    console.log(formData.data.packDetailList, "qsda");
+    // 减去待装箱数量
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      for (let j = 0; j < formData.data.contractProductData.length; j++) {
+        const jele = formData.data.contractProductData[j];
+        if (e.id === jele.id) {
+          formData.data.contractProductData[j].waitQuantity -= e.quantity;
+        }
+      }
+    }
   } else {
     return ElMessage({
       message: "请选择产品 !",
@@ -671,13 +840,14 @@ const handleChangeCustomer = (val) => {
     .get(`/contract/getNoPackContractByCustomerId?customerId=${val}`)
     .then((res) => {
       contractData.value = res.data;
-      formData.data.contractIds = "";
+      formData.data.contractIds = [];
     });
 };
 const handleChangeContract = (val) => {
+  const customerId = formData.data.customerId ? formData.data.customerId : "";
   proxy
     .get(
-      `/contractProduct/getNoPackContractProductById?customerId=${formData.data.customerId}&contractIds=${val}`
+      `/contractProduct/getNoPackContractProductById?customerId=${customerId}&contractIds=${val}`
     )
     .then((res) => {
       formData.data.contractProductData = res.data.map((x) => ({
@@ -686,6 +856,24 @@ const handleChangeContract = (val) => {
       }));
     });
 };
+
+const getData = (data, type) => {
+  if (!data) return [];
+  const arr = data.split(",");
+  if (arr && arr.length > 0) {
+    const arrOne = [];
+    for (let i = 0; i < arr.length; i++) {
+      const e = arr[i];
+      if (type === "code") {
+        arrOne.push(e.split("_")[0]);
+      } else if (type === "productName") {
+        arrOne.push(e.split("_")[1]);
+      }
+    }
+    return arrOne;
+  }
+  return [];
+};
 getSelectData();
 getList();
 </script>