spring
2026-10-08 e0fc86fda41a8777a0cec5a9de7aa9f1474f5dc8
src/pages/production/twist/receive/plate/form.vue
@@ -13,11 +13,11 @@
      />
      <wd-input
        v-model="model.model"
        label="尺寸"
        label="规格型号"
        label-width="100px"
        prop="model"
        clearable
        placeholder="请输入尺寸"
        placeholder="请输入规格型号"
      />
      <wd-input
        v-model="model.amount"
@@ -36,16 +36,6 @@
        placeholder="请选择单位"
        clearable
        @confirm="handleUnitChange"
      />
      <wd-picker
        v-model="model.supplier"
        :columns="supplierOptions"
        label="厂家"
        label-width="100px"
        prop="supplier"
        placeholder="请选择厂家"
        clearable
        @confirm="handleSupplierChange"
      />
    </wd-cell-group>
    <wd-toast />
@@ -78,7 +68,6 @@
  model: undefined, // 尺寸
  amount: undefined, // 数量
  unit: "只", // 单位,默认值为"只"
  supplier: undefined,
  type: "盘具",
});
@@ -92,9 +81,6 @@
// 单位字典数据
const unitOptions = ref<Array<{ label: string; value: string }>>([]);
// 厂家字典数据
const supplierOptions = ref<Array<{ label: string; value: string }>>([]);
// 加载盘具类型字典数据
const loadDiskMaterialDict = async () => {
@@ -133,21 +119,6 @@
  }
};
// 加载厂家字典数据
const loadSupplierDict = async () => {
  try {
    const res = await ManageApi.dictAPI("reel_factory");
    if (res.data && Array.isArray(res.data)) {
      supplierOptions.value = res.data.map((item: any) => ({
        label: item.dictLabel || "",
        value: item.dictValue || "",
      }));
    }
  } catch (error) {
    // 加载字典失败,静默处理
  }
};
// 处理盘具类型选择
const handleDiskMaterialChange = (val: any) => {
  model.diskMaterial = val.value;
@@ -156,11 +127,6 @@
// 处理单位选择
const handleUnitChange = (val: any) => {
  model.unit = val.value;
};
// 处理厂家选择
const handleSupplierChange = (val: any) => {
  model.supplier = val.value;
};
// 监听 model.diskMaterial 变化,同步选择器显示
@@ -200,14 +166,13 @@
  // 更新列表中对应的数据项
  const updatedList = currentList.map((item) => {
    if (item.id === currentId) {
      // 保留原有数据,然后更新修改的字段
      // 保留原有数据(含厂家等历史字段),只更新可编辑字段
      const updatedItem = {
        ...item, // 先保留原有的所有数据
        ...item,
        diskMaterial: model.diskMaterial,
        model: model.model,
        amount: model.amount,
        unit: model.unit,
        supplier: model.supplier,
        type: model.type,
      };
      return updatedItem;
@@ -244,7 +209,6 @@
    model.model = currentItem.model;
    model.amount = currentItem.amount;
    model.unit = currentItem.unit || "只";
    model.supplier = currentItem.supplier;
    model.type = currentItem.type || "盘具";
    // 设置盘具类型的回显值
    diskMaterialValue.value = currentItem.diskMaterial || "";
@@ -258,7 +222,6 @@
onMounted(async () => {
  await loadDiskMaterialDict();
  await loadUnitDict();
  await loadSupplierDict();
});
// 监听编辑数据变化,自动回显
@@ -270,7 +233,6 @@
      model.model = newData.model || "";
      model.amount = newData.amount || "";
      model.unit = newData.unit || "只";
      model.supplier = newData.supplier || "";
      model.type = newData.type || "盘具";
      diskMaterialValue.value = newData.diskMaterial || "";
    }
@@ -284,7 +246,6 @@
  model.model = undefined;
  model.amount = undefined;
  model.unit = "只";
  model.supplier = undefined;
  model.type = "盘具";
  diskMaterialValue.value = "";
};