zhangwencui
2026-06-18 9f5e18cc415cd3fef13f105ffeabae3c01ba9665
src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -97,6 +97,11 @@
                {{ getShippingStatusText(row) }}
              </el-tag>
            </template>
            <template #quantity="{ row }">
              <el-input-number v-model="row.quantity"
                               :min="0"
                               size="small" />
            </template>
          </PIMTable>
        </div>
      </div>
@@ -147,6 +152,7 @@
      salesContractNo: "",
      proDesc: "",
      customerName: "",
      productModelQuantities: "",
    },
    rules: {
      customerName: [
@@ -240,25 +246,12 @@
      align: "center",
    },
    { label: "发货日期", prop: "shippingDate", minWidth: 100, align: "center" },
    { label: "数量", prop: "quantity", width: 100 },
    { label: "税率(%)", prop: "taxRate", width: 100 },
    {
      label: "含税单价(元)",
      prop: "taxInclusiveUnitPrice",
      width: 160,
      formatData: formatCurrency,
    },
    {
      label: "含税总价(元)",
      prop: "taxInclusiveTotalPrice",
      width: 160,
      formatData: formatCurrency,
    },
    {
      label: "不含税总价(元)",
      prop: "taxExclusiveTotalPrice",
      width: 160,
      formatData: formatCurrency,
      label: "数量",
      prop: "quantity",
      width: 140,
      dataType: "slot",
      slot: "quantity",
    },
    {
      dataType: "action",
@@ -326,7 +319,7 @@
      form.value.customerId = null;
    }
    getSalesLedger({
      customerName: form.value.customerName,
      customerId: form.value.customerId,
    }).then(res => {
      if (res.code === 200) {
        associatedSalesOrderNumberOptions.value = res.data.records.map(item => ({
@@ -434,7 +427,7 @@
      form.value = { ...row };
      if (form.value.customerName) {
        const res = await getSalesLedger({
          customerName: form.value.customerName,
          customerId: form.value.customerId,
        });
        if (res?.code === 200) {
          console.log(res);
@@ -446,6 +439,31 @@
              id: item.id,
            })
          );
          const opt = associatedSalesOrderNumberOptions.value.find(
            item => item.value === form.value.salesContractNo
          );
          if (opt) {
            let restoredData = (opt.productData || []).map(normalizeProductRow);
            const selectedIds = form.value.productModelIds
              ? String(form.value.productModelIds).split(",")
              : [];
            const quantities = form.value.productModelQuantities
              ? String(form.value.productModelQuantities).split(",")
              : [];
            tableData.value = restoredData
              .filter(item => selectedIds.includes(String(item.id)))
              .map(item => {
                let qIndex = selectedIds.indexOf(String(item.id));
                if (
                  qIndex !== -1 &&
                  qIndex < quantities.length &&
                  quantities[qIndex] !== ""
                ) {
                  item.quantity = Number(quantities[qIndex]);
                }
                return item;
              });
          }
        }
      }
      console.log(form.value);
@@ -457,6 +475,9 @@
        // 匹配产品型号IDs
        form.value.productModelIds = tableData.value
          .map(item => item.id)
          .join(",");
        form.value.productModelQuantities = tableData.value
          .map(item => item.quantity || 0)
          .join(",");
        if (operationType.value === "add") {
          afterSalesServiceAdd(form.value).then(response => {
@@ -501,7 +522,7 @@
    transform: translateY(-50%);
    width: 4px;
    height: 1rem;
    background-color: #002fa7; /* Element 默认红色 */
    background-color: #8b5cf6; /* Element 默认红色 */
    border-radius: 2px;
  }
</style>