4 Commits

Author SHA1 Message Date
dhr
b6fabc0c4c 1011 2025-10-11 09:59:06 +08:00
dhr
0022ca0d01 0930 2025-09-30 17:57:19 +08:00
dhr
fe0ffbdf11 0929 2025-09-29 19:56:24 +08:00
dhr
7645cba791 0929 2025-09-29 18:49:04 +08:00
16 changed files with 563 additions and 507 deletions

View File

@ -365,9 +365,9 @@ export const getStepStatusText = (status: string | number): string => {
const statusMap: Record<string, string> = {
'1': '待执行',
'2': '执行中',
'3': '已完成',
'3': '失败',
'4': '已延期',
'5': '失败'
'5': '已完成'
};
return statusMap[statusStr] || '未知状态';
};

View File

@ -22,18 +22,37 @@
</div>
<!-- 搜索和筛选区 -->
<div class="search-filter">
<div class="search-container">
<el-input
v-model="searchKeyword"
placeholder="搜索班组名称或编号"
class="search-input"
suffix-icon="el-icon-search"
@keyup.enter="handleSearch"
></el-input>
<el-button icon="Refresh" @click="() => { searchKeyword = ''; handleSearch(); }">重置</el-button>
<el-button type="primary" class="new-team-btn" @click="handleCreateTeam"> <i class="el-icon-plus"></i> 新增班组 </el-button>
<transition :enter-active-class="'el-zoom-in-center'" :leave-active-class="'el-zoom-out-center'">
<div v-show="showSearch" class="search-filter">
<div class="search-container">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="班组名称" prop="teamName">
<el-input v-model="queryParams.teamName" placeholder="请输入班组名称" clearable @keyup.enter="handleQuery"></el-input>
</el-form-item>
<el-form-item label="负责区域" prop="region">
<el-input v-model="queryParams.region" placeholder="请输入负责区域" clearable @keyup.enter="handleQuery"></el-input>
</el-form-item>
<el-form-item label="组长" prop="leader">
<el-input v-model="queryParams.leader" placeholder="请输入组长姓名" clearable @keyup.enter="handleQuery"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option label="正常运行" value="正常运行"></el-option>
<el-option label="人员紧张" value="人员紧张"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
</div>
</transition>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px">
<el-button type="primary" class="new-team-btn" @click="handleCreateTeam"> <i class="el-icon-plus"></i> 新增班组 </el-button>
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
</div>
<!-- 班组卡片和图表区域 -->
@ -178,13 +197,35 @@
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted, nextTick, reactive, toRefs } from 'vue';
import router from '@/router';
import * as echarts from 'echarts'; // 导入ECharts
import renwuImage from '@/assets/images/renwu.png';
import { getCurrentInstance } from 'vue';
import { ref, computed, onMounted, onUnmounted, nextTick } from 'vue';
import router from '@/router';
import * as echarts from 'echarts'; // 导入ECharts
import renwuImage from '@/assets/images/renwu.png';
import { getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 搜索条件
const searchKeyword = ref('');
const showSearch = ref(true);
const queryFormRef = ref();
// 搜索参数
const data = reactive({
queryParams: {
teamName: '',
region: '',
leader: '',
status: ''
}
});
const { queryParams } = toRefs(data);
// 班组数据
const rawTeamData = ref([
@ -252,12 +293,24 @@ const total = ref(rawTeamData.value.length);
const filteredTeams = computed(() => {
let teams = [...rawTeamData.value];
if (searchKeyword.value) {
const keyword = searchKeyword.value.toLowerCase();
teams = teams.filter(
(team) =>
team.name.toLowerCase().includes(keyword) || team.region.toLowerCase().includes(keyword) || team.leader.toLowerCase().includes(keyword)
);
// 使用queryParams进行过滤
if (queryParams.value.teamName) {
const keyword = queryParams.value.teamName.toLowerCase();
teams = teams.filter((team) => team.name.toLowerCase().includes(keyword));
}
if (queryParams.value.region) {
const keyword = queryParams.value.region.toLowerCase();
teams = teams.filter((team) => team.region.toLowerCase().includes(keyword));
}
if (queryParams.value.leader) {
const keyword = queryParams.value.leader.toLowerCase();
teams = teams.filter((team) => team.leader.toLowerCase().includes(keyword));
}
if (queryParams.value.status) {
teams = teams.filter((team) => team.status === queryParams.value.status);
}
return teams;
@ -296,6 +349,19 @@ const handleSearch = () => {
currentPage.value = 1; // 重置到第一页
};
// 执行搜索
const handleQuery = () => {
currentPage.value = 1;
};
// 重置搜索
const resetQuery = () => {
if (queryFormRef.value) {
queryFormRef.value.resetFields();
}
currentPage.value = 1;
};
// 分页事件
const handleSizeChange = (val) => {
pageSize.value = val;

View File

@ -23,33 +23,30 @@
<div class="filter-bar">
<div class="filter-container">
<div class="filter-item">
<el-input v-model="keyword" placeholder="关键字(名称/报修人/维修人)" clearable @keyup.enter="handleSearch" />
<el-input v-model="searchParams.keyword" placeholder="关键字(名称/报修人/维修人)" clearable @keyup.enter="handleSearch" />
</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-select v-model="searchParams.taskStatus" placeholder="任务状态">
<el-option label="待处理" value="1"></el-option>
<el-option label="处理中" value="2"></el-option>
<el-option label="已完成" value="3"></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="searchParams.type" placeholder="报修类型">
<el-option label="硬件故障" value="1"></el-option>
<el-option label="软件故障" value="2"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="executor" placeholder="执行人">
<el-option label="张明" value="zhangming"></el-option>
<el-option label="李华" value="lihua"></el-option>
<el-option label="王强" value="wangqiang"></el-option>
<el-select v-model="searchParams.sendPerson" placeholder="执行人">
<el-option label="全部" value="" />
<el-option v-for="user in usersList" :key="user.id" :label="user.name" :value="user.id" />
</el-select>
</div>
<div class="filter-actions">
<el-button type="primary" icon="Search" class="search-btn" @click="handleSearch"> 搜索 </el-button>
<el-button icon="Refresh" @click="resetFilters"> 重置 </el-button>
<el-button type="primary" icon="Plus" class="create-btn" @click="handleCreateTask"> 手动创建任务 </el-button>
</div>
</div>
@ -392,13 +389,19 @@ import { baoxiulist, baoxiuDetail, updatebaoxiu, addbaoxiu } from '@/api/zhineng
import { xunjianUserlist } from '@/api/zhinengxunjian/xunjian';
import { ElMessage, ElLoading } from 'element-plus';
// 激活的选项卡
const activeTab = ref('task');
const activeTab = ref('all');
// 筛选条件
const keyword = ref('');
const taskStatus = ref('');
const planType = ref('');
const executor = ref('');
// 统一搜索参数对象
const searchParams = ref({
keyword: '',
taskStatus: '',
type: '',
sendPerson: ''
});
// 执行人列表相关
const usersList = ref([]);
const loadingUsers = ref(false);
// 详情弹窗相关
const detailDialogVisible = ref(false);
@ -428,17 +431,46 @@ const assignTaskRules = {
};
const assignTaskFormRef = ref(null);
// 获取用户列表
async function getUsersList() {
loadingUsers.value = true;
try {
const res = await xunjianUserlist();
// 根据接口返回格式成功码是200用户数据在rows数组中
if (res.code === 200 && res.rows && Array.isArray(res.rows)) {
// 映射用户数据使用userId字段作为唯一标识并转换为字符串以避免大整数精度问题
usersList.value = res.rows.map((user) => ({
id: String(user.userId || ''),
name: user.userName || '未知用户'
}));
} else {
usersList.value = [];
console.error('获取用户列表失败:', res.msg || '未知错误');
}
} catch (error) {
console.error('获取用户列表异常:', error);
usersList.value = [];
} finally {
loadingUsers.value = false;
}
}
// 获取报修任务列表
defineExpose({ getTaskList });
async function getTaskList() {
loading.value = true;
try {
// 确保用户列表已加载
if (usersList.value.length === 0) {
await getUsersList();
}
const res = await baoxiulist({
pageNum: currentPage.value,
pageSize: pageSize.value,
status: taskStatus.value,
type: planType.value,
executor: executor.value
status: searchParams.value.taskStatus || undefined,
type: searchParams.value.type || undefined,
sendPerson: searchParams.value.sendPerson || undefined,
keyword: searchParams.value.keyword
});
if (res.code === 200 && res.rows) {
@ -587,13 +619,14 @@ const statusOrder = {
const pagedTasks = computed(() => {
// 先关键词过滤
let filtered = [...tasks.value];
if (keyword.value && keyword.value.trim()) {
const kw = keyword.value.trim();
filtered = filtered.filter((t) =>
(t.title && t.title.includes(kw)) ||
(t.reporter && t.reporter.includes(kw)) ||
(t.maintainer && t.maintainer.includes(kw)) ||
(t.id && String(t.id).includes(kw))
if (searchParams.value.keyword && searchParams.value.keyword.trim()) {
const kw = searchParams.value.keyword.trim();
filtered = filtered.filter(
(t) =>
(t.title && t.title.includes(kw)) ||
(t.reporter && t.reporter.includes(kw)) ||
(t.maintainer && t.maintainer.includes(kw)) ||
(t.id && String(t.id).includes(kw))
);
}
@ -613,15 +646,6 @@ const handleSearch = () => {
getTaskList(); // 调用接口获取数据
};
const resetFilters = () => {
keyword.value = '';
taskStatus.value = '';
planType.value = '';
executor.value = '';
currentPage.value = 1;
getTaskList();
};
// 创建报修任务弹窗相关
const createTaskDialogVisible = ref(false);
const createTaskFormRef = ref(null);
@ -647,33 +671,6 @@ const createTaskRules = {
contactPhone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }]
};
// 用户列表(维修人)
const usersList = ref([]);
const loadingUsers = ref(false);
// 获取用户列表
const getUsersList = async () => {
loadingUsers.value = true;
try {
const res = await xunjianUserlist();
// 根据接口返回格式成功码是200用户数据在rows数组中
if (res.code === 200 && res.rows && Array.isArray(res.rows)) {
// 映射用户数据使用userId字段作为唯一标识并转换为字符串以避免大整数精度问题
usersList.value = res.rows.map((user) => ({
id: String(user.userId || ''),
name: user.userName || '未知用户'
}));
} else {
usersList.value = [];
console.error('获取用户列表失败:', res.msg || '未知错误');
}
} catch (error) {
console.error('获取用户列表异常:', error);
usersList.value = [];
} finally {
loadingUsers.value = false;
}
};
const isSubmitting = ref(false); // 防止重复提交的状态标记
// 创建任务

View File

@ -28,23 +28,29 @@
</div>
<div class="filter-item">
<el-select v-model="taskStatus" placeholder="任务状态">
<el-option label="待执行" value="1"></el-option>
<el-option label="待处理" value="1"></el-option>
<el-option label="处理中" value="2"></el-option>
<el-option label="已完成" value="3"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="priority" placeholder="优先级">
<el-option label="优先级" value="1"></el-option>
<el-option label="优先级" value="1"></el-option>
<el-option label="中优先级" value="2"></el-option>
<el-option label="优先级" value="3"></el-option>
<el-option label="优先级" value="3"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="executor" placeholder="处理人员">
<el-option label="全部人员" value="all"></el-option>
<el-option label="李阳" value="liyang"></el-option>
<el-option label="张明" value="zhangming"></el-option>
<el-select v-model="executor" placeholder="处理人员" :loading="loadingUsers">
<el-option label="全部人员" value=""></el-option>
<el-option v-for="user in usersList" :key="user.id" :label="user.name" :value="user.id" />
</el-select>
</div>
<div class="filter-item">
<el-select v-model="repairType" placeholder="报修类型">
<el-option label="全部类型" value=""></el-option>
<el-option label="硬件故障" value="1"></el-option>
<el-option label="软件故障" value="2"></el-option>
</el-select>
</div>
<div class="filter-item">
@ -382,9 +388,14 @@ const statsLoading = ref(false);
const taskStatus = ref('');
const priority = ref('');
const executor = ref('');
const repairType = ref('');
const dateRange = ref([]);
const keyword = ref('');
// 执行人列表相关
const usersList = ref([]);
const loadingUsers = ref(false);
// 分页相关
const currentPage = ref(1);
const pageSize = ref(7);
@ -408,6 +419,7 @@ const statsData = ref({
onMounted(() => {
fetchRepairRecords();
fetchStatsData();
getUsersList();
});
// 从接口获取报修记录
@ -416,11 +428,13 @@ const fetchRepairRecords = async () => {
try {
// 构建请求参数
const params = {
page: currentPage.value,
limit: pageSize.value,
pageNum: currentPage.value,
pageSize: pageSize.value,
status: taskStatus.value || undefined,
level: priority.value || undefined
// 可以根据需要添加更多筛选参数
level: priority.value || undefined,
executor: executor.value || undefined,
type: repairType.value || undefined,
keyword: keyword.value.trim() || undefined
};
// 调用接口获取数据
@ -463,6 +477,7 @@ const resetFilters = () => {
taskStatus.value = '';
priority.value = '';
executor.value = '';
repairType.value = '';
dateRange.value = [];
keyword.value = '';
currentPage.value = 1;
@ -495,8 +510,6 @@ const reportFinal = ref('');
const assignDialogVisible = ref(false);
const currentAssignTaskId = ref('');
const selectedUserId = ref('');
const usersList = ref([]);
const loadingUsers = ref(false);
// 维修类型映射
function mapRepairType(type) {

View File

@ -190,7 +190,8 @@
}
/* 步骤状态样式 - 已完成 */
.task-detail-container .step-status.status-completed {
.task-detail-container .step-status.status-completed,
.task-detail-container .step-status.tag-completed {
background-color: #f6ffed;
color: #52c41a;
border: 1px solid #b7eb8f;
@ -203,6 +204,20 @@
border: 1px solid #ffccc7;
}
/* 步骤状态样式 - 未完成 */
.task-detail-container .step-status.status-unknown {
background-color: #f5f5f5;
color: #999;
border: 1px solid #d9d9d9;
}
/* 步骤状态样式 - 失败 */
.task-detail-container .step-status.status-failed {
background-color: #fff2f0;
color: #ff4d4f;
border: 1px solid #ffccc7;
}
/* 通用状态颜色样式 */
.status-pending {
color: #e6a23c;

View File

@ -37,8 +37,8 @@
<div class="filter-item">
<el-select v-model="workOrderStatus" placeholder="全部状态" clearable>
<el-option label="全部状态" value="all"></el-option>
<el-option label="已接单" value="accepted"></el-option>
<el-option label="待处理" value="pending"></el-option>
<el-option label="待派单" value="pending"></el-option>
<el-option label="已派单" value="accepted"></el-option>
<el-option label="执行中" value="executing"></el-option>
<el-option label="已完成" value="completed"></el-option>
</el-select>
@ -376,7 +376,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未执行' : node.status === '3' ? '失败' : '已完成' }}
</div>
</div>
</div>
@ -464,16 +464,6 @@ const workOrderStatus = ref('all');
const priority = ref('all');
const createDate = ref('');
// 优先级转类名
const mapPriorityToClass = (priority) => {
const priorityMap = {
1: 'high',
2: 'medium',
3: 'low'
};
return priorityMap[priority] || 'low';
};
// 工单数据
const rawTableData = ref([]);
@ -491,6 +481,9 @@ const fetchWorkOrderList = async () => {
pageSize: pageSize.value
};
// 调试输出,检查参数是否正确
console.log('请求参数:', params);
const response = await gongdanlist(params);
if (response.code === 200 && response.rows) {
@ -522,6 +515,38 @@ const fetchWorkOrderList = async () => {
}
};
// 类型映射函数 - 页面类型转接口code
const mapTypeToTypeCode = (type) => {
const typeMap = {
'maintenance': 1, // 维护保养
'inspection': 2, // 检查检测
'installation': 3, // 安装调试
'upgrade': 4 // 升级改造
};
return typeMap[type] || null;
};
// 状态映射函数 - 页面状态转接口code
const mapStatusToStatusCode = (status) => {
const statusMap = {
'pending': 1, // 待派单
'accepted': 2, // 已派单
'executing': 3, // 执行中
'completed': 4 // 已完成
};
return statusMap[status] || null;
};
// 优先级映射函数 - 页面优先级转接口code
const mapPriorityToLevelCode = (priority) => {
const priorityMap = {
'high': 3, // 高
'medium': 2, // 中
'low': 1 // 低
};
return priorityMap[priority] || null;
};
// 类型映射函数 - 页面类型转接口code
const mapTypeToCode = (type) => {
const typeMap = {
@ -615,11 +640,12 @@ const pagedTableData = computed(() => {
if (keyword.value && keyword.value.trim()) {
const kw = keyword.value.trim();
filteredData = filteredData.filter((item) =>
(item.title && item.title.includes(kw)) ||
(item.description && item.description.includes(kw)) ||
(item.creator && item.creator.includes(kw)) ||
(item.orderNo && item.orderNo.includes(kw))
filteredData = filteredData.filter(
(item) =>
(item.title && item.title.includes(kw)) ||
(item.description && item.description.includes(kw)) ||
(item.creator && item.creator.includes(kw)) ||
(item.orderNo && item.orderNo.includes(kw))
);
}
@ -646,10 +672,10 @@ const pagedTableData = computed(() => {
let statusText = '';
switch (workOrderStatus.value) {
case 'accepted':
statusText = '已单';
statusText = '已单';
break;
case 'pending':
statusText = '待处理';
statusText = '待派单';
break;
case 'executing':
statusText = '执行中';
@ -729,10 +755,10 @@ const getStatusClass = (status) => {
// 处理可能的数字输入
const statusStr = status?.toString() || '';
const statusClassMap = {
'1': 'status-pending',
'2': 'status-delayed',
'3': 'status-executing',
'4': 'status-completed'
'1': 'status-pending', // 待执行 - 蓝色
'2': 'status-unknown', // 未完成 - 灰色
'3': 'status-failed', // 失败 - 红色
'4': 'status-completed' // 已完成 - 绿色
};
return statusClassMap[statusStr] || 'status-unknown';
};
@ -767,6 +793,7 @@ const getStepStatusText = (status) => {
const handleSearch = () => {
currentPage.value = 1; // 重置到第一页
fetchWorkOrderList(); // 触发API请求获取数据
};
// 重置筛选

View File

@ -39,8 +39,8 @@
<div class="filter-item">
<el-select v-model="workOrderStatus" placeholder="全部状态" clearable>
<el-option label="全部状态" value="all"></el-option>
<el-option label="待派单" value="accepted"></el-option>
<el-option label="待处理" value="pending"></el-option>
<el-option label="待派单" value="pending"></el-option>
<el-option label="已派单" value="accepted"></el-option>
<el-option label="执行中" value="executing"></el-option>
<el-option label="已完成" value="completed"></el-option>
</el-select>
@ -434,7 +434,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未执行' : node.status === '3' ? '失败' : '已完成' }}
</div>
</div>
</div>
@ -706,10 +706,10 @@ const getStatusClass = (status) => {
// 处理可能的数字输入
const statusStr = status?.toString() || '';
const statusClassMap = {
'1': 'status-pending',
'2': 'status-delayed',
'3': 'status-executing',
'4': 'status-completed'
'1': 'status-pending', // 待执行 - 蓝色
'2': 'status-unknown', // 未执行 - 灰色
'3': 'status-failed', // 失败 - 红色
'4': 'status-completed' // 已完成 - 绿色
};
return statusClassMap[statusStr] || 'status-unknown';
};
@ -792,10 +792,10 @@ const pagedTableData = computed(() => {
let statusText = '';
switch (workOrderStatus.value) {
case 'accepted':
statusText = '已单';
statusText = '已单';
break;
case 'pending':
statusText = '待处理';
statusText = '待派单';
break;
case 'executing':
statusText = '执行中';

View File

@ -33,21 +33,11 @@
<el-option label="已完成" value="completed"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="planType" placeholder="全部计划">
<el-option label="全部计划" value="all"></el-option>
<el-option label="每日巡检计划" value="daily"></el-option>
<el-option label="每周巡检计划" value="weekly"></el-option>
<el-option label="每月巡检计划" value="monthly"></el-option>
<el-option label="每季度巡检计划" value="quarterly"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="executor" placeholder="执行人">
<el-option label="全部人员" value="all"></el-option>
<el-option label="张明" value="zhangming"></el-option>
<el-option label="李华" value="lihua"></el-option>
<el-option label="王强" value="wangqiang"></el-option>
<el-select v-model="sendPerson" placeholder="维修人" :loading="loadingUsers">
<el-option label="全部维修人" value="all"></el-option>
<el-option v-for="user in usersList" :key="user.id" :label="user.name" :value="user.id"></el-option>
</el-select>
</div>
<div class="filter-actions">
@ -427,9 +417,9 @@ import router from '@/router';
import { ElMessage } from 'element-plus';
import { qiangxiuDetail, qiangxiulist, addqiangxiu, updateqiangxiu } from '@/api/zhinengxunjian/qiangxiu';
import { xunjianUserlist } from '@/api/zhinengxunjian/xunjian';
const taskStatus = ref('all');
const taskStatus = ref('');
const planType = ref('all');
const executor = ref('all');
const sendPerson = ref('all');
const keyword = ref('');
// 任务数据 - 添加了更多字段以展示滚动效果
const tasks = ref([]);
@ -467,7 +457,7 @@ const handleSearch = () => {
const resetFilters = () => {
taskStatus.value = 'all';
planType.value = 'all';
executor.value = 'all';
sendPerson.value = 'all';
keyword.value = '';
currentPage.value = 1;
getTaskList();
@ -987,12 +977,13 @@ const handleSaveResult = async () => {
}
};
// 状态映射辅助函数
// 状态映射辅助函数 - 严格匹配JSON数据中的status字段
function mapStatusToKey(status) {
const statusMap = {
'1': 'pending', // 待处理
'2': 'executing', // 处理中
'3': 'completed' // 已完成
'3': 'completed', // 已完成
'4': 'delayed' // 已延期
};
return statusMap[status] || 'pending';
}
@ -1083,23 +1074,44 @@ async function getTaskList() {
// 构建请求参数,包含筛选条件
const requestParams = {
projectId: 1,
pageNum: currentPage.value,
pageSize: pageSize.value
pageNum: parseInt(currentPage.value, 10),
pageSize: parseInt(pageSize.value, 10)
};
// 添加任务状态筛选条件
// 添加任务状态筛选条件 - 严格匹配JSON数据中的status字段
if (taskStatus.value && taskStatus.value !== 'all') {
requestParams.status = taskStatus.value;
// 状态映射pending -> 1(待处理), executing -> 2(处理中), completed -> 3(已完成), delayed -> 4(已延期)
const statusMap = {
'pending': '1',
'executing': '2',
'completed': '3',
'delayed': '4'
};
requestParams.status = String(statusMap[taskStatus.value] || taskStatus.value);
}
// 添加计划类型筛选条件
// 添加故障类型筛选条件 - 严格匹配JSON数据中的type字段
if (planType.value && planType.value !== 'all') {
requestParams.planType = planType.value;
// 类型映射electric -> 1(电力故障), device -> 2(设备故障), software -> 3(软件故障), network -> 4(网络故障), environment -> 5(环境问题)
const typeMap = {
'electric': '1',
'device': '2',
'software': '3',
'network': '4',
'environment': '5'
};
requestParams.type = String(typeMap[planType.value] || planType.value);
}
// 添加执行人筛选条件
if (executor.value && executor.value !== 'all') {
requestParams.executor = executor.value;
// 添加维修人员筛选条件 - 严格匹配JSON数据中的sendPerson字段
if (sendPerson.value && sendPerson.value !== 'all' && sendPerson.value !== '') {
// 转换为数字类型以匹配API期望的格式
requestParams.sendPerson = parseInt(sendPerson.value, 10);
}
// 添加关键词搜索条件
if (keyword.value && keyword.value.trim()) {
requestParams.keyword = keyword.value.trim();
}
const res = await qiangxiulist(requestParams);
@ -1114,43 +1126,49 @@ async function getTaskList() {
leftLineClass: getLeftLineClass(item.status, item.level),
priorityClass: getPriorityClass(item.level),
priority: getPriorityText(item.level),
// 修复报修时间字段名,使用与模板一致的createTime
// 严格匹配JSON数据中的createTime字段
createTime: formatDate(item.createTime),
// 修复报修人字段,使用reportName
// 严格匹配JSON数据中的reportName字段
reporter: item.reportName || '未知报修人',
// 修复维修人字段,从sendPersonVo对象中获取用户名
maintainer: item.sendPersonVo?.userName || '未分配',
// 严格匹配JSON数据中的sendPerson和sendPersonVo字段
maintainer: item.sendPersonVo?.userName || (item.sendPerson ? `用户ID: ${item.sendPerson}` : '未分配'),
completeTime: item.reportFinishTime ? formatDate(item.reportFinishTime) : '',
actionText: getActionText(item.status),
actionClass: getActionClass(item.status),
reportInfo: item.reportInfo,
position: item.position,
fileUrl: item.fileUrl,
reportInfo: item.reportInfo || '',
position: item.position || '',
fileUrl: item.fileUrl || '',
reportPhone: item.reportPhone || '',
type: item.type || '',
// 保留原始数据用于详情查看
sendPersonVo: item.sendPersonVo,
faultType: getFaultTypeText(item.type),
// 保留expectedTime字段用于任务修改
expectedTime: item.expectedTime || '',
// 添加needSupport字段确保从API返回数据中获取实际值
needSupport: item.support || ''
// 严格匹配JSON数据中的expectedTime字段
expectedTime: item.expectedTime ? formatDate(item.expectedTime) : '',
// 严格匹配JSON数据中的support字段
needSupport: item.support || '',
// 添加额外的原始字段用于筛选和展示
sendPerson: item.sendPerson,
level: item.level,
createBy: item.createBy
}));
// 关键词过滤
const kw = keyword.value.trim().toLowerCase();
const filtered = kw
? mapped.filter((t) =>
[t.title, t.reporter, t.maintainer, t.position, t.statusText]
.filter(Boolean)
.some((v) => String(v).toLowerCase().includes(kw))
[t.title, t.reporter, t.maintainer, t.position, t.statusText].filter(Boolean).some((v) => String(v).toLowerCase().includes(kw))
)
: mapped;
tasks.value = filtered;
total.value = kw ? filtered.length : res.total || filtered.length;
if (res.total !== undefined) {
total.value = kw ? filtered.length : res.total;
} else {
total.value = filtered.length;
}
} else {
tasks.value = [];
total.value = 0;
@ -1180,6 +1198,7 @@ function getFaultTypeText(type) {
// 初始化时调用接口获取数据
setTimeout(() => {
getTaskList();
getUsersList(); // 获取用户列表用于维修人筛选
}, 0);
</script>

View File

@ -19,7 +19,7 @@
</div>
</div>
<!-- 筛选栏 (默认隐藏) -->
<!-- 筛选栏 -->
<div class="filter-bar">
<div class="filter-container">
<div class="filter-item">
@ -39,10 +39,9 @@
</el-select>
</div>
<div class="filter-item">
<el-select v-model="executor" placeholder="抢修人员">
<el-select v-model="executor" placeholder="抢修人员" :loading="loadingUsers">
<el-option label="全部人员" value="all"></el-option>
<el-option label="李明" value="liming"></el-option>
<el-option label="王伟" value="wangwei"></el-option>
<el-option v-for="user in executors" :key="user.userId" :label="user.userName" :value="user.userId"></el-option>
</el-select>
</div>
<div class="filter-item">
@ -426,13 +425,52 @@ const getTaskList = async () => {
try {
isLoading.value = true;
// 构建查询参数
// 构建查询参数严格匹配JSON数据结构
const params = {
projectId: 1,
pageNum: currentPage.value,
pageSize: pageSize.value
};
// 添加任务状态筛选条件 - 严格匹配JSON数据中的status字段
if (taskStatus.value && taskStatus.value !== 'all') {
// 状态映射pending -> 1(待处理), processing -> 2(处理中), completed -> 3(已完成)
const statusMap = {
'pending': '1',
'processing': '2',
'completed': '3'
};
params.status = statusMap[taskStatus.value] || taskStatus.value;
}
// 添加紧急程度筛选条件 - 严格匹配JSON数据中的level字段
if (priority.value && priority.value !== 'all') {
// 优先级映射normal -> 1(常规), urgent -> 2(紧急), fatal -> 3(致命)
const priorityMap = {
'normal': '1',
'urgent': '2',
'fatal': '3'
};
params.level = priorityMap[priority.value] || priority.value;
}
// 添加维修人员筛选条件 - 严格匹配JSON数据中的sendPerson字段
if (executor.value && executor.value !== 'all') {
// 确保用户ID为字符串类型与接口期望格式一致
params.sendPerson = executor.value.toString();
}
// 添加时间范围筛选条件
if (dateRange.value && dateRange.value.length === 2) {
params.startTime = dateRange.value[0];
params.endTime = dateRange.value[1];
}
// 添加关键词搜索条件
if (keyword.value && keyword.value.trim()) {
params.keyword = keyword.value.trim();
}
// 调用接口获取数据
const res = await qiangxiulist(params);
@ -470,9 +508,7 @@ const getTaskList = async () => {
const kw = keyword.value.trim().toLowerCase();
const filtered = kw
? mapped.filter((r) =>
[r.reportNo, r.content, r.reporter, r.handler, r.status]
.filter(Boolean)
.some((v) => String(v).toLowerCase().includes(kw))
[r.reportNo, r.content, r.reporter, r.handler, r.status].filter(Boolean).some((v) => String(v).toLowerCase().includes(kw))
)
: mapped;
@ -650,7 +686,7 @@ const getStatisticsData = async () => {
// 初始化数据
const initData = async () => {
await Promise.all([getTaskList(), getStatisticsData()]);
await Promise.all([getTaskList(), getStatisticsData(), getUsersList()]);
};
// 组件挂载时初始化数据
@ -690,6 +726,27 @@ const selectedExecutor = ref('');
const executors = ref([]);
const assignLoading = ref(false);
// 获取用户列表函数
const getUsersList = async () => {
try {
loadingUsers.value = true;
const res = await xunjianUserlist();
if (res && res.code === 200) {
// 过滤无效数据+统一userId为字符串
executors.value = (res.rows || [])
.filter((item) => item.userId && item.userName)
.map((item) => ({
userId: item.userId.toString(), // 使用userId字段
userName: item.userName || '未知用户'
}));
}
} catch (error) {
console.error('获取用户列表失败:', error);
} finally {
loadingUsers.value = false;
}
};
// 跟进弹窗相关
const followDialogVisible = ref(false);
const reportFinal = ref('');
@ -773,16 +830,8 @@ const handleAction = (record) => {
const handleAssign = async (record) => {
currentRecord.value = { ...record };
try {
const res = await xunjianUserlist();
if (res && res.code === 200) {
// 过滤无效数据+统一userId为字符串
executors.value = (res.rows || [])
.filter((item) => item.userId && item.userName)
.map((item) => ({
userId: item.userId.toString(), // 使用userId字段
userName: item.userName || '未知用户'
}));
}
// 重新获取用户列表以确保最新数据
await getUsersList();
} catch (error) {
console.error('获取人员列表失败:', error);
ElMessage.error('获取人员列表失败,请稍后重试');

View File

@ -443,9 +443,6 @@ const handleInspectionManagement3 = () => {
margin-bottom: 16px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
/* */
/* 内容容器样式 */
.content-container {
display: flex;

View File

@ -24,19 +24,26 @@
<!-- 4. 筛选和操作区域与试验系统filter-and-actions结构一致 -->
<div class="filter-and-actions">
<div class="filters">
<el-input v-model="keyword" placeholder="关键字(计划名/编号/负责人)" clearable @keyup.enter="handleSearch" style="width: 220px" />
<el-select v-model="filterStatus" placeholder="巡检状态" clearable>
<el-input v-model="keyword" placeholder="关键字(计划名/编号)" clearable @keyup.enter="handleSearch" style="width: 220px" />
<el-select v-model="filterStatus" placeholder="试验状态" clearable>
<el-option label="全部状态" value="all"></el-option>
<el-option label="正常" value="normal"></el-option>
<el-option label="需关注" value="attention"></el-option>
<el-option label="有问题" value="problem"></el-option>
<el-option label="已批准" value="1"></el-option>
<el-option label="进行中" value="2"></el-option>
<el-option label="已完成" value="3"></el-option>
<el-option label="未通过" value="4"></el-option>
</el-select>
<el-select v-model="filterType" placeholder="巡检类型" clearable>
<el-select v-model="filterType" placeholder="实验对象类型" clearable>
<el-option label="全部类型" value="all"></el-option>
<el-option label="数据库" value="database"></el-option>
<el-option label="服务器" value="server"></el-option>
<el-option label="网络设备" value="network"></el-option>
<el-option label="安全试验" value="1"></el-option>
<el-option label="网络实验" value="2"></el-option>
<el-option label="性能试验" value="3"></el-option>
<el-option label="其他试验" value="4"></el-option>
</el-select>
<el-select v-model="filterManager" placeholder="负责人" clearable>
<el-option label="全部负责人" value="all"></el-option>
<el-option v-for="user in userList" :key="user.value" :label="user.label" :value="user.value" />
</el-select>
<el-date-picker
@ -51,7 +58,7 @@
</div>
<div class="action-buttons">
<el-button type="primary" icon="Search" class="search-btn" @click="handleSearch"> 搜索 </el-button>
<el-button icon="Refresh" @click="resetFilters"> 重置 </el-button>
<el-button icon="Refresh" class="search-btn" @click="resetFilters"> 重置 </el-button>
<el-button type="primary" icon="Plus" class="create-btn" @click="openRecordDialog"> <i class="fas fa-plus"></i> 新增实验记录 </el-button>
</div>
</div>
@ -586,6 +593,7 @@ const timeRange = ref('month'); // 统计时间范围:月/周/日
const keyword = ref('');
const filterStatus = ref('all');
const filterType = ref('all');
const filterManager = ref('all');
const dateRange = ref([]);
// 分页参数
@ -603,8 +611,14 @@ const fetchExperimentData = async () => {
const queryParams = {
projectId: 1,
pageSize: pageSize.value,
pageNum: currentPage.value
// 其他参数...
pageNum: currentPage.value,
// 根据筛选条件构建查询参数
keyword: keyword.value || undefined,
testStatus: filterStatus.value === 'all' ? undefined : filterStatus.value,
testObject: filterType.value === 'all' ? undefined : filterType.value,
personCharge: filterManager.value === 'all' ? undefined : filterManager.value,
beginTime: dateRange.value.length > 0 ? dateRange.value[0] : undefined,
endTime: dateRange.value.length > 0 ? dateRange.value[1] : undefined
};
const response = await shiyanlist(queryParams);
@ -642,6 +656,7 @@ const resetFilters = () => {
keyword.value = '';
filterStatus.value = 'all';
filterType.value = 'all';
filterManager.value = 'all';
dateRange.value = [];
currentPage.value = 1;
fetchExperimentData();
@ -736,15 +751,6 @@ const handleInspectionManagement2 = () => {
const handleInspectionManagement3 = () => {
router.push('/znxj/sygl/shiyanjilu');
};
// 10. 方法:切换功能选项卡
const switchTab = (tab) => {
activeTab.value = tab;
// 实际应用中需根据选项卡加载对应数据
if (tab === 'record') {
// 加载统计数据
updateStatData(timeRange.value);
}
};
// 11. 方法:更新统计数据(根据时间范围)
const updateStatData = (range) => {
@ -805,12 +811,6 @@ const getRecordStatusText = (status) => {
return statusMap[status] || '';
};
// 进度条颜色
const getProgressColor = (status) => {
const colorMap = { 'drafted': '#ccc', 'in-progress': '#3b82f6', 'completed': '#10b981', 'paused': '#9e9e9e' };
return colorMap[status] || '#ccc';
};
// 18. 新增实验记录弹窗相关
const showRecordDialog = ref(false);
const saveLoading = ref(false); // 保存加载状态
@ -1123,21 +1123,6 @@ const handleEditRecord = async (row) => {
loading.value = false;
}
};
// 添加新步骤
const addStep = () => {
formData.value.steps.push({ name: '', intendedPurpose: '', intendedTime: '' });
};
// 删除步骤
const deleteStep = (index) => {
// 确保至少保留一个步骤
if (formData.value.steps.length <= 1) {
ElMessage.warning('至少需要保留一个步骤');
return;
}
// 从数组中删除指定索引的步骤
formData.value.steps.splice(index, 1);
};
// 添加新设备
const addEquipment = () => {
@ -1233,19 +1218,6 @@ const formatDate = (dateString) => {
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
// 日期时间格式化函数
const formatDateTime = (dateString) => {
if (!dateString) return '';
const date = new Date(dateString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
</script>
<style scoped>

View File

@ -23,19 +23,21 @@
<!-- 筛选和操作区域 -->
<div class="filter-and-actions">
<div class="filters">
<el-input v-model="keyword" placeholder="关键字(任务名/负责人/编号)" clearable @keyup.enter="handleSearch" style="width: 220px" />
<el-select v-model="filterStatus" placeholder="巡检状态" clearable>
<el-input v-model="keyword" placeholder="关键字(计划名/编号)" clearable @keyup.enter="handleSearch" style="width: 220px" />
<el-select v-model="status" placeholder="试验状态" clearable>
<el-option label="全部状态" value="all"></el-option>
<el-option label="正常" value="normal"></el-option>
<el-option label="需关注" value="attention"></el-option>
<el-option label="有问题" value="problem"></el-option>
<el-option label="待执行" value="1"></el-option>
<el-option label="执行中" value="2"></el-option>
<el-option label="已完成" value="3"></el-option>
<el-option label="失败" value="4"></el-option>
</el-select>
<el-select v-model="filterType" placeholder="巡检类型" clearable>
<el-select v-model="filterType" placeholder="实验对象类型" clearable>
<el-option label="全部类型" value="all"></el-option>
<el-option label="数据库" value="database"></el-option>
<el-option label="服务器" value="server"></el-option>
<el-option label="网络设备" value="network"></el-option>
<el-option label="安全试验" value="1"></el-option>
<el-option label="网络实验" value="2"></el-option>
<el-option label="性能试验" value="3"></el-option>
<el-option label="其他试验" value="4"></el-option>
</el-select>
<el-date-picker
@ -140,11 +142,11 @@
:class="{ 'passed': record.status === 'completed', 'failed': record.status === 'failed' }"
>
<div class="record-header">
<h3 class="record-title">{{ record.taskName || '试验任务' }}</h3>
<h3 class="record-title">{{ record.taskName || record.testPlan?.planName || '试验任务' }}</h3>
<p class="record-date">
开始时间
{{ formatDate(record.beginTime) }}
<span class="record-time">计划完成时间: {{ record.planFinishTime ? formatDate(record.planFinishTime) : '未知' }}</span>
<span class="record-time">计划完成时间: {{ record.endTime ? formatDate(record.endTime) : '未知' }}</span>
</p>
<span class="status-tag" :class="getStatusClass(record.status)">
{{ getStatusText(record.status) }}
@ -172,11 +174,11 @@
<!-- 试验结果 -->
<div class="test-result" :class="{ 'failure-analysis': record.status === 'failed' }">
<h4 class="result-title">
{{ record.status === '3' ? '失败原因分析' : '试验结果' }}
{{ record.status === '4' ? '失败原因分析' : '试验结果' }}
</h4>
<p class="result-content">
{{ record.status === '3' ? record.failReason || '未提供失败原因' : record.testFinal || '试验未完成,未提供详细结果' }}
{{ record.status === '4' ? record.failReason || '未提供失败原因' : record.testFinal || '试验未完成,未提供详细结果' }}
</p>
<p class="result-details" v-if="record.status !== 'failed'">
@ -185,7 +187,7 @@
</p>
<!-- 改进建议仅失败时显示 -->
<div class="improvement-suggestion" v-if="record.status === 'failed' && record.faileTips">
<div class="improvement-suggestion" v-if="record.status === '4' && record.faileTips">
<i class="fas fa-lightbulb"></i>
<p>建议: {{ record.faileTips }}</p>
</div>
@ -360,7 +362,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未完成' : node.status === '3' ? '失败' : '已完成' }}
</div>
</div>
</div>
@ -399,7 +401,7 @@ const activeTab = ref('record'); // 默认显示"试验记录"
// 2. 筛选条件
const keyword = ref('');
const filterStatus = ref('all');
const status = ref('all');
const filterType = ref('all');
const dateRange = ref([]);
@ -433,18 +435,33 @@ const currentPage = ref(1);
const pageSize = ref(20);
const totalRecords = ref(0);
// 7. 方法:获取试验记录数据
// 7. 方法:获取试验记录数据根据提供的JSON数据结构优化参数
const getTestRecords = async () => {
try {
const response = await syrenwulist({
// 构建与JSON数据结构匹配的查询参数
const queryParams = {
projectId: 1,
page: currentPage.value,
size: pageSize.value
});
pageNum: currentPage.value,
pageSize: pageSize.value,
// 筛选条件
keyword: keyword.value || undefined,
status: status.value === 'all' ? undefined : status.value,
testObject: filterType.value === 'all' ? undefined : filterType.value,
beginTime: dateRange.value.length > 0 ? dateRange.value[0] : undefined,
endTime: dateRange.value.length > 0 ? dateRange.value[1] : undefined
};
const response = await syrenwulist(queryParams);
console.log('syrenwulist API响应:', response);
if (response && response.code === 200 && response.rows) {
testRecords.value = response.rows;
// 处理返回的数据确保ID是字符串避免大整数精度问题
testRecords.value = response.rows.map((item) => ({
...item,
id: String(item.id), // 强制转换为字符串
// 处理personInfo字段确保与页面显示匹配
personInfo: item.person || item.persons?.[0] || null
}));
totalRecords.value = response.total;
}
} catch (error) {
@ -452,35 +469,51 @@ const getTestRecords = async () => {
}
};
// 前端过滤后的试验记录
// 前端过滤后的试验记录与JSON数据结构匹配
const filteredTestRecords = computed(() => {
let data = [...testRecords.value];
// 关键字过滤 - 匹配planName/planCode/负责人姓名
if (keyword.value && keyword.value.trim()) {
const kw = keyword.value.trim();
data = data.filter((rec) => {
return (
(rec.taskName && rec.taskName.includes(kw)) ||
(rec.planName && rec.planName.includes(kw)) ||
(rec.planCode && rec.planCode.includes(kw)) ||
(rec.personInfo?.userName && rec.personInfo.userName.includes(kw)) ||
(rec.id && String(rec.id).includes(kw))
);
});
}
// 可根据筛选状态/类型进一步过滤(若后续需要)
// 状态过滤 - 匹配返回数据中的status字段
if (status.value !== 'all') {
data = data.filter((rec) => rec.status === status.value);
}
// 类型过滤
if (filterType.value !== 'all') {
data = data.filter((rec) => rec.testObject === filterType.value);
}
return data;
});
// 搜索与重置
const handleSearch = () => {
// 若后端支持条件,可在此调用接口;当前保持前端过滤
// 重置为第一页并重新获取数据
currentPage.value = 1;
getTestRecords();
};
const resetFilters = () => {
keyword.value = '';
filterStatus.value = 'all';
status.value = 'all';
filterType.value = 'all';
dateRange.value = [];
currentPage.value = 1;
// 重置后重新获取数据
getTestRecords();
};
// 8. 方法:获取统计数据
@ -592,14 +625,13 @@ const getProgressColor = (status) => {
return colorMap[status] || '#e5e7eb';
};
// 15. 辅助方法:获取状态文本
// 15. 辅助方法:获取状态文本 - 根据返回数据更新状态映射
const getStatusText = (status) => {
const statusMap = {
'1': '待执行',
'4': '执行中',
'2': '已延期',
'5': '已完成',
'3': '失败',
'2': '执行中',
'3': '已完成',
'4': '失败',
'completed': '已完成',
'failed': '失败',
'paused': '已延期',
@ -628,14 +660,13 @@ const getTaskStatusText = (status) => {
return statusMap[status] || '未知状态';
};
// 17. 辅助方法:获取状态类名
// 17. 辅助方法:获取状态类名 - 根据返回数据更新状态类映射
const getStatusClass = (status) => {
const classMap = {
'1': 'tag-pending', // 待执行
'4': 'tag-executing', // 执行中
'2': 'tag-delayed', // 已延期
'5': 'tag-completed', // 已完成
'3': 'status-failed', // 失败
'2': 'tag-executing', // 执行中
'3': 'tag-completed', // 已完成
'4': 'status-failed', // 失败
'completed': 'tag-completed',
'failed': 'status-failed',
'paused': 'tag-delayed',
@ -864,6 +895,12 @@ onMounted(async () => {
border-color: #b7eb8f;
}
.tag-incomplete {
background-color: #f5f5f5;
color: #999;
border-color: #d9d9d9;
}
/* 保留原有的部分样式以确保兼容性 */
.status-in-progress {
background-color: #fffbe6;

View File

@ -32,19 +32,11 @@
<el-option label="待执行" value="1"></el-option>
<el-option label="执行中" value="4"></el-option>
<el-option label="已延期" value="2"></el-option>
<el-option label="已完成" value="5"></el-option>
<el-option label="失败" value="3"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="planType" placeholder="全部计划">
<el-option label="每日巡检计划" value="1"></el-option>
<!-- 对应接口testPlanId -->
<el-option label="每周巡检计划" value="2"></el-option>
<el-option label="每月巡检计划" value="3"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select v-model="executor" placeholder="执行人">
<el-option label="全部人员" value="all"></el-option>
@ -376,7 +368,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未执行' : node.status === '3' ? '失败' : '已完成' }}
</div>
</div>
</div>
@ -553,10 +545,11 @@ const getStatusClass = (status) => {
// 处理可能的数字输入
const statusStr = status?.toString() || '';
const statusClassMap = {
'1': 'status-pending',
'2': 'status-delayed',
'3': 'status-executing',
'4': 'status-completed'
'1': 'status-pending', // 待执行
'2': 'status-unknown', // 未完成 - 灰色
'3': 'status-failed', // 失败 - 红色
'4': 'status-executing', // 执行中
'5': 'status-completed' // 已完成 - 绿色
};
return statusClassMap[statusStr] || 'status-unknown';
};
@ -591,7 +584,7 @@ const getStepStatusText = (status) => {
const statusMap = {
'1': '待执行',
'2': '执行中',
'3': '已完成',
'3': '失败',
'4': '已延期'
};
return statusMap[statusStr] || '未知状态';
@ -705,14 +698,14 @@ const getExperimentPlanList = async () => {
const getTaskList = async () => {
try {
loading.value = true;
// 1. 构造接口请求参数(严格匹配createDept结构)
// 1. 构造接口请求参数(严格匹配返回的JSON数据结构)
const requestParams = {
pageNum: currentPage.value,
pageSize: pageSize.value,
projectId: 1, // 项目ID必需字段,需从全局状态/路由获取真实值
status: taskStatus.value || undefined, // 任务状态(为空不传递
testPlanId: planType.value || undefined, // 关联计划ID筛选条件
person: executor.value === 'all' ? undefined : executor.value // 执行人ID筛选条件
projectId: 1, // 项目ID必需字段
status: taskStatus.value || undefined, // 任务状态(对应JSON中的status字段
testPlanId: planType.value || undefined, // 关联计划ID对应JSON中的testPlanId字段
person: executor.value === 'all' ? undefined : executor.value // 执行人ID对应JSON中的person字段
};
// 2. 调用接口已引入的syrenwulist函数
@ -764,9 +757,9 @@ const mapApiToView = (apiData) => {
result: '-'
},
'2': {
statusText: '已延期',
statusText: '未完成',
cardClass: 'card-delayed',
tagClass: 'tag-delayed',
tagClass: 'status-unknown',
actionText: '重新安排',
actionClass: 'reschedule-btn',
result: '-'
@ -774,7 +767,7 @@ const mapApiToView = (apiData) => {
'3': {
statusText: '失败',
cardClass: 'card-failed',
tagClass: 'tag-failed',
tagClass: 'status-failed',
actionText: '重新执行',
actionClass: 'reschedule-btn',
result: '失败',
@ -1123,9 +1116,9 @@ const handleAction = async (task) => {
case '3': // 失败 → 重试状态改为1
updateParams.status = '1';
// 清空失败相关字段,使用适合各字段数据类型的默认值
updateParams.failReason = '';
updateParams.failTime = ''; // 时间类型字段使用null
updateParams.failPhase = ''; // 整数类型字段使用0
updateParams.failReason = null;
updateParams.failTime = null; // 时间类型字段使用null
updateParams.failPhase = null; // 整数类型字段使用0
// 将失败的步骤状态改回2未完成
if (taskDetails.nodes && Array.isArray(taskDetails.nodes)) {
@ -1607,6 +1600,12 @@ const getTaskStatusClass = (status) => {
border-color: #ffccc7;
}
.tag-incomplete {
background-color: #f5f5f5;
color: #999;
border-color: #d9d9d9;
}
.task-details {
margin-bottom: 16px;
}
@ -1887,10 +1886,14 @@ const getTaskStatusClass = (status) => {
color: #f56c6c;
}
.status-failed {
.status-unknown {
color: #909399;
}
.status-failed {
color: #f56c6c;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.task-cards {

View File

@ -145,7 +145,7 @@
</div> -->
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">解决效率</span>
<span class="text-gray-600">问题解决效率</span>
<span class="font-medium text-gray-800">{{ timelinessRate }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2 overflow-hidden">
@ -394,7 +394,7 @@ const initPieChart = () => {
},
data: [
{ value: completionRate.value, name: '巡检完成率', itemStyle: { color: '#409eff' } },
{ value: timelinessRate.value, name: '解决效率', itemStyle: { color: '#67c23a' } }
{ value: timelinessRate.value, name: '问题解决效率', itemStyle: { color: '#67c23a' } }
]
}
]
@ -434,12 +434,12 @@ const fetchDashboardData = async () => {
// 根据时间范围确定type参数1是月2是周3是日
let type;
if (timeRange.value === 'month') {
type = 1;
type = 3;
} else if (timeRange.value === 'week') {
type = 2;
} else {
// day
type = 3;
type = 1;
}
// 构建查询参数

View File

@ -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>
@ -391,7 +386,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未执行' : node.status === '3' ? '失败' : '已完成' }}
</div>
</div>
</div>
@ -441,6 +436,10 @@ const planType = ref('');
const executor = ref('');
const keyword = ref('');
// 执行人列表相关
const usersList = ref([]);
const loadingUsers = ref(false);
// 任务数据 - 初始为空数组通过API获取
const tasks = ref([]);
@ -468,9 +467,9 @@ const getStatusClass = (status) => {
const statusStr = status?.toString() || '';
const statusClassMap = {
'1': 'status-pending',
'2': 'status-delayed',
'3': 'status-executing',
'4': 'status-completed'
'2': 'status-unknown', // 未完成状态显示为灰色
'3': 'status-failed', // 失败状态显示为红色
'4': 'status-completed' // 已完成状态显示为绿色
};
return statusClassMap[statusStr] || 'status-unknown';
};
@ -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;
}
};
@ -1462,166 +1483,6 @@ const handleAction = async (task) => {
}
}
/* 任务详情弹窗样式 */
.task-detail-container {
max-height: 600px;
overflow-y: auto;
}
/* 步骤条展示样式 */
.step-item {
display: flex;
align-items: flex-start;
margin-bottom: 12px;
padding: 12px;
background-color: #fafafa;
border-radius: 6px;
transition: all 0.3s ease;
}
.step-item:hover {
background-color: #f5f7fa;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.step-number {
width: 28px;
height: 28px;
background-color: #409eff;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 12px;
font-size: 14px;
font-weight: bold;
flex-shrink: 0;
}
.step-info {
flex: 1;
}
.step-name {
font-weight: 500;
color: #1d2129;
margin-bottom: 4px;
font-size: 14px;
}
.step-purpose {
color: #606266;
margin-bottom: 4px;
font-size: 13px;
}
.step-time,
.step-finish-time,
.step-remark {
color: #909399;
font-size: 12px;
margin-bottom: 2px;
}
.step-status {
padding: 4px 12px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
flex-shrink: 0;
margin-top: 4px;
}
/* 步骤状态样式 */
.step-status.status-pending {
background-color: #e6f7ff;
color: #1677ff;
border: 1px solid #91d5ff;
}
.step-status.status-executing {
background-color: #fffbe6;
color: #fa8c16;
border: 1px solid #ffe58f;
}
.step-status.status-completed {
background-color: #f6ffed;
color: #52c41a;
border: 1px solid #b7eb8f;
}
.step-status.status-delayed {
background-color: #fff2f0;
color: #ff4d4f;
border: 1px solid #ffccc7;
}
.detail-card {
margin-bottom: 20px;
padding: 20px;
background-color: #fafafa;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.card-title {
margin: 0 0 16px 0;
padding-bottom: 12px;
border-bottom: 2px solid #409eff;
font-size: 16px;
font-weight: 600;
color: #303133;
}
.card-content {
display: flex;
flex-direction: column;
gap: 12px;
}
.info-row {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.info-item {
flex: 1;
min-width: 280px;
}
.info-item.full-width {
min-width: 100%;
}
.info-label {
display: inline-block;
width: 100px;
color: #606266;
font-weight: 500;
}
.info-value {
color: #303133;
word-break: break-word;
}
.fail-reason {
color: #f56c6c;
}
.no-info {
color: #909399;
font-style: italic;
padding: 10px 0;
}
.loading-details {
padding: 20px 0;
}
/* 状态颜色样式 */
.status-pending {
color: #e6a23c;

View File

@ -39,8 +39,8 @@
<div class="filter-item">
<el-select v-model="workOrderStatus" placeholder="全部状态" clearable>
<el-option label="全部状态" value="all"></el-option>
<el-option label="待派单" value="accepted"></el-option>
<el-option label="待处理" value="pending"></el-option>
<el-option label="待派单" value="pending"></el-option>
<el-option label="已派单" value="accepted"></el-option>
<el-option label="执行中" value="executing"></el-option>
<el-option label="已完成" value="completed"></el-option>
</el-select>
@ -475,7 +475,7 @@
<div v-if="node.remark" class="step-remark">备注{{ node.remark }}</div>
</div>
<div class="step-status" :class="getStatusClass(node.status)">
{{ node.status === '2' ? '未完成' : '已完成' }}
{{ node.status === '2' ? '未执行' : node.status === '3' ? '失败' : '已完成' }}
</div>
<!-- 连接线 -->
<div v-if="index < detailData.nodes.length - 1" class="step-connector" :class="{ 'connector-completed': node.status !== '2' }"></div>
@ -1003,10 +1003,10 @@ const pagedTableData = computed(() => {
let statusText = '';
switch (workOrderStatus.value) {
case 'accepted':
statusText = '已单';
statusText = '已单';
break;
case 'pending':
statusText = '待处理';
statusText = '待派单';
break;
case 'executing':
statusText = '执行中';
@ -1090,10 +1090,10 @@ const getStatusClass = (status) => {
// 处理可能的数字输入
const statusStr = status?.toString() || '';
const statusClassMap = {
'1': 'status-pending',
'2': 'status-delayed',
'3': 'status-executing',
'4': 'status-completed'
'1': 'status-pending', // 待执行 - 蓝色
'2': 'status-unknown', // 未执行 - 灰色
'3': 'status-failed', // 失败 - 红色
'4': 'status-completed' // 已完成 - 绿色
};
return statusClassMap[statusStr] || 'status-unknown';
};