gongchunyi
2026-09-18 4dee4cb5b31a7f1dcd2c7b3d72f74b78d2fe3f29
src/views/procurementManagement/procurementLedger/index.vue
@@ -58,6 +58,7 @@
              <el-table-column label="产品大类" prop="productCategory" />
              <el-table-column label="规格型号" prop="specificationModel" />
              <el-table-column label="单位" prop="unit" />
              <el-table-column label="件数" prop="packagingSpec" />
              <el-table-column label="入库审核状态" prop="stockInApprovalStatus" width="120">
                <template #default="scope">
                  <el-tag :type="getStockInApprovalStatusType(scope.row.stockInApprovalStatus)" size="small">
@@ -90,7 +91,7 @@
        <el-table-column label="入库状态" prop="stockInStatus" width="100" show-overflow-tooltip>
          <template #default="scope">
            <el-tag :type="getStockInStatusType(scope.row.stockInStatus)" size="small">
              {{ scope.row.stockInStatus || '--' }}
              {{ formatStockInStatus(scope.row.stockInStatus) || '--' }}
            </el-tag>
          </template>
        </el-table-column>
@@ -108,7 +109,7 @@
            <el-button link type="primary" @click="openForm('edit', scope.row)"
              :disabled="scope.row.stockInStatus === '完全入库'">编辑
            </el-button>
            <el-button link type="primary" @click="downloadOrder(scope.row.id)">下载</el-button>
            <el-button link type="primary" @click="openFileDialog(scope.row)">附件</el-button> <!--downloadOrder(scope.row.id) 下载-->
          </template>
        </el-table-column>
      </el-table>
@@ -137,7 +138,7 @@
          <el-col :span="12">
            <el-form-item label="供应商名称:" prop="supplierId">
              <el-select v-model="form.supplierId" placeholder="请选择" filterable clearable>
                <el-option v-for="item in supplierList" :key="item.id" :label="item.supplierName" :value="item.id">{{ item.supplierName + '---' + item.supplierType }}</el-option>
<el-option v-for="item in supplierList" :key="item.id" :label="item.supplierName" :value="item.id">{{ item.supplierName }}</el-option>
              </el-select>
            </el-form-item>
          </el-col>
@@ -208,6 +209,7 @@
          <el-table-column label="产品大类" prop="productCategory" />
          <el-table-column label="规格型号" prop="specificationModel" />
          <el-table-column label="单位" prop="unit" width="70" />
          <el-table-column label="件数" prop="packagingSpec" width="120" show-overflow-tooltip />
          <el-table-column label="数量" prop="quantity" width="70" />
<!--          <el-table-column label="库存预警数量" prop="warnNum" width="120" show-overflow-tooltip />-->
          <el-table-column label="税率(%)" prop="taxRate" width="80" />
@@ -277,20 +279,22 @@
      @cancel="closeProductDia">
      <el-form :model="productForm" label-width="140px" label-position="top" :rules="productRules" ref="productFormRef">
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="产品大类:" prop="productId">
              <el-tree-select v-model="productForm.productId" placeholder="请选择" clearable filterable check-strictly
                @change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
          <el-col :span="12">
            <el-form-item label="产品大类:" prop="productCategory">
              <el-input v-model="productForm.productCategory"
                        placeholder="点击选择"
                        readonly
                        @click="showProductSelectDialog = true"
                        style="cursor:pointer" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
          <el-col :span="12">
            <el-form-item label="规格型号:" prop="productModelId">
              <el-select v-model="productForm.productModelId" placeholder="请选择" filterable clearable
                @change="getProductModel">
                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
              </el-select>
              <el-input v-model="productForm.specificationModel"
                        placeholder="点击选择"
                        readonly
                        @click="showProductSelectDialog = true"
                        style="cursor:pointer" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -305,6 +309,13 @@
              <el-select v-model="productForm.taxRate" placeholder="请选择" clearable @change="mathNum">
                <el-option v-for="dict in tax_rate" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="件数:" prop="packagingSpec">
              <el-input v-model="productForm.packagingSpec"  clearable />
            </el-form-item>
          </el-col>
        </el-row>
@@ -372,6 +383,9 @@
        </el-row>-->
      </el-form>
    </FormDialog>
    <ProductSelectDialog v-model="showProductSelectDialog"
                         @confirm="handleProductSelect"
                         single />
    <FileList v-if="fileListDialogVisible" v-model:visible="fileListDialogVisible" record-type="purchase_ledger"
      :record-id="recordId" />
    <Detail ref="detailRef" />
@@ -445,6 +459,7 @@
const fileList = ref([]);
import useUserStore from "@/store/modules/user";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
import { tableAmountFormatter, formatDecimal, buildAmountSummaryFormat } from '@/utils/numberFormat';
@@ -474,11 +489,17 @@
  return typeMap[status] || "";
};
// 入库状态显示:入库中也展示为完全入库
const formatStockInStatus = status => {
  if (status === "入库中") return "完全入库";
  return status;
};
// 获取入库状态标签类型
const getStockInStatusType = status => {
  const typeMap = {
    "待入库": "info", // 待入库 - 灰色
    "入库中": "warning", // 入库中 - 橙色
    "入库中": "success", // 入库中 - 绿色
    "完全入库": "success", // 完全入库 - 绿色
  };
  return typeMap[status] || "";
@@ -648,6 +669,7 @@
// 产品表单弹框数据
const productFormVisible = ref(false);
const showProductSelectDialog = ref(false);
const productOperationType = ref("");
const productOperationIndex = ref("");
const currentId = ref("");
@@ -658,6 +680,7 @@
    productModelId: "",
    specificationModel: "",
    unit: "",
    packagingSpec: "",
    quantity: "",
    taxInclusiveUnitPrice: "",
    taxRate: "",
@@ -668,8 +691,8 @@
    isChecked: false,
  },
  productRules: {
    productId: [{ required: true, message: "请选择", trigger: "change" }],
    productModelId: [{ required: true, message: "请选择", trigger: "change" }],
    productCategory: [{ required: true, message: "请选择产品大类", trigger: "change" }],
    productModelId: [{ required: true, message: "请选择规格型号", trigger: "change" }],
    unit: [{ required: true, message: "请输入", trigger: "blur" }],
    quantity: [{ required: true, message: "请输入", trigger: "blur" }],
    taxInclusiveUnitPrice: [
@@ -1257,6 +1280,19 @@
    await nextTick();
  }
};
// ProductSelectDialog 选中回调
const handleProductSelect = (products) => {
  if (!products || !products.length) return;
  const p = products[0];
  productForm.value.productId = p.productId;
  productForm.value.productCategory = p.productName || '';
  productForm.value.productModelId = p.id;
  productForm.value.specificationModel = p.model || '';
  productForm.value.unit = p.unit || '';
  showProductSelectDialog.value = false;
};
const getProductOptions = () => {
  return productTreeList().then(res => {
    productOptions.value = convertIdToValue(res);