| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-29 23:38:12 |
| | | * @LastEditTime: 2024-08-20 15:03:44 |
| | | */ |
| | | |
| | | import { DeleteLabelTemplate } from '/@/api/tigerapi/mes/label'; |
| | | import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { useWebSocketStore } from '/@/store/modules/websocket'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const { t } = useI18n(); |
| | | function _default() { |
| | | const ActionColumn: BasicColumn = { |
| | | width: 120, |
| | |
| | | * @description: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: (type: string) => { |
| | | CreateAction: (type: string, ...args) => { |
| | | return { |
| | | action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) | edit(如果是表格可编辑页面就是自定义方法) |
| | | url: 'BAS_LABEL_VAR/High', |
| | | params: { |
| | | CODE: '0', |
| | | ID: buildUUID(), |
| | | Name: 'BAS_LABEL_VAR', //实体名 |
| | | Title: '新增模板', //标题 |
| | | pCode: 'LABEL_CODE', //主信息关键字段CODE |
| | | IsID: true, //是否带过去侧边框的是ID,false就是CODE,true是ID |
| | | colSlots: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'], |
| | | drawers: [ |
| | | { |
| | | name: 'BAS_LABEL_VAR', //实体名 |
| | | code: 'LABEL_ID', //传递过去高级表单页面的关键字段名 |
| | | type: 'one', //one-表示需要code的一个值,默认是这个 |
| | | keyName: 'BAS_LABEL_VAR', //关键表名(实体名) |
| | | order: 'VAR_NAME', //排序 |
| | | showTbButton: false, //是否显示工具栏按钮 |
| | | FnName: '', //自定义方法名 |
| | | }, |
| | | { |
| | | name: 'BAS_LABEL_VAR_WO', //实体名 |
| | | code: 'LABEL_ID', //传递过去高级表单页面的关键字段名 |
| | | type: 'one', //all-表示需要code的所有的值 |
| | | keyName: 'BAS_LABEL_VAR_WO', //关键表名(实体名) |
| | | order: '', |
| | | showTbButton: true, //是否显示工具栏按钮 |
| | | FnName: 'AddRow', //自定义方法名 |
| | | }, |
| | | ], //drawers是右边弹出增改侧框的名字列表,及按钮的执行方法 |
| | | }, |
| | | action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | }; |
| | | // const colSlots = args[0]; |
| | | // return { |
| | | // action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) | edit(如果是表格可编辑页面就是自定义方法) |
| | | // url: 'BAS_LABEL_VAR/High', |
| | | // params: { |
| | | // CODE: '0', |
| | | // ID: buildUUID(), |
| | | // Name: 'BAS_LABEL_VAR', //实体名 |
| | | // Title: '新增模板', //标题 |
| | | // pCode: 'LABEL_CODE', //主信息关键字段CODE |
| | | // IsID: true, //是否带过去侧边框的是ID,false就是CODE,true是ID |
| | | // colSlots: colSlots, |
| | | // colSlotsInHigh: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'], |
| | | // drawers: [ |
| | | // { |
| | | // name: 'BAS_LABEL_VAR', //实体名 |
| | | // code: 'LABEL_ID', //传递过去高级表单页面的关键字段名 |
| | | // type: 'one', //one-表示需要code的一个值,默认是这个 |
| | | // keyName: 'BAS_LABEL_VAR', //关键表名(实体名) |
| | | // order: 'VAR_NAME', //排序 |
| | | // showTbButton: false, //是否显示工具栏按钮 |
| | | // FnName: '', //自定义方法名 |
| | | // }, |
| | | // { |
| | | // name: 'BAS_LABEL_VAR_WO', //实体名 |
| | | // code: 'LABEL_ID', //传递过去高级表单页面的关键字段名 |
| | | // type: 'one', //all-表示需要code的所有的值 |
| | | // keyName: 'BAS_LABEL_VAR_WO', //关键表名(实体名) |
| | | // order: '', |
| | | // showTbButton: true, //是否显示工具栏按钮 |
| | | // FnName: 'AddRow', //自定义方法名 |
| | | // }, |
| | | // ], //drawers是右边弹出增改侧框的名字列表,及按钮的执行方法 |
| | | // }, |
| | | // }; |
| | | }, |
| | | /** |
| | | * @description: 操作字段自定义按钮 |
| | |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | data.map((x) => { |
| | | if (x.name == 'Edit') { |
| | | if (x.name == 'goDetail') { |
| | | x.onClick = goDetail.bind(null, args[5], params); |
| | | x.tooltip = '模板变量'; |
| | | } |
| | | if (x.name == 'Delete') { |
| | | x.popConfirm.confirm = Del.bind(null, args, params); |
| | | x.tooltip = '删除'; |
| | | } |
| | | }); |
| | | return data; |
| | |
| | | */ |
| | | CustFunc: (param: CustModalParams) => { |
| | | const webSocketStore = useWebSocketStore(); |
| | | if (webSocketStore.GetSocketState == 1) { |
| | | if (webSocketStore.GetSocketState == 1 && param.values['TEMP_TYPE'] == 0) { |
| | | webSocketStore.sendMessage( |
| | | `wsSubStrings ${param.values['ID']}_#_${param.values['TEMP_PATH']}`, |
| | | ); |
| | | } |
| | | }, |
| | | /** |
| | | * @description: 选择过程变量弹出选择框成功返回赋值方法 |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | GetSelectSuccess: (d, u) => { |
| | | return { |
| | | LABEL_CODE: d.values['val'], |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 打开客户弹出选择框 |
| | | * @param {Fn} openItemModal |
| | | * @param {array} args |
| | | * @return {*} |
| | | */ |
| | | OpenSelectItem: (openItemModal: Fn, ...args) => { |
| | | openItemModal(true, { |
| | | title: '打印模板列表', |
| | | schemas: [ |
| | | { |
| | | field: 'LABEL_CODE', |
| | | component: 'Input', |
| | | label: '模板编码', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('模板编码'), |
| | | dataIndex: 'LABEL_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('模板名称'), |
| | | dataIndex: 'LABEL_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_LABEL_TEMP', |
| | | rowKey: 'LABEL_CODE', |
| | | searchInfo: { TABLE_NAME: 'BAS_LABEL_TEMP' }, |
| | | }); |
| | | }, |
| | | }; |
| | | |
| | |
| | | Title: `编辑模板${params['record']['LABEL_CODE']}的变量`, |
| | | pCode: 'LABEL_CODE', |
| | | IsID: true, |
| | | colSlots: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'], |
| | | ifSave: false, |
| | | colSlots: params['colSlots'].value, //['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'], |
| | | colSlotsInHigh: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'], |
| | | drawers: [ |
| | | { |
| | | name: 'BAS_LABEL_VAR', |
| | |
| | | type: 'one', |
| | | keyName: 'BAS_LABEL_VAR', |
| | | order: 'VAR_NAME', |
| | | showTbButton: false, |
| | | FnName: '', |
| | | }, |
| | | { |
| | | name: 'BAS_LABEL_VAR_WO', |
| | | code: 'LABEL_ID', |
| | | type: 'one', |
| | | keyName: 'BAS_LABEL_VAR_WO', |
| | | order: '', |
| | | showTbButton: true, |
| | | FnName: 'AddRow', |
| | | }, |
| | | // { |
| | | // name: 'BAS_LABEL_VAR_WO', |
| | | // code: 'LABEL_ID', |
| | | // type: 'one', |
| | | // keyName: 'BAS_LABEL_VAR_WO', |
| | | // order: '', |
| | | // showTbButton: true, |
| | | // FnName: 'AddRow', |
| | | // }, |
| | | ], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // const webSocketStore = useWebSocketStore(); |
| | |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function Del(args: Fn[], params: {}) { |
| | | const reload = args[1]; |
| | | DeleteLabelTemplate(params['record']['ID']).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | reload(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return [methods, ActionColumn]; |
| | | } |
| | | |