Commit 9552dd987f61a326e5167cc116ced78bdc8c5f93

Authored by gesilong
1 parent 06e498d5

commit: 设备巡检保养模块接口联调(未完成)

@@ -12,3 +12,23 @@ export const getInspectionPlanList = (params) => { @@ -12,3 +12,23 @@ export const getInspectionPlanList = (params) => {
12 params: otherParams, 12 params: otherParams,
13 }); 13 });
14 }; 14 };
  15 +
  16 +/**
  17 + * 删除
  18 + */
  19 +export const deleteInspectionPlan = (params) => {
  20 + return defHttp.get<any>({
  21 + url: `/inspectionPlan/delete`,
  22 + params,
  23 + });
  24 +};
  25 +
  26 +/**
  27 + * 更新
  28 + */
  29 +export const updateInspectionStatus = (params) => {
  30 + return defHttp.post<any>({
  31 + url: `/inspectionPlan/save`,
  32 + params,
  33 + });
  34 +};
@@ -12,3 +12,14 @@ export const getInspectionRecordList = (params) => { @@ -12,3 +12,14 @@ export const getInspectionRecordList = (params) => {
12 params: otherParams, 12 params: otherParams,
13 }); 13 });
14 }; 14 };
  15 +
  16 +
  17 +/**
  18 + * 删除
  19 + */
  20 +export const deleteInsRecord = (params) => {
  21 + return defHttp.get<any>({
  22 + url: `/inspectionRecord/delete`,
  23 + params,
  24 + });
  25 +};
@@ -12,3 +12,23 @@ export const getServicePlanList = (params) => { @@ -12,3 +12,23 @@ export const getServicePlanList = (params) => {
12 params: otherParams, 12 params: otherParams,
13 }); 13 });
14 }; 14 };
  15 +
  16 +/**
  17 + * 删除
  18 + */
  19 +export const deleteServePlan = (params) => {
  20 + return defHttp.get<any>({
  21 + url: `/preservePlan/delete`,
  22 + params,
  23 + });
  24 +};
  25 +
  26 +/**
  27 + * 更新
  28 + */
  29 +export const updateServiceStatus = (params) => {
  30 + return defHttp.post<any>({
  31 + url: `/preservePlan/updateStatus`,
  32 + params,
  33 + });
  34 +};
@@ -12,3 +12,13 @@ export const getServiceRecordList = (params) => { @@ -12,3 +12,13 @@ export const getServiceRecordList = (params) => {
12 params: otherParams, 12 params: otherParams,
13 }); 13 });
14 }; 14 };
  15 +
  16 +/**
  17 + * 删除
  18 + */
  19 +export const deleteServeRecord = (params) => {
  20 + return defHttp.get<any>({
  21 + url: `/preserveRecord/delete`,
  22 + params,
  23 + });
  24 +};
@@ -12,3 +12,24 @@ export const getRepairOrderList = (params) => { @@ -12,3 +12,24 @@ export const getRepairOrderList = (params) => {
12 params: otherParams, 12 params: otherParams,
13 }); 13 });
14 }; 14 };
  15 +
  16 +/**
  17 + * 新增
  18 + */
  19 +export const saveOrder = (params) => {
  20 + return defHttp.post<any>({
  21 + url: `/repairOrder/save`,
  22 + params,
  23 + });
  24 +};
  25 +
  26 +/**
  27 + * 删除
  28 + */
  29 +export const deleteRepairOrder = (params) => {
  30 + return defHttp.get<any>({
  31 + url: `/repairOrder/delete`,
  32 + params,
  33 + });
  34 +};
  35 +
@@ -34,6 +34,7 @@ import { JEasyCron } from './components/JEasyCron'; @@ -34,6 +34,7 @@ import { JEasyCron } from './components/JEasyCron';
34 import ColorPicker from './components/ColorPicker.vue'; 34 import ColorPicker from './components/ColorPicker.vue';
35 import IconDrawer from './components/IconDrawer.vue'; 35 import IconDrawer from './components/IconDrawer.vue';
36 import ApiUpload from './components/ApiUpload.vue'; 36 import ApiUpload from './components/ApiUpload.vue';
  37 +// @ts-ignore
37 import ApiSearchSelect from './components/ApiSearchSelect.vue'; 38 import ApiSearchSelect from './components/ApiSearchSelect.vue';
38 import CustomMinMaxInput from './components/CustomMinMaxInput.vue'; 39 import CustomMinMaxInput from './components/CustomMinMaxInput.vue';
39 import ApiSelectScrollLoad from './components/ApiSelectScrollLoad.vue'; 40 import ApiSelectScrollLoad from './components/ApiSelectScrollLoad.vue';
@@ -45,6 +45,14 @@ export default { @@ -45,6 +45,14 @@ export default {
45 redo: '刷新', 45 redo: '刷新',
46 back: '返回', 46 back: '返回',
47 47
  48 + start: '开始',
  49 + startConfirmText: '确认开始当前维护计划吗?',
  50 + stop: '停用',
  51 + stopConfirmText: '确认停用当前维护计划吗?',
  52 + down: '完成',
  53 + downConfirmText: '确认完成当前维护计划吗?',
  54 +
  55 +
48 light: '亮色主题', 56 light: '亮色主题',
49 dark: '黑暗主题', 57 dark: '黑暗主题',
50 58
1 export default { 1 export default {
2 listText: '巡检记录', 2 listText: '巡检记录',
3 nameText: '巡检计划', 3 nameText: '巡检计划',
  4 + createRecordText: '创建巡检记录',
4 recordCodeText: '巡检编号', 5 recordCodeText: '巡检编号',
5 inspectionPlanText: '巡检计划', 6 inspectionPlanText: '巡检计划',
6 checkDateText: '巡检日期', 7 checkDateText: '巡检日期',
@@ -5,7 +5,8 @@ export default { @@ -5,7 +5,8 @@ export default {
5 statusText: '状态', 5 statusText: '状态',
6 frequencyText: '频率', 6 frequencyText: '频率',
7 timesText: '次数', 7 timesText: '次数',
8 - createCategoryText: '创建计划', 8 + createPlanText: '创建计划',
  9 + editPlanText: '创建计划',
9 NOTSTART : '未开始', 10 NOTSTART : '未开始',
10 UNDERWAY: '进行中', 11 UNDERWAY: '进行中',
11 COMPLETED: '已完成', 12 COMPLETED: '已完成',
1 export default { 1 export default {
2 listText: '保养记录', 2 listText: '保养记录',
  3 + planText: '保计计划',
3 preserveNameText: '维护结果', 4 preserveNameText: '维护结果',
4 preserveCodeText: '计划编号', 5 preserveCodeText: '计划编号',
5 statusText: '状态', 6 statusText: '状态',
6 time: '保养日期', 7 time: '保养日期',
  8 + startTime: '开始时间',
  9 + endTime: '结束时间',
7 frequencyText: '频率', 10 frequencyText: '频率',
8 timesText: '次数', 11 timesText: '次数',
9 createCategoryText: '创建记录', 12 createCategoryText: '创建记录',
@@ -19,7 +19,7 @@ export default { @@ -19,7 +19,7 @@ export default {
19 emergencyText: '是否紧急', 19 emergencyText: '是否紧急',
20 enableText: '启用', 20 enableText: '启用',
21 disabledText: '停用', 21 disabledText: '停用',
22 - createCategoryText: '创建工单',  
23 - editCategoryText: '编辑方案', 22 + createOrderText: '创建工单',
  23 + editOrderText: '编辑工单',
24 detailText: '查看详情', 24 detailText: '查看详情',
25 }; 25 };
1 -import { formatToDateTime } from '/@/utils/dateUtil';  
2 -import { FormSchema, useComponentRegister } from '/@/components/Form';  
3 -import { BasicColumn } from '/@/components/Table';  
4 -import { getCustomerList } from '/@/api/device/deviceManager';  
5 -import { DescItem } from '/@/components/Description/index';  
6 -import moment from 'moment';  
7 -import { CSSProperties, h } from 'vue';  
8 -import { Button, Tag, Tooltip } from 'ant-design-vue';  
9 -import { TypeEnum, updateOrgHelpMessage } from './data';  
10 -import { PageEnum } from '/@/enums/pageEnum';  
11 -import { useGo } from '/@/hooks/web/usePage';  
12 -import { useAuthDeviceDetail } from '../hook/useAuthDeviceDetail';  
13 -import { findDictItemByCode } from '/@/api/system/dict';  
14 -import { isNullOrUnDef } from '/@/utils/is';  
15 -import { useI18n } from '/@/hooks/web/useI18n';  
16 -import { DeviceStatusEnum } from '/@/enums/deviceEnum';  
17 -import { AlarmStatus } from '/@/enums/alarmEnum';  
18 -const { t } = useI18n();  
19 -import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';  
20 -  
21 -useComponentRegister('OrgTreeSelect', OrgTreeSelect);  
22 -  
23 -// 设备详情的描述  
24 -export const descSchema = (emit: EmitType): DescItem[] => {  
25 - return [  
26 - {  
27 - field: 'createTime',  
28 - label: t('common.createTimeText'),  
29 - },  
30 - {  
31 - field: 'name',  
32 - label: t('business.deviceNameText'),  
33 - render(val, data: Record<'alias' | 'name', string>) {  
34 - return h(Tooltip, { title: data.alias || val }, () =>  
35 - h('span', { style: { cursor: 'pointer' } as CSSProperties }, data.alias || val)  
36 - );  
37 - },  
38 - },  
39 - {  
40 - field: 'label',  
41 - label: t('deviceManagement.device.deviceLabelText'),  
42 - render(val) {  
43 - return h(Tooltip, { title: val }, () =>  
44 - h('span', { style: { cursor: 'pointer' } as CSSProperties }, val)  
45 - );  
46 - },  
47 - },  
48 - {  
49 - field: 'deviceProfile.name',  
50 - label: t('business.productText'),  
51 - render(val) {  
52 - const go = useGo();  
53 - const { isCustomer } = useAuthDeviceDetail();  
54 - return h(  
55 - Button,  
56 - {  
57 - type: 'link',  
58 - style: { padding: 0 },  
59 - onClick: () =>  
60 - !isCustomer  
61 - ? go(PageEnum.DEVICE_PROFILE + '?name=' + encodeURIComponent(String(val)))  
62 - : '',  
63 - },  
64 - { default: () => val }  
65 - );  
66 - },  
67 - },  
68 - {  
69 - field: 'gatewayName',  
70 - label: t('business.affiliatedGatewayText'),  
71 - show: (data) => !!data.gatewayName,  
72 - render(val, data) {  
73 - if (TypeEnum.SENSOR !== data.deviceType) return val;  
74 - return h(  
75 - Button,  
76 - { type: 'link', style: { padding: 0 }, onClick: () => emit('open-gateway-device', data) },  
77 - { default: () => data.gatewayAlias || val }  
78 - );  
79 - },  
80 - },  
81 - {  
82 - field: 'deviceType',  
83 - label: t('business.deviceTypeText'),  
84 - render: (text) => {  
85 - return text && t(`enum.deviceType.${text}`);  
86 - },  
87 - },  
88 - {  
89 - field: 'deviceInfo.sip.cameraCode',  
90 - label: t('deviceManagement.device.deviceCameraCodeText'),  
91 - },  
92 - {  
93 - field: 'deviceInfo.sip.hostAddress',  
94 - label: t('deviceManagement.device.hostAddressText'),  
95 - },  
96 - {  
97 - field: 'deviceInfo.sip.manufacturer',  
98 - label: t('deviceManagement.device.brandText'),  
99 - },  
100 - {  
101 - field: 'deviceInfo.sip.streamMode',  
102 - label: t('deviceManagement.device.streamModeText'),  
103 - },  
104 - {  
105 - field: 'description',  
106 - label: t('common.descText'),  
107 - // span: 2,  
108 - render(val) {  
109 - return h(Tooltip, { title: val }, () =>  
110 - h('span', { style: { cursor: 'pointer' } as CSSProperties }, val)  
111 - );  
112 - },  
113 - },  
114 - ];  
115 -};  
116 -  
117 -// 实时数据表格  
118 -export const realTimeDataColumns: BasicColumn[] = [  
119 - {  
120 - title: t('deviceManagement.device.keyText'),  
121 - dataIndex: 'name',  
122 - width: 100,  
123 - },  
124 - {  
125 - title: t('deviceManagement.device.valueText'),  
126 - dataIndex: 'rawValue',  
127 - width: 160,  
128 - format(text) {  
129 - return isNullOrUnDef(text) ? '--' : text;  
130 - },  
131 - },  
132 - {  
133 - title: t('deviceManagement.device.latestUpdateTimeText'),  
134 - dataIndex: 'time',  
135 - width: 120,  
136 - format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'),  
137 - },  
138 -];  
139 -  
140 -// 告警  
141 -export const alarmSearchSchemas: FormSchema[] = [  
142 - {  
143 - field: 'status',  
144 - label: t('business.deviceStatusText'),  
145 - component: 'Select',  
146 - colProps: { span: 6 },  
147 - componentProps: {  
148 - options: Object.values(AlarmStatus).map((value) => ({  
149 - label: t(`enum.alarmStaus.${value}`),  
150 - value,  
151 - })),  
152 - },  
153 - },  
154 - {  
155 - field: 'alarmType',  
156 - label: t('deviceManagement.device.alarmSceneText'),  
157 - component: 'Input',  
158 - colProps: { span: 6 },  
159 - componentProps: {  
160 - maxLength: 36,  
161 - },  
162 - },  
163 - {  
164 - field: 'alarmTime',  
165 - label: t('deviceManagement.device.alarmTimeText'),  
166 - component: 'RangePicker',  
167 - componentProps: {  
168 - showTime: { defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] },  
169 - },  
170 - colProps: { span: 7 },  
171 - },  
172 - {  
173 - field: 'severity',  
174 - label: t('deviceManagement.device.alarmSeverityText'),  
175 - component: 'ApiSelect',  
176 - colProps: { span: 6 },  
177 - componentProps: {  
178 - api: findDictItemByCode,  
179 - params: {  
180 - dictCode: 'severity_type',  
181 - },  
182 - labelField: 'itemText',  
183 - valueField: 'itemValue',  
184 - },  
185 - },  
186 -];  
187 -export const alarmColumns: BasicColumn[] = [  
188 - {  
189 - title: t('deviceManagement.device.alarmTimeText'),  
190 - dataIndex: 'createdTime',  
191 - width: 180,  
192 - },  
193 - {  
194 - title: t('deviceManagement.device.alarmDeviceText'),  
195 - dataIndex: 'deviceName',  
196 - width: 120,  
197 - customRender: ({ record }) => {  
198 - const { deviceAlias, deviceName } = record || {};  
199 - return deviceAlias || deviceName;  
200 - },  
201 - },  
202 - {  
203 - title: t('deviceManagement.device.alarmSceneText'),  
204 - dataIndex: 'type',  
205 - width: 160,  
206 - },  
207 - {  
208 - title: t('deviceManagement.device.alarmSeverityText'),  
209 - dataIndex: 'severity',  
210 - width: 90,  
211 - format: (text) => alarmLevel(text),  
212 - },  
213 - {  
214 - title: t('deviceManagement.device.alarmDetailsText'),  
215 - dataIndex: 'details',  
216 - slots: { customRender: 'details' },  
217 - width: 160,  
218 - },  
219 - {  
220 - title: t('deviceManagement.device.statusText'),  
221 - dataIndex: 'status',  
222 - // format: (text) => statusType(text),  
223 - width: 100,  
224 - },  
225 -];  
226 -  
227 -export const alarmSchemasForm: FormSchema[] = [  
228 - {  
229 - field: 'deviceName',  
230 - label: '告警设备',  
231 - component: 'Input',  
232 - componentProps: {  
233 - disabled: true,  
234 - },  
235 - },  
236 -  
237 - {  
238 - field: 'startTs',  
239 - label: '开始时间',  
240 - component: 'Input',  
241 - componentProps: {  
242 - disabled: true,  
243 - },  
244 - },  
245 - {  
246 - field: 'endTs',  
247 - label: '结束时间',  
248 - component: 'Input',  
249 - componentProps: {  
250 - disabled: true,  
251 - },  
252 - },  
253 - {  
254 - field: 'ackTs',  
255 - label: '处理时间',  
256 - component: 'Input',  
257 - componentProps: {  
258 - disabled: true,  
259 - },  
260 - ifShow: ({ values }) => values.status === '激活已确认' || values.status === '清除已确认',  
261 - },  
262 - {  
263 - field: 'clearTs',  
264 - label: '清除时间',  
265 - component: 'Input',  
266 - componentProps: {  
267 - disabled: true,  
268 - },  
269 - ifShow: ({ values }) => values.status === '清除已确认' || values.status === '清除未确认',  
270 - },  
271 - {  
272 - field: 'type',  
273 - label: '告警场景',  
274 - component: 'Input',  
275 - componentProps: {  
276 - disabled: true,  
277 - },  
278 - },  
279 - {  
280 - field: 'severity',  
281 - label: '严重程度',  
282 - component: 'Input',  
283 - componentProps: {  
284 - disabled: true,  
285 - },  
286 - },  
287 - {  
288 - field: 'status',  
289 - label: '状态',  
290 - component: 'Input',  
291 - componentProps: {  
292 - disabled: true,  
293 - },  
294 - },  
295 -];  
296 -// 子设备  
297 -export const childDeviceSchemas: FormSchema[] = [  
298 - {  
299 - field: 'deviceState',  
300 - label: t('business.deviceStatusText'),  
301 - colProps: { span: 6 },  
302 - component: 'Select',  
303 - componentProps: {  
304 - maxLength: 255,  
305 - options: Object.values(DeviceStatusEnum).map((value) => ({  
306 - label: t(`enum.deviceStatus.${value}`),  
307 - value,  
308 - })),  
309 - },  
310 - },  
311 - {  
312 - field: 'name',  
313 - label: t('business.deviceNameText'),  
314 - component: 'Input',  
315 - colProps: { span: 6 },  
316 - componentProps: {  
317 - maxLength: 255,  
318 - },  
319 - },  
320 -];  
321 -  
322 -const deviceStatusColorMapping = {  
323 - [DeviceStatusEnum.INACTIVE]: 'warning',  
324 - [DeviceStatusEnum.OFFLINE]: 'error',  
325 - [DeviceStatusEnum.ONLINE]: 'success',  
326 -};  
327 -export const childDeviceColumns: BasicColumn[] = [  
328 - {  
329 - title: t('deviceManagement.device.nameText'),  
330 - dataIndex: 'tbDeviceName',  
331 - width: 120,  
332 - slots: {  
333 - customRender: 'tbDeviceName',  
334 - },  
335 - },  
336 - {  
337 - title: t('deviceManagement.device.labelText'),  
338 - dataIndex: 'label',  
339 - width: 160,  
340 - },  
341 - {  
342 - title: t('deviceManagement.device.statusText'),  
343 - dataIndex: 'deviceState',  
344 - customRender: ({ text }) => {  
345 - return h(Tag, { color: deviceStatusColorMapping[text] }, () =>  
346 - t(`enum.deviceStatus.${text}`)  
347 - );  
348 - },  
349 - width: 160,  
350 - },  
351 - {  
352 - title: t('deviceManagement.device.latestConnectionTimeText'),  
353 - dataIndex: 'lastOnlineTime',  
354 - format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'),  
355 - width: 160,  
356 - },  
357 - {  
358 - title: t('common.updateTimeText'),  
359 - dataIndex: 'createdTime',  
360 - format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'),  
361 - width: 160,  
362 - },  
363 -];  
364 -  
365 -export const alarmLevel = (type: string): string => {  
366 - const { t } = useI18n();  
367 -  
368 - return t(`enum.alarmLevel.${type}`);  
369 -};  
370 -  
371 -export const customerForm: FormSchema[] = [  
372 - {  
373 - field: 'customerId',  
374 - label: t('deviceManagement.device.assignCustomerText'),  
375 - component: 'ApiSelect',  
376 - componentProps: {  
377 - api: getCustomerList,  
378 - immediate: false,  
379 - labelField: 'realName',  
380 - valueField: 'customerId',  
381 - },  
382 - required: true,  
383 - colProps: { span: 12 },  
384 - },  
385 -];  
386 -  
387 -export const orgForm: FormSchema[] = [  
388 - {  
389 - field: 'sensorOrganizationId',  
390 - label: t('deviceManagement.device.organizeArrayBased'),  
391 - component: 'Input',  
392 - ifShow: false,  
393 - },  
394 - {  
395 - field: 'organizationId',  
396 - component: 'OrgTreeSelect',  
397 - helpMessage: updateOrgHelpMessage,  
398 - label: t('deviceManagement.device.chooseOrganization'),  
399 - required: true,  
400 - componentProps: ({ formModel }) => {  
401 - return {  
402 - apiTreeSelectProps: {  
403 - params: {  
404 - organizationId: formModel?.sensorOrganizationId,  
405 - },  
406 - },  
407 - };  
408 - },  
409 - },  
410 -];  
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
2 import { useI18n } from '/@/hooks/web/useI18n'; 2 import { useI18n } from '/@/hooks/web/useI18n';
3 import { BasicColumn } from '/@/components/Table'; 3 import { BasicColumn } from '/@/components/Table';
4 -import moment from "moment/moment";  
5 const { t } = useI18n(); 4 const { t } = useI18n();
6 5
7 const typeOptions = [ 6 const typeOptions = [
@@ -30,23 +29,13 @@ export const searchFormSchema: FormSchema[] = [ @@ -30,23 +29,13 @@ export const searchFormSchema: FormSchema[] = [
30 { 29 {
31 field: 'startTime', 30 field: 'startTime',
32 label: t('inspection.inspectionPlan.startTimeText'), 31 label: t('inspection.inspectionPlan.startTimeText'),
33 - component: 'RangePicker',  
34 - componentProps: {  
35 - showTime: {  
36 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
37 - },  
38 - }, 32 + component: 'DatePicker',
39 colProps: { span: 6 }, 33 colProps: { span: 6 },
40 }, 34 },
41 { 35 {
42 field: 'endTime', 36 field: 'endTime',
43 label: t('inspection.inspectionPlan.endTimeText'), 37 label: t('inspection.inspectionPlan.endTimeText'),
44 - component: 'RangePicker',  
45 - componentProps: {  
46 - showTime: {  
47 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
48 - },  
49 - }, 38 + component: 'DatePicker',
50 colProps: { span: 6 }, 39 colProps: { span: 6 },
51 }, 40 },
52 ]; 41 ];
@@ -22,16 +22,72 @@ @@ -22,16 +22,72 @@
22 {{ t(`inspection.inspectionPlan.${record.status}`) }} 22 {{ t(`inspection.inspectionPlan.${record.status}`) }}
23 </Tag> 23 </Tag>
24 </template> 24 </template>
  25 + <template #action="{ record }">
  26 + <TableAction
  27 + :actions="[
  28 + {
  29 + label: t('common.editText'),
  30 + auth: 'api:yt:product:category:update',
  31 + icon: 'clarity:note-edit-line',
  32 + // onClick: handleEdit.bind(null, record),
  33 + ifShow: () => record.status === 'NOT_START',
  34 + },
  35 + {
  36 + label: t('common.delText'),
  37 + auth: 'api:yt:product:category:delete',
  38 + icon: 'ant-design:delete-outlined',
  39 + color: 'error',
  40 + ifShow: () => record.status === 'NOT_START',
  41 + popConfirm: {
  42 + title: t('common.deleteConfirmText'),
  43 + confirm: handleDelete.bind(null, record),
  44 + },
  45 + },
  46 + {
  47 + label: t('common.start'),
  48 + auth: 'api:yt:product:category:delete',
  49 + icon: 'ant-design:caret-right-outlined',
  50 + ifShow: () => record.status === 'NOT_START',
  51 + popConfirm: {
  52 + title: t('common.startConfirmText'),
  53 + confirm: handleUpdateStatus.bind(null, record),
  54 + },
  55 + },
  56 + {
  57 + label: t('common.stop'),
  58 + auth: 'api:yt:product:category:delete',
  59 + icon: ' <PauseCircleOutlined />',
  60 + ifShow: () => record.status === 'NOT_START' || record.status === 'UNDERWAY',
  61 + popConfirm: {
  62 + title: t('common.stopConfirmText'),
  63 + confirm: handleUpdateStatus.bind(null, record,'STOP'),
  64 + },
  65 + },
  66 + {
  67 + label: t('common.down'),
  68 + auth: 'api:yt:product:category:delete',
  69 + icon: 'ant-design:check-circle-outlined',
  70 + ifShow: () => record.status === 'UNDERWAY',
  71 + popConfirm: {
  72 + title: t('common.downConfirmText'),
  73 + confirm: handleUpdateStatus.bind(null, record),
  74 + },
  75 + },
  76 + ]"
  77 + />
  78 + </template>
25 </BasicTable> 79 </BasicTable>
26 </div> 80 </div>
27 </template> 81 </template>
28 <script setup lang="ts"> 82 <script setup lang="ts">
29 -import { BasicTable, useTable } from '/@/components/Table';  
30 -import { getInspectionPlanList } from '/@/api/inspection/inspectionPlan'; 83 +import { BasicTable, useTable, TableAction } from '/@/components/Table';
  84 +import {deleteInspectionPlan, getInspectionPlanList, updateInspectionStatus} from '/@/api/inspection/inspectionPlan';
31 import { columns, searchFormSchema } from './index'; 85 import { columns, searchFormSchema } from './index';
32 import { useI18n } from '/@/hooks/web/useI18n'; 86 import { useI18n } from '/@/hooks/web/useI18n';
33 import { Button, Tag } from 'ant-design-vue'; 87 import { Button, Tag } from 'ant-design-vue';
  88 +import {useMessage} from "/@/hooks/web/useMessage";
34 const { t } = useI18n(); 89 const { t } = useI18n();
  90 +const { createMessage } = useMessage();
35 91
36 const [ 92 const [
37 registerTable, 93 registerTable,
@@ -62,4 +118,48 @@ const [ @@ -62,4 +118,48 @@ const [
62 getCheckboxProps: (record: any) => {}, 118 getCheckboxProps: (record: any) => {},
63 }, 119 },
64 }); 120 });
  121 +
  122 +const handleDelete = async (record?: any) => {
  123 + let id = record.id;
  124 + try {
  125 + setLoading(true);
  126 + await deleteInspectionPlan({ id });
  127 + createMessage.success(t('common.deleteSuccessText'));
  128 + handleReload();
  129 + } catch (error) {
  130 + throw error;
  131 + } finally {
  132 + setLoading(false);
  133 + }
  134 +};
  135 +
  136 +const handleReload = () => {
  137 + setSelectedRowKeys([]);
  138 + reload();
  139 +};
  140 +
  141 +const handleUpdateStatus = async (record?: any,value?: string) => {
  142 + let _status = '';
  143 + if (record.status === 'NOT_START') {
  144 + _status = 'UNDERWAY'
  145 + }else if(record.status === 'UNDERWAY'){
  146 + _status = 'FINISH'
  147 + }else if(record.status === 'FINISH'){
  148 + _status = 'STOP'
  149 + }
  150 + if (value === 'STOP') {
  151 + _status = 'STOP'
  152 + }
  153 + try {
  154 + setLoading(true);
  155 + await updateInspectionStatus({ ...record,status: _status });
  156 + createMessage.success(t('common.editSuccessText'));
  157 + handleReload();
  158 + } catch (error) {
  159 + throw error;
  160 + } finally {
  161 + setLoading(false);
  162 + }
  163 +}
  164 +
65 </script> 165 </script>
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
2 import { useI18n } from '/@/hooks/web/useI18n'; 2 import { useI18n } from '/@/hooks/web/useI18n';
3 import { BasicColumn } from '/@/components/Table'; 3 import { BasicColumn } from '/@/components/Table';
4 -import moment from "moment"; 4 +import {getInspectionPlanList} from "../../../api/inspection/inspectionPlan";
5 const { t } = useI18n(); 5 const { t } = useI18n();
6 6
7 7
8 const resultOptions = [ 8 const resultOptions = [
9 - { label: t('inspection.inspectionRecord.normal'), value: 'true' },  
10 - { label: t('inspection.inspectionRecord.error'), value: 'false' }, 9 + { label: t('inspection.inspectionRecord.normal'), value: true },
  10 + { label: t('inspection.inspectionRecord.error'), value: false },
11 ]; 11 ];
12 12
13 export const searchFormSchema: FormSchema[] = [ 13 export const searchFormSchema: FormSchema[] = [
@@ -16,40 +16,34 @@ export const searchFormSchema: FormSchema[] = [ @@ -16,40 +16,34 @@ export const searchFormSchema: FormSchema[] = [
16 label: t('inspection.inspectionRecord.nameText'), 16 label: t('inspection.inspectionRecord.nameText'),
17 component: 'Input', 17 component: 'Input',
18 colProps: { span: 6 }, 18 colProps: { span: 6 },
19 - },  
20 - {  
21 - field: 'inspectorId',  
22 - label: t('inspection.inspectionRecord.inspectorIdText'),  
23 - component: 'Input',  
24 - colProps: { span: 6 }, 19 + componentProps: {
  20 + api: getInspectionPlanList,
  21 + params: {
  22 + page: 1,
  23 + pageSize: 999,
  24 + },
  25 + resultField: 'items',
  26 + labelField: 'name',
  27 + valueField: 'id',
  28 + },
25 }, 29 },
26 { 30 {
27 field: 'startTime', 31 field: 'startTime',
28 label: t('inspection.inspectionRecord.startTimeText'), 32 label: t('inspection.inspectionRecord.startTimeText'),
29 - component: 'RangePicker',  
30 - componentProps: {  
31 - showTime: {  
32 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
33 - },  
34 - }, 33 + component: 'DatePicker',
35 colProps: { span: 6 }, 34 colProps: { span: 6 },
36 }, 35 },
37 { 36 {
38 field: 'endTime', 37 field: 'endTime',
39 label: t('inspection.inspectionRecord.endTimeText'), 38 label: t('inspection.inspectionRecord.endTimeText'),
40 - component: 'RangePicker',  
41 - componentProps: {  
42 - showTime: {  
43 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
44 - },  
45 - }, 39 + component: 'DatePicker',
46 colProps: { span: 6 }, 40 colProps: { span: 6 },
47 }, 41 },
48 { 42 {
49 field: 'recordResult', 43 field: 'recordResult',
50 label: t('inspection.inspectionRecord.recordResultText'), 44 label: t('inspection.inspectionRecord.recordResultText'),
51 component: 'Select', 45 component: 'Select',
52 - colProps: { span: 8 }, 46 + colProps: { span: 6 },
53 componentProps: { 47 componentProps: {
54 options: resultOptions, 48 options: resultOptions,
55 }, 49 },
@@ -63,12 +57,17 @@ export const columns: BasicColumn[] = [ @@ -63,12 +57,17 @@ export const columns: BasicColumn[] = [
63 }, 57 },
64 { 58 {
65 title: t('inspection.inspectionRecord.inspectionPlanText'), 59 title: t('inspection.inspectionRecord.inspectionPlanText'),
66 - dataIndex: 'inspectionPlanId', 60 + dataIndex: 'tkInspectionPlanDTO',
  61 + format: (text, record) => {
  62 + return record.tkInspectionPlanDTO?.name || '-'|| text;
  63 + },
67 }, 64 },
68 { 65 {
69 title: t('inspection.inspectionRecord.inspectorByName'), 66 title: t('inspection.inspectionRecord.inspectorByName'),
70 - dataIndex: 'inspectorId',  
71 - 67 + dataIndex: 'userDTO',
  68 + format: (text, record) => {
  69 + return record.userDTO?.realName || '-' || text;
  70 + },
72 }, 71 },
73 { 72 {
74 title: t('inspection.inspectionRecord.checkDateText'), 73 title: t('inspection.inspectionRecord.checkDateText'),
@@ -78,6 +77,5 @@ export const columns: BasicColumn[] = [ @@ -78,6 +77,5 @@ export const columns: BasicColumn[] = [
78 title: t('inspection.inspectionRecord.recordResultText'), 77 title: t('inspection.inspectionRecord.recordResultText'),
79 dataIndex: 'recordResult', 78 dataIndex: 'recordResult',
80 slots: { customRender: 'recordResult' }, 79 slots: { customRender: 'recordResult' },
81 -  
82 }, 80 },
83 ]; 81 ];
@@ -4,28 +4,52 @@ @@ -4,28 +4,52 @@
4 <template #toolbar> 4 <template #toolbar>
5 <Authority value="api:yt:product:category:post"> 5 <Authority value="api:yt:product:category:post">
6 <Button type="primary" > 6 <Button type="primary" >
7 - {{ t('inspection.inspectionRecord.createCategoryText') }} 7 + {{ t('inspection.inspectionRecord.createRecordText') }}
8 </Button> 8 </Button>
9 </Authority> 9 </Authority>
10 </template> 10 </template>
11 <template #recordResult="{ record }"> 11 <template #recordResult="{ record }">
12 <Tag 12 <Tag
13 - :color="record.status ? 'green' : 'red'" 13 + :color="record.recordResult ? 'green' : 'red'"
14 class="ml-2" 14 class="ml-2"
15 > 15 >
16 {{record.recordResult ? '正常' : '异常'}} 16 {{record.recordResult ? '正常' : '异常'}}
17 </Tag> 17 </Tag>
18 </template> 18 </template>
  19 + <template #action="{ record }">
  20 + <TableAction
  21 + :actions="[
  22 + {
  23 + label: t('common.editText'),
  24 + auth: 'api:yt:product:category:update',
  25 + icon: 'clarity:note-edit-line',
  26 + // onClick: handleEdit.bind(null, record),
  27 + },
  28 + {
  29 + label: t('common.delText'),
  30 + auth: 'api:yt:product:category:delete',
  31 + icon: 'ant-design:delete-outlined',
  32 + color: 'error',
  33 + popConfirm: {
  34 + title: t('common.deleteConfirmText'),
  35 + confirm: handleDelete.bind(null, record),
  36 + },
  37 + },
  38 + ]"
  39 + />
  40 + </template>
19 </BasicTable> 41 </BasicTable>
20 </div> 42 </div>
21 </template> 43 </template>
22 <script setup lang="ts"> 44 <script setup lang="ts">
23 - import { BasicTable, useTable } from '/@/components/Table';  
24 - import { getInspectionRecordList } from '/@/api/inspection/inspectionRecord'; 45 + import { BasicTable, useTable, TableAction } from '/@/components/Table';
  46 + import { getInspectionRecordList, deleteInsRecord } from '/@/api/inspection/inspectionRecord';
25 import { columns, searchFormSchema } from './index'; 47 import { columns, searchFormSchema } from './index';
26 import { useI18n } from '/@/hooks/web/useI18n'; 48 import { useI18n } from '/@/hooks/web/useI18n';
27 import { Button, Tag } from 'ant-design-vue'; 49 import { Button, Tag } from 'ant-design-vue';
  50 + import {useMessage} from "/@/hooks/web/useMessage";
28 const { t } = useI18n(); 51 const { t } = useI18n();
  52 + const { createMessage } = useMessage();
29 53
30 const [ 54 const [
31 registerTable, 55 registerTable,
@@ -56,4 +80,23 @@ @@ -56,4 +80,23 @@
56 getCheckboxProps: (record: any) => {}, 80 getCheckboxProps: (record: any) => {},
57 }, 81 },
58 }); 82 });
  83 +
  84 + const handleDelete = async (record?: any) => {
  85 + let id = record.id;
  86 + try {
  87 + setLoading(true);
  88 + await deleteInsRecord({ id });
  89 + createMessage.success(t('common.deleteSuccessText'));
  90 + handleReload();
  91 + } catch (error) {
  92 + throw error;
  93 + } finally {
  94 + setLoading(false);
  95 + }
  96 + };
  97 +
  98 + const handleReload = () => {
  99 + setSelectedRowKeys([]);
  100 + reload();
  101 + };
59 </script> 102 </script>
  1 +import servicePlanModal from './servicePlanModal.vue';
  2 +
  3 +export { servicePlanModal };
  1 +<template>
  2 + <div>
  3 + <BasicModal
  4 + v-bind="$attrs"
  5 + width="30rem"
  6 + :title="getTitle"
  7 + @register="register"
  8 + @cancel="handleCancel"
  9 + @ok="handleOk"
  10 + destroyOnClose
  11 + >
  12 + <div>
  13 + <BasicForm @register="registerForm" />
  14 + </div>
  15 + </BasicModal>
  16 + </div>
  17 +</template>
  18 +<script setup lang="ts">
  19 +import {computed, ref, unref} from "vue";
  20 +import {useI18n} from "/@/hooks/web/useI18n";
  21 +import {useForm} from "/@/components/Form";
  22 +import {schemas} from "../index";
  23 +import {useModalInner} from "/@/components/Modal";
  24 +const { t } = useI18n();
  25 +const isUpdate = ref<Boolean>(false);
  26 +const recordInfo = ref<any>({});
  27 +const emit = defineEmits(['handleReload', 'register']);
  28 +
  29 +const getTitle = computed(() =>
  30 + !unref(isUpdate)
  31 + ? t('inspection.servicePlan.createPlanText')
  32 + : t('inspection.servicePlan.editPlanText')
  33 +);
  34 +
  35 +const [registerForm, { getFieldsValue, setFieldsValue, validate, updateSchema }] = useForm({
  36 + labelWidth: 140,
  37 + schemas,
  38 + actionColOptions: {
  39 + span: 14,
  40 + },
  41 + showActionButtonGroup: false,
  42 +});
  43 +
  44 +const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
  45 + setModalProps({ confirmLoading: false, loading: true });
  46 + isUpdate.value = data?.isUpdate;
  47 + recordInfo.value = data?.record;
  48 + if (data?.record) {
  49 + setFieldsValue(data?.record);
  50 + }
  51 + setModalProps({ loading: false });
  52 +});
  53 +
  54 +const handleCancel = () => {
  55 + closeModal();
  56 +};
  57 +
  58 +const handleOk = async () => {
  59 +
  60 +}
  61 +</script>
@@ -35,3 +35,51 @@ export const columns: BasicColumn[] = [ @@ -35,3 +35,51 @@ export const columns: BasicColumn[] = [
35 dataIndex: 'times', 35 dataIndex: 'times',
36 }, 36 },
37 ]; 37 ];
  38 +
  39 +
  40 +export const schemas: FormSchema[] = [
  41 + {
  42 + field: 'code',
  43 + label: t('equipment.checkPlan.nameCode'),
  44 + component: 'Input',
  45 + colProps: { span: 21 },
  46 + required: true,
  47 + componentProps: {
  48 + maxLength: 20,
  49 + },
  50 + },
  51 + {
  52 + field: 'name',
  53 + label: t('equipment.checkPlan.nameText'),
  54 + component: 'Input',
  55 + colProps: { span: 21 },
  56 + required: true,
  57 + componentProps: {
  58 + maxLength: 20,
  59 + },
  60 + },
  61 + {
  62 + field: 'type',
  63 + label: t('equipment.checkPlan.typeText'),
  64 + component: 'RadioButtonGroup',
  65 + defaultValue: 'INSPECTION',
  66 +
  67 + },
  68 + {
  69 + field: 'status',
  70 + label: t('equipment.checkPlan.statusText'),
  71 + component: 'RadioButtonGroup',
  72 + defaultValue: 'ENABLE',
  73 +
  74 + },
  75 + {
  76 + field: 'planDetails',
  77 + label: t('equipment.checkPlan.nameDetail'),
  78 + component: 'InputTextArea',
  79 + colProps: { span: 21 },
  80 + required: true,
  81 + componentProps: {
  82 + maxLength: 200,
  83 + },
  84 + },
  85 +];
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <template #toolbar> 4 <template #toolbar>
5 <Authority value="api:yt:product:category:post"> 5 <Authority value="api:yt:product:category:post">
6 <Button type="primary" @click="handleCreate"> 6 <Button type="primary" @click="handleCreate">
7 - {{ t('inspection.servicePlan.createCategoryText') }} 7 + {{ t('inspection.servicePlan.createPlanText') }}
8 </Button> 8 </Button>
9 </Authority> 9 </Authority>
10 </template> 10 </template>
@@ -22,16 +22,76 @@ @@ -22,16 +22,76 @@
22 {{ t(`inspection.servicePlan.${record.status}`) }} 22 {{ t(`inspection.servicePlan.${record.status}`) }}
23 </Tag> 23 </Tag>
24 </template> 24 </template>
  25 + <template #action="{ record }">
  26 + <TableAction
  27 + :actions="[
  28 + {
  29 + label: t('common.editText'),
  30 + auth: 'api:yt:product:category:update',
  31 + icon: 'clarity:note-edit-line',
  32 + // onClick: handleEdit.bind(null, record),
  33 + ifShow: () => record.status === 'NOTSTART',
  34 + },
  35 + {
  36 + label: t('common.delText'),
  37 + auth: 'api:yt:product:category:delete',
  38 + icon: 'ant-design:delete-outlined',
  39 + color: 'error',
  40 + ifShow: () => record.status === 'NOTSTART',
  41 + popConfirm: {
  42 + title: t('common.deleteConfirmText'),
  43 + confirm: handleDelete.bind(null, record),
  44 + },
  45 + },
  46 + {
  47 + label: t('common.start'),
  48 + auth: 'api:yt:product:category:delete',
  49 + icon: 'ant-design:caret-right-outlined',
  50 + ifShow: () => record.status === 'NOTSTART',
  51 + popConfirm: {
  52 + title: t('common.startConfirmText'),
  53 + confirm: handleUpdateStatus.bind(null, record),
  54 + },
  55 + },
  56 + {
  57 + label: t('common.stop'),
  58 + auth: 'api:yt:product:category:delete',
  59 + icon: ' <PauseCircleOutlined />',
  60 + ifShow: () => record.status === 'NOTSTART' || record.status === 'UNDERWAY',
  61 + popConfirm: {
  62 + title: t('common.stopConfirmText'),
  63 + confirm: handleUpdateStatus.bind(null, record,'STOP'),
  64 + },
  65 + },
  66 + {
  67 + label: t('common.down'),
  68 + auth: 'api:yt:product:category:delete',
  69 + icon: 'ant-design:check-circle-outlined',
  70 + ifShow: () => record.status === 'UNDERWAY',
  71 + popConfirm: {
  72 + title: t('common.downConfirmText'),
  73 + confirm: handleUpdateStatus.bind(null, record),
  74 + },
  75 + },
  76 + ]"
  77 + />
  78 + </template>
25 </BasicTable> 79 </BasicTable>
  80 + <servicePlanModal @register="registerModal" @handleReload="handleReload" />
  81 +
26 </div> 82 </div>
27 </template> 83 </template>
28 <script setup lang="ts"> 84 <script setup lang="ts">
29 - import { BasicTable, useTable } from '/@/components/Table';  
30 - import { getServicePlanList } from '/@/api/inspection/servicePlan'; 85 + import { BasicTable, useTable, TableAction } from '/@/components/Table';
  86 + import {deleteServePlan, getServicePlanList, updateServiceStatus} from '/@/api/inspection/servicePlan';
31 import { columns, searchFormSchema } from './index'; 87 import { columns, searchFormSchema } from './index';
32 import { useI18n } from '/@/hooks/web/useI18n'; 88 import { useI18n } from '/@/hooks/web/useI18n';
33 import { Button, Tag } from 'ant-design-vue'; 89 import { Button, Tag } from 'ant-design-vue';
  90 + import {useModal} from "/@/components/Modal";
  91 + import {useMessage} from "/@/hooks/web/useMessage";
34 const { t } = useI18n(); 92 const { t } = useI18n();
  93 + const [registerModal, { openModal }] = useModal();
  94 + const { createMessage } = useMessage();
35 95
36 const [ 96 const [
37 registerTable, 97 registerTable,
@@ -62,4 +122,56 @@ @@ -62,4 +122,56 @@
62 getCheckboxProps: (record: any) => {}, 122 getCheckboxProps: (record: any) => {},
63 }, 123 },
64 }); 124 });
  125 +
  126 + // 新增
  127 + const handleCreate = () => {
  128 + openModal(true, {
  129 + isUpdate: false,
  130 + });
  131 + };
  132 +
  133 + const handleReload = () => {
  134 + setSelectedRowKeys([]);
  135 + reload();
  136 + };
  137 +
  138 + const handleDelete = async (record?: any) => {
  139 + let id = record.id;
  140 + try {
  141 + setLoading(true);
  142 + await deleteServePlan({ id });
  143 + createMessage.success(t('common.deleteSuccessText'));
  144 + handleReload();
  145 + } catch (error) {
  146 + throw error;
  147 + } finally {
  148 + setLoading(false);
  149 + }
  150 + };
  151 +
  152 + const handleUpdateStatus = async (record?: any,value?: string) => {
  153 + let id = record.id;
  154 + let status = '';
  155 + if (record.status === 'NOTSTART') {
  156 + status = 'UNDERWAY'
  157 + }else if(record.status === 'UNDERWAY'){
  158 + status = 'COMPLETED'
  159 + }else if(record.status === 'COMPLETED'){
  160 + status = 'STOP'
  161 + }
  162 + if (value === 'STOP') {
  163 + status = 'STOP'
  164 + }
  165 + try {
  166 + setLoading(true);
  167 + await updateServiceStatus({ id,status });
  168 + createMessage.success(t('common.editSuccessText'));
  169 + handleReload();
  170 + } catch (error) {
  171 + throw error;
  172 + } finally {
  173 + setLoading(false);
  174 + }
  175 + }
  176 +
65 </script> 177 </script>
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
2 import { useI18n } from '/@/hooks/web/useI18n'; 2 import { useI18n } from '/@/hooks/web/useI18n';
3 import { BasicColumn } from '/@/components/Table'; 3 import { BasicColumn } from '/@/components/Table';
4 -import moment from "moment"; 4 +import {getServicePlanList} from "../../../api/inspection/servicePlan";
5 const { t } = useI18n(); 5 const { t } = useI18n();
6 6
7 7
@@ -12,23 +12,40 @@ const statusOptions = [ @@ -12,23 +12,40 @@ const statusOptions = [
12 12
13 export const searchFormSchema: FormSchema[] = [ 13 export const searchFormSchema: FormSchema[] = [
14 { 14 {
  15 + field: 'preservePlanId',
  16 + label: t('inspection.serviceRecord.planText'),
  17 + component: 'ApiSelect',
  18 + colProps: { span: 6 },
  19 + componentProps: {
  20 + api: getServicePlanList,
  21 + params: {
  22 + page: 1,
  23 + pageSize: 999,
  24 + },
  25 + resultField: 'items',
  26 + labelField: 'preserveName',
  27 + valueField: 'id',
  28 + },
  29 + },
  30 + {
15 field: 'preserveStatus', 31 field: 'preserveStatus',
16 label: t('inspection.serviceRecord.preserveNameText'), 32 label: t('inspection.serviceRecord.preserveNameText'),
17 component: 'Select', 33 component: 'Select',
18 - colProps: { span: 8 }, 34 + colProps: { span: 6 },
19 componentProps: { 35 componentProps: {
20 options: statusOptions, 36 options: statusOptions,
21 }, 37 },
22 }, 38 },
23 { 39 {
24 field: 'startDate', 40 field: 'startDate',
25 - label: t('inspection.serviceRecord.time'),  
26 - component: 'RangePicker',  
27 - componentProps: {  
28 - showTime: {  
29 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
30 - },  
31 - }, 41 + label: t('inspection.serviceRecord.startTime'),
  42 + component: 'DatePicker',
  43 + colProps: { span: 6 },
  44 + },
  45 + {
  46 + field: 'endDate',
  47 + label: t('inspection.serviceRecord.endTime'),
  48 + component: 'DatePicker',
32 colProps: { span: 6 }, 49 colProps: { span: 6 },
33 }, 50 },
34 ]; 51 ];
@@ -20,16 +20,40 @@ @@ -20,16 +20,40 @@
20 {{ t(`inspection.serviceRecord.${record.preserveStatus}`) }} 20 {{ t(`inspection.serviceRecord.${record.preserveStatus}`) }}
21 </Tag> 21 </Tag>
22 </template> 22 </template>
  23 + <template #action="{ record }">
  24 + <TableAction
  25 + :actions="[
  26 + {
  27 + label: t('common.editText'),
  28 + auth: 'api:yt:product:category:update',
  29 + icon: 'clarity:note-edit-line',
  30 + // onClick: handleEdit.bind(null, record),
  31 + },
  32 + {
  33 + label: t('common.delText'),
  34 + auth: 'api:yt:product:category:delete',
  35 + icon: 'ant-design:delete-outlined',
  36 + color: 'error',
  37 + popConfirm: {
  38 + title: t('common.deleteConfirmText'),
  39 + confirm: handleDelete.bind(null, record),
  40 + },
  41 + },
  42 + ]"
  43 + />
  44 + </template>
23 </BasicTable> 45 </BasicTable>
24 </div> 46 </div>
25 </template> 47 </template>
26 <script setup lang="ts"> 48 <script setup lang="ts">
27 -import { BasicTable, useTable } from '/@/components/Table';  
28 -import { getServiceRecordList } from '/@/api/inspection/serviceRecord'; 49 +import { BasicTable, useTable, TableAction } from '/@/components/Table';
  50 +import { getServiceRecordList, deleteServeRecord } from '/@/api/inspection/serviceRecord';
29 import { columns, searchFormSchema } from './index'; 51 import { columns, searchFormSchema } from './index';
30 import { useI18n } from '/@/hooks/web/useI18n'; 52 import { useI18n } from '/@/hooks/web/useI18n';
31 import { Button, Tag } from 'ant-design-vue'; 53 import { Button, Tag } from 'ant-design-vue';
  54 +import {useMessage} from "/@/hooks/web/useMessage";
32 const { t } = useI18n(); 55 const { t } = useI18n();
  56 +const { createMessage } = useMessage();
33 57
34 const [ 58 const [
35 registerTable, 59 registerTable,
@@ -60,4 +84,24 @@ const [ @@ -60,4 +84,24 @@ const [
60 getCheckboxProps: (record: any) => {}, 84 getCheckboxProps: (record: any) => {},
61 }, 85 },
62 }); 86 });
  87 +
  88 +const handleDelete = async (record?: any) => {
  89 + let id = record.id;
  90 + try {
  91 + setLoading(true);
  92 + await deleteServeRecord({ id });
  93 + createMessage.success(t('common.deleteSuccessText'));
  94 + handleReload();
  95 + } catch (error) {
  96 + throw error;
  97 + } finally {
  98 + setLoading(false);
  99 + }
  100 +};
  101 +
  102 +const handleReload = () => {
  103 + setSelectedRowKeys([]);
  104 + reload();
  105 +};
  106 +
63 </script> 107 </script>
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
2 import { useI18n } from '/@/hooks/web/useI18n'; 2 import { useI18n } from '/@/hooks/web/useI18n';
3 import { BasicColumn } from '/@/components/Table'; 3 import { BasicColumn } from '/@/components/Table';
  4 +import {getRepairOrderList} from "../../../api/repair/order";
4 const { t } = useI18n(); 5 const { t } = useI18n();
5 6
6 export const columns: BasicColumn[] = [ 7 export const columns: BasicColumn[] = [
7 { 8 {
8 title: t('repair.history.orderCode'), 9 title: t('repair.history.orderCode'),
9 - dataIndex: 'tkRepairOrderDTO',  
10 - // format: (text,record) => {  
11 - // return record.orderCode;  
12 - // }, 10 + dataIndex: 'code',
13 }, 11 },
14 { 12 {
15 title: t('repair.history.orderText'), 13 title: t('repair.history.orderText'),
16 dataIndex: 'tkRepairOrderDTO', 14 dataIndex: 'tkRepairOrderDTO',
17 - // format: (text,record) => {  
18 - // return record.orderCode;  
19 - // }, 15 + format: (text, record) => {
  16 + return record.tkRepairOrderDTO?.orderCode || '-' || text;
  17 + },
20 }, 18 },
21 { 19 {
22 title: t('repair.history.deviceNameText'), 20 title: t('repair.history.deviceNameText'),
23 - dataIndex: 'reportDate', 21 + dataIndex: 'deviceAccountName',
24 }, 22 },
25 { 23 {
26 title: t('repair.history.time'), 24 title: t('repair.history.time'),
27 - dataIndex: 'time', 25 + dataIndex: 'tkRepairOrderDTO',
  26 + format: (text, record) => {
  27 + return record.tkRepairOrderDTO?.reportDate || '-' || text;
  28 + },
28 }, 29 },
29 { 30 {
30 title: t('repair.history.reportByName'), 31 title: t('repair.history.reportByName'),
31 - dataIndex: 'reportByName', 32 + dataIndex: 'tkRepairOrderDTO',
  33 + format: (text, record) => {
  34 + return record.tkRepairOrderDTO?.reportByName || '-' || text;
  35 + },
32 }, 36 },
33 { 37 {
34 title: t('repair.history.photo'), 38 title: t('repair.history.photo'),
35 - dataIndex: 'photo', 39 + dataIndex: 'tkRepairOrderDTO',
  40 + format: (text, record) => {
  41 + return record.tkRepairOrderDTO?.situationImg || '-' || text;
  42 + },
36 }, 43 },
37 { 44 {
38 title: t('repair.history.description'), 45 title: t('repair.history.description'),
@@ -40,23 +47,15 @@ export const columns: BasicColumn[] = [ @@ -40,23 +47,15 @@ export const columns: BasicColumn[] = [
40 }, 47 },
41 { 48 {
42 title: t('repair.history.repairTime'), 49 title: t('repair.history.repairTime'),
43 - dataIndex: 'repairTime',  
44 - slots: { customRender: 'repairTime' }, 50 + dataIndex: 'repairDate',
45 }, 51 },
46 { 52 {
47 title: t('repair.history.repairByName'), 53 title: t('repair.history.repairByName'),
48 - dataIndex: 'repairByName',  
49 - slots: { customRender: 'repairByName' }, 54 + dataIndex: 'repairName',
50 }, 55 },
51 { 56 {
52 title: t('repair.history.repairReason'), 57 title: t('repair.history.repairReason'),
53 - dataIndex: 'repairReason',  
54 - slots: { customRender: 'repairReason' },  
55 - },  
56 - {  
57 - title: t('repair.history.repairDescription'),  
58 - dataIndex: 'repairDescription',  
59 - slots: { customRender: 'repairDescription' }, 58 + dataIndex: 'malfunctionReasonName',
60 }, 59 },
61 ]; 60 ];
62 61
@@ -64,7 +63,17 @@ export const searchFormSchema: FormSchema[] = [ @@ -64,7 +63,17 @@ export const searchFormSchema: FormSchema[] = [
64 { 63 {
65 field: 'orderId', 64 field: 'orderId',
66 label: t('repair.history.orderText'), 65 label: t('repair.history.orderText'),
67 - component: 'Select', 66 + component: 'ApiSelect',
68 colProps: { span: 6 }, 67 colProps: { span: 6 },
  68 + componentProps: {
  69 + api: getRepairOrderList,
  70 + params: {
  71 + page: 1,
  72 + pageSize: 999,
  73 + },
  74 + resultField: 'items',
  75 + labelField: 'orderCode',
  76 + valueField: 'id',
  77 + },
69 }, 78 },
70 ]; 79 ];
  1 +import { FormSchema } from '/@/components/Form';
  2 +import { useI18n } from '/@/hooks/web/useI18n';
  3 +import {uploadThumbnail} from "/@/api/configuration/center/configurationCenter";
  4 +import {createImgPreview} from "/@/components/Preview";
  5 +
  6 +const { t } = useI18n();
  7 +const statusOptions = [
  8 + { label: t('repair.order.SCHEDULING'), value: 'SCHEDULING' },
  9 + { label: t('repair.order.REPAIRFINISH'), value: 'REPAIRFINISH' },
  10 + { label: t('repair.order.ACCEPTANCEPASSED'), value: 'ACCEPTANCEPASSED' },
  11 +];
  12 +const emergencyOptions = [
  13 + { label: '是', value: true },
  14 + { label: '否', value: false },
  15 +];
  16 +export const formSchema: FormSchema[] = [
  17 + {
  18 + field: 'situationImg',
  19 + label: t('deviceManagement.product.imageText'),
  20 + component: 'ApiUpload',
  21 + changeEvent: 'update:fileList',
  22 + valueField: 'fileList',
  23 + componentProps: ({ formModel }) => {
  24 + return {
  25 + disabled: 'disabled',
  26 + listType: 'picture-card',
  27 + maxFileLimit: 1,
  28 + accept: '.png,.jpg,.jpeg,.gif',
  29 + api: async (file: File) => {
  30 + try {
  31 + const formData = new FormData();
  32 + formData.set('file', file);
  33 + const { fileStaticUri, fileName } = await uploadThumbnail(formData);
  34 + return {
  35 + uid: fileStaticUri,
  36 + name: fileName,
  37 + url: fileStaticUri,
  38 + };
  39 + } catch (error) {
  40 + return {};
  41 + }
  42 + },
  43 + onPreview: (fileList) => {
  44 + createImgPreview({ imageList: [fileList.url!] });
  45 + },
  46 + onDelete(url: string) {
  47 + formModel.deleteUrl = url!;
  48 + },
  49 + };
  50 + },
  51 + },
  52 + {
  53 + field: 'orderCode',
  54 + label: t('repair.order.nameCode'),
  55 + component: 'Input',
  56 + colProps: { span: 21 },
  57 + required: true,
  58 + componentProps: {
  59 + disabled: 'disabled',
  60 + maxLength: 20,
  61 + },
  62 + },
  63 + {
  64 + field: 'deviceId',
  65 + label: t('repair.order.deviceNameText'),
  66 + component: 'Input',
  67 + colProps: { span: 21 },
  68 + required: true,
  69 + componentProps: {
  70 + disabled: 'disabled',
  71 + maxLength: 20,
  72 + },
  73 + },
  74 + {
  75 + field: 'reportBy',
  76 + component: 'Input',
  77 + label: '报修人',
  78 + required: true,
  79 + colProps: { span: 21 },
  80 + componentProps: {
  81 + disabled: 'disabled',
  82 + // 动态加载的选项
  83 + options: [], // 初始为空,后续动态加载
  84 + },
  85 + },
  86 + {
  87 + field: 'reportDate',
  88 + label: t('repair.order.time'),
  89 + component: 'DatePicker',
  90 + componentProps: {
  91 + disabled: 'disabled',
  92 + showTime: true,
  93 + format: 'YYYY-MM-DD HH:mm:ss',
  94 + },
  95 + },
  96 + {
  97 + field: 'status',
  98 + label: t('repair.order.statusText'),
  99 + component: 'RadioButtonGroup',
  100 + defaultValue: 'ENABLE',
  101 + componentProps: {
  102 + disabled: 'disabled',
  103 + options: statusOptions,
  104 + },
  105 + },
  106 + {
  107 + field: 'emergency',
  108 + label: t('repair.order.emergencyText'),
  109 + component: 'Select',
  110 + colProps: { span: 21 },
  111 + required: true,
  112 + componentProps: {
  113 + disabled: 'disabled',
  114 + options: emergencyOptions,
  115 + },
  116 + },
  117 + {
  118 + field: 'description',
  119 + label: '故障描述',
  120 + colProps: { span: 21 },
  121 + component: 'InputTextArea',
  122 + componentProps: {
  123 + disabled: 'disabled',
  124 + maxLength: 255,
  125 + placeholder: '请输入描述',
  126 + },
  127 + },
  128 +
  129 +];
  1 +export { default as FormDrawer } from './index.vue';
  1 +<script lang="ts" setup>
  2 + import { nextTick, ref, unref, computed } from 'vue';
  3 + import { BasicForm, useForm } from '/@/components/Form';
  4 + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  5 + import { formSchema } from './config';
  6 + import { useMessage } from '/@/hooks/web/useMessage';
  7 + import { useI18n } from '/@/hooks/web/useI18n';
  8 + import { JSONEditor } from '/@/components/CodeEditor';
  9 + import { ApplicationApiItemType } from '/@/api/application/model/api';
  10 +
  11 + const emits = defineEmits(['success', 'register']);
  12 +
  13 + const { t } = useI18n();
  14 +
  15 + const { createMessage } = useMessage();
  16 +
  17 + const handleCount = ref<Number>(); // 0 新增 1 编辑 2 详情
  18 +
  19 + const recordData = ref<ApplicationApiItemType>();
  20 +
  21 + const [registerForm, { resetFields, validate, setFieldsValue, setProps }] = useForm({
  22 + labelWidth: 120,
  23 + schemas: formSchema,
  24 + showActionButtonGroup: false,
  25 + });
  26 +
  27 + const cacheTitle = computed(() =>
  28 + unref(handleCount) === 0
  29 + ? t('application.api.action.create')
  30 + : unref(handleCount) === 1
  31 + ? t('application.api.action.edit')
  32 + : t('application.api.action.detail')
  33 + );
  34 +
  35 + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
  36 + setDrawerProps({ loading: true });
  37 + await resetFields();
  38 + handleCount.value = data.isUpdate;
  39 + recordData.value = data.record;
  40 + if (unref(handleCount) === 2) {
  41 + setProps({ disabled: true });
  42 + } else {
  43 + setProps({ disabled: false });
  44 + }
  45 + try {
  46 + await nextTick();
  47 + setFieldsValue(data.record);
  48 + } finally {
  49 + setDrawerProps({ loading: false });
  50 + }
  51 + });
  52 +
  53 +
  54 +</script>
  55 +
  56 +<template>
  57 + <div>
  58 + <BasicDrawer
  59 + destroyOnClose
  60 + v-bind="$attrs"
  61 + :showFooter="handleCount !== 2"
  62 + :title="cacheTitle"
  63 + width="30%"
  64 + :maskClosable="true"
  65 + @register="registerDrawer"
  66 + >
  67 + <BasicForm @register="registerForm">
  68 + <template #interfaceParamsSlot="{ model, field }">
  69 + <JSONEditor v-model:value="model[field]" />
  70 + </template>
  71 + </BasicForm>
  72 + </BasicDrawer>
  73 + </div>
  74 +</template>
  75 +
  76 +<style lang="less" scoped></style>
  1 +import orderModal from './orderModal.vue';
  2 +
  3 +export { orderModal };
  1 +<template>
  2 + <div>
  3 + <BasicModal
  4 + v-bind="$attrs"
  5 + width="30rem"
  6 + :title="getTitle"
  7 + @register="register"
  8 + @cancel="handleCancel"
  9 + @ok="handleOk"
  10 + destroyOnClose
  11 + >
  12 + <div>
  13 + <BasicForm @register="registerForm" />
  14 + </div>
  15 + </BasicModal>
  16 + </div>
  17 +</template>
  18 +<script setup lang="ts">
  19 +import {BasicModal, useModalInner} from "/@/components/Modal";
  20 +import {BasicForm, useForm} from "/@/components/Form";
  21 +import {computed, ref, unref} from "vue";
  22 +import {useI18n} from "/@/hooks/web/useI18n";
  23 +import {schemas} from "../index";
  24 +import {getUserListByOrg} from "/@/api/equipment/ledger";
  25 +import {useUserStore} from "/@/store/modules/user";
  26 +import {saveOrder} from "/@/api/repair/order";
  27 +import {useMessage} from "/@/hooks/web/useMessage";
  28 +const { t } = useI18n();
  29 +const isUpdate = ref<Boolean>(false);
  30 +const recordInfo = ref<any>({});
  31 +// 定义人员选项
  32 +const userOptions = ref<any[]>([]);
  33 +const userInfo = useUserStore();
  34 +const { createMessage } = useMessage();
  35 +
  36 +const emit = defineEmits(['handleReload', 'register']);
  37 +
  38 +const getTitle = computed(() =>
  39 + !unref(isUpdate)
  40 + ? t('repair.order.createOrderText')
  41 + : t('repair.order.editOrderText')
  42 +);
  43 +
  44 +const [registerForm, { getFieldsValue, setFieldsValue, validate,updateSchema }] = useForm({
  45 + labelWidth: 140,
  46 + schemas,
  47 + actionColOptions: {
  48 + span: 14,
  49 + },
  50 + showActionButtonGroup: false,
  51 +});
  52 +
  53 +const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
  54 + setModalProps({ confirmLoading: false, loading: true });
  55 + isUpdate.value = data?.isUpdate;
  56 + recordInfo.value = data?.record;
  57 + // 更新 formSchema 中的 org 字段,绑定 change 事件
  58 + updateSchema({
  59 + field: 'org',
  60 + componentProps: {
  61 + onChange: handleOrgChange,
  62 + },
  63 + });
  64 + if (data?.record) {
  65 + setFieldsValue(data?.record);
  66 + }
  67 + setModalProps({ loading: false });
  68 +});
  69 +
  70 +// 监听 org 字段的变化
  71 +const handleOrgChange = async (orgId: string) => {
  72 + if (!orgId) {
  73 + userOptions.value = []; // 清空人员选项
  74 + updateSchema({
  75 + field: 'reportBy',
  76 + componentProps: { options: [] },
  77 + });
  78 + return;
  79 + }
  80 + const _data = {
  81 + page: '1',
  82 + pageSize: '999',
  83 + tenantId: userInfo.getUserInfo.tenantId!,
  84 + organizationId: orgId
  85 + }
  86 + // 调用接口 B 获取人员数据
  87 + const userList = await getUserListByOrg(_data);
  88 + userOptions.value = userList?.items.map(user => ({
  89 + label: user.username,
  90 + value: user.id,
  91 + }));
  92 +
  93 + // 更新 user 字段的选项
  94 + updateSchema({
  95 + field: 'reportBy',
  96 + componentProps: { options: userOptions.value },
  97 + });
  98 +};
  99 +
  100 +
  101 +const handleCancel = () => {
  102 + closeModal();
  103 +};
  104 +
  105 +const handleOk = async () => {
  106 + await validate();
  107 + let values = getFieldsValue();
  108 + if (unref(isUpdate)) {
  109 + values = { ...values, id: unref(recordInfo).id, situationImg: values.situationImg?.[0]?.url};
  110 + }else {
  111 + values = { ...values, situationImg: values.situationImg?.[0]?.url};
  112 + }
  113 + await saveOrder(values);
  114 + createMessage.success(t('common.operationSuccessText'));
  115 + emit('handleReload');
  116 + handleCancel();
  117 +};
  118 +
  119 +</script>
1 -import { FormSchema } from '/@/components/Form'; 1 +import { FormSchema, useComponentRegister } from '/@/components/Form';
2 import { useI18n } from '/@/hooks/web/useI18n'; 2 import { useI18n } from '/@/hooks/web/useI18n';
3 import { BasicColumn } from '/@/components/Table'; 3 import { BasicColumn } from '/@/components/Table';
4 -import moment from 'moment/moment'; 4 +import {getLedgerList} from "/@/api/equipment/ledger";
5 const { t } = useI18n(); 5 const { t } = useI18n();
  6 +import { OrgTreeSelect } from '../../common/OrgTreeSelect';
  7 +import {uploadThumbnail} from "/@/api/configuration/center/configurationCenter";
  8 +import {createImgPreview} from "/@/components/Preview";
  9 +useComponentRegister('OrgTreeSelect', OrgTreeSelect);
6 10
7 const statusOptions = [ 11 const statusOptions = [
8 { label: t('repair.order.SCHEDULING'), value: 'SCHEDULING' }, 12 { label: t('repair.order.SCHEDULING'), value: 'SCHEDULING' },
9 { label: t('repair.order.REPAIRFINISH'), value: 'REPAIRFINISH' }, 13 { label: t('repair.order.REPAIRFINISH'), value: 'REPAIRFINISH' },
10 { label: t('repair.order.ACCEPTANCEPASSED'), value: 'ACCEPTANCEPASSED' }, 14 { label: t('repair.order.ACCEPTANCEPASSED'), value: 'ACCEPTANCEPASSED' },
11 ]; 15 ];
12 -const typeOptions = [  
13 - { label: t('repair.order.inspectionText'), value: 'INSPECTION' },  
14 - { label: t('repair.order.maintenanceText'), value: 'MAINTENANCE' }, 16 +const emergencyOptions = [
  17 + { label: '是', value: true },
  18 + { label: '否', value: false },
15 ]; 19 ];
16 20
17 export const columns: BasicColumn[] = [ 21 export const columns: BasicColumn[] = [
@@ -52,8 +56,18 @@ export const searchFormSchema: FormSchema[] = [ @@ -52,8 +56,18 @@ export const searchFormSchema: FormSchema[] = [
52 { 56 {
53 field: 'deviceId', 57 field: 'deviceId',
54 label: t('repair.order.deviceNameText'), 58 label: t('repair.order.deviceNameText'),
55 - component: 'Select', 59 + component: 'ApiSelect',
56 colProps: { span: 6 }, 60 colProps: { span: 6 },
  61 + componentProps: {
  62 + api: getLedgerList,
  63 + params: {
  64 + page: 1,
  65 + pageSize: 999,
  66 + },
  67 + resultField: 'items',
  68 + labelField: 'name',
  69 + valueField: 'id',
  70 + },
57 }, 71 },
58 { 72 {
59 field: 'status', 73 field: 'status',
@@ -63,23 +77,46 @@ export const searchFormSchema: FormSchema[] = [ @@ -63,23 +77,46 @@ export const searchFormSchema: FormSchema[] = [
63 componentProps: { 77 componentProps: {
64 options: statusOptions, 78 options: statusOptions,
65 }, 79 },
66 - },  
67 - {  
68 - field: 'startDate',  
69 - label: t('repair.order.time'),  
70 - component: 'RangePicker',  
71 - componentProps: {  
72 - showTime: {  
73 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
74 - },  
75 - },  
76 - colProps: { span: 6 },  
77 - }, 80 + }
78 ]; 81 ];
79 82
80 export const schemas: FormSchema[] = [ 83 export const schemas: FormSchema[] = [
81 { 84 {
82 - field: 'code', 85 + field: 'situationImg',
  86 + label: t('deviceManagement.product.imageText'),
  87 + component: 'ApiUpload',
  88 + changeEvent: 'update:fileList',
  89 + valueField: 'fileList',
  90 + componentProps: ({ formModel }) => {
  91 + return {
  92 + listType: 'picture-card',
  93 + maxFileLimit: 1,
  94 + accept: '.png,.jpg,.jpeg,.gif',
  95 + api: async (file: File) => {
  96 + try {
  97 + const formData = new FormData();
  98 + formData.set('file', file);
  99 + const { fileStaticUri, fileName } = await uploadThumbnail(formData);
  100 + return {
  101 + uid: fileStaticUri,
  102 + name: fileName,
  103 + url: fileStaticUri,
  104 + };
  105 + } catch (error) {
  106 + return {};
  107 + }
  108 + },
  109 + onPreview: (fileList) => {
  110 + createImgPreview({ imageList: [fileList.url!] });
  111 + },
  112 + onDelete(url: string) {
  113 + formModel.deleteUrl = url!;
  114 + },
  115 + };
  116 + },
  117 + },
  118 + {
  119 + field: 'orderCode',
83 label: t('repair.order.nameCode'), 120 label: t('repair.order.nameCode'),
84 component: 'Input', 121 component: 'Input',
85 colProps: { span: 21 }, 122 colProps: { span: 21 },
@@ -89,22 +126,54 @@ export const schemas: FormSchema[] = [ @@ -89,22 +126,54 @@ export const schemas: FormSchema[] = [
89 }, 126 },
90 }, 127 },
91 { 128 {
92 - field: 'name',  
93 - label: t('repair.order.nameText'),  
94 - component: 'Input', 129 + field: 'deviceId',
  130 + label: t('repair.order.deviceNameText'),
  131 + component: 'ApiSelect',
95 colProps: { span: 21 }, 132 colProps: { span: 21 },
96 required: true, 133 required: true,
97 componentProps: { 134 componentProps: {
98 - maxLength: 20, 135 + api: getLedgerList,
  136 + params: {
  137 + page: 1,
  138 + pageSize: 999,
  139 + },
  140 + resultField: 'items',
  141 + labelField: 'name',
  142 + valueField: 'id',
99 }, 143 },
100 }, 144 },
101 { 145 {
102 - field: 'type',  
103 - label: t('repair.order.typeText'),  
104 - component: 'RadioButtonGroup',  
105 - defaultValue: 'INSPECTION', 146 + field: 'org',
  147 + component: 'OrgTreeSelect',
  148 + label: '报修人组织',
  149 + required: true,
  150 + colProps: { span: 24 },
106 componentProps: { 151 componentProps: {
107 - options: typeOptions, 152 + // 添加 change 事件
  153 + onChange: (value: string) => {
  154 + // 这里需要触发加载人员数据的逻辑
  155 + console.log(value,'value')
  156 + },
  157 + },
  158 + },
  159 + {
  160 + field: 'reportBy',
  161 + component: 'Select',
  162 + label: '报修人',
  163 + required: true,
  164 + colProps: { span: 21 },
  165 + componentProps: {
  166 + // 动态加载的选项
  167 + options: [], // 初始为空,后续动态加载
  168 + },
  169 + },
  170 + {
  171 + field: 'reportDate',
  172 + label: t('repair.order.time'),
  173 + component: 'DatePicker',
  174 + componentProps: {
  175 + showTime: true,
  176 + format: 'YYYY-MM-DD HH:mm:ss',
108 }, 177 },
109 }, 178 },
110 { 179 {
@@ -117,13 +186,23 @@ export const schemas: FormSchema[] = [ @@ -117,13 +186,23 @@ export const schemas: FormSchema[] = [
117 }, 186 },
118 }, 187 },
119 { 188 {
120 - field: 'planDetails',  
121 - label: t('repair.order.nameDetail'),  
122 - component: 'InputTextArea', 189 + field: 'emergency',
  190 + label: t('repair.order.emergencyText'),
  191 + component: 'Select',
123 colProps: { span: 21 }, 192 colProps: { span: 21 },
124 required: true, 193 required: true,
125 componentProps: { 194 componentProps: {
126 - maxLength: 200, 195 + options: emergencyOptions,
  196 + },
  197 + },
  198 + {
  199 + field: 'description',
  200 + label: '故障描述',
  201 + colProps: { span: 21 },
  202 + component: 'InputTextArea',
  203 + componentProps: {
  204 + maxLength: 255,
  205 + placeholder: '请输入描述',
127 }, 206 },
128 }, 207 },
129 ]; 208 ];
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 <BasicTable style="flex: auto" @register="registerTable"> 3 <BasicTable style="flex: auto" @register="registerTable">
4 <template #toolbar> 4 <template #toolbar>
5 <Authority value="api:yt:product:category:post"> 5 <Authority value="api:yt:product:category:post">
6 - <Button type="primary">  
7 - {{ t('repair.order.createCategoryText') }} 6 + <Button type="primary" @click="handleCreate">
  7 + {{ t('repair.order.createOrderText') }}
8 </Button> 8 </Button>
9 </Authority> 9 </Authority>
10 </template> 10 </template>
@@ -30,10 +30,43 @@ @@ -30,10 +30,43 @@
30 {{ record.emergency ? '是' : '否' }} 30 {{ record.emergency ? '是' : '否' }}
31 </Tag> 31 </Tag>
32 </template> 32 </template>
  33 + <template #action="{ record }">
  34 + <TableAction
  35 + :actions="[
  36 + // {
  37 + // label: t('common.detailText'),
  38 + // icon: 'ant-design:eye-outlined',
  39 + // auth: 'api:yt:product:category:get',
  40 + // onClick: handleDetail.bind(null, record),
  41 + // },
  42 + {
  43 + label: t('common.editText'),
  44 + auth: 'api:yt:product:category:update',
  45 + icon: 'clarity:note-edit-line',
  46 + onClick: handleEdit.bind(null, record),
  47 + },
  48 + {
  49 + label: t('common.delText'),
  50 + auth: 'api:yt:product:category:delete',
  51 + icon: 'ant-design:delete-outlined',
  52 + color: 'error',
  53 + popConfirm: {
  54 + title: t('common.deleteConfirmText'),
  55 + confirm: handleDelete.bind(null, record),
  56 + },
  57 + },
  58 + ]"
  59 + />
  60 + </template>
33 </BasicTable> 61 </BasicTable>
  62 + <orderModal @register="registerModal" @handleReload="handleReload" />
  63 + <FormDrawer
  64 + @register="registerApplicationApiFormDrawer"
  65 + />
34 </div> 66 </div>
35 </template> 67 </template>
36 <script setup lang="ts"> 68 <script setup lang="ts">
  69 + import { orderModal } from "./components/index"
37 import { BasicTable, TableAction } from '/@/components/Table'; 70 import { BasicTable, TableAction } from '/@/components/Table';
38 import { useTable } from '/@/components/Table'; 71 import { useTable } from '/@/components/Table';
39 import { getRepairOrderList } from '/@/api/repair/order'; 72 import { getRepairOrderList } from '/@/api/repair/order';
@@ -41,7 +74,15 @@ @@ -41,7 +74,15 @@
41 import { useI18n } from '/@/hooks/web/useI18n'; 74 import { useI18n } from '/@/hooks/web/useI18n';
42 import { Button, Tag } from 'ant-design-vue'; 75 import { Button, Tag } from 'ant-design-vue';
43 import { Authority } from '/@/components/Authority'; 76 import { Authority } from '/@/components/Authority';
  77 + import {useModal} from "/@/components/Modal";
44 const { t } = useI18n(); 78 const { t } = useI18n();
  79 + const [registerModal, { openModal }] = useModal();
  80 + import {FormDrawer} from "./components/FormDrawer/index";
  81 + import {useDrawer} from "/@/components/Drawer";
  82 + import {deleteRepairOrder} from "/@/api/repair/order";
  83 + import {useMessage} from "/@/hooks/web/useMessage";
  84 + const [registerApplicationApiFormDrawer, { openDrawer }] = useDrawer();
  85 + const { createMessage } = useMessage();
45 86
46 const [ 87 const [
47 registerTable, 88 registerTable,
@@ -72,4 +113,46 @@ @@ -72,4 +113,46 @@
72 getCheckboxProps: (record: any) => {}, 113 getCheckboxProps: (record: any) => {},
73 }, 114 },
74 }); 115 });
  116 +
  117 + const handleReload = () => {
  118 + setSelectedRowKeys([]);
  119 + reload();
  120 + };
  121 +
  122 + // 新增
  123 + const handleCreate = () => {
  124 + openModal(true, {
  125 + isUpdate: false,
  126 + });
  127 + };
  128 +
  129 + const handleDetail = (record?: any) => {
  130 + openDrawer(true, {
  131 + isUpdate: 2,
  132 + record,
  133 + });
  134 + };
  135 +
  136 + // 编辑
  137 + const handleEdit = (record?: any) => {
  138 + openModal(true, {
  139 + isUpdate: true,
  140 + record,
  141 + });
  142 + };
  143 +
  144 + const handleDelete = async (record?: any) => {
  145 + let id = record.id;
  146 + try {
  147 + setLoading(true);
  148 + await deleteRepairOrder({ id });
  149 + createMessage.success(t('common.deleteSuccessText'));
  150 + handleReload();
  151 + } catch (error) {
  152 + throw error;
  153 + } finally {
  154 + setLoading(false);
  155 + }
  156 + };
  157 +
75 </script> 158 </script>