Ben Lin
2024-06-09 2060cb1aec383655dc0e8ee7ecf31e044b4e52a3
src/views/components/bizMesWo.ts
@@ -1,12 +1,14 @@
import { FunctionType } from '/@/api/tigerapi/model/systemModel';
import { SaveEntity, getEntity } from '/@/api/tigerapi/system';
import { GetEnum, SaveEntity, getEntity } from '/@/api/tigerapi/system';
import { FormSchema } from '/@/components/Table';
import { useUserStore } from '/@/store/modules/user';
import { useI18n } from '/@/hooks/web/useI18n';
import { uploadApi } from '/@/api/sys/upload';
import { notification } from 'ant-design-vue';
import { useLocale } from '/@/locales/useLocale';
import { unref } from 'vue';
const { t } = useI18n();
const { getLocale } = useLocale();
export const getFns: Record<string, FunctionType> = {
  handleSubmit: async (e, ...args) => {
@@ -40,57 +42,74 @@
export const woCfgformSchema: FormSchema[] = [
  {
    field: 'field1',
    field: 'ORDER_NO',
    component: 'Input',
    label: '字段1',
    label: '工单号',
    colProps: {
      span: 8,
    },
    componentProps: {
      placeholder: '自定义placeholder',
      placeholder: '请输入工单号',
      onChange: (e: any) => {
        console.log(e);
      },
    },
    dynamicDisabled: true,
  },
  {
    field: 'field2',
    field: 'ORDER_TYPE',
    component: 'Select',
    label: '工单类型',
    colProps: {
      span: 8,
    },
    defaultValue: 'Normal',
    componentProps: {
      options: [
        {
          label: '正常',
          value: 'Normal',
        },
        {
          label: '返工',
          value: 'Rework',
        },
      ],
    },
    dynamicDisabled: true,
  },
  {
    field: 'PLAN_QTY',
    component: 'Input',
    label: '字段2',
    label: '计划数量',
    colProps: {
      span: 8,
    },
  },
  {
    field: 'field3',
    component: 'DatePicker',
    label: '字段3',
    colProps: {
      span: 8,
    },
    dynamicDisabled: true,
  },
];
export const prodCfgformSchema: FormSchema[] = [
  {
    field: 'field4',
    field: 'ITEM_CODE',
    component: 'Input',
    label: '字段1',
    label: '物料编码',
    required: true,
    colProps: {
      span: 8,
    },
    componentProps: {
      placeholder: '自定义placeholder',
      placeholder: '请输入物料编码',
      onChange: (e: any) => {
        console.log(e);
      },
    },
    dynamicDisabled: true,
  },
  {
    field: 'field5',
    field: 'ITEM_TYPE',
    component: 'Input',
    label: '字段2',
    label: '物料类型',
    colProps: {
      span: 8,
    },
@@ -104,17 +123,32 @@
    },
  },
  {
    field: 'field7',
    label: '工艺路线',
    field: 'ROUTE_CODE',
    component: 'Input',
    label: '字段4',
    required: true,
    colProps: {
      span: 8,
      span: 12,
    },
    componentProps: {
      placeholder: '自定义placeholder',
      onChange: (e: any) => {
        console.log(e);
      },
  },
  {
    field: 'addRot',
    component: 'Input',
    label: '1',
    colSlot: 'addRot',
    defaultValue: 'MES_ROUTE',
    colProps: {
      span: 1,
    },
  },
  {
    field: 'setRot',
    component: 'Input',
    label: '1',
    colSlot: 'setRot',
    defaultValue: 'MES_ROUTE',
    colProps: {
      span: 1,
    },
  },
  {
@@ -122,15 +156,7 @@
    component: 'Input',
    label: '字段5',
    colProps: {
      span: 8,
    },
  },
  {
    field: 'field9',
    component: 'DatePicker',
    label: '字段6',
    colProps: {
      span: 8,
      span: 10,
    },
  },
];
@@ -151,11 +177,21 @@
    },
  },
  {
    field: 'field11',
    field: 'ROUTE_CODE',
    component: 'Input',
    label: '字段2',
    colProps: {
      span: 8,
    },
  },
  {
    field: 'add',
    component: 'Input',
    label: '1',
    colSlot: 'add',
    defaultValue: 'MES_ROUTE',
    colProps: {
      span: 1,
    },
  },
  {
@@ -245,10 +281,12 @@
  };
}
export function woCustFn(openItemModal: Fn, slotName: string, others: Fn[], ...args) {
/* 自定义模态框打开方法 */
export function woCustFn(openModal: Fn, slotName: string, others: Fn[], ...args) {
  switch (slotName) {
    case 'add':
      openItemModal(true, {
    case 'addRot':
      openModal(true, {
        title: '工艺路线列表',
        schemas: [
          {
@@ -282,12 +320,13 @@
      });
      break;
    case 'set':
    case 'setRot':
      //   notification.success({
      //     message: '点击了设置按钮',
      //     description: `OK`,
      //     duration: 3,
      //   });
      others[0](true, { rotId: args[0][0], slotName: 'set' });
      others[0](true, { rotId: args[0][0], slotName: slotName });
      break;
    default:
      () => {};