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 => { export const weightCheck = params => {
return http({url: '/lz_management/user/lzresultrecord/weightCheck', method: 'post', 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 this.dataListSelections = val
}, },
// //
addOrUpdateHandle (id, type) { addOrUpdateHandle (id, recordType) {
this.$router.push({name: 'recorddetail', query: {id: id, type: type}}, () => { this.$router.push({name: 'recorddetail', query: {id: id, recordType: recordType}}, () => {
this.mainTabsActiveName = this.$route.name this.mainTabsActiveName = this.$route.name
}) })
}, },

View File

@ -5,41 +5,46 @@
:visible.sync="visible"> :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" <el-form :model="dataForm" :rules="dataRule" ref="dataForm"
label-width="80px"> label-width="80px">
<el-form-item label="目标/指标" prop="target"> <el-form-item label="目标/指标" v-show="auth.target >= 1" prop="target">
<el-input :disabled="false" v-model="dataForm.target" placeholder="目标/指标"></el-input> <el-input :disabled="auth.target<2" v-model="dataForm.target" placeholder="目标/指标"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="关键结果" prop="keyResult"> <el-form-item label="关键结果" v-show="auth.keyResult >= 1 && this.type == 1 " prop="keyResult">
<div id="keyResultEditorElem" class="editor"></div> <div id="keyResultEditorElem" class="editor"></div>
</el-form-item> </el-form-item>
<el-form-item label="考核权重" prop="checkWeight"> <el-form-item v-show="auth.checkWeight>=1" label="考核权重" prop="checkWeight">
<el-input v-model="dataForm.checkWeight" placeholder="考核权重"></el-input> <el-input v-model="dataForm.checkWeight" :disabled="auth.checkWeight<2" placeholder="考核权重"></el-input>
</el-form-item> </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> <div id="checkResultEditorElem" class="editor"></div>
</el-form-item> </el-form-item>
<el-form-item label="上级评分"> <el-form-item label="优先级" v-show="auth.priority >= 1" prop="priority">
<el-select v-model="dataForm.superScore" placeholder="请选择" @change="changeSuperScore()" > <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 <el-option
v-for="item in superScore" v-for="item in superScoreData"
:key="item.score" :key="item.score"
:label="item.label" :label="item.label"
:value="item.label" :value="item.score"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="得分" prop="acquireScore"> <el-form-item label="得分" prop="acquireScore" v-show="auth.acquireScore == 1">
<template > <template>
<div style="color: red" class="conatnt-name" v-model="dataForm.acquireScore"> <div style="color: red" class="conatnt-name">
<span>{{ this.dataForm.acquireScore }}</span> <span>{{ acquireScore }}</span>
</div> </div>
</template> </template>
</el-form-item> </el-form-item>
<el-form-item label="评分说明" v-show="auth.scoreComment >= 1" prop="scoreComment">
<el-form-item v-show="true" label="评分说明" prop="scoreComment"> <div id="scoreCommentEditorElem" class="editor"></div>
<el-input v-model="dataForm.scoreComment" placeholder="评分说明(直属上级填写)"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
@ -80,25 +85,56 @@ export default {
} }
callback() 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 { return {
visible: false, visible: false,
keyResultEditor: null, keyResultEditor: null,
checkResultEditor: null, checkResultEditor: null,
recordResultId: null, recordResultId: null,
scoreCommentEditor: null,
auth: [],
recordType: 0,
type: 0, type: 0,
superScore: [{ superScoreData: [{
score: 0,
label: ' '
}, {
score: 4, score: 4,
label: '4分-卓越' label: '4分-卓越'
}, {
score: 3.875,
label: '3.75(+)-优秀'
}, { }, {
score: 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, score: 3.5,
label: '3.5分-合格' label: '3.5分-合格'
}, {
score: 3.375,
label: '3.5(-)-合格'
}, { }, {
score: 3.25, score: 3.25,
label: '3.25分-不合格,待改进' label: '3.25分-不合格,待改进'
}], }
],
dataForm: { dataForm: {
id: 0, id: 0,
target: '', target: '',
@ -107,7 +143,8 @@ export default {
checkResult: '', checkResult: '',
superScore: '', superScore: '',
acquireScore: '', acquireScore: '',
scoreComment: '' scoreComment: '',
priority: ''
}, },
dataRule: { dataRule: {
scoreComment: [ scoreComment: [
@ -115,6 +152,9 @@ export default {
], ],
checkWeight: [ checkWeight: [
{validator: validNum, required: true, trigger: 'blur'} {validator: validNum, required: true, trigger: 'blur'}
],
priority: [
{validator: validPriority, required: true, trigger: 'blur'}
] ]
} }
} }
@ -123,13 +163,18 @@ export default {
}, },
computed: { computed: {
acquireScore () {
const score1 = this.superScoreData.filter(i => this.dataForm.acquireScore === i.score)
return score1.length > 0 ? score1[0].score : 0
}
}, },
methods: { methods: {
async init (id, type, recordResultId) { async init (id, type, recordResultId, auth, recordType) {
this.type = type this.type = type
this.recordResultId = recordResultId this.recordResultId = recordResultId
this.auth = auth
this.recordType = recordType
this.dataForm.id = id || 0 this.dataForm.id = id || 0
let data = await weightCheck({ let data = await weightCheck({
'recordResultId': this.recordResultId, 'recordResultId': this.recordResultId,
'type': this.type, 'type': this.type,
@ -146,6 +191,15 @@ export default {
}) })
return 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.visible = true
this.$nextTick(async () => { this.$nextTick(async () => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
@ -156,7 +210,9 @@ export default {
this.keyResultEditor.customConfig.uploadImgParams = '' this.keyResultEditor.customConfig.uploadImgParams = ''
this.keyResultEditor.customConfig.debug = true this.keyResultEditor.customConfig.debug = true
this.keyResultEditor.create() this.keyResultEditor.create()
this.keyResultEditor.$textElem.attr('contenteditable', false) if (this.auth.keyResult < 2) {
this.keyResultEditor.$textElem.attr('contenteditable', false)
}
} }
if (this.checkResultEditor === null) { if (this.checkResultEditor === null) {
this.checkResultEditor = new E('#checkResultEditorElem') this.checkResultEditor = new E('#checkResultEditorElem')
@ -165,57 +221,135 @@ export default {
this.checkResultEditor.customConfig.uploadImgParams = '' this.checkResultEditor.customConfig.uploadImgParams = ''
this.checkResultEditor.customConfig.debug = true this.checkResultEditor.customConfig.debug = true
this.checkResultEditor.create() 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) { if (this.dataForm.id && this.dataForm.id > 0) {
const data = await apiDetailInfo(this.dataForm.id) const data = await apiDetailInfo(this.dataForm.id)
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm.target = data.detailInfo.target this.dataForm = data.detailInfo
this.dataForm.keyResult = data.detailInfo.keyResult if (this.keyResultEditor !== null) {
this.dataForm.checkWeight = data.detailInfo.checkWeight this.keyResultEditor.txt.html(this.dataForm.keyResult || '')
this.dataForm.checkResult = data.detailInfo.checkResult }
this.dataForm.superScore = data.detailInfo.superScore if (this.checkResultEditor !== null) {
this.dataForm.acquireScore = data.detailInfo.acquireScore this.checkResultEditor.txt.html(this.dataForm.checkResult || '')
this.dataForm.scoreComment = data.detailInfo.scoreComment }
this.keyResultEditor.txt.html(this.dataForm.keyResult || '') if (this.scoreCommentEditor !== null) {
this.checkResultEditor.txt.html(this.dataForm.checkResult || '') this.scoreCommentEditor.txt.html(this.dataForm.checkResult || '')
}
} }
} }
}) })
}, },
changeSuperScore () { changeSuperScore () {
let value = this.dataForm.superScore
value = value.replace(/[\u4e00-\u9fa5]/g, '')
value = value.replace('-', '')
value = value.replace('', '')
this.dataForm.acquireScore = value
}, },
dataFormSubmit () { alertInfo (msg) {
this.$refs['dataForm'].validate((valid) => { this.$message({
if (valid) { message: msg,
recorddetailAddOrUpdate({ type: 'success',
'id': this.dataForm.id || undefined, duration: 1500,
'type': this.type, onClose: () => {
'target': this.dataForm.target, }
'keyResult': Base64.encode(this.keyResultEditor.txt.html()), })
'checkWeight': this.dataForm.checkWeight, },
'checkResult': Base64.encode(this.checkResultEditor.txt.html()), stringIsNull (str) {
'superScore': this.dataForm.superScore, if (typeof str === 'undefined' || str === null || str === '') {
'acquireScore': this.dataForm.acquireScore, return true
'scoreComment': this.dataForm.scoreComment, }
'recordId': this.recordResultId return false
}).then(res => { },
if (res && res.code === 0) { async dataFormSubmit () {
this.$message({ if (this.auth.target === 2) {
message: '操作成功', if (this.stringIsNull(this.dataForm.target)) {
type: 'success', this.alertInfo('目标不能为空')
duration: 1500, return
onClose: () => { }
this.visible = false }
this.$emit('refreshDataList') 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="titleBottom">
<div class="bottom" v-show="this.auth.commit == 1" > <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>
<div class="bottom" v-show="this.auth.approvel == 1" > <div class="bottom" v-show="this.auth.approvel == 1" >
@ -85,7 +85,12 @@
</div> </div>
</template> </template>
</el-table-column> </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"> <el-table-column width="80" label="操作" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
@ -94,26 +99,20 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {getStaffResultDetail} from '@/api/api_result' import {getStaffResultDetail, commitApproval} from '@/api/api_result'
import AddOrUpdate from './recorddetail-add-or-update' import AddOrUpdate from './recorddetail-add-or-update'
export default { export default {
created () { created () {
this.recordResultId = this.$route.query.id
this.type = this.$route.query.type
}, },
filters: { filters: {
getcheckWeightStr (val) { getcheckWeightStr (val) {
@ -154,20 +153,23 @@ export default {
addOrUpdateVisible: false, addOrUpdateVisible: false,
loading: false, loading: false,
auth: [], auth: [],
authId: 0 recordType: 0
} }
}, },
components: { components: {
AddOrUpdate AddOrUpdate
}, },
activated () { activated () {
this.recordResultId = this.$route.query.id
this.recordType = this.$route.query.recordType
this.getDataList() this.getDataList()
}, },
methods: { methods: {
getDataList () { getDataList (id = this.recordResultId) {
this.recordResultId = id
getStaffResultDetail({ getStaffResultDetail({
'recordResultId': this.recordResultId, 'recordResultId': id,
'type': this.type 'recordType': this.recordType
}).then(data => { }).then(data => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.tableData = data.list this.tableData = data.list
@ -183,7 +185,8 @@ export default {
this.department3 = data.department3 this.department3 = data.department3
this.superStaff = data.superStaff this.superStaff = data.superStaff
this.auth = data.auth this.auth = data.auth
this.authId = data.authId this.recordType = data.recordType
this.recordResultId = data.recordResultId
} else { } else {
this.tableData = [] this.tableData = []
} }
@ -196,7 +199,7 @@ export default {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.$refs.addOrUpdate.init(id, type, this.recordResultId) this.$refs.addOrUpdate.init(id, type, this.recordResultId, this.auth, this.recordType)
}, 500) }, 500)
}) })
}, },
@ -207,7 +210,28 @@ export default {
return '' 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}) { objectSpanMethod ({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex === 0) { if (rowIndex === 0) {
@ -253,7 +277,6 @@ export default {
return [0, 0] return [0, 0]
} }
} }
if (rowIndex >= this.fourRowspan && rowIndex <= this.fiveRowspan) { if (rowIndex >= this.fourRowspan && rowIndex <= this.fiveRowspan) {
if (columnIndex === 0) { if (columnIndex === 0) {
return [1, 2] return [1, 2]