From dc16b68e74c18b617c8f79d82fd3c3306badbcbe Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十一月 2024 17:22:23 +0800 Subject: [PATCH] 修复场景报告中设备图片选择弹框错误问题 --- src/views/fysp/check/ProCheckProxy.js | 227 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 173 insertions(+), 54 deletions(-) diff --git a/src/views/fysp/check/ProCheckProxy.js b/src/views/fysp/check/ProCheckProxy.js index bebef21..938422f 100644 --- a/src/views/fysp/check/ProCheckProxy.js +++ b/src/views/fysp/check/ProCheckProxy.js @@ -1,4 +1,4 @@ -import { $fysp } from '@/api/index' +import { $fysp } from '@/api/index'; //闂鐘舵�� const proStatus = { @@ -8,7 +8,7 @@ change_unCheck: 'change_unCheck', change_fail: 'change_fail', change_pass: 'change_pass' -} +}; export default { //缁熻闂 @@ -34,25 +34,26 @@ passPer: '0%', //瀹℃牳鐜� checkPer: '0%' - } + }; proList.forEach((p) => { - if (p.ischanged) status.changeNum++ + if (p.ischanged) status.changeNum++; - if (p.extension3 == 'fail' || p.extension3 == 'change_fail') status.unpassNum++ + if (p.extension3 == 'fail' || p.extension3 == 'change_fail') + status.unpassNum++; else if ( p.extension3 == 'unCheck' || p.extension3 == 'change_unCheck' || (p.extension3 == 'pass' && p.ischanged) ) - status.uncheckNum++ - else status.passNum++ + status.uncheckNum++; + else status.passNum++; if (p.extension3 == proStatus.pass) { - status.proCheckedNum++ + status.proCheckedNum++; } if (p.extension3 == proStatus.change_pass) { - status.changeCheckedNum++ + status.changeCheckedNum++; } status.changePer = @@ -60,37 +61,71 @@ (status.changeNum / status.proNum) * 100 ? ((status.changeNum / status.proNum) * 100).toFixed(1) : 0 - ) + '%' + ) + '%'; status.passPer = String( (status.passNum / status.proNum) * 100 ? ((status.passNum / status.proNum) * 100).toFixed(1) : 0 - ) + '%' + ) + '%'; status.checkPer = String( ((status.passNum + status.unpassNum) / status.proNum) * 100 - ? (((status.passNum + status.unpassNum) / status.proNum) * 100).toFixed(1) + ? ( + ((status.passNum + status.unpassNum) / status.proNum) * + 100 + ).toFixed(1) : 0 - ) + '%' - }) + ) + '%'; + }); - return status + return status; }, //缁熻闂锛岃繑鍥炴暟缁勫舰寮� proStatusArray(proList) { - const status = this.calProStatus(proList) + const status = this.calProStatus(proList); return [ - { name: '闂鏁�', value: status.proNum }, - { name: '鏁存敼鏁�', value: status.changeNum }, - { name: '寰呭鏍�', value: status.uncheckNum }, - { name: '宸插鏍�', value: status.passNum }, - { name: '鏈�氳繃', value: status.unpassNum }, - { name: '鏁存敼鐜�', value: status.changePer }, - { name: '閫氳繃鐜�', value: status.passPer }, - { name: '瀹℃牳鐜�', value: status.checkPer } - ] + { name: '闂鏁�', value: status.proNum, type: 'info' }, + { + name: '鏁存敼鏁�', + value: status.changeNum, + type: status.changeNum < status.proNum ? 'danger' : 'info' + }, + { + name: '寰呭鏍�', + value: status.uncheckNum, + type: status.uncheckNum > 0 ? 'danger' : 'info' + }, + { name: '宸插鏍�', value: status.passNum, type: 'info' }, + // { + // name: '鏈�氳繃', + // value: status.unpassNum, + // type: status.unpassNum > 0 ? 'danger' : 'info' + // }, + { + name: '鏁存敼鐜�', + value: status.changePer, + type: + status.proNum > 0 && status.changePer != '100.0%' + ? 'danger' + : 'success' + }, + // { + // name: '閫氳繃鐜�', + // value: status.passPer, + // type: + // status.proNum > 0 && status.passPer != '100.0%' ? 'danger' : 'success' + // }, + { + name: '瀹℃牳鐜�', + value: status.checkPer, + type: + status.proNum > 0 && status.checkPer != '100.0%' + ? 'danger' + : 'success' + } + ]; }, //闂鍥剧墖鍜屾暣鏀瑰浘鐗� @@ -104,34 +139,118 @@ title: '鏁存敼鍥剧墖', path: [] } - ] + ]; if (pro.mediafileList) { pro.mediafileList.forEach((m) => { - pics[m.ischanged ? 1 : 0].path.push(`${$fysp.imgUrl}${m.extension1}${m.guid}.jpg`) - }) + pics[m.ischanged ? 1 : 0].path.push( + `${$fysp.imgUrl}${m.extension1}${m.guid}.jpg` + ); + }); } - return pics + return pics; }, //闂瀹℃牳鐘舵�佽浆鎹腑鏂� proStatusMap(p) { switch (p) { case proStatus.unCheck: - return { name: '闂鏈鏍�', type: 'warning', index: 0, checkable: true, deletable: true, changeable: false } + return { + name: '闂鏈鏍�', + type: 'warning', + index: 0, + checkable: true, + deletable: true, + changeable: false + }; case proStatus.pass: - return { name: '闂閫氳繃', type: 'success', index: 1, checkable: false, deletable: true, changeable: false } + return { + name: '闂閫氳繃', + type: 'success', + index: 1, + checkable: false, + deletable: true, + changeable: false + }; case proStatus.fail: - return { name: '闂涓嶉�氳繃', type: 'danger', index: 1, checkable: false, deletable: true, changeable: false } + return { + name: '闂涓嶉�氳繃', + type: 'danger', + index: 1, + checkable: false, + deletable: true, + changeable: false + }; case proStatus.change_unCheck: - return { name: '鏁存敼鏈鏍�', type: 'warning', index: 2, checkable: true, deletable: false, changeable: true } + return { + name: '鏁存敼鏈鏍�', + type: 'warning', + index: 2, + checkable: true, + deletable: false, + changeable: true + }; case proStatus.change_fail: - return { name: '鏁存敼涓嶉�氳繃', type: 'danger', index: 3, checkable: false, deletable: false, changeable: true } + return { + name: '鏁存敼涓嶉�氳繃', + type: 'danger', + index: 3, + checkable: false, + deletable: false, + changeable: true + }; case proStatus.change_pass: - return { name: '鏁存敼閫氳繃', type: 'success', index: 3, checkable: false, deletable: false, changeable: true } + return { + name: '鏁存敼閫氳繃', + type: 'success', + index: 3, + checkable: false, + deletable: false, + changeable: true + }; default: - return { name: '闂鏈鏍�', type: 'warning', index: 0, checkable: true, deletable: true } + return { + name: '闂鏈鏍�', + type: 'warning', + index: 0, + checkable: true, + deletable: true + }; } + }, + + //鑾峰彇浠诲姟闂鐨勫鏍告儏鍐� + getSubtaskType(s) { + let type = 0; + // 鏃犻棶棰� + if (s.proNum == 0) { + type = 0; + } + // 闂鏈鏍� + else if (s.proCheckedNum == 0) { + type = 1; + } + // 闂閮ㄥ垎瀹℃牳 + else if (s.proCheckedNum < s.proNum) { + type = 2; + } + // 鏈暣鏀� + else if (s.changeNum < s.proNum) { + type = 3; + } + // 鏁存敼鏈鏍� + else if (s.changeCheckedNum == 0) { + type = 4; + } + // 鏁存敼閮ㄥ垎瀹℃牳 + else if (s.changeCheckedNum < s.changeNum) { + type = 5; + } + // 瀹屽叏瀹℃牳 + else { + type = 6; + } + return type; }, /** @@ -141,18 +260,18 @@ * @returns 涓嬩竴涓棶棰樼姸鎬� */ proNextStatus(s, isPass) { - let status, action + let status, action; switch (s) { case proStatus.unCheck: - status = isPass ? proStatus.pass : proStatus.fail - action = isPass ? 0 : 1 - break + status = isPass ? proStatus.pass : proStatus.fail; + action = isPass ? 0 : 1; + break; case proStatus.change_unCheck: - status = isPass ? proStatus.change_pass : proStatus.change_fail - action = isPass ? 2 : 3 - break + status = isPass ? proStatus.change_pass : proStatus.change_fail; + action = isPass ? 2 : 3; + break; } - return { status: status, action: action } + return { status: status, action: action }; }, /** @@ -161,19 +280,19 @@ * @returns 涓嬩竴涓棶棰樼姸鎬� */ proBeforeStatus(s) { - let status, action + let status, action; switch (s) { case proStatus.fail: case proStatus.pass: - status = proStatus.unCheck - action = 4 - break - case proStatus.change_fail: + status = proStatus.unCheck; + action = 4; + break; + case proStatus.change_fail: case proStatus.change_pass: - status = proStatus.change_unCheck - action = 5 - break + status = proStatus.change_unCheck; + action = 5; + break; } - return { status: status, action: action } + return { status: status, action: action }; } -} +}; -- Gitblit v1.9.3