| | |
| | | import { $fysp } from '@/api/index' |
| | | import { $fysp } from '@/api/index'; |
| | | |
| | | //问题状态 |
| | | const proStatus = { |
| | |
| | | change_unCheck: 'change_unCheck', |
| | | change_fail: 'change_fail', |
| | | change_pass: 'change_pass' |
| | | } |
| | | }; |
| | | |
| | | export default { |
| | | //统计问题 |
| | |
| | | //未通过数量 |
| | | unpassNum: 0, |
| | | //整改率 |
| | | changePer: '0%', |
| | | changePer: '--', |
| | | //通过率 |
| | | 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++ |
| | | if (p.extension3 != proStatus.unCheck) { |
| | | status.proCheckedNum++; |
| | | } |
| | | if (p.extension3 == proStatus.change_pass) { |
| | | status.changeCheckedNum++ |
| | | if (p.extension3 == proStatus.change_pass || p.extension3 == proStatus.change_fail) { |
| | | status.changeCheckedNum++; |
| | | } |
| | | |
| | | status.changePer = |
| | |
| | | (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' |
| | | } |
| | | ]; |
| | | }, |
| | | |
| | | //问题图片和整改图片 |
| | |
| | | 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 > 0 && s.changeCheckedNum == 0) { |
| | | type = 4; |
| | | } |
| | | // 整改部分审核 |
| | | else if (s.changeNum > 0 && s.changeCheckedNum < s.changeNum) { |
| | | type = 5; |
| | | } |
| | | // 未整改 |
| | | else if (s.changeNum < s.proNum) { |
| | | type = 3; |
| | | } |
| | | // 完全审核 |
| | | else { |
| | | type = 6; |
| | | } |
| | | return type; |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @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 }; |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @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 }; |
| | | } |
| | | } |
| | | }; |