|
|
@@ -39,6 +39,7 @@ import {
|
|
39
|
39
|
querysubItembaseApilist,
|
|
40
|
40
|
querytagbaseApilist,
|
|
41
|
41
|
saveApi,
|
|
|
42
|
+ queryinspectionItemDetailApi,
|
|
42
|
43
|
} from '#/api/system/tasksettings/checktheform';
|
|
43
|
44
|
import TinymceEditor from '#/components/tinymce/src/editor.vue';
|
|
44
|
45
|
import { getUploadAction } from '#/components/upload/config';
|
|
|
@@ -107,6 +108,18 @@ const init = async () => {
|
|
107
|
108
|
await taglistfn();
|
|
108
|
109
|
};
|
|
109
|
110
|
|
|
|
111
|
+const queryinspectionItemDetail = async (id: number) => {
|
|
|
112
|
+ try {
|
|
|
113
|
+ const res = await queryinspectionItemDetailApi(id);
|
|
|
114
|
+ console.log('检查项详情', res);
|
|
|
115
|
+ // if (res) {
|
|
|
116
|
+ // editForm = res;
|
|
|
117
|
+ // }
|
|
|
118
|
+ } catch (error) {
|
|
|
119
|
+ console.error('查询检查项详情失败:', error);
|
|
|
120
|
+ }
|
|
|
121
|
+};
|
|
|
122
|
+
|
|
110
|
123
|
// 检测 id 变化
|
|
111
|
124
|
watch(
|
|
112
|
125
|
() => route.query.id,
|
|
|
@@ -184,7 +197,7 @@ const editForm = reactive({
|
|
184
|
197
|
// exampleImagelist: [],
|
|
185
|
198
|
// 富文本内容
|
|
186
|
199
|
checkDescription: '',
|
|
187
|
|
-});
|
|
|
200
|
+}) as any;
|
|
188
|
201
|
|
|
189
|
202
|
// 表单验证规则
|
|
190
|
203
|
const editFormRules = reactive({
|
|
|
@@ -276,35 +289,21 @@ async function deleteSubItem(subItem: SubItem) {
|
|
276
|
289
|
function addCheckItem() {
|
|
277
|
290
|
editType.value = 'addcheck';
|
|
278
|
291
|
editDrawerVisible.value = true;
|
|
279
|
|
- editForm.id = '';
|
|
280
|
|
- editForm.name = '';
|
|
281
|
292
|
// 关联子项
|
|
282
|
293
|
editForm.subItemId = selectedSubItemId.value || '';
|
|
283
|
|
- // 检查项名称
|
|
284
|
|
- editForm.itemName = '';
|
|
285
|
|
- editForm.isRandom = '';
|
|
286
|
|
- // 标签
|
|
287
|
|
- editForm.tag = [];
|
|
288
|
|
- // 输入项
|
|
289
|
|
- editForm.hasInput = '';
|
|
290
|
|
- editForm.inputContent = '';
|
|
291
|
|
- // 拍照
|
|
292
|
|
- ishasPhoto.value = false;
|
|
293
|
|
- editForm.hasPhoto = '';
|
|
294
|
|
- editForm.photoPrompt = '';
|
|
295
|
|
- // 检查结果
|
|
296
|
|
- editForm.checkResult = '';
|
|
297
|
|
- editForm.limitScore = '';
|
|
298
|
|
- // 示例图
|
|
299
|
|
- editForm.exampleImage = '';
|
|
300
|
|
- // editForm.exampleImagelist = [];
|
|
301
|
|
- // 富文本内容
|
|
302
|
|
- editForm.checkDescription = '';
|
|
303
|
294
|
}
|
|
304
|
295
|
|
|
305
|
296
|
// 编辑检查项
|
|
306
|
|
-function editCheckItem(checkItem: any) {
|
|
307
|
|
- console.log(checkItem);
|
|
|
297
|
+async function editCheckItem(checkItem: any) {
|
|
|
298
|
+ // console.log(checkItem);
|
|
|
299
|
+ // const aa = "http://192.168.1.33:19000/smart-steward-bucket/comment/20260206/ca63ff81.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=root%2F20260206%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260206T100201Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=99e33fd4c65189bc90e60ca65dad1149f316847d69325484dc6850129427c5d4"
|
|
|
300
|
+ // console.log(aa.split('?')[0].split('/').slice(-3).join('/'));
|
|
|
301
|
+
|
|
|
302
|
+ try {
|
|
|
303
|
+ await queryinspectionItemDetail(checkItem.id);
|
|
|
304
|
+ } catch (error) {
|
|
|
305
|
+ console.error('查询检查项详情失败:', error);
|
|
|
306
|
+ }
|
|
308
|
307
|
ishasPhoto.value = checkItem?.hasPhoto == '2';
|
|
309
|
308
|
|
|
310
|
309
|
editType.value = 'check';
|
|
|
@@ -322,20 +321,26 @@ function editCheckItem(checkItem: any) {
|
|
322
|
321
|
editForm.photoPrompt = checkItem?.photoPrompt || '';
|
|
323
|
322
|
editForm.checkResult = String(checkItem?.checkResult) || '';
|
|
324
|
323
|
editForm.limitScore = checkItem?.limitScore || '';
|
|
325
|
|
- // fileList.value = checkItem?.exampleImagelist|| [];
|
|
326
|
|
- // fileList.value = checkItem?.exampleImage
|
|
327
|
|
- // .split(',')
|
|
328
|
|
- // .map((item: any, index: number) => {
|
|
|
324
|
+ // fileList.value = checkItem?.exampleImageUrl.map(
|
|
|
325
|
+ // (item: any, index: number) => {
|
|
329
|
326
|
// return {
|
|
330
|
|
- // name: item,
|
|
|
327
|
+ // name: item.split('?')[0].split('/').slice(-3).join('/'),
|
|
331
|
328
|
// response: {
|
|
332
|
|
- // fileName: item,
|
|
333
|
|
- // url: item,
|
|
|
329
|
+ // code: 200,
|
|
|
330
|
+ // data: {
|
|
|
331
|
+ // fileName: item.split('?')[0].split('/').slice(-3).join('/'),
|
|
|
332
|
+ // url: item,
|
|
|
333
|
+ // },
|
|
|
334
|
+ // msg: '操作成功',
|
|
334
|
335
|
// },
|
|
|
336
|
+ // url: item,
|
|
335
|
337
|
// status: 'success',
|
|
336
|
338
|
// uid: index + Math.random().toString(36).substring(2),
|
|
337
|
339
|
// };
|
|
338
|
|
- // });
|
|
|
340
|
+ // },
|
|
|
341
|
+ // );
|
|
|
342
|
+ // console.log(fileList.value);
|
|
|
343
|
+
|
|
339
|
344
|
editForm.checkDescription = checkItem?.checkDescription || '';
|
|
340
|
345
|
}
|
|
341
|
346
|
|
|
|
@@ -347,7 +352,7 @@ function saveEdit() {
|
|
347
|
352
|
switch (editType.value) {
|
|
348
|
353
|
case 'addcheck': {
|
|
349
|
354
|
// console.log(editForm);
|
|
350
|
|
- // console.log(fileList.value);
|
|
|
355
|
+ console.log(fileList.value);
|
|
351
|
356
|
// 新增检查项
|
|
352
|
357
|
try {
|
|
353
|
358
|
await addinspectionItemApi({
|
|
|
@@ -433,7 +438,7 @@ function saveEdit() {
|
|
433
|
438
|
case 'sub': {
|
|
434
|
439
|
// 编辑子项
|
|
435
|
440
|
const index = subItems.value.findIndex(
|
|
436
|
|
- (item) => item.id === editForm.id,
|
|
|
441
|
+ (item: any) => item.id === editForm.id,
|
|
437
|
442
|
);
|
|
438
|
443
|
if (index !== -1) {
|
|
439
|
444
|
try {
|
|
|
@@ -528,10 +533,10 @@ async function onDrop(
|
|
528
|
533
|
|
|
529
|
534
|
// 找到被拖拽元素和目标元素的索引(确保id类型一致)
|
|
530
|
535
|
const draggedIndex = items.findIndex(
|
|
531
|
|
- (item) => String(item.id) === String(itemId),
|
|
|
536
|
+ (item: any) => String(item.id) === String(itemId),
|
|
532
|
537
|
);
|
|
533
|
538
|
const targetIndex = items.findIndex(
|
|
534
|
|
- (item) => String(item.id) === String(targetItem.id),
|
|
|
539
|
+ (item: any) => String(item.id) === String(targetItem.id),
|
|
535
|
540
|
);
|
|
536
|
541
|
|
|
537
|
542
|
if (draggedIndex === -1 || targetIndex === -1) {
|
|
|
@@ -548,7 +553,7 @@ async function onDrop(
|
|
548
|
553
|
items.splice(targetIndex, 0, draggedItem);
|
|
549
|
554
|
|
|
550
|
555
|
// 更新所有元素的order属性
|
|
551
|
|
- items.forEach((item, index) => {
|
|
|
556
|
+ items.forEach((item: any, index: any) => {
|
|
552
|
557
|
item.order = index + 1;
|
|
553
|
558
|
});
|
|
554
|
559
|
|
|
|
@@ -558,7 +563,7 @@ async function onDrop(
|
|
558
|
563
|
'到',
|
|
559
|
564
|
targetItem.id,
|
|
560
|
565
|
'新顺序:',
|
|
561
|
|
- items.map((item) => ({
|
|
|
566
|
+ items.map((item: any) => ({
|
|
562
|
567
|
id: item.id,
|
|
563
|
568
|
name: item.name,
|
|
564
|
569
|
order: item.order,
|
|
|
@@ -567,7 +572,7 @@ async function onDrop(
|
|
567
|
572
|
|
|
568
|
573
|
// 保存排序结果到后端(只处理子项)
|
|
569
|
574
|
if (type === 'sub') {
|
|
570
|
|
- const updatePromises = items.map(async (item) => {
|
|
|
575
|
+ const updatePromises = items.map(async (item: any) => {
|
|
571
|
576
|
try {
|
|
572
|
577
|
await editSubItemApi({
|
|
573
|
578
|
id: item.id,
|
|
|
@@ -582,7 +587,7 @@ async function onDrop(
|
|
582
|
587
|
await Promise.all(updatePromises);
|
|
583
|
588
|
await querysubItemlist();
|
|
584
|
589
|
} else {
|
|
585
|
|
- checkItems.value = items.map((item) => {
|
|
|
590
|
+ checkItems.value = items.map((item: any) => {
|
|
586
|
591
|
return {
|
|
587
|
592
|
...item,
|
|
588
|
593
|
sortOrder: item.order,
|
|
|
@@ -601,12 +606,13 @@ const fileList = ref([]) as any;
|
|
601
|
606
|
const dialogImageUrl = ref('');
|
|
602
|
607
|
const dialogVisible = ref(false);
|
|
603
|
608
|
|
|
604
|
|
-const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
|
|
609
|
+const handleRemove = (uploadFile: any, uploadFiles: any) => {
|
|
605
|
610
|
console.log(uploadFile, uploadFiles);
|
|
606
|
611
|
};
|
|
607
|
612
|
|
|
608
|
|
-const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
609
|
|
- dialogImageUrl.value = uploadFile.url!;
|
|
|
613
|
+const handlePictureCardPreview = (uploadFile: any) => {
|
|
|
614
|
+ console.log(uploadFile);
|
|
|
615
|
+ dialogImageUrl.value = uploadFile.url;
|
|
610
|
616
|
dialogVisible.value = true;
|
|
611
|
617
|
};
|
|
612
|
618
|
// 抽屉打开后处理函数
|
|
|
@@ -618,6 +624,39 @@ function handleDrawerOpen() {
|
|
618
|
624
|
drawerContent.scrollTop = 0;
|
|
619
|
625
|
}
|
|
620
|
626
|
}
|
|
|
627
|
+const closeEditDrawer = () => {
|
|
|
628
|
+ console.log('关闭了');
|
|
|
629
|
+ editForm.id = '';
|
|
|
630
|
+ editForm.name = '';
|
|
|
631
|
+ // 关联子项
|
|
|
632
|
+ editForm.subItemId = '';
|
|
|
633
|
+ // 检查项名称
|
|
|
634
|
+ editForm.itemName = '';
|
|
|
635
|
+ editForm.isRandom = '';
|
|
|
636
|
+ // 标签
|
|
|
637
|
+ editForm.tag = [];
|
|
|
638
|
+ // 输入项
|
|
|
639
|
+ editForm.hasInput = '';
|
|
|
640
|
+ editForm.inputContent = '';
|
|
|
641
|
+ // 拍照
|
|
|
642
|
+ ishasPhoto.value = false;
|
|
|
643
|
+ editForm.hasPhoto = '';
|
|
|
644
|
+ editForm.photoPrompt = '';
|
|
|
645
|
+ // 检查结果
|
|
|
646
|
+ editForm.checkResult = '';
|
|
|
647
|
+ editForm.limitScore = '';
|
|
|
648
|
+ // 示例图
|
|
|
649
|
+ editForm.exampleImage = '';
|
|
|
650
|
+ // editForm.exampleImagelist = [];
|
|
|
651
|
+ // 富文本内容
|
|
|
652
|
+ editForm.checkDescription = '';
|
|
|
653
|
+ fileList.value = [];
|
|
|
654
|
+};
|
|
|
655
|
+
|
|
|
656
|
+const handleUpload = ()=>{
|
|
|
657
|
+ console.log(fileList.value);
|
|
|
658
|
+
|
|
|
659
|
+}
|
|
621
|
660
|
</script>
|
|
622
|
661
|
|
|
623
|
662
|
<template>
|
|
|
@@ -801,8 +840,9 @@ function handleDrawerOpen() {
|
|
801
|
840
|
? '新增检查项'
|
|
802
|
841
|
: ''
|
|
803
|
842
|
"
|
|
804
|
|
- size="600px"
|
|
|
843
|
+ size="700px"
|
|
805
|
844
|
direction="rtl"
|
|
|
845
|
+ @close="closeEditDrawer"
|
|
806
|
846
|
>
|
|
807
|
847
|
<ElForm
|
|
808
|
848
|
ref="editFormRef"
|
|
|
@@ -941,7 +981,7 @@ function handleDrawerOpen() {
|
|
941
|
981
|
<el-checkbox
|
|
942
|
982
|
v-model="ishasPhoto"
|
|
943
|
983
|
@change="
|
|
944
|
|
- (val) => {
|
|
|
984
|
+ (val: any) => {
|
|
945
|
985
|
val === true ? (editForm.hasPhoto = '1') : '';
|
|
946
|
986
|
}
|
|
947
|
987
|
"
|
|
|
@@ -984,7 +1024,7 @@ function handleDrawerOpen() {
|
|
984
|
1024
|
v-if="editType === 'addcheck' || editType === 'check'"
|
|
985
|
1025
|
label="示例图"
|
|
986
|
1026
|
>
|
|
987
|
|
- <el-icon style="font-size: 16px"><QuestionFilled /></el-icon>
|
|
|
1027
|
+ <!-- <el-icon style="font-size: 16px;"><QuestionFilled /></el-icon> -->
|
|
988
|
1028
|
|
|
989
|
1029
|
<el-upload
|
|
990
|
1030
|
v-model:file-list="fileList"
|
|
|
@@ -994,6 +1034,7 @@ function handleDrawerOpen() {
|
|
994
|
1034
|
list-type="picture-card"
|
|
995
|
1035
|
:on-preview="handlePictureCardPreview"
|
|
996
|
1036
|
:on-remove="handleRemove"
|
|
|
1037
|
+ :on-success="handleUpload"
|
|
997
|
1038
|
:disabled="fileList.length >= 3"
|
|
998
|
1039
|
>
|
|
999
|
1040
|
<template #default>
|