|
@@ -1245,7 +1245,7 @@ import {
|
|
|
finalizeRepairOrder,
|
|
finalizeRepairOrder,
|
|
|
restartRepairOrder
|
|
restartRepairOrder
|
|
|
} from "@/api/gxt/repairOrder";
|
|
} from "@/api/gxt/repairOrder";
|
|
|
-import { listDept } from "@/api/system/dept";
|
|
|
|
|
|
|
+import { listDept,getDept } from "@/api/system/dept";
|
|
|
import { listFaultCodes } from "@/api/gxt/faultCodes"
|
|
import { listFaultCodes } from "@/api/gxt/faultCodes"
|
|
|
import { listGxtOrder } from "@/api/gxt/gxtOrder";
|
|
import { listGxtOrder } from "@/api/gxt/gxtOrder";
|
|
|
import { listUser } from "@/api/system/user";
|
|
import { listUser } from "@/api/system/user";
|
|
@@ -1666,6 +1666,59 @@ function handleMaintenanceCenterChange(selectedCenter) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 根据部门ID获取部门信息,并根据level判断是否需要查找父部门
|
|
|
|
|
+ * @param {Number} deptId 部门ID
|
|
|
|
|
+ * @returns {Promise<Number>} 返回level为3的部门ID
|
|
|
|
|
+ */
|
|
|
|
|
+function getDeptAndUserByLevel(deptId) {
|
|
|
|
|
+ return new Promise((resolve) => {
|
|
|
|
|
+ // 获取部门信息
|
|
|
|
|
+ getDeptInfoAndParent(deptId).then(dept => {
|
|
|
|
|
+ resolve(dept.deptId);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+/**
|
|
|
|
|
+ * 递归获取部门信息,查找父部门直到level为3
|
|
|
|
|
+ * @param {Number} deptId 部门ID
|
|
|
|
|
+ * @returns {Promise<Object>} 返回level为3的部门对象
|
|
|
|
|
+ */
|
|
|
|
|
+function getDeptInfoAndParent(deptId) {
|
|
|
|
|
+ return new Promise((resolve) => {
|
|
|
|
|
+ getDept(deptId).then(response => {
|
|
|
|
|
+ const dept = response.data;
|
|
|
|
|
+ // 如果部门level为3,直接返回
|
|
|
|
|
+ if (dept.level === "3") {
|
|
|
|
|
+ resolve(dept);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果有祖先部门,则继续向上查找
|
|
|
|
|
+ else if (dept.ancestors) {
|
|
|
|
|
+ // 从ancestors中提取父部门ID
|
|
|
|
|
+ // ancestors格式类似 "0,100,101,102"
|
|
|
|
|
+ const ancestorIds = dept.ancestors.split(',');
|
|
|
|
|
+ if (ancestorIds.length <= 1){
|
|
|
|
|
+ resolve(dept);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ const parentDeptId = ancestorIds[ancestorIds.length - 1];
|
|
|
|
|
+ // 递归获取父部门信息
|
|
|
|
|
+ getDeptInfoAndParent(parentDeptId).then(parentDept => {
|
|
|
|
|
+ resolve(parentDept);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他情况也直接返回
|
|
|
|
|
+ else {
|
|
|
|
|
+ resolve(dept);
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ // 如果获取部门信息失败,返回null
|
|
|
|
|
+ console.error("获取部门信息失败:", error);
|
|
|
|
|
+ resolve(null);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 取消按钮
|
|
// 取消按钮
|
|
|
function cancel() {
|
|
function cancel() {
|
|
|
openDialog.value = false
|
|
openDialog.value = false
|
|
@@ -1930,9 +1983,19 @@ function handleAccept(row) {
|
|
|
acceptForm.value.pcsStationId = response.data.pcsStationId
|
|
acceptForm.value.pcsStationId = response.data.pcsStationId
|
|
|
// 根据场站ID查询该场站的用户列表
|
|
// 根据场站ID查询该场站的用户列表
|
|
|
if (acceptForm.value.pcsStationId) {
|
|
if (acceptForm.value.pcsStationId) {
|
|
|
- listUser({ pageNum: 1, pageSize: 100, deptId: acceptForm.value.pcsStationId }).then(response => {
|
|
|
|
|
- userList.value = response.rows
|
|
|
|
|
- acceptDialogVisible.value = true
|
|
|
|
|
|
|
+ // 先获取部门信息,判断level是否为4,如果是则查找其父部门直到level为3
|
|
|
|
|
+ getDeptAndUserByLevel(acceptForm.value.pcsStationId).then(deptId => {
|
|
|
|
|
+ // 确保 deptId 是有效的再调用 listUser
|
|
|
|
|
+ if (deptId) {
|
|
|
|
|
+ listUser({ pageNum: 1, pageSize: 100, deptId: deptId }).then(response => {
|
|
|
|
|
+ userList.value = response.rows
|
|
|
|
|
+ acceptDialogVisible.value = true
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有找到有效的部门ID,仍然打开对话框但给出提示
|
|
|
|
|
+ proxy.$modal.msgWarning("未找到有效的部门信息,无法加载用户列表");
|
|
|
|
|
+ acceptDialogVisible.value = true
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
acceptDialogVisible.value = true
|
|
acceptDialogVisible.value = true
|
|
@@ -2256,9 +2319,19 @@ function handleFinalize(row) {
|
|
|
finalizeForm.value.pcsStationId = response.data.pcsStationId
|
|
finalizeForm.value.pcsStationId = response.data.pcsStationId
|
|
|
// 根据场站ID查询该场站的用户列表
|
|
// 根据场站ID查询该场站的用户列表
|
|
|
if (finalizeForm.value.pcsStationId) {
|
|
if (finalizeForm.value.pcsStationId) {
|
|
|
- listUser({ pageNum: 1, pageSize: 100, deptId: finalizeForm.value.pcsStationId }).then(response => {
|
|
|
|
|
- userList.value = response.rows
|
|
|
|
|
- finalizeDialogVisible.value = true
|
|
|
|
|
|
|
+ // 先获取部门信息,判断level是否为4,如果是则查找其父部门直到level为3
|
|
|
|
|
+ getDeptAndUserByLevel(finalizeForm.value.pcsStationId).then(deptId => {
|
|
|
|
|
+ // 确保 deptId 是有效的再调用 listUser
|
|
|
|
|
+ if (deptId) {
|
|
|
|
|
+ listUser({ pageNum: 1, pageSize: 100, deptId: deptId }).then(response => {
|
|
|
|
|
+ userList.value = response.rows
|
|
|
|
|
+ finalizeDialogVisible.value = true
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有找到有效的部门ID,仍然打开对话框但给出提示
|
|
|
|
|
+ proxy.$modal.msgWarning("未找到有效的部门信息,无法加载用户列表");
|
|
|
|
|
+ finalizeDialogVisible.value = true
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
finalizeDialogVisible.value = true
|
|
finalizeDialogVisible.value = true
|