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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
| import { BasicColumn, FormSchema } from '/@/components/Table';
| import { h, unref } from 'vue';
| import { Switch } from 'ant-design-vue';
| import { useMessage } from '/@/hooks/web/useMessage';
| import { RouteTypeStatus, setRouteStatus } from '/@/api/tigerapi/mes/router';
| import { useI18n } from '/@/hooks/web/useI18n';
| import { useLocale } from '/@/locales/useLocale';
|
| const { t } = useI18n();
| const { getLocale } = useLocale();
|
| export const columns: BasicColumn[] = [
| {
| title: '工艺路线编码',
| dataIndex: 'ROT_CODE',
| width: 200,
| },
| {
| title: '工艺路线名称',
| dataIndex: 'ROT_NAME',
| width: 180,
| },
| {
| title: '状态',
| dataIndex: 'IS_ACTIVE',
| width: 120,
| customRender: ({ record }) => {
| if (!Reflect.has(record, 'pendingStatus')) {
| record.pendingStatus = false;
| }
| return h(Switch, {
| checked: record.IS_ACTIVE === 'Y',
| checkedChildren: '已启用',
| unCheckedChildren: '已禁用',
| loading: record.pendingStatus,
| onChange(checked: boolean) {
| const oldStatus = record.IS_ACTIVE;
| record.pendingStatus = true;
| const newStatus = checked ? 'Y' : 'N';
| console.log(10, newStatus);
| const { createMessage } = useMessage();
| record.IS_ACTIVE = newStatus;
| setRouteStatus(record)
| .then(() => {
| createMessage.success(`已成功修改工艺路线状态`);
| })
| .catch(() => {
| createMessage.error('修改工艺路线状态失败');
| record.IS_ACTIVE = oldStatus;
| })
| .finally(() => {
| record.pendingStatus = false;
| });
| },
| });
| },
| editDynamicDisabled: true,
| },
| {
| title: '创建时间',
| dataIndex: 'CREATE_TIME',
| width: 180,
| },
| {
| title: '备注',
| dataIndex: 'REMARK',
| width: 180,
| },
| ];
|
| export const searchFormSchema: FormSchema[] = [
| {
| field: 'ROT_CODE',
| label: '工艺路线编码',
| component: 'Input',
| colProps: { span: 8 },
| },
| {
| field: 'ROT_NAME',
| label: '工艺路线名称',
| component: 'Input',
| colProps: { span: 8 },
| },
| {
| field: 'IS_ACTIVE',
| label: '状态',
| component: 'Select',
| componentProps: {
| options: [
| { label: '启用', value: 'Y' },
| { label: '停用', value: 'N' },
| ],
| },
| colProps: { span: 8 },
| },
| ];
|
| export const formSchema: FormSchema[] = [
| {
| field: 'ROT_CODE',
| label: '工艺路线编码',
| required: true,
| component: 'Input',
| colProps: { span: 24 },
| },
| {
| field: 'ID',
| label: 'ID',
| component: 'Input',
| show: false,
| },
| {
| field: 'ROT_NAME',
| label: '工艺路线名称',
| required: true,
| component: 'Input',
| colProps: { span: 24 },
| },
| {
| field: 'ROT_TYPE',
| label: t('工艺路线类型'),
| component: 'ApiSelect',
| colProps: { span: 24 },
| componentProps: {
| api: RouteTypeStatus,
| resultField: 'Data',
| labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
| valueField: 'Value',
| // onChange: (e, v) => {
| // alert(e)
| // console.log('ApiSelect====>:', e, v);
| // },
| },
| },
| {
| field: 'ROT_VER',
| label: '工艺路线版本',
| // required: true,
| component: 'Input',
| colProps: { span: 24 },
| },
| {
| field: 'IS_ACTIVE',
| label: '是否启用(Y/N)',
| required: true,
| component: 'Select',
| colProps: { span: 24 },
| componentProps: {
| options: [
| {
| label: '是',
| value: 'Y',
| key: 'Y',
| },
| {
| label: '否',
| value: 'N',
| key: 'N',
| },
| ],
| },
| },
| {
| field: 'REMARK',
| label: '备注',
| // required: true,
| component: 'Input',
| colProps: { span: 24 },
| },
| ];
|
|