rjuq whnt

This commit is contained in:
quyixiao 2020-08-20 14:37:26 +08:00
parent 0543fbccc7
commit b59b056773
4 changed files with 246 additions and 85 deletions

View File

@ -28,3 +28,7 @@ export const recorddetailDelete = params => {
export const weightCheck = params => {
return http({url: '/lz_management/user/lzresultrecord/weightCheck', method: 'post', params})
}
export const commitApproval = params => {
return http({url: '/lz_management/user/lzresultrecord/commitApproval', method: 'get', params})
}

View File

@ -261,8 +261,8 @@ export default {
this.dataListSelections = val
},
//
addOrUpdateHandle (id, type) {
this.$router.push({name: 'recorddetail', query: {id: id, type: type}}, () => {
addOrUpdateHandle (id, recordType) {
this.$router.push({name: 'recorddetail', query: {id: id, recordType: recordType}}, () => {
this.mainTabsActiveName = this.$route.name
})
},

View File

@ -5,41 +5,46 @@
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm"
label-width="80px">
<el-form-item label="目标/指标" prop="target">
<el-input :disabled="false" v-model="dataForm.target" placeholder="目标/指标"></el-input>
<el-form-item label="目标/指标" v-show="auth.target >= 1" prop="target">
<el-input :disabled="auth.target<2" v-model="dataForm.target" placeholder="目标/指标"></el-input>
</el-form-item>
<el-form-item label="关键结果" prop="keyResult">
<div id="keyResultEditorElem" class="editor"></div>
<el-form-item label="关键结果" v-show="auth.keyResult >= 1 && this.type == 1 " prop="keyResult">
<div id="keyResultEditorElem" class="editor"></div>
</el-form-item>
<el-form-item label="考核权重" prop="checkWeight">
<el-input v-model="dataForm.checkWeight" placeholder="考核权重"></el-input>
<el-form-item v-show="auth.checkWeight>=1" label="考核权重" prop="checkWeight">
<el-input v-model="dataForm.checkWeight" :disabled="auth.checkWeight<2" placeholder="考核权重"></el-input>
</el-form-item>
<el-form-item label="考核结果" prop="checkResult">
<el-form-item label="考核结果" v-show="auth.checkResult >= 1" prop="checkResult">
<div id="checkResultEditorElem" class="editor"></div>
</el-form-item>
<el-form-item label="上级评分">
<el-select v-model="dataForm.superScore" placeholder="请选择" @change="changeSuperScore()" >
<el-form-item label="优先级" v-show="auth.priority >= 1" prop="priority">
<el-input :disabled="auth.priority < 2 " v-model="dataForm.priority" placeholder="优先级别,数字越大,越在排列在表格前面"></el-input>
</el-form-item>
<el-form-item label="上级评分" v-show="auth.superScore >= 1">
<el-select v-model="dataForm.acquireScore" :disabled="auth.superScore < 2" placeholder="请选择">
<el-option
v-for="item in superScore"
v-for="item in superScoreData"
:key="item.score"
:label="item.label"
:value="item.label"
:value="item.score"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="得分" prop="acquireScore">
<template >
<div style="color: red" class="conatnt-name" v-model="dataForm.acquireScore">
<span>{{ this.dataForm.acquireScore }}</span>
<el-form-item label="得分" prop="acquireScore" v-show="auth.acquireScore == 1">
<template>
<div style="color: red" class="conatnt-name">
<span>{{ acquireScore }}</span>
</div>
</template>
</el-form-item>
<el-form-item v-show="true" label="评分说明" prop="scoreComment">
<el-input v-model="dataForm.scoreComment" placeholder="评分说明(直属上级填写)"></el-input>
<el-form-item label="评分说明" v-show="auth.scoreComment >= 1" prop="scoreComment">
<div id="scoreCommentEditorElem" class="editor"></div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
@ -80,25 +85,56 @@ export default {
}
callback()
}
var validPriority = async (rule, value, callback) => {
if (!value) {
callback(new Error('优先级不能为空'))
}
if (!/^(0|[1-9][0-9]*)$/.test(value)) {
callback(new Error('请输入大于或等于0的整数'))
}
callback()
}
return {
visible: false,
keyResultEditor: null,
checkResultEditor: null,
recordResultId: null,
scoreCommentEditor: null,
auth: [],
recordType: 0,
type: 0,
superScore: [{
superScoreData: [{
score: 0,
label: ' '
}, {
score: 4,
label: '4分-卓越'
}, {
score: 3.875,
label: '3.75(+)-优秀'
}, {
score: 3.75,
label: '3.75分-优秀'
label: '3.75分-合格'
}, {
score: 3.667,
label: '3.75(-)-优秀'
}, {
score: 3.583,
label: '3.5(+)-合格'
}, {
score: 3.583,
label: '3.5(+)-合格'
}, {
score: 3.5,
label: '3.5分-合格'
}, {
score: 3.375,
label: '3.5(-)-合格'
}, {
score: 3.25,
label: '3.25分-不合格,待改进'
}],
}
],
dataForm: {
id: 0,
target: '',
@ -107,7 +143,8 @@ export default {
checkResult: '',
superScore: '',
acquireScore: '',
scoreComment: ''
scoreComment: '',
priority: ''
},
dataRule: {
scoreComment: [
@ -115,6 +152,9 @@ export default {
],
checkWeight: [
{validator: validNum, required: true, trigger: 'blur'}
],
priority: [
{validator: validPriority, required: true, trigger: 'blur'}
]
}
}
@ -123,13 +163,18 @@ export default {
},
computed: {
acquireScore () {
const score1 = this.superScoreData.filter(i => this.dataForm.acquireScore === i.score)
return score1.length > 0 ? score1[0].score : 0
}
},
methods: {
async init (id, type, recordResultId) {
async init (id, type, recordResultId, auth, recordType) {
this.type = type
this.recordResultId = recordResultId
this.auth = auth
this.recordType = recordType
this.dataForm.id = id || 0
let data = await weightCheck({
'recordResultId': this.recordResultId,
'type': this.type,
@ -146,6 +191,15 @@ export default {
})
return
}
if (this.keyResultEditor !== null) {
this.keyResultEditor.txt.html('')
}
if (this.checkResultEditor !== null) {
this.checkResultEditor.txt.html('')
}
if (this.scoreCommentEditor !== null) {
this.scoreCommentEditor.txt.html('')
}
this.visible = true
this.$nextTick(async () => {
this.$refs['dataForm'].resetFields()
@ -156,7 +210,9 @@ export default {
this.keyResultEditor.customConfig.uploadImgParams = ''
this.keyResultEditor.customConfig.debug = true
this.keyResultEditor.create()
this.keyResultEditor.$textElem.attr('contenteditable', false)
if (this.auth.keyResult < 2) {
this.keyResultEditor.$textElem.attr('contenteditable', false)
}
}
if (this.checkResultEditor === null) {
this.checkResultEditor = new E('#checkResultEditorElem')
@ -165,57 +221,135 @@ export default {
this.checkResultEditor.customConfig.uploadImgParams = ''
this.checkResultEditor.customConfig.debug = true
this.checkResultEditor.create()
this.keyResultEditor.$textElem.attr('contenteditable', false)
if (this.auth.checkResult < 2) {
this.checkResultEditor.$textElem.attr('contenteditable', false)
}
}
if (this.scoreCommentEditor === null) {
this.scoreCommentEditor = new E('#scoreCommentEditorElem')
this.scoreCommentEditor.customConfig.uploadImgServer = '/uploadPicture'
this.scoreCommentEditor.customConfig.uploadFileName = 'file'
this.scoreCommentEditor.customConfig.uploadImgParams = ''
this.scoreCommentEditor.customConfig.debug = true
this.scoreCommentEditor.create()
if (this.auth.scoreComment < 2) {
this.scoreCommentEditor.$textElem.attr('contenteditable', false)
}
}
if (this.dataForm.id && this.dataForm.id > 0) {
const data = await apiDetailInfo(this.dataForm.id)
if (data && data.code === 0) {
this.dataForm.target = data.detailInfo.target
this.dataForm.keyResult = data.detailInfo.keyResult
this.dataForm.checkWeight = data.detailInfo.checkWeight
this.dataForm.checkResult = data.detailInfo.checkResult
this.dataForm.superScore = data.detailInfo.superScore
this.dataForm.acquireScore = data.detailInfo.acquireScore
this.dataForm.scoreComment = data.detailInfo.scoreComment
this.keyResultEditor.txt.html(this.dataForm.keyResult || '')
this.checkResultEditor.txt.html(this.dataForm.checkResult || '')
this.dataForm = data.detailInfo
if (this.keyResultEditor !== null) {
this.keyResultEditor.txt.html(this.dataForm.keyResult || '')
}
if (this.checkResultEditor !== null) {
this.checkResultEditor.txt.html(this.dataForm.checkResult || '')
}
if (this.scoreCommentEditor !== null) {
this.scoreCommentEditor.txt.html(this.dataForm.checkResult || '')
}
}
}
})
},
changeSuperScore () {
let value = this.dataForm.superScore
value = value.replace(/[\u4e00-\u9fa5]/g, '')
value = value.replace('-', '')
value = value.replace('', '')
this.dataForm.acquireScore = value
},
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
recorddetailAddOrUpdate({
'id': this.dataForm.id || undefined,
'type': this.type,
'target': this.dataForm.target,
'keyResult': Base64.encode(this.keyResultEditor.txt.html()),
'checkWeight': this.dataForm.checkWeight,
'checkResult': Base64.encode(this.checkResultEditor.txt.html()),
'superScore': this.dataForm.superScore,
'acquireScore': this.dataForm.acquireScore,
'scoreComment': this.dataForm.scoreComment,
'recordId': this.recordResultId
}).then(res => {
if (res && res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
alertInfo (msg) {
this.$message({
message: msg,
type: 'success',
duration: 1500,
onClose: () => {
}
})
},
stringIsNull (str) {
if (typeof str === 'undefined' || str === null || str === '') {
return true
}
return false
},
async dataFormSubmit () {
if (this.auth.target === 2) {
if (this.stringIsNull(this.dataForm.target)) {
this.alertInfo('目标不能为空')
return
}
}
if (this.auth.keyResult === 2 && this.type === 1) {
if (this.stringIsNull(this.keyResultEditor.txt.html())) {
this.alertInfo('关键结果不能为空')
return
}
}
if (this.auth.checkWeight === 2) {
if (this.stringIsNull(this.dataForm.checkWeight)) {
this.alertInfo('权重不能为空')
return
}
let data = await weightCheck({
'recordResultId': this.recordResultId,
'weight': this.dataForm.checkWeight,
'type': this.type,
'id': this.dataForm.id
})
if (data && data.code !== 0) {
this.alertInfo(data.msg)
return
}
}
if (this.auth.checkResult === 2) {
if (this.stringIsNull(this.checkResultEditor.txt.html())) {
this.alertInfo('考核结果不能为空')
return
}
}
if (this.auth.superScore === 2) {
if (this.stringIsNull(this.dataForm.superScore)) {
this.alertInfo('上级评分不能为空')
return
}
}
if (this.auth.scoreComment === 2) {
if (this.dataForm.acquireScore !== 3.5 || this.dataForm.acquireScore !== 3.75) {
if (this.stringIsNull(this.dataForm.scoreComment)) {
this.alertInfo('评分说明不能为空')
return
}
}
}
if (this.auth.priority === 2) {
if (this.stringIsNull(this.dataForm.priority)) {
this.alertInfo('优先级不能为空')
return
}
}
const score1 = this.superScoreData.filter(i => this.dataForm.acquireScore === i.score)
const superScore1 = score1[0].label
recorddetailAddOrUpdate({
'id': this.dataForm.id || undefined,
'type': this.type,
'target': this.dataForm.target,
'keyResult': Base64.encode(this.keyResultEditor.txt.html()),
'checkWeight': this.dataForm.checkWeight,
'checkResult': Base64.encode(this.checkResultEditor.txt.html()),
'superScore': superScore1,
'acquireScore': this.dataForm.acquireScore,
'scoreComment': Base64.encode(this.scoreCommentEditor.txt.html()),
'recordId': this.recordResultId,
'recordType': this.recordType,
'priority': this.priority
}).then(res => {
if (res && res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList', res.recordId)
}
})
}

View File

@ -26,7 +26,7 @@
<div class="titleBottom">
<div class="bottom" v-show="this.auth.commit == 1" >
<p> <span style="cursor: pointer">提交审批</span></p>
<p> <span style="cursor: pointer" @click="commitApproval">提交审批</span></p>
</div>
<div class="bottom" v-show="this.auth.approvel == 1" >
@ -85,7 +85,12 @@
</div>
</template>
</el-table-column>
<el-table-column label="评分说明(直属上级填写)" width="300" prop="scoreComment"></el-table-column>
<el-table-column label="评分说明(直属上级填写)" width="300" prop="scoreComment">
<template slot-scope="scope">
<div v-html="scope.row.scoreComment" class="rich">
</div>
</template>
</el-table-column>
<el-table-column width="80" label="操作" align="center" fixed="right">
<template slot-scope="scope">
@ -94,26 +99,20 @@
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</div>
</template>
<script>
import {getStaffResultDetail} from '@/api/api_result'
import {getStaffResultDetail, commitApproval} from '@/api/api_result'
import AddOrUpdate from './recorddetail-add-or-update'
export default {
created () {
this.recordResultId = this.$route.query.id
this.type = this.$route.query.type
},
filters: {
getcheckWeightStr (val) {
@ -154,20 +153,23 @@ export default {
addOrUpdateVisible: false,
loading: false,
auth: [],
authId: 0
recordType: 0
}
},
components: {
AddOrUpdate
},
activated () {
this.recordResultId = this.$route.query.id
this.recordType = this.$route.query.recordType
this.getDataList()
},
methods: {
getDataList () {
getDataList (id = this.recordResultId) {
this.recordResultId = id
getStaffResultDetail({
'recordResultId': this.recordResultId,
'type': this.type
'recordResultId': id,
'recordType': this.recordType
}).then(data => {
if (data && data.code === 0) {
this.tableData = data.list
@ -183,7 +185,8 @@ export default {
this.department3 = data.department3
this.superStaff = data.superStaff
this.auth = data.auth
this.authId = data.authId
this.recordType = data.recordType
this.recordResultId = data.recordResultId
} else {
this.tableData = []
}
@ -196,7 +199,7 @@ export default {
this.addOrUpdateVisible = true
this.$nextTick(() => {
setTimeout(() => {
this.$refs.addOrUpdate.init(id, type, this.recordResultId)
this.$refs.addOrUpdate.init(id, type, this.recordResultId, this.auth, this.recordType)
}, 500)
})
},
@ -207,7 +210,28 @@ export default {
return ''
}
},
commitApproval () {
this.$confirm(`确定要提交审批吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
commitApproval({
'recordResultId': this.recordResultId
}).then(data => {
if (data && data.code === 0) {
this.$message({
message: data.msg,
type: 'success',
duration: 1500,
onClose: () => {
}
})
}
})
}).catch(() => {
})
},
objectSpanMethod ({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0) {
if (rowIndex === 0) {
@ -253,7 +277,6 @@ export default {
return [0, 0]
}
}
if (rowIndex >= this.fourRowspan && rowIndex <= this.fiveRowspan) {
if (columnIndex === 0) {
return [1, 2]