yyb
10 天以前 53e7b5182e230c225282f6753ba692ddf9a5e1aa
src/views/salesManagement/salesLedger/index.vue
@@ -66,8 +66,10 @@
                       :value="2" />
            <el-option label="审批失败"
                       :value="3" />
            <el-option label="已发货"
            <el-option label="审批通过"
                       :value="4" />
            <el-option label="已发货"
                       :value="5" />
          </el-select>
        </el-form-item>
        <el-form-item label="入库状态:">
@@ -118,8 +120,8 @@
            </el-button>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item command="notShipped">未发货</el-dropdown-item>
                <el-dropdown-item command="shipped">已发货</el-dropdown-item>
                <el-dropdown-item command="notShipped">未出库</el-dropdown-item>
                <el-dropdown-item command="shipped">已出库</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
@@ -158,7 +160,7 @@
                style="width: 100%"
                :summary-method="summarizeMainTable"
                @expand-change="expandChange"
                height="calc(100vh - 18.5em)">
                height="calc(100vh - 22em)">
        <el-table-column align="center"
                         type="selection"
                         width="55"
@@ -238,6 +240,8 @@
                <template #default="scope">
                  <el-tag v-if="scope.row.approveStatus === 1 && (!scope.row.shippingDate || !scope.row.shippingCarNumber)"
                          type="success">充足</el-tag>
                  <el-tag v-else-if="scope.row.approveStatus === 1 && scope.row.shippingDate && scope.row.shippingCarNumber"
                          type="success">已出库</el-tag>
                  <el-tag v-else-if="scope.row.approveStatus === 0 && (scope.row.shippingDate || scope.row.shippingCarNumber)"
                          type="success">已出库</el-tag>
                  <el-tag v-else
@@ -383,6 +387,8 @@
                    type="success">部分入库</el-tag>
            <el-tag v-else-if="Number(scope.row.stockStatus) === 2"
                    type="success">已入库</el-tag>
            <el-tag v-else-if="Number(scope.row.stockStatus) === 3"
                    type="warning">审批中</el-tag>
            <el-tag v-else
                    type="info">-</el-tag>
          </template>
@@ -658,6 +664,36 @@
              <span v-else>{{ scope.row.thickness ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="楼层编号"
                           prop="floorCode"
                           min-width="250"
                           show-overflow-tooltip>
            <template #default="scope">
              <el-input v-if="scope.row.__editing"
                        v-model="scope.row.floorCode"
                        placeholder="请输入"
                        clearable
                        style="width: 100%" />
              <span v-else>{{ scope.row.floorCode ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="含税单价(元)"
                           prop="taxInclusiveUnitPrice"
                           min-width="160">
            <template #default="scope">
              <el-input-number v-if="scope.row.__editing"
                               :step="0.01"
                               :min="0"
                               :precision="2"
                               style="width: 100%"
                               v-model="scope.row.taxInclusiveUnitPrice"
                               placeholder="请输入"
                               clearable
                               @change="() => handleInlineUnitPriceChange(scope.row)"
                               @input="() => handleInlineUnitPriceChange(scope.row)" />
              <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="宽(mm)"
                           prop="width"
                           min-width="160">
@@ -694,23 +730,6 @@
              <span v-else>{{ scope.row.height ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="结算单片面积(㎡)"
                           prop="settlePieceArea"
                           min-width="200">
            <template #default="scope">
              <el-input-number v-if="scope.row.__editing"
                               controls-position="right"
                               v-model="scope.row.settlePieceArea"
                               :min="0"
                               :step="1"
                               :precision="4"
                               style="width: 100%"
                               placeholder="请输入"
                               clearable
                               @change="() => handleInlineSettleAreaChange(scope.row)" />
              <span v-else>{{ scope.row.settlePieceArea ? Number(scope.row.settlePieceArea).toFixed(4) : "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="数量"
                           prop="quantity"
                           min-width="150">
@@ -729,6 +748,23 @@
              <span v-else>{{ scope.row.quantity ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="结算单片面积(㎡)"
                           prop="settlePieceArea"
                           min-width="200">
            <template #default="scope">
              <el-input-number v-if="scope.row.__editing"
                               controls-position="right"
                               v-model="scope.row.settlePieceArea"
                               :min="0"
                               :step="1"
                               :precision="4"
                               style="width: 100%"
                               placeholder="请输入"
                               clearable
                               @change="() => handleInlineSettleAreaChange(scope.row)" />
              <span v-else>{{ scope.row.settlePieceArea ? Number(scope.row.settlePieceArea).toFixed(4) : "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="面积(m²)"
                           prop="actualTotalArea"
                           min-width="200">
@@ -742,23 +778,6 @@
                               style="width: 100%"
                               placeholder="自动计算" />
              <span v-else>{{ scope.row.actualTotalArea ? Number(scope.row.actualTotalArea).toFixed(4) : "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="含税单价(元)"
                           prop="taxInclusiveUnitPrice"
                           min-width="160">
            <template #default="scope">
              <el-input-number v-if="scope.row.__editing"
                               :step="0.01"
                               :min="0"
                               :precision="2"
                               style="width: 100%"
                               v-model="scope.row.taxInclusiveUnitPrice"
                               placeholder="请输入"
                               clearable
                               @change="() => handleInlineUnitPriceChange(scope.row)"
                               @input="() => handleInlineUnitPriceChange(scope.row)" />
              <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="税率(%)"
@@ -793,6 +812,19 @@
                           prop="taxExclusiveTotalPrice"
                           :formatter="formattedNumber"
                           min-width="120" />
          <el-table-column label="加工要求"
                           prop="processRequirement"
                           min-width="160"
                           show-overflow-tooltip>
            <template #default="scope">
              <el-input v-if="scope.row.__editing"
                        v-model="scope.row.processRequirement"
                        placeholder="请输入"
                        clearable
                        style="width: 100%" />
              <span v-else>{{ scope.row.processRequirement ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="发票类型"
                           prop="invoiceType"
                           min-width="120">
@@ -810,19 +842,6 @@
              <span v-else>{{ scope.row.invoiceType ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="加工要求"
                           prop="processRequirement"
                           min-width="160"
                           show-overflow-tooltip>
            <template #default="scope">
              <el-input v-if="scope.row.__editing"
                        v-model="scope.row.processRequirement"
                        placeholder="请输入"
                        clearable
                        style="width: 100%" />
              <span v-else>{{ scope.row.processRequirement ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备注"
                           prop="remark"
                           min-width="140"
@@ -834,19 +853,6 @@
                        clearable
                        style="width: 100%" />
              <span v-else>{{ scope.row.remark ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="楼层编号"
                           prop="floorCode"
                           min-width="250"
                           show-overflow-tooltip>
            <template #default="scope">
              <el-input v-if="scope.row.__editing"
                        v-model="scope.row.floorCode"
                        placeholder="请输入"
                        clearable
                        style="width: 100%" />
              <span v-else>{{ scope.row.floorCode ?? "" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="重箱"
@@ -2212,10 +2218,17 @@
      row.thickness !== null && row.thickness !== undefined && row.thickness !== ""
        ? Number(row.thickness)
        : null;
    copied.floorCode = row?.floorCode ?? row?.floor_code ?? "";
    // 复制新建仅带出产品大类与规格型号,其他数字字段全部留空,避免出现 0.00
    const srcUnit = row?.taxInclusiveUnitPrice;
    const unitNum =
      srcUnit !== null && srcUnit !== undefined && srcUnit !== ""
        ? Number(srcUnit)
        : NaN;
    copied.taxInclusiveUnitPrice = Number.isFinite(unitNum) ? unitNum : null;
    // 复制新建带出:产品大类、规格型号、厚度、楼层编号、单价;其余数量/面积/总价等留空,避免出现 0.00
    copied.quantity = null;
    copied.taxInclusiveUnitPrice = null;
    copied.taxInclusiveTotalPrice = null;
    copied.taxExclusiveTotalPrice = null;
    copied.width = null;
@@ -2908,7 +2921,15 @@
    notShipped: "/sales/ledger/salesHistory/notShippingImport",
    shipped: "/sales/ledger/salesHistory/shippingImport",
  };
  const HISTORY_IMPORT_TEMPLATE_URL_MAP = {
    notShipped: "/sales/ledger/salesHistory/notShippingImportTemplate",
    shipped: "/sales/ledger/salesHistory/shippingImportTemplate",
  };
  const HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP = {
    notShipped: "销售发货历史数据导入模板-未发货.xlsx",
    shipped: "销售发货历史数据导入模板-已发货.xlsx",
  };
  const currentImportCommand = ref("default");
  const changeDaterange = value => {
    if (value) {
      searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
@@ -3875,18 +3896,29 @@
  };
  // 导入
  const handleImport = () => {
    currentImportCommand.value = "default";
    openImportDialog("导入销售台账", "/sales/ledger/import");
  };
  // 历史迁移
  const handleHistoryImportCommand = command => {
    const url = HISTORY_IMPORT_URL_MAP[command];
    if (!url) return;
    const title = command === "shipped" ? "历史迁移-已发货" : "历史迁移-未发货";
    currentImportCommand.value = command;
    const title = command === "shipped" ? "历史迁移-已出库" : "历史迁移-未出库";
    openImportDialog(title, url);
  };
  // 下载导入模板
  const downloadTemplate = () => {
    const command = currentImportCommand.value;
    if (command && command !== "default") {
      const templateUrl = HISTORY_IMPORT_TEMPLATE_URL_MAP[command];
      const fileName = HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP[command];
      if (templateUrl) {
        proxy.download(templateUrl, {}, fileName || "销售发货历史数据导入模板.xlsx");
        return;
      }
    }
    proxy.download("/sales/ledger/exportTemplate", {}, "销售台账导入模板.xlsx");
  };
  const onClose = () => {