云
10 小时以前 fb4db4ae9b6a7f113ba049f6789e6916c0dcc276
src/views/mes/pro/batch/data.ts
@@ -18,12 +18,16 @@
export interface PalletOption {
  label: string;
  value: number;
  itemId?: number;
  itemName?: string;
  itemCode?: string;
}
/** 新增/修改的表单 */
export function useFormSchema(
  formType: FormType,
  palletOptions: PalletOption[] = [],
  onPalletChange?: (ids: number[]) => void,
): VbenFormSchema[] {
  const disabled = formType === 'detail';
  return [
@@ -132,6 +136,18 @@
      rules: 'selectRequired',
    },
    {
      fieldName: 'itemId', component: 'Input',
      dependencies: { triggerFields: [''], show: () => false },
    },
    {
      fieldName: 'itemName', label: '品种名称', component: 'Input',
      componentProps: { disabled: true, placeholder: '选择托盘后自动带入' },
    },
    {
      fieldName: 'itemCode', label: '品种编码', component: 'Input',
      componentProps: { disabled: true, placeholder: '选择托盘后自动带入' },
    },
    {
      fieldName: 'palletIds',
      label: '绑定托盘',
      component: 'Select',
@@ -139,17 +155,25 @@
        allowClear: true,
        disabled,
        maxTagCount: 3,
        dropdownMatchSelectWidth: false,
        dropdownStyle: { minWidth: '360px', maxWidth: 'calc(100vw - 32px)' },
        mode: 'multiple',
        optionFilterProp: 'label',
        options: palletOptions,
        placeholder: '请选择托盘(可不选)',
        onChange: onPalletChange,
        placeholder: '请选择相同品种的托盘',
        showSearch: true,
      },
      dependencies: {
        triggerFields: [''],
        triggerFields: ['itemId'],
        show: () => formType !== 'detail',
        componentProps: (values) => ({
          options: palletOptions.map(option => ({ ...option,
            disabled: !option.itemId || (!!values.itemId && option.itemId !== values.itemId),
          })),
        }),
      },
      help: '绑定后批次直接进入生产中:托盘生成正式托盘码,托盘下未录批次的袋码自动级联录入本批次(袋码品种须一致);编辑时仅需勾选新增托盘,已绑定的不可解绑',
      help: '只能绑定相同品种的托盘,品种信息自动带入;缺少品种的托盘请先装袋。绑定后批次直接进入生产中:托盘生成正式托盘码,托盘下未录批次的袋码自动级联录入本批次(袋码品种须一致);编辑时仅需勾选新增托盘,已绑定的不可解绑',
    },
    {
      fieldName: 'remark',
@@ -168,6 +192,7 @@
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    { fieldName: 'businessCode', label: '业务码', component: 'Input', componentProps: { allowClear: true, placeholder: '请输入作业扫码业务码' } },
    {
      fieldName: 'code',
      label: '批次号',
@@ -237,6 +262,7 @@
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<MesProBatchApi.Batch>['columns'] {
  return [
    { field: 'businessCode', title: '业务码(作业扫码)', minWidth: 210 },
    {
      field: 'code',
      title: '批次号',
@@ -244,6 +270,8 @@
      minWidth: 200,
      slots: { default: 'code' },
    },
    { field: 'itemName', title: '品种名称', minWidth: 150 },
    { field: 'itemCode', title: '品种编码', minWidth: 150 },
    {
      field: 'lineName',
      title: '加工单位',