From db396d943c1273cae8f7b2ba30b32522e7391414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Mon, 9 Nov 2020 18:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 2 + src/mixins/gload.js | 20 +++++ src/store/getters.js | 3 +- src/store/modules/user.js | 9 ++- src/views/kpi/assessment/homeList/index.vue | 4 +- .../performance/components/table.vue | 78 +++++++++++-------- .../kpi/assessment/performance/index.vue | 2 +- src/views/kpi/assessment/stepList/index.vue | 2 + src/views/kpi/set/index.vue | 4 +- .../workbench/assessmentGroup/groundTable.vue | 6 +- src/views/kpi/workbench/home/index.vue | 6 +- src/views/kpi/workbench/index.vue | 9 ++- 12 files changed, 98 insertions(+), 47 deletions(-) create mode 100644 src/mixins/gload.js diff --git a/src/main.js b/src/main.js index 0220c91..2111bb2 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,7 @@ // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' +import Mixin from './mixins/gload' import router from './router' import store from './store' import './utils/elementConfig' @@ -12,6 +13,7 @@ import VConsole from 'vconsole' import VueCookie from 'vue-cookies' import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose } from '@/utils/common' import { format } from '@/utils/dateFormat' +Vue.mixin(Mixin) // } // let hostList = ['lzmanagement.ldxinyong.com'] diff --git a/src/mixins/gload.js b/src/mixins/gload.js new file mode 100644 index 0000000..4557b0d --- /dev/null +++ b/src/mixins/gload.js @@ -0,0 +1,20 @@ +// src/mixins/index.js +import { mapGetters } from 'vuex' +let mixin = { + data () { + return {} + }, + computed: { + ...mapGetters(['auth']) + }, + methods: { + loadPage (routerName, param) { + if (param) { + this.$router.push({name: routerName, query: param}) + } else { + this.$router.push({name: routerName}) + } + } + } +} +export default mixin diff --git a/src/store/getters.js b/src/store/getters.js index 4d8ecc2..c5d3336 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,5 +1,6 @@ const getters = { permission_routes: state => state.user.routes, - userInfo: state => state.user.info + userInfo: state => state.user.info, + auth: state => state.user.auth } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index b9d2fb4..b723734 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -2,16 +2,19 @@ import { getDepList } from '@/api/report' const user = { state: { deplist: [], - info: JSON.parse(localStorage.getItem('info')) || {} + info: JSON.parse(localStorage.getItem('info')) || {}, + auth: JSON.parse(localStorage.getItem('auth')) || {} }, mutations: { SET_USER_INFO: (state, info) => { - console.log('state: ', state) - console.log('info: ', info) localStorage.setItem('info', JSON.stringify(info)) state.info = info }, + SET_USER_AUTH: (state, auth) => { + localStorage.setItem('auth', JSON.stringify(auth)) + state.auth = auth + }, SET_DEPLIST: (state, list = []) => { state.deplist = list } diff --git a/src/views/kpi/assessment/homeList/index.vue b/src/views/kpi/assessment/homeList/index.vue index ac98ee2..b5441d1 100644 --- a/src/views/kpi/assessment/homeList/index.vue +++ b/src/views/kpi/assessment/homeList/index.vue @@ -20,7 +20,7 @@
- 发起考核 + 发起考核 -
+
@@ -33,16 +34,16 @@ {{child.keyResult || ''}}
-
+
{{child.checkResult || '--'}}
{{( Math.round((child.checkWeight * 100) * 1000) / 1000 )}}%
-
+
- + - + {{handleScore(child.scoreDtos[child.scoreDtos.length-1].acquireScore)}}
-
+
+ {{child.scoreDtos[child.scoreDtos.length-1].acquireScore || '--'}} +
+
{{child.scoreComment || '--'}}
@@ -64,16 +68,17 @@
-
+
-
+
+ {{score.scoreLevel}}
-
- {{handleGetScorc()}} +
+ {{score.lastScore}}
-
+
@@ -124,7 +129,7 @@ export default { } } }, - auth: { + tableAuth: { type: Object, default: () => { return {} @@ -137,33 +142,44 @@ export default { loadingZan: false, input: '', scoreList: [] + // score: { + // lastScore: '', + // scoreLevel: '' + // } + } + }, + computed: { + score () { + const result = this.obj.recortModelDtos.reduce((result, i) => { + i.detailDtos.map(j => { + j.scoreDtos.map(k => { + const str = j.calculate.replace(/{\w+}/g, (i) => { + i = i.replace(/{|}/g, '') + return k[i] + }) + let a = eval(str) + result += a + }) + }) + return result + }, 0) + const arr = this.scoreList.filter(i => i.minScore <= result && i.maxScore > result) + return { + lastScore: result.toFixed(3), + scoreLevel: arr.length > 0 ? arr[0].name : '' + } } }, mounted () { this.handleGrt375() }, methods: { - handleGetScorc (obj = this.obj) { - const result = obj.recortModelDtos.reduce((result, i) => { - i.detailDtos.map(j => { - const str = j.calculate.replace(/{\w+}/g, (i) => { - i = i.replace(/{|}/g, '') - return j[i] - }) - let a = eval(str) - result += a - }) - return result - }, 0) - return result.toFixed(3) - }, handleScore (item) { - console.log('this.scoreList: ', this.scoreList) return this.scoreList.filter(i => i.score === item).length > 0 ? this.scoreList.filter(i => i.score === item)[0].name : 0 }, async handleGetNext () { this.loadingTi = true - let res1 = await apiSaveDetail(this.obj) + let res1 = await apiSaveDetail(Object.assign({}, this.score, this.obj)) if (res1.code !== 200) { this.$message.error(res1.msg) this.loadingTi = false diff --git a/src/views/kpi/assessment/performance/index.vue b/src/views/kpi/assessment/performance/index.vue index 7883e37..1e41e10 100644 --- a/src/views/kpi/assessment/performance/index.vue +++ b/src/views/kpi/assessment/performance/index.vue @@ -70,7 +70,7 @@
更多 @@ -127,6 +128,7 @@