| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-22 20:35:33 |
| | | * @LastEditTime: 2024-07-24 23:02:47 |
| | | */ |
| | | |
| | | import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { useWebSocketStore } from '/@/store/modules/websocket'; |
| | | |
| | | function _default() { |
| | | /** |
| | | * @description: 跳转到详情页面方法 |
| | | * @param {Fn} go |
| | | * @return {*} |
| | | */ |
| | | function goDetail(go: Fn, params: Recordable) { |
| | | const id = { |
| | | ID: 'BAS_LABEL_VAR', |
| | | firstTabName: '标签模板变量', |
| | | secondTabName: '', //'标签过程变量', |
| | | firstTitle: '模板变量', |
| | | secondTitle: '', //'过程变量', |
| | | pageTitle: '标签模板变量', //详情页面标题 |
| | | contentStr: '这里是标签模板变量管理页面,可以管理标签的模板变量或者打印过程中的变量', |
| | | detailName: `模板[${params['record'].LABEL_NAME}]`, |
| | | others: { LABEL_ID: params['record'].ID }, |
| | | colSlots: ['BAS_LABEL_PV1add'], |
| | | }; |
| | | go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify(id))}`); |
| | | } |
| | | |
| | | const ActionColumn: BasicColumn = { |
| | | width: 120, |
| | | title: '操作', |
| | |
| | | fixed: 'right', |
| | | }; |
| | | |
| | | /** |
| | | * @description: 些自定义方法 |
| | | * @return {*} |
| | | */ |
| | | const methods = { |
| | | /** |
| | | * @description: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: () => { |
| | | CreateAction: (fnName: string) => { |
| | | return { |
| | | action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @description: 操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | return [ |
| | | ...data, |
| | | ...[ |
| | | { |
| | | icon: 'clarity:info-standard-line', |
| | | tooltip: '模板变量', |
| | | onClick: goDetail.bind(null, args[5], params), |
| | | }, |
| | | ], |
| | | ]; |
| | | data.map((x) => { |
| | | if (x.name == 'goDetail') { |
| | | x.onClick = goDetail.bind(null, args[5], params); |
| | | x.tooltip = '模板变量'; |
| | | } |
| | | }); |
| | | return data; |
| | | }, |
| | | GetUseForm: () => { |
| | | return {}; |
| | | }, |
| | | /** |
| | | * @description: 自定义方法 |
| | | * @param {string} type |
| | | * @param {array} args |
| | | * @return {*} |
| | | */ |
| | | CustFunc: (param: CustModalParams) => { |
| | | const webSocketStore = useWebSocketStore(); |
| | | if (webSocketStore.GetSocketState == 1) { |
| | | webSocketStore.sendMessage( |
| | | `wsSubStrings ${param.values['ID']}_#_${param.values['TEMP_PATH']}` |
| | | ); |
| | | } |
| | | }, |
| | | }; |
| | | |
| | | /* 以下是内部方法,不export,供上面的方法调用 */ |
| | | |
| | | /** |
| | | * @description: 跳转到详情页面方法 |
| | | * @param {Fn} go |
| | | * @return {*} |
| | | */ |
| | | function goDetail(go: Fn, params: Recordable) { |
| | | const id = { |
| | | ID: params['record'].ID, |
| | | CODE: params['record']['LABEL_CODE'], |
| | | Name: 'BAS_LABEL_VAR', |
| | | firstTabName: '标签模板变量', |
| | | secondTabName: '', //'标签过程变量', |
| | | firstTitle: '模板变量', |
| | | secondTitle: '', //'过程变量', |
| | | pageTitle: '标签模板变量', //详情页面标题 |
| | | contentStr: '这里是标签模板变量管理页面,可以管理标签的模板变量或者打印过程中的变量', |
| | | detailName: `模板[${params['record'].LABEL_NAME}]`, |
| | | keyFieldValues: { LABEL_ID: params['record'].ID }, |
| | | colSlots: ['BAS_LABEL_PV1add'], |
| | | SessionName: 'BAS_LABEL_VAR_update', |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${id.SessionName}_params`); |
| | | sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id))); |
| | | go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`); |
| | | } |
| | | |
| | | return [methods, ActionColumn]; |
| | | } |
| | | |