|
|
@@ -460,10 +460,10 @@ export default {
|
|
460
|
460
|
createBy: user?.userName || '',
|
|
461
|
461
|
seizureTime: data.createTime || '',
|
|
462
|
462
|
inspectUserRoleName: user?.roles[0]?.roleName || '',
|
|
463
|
|
- checkMethod: data.positionId === 0 ? '' : data.positionId || '',
|
|
464
|
|
- checkMethodText: data.positionName == '未知岗位' ? '' : data.positionName,
|
|
|
463
|
+ checkMethod: data.postDictCode == 0 ? '' : data.postDictCode || '',
|
|
|
464
|
+ checkMethodText: data.postLabel == '未知岗位' ? '' : data.postLabel,
|
|
465
|
465
|
reportTeam: data.teamId || '',
|
|
466
|
|
- // securityLocation: data.channelId,
|
|
|
466
|
+ securityLocation: data.channelId || '',
|
|
467
|
467
|
forbiddenName: data.name || '',
|
|
468
|
468
|
isActiveConcealment: '0',
|
|
469
|
469
|
handlingMethod: 'ABANDON',
|
|
|
@@ -478,8 +478,19 @@ export default {
|
|
478
|
478
|
partType: data.checkPointId,
|
|
479
|
479
|
partTypeText: data.checkPointName
|
|
480
|
480
|
};
|
|
|
481
|
+ const locationResult = this.getParentLocation(data.channelId, 'id')
|
|
|
482
|
+ // 安全地处理可能为null的结果
|
|
|
483
|
+ if (locationResult) {
|
|
|
484
|
+ this.formData.terminlName = locationResult.grandParent?.text;
|
|
|
485
|
+ this.formData.terminlCode = locationResult.grandParent?.value;
|
|
|
486
|
+ this.formData.regionalName = locationResult.parent?.text;
|
|
|
487
|
+ this.formData.regionalCode = locationResult.parent?.value;
|
|
|
488
|
+ this.formData.channelName = locationResult.current?.text;
|
|
|
489
|
+ this.formData.channelCode = locationResult.current?.value;
|
|
|
490
|
+ this.formData.securityLocation = locationResult.current?.value;
|
|
|
491
|
+ }
|
|
481
|
492
|
|
|
482
|
|
- console.log(this.formData, "parentNode")
|
|
|
493
|
+
|
|
483
|
494
|
|
|
484
|
495
|
|
|
485
|
496
|
} else {
|
|
|
@@ -907,47 +918,47 @@ export default {
|
|
907
|
918
|
const curUserInfo = (res.data || []).find(item => {
|
|
908
|
919
|
return item.userId === this.currentUser.id && (!item.checkOutTime || item.checkOutTime === '2000-01-01 00:00:00')
|
|
909
|
920
|
}) || {}
|
|
910
|
|
- console.log(curUserInfo, "curUserInfo")
|
|
911
|
|
- this.formData.securityLocation = curUserInfo.channelCode || curUserInfo.regionalCode
|
|
912
|
|
- this.formData.securityLocationText = curUserInfo.channelName || curUserInfo.regionalName
|
|
|
921
|
+ console.log(curUserInfo, "curUserInfo", this.formData)
|
|
|
922
|
+ // 修复:只有当打卡数据确实存在时才覆盖securityLocation
|
|
|
923
|
+ if (curUserInfo.channelCode) {
|
|
|
924
|
+
|
|
|
925
|
+ this.formData.securityLocation = curUserInfo.channelCode;
|
|
|
926
|
+ this.formData.securityLocationText = `${curUserInfo?.terminlName}/${curUserInfo?.regionalName}/${curUserInfo?.channelName}`;
|
|
|
927
|
+ }
|
|
|
928
|
+ console.log(this.formData.securityLocation, "this.formData.securityLocation");
|
|
913
|
929
|
|
|
914
|
|
- this.formData.team = curUserInfo.attendanceTeamId
|
|
915
|
|
- this.formData.reportTeam = curUserInfo.attendanceTeamId
|
|
|
930
|
+ this.formData.team = curUserInfo.attendanceTeamId;
|
|
|
931
|
+ //打卡的优先于语音,所以后请求打卡的数据,先请求语音的,但是如果打卡的数据没有,就不清空语音的数据
|
|
|
932
|
+ this.formData.reportTeam = curUserInfo.attendanceTeamId ?? this.formData.reportTeam;
|
|
916
|
933
|
if (curUserInfo.attendanceStationName && curUserInfo.attendanceDepartmentName) {
|
|
917
|
934
|
this.formData.teamName = `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}`
|
|
918
|
|
- this.formData.reportTeamText = `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}`
|
|
|
935
|
+ this.formData.reportTeamText = curUserInfo.attendanceTeamName ? `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}` : this.formData.reportTeamText
|
|
919
|
936
|
}
|
|
920
|
937
|
console.log(this.formData);
|
|
921
|
938
|
const locationResult = this.getParentLocation(this.formData.securityLocation)
|
|
922
|
939
|
// 安全地处理可能为null的结果
|
|
923
|
940
|
if (locationResult) {
|
|
924
|
|
- this.formData.terminlName = locationResult.grandParent?.text || '';
|
|
925
|
|
- this.formData.terminlCode = locationResult.grandParent?.value || '';
|
|
926
|
|
- this.formData.regionalName = locationResult.parent?.text || '';
|
|
927
|
|
- this.formData.regionalCode = locationResult.parent?.value || '';
|
|
928
|
|
- this.formData.channelName = locationResult.current?.text || '';
|
|
929
|
|
- this.formData.channelCode = locationResult.current?.value || '';
|
|
930
|
|
- } else {
|
|
931
|
|
- // 如果找不到位置信息,清空相关字段
|
|
932
|
|
- this.formData.terminlName = '';
|
|
933
|
|
- this.formData.terminlCode = '';
|
|
934
|
|
- this.formData.regionalName = '';
|
|
935
|
|
- this.formData.regionalCode = '';
|
|
936
|
|
- this.formData.channelName = '';
|
|
937
|
|
- this.formData.channelCode = '';
|
|
|
941
|
+ this.formData.terminlName = locationResult.grandParent?.text;
|
|
|
942
|
+ this.formData.terminlCode = locationResult.grandParent?.value;
|
|
|
943
|
+ this.formData.regionalName = locationResult.parent?.text;
|
|
|
944
|
+ this.formData.regionalCode = locationResult.parent?.value;
|
|
|
945
|
+ this.formData.channelName = locationResult.current?.text;
|
|
|
946
|
+ this.formData.channelCode = locationResult.current?.value;
|
|
938
|
947
|
}
|
|
939
|
948
|
})
|
|
940
|
949
|
},
|
|
941
|
950
|
//根据securityLocation,从this.position_options中向上找到前两级别的父级对象和当前级别对象
|
|
942
|
|
- getParentLocation(securityLocation) {
|
|
|
951
|
+ getParentLocation(securityLocation, value) {
|
|
|
952
|
+
|
|
943
|
953
|
if (!securityLocation || !this.position_options || !this.position_options.length) {
|
|
944
|
954
|
return null;
|
|
945
|
955
|
}
|
|
|
956
|
+ const getValue = value || 'value';
|
|
946
|
957
|
|
|
947
|
958
|
// 递归查找节点及其父级
|
|
948
|
959
|
const findNodeAndParents = (nodes, targetValue, parents = []) => {
|
|
949
|
960
|
for (const node of nodes) {
|
|
950
|
|
- if (node.value === targetValue) {
|
|
|
961
|
+ if (node[getValue] === targetValue) {
|
|
951
|
962
|
return { node, parents };
|
|
952
|
963
|
}
|
|
953
|
964
|
|
|
|
@@ -1023,6 +1034,7 @@ export default {
|
|
1023
|
1034
|
list.map(node => ({
|
|
1024
|
1035
|
text: node.label,
|
|
1025
|
1036
|
value: node.code,
|
|
|
1037
|
+ id: node.id,
|
|
1026
|
1038
|
children: node.children ? convertTree(node.children) : null
|
|
1027
|
1039
|
}))
|
|
1028
|
1040
|
|