@@ -479,6 +483,7 @@ const loading = ref(false);
// 筛选条件(与接口参数对应)
const taskStatus = ref(''); // 任务状态:1=待执行,2=暂停(已延期),3=失败,4=执行中,5=已完成
const planType = ref(''); // 关联计划ID:1=每日,2=每周,3=每月
+const keyword = ref(''); // 关键词
/**
* 将节点数据按模块分组
@@ -716,8 +721,18 @@ const getTaskList = async () => {
if (response.code === 200) {
// 3. 接口数据映射为页面展示格式
- tasks.value = (response.rows || []).map((item) => mapApiToView(item));
- total.value = response.total || 0; // 同步总条数
+ const mapped = (response.rows || []).map((item) => mapApiToView(item));
+ // 4. 前端关键词过滤
+ const kw = keyword.value.trim();
+ const filtered = kw
+ ? mapped.filter((t) =>
+ [t.title, t.target, t.executor, t.relatedPlan, t.statusText]
+ .filter(Boolean)
+ .some((v) => String(v).toLowerCase().includes(kw.toLowerCase()))
+ )
+ : mapped;
+ tasks.value = filtered;
+ total.value = kw ? filtered.length : response.total || filtered.length; // 同步总条数
} else {
ElMessage.error('获取任务列表失败:' + (response.msg || '未知错误'));
tasks.value = [];
@@ -833,6 +848,18 @@ const mapApiToView = (apiData) => {
try {
// 优先查找nodes数组中处于执行中或失败的节点来确定当前试验阶段
if (apiData && apiData.nodes && Array.isArray(apiData.nodes)) {
+ // 优先查找失败状态的节点(根据需求,优先显示status为3的数据)
+ const failedNode = apiData.nodes.find((node) => {
+ if (!node || node.status === undefined) return false;
+ return node.status === '3' || node.status === 3;
+ });
+
+ // 如果有失败的节点,根据code判断阶段
+ if (failedNode && failedNode.code !== undefined) {
+ const stepName = failedNode.name || '未命名步骤';
+ return `第${failedNode.code}步(${stepName})`;
+ }
+
// 查找执行中状态的节点
const executingNode = apiData.nodes.find((node) => {
if (!node || node.status === undefined) return false;
@@ -845,18 +872,6 @@ const mapApiToView = (apiData) => {
return `第${executingNode.code}步(${stepName})`;
}
- // 查找失败状态的节点
- const failedNode = apiData.nodes.find((node) => {
- if (!node || node.status === undefined) return false;
- return node.status === '3' || node.status === 3;
- });
-
- // 如果有失败的节点,根据code判断阶段
- if (failedNode && failedNode.code !== undefined) {
- const stepName = failedNode.name || '未命名步骤';
- return `第${failedNode.code}步(${stepName})`;
- }
-
// 查找已完成的节点,确定最后完成的阶段
const completedNodes = apiData.nodes.filter((node) => {
if (!node || node.status === undefined) return false;
@@ -921,6 +936,16 @@ const handleSearch = () => {
getTaskList();
};
+// 重置筛选条件
+const resetFilters = () => {
+ taskStatus.value = '';
+ planType.value = '';
+ executor.value = 'all';
+ keyword.value = '';
+ currentPage.value = 1;
+ getTaskList();
+};
+
/**
* 每页条数变化
* @param {number} val - 新的每页条数
diff --git a/src/views/zhinengxunjian/xunjianjihua.vue b/src/views/zhinengxunjian/xunjianjihua.vue
index 3160b96..e4d4f6a 100644
--- a/src/views/zhinengxunjian/xunjianjihua.vue
+++ b/src/views/zhinengxunjian/xunjianjihua.vue
@@ -654,46 +654,7 @@ const handleInspectionManagement3 = () => {
}
/* 导航栏样式 */
-.navigation-tabs {
- display: flex;
- margin-bottom: 20px;
- background-color: #fff;
- border-radius: 4px;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
- padding: 2px;
-}
-
-.nav-tab {
- padding: 12px 24px;
- cursor: pointer;
- transition: all 0.3s ease;
- border-radius: 4px;
- font-size: 14px;
- color: #606266;
- border-right: 1px solid #f0f0f0;
- flex: 1;
- text-align: center;
-}
-
-.nav-tab:last-child {
- border-right: none;
-}
-
-.nav-tab:hover {
- color: #409eff;
- background-color: #ecf5ff;
-}
-
-.nav-tab.active {
- background-color: #409eff;
- color: #fff;
- box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
-}
-
-.nav-tab {
- cursor: pointer;
- user-select: none;
-}
+/* 已移除未使用的导航样式(模板中为注释状态) */
/* 选项卡样式 */
.tabs-wrapper {
diff --git a/src/views/zhinengxunjian/xunjianrenwu.vue b/src/views/zhinengxunjian/xunjianrenwu.vue
index b2e3022..325da96 100644
--- a/src/views/zhinengxunjian/xunjianrenwu.vue
+++ b/src/views/zhinengxunjian/xunjianrenwu.vue
@@ -23,6 +23,9 @@
+
+
+
@@ -43,6 +46,7 @@
搜索
+ 重置
手动创建任务
@@ -429,11 +433,13 @@ import { xjrenwuDetail, xjrenwulist, addxjrenwu, updatexjrenwu } from '@/api/zhi
import { xunjianUserlist, xunjianlist } from '@/api/zhinengxunjian/xunjian/index';
import { addjiedian } from '@/api/zhinengxunjian/jiedian/index';
import { ElMessage, ElLoading, ElForm } from 'element-plus';
+import { formatDate } from '@/utils/index';
// 筛选条件
const taskStatus = ref('');
const planType = ref('');
const executor = ref('');
+const keyword = ref('');
// 任务数据 - 初始为空数组,通过API获取
const tasks = ref([]);
@@ -543,16 +549,13 @@ const getTaskList = async () => {
const params = {
pageSize: pageSize.value,
pageNum: currentPage.value,
- personId: 1,
- taskType: taskStatus.value || undefined, // 任务状态
- planType: planType.value || undefined, // 计划类型
- personName: executor.value || undefined // 执行人
+ projectId: 1
};
const response = await xjrenwulist(params);
if (response.code === 200 && response.rows) {
- tasks.value = response.rows.map((item) => {
+ const mapped = response.rows.map((item) => {
// 获取原始数据中的id
const taskId = item.id || '';
if (!taskId) {
@@ -603,13 +606,16 @@ const getTaskList = async () => {
return task;
});
-
- total.value = response.total || tasks.value.length;
-
- // 搜索后如果没有结果,显示提示信息
- if (tasks.value.length === 0) {
- ElMessage.info('未找到符合条件的任务');
- }
+ const kw = keyword.value.trim();
+ const filtered = kw
+ ? mapped.filter((t) =>
+ [t.title, t.target, t.executor, t.relatedPlan, t.statusText]
+ .filter(Boolean)
+ .some((v) => String(v).toLowerCase().includes(kw.toLowerCase()))
+ )
+ : mapped;
+ tasks.value = filtered;
+ total.value = kw ? filtered.length : response.total || filtered.length;
}
} catch (error) {
console.error('获取巡检任务数据失败:', error);
@@ -809,7 +815,7 @@ const handleSaveTask = async () => {
createTime: new Date().toISOString(),
updateTime: new Date().toISOString(),
- startTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
+ startTime: formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss'),
params: {
property1: 'string',
property2: 'string'
@@ -1045,7 +1051,7 @@ const handleAction = async (task) => {
const updateData = {
...originalTask.rawData,
id: task.id,
- startTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
+ startTime: formatDate(new Date().toString()),
taskType: '3', // 3表示执行中
status: 'executing',
taskProgress: 0
@@ -1072,14 +1078,7 @@ const handleAction = async (task) => {
const originalTask = tasks.value[taskIndex];
- const now = new Date();
- const year = now.getFullYear();
- const month = String(now.getMonth() + 1).padStart(2, '0');
- const day = String(now.getDate()).padStart(2, '0');
- const hours = String(now.getHours()).padStart(2, '0');
- const minutes = String(now.getMinutes()).padStart(2, '0');
- const seconds = String(now.getSeconds()).padStart(2, '0');
- const finishTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ const finishTime = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
const updateData = {
...originalTask.rawData,
diff --git a/src/views/zhinengxunjian/zhixingjilu.vue b/src/views/zhinengxunjian/zhixingjilu.vue
index d7185e3..8ec8f01 100644
--- a/src/views/zhinengxunjian/zhixingjilu.vue
+++ b/src/views/zhinengxunjian/zhixingjilu.vue
@@ -24,6 +24,9 @@
+
+
+
@@ -55,6 +58,7 @@
搜索
+ 重置
@@ -552,6 +556,7 @@ import ImageUpload from '@/components/ImageUpload/index.vue';
import { ElMessageBox, ElMessage } from 'element-plus';
// 筛选条件
+const keyword = ref('');
const workOrderType = ref('all');
const workOrderStatus = ref('all');
const priority = ref('all');
@@ -961,6 +966,18 @@ const pagedTableData = computed(() => {
// 筛选逻辑
let filteredData = [...rawTableData.value];
+ if (keyword.value && keyword.value.trim()) {
+ const kw = keyword.value.trim();
+ filteredData = filteredData.filter((item) => {
+ return (
+ (item.title && item.title.includes(kw)) ||
+ (item.description && item.description.includes(kw)) ||
+ (item.creator && item.creator.includes(kw)) ||
+ (item.orderNo && item.orderNo.includes(kw))
+ );
+ });
+ }
+
if (workOrderType.value !== 'all') {
// 转换筛选条件为显示文本进行匹配
let typeText = '';
@@ -1114,6 +1131,16 @@ const handleSearch = () => {
currentPage.value = 1; // 重置到第一页
};
+// 重置筛选
+const resetFilters = () => {
+ keyword.value = '';
+ workOrderType.value = 'all';
+ workOrderStatus.value = 'all';
+ priority.value = 'all';
+ createDate.value = '';
+ currentPage.value = 1;
+};
+
// 分页事件
const handleSizeChange = (val) => {
pageSize.value = val;
@@ -2191,46 +2218,7 @@ const handleCloseDetailDialog = () => {
}
/* 导航栏样式 */
-.navigation-tabs {
- display: flex;
- margin-bottom: 20px;
- background-color: #fff;
- border-radius: 4px;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
- padding: 2px;
-}
-
-.nav-tab {
- padding: 12px 24px;
- cursor: pointer;
- transition: all 0.3s ease;
- border-radius: 4px;
- font-size: 14px;
- color: #606266;
- border-right: 1px solid #f0f0f0;
- flex: 1;
- text-align: center;
-}
-
-.nav-tab:last-child {
- border-right: none;
-}
-
-.nav-tab:hover {
- color: #409eff;
- background-color: #ecf5ff;
-}
-
-.nav-tab.active {
- background-color: #409eff;
- color: #fff;
- box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
-}
-
-.nav-tab {
- cursor: pointer;
- user-select: none;
-}
+/* 导航栏相关样式移除(对应模板已注释) */
/* 弹窗样式 */
.create-dialog {
@@ -2711,17 +2699,7 @@ const handleCloseDetailDialog = () => {
}
/* 动画效果 */
-@keyframes pulse {
- 0% {
- box-shadow: 0 0 0 0 rgba(22, 93, 255, 0.4);
- }
- 70% {
- box-shadow: 0 0 0 10px rgba(22, 93, 255, 0);
- }
- 100% {
- box-shadow: 0 0 0 0 rgba(22, 93, 255, 0);
- }
-}
+/* 重复的 pulse 动画移除(下方已存在统一定义) */
.custom-steps {
padding: 20px 10px;
@@ -3122,17 +3100,7 @@ const handleCloseDetailDialog = () => {
position: relative;
overflow: hidden;
}
-.custom-steps::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 4px;
- background: linear-gradient(90deg, #165dff, #409eff, #69c0ff);
- z-index: 0;
- border-radius: 4px 4px 0 0;
-}
+/* 去重:自定义步骤条顶部装饰在下方统一块中定义 */
/* 重点跟踪区域样式 */
.tracking-section {
@@ -3350,17 +3318,7 @@ const handleCloseDetailDialog = () => {
}
/* 顶部装饰条 */
-.custom-steps::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 6px;
- background: linear-gradient(90deg, #165dff, #409eff, #69c0ff);
- border-radius: 6px 6px 0 0;
- box-shadow: 0 2px 12px rgba(22, 93, 255, 0.2);
-}
+/* 去重:自定义步骤条顶部装饰重复定义移除 */
/* 背景装饰 */
.custom-steps::after {
@@ -3376,30 +3334,10 @@ const handleCloseDetailDialog = () => {
}
/* 左侧装饰 */
-.custom-steps::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 6px;
- background: linear-gradient(90deg, #165dff, #409eff, #69c0ff);
- border-radius: 6px 6px 0 0;
- box-shadow: 0 2px 12px rgba(22, 93, 255, 0.2);
-}
+/* 去重:重复 before 装饰定义移除 */
/* 右侧装饰 */
-.custom-steps::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 6px;
- background: linear-gradient(90deg, #165dff, #409eff, #69c0ff);
- border-radius: 6px 6px 0 0;
- box-shadow: 0 2px 12px rgba(22, 93, 255, 0.2);
-}
+/* 去重:重复 before 装饰定义移除 */
/* 左侧装饰球 */
.custom-steps::before {