| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-22 22:33:52 |
| | | * @LastEditTime: 2024-07-20 21:26:24 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { isNullOrUnDef } from '/@/utils/is'; |
| | | |
| | | const { t } = useI18n(); |
| | | function _default() { |
| | | const ActionColumn: BasicColumn = { |
| | | width: 100, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: 'right', |
| | | }; |
| | | /** |
| | | * @description: 一些自定义方法 |
| | | * @return {*} |
| | | */ |
| | | const methods = { |
| | | /** |
| | | * @description: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: (fnName: string) => { |
| | | return { |
| | | action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | url: 'BAS_DEFECT/High', |
| | | params: { |
| | | CODE: '0', |
| | | ID: buildUUID(), |
| | | Name: 'BAS_DEFECT', |
| | | Title: '新增不良代码组', |
| | | // pCode: 'DFTG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one', keyName: 'BAS_DEFECT' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | if (!isNullOrUnDef(data[0])) { |
| | | data[0].onClick = DftGrpEdit.bind(null, args, params); |
| | | } |
| | | return data; |
| | | }, |
| | | /** |
| | | * @description: 弹出选择框成功返回方法 |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | GetSelectSuccess: (d, u) => { |
| | | return { |
| | | ITEM_CODE: d.values['val'], |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 弹出选择框打开方法 |
| | | * @param {Fn} openItemModal |
| | | * @return {*} |
| | | */ |
| | | OpenSelectItem: (openItemModal: Fn, ...args) => { |
| | | openItemModal(true, { |
| | | title: '物料列表', |
| | | schemas: [ |
| | | { |
| | | field: 'ITEM_CODE', |
| | | component: 'Input', |
| | | label: '物料编码', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('物料编码'), |
| | | dataIndex: 'ITEM_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('物料名称'), |
| | | dataIndex: 'ITEM_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_ITEM', |
| | | rowKey: 'ITEM_CODE', |
| | | searchInfo: { TABLE_NAME: 'BAS_ITEM' }, |
| | | }); |
| | | }, |
| | | GetUseForm: () => { |
| | | return {}; |
| | | }, |
| | | }; |
| | | |
| | | /* 以下是内部方法,不export,供上面的方法调用 */ |
| | | |
| | | /** |
| | | * @description: 自定义编辑方法 |
| | | * @param {Fn} args |
| | |
| | | CODE: params['record']['DFTG_CODE'], |
| | | ID: params['record']['ID'], |
| | | Name: 'BAS_DEFECT', |
| | | SessionName: 'BAS_DEFECT_update', |
| | | Title: `编辑不良代码组:${params['record']['DFTG_CODE']}`, |
| | | pCode: 'DFTG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one', keyName: 'BAS_DEFECT' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | args[5](`/BAS_DEFECT/High/${encodeURI(JSON.stringify(param))}`); |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${param.SessionName}_params`); |
| | | sessionStorage.setItem(`${param.SessionName}_params`, encodeURI(JSON.stringify(param))); |
| | | args[5]( |
| | | `/BAS_DEFECT/High/${encodeURI(JSON.stringify({ sName: param.SessionName, Name: param.Name }))}`, |
| | | ); |
| | | } |
| | | |
| | | const ActionColumn: BasicColumn = { |
| | | width: 100, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: 'right', |
| | | }; |
| | | |
| | | const methods = { |
| | | /** |
| | | * @description: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: () => { |
| | | return { |
| | | action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | url: 'BAS_DEFECT/High', |
| | | params: { |
| | | CODE: '0', |
| | | ID: buildUUID(), |
| | | Name: 'BAS_DEFECT', |
| | | Title: '新增不良代码组', |
| | | pCode: 'DFTG_CODE', |
| | | IsID: false, |
| | | }, |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | data[0].onClick = DftGrpEdit.bind(null, args, params); |
| | | return data; |
| | | }, |
| | | GetSelectSuccess:(d, u) => { |
| | | return { |
| | | ITEM_CODE: d.values['val'], |
| | | }; |
| | | } |
| | | }; |
| | | |
| | | return [methods, ActionColumn]; |
| | | } |