diff --git a/.env.development b/.env.development index f8f2a3b..36f63d9 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源场站智慧运维平台 VITE_APP_ENV = 'development' # 开发环境 -VITE_APP_BASE_API = 'http://192.168.110.149:18899' +VITE_APP_BASE_API = 'http://192.168.110.210:18899' # 应用访问路径 例如使用前缀 /admin/ VITE_APP_CONTEXT_PATH = '/' diff --git a/src/utils/index.ts b/src/utils/index.ts index 9ddb698..f64e4b6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -365,9 +365,9 @@ export const getStepStatusText = (status: string | number): string => { const statusMap: Record = { '1': '待执行', '2': '执行中', - '3': '已完成', + '3': '失败', '4': '已延期', - '5': '失败' + '5': '已完成' }; return statusMap[statusStr] || '未知状态'; }; diff --git a/src/views/zhinengxunjian/banzhuzhuangtai.vue b/src/views/zhinengxunjian/banzhuzhuangtai.vue index c2ad935..3cbe46e 100644 --- a/src/views/zhinengxunjian/banzhuzhuangtai.vue +++ b/src/views/zhinengxunjian/banzhuzhuangtai.vue @@ -22,17 +22,37 @@ -
-
- - 新增班组 + +
+
+ + + + + + + + + + + + + + + + + + 搜索 + 重置 + + +
+
+ +
+ 新增班组 +
@@ -177,13 +197,35 @@ @@ -1578,7 +1624,8 @@ setTimeout(() => { .detail-value { flex: 1; color: #4e5969; - word-break: break-all; + word-break: break-word; + line-height: 1.5; } .task-result { @@ -1595,13 +1642,7 @@ setTimeout(() => { align-items: center; padding-top: 12px; border-top: 1px solid #f0f2f5; - position: absolute; - bottom: 16px; - right: 16px; - left: 16px; background-color: #fff; - padding: 12px 0 0 0; - z-index: 10; } .action-btn { @@ -1705,10 +1746,11 @@ setTimeout(() => { } .task-title { - font-size: 14px; + font-size: 16px; font-weight: 500; color: #1d2129; line-height: 1.4; + word-break: break-word; flex: 1; margin-right: 8px; } @@ -1721,35 +1763,32 @@ setTimeout(() => { border: 1px solid transparent; } -/* 不同故障类型的颜色 */ -/* 电力,设备故障为红色 */ -.task-type-tag.electric, -.task-type-tag.equipment { +/* 优先级标签背景色样式 - 与保修管理页面保持一致 */ +.priority-high { background-color: #fff2f0; color: #ff4d4f; border-color: #ffccc7; } -/* 供水,设备损坏为黄色 */ -.task-type-tag.water, -.task-type-tag.damage { +.priority-medium { background-color: #fffbe6; color: #fa8c16; border-color: #ffe58f; } -/* 其余为绿色 */ -.task-type-tag { - background-color: #f6ffed; - color: #52c41a; - border-color: #b7eb8f; +.priority-low { + background-color: #e6f7ff; + color: #1890ff; + border-color: #91d5ff; } .task-card:hover { transform: translateY(-3px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); } -.task-card[data-v-2668390e]::before { + +/* 左侧状态线样式 - 与保修管理页面保持一致 */ +.task-card::before { content: ''; position: absolute; left: 0; @@ -1757,6 +1796,22 @@ setTimeout(() => { bottom: 0; width: 4px; } + +.left-line-high::before { + background-color: #ff4d4f; +} + +.left-line-medium::before { + background-color: #fa8c16; +} + +.left-line-low::before { + background-color: #1677ff; +} + +.left-line-completed::before { + background-color: #52c41a; +} .task-details { margin-bottom: 16px; } @@ -1769,8 +1824,9 @@ setTimeout(() => { } .detail-label { - flex: 0 0 70px; + flex: 0 0 85px; color: #86909c; + margin-right: 4px; } .detail-value { diff --git a/src/views/zhinengxunjian/qiangxiujilu.vue b/src/views/zhinengxunjian/qiangxiujilu.vue index 160e252..b66cdf9 100644 --- a/src/views/zhinengxunjian/qiangxiujilu.vue +++ b/src/views/zhinengxunjian/qiangxiujilu.vue @@ -19,9 +19,12 @@
- +
+
+ +
@@ -36,10 +39,9 @@
- + - - +
@@ -54,6 +56,7 @@
搜索 + 重置
@@ -64,7 +67,9 @@

本月抢修总数

{{ isCardLoading ? '加载中...' : statisticsData.totalCount }}

-

较上月:{{ statisticsData.monthChange }}

+

+ 较上月{{ statisticsData.monthChangeClass === 'warning' ? '无增长' : ':' + statisticsData.monthChange }} +

本月抢修总数 @@ -75,7 +80,9 @@

平均抢修时长

{{ isCardLoading ? '加载中...' : statisticsData.avgDuration }}

-

较上月:{{ statisticsData.durationChange }}

+

+ 较上月{{ statisticsData.durationChangeClass === 'warning' ? '无增长' : ':' + statisticsData.durationChange }} +

平均抢修时长 @@ -97,7 +104,9 @@

按时完成率

{{ isCardLoading ? '加载中...' : statisticsData.completionRate }}

-

{{ statisticsData.rateChange }}

+

+ {{ statisticsData.rateChangeClass === 'warning' ? '较上月无增长' : statisticsData.rateChange }} +

按时完成率 @@ -360,6 +369,7 @@ const priority = ref(''); const executor = ref(''); const dateRange = ref([]); const showFilter = ref(false); +const keyword = ref(''); // 表单验证规则 const assignTaskRules = { @@ -415,19 +425,58 @@ 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); if (res && res.code === 200) { // 更新表格数据,将接口返回的字段映射到表格期望的字段 - repairRecords.value = Array.isArray(res.rows) + const mapped = Array.isArray(res.rows) ? res.rows.map((item) => ({ // 映射抢修单号 reportNo: `R-${item.id || '000'}`, @@ -454,7 +503,17 @@ const getTaskList = async () => { originalData: item })) : []; - total.value = res.total || 0; + + // 关键词过滤 + 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)) + ) + : mapped; + + repairRecords.value = filtered; + total.value = kw ? filtered.length : res.total || filtered.length; } else { ElMessage.error(`获取抢修记录失败:${res?.msg || '未知错误'}`); repairRecords.value = []; @@ -586,15 +645,33 @@ const getStatisticsData = async () => { const res = await qiangxiuRecord({ projectId: 1 }); if (res && res.code === 200) { - // 更新统计卡片数据 + // API返回的实际数据在data字段中 + const data = res.data || {}; + + // 更新统计卡片数据 - 映射新的API返回字段 + // 解析百分比数据并添加判断逻辑 + const bxsPercent = parseFloat(data.bxsjszzzl) || 0; + const clscPercent = parseFloat(data.clscjszzzl) || 0; + const wclPercent = parseFloat(data.wcljszzzl) || 0; + + // 判断并设置变化率样式类 + const getChangeClass = (percent) => { + if (percent > 100) return 'up'; + if (percent < 100 && percent !== 0) return 'down'; + return 'warning'; // 等于100或0时显示为灰色(无变化) + }; + statisticsData.value = { - totalCount: res.totalCount || 0, - avgDuration: res.avgDuration || '0分钟', - pendingCount: res.pendingCount || 0, - completionRate: res.completionRate || '0%', - monthChange: res.monthChange || '+0%', - durationChange: res.durationChange || '-0分钟', - rateChange: res.rateChange || '+0%' + totalCount: data.byzbxs || 0, // 本月报修总数 + avgDuration: `${data.pjclsc || 0}分钟`, // 平均处理时长 + pendingCount: data.dclbx || 0, // 待处理报修 + completionRate: `${data.wcl || 0}%`, // 完成率 + monthChange: `${bxsPercent > 0 ? '+' : ''}${bxsPercent}%`, // 报修数较上月变化 + monthChangeClass: getChangeClass(bxsPercent), // 报修数变化率样式类 + durationChange: `${clscPercent > 0 ? '+' : '-'}${Math.abs(clscPercent)}分钟`, // 处理时长较上月变化 + durationChangeClass: getChangeClass(clscPercent), // 处理时长变化率样式类 + rateChange: `${wclPercent > 0 ? '+' : ''}${wclPercent}%`, // 完成率较上月变化 + rateChangeClass: getChangeClass(wclPercent) // 完成率变化率样式类 }; } else { ElMessage.error(`获取统计数据失败:${res?.msg || '未知错误'}`); @@ -609,7 +686,7 @@ const getStatisticsData = async () => { // 初始化数据 const initData = async () => { - await Promise.all([getTaskList(), getStatisticsData()]); + await Promise.all([getTaskList(), getStatisticsData(), getUsersList()]); }; // 组件挂载时初始化数据 @@ -649,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(''); @@ -732,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('获取人员列表失败,请稍后重试'); @@ -1122,7 +1212,7 @@ const handleInspectionManagement2 = () => { } .stat-trend.warning { - color: #fa8c16; + color: #999; } .stat-icon { @@ -1210,39 +1300,53 @@ const handleInspectionManagement2 = () => { } .status-tag { - padding: 2px 8px; - border-radius: 4px; + padding: 4px 10px; + border-radius: 6px; font-size: 12px; + font-weight: 500; } -.status-tag.processing { +.status-processing { background-color: #fffbe6; - color: #faad14; - border: 1px solid #fff1b8; + color: #fa8c16; + border: 1px solid #ffe58f; } -.status-tag.completed { - background-color: #f0f9eb; +.status-completed { + background-color: #f6ffed; color: #52c41a; - border: 1px solid #e1f3d8; + border: 1px solid #b7eb8f; +} + +.status-pending { + background-color: #e6f7ff; + color: #1677ff; + border: 1px solid #91d5ff; } .priority-tag { - padding: 2px 8px; - border-radius: 4px; + padding: 4px 10px; + border-radius: 6px; font-size: 12px; + font-weight: 500; } -.priority-tag.urgent { - background-color: #ffebe6; +.priority-urgent { + background-color: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; } -.priority-tag.normal { +.priority-normal { background-color: #e6f7ff; - color: #1890ff; - border: 1px solid #b3d8ff; + color: #1677ff; + border: 1px solid #91d5ff; +} + +.priority-fatal { + background-color: #fff2f0; + color: #ff4d4f; + border: 1px solid #ffccc7; } .detail-btn { @@ -1253,6 +1357,10 @@ const handleInspectionManagement2 = () => { color: #fa8c16; } +.evaluate-btn { + color: #52c41a; +} + /* 分页区域样式 */ .pagination-section { display: flex; diff --git a/src/views/zhinengxunjian/renyuanzhuangtai.vue b/src/views/zhinengxunjian/renyuanzhuangtai.vue index ce97e86..6e9b97f 100644 --- a/src/views/zhinengxunjian/renyuanzhuangtai.vue +++ b/src/views/zhinengxunjian/renyuanzhuangtai.vue @@ -443,9 +443,6 @@ const handleInspectionManagement3 = () => { margin-bottom: 16px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); } - -/* */ - /* 内容容器样式 */ .content-container { display: flex; diff --git a/src/views/zhinengxunjian/shiyanguanli.vue b/src/views/zhinengxunjian/shiyanguanli.vue index 00dda93..14043ce 100644 --- a/src/views/zhinengxunjian/shiyanguanli.vue +++ b/src/views/zhinengxunjian/shiyanguanli.vue @@ -24,18 +24,26 @@
- + + - - - + + + + - + - - - + + + + + + + + +
- 搜索 + 搜索 + 重置 新增实验记录
@@ -581,8 +590,10 @@ const activeTab = ref('plan'); // 默认为"巡检计划" const timeRange = ref('month'); // 统计时间范围:月/周/日 // 2. 筛选条件 +const keyword = ref(''); const filterStatus = ref('all'); const filterType = ref('all'); +const filterManager = ref('all'); const dateRange = ref([]); // 分页参数 @@ -600,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); @@ -628,6 +645,23 @@ const fetchExperimentData = async () => { } }; +// 搜索与重置(当前数据主要来自接口,保留前端筛选入口) +const handleSearch = () => { + // 可根据项目需要将 keyword/filter 传给接口;当前保持页内刷新 + currentPage.value = 1; + fetchExperimentData(); +}; + +const resetFilters = () => { + keyword.value = ''; + filterStatus.value = 'all'; + filterType.value = 'all'; + filterManager.value = 'all'; + dateRange.value = []; + currentPage.value = 1; + fetchExperimentData(); +}; + // 辅助方法 const getTestObjectText = (type) => { const typeMap = { @@ -717,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) => { @@ -786,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); // 保存加载状态 @@ -1104,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 = () => { @@ -1214,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}`; -};