From bbf82e56ce0bd2cf1aabea0ae97629d3ecc5847a Mon Sep 17 00:00:00 2001 From: zhujida Date: Thu, 24 Dec 2020 18:45:43 +0800 Subject: [PATCH] =?UTF-8?q?4,=E8=AF=84=E5=88=86=E7=8E=AF=E5=A2=83=20?= =?UTF-8?q?=E4=B8=8D=E7=AD=89=E4=BA=8E=203.5=20=E6=88=963.75=20=E8=AF=84?= =?UTF-8?q?=E5=88=86=E8=AF=B4=E6=98=8E=20=E5=BF=85=E5=A1=AB=206=EF=BC=8C?= =?UTF-8?q?=E7=BB=A9=E6=95=88=E6=80=BB=E5=88=86=E6=95=B0=20=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E4=B8=A4=E4=BD=8D=20=E5=9B=9B=E8=88=8D=E4=BA=94?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 4 ++-- src/utils/common.js | 9 ++++++++ .../performance/components/table.vue | 22 +++++++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main.js b/src/main.js index bbd531c..830238b 100644 --- a/src/main.js +++ b/src/main.js @@ -11,7 +11,7 @@ import './style/index.less' import '@/icons' import _ from 'lodash' import VueCookie from 'vue-cookies' -import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose, handleBlur } from '@/utils/common' +import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose, handleBlur, isStringEmpty } from '@/utils/common' import { format } from '@/utils/dateFormat' Vue.prototype._ = _ Vue.mixin(Mixin) @@ -27,7 +27,7 @@ Vue.prototype.$handleInputInt = handleInput Vue.prototype.$handleBlur = handleBlur Vue.prototype.$msg = messageSuccess - +Vue.prototype.$isStringEmpty = isStringEmpty /* eslint-disable no-new */ new Vue({ el: '#app', diff --git a/src/utils/common.js b/src/utils/common.js index 8d1d380..8f9b3ac 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -136,3 +136,12 @@ export function getUrlParams () { } return obj } + +// 判断字符是否为空的方法 +export function isStringEmpty (obj) { + if (typeof obj === 'undefined' || obj === null || obj === '') { + return true + } else { + return false + } +} diff --git a/src/views/kpi/assessment/performance/components/table.vue b/src/views/kpi/assessment/performance/components/table.vue index 6e1ea5a..32292ca 100644 --- a/src/views/kpi/assessment/performance/components/table.vue +++ b/src/views/kpi/assessment/performance/components/table.vue @@ -343,8 +343,9 @@ export default { }) const arr = this.scoreList.filter(i => i.minScore <= result && i.maxScore > result) return { - ScoreSimple: res.toFixed(3), - Score: result.toFixed(3), + // ScoreSimple: res.toFixed(3), + ScoreSimple: Math.round(res * 100) / 100.0, + Score: result.toFixed(res), Level: arr.length > 0 ? arr[0].name : '' } }) @@ -430,7 +431,8 @@ export default { const obj = { status: 1, menuName: this.tableInfo.result ? '提交了结果值' : '提交了评分' } const params = Object.assign({}, { resultRecordId: this.obj.id || '' }, obj) if (!this.tableInfo.result) { - let isScore = true + let isScore = true // false 有未评分 + let isScoreComment = true // false 有分数等于3.5或3.75 但为评论 this.obj.recortModelDtos.map(i => { i.detailDtos.map(j => { const obj = j.scoreDtos.find(k => k.approvalId === this.userInfo.userId) @@ -439,16 +441,28 @@ export default { } else { isScore = false } + + // 有分数等于3.5或3.75 但为评论 + if ((obj.acquireScore !== 3.75 && obj.acquireScore !== 3.5) && this.$isStringEmpty(obj.scoreComment)) { + isScoreComment = false + } }) }) if (!isScore) { this.loadingTi = false return this.$message({ message: '有未评分指标', - type: 'info' + type: 'error' + }) + } else if (!isScoreComment) { + this.loadingTi = false + return this.$message({ + message: '评分不等于3.50或3.75的未填写评分说明', + type: 'error' }) } } + let rqPara = this.tableInfo.result ? Object.assign({}, this.obj, { lastScore: null, scoreLevel: null }) : Object.assign({}, this.obj, this.score) let res1 = await apiSaveDetail(rqPara) if (res1.code !== 200) {