xiaoyi
19 小时以前 f8bc8d5d87ab015272b64f9a1e997a4182203c44
完善物料颜色维护与选择
已修改5个文件
44 ■■■■■ 文件已修改
src/api/mdm/item/index.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/components/data.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/components/select.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/data.ts 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/modules/form.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mdm/item/index.ts
@@ -10,6 +10,7 @@
    name: string;
    barCode?: string;
    specification?: string;
    color?: string; // 颜色
    categoryId?: number;
    categoryName?: string;
    unitMeasureId?: number;
@@ -56,6 +57,7 @@
  export interface PageParams extends PageParam {
    code?: string;
    name?: string;
    color?: string; // 颜色(模糊匹配)
    categoryId?: number;
    itemType?: number;
    status?: number;
src/views/basicData/mdm/components/data.ts
@@ -29,6 +29,12 @@
      },
    },
    {
      fieldName: 'color',
      label: '颜色',
      component: 'Input',
      componentProps: { allowClear: true, placeholder: '请输入颜色' },
    },
    {
      fieldName: 'categoryId',
      label: '物料分类',
      component: 'ApiSelect',
@@ -80,6 +86,12 @@
      align: 'left',
    },
    {
      field: 'color',
      title: '颜色',
      minWidth: 100,
      align: 'left',
    },
    {
      field: 'categoryId',
      title: '物料分类',
      minWidth: 120,
src/views/basicData/mdm/components/select.vue
@@ -38,7 +38,9 @@
const hovering = ref(false); // 是否悬停
const selectedItem = ref<MdmItemApi.Item>(); // 当前选中物料
const displayLabel = computed(() => selectedItem.value?.name ?? props.label ?? ''); // 选择器展示名称
const displayLabel = computed(() => selectedItem.value
  ? [selectedItem.value.name, selectedItem.value.specification, selectedItem.value.color].filter(Boolean).join(' ')
  : props.label ?? '');
const showClear = computed(
  () =>
    props.allowClear &&
@@ -118,6 +120,7 @@
          <div>编码:{{ selectedItem.code || '-' }}</div>
          <div>名称:{{ selectedItem.name || '-' }}</div>
          <div>规格:{{ selectedItem.specification || '-' }}</div>
          <div>颜色:{{ selectedItem.color || '-' }}</div>
          <div>单位:{{ selectedItem.unitMeasureName || '-' }}</div>
        </div>
      </template>
src/views/basicData/mdm/data.ts
@@ -147,6 +147,15 @@
      },
    },
    {
      component: "Input",
      fieldName: "color",
      label: "颜色",
      componentProps: {
        placeholder: "如:红色、金EF6F45",
        allowClear: true,
      },
    },
    {
      component: "ApiSelect",
      fieldName: "unitMeasureId",
      label: "计量单位",
@@ -521,6 +530,15 @@
      },
    },
    {
      fieldName: "color",
      label: "颜色",
      component: "Input",
      componentProps: {
        placeholder: "请输入颜色(模糊匹配)",
        allowClear: true,
      },
    },
    {
      fieldName: "status",
      label: "状态",
      component: "Select",
@@ -553,6 +571,11 @@
      minWidth: 150,
    },
    {
      field: "color",
      title: "颜色",
      width: 120,
    },
    {
      field: "categoryName",
      title: "物料分类",
      minWidth: 120,
src/views/basicData/mdm/modules/form.vue
@@ -77,6 +77,8 @@
      // 新增模式
      formData.value = undefined;
      await formApi.resetForm();
      // 动态设置 schema 后 resetForm 不会自动带入字段默认值。
      await formApi.setValues({ isBatchManaged: false, syncMes: true, status: 0 });
    }
  },
});