This commit is contained in:
熊成强 2020-11-09 18:29:13 +08:00
parent 258fbde75d
commit db396d943c
12 changed files with 98 additions and 47 deletions

View File

@ -2,6 +2,7 @@
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue' import Vue from 'vue'
import App from './App' import App from './App'
import Mixin from './mixins/gload'
import router from './router' import router from './router'
import store from './store' import store from './store'
import './utils/elementConfig' import './utils/elementConfig'
@ -12,6 +13,7 @@ import VConsole from 'vconsole'
import VueCookie from 'vue-cookies' import VueCookie from 'vue-cookies'
import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose } from '@/utils/common' import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose } from '@/utils/common'
import { format } from '@/utils/dateFormat' import { format } from '@/utils/dateFormat'
Vue.mixin(Mixin)
// } // }
// let hostList = ['lzmanagement.ldxinyong.com'] // let hostList = ['lzmanagement.ldxinyong.com']

20
src/mixins/gload.js Normal file
View File

@ -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

View File

@ -1,5 +1,6 @@
const getters = { const getters = {
permission_routes: state => state.user.routes, permission_routes: state => state.user.routes,
userInfo: state => state.user.info userInfo: state => state.user.info,
auth: state => state.user.auth
} }
export default getters export default getters

View File

@ -2,16 +2,19 @@ import { getDepList } from '@/api/report'
const user = { const user = {
state: { state: {
deplist: [], deplist: [],
info: JSON.parse(localStorage.getItem('info')) || {} info: JSON.parse(localStorage.getItem('info')) || {},
auth: JSON.parse(localStorage.getItem('auth')) || {}
}, },
mutations: { mutations: {
SET_USER_INFO: (state, info) => { SET_USER_INFO: (state, info) => {
console.log('state: ', state)
console.log('info: ', info)
localStorage.setItem('info', JSON.stringify(info)) localStorage.setItem('info', JSON.stringify(info))
state.info = info state.info = info
}, },
SET_USER_AUTH: (state, auth) => {
localStorage.setItem('auth', JSON.stringify(auth))
state.auth = auth
},
SET_DEPLIST: (state, list = []) => { SET_DEPLIST: (state, list = []) => {
state.deplist = list state.deplist = list
} }

View File

@ -20,7 +20,7 @@
</div> </div>
<div> <div>
<el-form-item > <el-form-item >
<el-button type="primary" size="small" @click="$router.push({name:'initiate'})">发起考核</el-button> <el-button type="primary" :disabled='!auth.startAm' size="small" @click="$router.push({name:'initiate'})">发起考核</el-button>
</el-form-item> </el-form-item>
<!-- <el-form-item > <!-- <el-form-item >
<el-button size="small" >导入历史绩效</el-button> <el-button size="small" >导入历史绩效</el-button>
@ -53,12 +53,14 @@
width="120"> width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
:disabled='!auth.seeAm'
@click="handlePush(scope.row.id)" @click="handlePush(scope.row.id)"
type="text" type="text"
size="small"> size="small">
</el-button> </el-button>
<el-button <el-button
:disabled='!auth.deleteAm'
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"
type="text" type="text"
size="small"> size="small">

View File

@ -5,10 +5,11 @@
<div class="table-left">维度</div> <div class="table-left">维度</div>
<div class="table-header-flex name">名称</div> <div class="table-header-flex name">名称</div>
<div class="table-header-flex">考核标准</div> <div class="table-header-flex">考核标准</div>
<div class="table-header-flex" v-if="tableInfo.result || auth.showResult">结果值</div> <div class="table-header-flex" v-if="tableInfo.result || tableAuth.showResult">结果值</div>
<div class="table-header-flex quanzhomng" style="flex:none;">权重({{obj.weight*100}}%)</div> <div class="table-header-flex quanzhomng" style="flex:none;">权重({{obj.weight*100}}%)</div>
<div class="table-header-flex" v-if="tableInfo.score || auth.showScore">上级评分</div> <div class="table-header-flex" style="flex:none;width:130px;" v-if="tableInfo.score || tableAuth.showScore">上级评分</div>
<div class="table-header-flex" v-if="tableInfo.score || auth.showScore">评分说明</div> <div class="table-header-flex quanzhomng" style="flex:none;" v-if="tableInfo.score || tableAuth.showScore">得分</div>
<div class="table-header-flex" v-if="tableInfo.score || tableAuth.showScore">评分说明</div>
</div> </div>
<!-- <div v-if="obj.recortModelDtos.length === 0" class='listNone'> <!-- <div v-if="obj.recortModelDtos.length === 0" class='listNone'>
<div> <div>
@ -16,7 +17,7 @@
</div> </div>
</div> --> </div> -->
<div v-for="(item,index) in ((tableInfo.score || auth.showScore)?obj.recortModelDtos:obj.recortModelDtos.slice(0,obj.recortModelDtos.length-1))" :key="index" class="table-content"> <div v-for="(item,index) in ((tableInfo.score || tableAuth.showScore)?obj.recortModelDtos:obj.recortModelDtos.slice(0,obj.recortModelDtos.length-1))" :key="index" class="table-content">
<div class="table-content-left table-left"> <div class="table-content-left table-left">
<!-- {{item.name}} --> <!-- {{item.name}} -->
<div v-for="(i,indexs) in item.name" :key="indexs"> <div v-for="(i,indexs) in item.name" :key="indexs">
@ -33,16 +34,16 @@
{{child.keyResult || ''}} {{child.keyResult || ''}}
</pre> </pre>
</div> </div>
<div v-if="tableInfo.result || auth.showResult"> <div v-if="tableInfo.result || tableAuth.showResult">
<el-input v-if="tableInfo.result" type="textarea" size="mini" placeholder="请输入内容" v-model="child.checkResult" clearable></el-input> <el-input v-if="tableInfo.result" type="textarea" size="mini" placeholder="请输入内容" v-model="child.checkResult" clearable></el-input>
<pre v-else>{{child.checkResult || '--'}}</pre> <pre v-else>{{child.checkResult || '--'}}</pre>
</div> </div>
<div class="quanzhomng" style="flex:none;"> <div class="quanzhomng" style="flex:none;">
{{( Math.round((child.checkWeight * 100) * 1000) / 1000 )}}% {{( Math.round((child.checkWeight * 100) * 1000) / 1000 )}}%
</div> </div>
<div v-if="tableInfo.score || auth.showScore"> <div v-if="tableInfo.score || tableAuth.showScore" style="flex:none;width:130px;">
<!-- gradeGroupId=== 1 下拉 --> <!-- gradeGroupId=== 1 下拉 -->
<el-select v-if="tableInfo.score && obj.gradeGroupId===1" style="width:140px;" size="mini" v-model="child.scoreDtos[child.scoreDtos.length-1].acquireScore"> <el-select v-if="tableInfo.score && obj.gradeGroupId===1" style="width:115px;" size="mini" v-model="child.scoreDtos[child.scoreDtos.length-1].acquireScore">
<el-option <el-option
v-for="item in scoreList" v-for="item in scoreList"
:key="item.id" :key="item.id"
@ -50,10 +51,13 @@
:value="item.score"> :value="item.score">
</el-option> </el-option>
</el-select> </el-select>
<el-input v-if="tableInfo.score && obj.gradeGroupId===2" style="width:120px;" size="mini" placeholder="请输入评分值" v-model="child.superScore" clearable></el-input> <el-input v-if="tableInfo.score && obj.gradeGroupId===2" style="width:115px;" size="mini" placeholder="请输入评分值" v-model="child.scoreDtos[child.scoreDtos.length-1].acquireScore" clearable></el-input>
<span v-if="!tableInfo.score">{{handleScore(child.scoreDtos[child.scoreDtos.length-1].acquireScore)}}</span> <span v-if="!tableInfo.score">{{handleScore(child.scoreDtos[child.scoreDtos.length-1].acquireScore)}}</span>
</div> </div>
<div style="padding:10px;" v-if="tableInfo.score || auth.showScore"> <div class="quanzhomng" style="flex:none;" v-if="tableInfo.score || tableAuth.showScore">
<span>{{child.scoreDtos[child.scoreDtos.length-1].acquireScore || '--'}}</span>
</div>
<div style="padding:10px;" v-if="tableInfo.score || tableAuth.showScore">
<el-input v-if="tableInfo.score" style="width:200px;" size="mini" type="textarea" placeholder="请输入内容" v-model="child.scoreComment" clearable></el-input> <el-input v-if="tableInfo.score" style="width:200px;" size="mini" type="textarea" placeholder="请输入内容" v-model="child.scoreComment" clearable></el-input>
<span v-else>{{child.scoreComment || '--'}}</span> <span v-else>{{child.scoreComment || '--'}}</span>
</div> </div>
@ -64,16 +68,17 @@
</div> </div>
<div> <div>
</div> </div>
<div v-if="tableInfo.result || auth.showResult"> <div v-if="tableInfo.result || tableAuth.showResult">
</div> </div>
<div class="quanzhomng" style="flex:none;"> <div class="quanzhomng" style="flex:none;">
</div> </div>
<div v-if="tableInfo.score"> <div style="padding:10px;flex:none;width:130px;" v-if="tableInfo.score || tableAuth.showScore">
{{score.scoreLevel}}
</div> </div>
<div style="width:140px;" v-if="tableInfo.score || auth.showScore"> <div class="quanzhomng" style="flex:none;" v-if="tableInfo.score || tableAuth.showScore">
{{handleGetScorc()}} {{score.lastScore}}
</div> </div>
<div style="padding:10px;" v-if="tableInfo.score || auth.showScore"> <div style="padding:10px;" v-if="tableInfo.score || tableAuth.showScore">
</div> </div>
</div> </div>
</div> </div>
@ -124,7 +129,7 @@ export default {
} }
} }
}, },
auth: { tableAuth: {
type: Object, type: Object,
default: () => { default: () => {
return {} return {}
@ -137,33 +142,44 @@ export default {
loadingZan: false, loadingZan: false,
input: '', input: '',
scoreList: [] 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 () { mounted () {
this.handleGrt375() this.handleGrt375()
}, },
methods: { 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) { 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 return this.scoreList.filter(i => i.score === item).length > 0 ? this.scoreList.filter(i => i.score === item)[0].name : 0
}, },
async handleGetNext () { async handleGetNext () {
this.loadingTi = true this.loadingTi = true
let res1 = await apiSaveDetail(this.obj) let res1 = await apiSaveDetail(Object.assign({}, this.score, this.obj))
if (res1.code !== 200) { if (res1.code !== 200) {
this.$message.error(res1.msg) this.$message.error(res1.msg)
this.loadingTi = false this.loadingTi = false

View File

@ -70,7 +70,7 @@
</div> </div>
<div class="performance-content-bottom"> <div class="performance-content-bottom">
<tables <tables
:auth='formList.auth' :tableAuth='formList.auth'
:tableInfo.sync='tableInfo' :tableInfo.sync='tableInfo'
v-if="obj.recortModelDtos.length !==0" v-if="obj.recortModelDtos.length !==0"
:obj='obj' :obj='obj'

View File

@ -52,6 +52,7 @@
<!-- handleGetList handleChoose --> <!-- handleGetList handleChoose -->
<el-button <el-button
size="small" size="small"
v-if='auth.amMore'
@click="handleMore" @click="handleMore"
plain plain
>更多</el-button> >更多</el-button>
@ -127,6 +128,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<el-button <el-button
@click="handleLook(scope.row.id)" @click="handleLook(scope.row.id)"
type="text" type="text"
size="small" size="small"

View File

@ -8,8 +8,8 @@
text-color="#52575b" text-color="#52575b"
active-text-color="#3ba1ff" active-text-color="#3ba1ff"
> >
<el-menu-item index="0">考评组设置</el-menu-item> <el-menu-item v-if="auth.evaluationSet" index="0">考评组设置</el-menu-item>
<el-menu-item index="1">权限设置</el-menu-item> <el-menu-item v-if="auth.roleSet" index="1">权限设置</el-menu-item>
</el-menu> </el-menu>
<ground-table class="kaoping" v-if="activeIndex==='0'"></ground-table> <ground-table class="kaoping" v-if="activeIndex==='0'"></ground-table>
<div v-else-if="activeIndex==='1'"> <div v-else-if="activeIndex==='1'">

View File

@ -12,8 +12,8 @@
新增考评组<i class="el-icon-arrow-down el-icon--right"></i> 新增考评组<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleToEidt" >新增考评组</el-dropdown-item> <el-dropdown-item :disabled='!auth.evaluationAddSet' @click.native="handleToEidt" >新增考评组</el-dropdown-item>
<el-dropdown-item @click.native="handleToEidtCopy" > 复制考评组</el-dropdown-item> <el-dropdown-item :disabled='!auth.evaluationAddSet' @click.native="handleToEidtCopy" > 复制考评组</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-form-item> </el-form-item>
@ -40,12 +40,14 @@
width="120"> width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
:disabled='!auth.evaluationEditSet'
@click="handlePush(scope.row.id)" @click="handlePush(scope.row.id)"
type="text" type="text"
size="small"> size="small">
</el-button> </el-button>
<el-button <el-button
:disabled='!auth.evaluationDeleteSet'
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"
type="text" type="text"
size="small"> size="small">

View File

@ -18,9 +18,9 @@
<div class="home-left-enter-title commonFont">快捷入口</div> <div class="home-left-enter-title commonFont">快捷入口</div>
<div class="home-left-enter-content"> <div class="home-left-enter-content">
<div class="boderAndRadius commonFont noSelect" @click="handleGetMoreToDo('assessment')">考核管理</div> <div class="boderAndRadius commonFont noSelect" @click="handleGetMoreToDo('assessment')">考核管理</div>
<div class="boderAndRadius commonFont noSelect" @click="handleGetMoreToDo('workbench-group')" >考评组</div> <div class="boderAndRadius commonFont noSelect" v-if="auth.evaluationGroupManager" @click="handleGetMoreToDo('workbench-group')" >考评组</div>
<div class="boderAndRadius commonFont noSelect" @click="handleGetMoreToDo('initiate')">发起考核</div> <div class="boderAndRadius commonFont noSelect" v-if="auth.launchEvaluation" @click="handleGetMoreToDo('initiate')">发起考核</div>
<div class="boderAndRadius commonFont noSelect" @click="handleGetMoreToDo('1')">指标库</div> <div class="boderAndRadius commonFont noSelect" v-if="auth.indexData" @click="handleGetMoreToDo('1')">指标库</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -33,11 +33,12 @@ export default {
token: this.$cookies.get('token') token: this.$cookies.get('token')
} }
}, },
computed: {}, computed: {
},
beforeMount () {}, beforeMount () {},
mounted () {}, mounted () {},
methods: { methods: {
...mapMutations(['SET_USER_INFO']), ...mapMutations(['SET_USER_INFO', 'SET_USER_AUTH']),
handleClick () { handleClick () {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
@ -45,14 +46,16 @@ export default {
localStorage.setItem('input', this.input) localStorage.setItem('input', this.input)
const params = {'userName': this.input, 'password': 'admin', 'uuid': '', 'verify': this.verify, 'verifyCode': this.verify} const params = {'userName': this.input, 'password': 'admin', 'uuid': '', 'verify': this.verify, 'verifyCode': this.verify}
let res = await apiLogin(params) let res = await apiLogin(params)
console.log('res: ', res)
if (res.code === 200) { if (res.code === 200) {
this.SET_USER_AUTH(res.data)
this.token = res.token this.token = res.token
this.$cookies.set('token', res.token, res.expire) this.$cookies.set('token', res.token, res.expire)
let ress = await apiUserInfo() let ress = await apiUserInfo()
if (ress.code === 200) { if (ress.code === 200) {
this.SET_USER_INFO(ress.user) this.SET_USER_INFO(ress.user)
} }
location.reload() // location.reload()
} }
} }
}, },