0930
This commit is contained in:
@ -28,22 +28,17 @@
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<el-select v-model="taskStatus" placeholder="任务状态">
|
||||
<el-option label="待执行" value="pending"></el-option>
|
||||
<el-option label="执行中" value="executing"></el-option>
|
||||
<el-option label="已延期" value="delayed"></el-option>
|
||||
<el-option label="已完成" value="completed"></el-option>
|
||||
<el-option label="待处理" value="1"></el-option>
|
||||
<el-option label="处理中" value="3"></el-option>
|
||||
<el-option label="已完成" value="4"></el-option>
|
||||
<el-option label="已延期" value="2"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<el-select v-model="planType" placeholder="全部计划">
|
||||
<el-option label="每日巡检计划" value="daily"></el-option>
|
||||
<el-option label="每周巡检计划" value="weekly"></el-option>
|
||||
<el-option label="每月巡检计划" value="monthly"></el-option>
|
||||
<el-select v-model="executor" placeholder="执行人" :disabled="loadingUsers">
|
||||
<el-option v-for="user in usersList" :key="user.id" :label="user.name" :value="user.id" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<el-input v-model="executor" placeholder="执行人"></el-input>
|
||||
</div>
|
||||
<div class="filter-actions">
|
||||
<el-button type="primary" icon="Search" class="search-btn" @click="handleSearch"> 搜索 </el-button>
|
||||
<el-button icon="Refresh" class="create-btn" @click="resetFilters"> 重置 </el-button>
|
||||
@ -441,6 +436,10 @@ const planType = ref('');
|
||||
const executor = ref('');
|
||||
const keyword = ref('');
|
||||
|
||||
// 执行人列表相关
|
||||
const usersList = ref([]);
|
||||
const loadingUsers = ref(false);
|
||||
|
||||
// 任务数据 - 初始为空数组,通过API获取
|
||||
const tasks = ref([]);
|
||||
|
||||
@ -549,7 +548,11 @@ const getTaskList = async () => {
|
||||
const params = {
|
||||
pageSize: pageSize.value,
|
||||
pageNum: currentPage.value,
|
||||
projectId: 1
|
||||
projectId: 1,
|
||||
status: taskStatus.value || undefined,
|
||||
planType: planType.value || undefined,
|
||||
personId: executor.value || undefined,
|
||||
keyword: keyword.value.trim() || undefined
|
||||
};
|
||||
|
||||
const response = await xjrenwulist(params);
|
||||
@ -629,6 +632,7 @@ const getTaskList = async () => {
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getTaskList();
|
||||
getUsersList();
|
||||
});
|
||||
|
||||
// 分页相关
|
||||
@ -880,11 +884,13 @@ const planList = ref([]);
|
||||
|
||||
// 获取负责人列表
|
||||
const getUsersList = async () => {
|
||||
loadingUsers.value = true;
|
||||
try {
|
||||
const response = await xunjianUserlist();
|
||||
// 适配新接口格式:检查code为200且rows为数组
|
||||
const userRows = response.code === 200 && response.rows && Array.isArray(response.rows) ? response.rows : [];
|
||||
|
||||
// 更新userList变量(用于创建任务弹窗)
|
||||
userList.value = userRows
|
||||
.filter((item) => item && typeof item === 'object')
|
||||
.map((item) => ({
|
||||
@ -892,12 +898,27 @@ const getUsersList = async () => {
|
||||
value: String(item.userId || '') // 使用userId作为唯一标识
|
||||
}));
|
||||
|
||||
// 同时更新usersList变量(用于筛选栏)
|
||||
usersList.value = userRows
|
||||
.filter((item) => item && typeof item === 'object')
|
||||
.map((item) => ({
|
||||
id: String(item.userId || ''),
|
||||
name: item.userName || '未知用户'
|
||||
}));
|
||||
|
||||
// 空数据处理
|
||||
if (userList.value.length === 0) {
|
||||
userList.value = [{ label: '默认用户', value: 'default' }];
|
||||
}
|
||||
if (usersList.value.length === 0) {
|
||||
usersList.value = [{ id: 'default', name: '默认用户' }];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取负责人列表失败:', error);
|
||||
userList.value = [{ label: '默认用户', value: 'default' }];
|
||||
usersList.value = [{ id: 'default', name: '默认用户' }];
|
||||
} finally {
|
||||
loadingUsers.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user