1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
| /*
| * @Description: 不良原因组相关
| * @Author: Ben Lin
| * @version:
| * @Date: 2024-06-19 20:34:27
| * @LastEditors: Ben Lin
| * @LastEditTime: 2024-08-04 14:20:37
| */
|
| 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: 180,
| title: '操作',
| dataIndex: 'action',
| slots: { customRender: 'action' },
| fixed: undefined,
| };
|
| /**
| * @description: 一些自定义方法
| * @return {*}
| */
| const methods = {
| /**
| * @description: 获取新增按钮的行为
| * @return {*}
| */
| CreateAction: (type: string) => {
| return {
| action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) | edit(如果是表格可编辑页面就是自定义方法)
| url: 'BAS_REASON/High',
| params: {
| CODE: '0',
| ID: buildUUID(),
| Name: 'BAS_REASON',
| Title: '新增不良原因组',
| pCode: 'RSNG_CODE',
| IsID: false,
| ifSave: false,
| drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one', keyName: 'BAS_REASON' }], //drawers是右边弹出增改侧框的名字列表
| },
| };
| },
| /**
| * @description: 操作字段自定义按钮
| * @return {*}
| */
| ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
| if (!isNullOrUnDef(data[0])) {
| data[0].onClick = rsnGrpEdit.bind(null, args, params); //替换主页面编辑按钮方法变为跳转到高级页面
| }
| return data;
| },
| GetSelectSuccess: (d, u) => {
| return {
| RSNG_CODE: d.values['val'],
| };
| },
| OpenSelectItem: (openItemModal: Fn, ...args) => {
| openItemModal(true, {
| title: '不良原因组列表',
| schemas: [
| {
| field: 'RSNG_CODE',
| component: 'Input',
| label: '不良原因组代码',
| colProps: {
| span: 12,
| },
| },
| ],
| ItemColumns: [
| {
| title: t('不良原因组代码'),
| dataIndex: 'RSNG_CODE',
| resizable: true,
| sorter: true,
| width: 200,
| },
| {
| title: t('不良原因组名称'),
| dataIndex: 'RSNG_NAME',
| resizable: true,
| sorter: true,
| width: 180,
| },
| ],
| tableName: 'BAS_REASON_GRP',
| rowKey: 'RSNG_CODE',
| searchInfo: { TABLE_NAME: 'BAS_REASON_GRP' },
| });
| },
| GetUseForm: () => {
| return {};
| },
| };
|
| /* 以下是内部方法,不export,供上面的方法调用 */
|
| /**
| * @description: 自定义编辑方法,跳转到高级页面
| * @param {Fn} args
| * @param {*} params
| * @return {*}
| */
| function rsnGrpEdit(args: Fn[], params: {}) {
| const param = {
| CODE: params['record']['RSNG_CODE'],
| ID: params['record']['ID'],
| Name: 'BAS_REASON',
| SessionName: 'BAS_REASON_update',
| Title: `编辑不良原因组:${params['record']['RSNG_CODE']}`,
| pCode: 'RSNG_CODE',
| IsID: false,
| ifSave: false,
| drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one', keyName: 'BAS_REASON' }], //drawers是右边弹出增改侧框的名字列表
| };
| // 将对象转换为JSON字符串并保存到sessionStorage
| sessionStorage.removeItem(`${param.SessionName}_params`);
| sessionStorage.setItem(`${param.SessionName}_params`, encodeURI(JSON.stringify(param)));
| args[5](
| `/BAS_REASON/High/${encodeURI(JSON.stringify({ sName: param.SessionName, Name: param.Name }))}`,
| );
| }
|
| return [methods, ActionColumn];
| }
|
| export default _default;
|
|