|
1
|
1
|
import {BasicColumn, FormSchema} from "/@/components/Table";
|
|
2
|
2
|
import {useI18n} from "/@/hooks/web/useI18n";
|
|
3
|
3
|
const { t } = useI18n();
|
|
|
4
|
+import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
|
|
|
5
|
+import { FileItem } from '/@/components/Upload/src/typing';
|
|
|
6
|
+import {createImgPreview} from "/@/components/Preview";
|
|
|
7
|
+
|
|
4
|
8
|
const statusOptions = [
|
|
5
|
9
|
|
|
6
|
10
|
];
|
|
...
|
...
|
@@ -44,6 +48,181 @@ export const columns: BasicColumn[] = [ |
|
44
|
48
|
}
|
|
45
|
49
|
];
|
|
46
|
50
|
|
|
|
51
|
+export const formSchema: FormSchema[] = [
|
|
|
52
|
+ {
|
|
|
53
|
+ field: 'deviceName',
|
|
|
54
|
+ label: t('faultReport.facility.deviceNameText'),
|
|
|
55
|
+ component: 'Input',
|
|
|
56
|
+ required: true,
|
|
|
57
|
+ colProps: { span: 12 },
|
|
|
58
|
+ },
|
|
|
59
|
+ {
|
|
|
60
|
+ field: 'deviceCode',
|
|
|
61
|
+ label: t('faultReport.facility.deviceCodeText'),
|
|
|
62
|
+ component: 'Input',
|
|
|
63
|
+ componentProps: {
|
|
|
64
|
+ disabled: true,
|
|
|
65
|
+ },
|
|
|
66
|
+ required: true,
|
|
|
67
|
+ colProps: { span: 12 },
|
|
|
68
|
+ },
|
|
|
69
|
+ {
|
|
|
70
|
+ field: 'model',
|
|
|
71
|
+ label: t('faultReport.facility.modelText'),
|
|
|
72
|
+ component: 'Input',
|
|
|
73
|
+ componentProps: {
|
|
|
74
|
+ disabled: true,
|
|
|
75
|
+ },
|
|
|
76
|
+ colProps: { span: 12 },
|
|
|
77
|
+ },
|
|
|
78
|
+ {
|
|
|
79
|
+ field: 'deviceType',
|
|
|
80
|
+ label: t('faultReport.facility.deviceTypeText'),
|
|
|
81
|
+ component: 'Input',
|
|
|
82
|
+ required: true,
|
|
|
83
|
+ componentProps: {
|
|
|
84
|
+ disabled: true,
|
|
|
85
|
+ },
|
|
|
86
|
+ colProps: { span: 12 },
|
|
|
87
|
+ },{
|
|
|
88
|
+ field: 'storageLocation',
|
|
|
89
|
+ label: t('faultReport.facility.storageLocationText'),
|
|
|
90
|
+ component: 'Input',
|
|
|
91
|
+ componentProps: {
|
|
|
92
|
+ disabled: true,
|
|
|
93
|
+ },
|
|
|
94
|
+ colProps: { span: 12 },
|
|
|
95
|
+ },{
|
|
|
96
|
+ field: 'useDepartment',
|
|
|
97
|
+ label: t('faultReport.facility.useDepartmentText'),
|
|
|
98
|
+ component: 'Input',
|
|
|
99
|
+ componentProps: {
|
|
|
100
|
+ disabled: true,
|
|
|
101
|
+ },
|
|
|
102
|
+ required: true,
|
|
|
103
|
+ colProps: { span: 12 },
|
|
|
104
|
+ },{
|
|
|
105
|
+ field: 'nameCode',
|
|
|
106
|
+ label: t('faultReport.facility.nameCode'),
|
|
|
107
|
+ component: 'Input',
|
|
|
108
|
+ componentProps: {
|
|
|
109
|
+ disabled: true,
|
|
|
110
|
+ },
|
|
|
111
|
+ required: true,
|
|
|
112
|
+ colProps: { span: 12 },
|
|
|
113
|
+ },{
|
|
|
114
|
+ field: 'report',
|
|
|
115
|
+ label: t('faultReport.facility.reportText'),
|
|
|
116
|
+ component: 'Input',
|
|
|
117
|
+ componentProps: {
|
|
|
118
|
+ disabled: true,
|
|
|
119
|
+ },
|
|
|
120
|
+ required: true,
|
|
|
121
|
+ colProps: { span: 12 },
|
|
|
122
|
+ },{
|
|
|
123
|
+ field: 'department',
|
|
|
124
|
+ label: t('faultReport.facility.departmentText'),
|
|
|
125
|
+ component: 'Input',
|
|
|
126
|
+ componentProps: {
|
|
|
127
|
+ disabled: true,
|
|
|
128
|
+ },
|
|
|
129
|
+ required: true,
|
|
|
130
|
+ colProps: { span: 12 },
|
|
|
131
|
+ },{
|
|
|
132
|
+ field: 'phone',
|
|
|
133
|
+ label: t('faultReport.facility.phoneText'),
|
|
|
134
|
+ component: 'Input',
|
|
|
135
|
+ componentProps: {
|
|
|
136
|
+ disabled: true,
|
|
|
137
|
+ },
|
|
|
138
|
+ colProps: { span: 12 },
|
|
|
139
|
+ },{
|
|
|
140
|
+ field: 'themeText',
|
|
|
141
|
+ label: t('faultReport.facility.themeText'),
|
|
|
142
|
+ component: 'Input',
|
|
|
143
|
+ required: true,
|
|
|
144
|
+ colProps: { span: 24 },
|
|
|
145
|
+ },{
|
|
|
146
|
+ field: 'faultDate',
|
|
|
147
|
+ label: t('faultReport.facility.faultDate'),
|
|
|
148
|
+ component: 'DatePicker',
|
|
|
149
|
+ componentProps: {
|
|
|
150
|
+ style: { width: '100%' },
|
|
|
151
|
+ },
|
|
|
152
|
+ colProps: { span: 12 },
|
|
|
153
|
+ },
|
|
|
154
|
+ {
|
|
|
155
|
+ field: 'faultLevel',
|
|
|
156
|
+ label: t('faultReport.facility.faultLevel'),
|
|
|
157
|
+ component: 'Select',
|
|
|
158
|
+ colProps: { span: 12 },
|
|
|
159
|
+ },{
|
|
|
160
|
+ field: 'faultType',
|
|
|
161
|
+ label: t('faultReport.facility.faultType'),
|
|
|
162
|
+ component: 'Select',
|
|
|
163
|
+ colProps: { span: 12 },
|
|
|
164
|
+ },{
|
|
|
165
|
+ field: 'serviceStatus',
|
|
|
166
|
+ label: t('faultReport.facility.serviceStatus'),
|
|
|
167
|
+ component: 'Checkbox',
|
|
|
168
|
+ colProps: { span: 12 },
|
|
|
169
|
+ },{
|
|
|
170
|
+ field: 'faultDescription',
|
|
|
171
|
+ label: t('faultReport.facility.faultDescription'),
|
|
|
172
|
+ component: 'InputTextArea',
|
|
|
173
|
+ colProps: { span: 24 },
|
|
|
174
|
+ },{
|
|
|
175
|
+ field: 'img',
|
|
|
176
|
+ label: t('faultReport.facility.imgText'),
|
|
|
177
|
+ component: 'ApiUpload',
|
|
|
178
|
+ changeEvent: 'update:fileList',
|
|
|
179
|
+ valueField: 'fileList',
|
|
|
180
|
+ componentProps: ({ formModel }) => {
|
|
|
181
|
+ return {
|
|
|
182
|
+ listType: 'picture',
|
|
|
183
|
+ maxFileLimit: 10,
|
|
|
184
|
+ accept: '.png,.jpg,.jpeg,.gif',
|
|
|
185
|
+ api: async (file: File) => {
|
|
|
186
|
+ try {
|
|
|
187
|
+ const formData = new FormData();
|
|
|
188
|
+ formData.set('file', file);
|
|
|
189
|
+ const { fileStaticUri, fileName } = await uploadThumbnail(formData);
|
|
|
190
|
+ return {
|
|
|
191
|
+ uid: fileStaticUri,
|
|
|
192
|
+ name: fileName,
|
|
|
193
|
+ url: fileStaticUri,
|
|
|
194
|
+ } as FileItem;
|
|
|
195
|
+ } catch (error) {
|
|
|
196
|
+ return {};
|
|
|
197
|
+ }
|
|
|
198
|
+ },
|
|
|
199
|
+ // showUploadList: true,
|
|
|
200
|
+ onDownload() {},
|
|
|
201
|
+ onPreview: (fileList: FileItem) => {
|
|
|
202
|
+ createImgPreview({ imageList: [fileList.url!] });
|
|
|
203
|
+ },
|
|
|
204
|
+ onDelete(url: string) {
|
|
|
205
|
+ formModel.deleteLogoUrl = url!;
|
|
|
206
|
+ },
|
|
|
207
|
+ };
|
|
|
208
|
+ }
|
|
|
209
|
+ }
|
|
|
210
|
+ // {
|
|
|
211
|
+ // field: 'parentId',
|
|
|
212
|
+ // label: t('routes.common.organization.parentOrganization'),
|
|
|
213
|
+ // component: 'ApiTreeSelect',
|
|
|
214
|
+ // componentProps: {
|
|
|
215
|
+ // placeholder: t('common.chooseText') + t('business.organizationText'),
|
|
|
216
|
+ // api: async () => {
|
|
|
217
|
+ // const data = await getOrganizationList();
|
|
|
218
|
+ // copyTransFun(data as any as any[]);
|
|
|
219
|
+ // return data;
|
|
|
220
|
+ // },
|
|
|
221
|
+ // multiple: 2
|
|
|
222
|
+ // },
|
|
|
223
|
+ // },
|
|
|
224
|
+]
|
|
|
225
|
+
|
|
47
|
226
|
export const searchFormSchema: FormSchema[] = [
|
|
48
|
227
|
{
|
|
49
|
228
|
field: 'deviceNameText',
|
...
|
...
|
|