企标评价功能完毕

This commit is contained in:
yanyizhou
2021-12-09 13:46:15 +08:00
parent ddfe7c106f
commit 3d1209fa32
@@ -23,65 +23,66 @@
<div class="modular-header" style="height: 50px;">
<div class="modular-header-btn">
<el-button type="warning" icon="el-icon-edit" @click="businessCommentDialog = true">企标评价</el-button>
<el-dialog title="企业标准动态评价" :visible.sync="businessCommentDialog" width="54%" :close-on-click-modal="false">
<el-table ref="businessCommentTable" :data="businessCommentTable.filter((v) => v.code !== '3U9lb')" border style="width: 100%; flex: auto;margin-bottom: 2%"
class="comment-table"
:header-cell-style="{background: '#E8E8E8', color: '#333333', fontSize: '16px',
<el-dialog title="企业标准评价" :visible.sync="businessCommentDialog" :width="(commentAverageScoreTag === '1' && commentActiveName !== 'dynamicComment')?'90%':'65%'" :close-on-click-modal="false">
<el-tabs v-model="commentActiveName" @tab-click="tabsClick">
<el-tab-pane label="动态评价" name="dynamicComment">
<el-table ref="businessCommentTable" :data="businessCommentTable.filter((v) => v.code !== '3U9lb')" border style="width: 100%; flex: auto;margin-bottom: 2%"
class="comment-table"
:header-cell-style="{background: '#E8E8E8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
type="index"
label="序号"
width="55"
align="center"
/>
<el-table-column prop="threeIndexTitle" label="评价指标" width="300">
<!--commentTarget-->
<template slot-scope="scope">
<span>{{scope.row.threeIndexTitle}}</span>
</template>
</el-table-column>
<el-table-column prop="targetScore" label="指标分值" width="165">
<template slot-scope="scope">
<el-col :span="20">
<el-rate
v-model="scope.row.targetScore"
@change="targetScoreChange(scope.row)"
allow-half>
</el-rate>
</el-col>
<b style="margin-left: 5px;font-size: 12px;">{{ scope.row.targetScore * 2 }}</b>
</template>
</el-table-column>
<el-table-column property="reason" label="简述理由">
<template slot-scope="scope">
<el-input clearable size="mini" placeholder="请简述评分理由" @change="commentReasonChange(scope.row)" v-model="scope.row.commentReason" />
</template>
</el-table-column>
</el-table>
<el-form :model="businessCommentForm">
<el-form-item label="动态评价分值">
<el-col :span="4">
<el-rate
v-model="businessCommentForm.averageScore"
disabled
style="margin-top: 12px"
text-color="#ff9900">
</el-rate>
</el-col>
<b style="margin-top: 5px">{{ businessCommentForm.averageScore * 2 }}</b>
</el-form-item>
<el-form-item label="对标准的意见和建议,是否需要修订">
<template>
<el-radio v-model="businessCommentForm.revise" label="1"></el-radio>
<el-radio v-model="businessCommentForm.revise" label="0"></el-radio>
<el-input v-show="businessCommentForm.revise === '1'"
v-model="businessCommentForm.reviseReason"
placeholder="请填写修订理由"
type="textarea"
:rows="2"></el-input>
</template>
</el-form-item>
</el-form>
<el-table-column
type="index"
label="序号"
width="55"
align="center"
/>
<el-table-column prop="threeIndexTitle" label="评价指标" width="300">
<!--commentTarget-->
<template slot-scope="scope">
<span>{{scope.row.threeIndexTitle}}</span>
</template>
</el-table-column>
<el-table-column prop="targetScore" label="指标分值" width="165">
<template slot-scope="scope">
<el-col :span="20">
<el-rate
v-model="scope.row.targetScore"
@change="targetScoreChange(scope.row)"
allow-half>
</el-rate>
</el-col>
<b style="margin-left: 5px;font-size: 12px;color: #ff9900">{{ scope.row.targetScore * 2 }}</b>
</template>
</el-table-column>
<el-table-column property="reason" label="简述理由">
<template slot-scope="scope">
<el-input clearable size="mini" placeholder="请简述评分理由" @change="commentReasonChange(scope.row)" v-model="scope.row.commentReason" />
</template>
</el-table-column>
</el-table>
<el-form :model="businessCommentForm">
<el-form-item label="动态评价分值">
<el-col :span="4">
<el-rate
v-model="businessCommentForm.averageScore"
disabled
style="margin-top: 12px">
</el-rate>
</el-col>
<b style="margin-top: 5px;margin-left: -2%;color: #ff9900">{{ businessCommentForm.averageScore * 2 }}</b>
</el-form-item>
<el-form-item label="对标准的意见和建议,是否需要修订">
<template>
<el-radio v-model="businessCommentForm.revise" label="1"></el-radio>
<el-radio v-model="businessCommentForm.revise" label="0"></el-radio>
<el-input v-show="businessCommentForm.revise === '1'"
v-model="businessCommentForm.reviseReason"
placeholder="请填写修订理由"
type="textarea"
:rows="2"></el-input>
</template>
</el-form-item>
</el-form>
<div style="padding-left: 80%">
<el-button
type="primary"
@@ -100,6 +101,230 @@
>取消
</el-button>
</div>
</el-tab-pane>
<el-tab-pane label="历史评价" name="historyComment">
<el-form>
<el-row>
<el-col :span="10" :offset="4">
<el-form-item>
<el-radio v-model="commentAverageScoreTag" label="1" border @change="tabsClick">质量评价总平均分</el-radio>
<b style="margin-top: 30px;margin-left: 5px;font-size: 20px;color: #ff9900">{{
qualityCommentScore * 2
}}</b>
</el-form-item>
</el-col>
<el-col :span="8" :offset="2">
<el-form-item>
<el-radio v-model="commentAverageScoreTag" label="2" border @change="tabsClick">动态评价总平均分</el-radio>
<b style="margin-top: 30px;margin-left: 5px;font-size: 20px;color: #ff9900">{{
dynamicCommentScore * 2
}}</b>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-table
v-if="commentAverageScoreTag === '1'"
:data="qualityHistoryPeopleTable"
style="width: 100%"
height="345px"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
prop="historyPeopleName"
align="center"
label="质量评价人"
width="130px"
show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="default"
style="width: 100px;" size="mini" @click="historyPeopleChange(scope.row)">
{{ scope.row.userName }}
</el-button>
</template>
</el-table-column>
</el-table>
<el-table
v-else-if="commentAverageScoreTag === '2'"
:data="dynamicHistoryPeopleTable"
style="width: 100%"
height="345px"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
prop="historyPeopleName"
align="center"
label="动态评价人"
width="130px"
show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="default"
style="width: 100px;" size="mini" @click="historyPeopleChange(scope.row)">
{{ scope.row.userName }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="20" >
<div style="width: 100%;padding: 0 1% 2% 0" v-loading="historyInfoLoading" v-show="commentAverageScoreTag === '1'">
<el-table
:data="qualityHistoryCommentTable"
:summary-method="getSummaries"
show-summary
:span-method="(({row, column, rowIndex, columnIndex})=>objectSpanMethod({row, column, rowIndex, columnIndex},qualityHistoryCommentTable))"
style="width: 100%">
<el-table-column label="企业标准编写质量评价表" align="center" label-class-name="column1">
<el-table-column
label="标准代号"
>
<el-table-column
prop="oneIndexTitle"
align="center"
label="一级指标"
width = '120'
>
</el-table-column>
</el-table-column>
<el-table-column
:label="sarStandardsInfoEO.standCode"
>
<el-table-column
prop="twoIndexTitle"
align="center"
label="二级指标"
width = '120'
>
</el-table-column>
<el-table-column
prop="threeIndexTitle"
label="三级指标"
width="300"
>
</el-table-column>
</el-table-column>
<el-table-column
label="标准名称"
>
<el-table-column
prop="weight"
align="center"
label="指标权重 %"
width = '100'
>
<template slot-scope="scope">
{{scope.row.valueType === 'number' ? scope.row.weight * 100 : '加分项('+scope.row.weight+'分)'}}
</template>
</el-table-column>
</el-table-column>
<el-table-column
:label="sarStandardsInfoEO.standName"
>
<el-table-column
prop="targetScore"
align="center"
label="指标分值10分制8合格68不合格6"
width = '200'
>
<template slot-scope="scope">
<el-form-item
:prop="'qualityHistoryCommentTable.'+scope.$index + '.targetScore'">
<el-input v-model.number="scope.row.targetScore" placeholder="请填写分值" />
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="scoreMin"
align="center"
label="分值小计"
width = '80'
>
<template slot-scope="scope">
{{setScoreMin(scope.row)}}
</template>
</el-table-column>
<el-table-column
prop="commentReason"
align="center"
label="简述扣分理由不合格6必填"
>
<template slot-scope="scope" v-if="scope.row.valueType !== 'add'">
<el-form-item
:prop="'qualityHistoryCommentTable.'+scope.$index + '.commentReason'">
<el-input v-model="scope.row.commentReason" placeholder="请填写扣分理由" />
</el-form-item>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
</div>
<div style="width: 100%" v-loading="historyInfoLoading" v-show="commentAverageScoreTag === '2'">
<el-table ref="businessCommentTable" :data="dynamicHistoryCommentTable.filter((v) => v.code !== '3U9lb')" border style="width: 100%; flex: auto;margin-bottom: 2%"
class="comment-table"
:header-cell-style="{background: '#E8E8E8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}">
<el-table-column
type="index"
label="序号"
width="55"
align="center"
/>
<el-table-column prop="threeIndexTitle" label="评价指标" width="300">
<!--commentTarget-->
<template slot-scope="scope">
<span>{{scope.row.indexTitle}}</span>
</template>
</el-table-column>
<el-table-column prop="targetScore" label="指标分值" width="165">
<template slot-scope="scope">
<el-col :span="20">
<el-rate
v-model="scope.row.targetScore / 2"
disabled
allow-half>
</el-rate>
</el-col>
<b style="margin-left: 5px;font-size: 12px;color: #ff9900">{{ parseInt(scope.row.targetScore) }}</b>
</template>
</el-table-column>
<el-table-column property="reason" label="简述理由">
<template slot-scope="scope">
<el-input clearable size="mini" placeholder="该用户没有填写评分理由" disabled v-model="scope.row.commentReason" />
</template>
</el-table-column>
</el-table>
<el-form :model="historyCommentForm">
<el-form-item label="动态评价分值">
<el-col :span="5">
<el-rate
v-model="historyCommentForm.averageScore / 2"
disabled
style="margin-top: 12px;">
</el-rate>
</el-col>
<b style="margin-top: 5px;margin-left: -2%;color: #ff9900">{{ historyCommentForm.averageScore }}</b>
</el-form-item>
<el-form-item label="对标准的意见和建议是否需要修订">
<template>
<el-radio v-model="historyCommentForm.revise" label="1" disabled>是</el-radio>
<el-radio v-model="historyCommentForm.revise" label="0" disabled>否</el-radio>
<el-input v-show="historyCommentForm.revise === '1'"
v-model="historyCommentForm.reviseReason"
disabled
placeholder="请填写修订理由"
type="textarea"
:rows="2"></el-input>
</template>
</el-form-item>
</el-form>
</div>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
</el-dialog>
<el-button v-if="sarStandardsInfoEO.collectId" @click="collectClick(sarStandardsInfoEO.collectId)" title="取消收藏" class="collection-btn" icon="el-icon-star-on" :loading="isSubmit"></el-button>
<el-button v-else @click="collectClick()" title="收藏" class="collection-btn" icon="el-icon-star-off" :loading="isSubmit"></el-button>
@@ -1066,6 +1291,21 @@ export default {
},
data () {
return {
commentAverageScoreTag: '1',
firstHistoryPeopleId: '',//最新评价的人的id
historyInfoLoading: false,//历史评价信息的loading
historyCommentForm: {
averageScore: 0, // 平均分值
revise: '',
reviseReason: '', // 修订理由
}, // 历史评价表单
dynamicHistoryCommentTable: [], // 动态评价历史评价表格
qualityHistoryCommentTable: [], // 质量评价历史评价表格
dynamicHistoryPeopleTable: [], // 动态评价历史评价人表格
qualityHistoryPeopleTable: [], // 质量评价历史评价人表格
dynamicCommentScore: 0,// 动态评价总平均分
qualityCommentScore: 0,// 质量评价总平均分
commentActiveName: 'dynamicComment',
indexType: 'dynamic',
commentReason: '', // 评价理由
commentReason1: '', // 评价理由
@@ -1293,6 +1533,108 @@ export default {
watch: {
},
methods: {
historyPeopleChange(row){
this.historyInfoLoading = true
const allData = {
lawId: this.sarStandardsInfoEO.id,
userId: row.userId,
evaluationType: this.indexType
}
if (this.indexType === 'quality'){
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getEvaluationForm', allData , {
_this: this
}, res => {
this.qualityHistoryCommentTable = res.data
this.historyInfoLoading = false
}, e => {
this.historyInfoLoading = false
})
}else if (this.indexType === 'dynamic'){
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getEvaluationForm', allData , {
_this: this
}, res => {
this.dynamicHistoryCommentTable = res.data
this.historyCommentForm.revise = res.data[0].targetScore
this.historyCommentForm.reviseReason = res.data[0].commentReason
let averageScore = 0
res.data.forEach(item => {
if (item.valueType === 'number'){
averageScore += parseInt(item.targetScore)
}
})
averageScore = averageScore / 4
this.historyCommentForm.averageScore = averageScore
this.historyInfoLoading = false
}, e => {
this.historyInfoLoading = false
})
}
},
tabsClick(tab, event){
this.historyInfoLoading = true
if (this.commentAverageScoreTag === '1'){
this.indexType = 'quality'
//查询评分表
const allData = {
lawId: this.sarStandardsInfoEO.id,
userId: this.firstHistoryPeopleId,
evaluationType: this.indexType
}
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getEvaluationForm', allData , {
_this: this
}, res => {
this.qualityHistoryCommentTable = res.data
this.historyInfoLoading = false
}, e => {
this.historyInfoLoading = false
})
}
else if (this.commentAverageScoreTag === '2'){
this.indexType = 'dynamic'
//查询评分表
const allData = {
lawId: this.sarStandardsInfoEO.id,
userId: this.firstHistoryPeopleId,
evaluationType: this.indexType
}
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getEvaluationForm', allData , {
_this: this
}, res => {
this.dynamicHistoryCommentTable = res.data
this.historyCommentForm.revise = res.data[0].targetScore
this.historyCommentForm.reviseReason = res.data[0].commentReason
let averageScore = 0
res.data.forEach(item => {
if (item.valueType === 'number'){
averageScore += parseInt(item.targetScore)
}
})
averageScore = averageScore / 4
this.historyCommentForm.averageScore = averageScore
this.historyInfoLoading = false
}, e => {
this.historyInfoLoading = false
})
}
//查询动态评价总平均分和质量评价总平均分
let standId = this.sarStandardsInfoEO.id
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getScore', {lawId:standId}, {
_this: this
}, res => {
this.qualityCommentScore = res.data.quality.toFixed(3)/2
this.dynamicCommentScore = res.data.dynamic.toFixed(3)/2
}, e => {
})
},
targetScoreChange(row){
if (this.targetScore1 === '') {
this.targetScore1 = 0
@@ -1368,26 +1710,120 @@ export default {
this.$message.warning('请填写修订理由')
}
if (submitFlag === true) {
this.$message.success('通过')
this.commentSubmitLoading = true
const allData = {
tableData: this.businessCommentTable,
formData: JSON.stringify(this.businessCommentForm),
standId: this.sarStandardsInfoEO.id,
userId: this.$store.getters.userInfo.userId
userId: this.$store.getters.userInfo.userId,
evaluationType: this.indexType
}
console.log(allData)
this.$http.postData('sarEnterpriseStandardEvaluation/quality-evaluation/submitEvaluationForm', allData, {
_this: this
}, res => {
console.log(res)
if (res.ok){
this.$message.success('提交成功')
this.commentSubmitLoading = false
//重新评分之后刷新历史评分人
let standId = this.sarStandardsInfoEO.id
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getHistory', {lawId:standId}, {
_this: this
}, res => {
this.dynamicHistoryPeopleTable = []
this.dynamicHistoryPeopleTable = res.data.records
this.firstHistoryPeopleId = res.data.records[0].userId
// for (let i = 0; i < res.data.records.length; i++) {
// this.dynamicHistoryPeopleTable.push(res.data.records[i].userName)
// }
}, e => {
})
}
}, e => {
})
}
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 3) {
sums[index] = '合计:';
return;
}else if(index === 6){
sums[index] = '';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += ' ';
} else {
sums[index] = '';
}
if(sums[index] !== '' && sums[index].indexOf(".") !== -1){
sums[index] = parseFloat(sums[index]).toFixed(1);
}
});
return sums;
},
objectSpanMethod({ row, column, rowIndex, columnIndex },value) {
if (columnIndex === 0) {
if (rowIndex === 0) {
return {
rowspan: value.length,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}else if(columnIndex === 1 ) {
const _row = (this.filterData2(this.qualityHistoryCommentTable).one)[rowIndex]
const _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}
},
setScoreMin(row){
return row.scoreMin = ((row.targetScore === undefined || row.targetScore === '') ? '' : row.valueType === 'add' ? row.targetScore : (row.targetScore / 10).toFixed(1))
},
filterData2(){
let spanOneArr = []
let concatOne = 0
this.qualityHistoryCommentTable.forEach((item,index)=>{//循环后端查询出来的数据(orderdata)
if(index === 0){
spanOneArr.push(1)
}else{
//name 修改
if(item.twoIndexTitle === this.qualityHistoryCommentTable[index - 1].twoIndexTitle){ //第一列需合并相同内容的字段
spanOneArr[concatOne] += 1
spanOneArr.push(0)
}else{
spanOneArr.push(1)
concatOne = index
}
}
})
return {
one: spanOneArr,
}
},
child1Func(child1){
const list = []
if(child1 && child1.length > 1){
@@ -2383,12 +2819,34 @@ export default {
// }
},
async mounted () {
const qualityRequest = {
lawId: this.sarStandardsInfoEO.id,
evaluationType: 'quality'
}
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getHistory', qualityRequest, {
_this: this
}, res => {
this.qualityHistoryPeopleTable = res.data.records
this.firstHistoryPeopleId = res.data.records[0].userId
}, e => {
})
const dynamicRequest = {
lawId: this.sarStandardsInfoEO.id,
evaluationType: 'dynamic'
}
this.$http.get('sarEnterpriseStandardEvaluation/quality-evaluation/getHistory', dynamicRequest, {
_this: this
}, res => {
this.dynamicHistoryPeopleTable = res.data.records
this.firstHistoryPeopleId = res.data.records[0].userId
}, e => {
})
this.$http.get('sarEnterpriseStandardEvaluation/evaluation-index/getEvaluationIndex', {indexType:this.indexType}, {
_this: this
}, res => {
console.log('2371',res)
this.businessCommentTable = res.data
console.log(this.businessCommentTable)
}, e => {
})
this.sarStandardsInfoEO.id = this.$route.params.id