Ben Lin
2024-06-23 f1d47feeee1ddb5751847b71f789f2c3b822ec32
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
/*
 * @Description: 产品标签模板相关
 * @Author: Ben Lin
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-23 23:53:41
 */
 
import { ActionItem, BasicColumn } from '/@/components/Table';
 
function _default() {
  /**
   * @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}]`,
      others: { LABEL_ID: params['record'].ID },
      colSlots: ['BAS_LABEL_PV1add'],
    };
    go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify(id))}`);
  }
 
  const ActionColumn: BasicColumn = {
    width: 120,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    fixed: 'right',
  };
 
  const methods = {
    /**
     * @description: 获取新增按钮的行为
     * @return {*}
     */
    CreateAction: () => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
    },
    /**
     * @description: 产品绑定工艺路线操作字段自定义按钮
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      return [
        ...data,
        ...[
          {
            icon: 'clarity:info-standard-line',
            tooltip: '模板变量',
            onClick: goDetail.bind(null, args[5], params),
          },
        ],
      ];
    },
  };
 
  return [methods, ActionColumn];
}
 
export default _default;