src/views/wls/stocktaking/task/data.ts
@@ -22,11 +22,7 @@
import { getRangePickerDefaultProps } from '#/utils';
import { MdItemSelect } from '#/views/mes/md/item/components';
import { StockTakingPlanSelect } from '#/views/wls/stocktaking/plan/components';
import {
  WmWarehouseAreaSelect,
  WmWarehouseLocationSelect,
  WmWarehouseSelect,
} from '#/views/wls/warehouse/components';
import { WmWarehouseSelect } from '#/views/wls/warehouse/components';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'execute' | 'submit' | 'update';
@@ -366,16 +362,6 @@
      minWidth: 120,
    },
    {
      field: 'locationName',
      title: '库区',
      minWidth: 120,
    },
    {
      field: 'areaName',
      title: '库位',
      minWidth: 120,
    },
    {
      field: 'status',
      title: '状态',
      minWidth: 100,
@@ -428,16 +414,6 @@
      minWidth: 120,
    },
    {
      field: 'locationName',
      title: '库区',
      minWidth: 120,
    },
    {
      field: 'areaName',
      title: '库位',
      minWidth: 120,
    },
    {
      field: 'quantity',
      title: '数量',
      minWidth: 120,
@@ -476,19 +452,15 @@
        onChange: async (lineId?: number) => {
          const line = taskLines.find((item) => item.id === lineId);
          await formApi?.setValues({
            areaId: line?.areaId,
            batchCode: line?.batchCode,
            batchId: line?.batchId,
            itemId: line?.itemId,
            locationId: line?.locationId,
            materialStockId: line?.materialStockId,
            warehouseId: line?.warehouseId,
          });
        },
        options: taskLines.map((line) => ({
          label: `${line.itemCode} - ${line.itemName} (${line.warehouseName}${
            line.locationName ? ` / ${line.locationName}` : ''
          }${line.areaName ? ` / ${line.areaName}` : ''})`,
          label: `${line.itemCode} - ${line.itemName} (${line.warehouseName})`,
          value: line.id,
        })),
        placeholder: '请选择盘点清单(可选)',
@@ -538,12 +510,6 @@
      label: '仓库',
      component: markRaw(WmWarehouseSelect),
      componentProps: {
        // 仓库变化时清空库区和库位
        onChange: () =>
          formApi?.setValues({
            areaId: undefined,
            locationId: undefined,
          }),
        placeholder: '请选择仓库',
      },
      rules: 'selectRequired',
@@ -551,39 +517,6 @@
      dependencies: {
        triggerFields: ['lineId'],
        disabled: (values) => values.lineId !== null,
      },
    },
    {
      fieldName: 'locationId',
      label: '库区',
      component: markRaw(WmWarehouseLocationSelect),
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['warehouseId', 'lineId'],
        show: (values) => !!values.warehouseId,
        // 选中盘点清单后,库区由清单带出且禁止改动
        disabled: (values) => values.lineId !== null,
        componentProps: (values) => ({
          onChange: () => formApi?.setFieldValue('areaId', undefined),
          placeholder: '请选择库区',
          warehouseId: values.warehouseId,
        }),
      },
    },
    {
      fieldName: 'areaId',
      label: '库位',
      component: markRaw(WmWarehouseAreaSelect),
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['locationId', 'lineId'],
        show: (values) => !!values.locationId,
        // 选中盘点清单后,库位由清单带出且禁止改动
        disabled: (values) => values.lineId !== null,
        componentProps: (values) => ({
          locationId: values.locationId,
          placeholder: '请选择库位',
        }),
      },
    },
    {