|
|
@@ -62,15 +62,14 @@
|
|
62
|
62
|
<uni-forms-item label="查获位置" name="securityLocation" required>
|
|
63
|
63
|
<uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="position_options"
|
|
64
|
64
|
popup-title="请选择查获位置" v-model="formData.securityLocation" @change="onLocationChange" />
|
|
65
|
|
- <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组"
|
|
66
|
|
- :value="formData.channelName || formData.regionalName" />
|
|
|
65
|
+ <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组" :value="formData.securityLocationText" />
|
|
67
|
66
|
</uni-forms-item>
|
|
68
|
67
|
|
|
69
|
68
|
<uni-forms-item label="查获班组" name="reportTeam" required>
|
|
70
|
69
|
<uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="teams" popup-title="请选择查获班组"
|
|
71
|
70
|
v-model="formData.reportTeam" @change="onReportTeamChange" />
|
|
72
|
71
|
|
|
73
|
|
- <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组" :value="formData.reportTeamText" />
|
|
|
72
|
+ <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组" :value="formData.attendanceTeamName" />
|
|
74
|
73
|
</uni-forms-item>
|
|
75
|
74
|
</uni-collapse-item>
|
|
76
|
75
|
</uni-collapse>
|
|
|
@@ -251,7 +250,7 @@ export default {
|
|
251
|
250
|
return this.$store.state.user;
|
|
252
|
251
|
},
|
|
253
|
252
|
userInfo() {
|
|
254
|
|
-
|
|
|
253
|
+
|
|
255
|
254
|
return (this.$store.state.user && this.$store.state.user.userInfo) ? this.$store.state.user.userInfo : {}
|
|
256
|
255
|
},
|
|
257
|
256
|
// 将item_check_method_options转换为字符串数组供uni-combox使用
|
|
|
@@ -323,11 +322,11 @@ export default {
|
|
323
|
322
|
attendanceId: '',
|
|
324
|
323
|
attendanceTeamId: '',
|
|
325
|
324
|
attendanceTeamName: '无',
|
|
326
|
|
- attendanceDepartmentId: '',
|
|
|
325
|
+ attendanceDepartmentId: '',
|
|
327
|
326
|
attendanceDepartmentName: '无',
|
|
328
|
|
- attendanceStationId: '',
|
|
|
327
|
+ attendanceStationId: '',
|
|
329
|
328
|
attendanceStationName: '无',
|
|
330
|
|
- regionalCode: '',
|
|
|
329
|
+ regionalCode: '',
|
|
331
|
330
|
regionalName: '无',
|
|
332
|
331
|
terminlCode: '',
|
|
333
|
332
|
terminlName: '无',
|
|
|
@@ -434,20 +433,23 @@ export default {
|
|
434
|
433
|
}
|
|
435
|
434
|
},
|
|
436
|
435
|
async onLoad(options) {
|
|
437
|
|
-
|
|
|
436
|
+
|
|
438
|
437
|
// if (options && options?.params) {
|
|
439
|
|
- let params = {};
|
|
440
|
|
- if (options?.params) {
|
|
441
|
|
- params = JSON.parse(decodeURIComponent(options.params));
|
|
442
|
|
- }
|
|
443
|
|
- this.businessId = params?.businessId;
|
|
444
|
|
- this.instanceId = params?.instanceId;
|
|
445
|
|
- this.id = params?.id;
|
|
446
|
|
- this.nodeCode = params?.nodeCode;
|
|
447
|
|
- this.type = params?.type || 'add';
|
|
|
438
|
+ let params = {};
|
|
|
439
|
+ if (options?.params) {
|
|
|
440
|
+ params = JSON.parse(decodeURIComponent(options.params));
|
|
|
441
|
+ }
|
|
|
442
|
+ this.businessId = params?.businessId;
|
|
|
443
|
+ this.instanceId = params?.instanceId;
|
|
|
444
|
+ this.id = params?.id;
|
|
|
445
|
+ this.nodeCode = params?.nodeCode;
|
|
|
446
|
+ this.type = params?.type || 'add';
|
|
448
|
447
|
// }
|
|
449
|
448
|
await this.initPageData();
|
|
450
|
|
- this.invokerGetLocationsbyTime()
|
|
|
449
|
+ if (this.type == 'add') {
|
|
|
450
|
+ this.invokerGetLocationsbyTime()
|
|
|
451
|
+ }
|
|
|
452
|
+
|
|
451
|
453
|
this.invokerCategoryInfo()
|
|
452
|
454
|
// 如果有路由ID,获取详情信息
|
|
453
|
455
|
if (this.businessId) {
|
|
|
@@ -575,6 +577,8 @@ export default {
|
|
575
|
577
|
isActiveConcealment: String(detailData?.itemSeizureItemsList[0].isActiveConcealment),
|
|
576
|
578
|
handlingMethodDesc: detailData?.itemSeizureItemsList[0].handlingMethodDesc,
|
|
577
|
579
|
handlingMethod: detailData?.itemSeizureItemsList[0].handlingMethod,
|
|
|
580
|
+ // reportTeamText:`${detailData?.inspectStationName}/${detailData?.inspectBrigadeName}/${detailData?.inspectDepartmentName}/${detailData?.inspectTeamName}`,
|
|
|
581
|
+ securityLocationText:`${detailData?.terminlName}/${detailData?.regionalName}/${detailData?.channelName}`
|
|
578
|
582
|
};
|
|
579
|
583
|
|
|
580
|
584
|
this.$nextTick(() => {
|
|
|
@@ -624,8 +628,7 @@ export default {
|
|
624
|
628
|
|
|
625
|
629
|
this.formData.securityLocation = curUserInfo.channelCode || curUserInfo.regionalCode
|
|
626
|
630
|
this.formData.securityLocationText = curUserInfo.channelName || curUserInfo.regionalName
|
|
627
|
|
- this.formData.channelCode = curUserInfo.channelCode
|
|
628
|
|
- this.formData.channelName = curUserInfo.channelName
|
|
|
631
|
+
|
|
629
|
632
|
this.formData.team = curUserInfo.attendanceTeamId
|
|
630
|
633
|
this.formData.reportTeam = curUserInfo.attendanceTeamId
|
|
631
|
634
|
if (curUserInfo.attendanceStationName && curUserInfo.attendanceDepartmentName) {
|
|
|
@@ -633,9 +636,80 @@ export default {
|
|
633
|
636
|
this.formData.reportTeamText = `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}`
|
|
634
|
637
|
}
|
|
635
|
638
|
console.log(this.formData);
|
|
636
|
|
-
|
|
|
639
|
+ const locationResult = this.getParentLocation(this.formData.securityLocation)
|
|
|
640
|
+ console.log(locationResult);
|
|
|
641
|
+
|
|
|
642
|
+ // 安全地处理可能为null的结果
|
|
|
643
|
+ if (locationResult) {
|
|
|
644
|
+ this.formData.terminlName = locationResult.grandParent?.text || '';
|
|
|
645
|
+ this.formData.terminlCode = locationResult.grandParent?.value || '';
|
|
|
646
|
+ this.formData.regionalName = locationResult.parent?.text || '';
|
|
|
647
|
+ this.formData.regionalCode = locationResult.parent?.value || '';
|
|
|
648
|
+ this.formData.channelName = locationResult.current?.text || '';
|
|
|
649
|
+ this.formData.channelCode = locationResult.current?.value || '';
|
|
|
650
|
+ } else {
|
|
|
651
|
+ // 如果找不到位置信息,清空相关字段
|
|
|
652
|
+ this.formData.terminlName = '';
|
|
|
653
|
+ this.formData.terminlCode = '';
|
|
|
654
|
+ this.formData.regionalName = '';
|
|
|
655
|
+ this.formData.regionalCode = '';
|
|
|
656
|
+ this.formData.channelName = '';
|
|
|
657
|
+ this.formData.channelCode = '';
|
|
|
658
|
+ }
|
|
637
|
659
|
})
|
|
638
|
660
|
},
|
|
|
661
|
+ //根据securityLocation,从this.position_options中向上找到前两级别的父级对象和当前级别对象
|
|
|
662
|
+ getParentLocation(securityLocation) {
|
|
|
663
|
+ if (!securityLocation || !this.position_options || !this.position_options.length) {
|
|
|
664
|
+ return null;
|
|
|
665
|
+ }
|
|
|
666
|
+
|
|
|
667
|
+ // 递归查找节点及其父级
|
|
|
668
|
+ const findNodeAndParents = (nodes, targetValue, parents = []) => {
|
|
|
669
|
+ for (const node of nodes) {
|
|
|
670
|
+ if (node.value === targetValue) {
|
|
|
671
|
+ return { node, parents };
|
|
|
672
|
+ }
|
|
|
673
|
+
|
|
|
674
|
+ if (node.children && node.children.length) {
|
|
|
675
|
+ const result = findNodeAndParents(node.children, targetValue, [...parents, node]);
|
|
|
676
|
+ if (result) {
|
|
|
677
|
+ return result;
|
|
|
678
|
+ }
|
|
|
679
|
+ }
|
|
|
680
|
+ }
|
|
|
681
|
+ return null;
|
|
|
682
|
+ };
|
|
|
683
|
+
|
|
|
684
|
+ const result = findNodeAndParents(this.position_options, securityLocation);
|
|
|
685
|
+
|
|
|
686
|
+ if (!result) {
|
|
|
687
|
+ return null;
|
|
|
688
|
+ }
|
|
|
689
|
+
|
|
|
690
|
+ const { node, parents } = result;
|
|
|
691
|
+
|
|
|
692
|
+ // 返回当前级别对象和前两级的父级对象(如果存在)
|
|
|
693
|
+ if (parents.length >= 2) {
|
|
|
694
|
+ return {
|
|
|
695
|
+ current: node, // 当前级别对象
|
|
|
696
|
+ grandParent: parents[parents.length - 2], // 祖父级
|
|
|
697
|
+ parent: parents[parents.length - 1] // 父级
|
|
|
698
|
+ };
|
|
|
699
|
+ } else if (parents.length === 1) {
|
|
|
700
|
+ return {
|
|
|
701
|
+ current: node, // 当前级别对象
|
|
|
702
|
+ grandParent: null, // 没有祖父级
|
|
|
703
|
+ parent: parents[0] // 只有父级
|
|
|
704
|
+ };
|
|
|
705
|
+ } else {
|
|
|
706
|
+ return {
|
|
|
707
|
+ current: node, // 当前级别对象
|
|
|
708
|
+ grandParent: null, // 没有祖父级
|
|
|
709
|
+ parent: null // 没有父级
|
|
|
710
|
+ };
|
|
|
711
|
+ }
|
|
|
712
|
+ },
|
|
639
|
713
|
invokerCategoryInfo() {
|
|
640
|
714
|
categoryInfo(1).then(res => {
|
|
641
|
715
|
this.commonlyList.forbidden = res.data || []
|
|
|
@@ -775,6 +849,26 @@ export default {
|
|
775
|
849
|
const arr = e.detail.value || [];
|
|
776
|
850
|
this.formData.securityLocation = arr[arr.length - 1]?.value || '';
|
|
777
|
851
|
this.formData.securityLocationText = arr.map(item => item.text).join('/');
|
|
|
852
|
+ const locationResult = this.getParentLocation(this.formData.securityLocation)
|
|
|
853
|
+ console.log(locationResult);
|
|
|
854
|
+
|
|
|
855
|
+ // 安全地处理可能为null的结果
|
|
|
856
|
+ if (locationResult) {
|
|
|
857
|
+ this.formData.terminlName = locationResult.grandParent?.text || '';
|
|
|
858
|
+ this.formData.terminlCode = locationResult.grandParent?.value || '';
|
|
|
859
|
+ this.formData.regionalName = locationResult.parent?.text || '';
|
|
|
860
|
+ this.formData.regionalCode = locationResult.parent?.value || '';
|
|
|
861
|
+ this.formData.channelName = locationResult.current?.text || '';
|
|
|
862
|
+ this.formData.channelCode = locationResult.current?.value || '';
|
|
|
863
|
+ } else {
|
|
|
864
|
+ // 如果找不到位置信息,清空相关字段
|
|
|
865
|
+ this.formData.terminlName = '';
|
|
|
866
|
+ this.formData.terminlCode = '';
|
|
|
867
|
+ this.formData.regionalName = '';
|
|
|
868
|
+ this.formData.regionalCode = '';
|
|
|
869
|
+ this.formData.channelName = '';
|
|
|
870
|
+ this.formData.channelCode = '';
|
|
|
871
|
+ }
|
|
778
|
872
|
},
|
|
779
|
873
|
|
|
780
|
874
|
// 通用取值:只拿最后一级
|
|
|
@@ -929,8 +1023,8 @@ export default {
|
|
929
|
1023
|
return parseInt(`${timestamp}${random}`.slice(-15)); // 确保总长度不超过15位
|
|
930
|
1024
|
},
|
|
931
|
1025
|
formatData() {
|
|
932
|
|
- this.formData.regionalCode = this.formData.securityLocation
|
|
933
|
|
- this.formData.regionalName = this.formData.securityLocationText
|
|
|
1026
|
+ // this.formData.regionalCode = this.formData.securityLocation
|
|
|
1027
|
+ // this.formData.regionalName = this.formData.securityLocationText
|
|
934
|
1028
|
this.formData.channelCode =
|
|
935
|
1029
|
this.formData.channelCode || this.formData.securityLocation || '无'
|
|
936
|
1030
|
this.formData.channelName =
|
|
|
@@ -996,7 +1090,7 @@ export default {
|
|
996
|
1090
|
|
|
997
|
1091
|
// 提交表单
|
|
998
|
1092
|
submitForm() {
|
|
999
|
|
- console.log("generateNumericID", this.generateNumericID())
|
|
|
1093
|
+
|
|
1000
|
1094
|
this.$refs.form.validate().then(res => {
|
|
1001
|
1095
|
uni.showLoading({ title: '提交中...', mask: true });
|
|
1002
|
1096
|
let payload = this.formatData()
|
|
|
@@ -1017,10 +1111,12 @@ export default {
|
|
1017
|
1111
|
uni.showToast({ title: '提交成功', icon: 'success' });
|
|
1018
|
1112
|
//开始流程
|
|
1019
|
1113
|
console.log("res0", res)
|
|
|
1114
|
+
|
|
1020
|
1115
|
approvalStart({ ...params, businessId: res.data }).then(res => {
|
|
1021
|
1116
|
setTimeout(() => uni.navigateBack(), 1500); // 提交成功后跳转
|
|
1022
|
1117
|
})
|
|
1023
|
1118
|
|
|
|
1119
|
+
|
|
1024
|
1120
|
})
|
|
1025
|
1121
|
.catch((error) => {
|
|
1026
|
1122
|
uni.showToast({ title: '操作失败,请稍后重试!', icon: 'none' }); // 提交失败提示
|