云
5 天以前 78caa769e452f63288743b8997f7b4c21bb06ce5
src/views/wls/barcode/data.ts
@@ -34,11 +34,7 @@
import { WmMaterialStockSelect } from '../materialstock/components';
import { WmPackageSelect } from '#/views/wls/packages/components';
import {
  WmWarehouseAreaSelect,
  WmWarehouseLocationSelect,
  WmWarehouseSelect,
} from '../warehouse/components';
import { WmWarehouseSelect } from '../warehouse/components';
/** 业务对象选中后回填业务编码、业务名称、条码内容 */
async function syncBizDetail(formApi: undefined | VbenFormApi, item: any) {
@@ -107,11 +103,16 @@
            bizCode: undefined,
            bizName: undefined,
            content: undefined,
            locationWarehouseId: undefined,
            areaWarehouseId: undefined,
            areaLocationId: undefined,
          }),
        options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, 'number'),
        // 不再支持按库区/库位生成条码
        options: getDictOptions(
          DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE,
          'number',
        ).filter(
          (item) =>
            item.value !== BarcodeBizTypeEnum.LOCATION &&
            item.value !== BarcodeBizTypeEnum.AREA,
        ),
        placeholder: '请选择业务类型',
      },
      rules: 'required',
@@ -127,95 +128,6 @@
      dependencies: {
        triggerFields: ['bizType'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.WAREHOUSE,
      },
      rules: 'required',
    },
    {
      fieldName: 'locationWarehouseId',
      label: '库区·仓库',
      component: markRaw(WmWarehouseSelect),
      componentProps: {
        onChange: () =>
          formApi?.setValues({
            bizId: undefined,
            bizCode: undefined,
            bizName: undefined,
            content: undefined,
          }),
        placeholder: '请选择仓库',
      },
      dependencies: {
        triggerFields: ['bizType'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.LOCATION,
      },
    },
    {
      fieldName: 'bizId',
      label: '库区',
      component: markRaw(WmWarehouseLocationSelect),
      dependencies: {
        triggerFields: ['bizType', 'locationWarehouseId'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.LOCATION,
        componentProps: (values) => ({
          onChange: (item: any) => syncBizDetail(formApi, item),
          placeholder: '请选择库区',
          warehouseId: values.locationWarehouseId,
        }),
      },
      rules: 'required',
    },
    {
      fieldName: 'areaWarehouseId',
      label: '库位·仓库',
      component: markRaw(WmWarehouseSelect),
      componentProps: {
        onChange: () =>
          formApi?.setValues({
            areaLocationId: undefined,
            bizId: undefined,
            bizCode: undefined,
            bizName: undefined,
            content: undefined,
          }),
        placeholder: '请选择仓库',
      },
      dependencies: {
        triggerFields: ['bizType'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.AREA,
      },
    },
    {
      fieldName: 'areaLocationId',
      label: '库位·库区',
      component: markRaw(WmWarehouseLocationSelect),
      dependencies: {
        triggerFields: ['bizType', 'areaWarehouseId'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.AREA,
        componentProps: (values) => ({
          onChange: () =>
            formApi?.setValues({
              bizId: undefined,
              bizCode: undefined,
              bizName: undefined,
              content: undefined,
            }),
          placeholder: '请选择库区',
          warehouseId: values.areaWarehouseId,
        }),
      },
    },
    {
      fieldName: 'bizId',
      label: '库位',
      component: markRaw(WmWarehouseAreaSelect),
      dependencies: {
        triggerFields: ['bizType', 'areaLocationId'],
        show: (values) => values.bizType === BarcodeBizTypeEnum.AREA,
        componentProps: (values) => ({
          locationId: values.areaLocationId,
          onChange: (item: any) => syncBizDetail(formApi, item),
          placeholder: '请选择库位',
        }),
      },
      rules: 'required',
    },