|
|
@@ -282,7 +282,7 @@
|
|
|
@click="handleProcessDone(scope.row)"
|
|
|
>结束</el-button>-->
|
|
|
<el-button
|
|
|
- v-if="scope.row.workOrderStatus === 'to_finish'"
|
|
|
+ v-if="scope.row.workOrderStatus === 'to_finish' && (scope.row.teamLeaderId == userStore.id || userStore.roles.includes('admin'))"
|
|
|
type="success"
|
|
|
link
|
|
|
@click="handleFinalize(scope.row)"
|
|
|
@@ -1535,6 +1535,7 @@ import {genCode} from "@/api/system/autocode/rule.js";
|
|
|
import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
|
|
|
import {listMisInfo, listWorkPerson} from "@/api/gxt/misInfo.js";
|
|
|
import {listGxtOrder} from "@/api/gxt/gxtOrder.js";
|
|
|
+import useUserStore from '@/store/modules/user'
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
@@ -1641,6 +1642,9 @@ const quickTeamLeaderList = ref([])
|
|
|
const teamLeaderLoading = ref(false)
|
|
|
const teamLeaderSearchTimer = ref(null)
|
|
|
const allUserList = ref([]) // 存储所有设备数据用于快速检索
|
|
|
+const lastLoadedCenterId = ref(null) // Track last loaded maintenance center ID
|
|
|
+
|
|
|
+const userStore = useUserStore();
|
|
|
|
|
|
/** 过滤快速检索用户列表 */
|
|
|
const filterQuickUserList = (keyword) => {
|
|
|
@@ -1728,11 +1732,15 @@ const searchTeamLeaderList = async (keyword) => {
|
|
|
|
|
|
/** 加载快速检索工作负责人列表 */
|
|
|
const loadQuickTeamLeaderList = async () => {
|
|
|
- // 如果已有所有用户数据,直接使用
|
|
|
- if (allUserList.value.length > 0) {
|
|
|
+ // 如果已有所有用户数据,且是同一个维保中心,直接使用
|
|
|
+ if (allUserList.value.length > 0 && lastLoadedCenterId.value === acceptForm.value.gxtCenterId) {
|
|
|
quickTeamLeaderList.value = allUserList.value;
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ // 记录当前维保中心ID
|
|
|
+ lastLoadedCenterId.value = acceptForm.value.gxtCenterId;
|
|
|
+
|
|
|
teamLeaderLoading.value = true
|
|
|
try {
|
|
|
// 加载当前部门下的用户列表
|
|
|
@@ -1741,7 +1749,7 @@ const loadQuickTeamLeaderList = async () => {
|
|
|
status: '0'
|
|
|
})
|
|
|
allUserList.value = response.data || []
|
|
|
- quickTeamLeaderList.value = allUserList.value; //
|
|
|
+ quickTeamLeaderList.value = allUserList.value;
|
|
|
} catch (error) {
|
|
|
console.error('加载工作负责人列表失败:', error)
|
|
|
allUserList.value = []
|
|
|
@@ -2507,38 +2515,13 @@ function handleAccept(row) {
|
|
|
// 获取场站ID用于查询用户
|
|
|
acceptForm.value.pcsStationId = response.data.pcsStationId
|
|
|
acceptForm.value.pcsStationPid = response.data.pcsStationPid
|
|
|
+ if (lastLoadedCenterId.value !== acceptForm.value.gxtCenterId) {
|
|
|
+ allUserList.value = [];
|
|
|
+ }
|
|
|
+
|
|
|
// 预加载工作负责人列表
|
|
|
loadQuickTeamLeaderList()
|
|
|
acceptDialogVisible.value = true
|
|
|
- // // 根据场站ID查询该场站的用户列表
|
|
|
- // if (acceptForm.value.gxtCenterId) {
|
|
|
- // /*listUser({ pageNum: 1, pageSize: 100, deptId: acceptForm.value.pcsStationPid }).then(response => {
|
|
|
- // userList.value = response.rows
|
|
|
- // acceptDialogVisible.value = true
|
|
|
- // })*/
|
|
|
- // listUserNoPermi({ deptId: acceptForm.value.gxtCenterId }).then(response => {
|
|
|
- // userList.value = response.data
|
|
|
- // acceptDialogVisible.value = true
|
|
|
- // })
|
|
|
- // }/*else if (acceptForm.value.pcsStationId) {
|
|
|
- // // 先获取部门信息,判断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 {
|
|
|
- // proxy.$modal.msgWarning("未找到有效的部门信息,无法加载用户列表");
|
|
|
- // acceptDialogVisible.value = true
|
|
|
- // }
|
|
|
})
|
|
|
}
|
|
|
|