|
@@ -189,8 +189,10 @@
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
<div>审核进度:{{ computedStep }}/{{ twoTarget }}</div>
|
|
|
- <div>自评分数:{{ DigSelfSco }}</div>
|
|
|
- <div>考核分数:{{ computedSco }}</div>
|
|
|
+ <div>自评分:{{ DigSelfSco }}</div>
|
|
|
+ <div>认定分:{{ computedSco }}</div>
|
|
|
+ <div v-if="formula">加权分:{{formulaScore}}</div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="height:100%;overflow: auto;padding-bottom: 80px;">
|
|
@@ -460,7 +462,8 @@ export default {
|
|
|
PageBaseDataTwo: [],
|
|
|
remDig: false,
|
|
|
timeSortList:[],
|
|
|
- typeStatusList:["待办","已完成",'/']
|
|
|
+ typeStatusList:["待办","已完成",'/'],
|
|
|
+ formula:""
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -538,6 +541,45 @@ export default {
|
|
|
return score;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ formulaScore(){
|
|
|
+ let _result = "0.00"
|
|
|
+
|
|
|
+ if(this.formula && this.PageBaseData){
|
|
|
+ let scoreObj = {}
|
|
|
+ this.PageBaseData.forEach(i=>{
|
|
|
+ if(!scoreObj[i.id]){
|
|
|
+ scoreObj[i.id] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ i.children.forEach(i2=>{
|
|
|
+ if(i2.sco2){
|
|
|
+ scoreObj[i.id]+=parseFloat(i2.sco2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ let formulaText = this.formula;
|
|
|
+ for (const key in scoreObj) {
|
|
|
+ if (scoreObj.hasOwnProperty(key)) {
|
|
|
+ const regex = new RegExp('\\b' + key + '\\b', 'g');
|
|
|
+ formulaText = formulaText.replace(regex, scoreObj[key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!formulaText)return _result;
|
|
|
+
|
|
|
+ try{
|
|
|
+ _result = eval(formulaText).toFixed(2)
|
|
|
+ }catch(e){
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return _result;
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData();
|
|
@@ -546,9 +588,9 @@ export default {
|
|
|
methods: {
|
|
|
exportExlec(){
|
|
|
let headers = [
|
|
|
- ['一级指标', '二级指标', '评价方法', '分值', '自评', '自评概述', '认定', '认定概述']
|
|
|
+ ['一级指标', '二级指标', '分值', '自评', '自评概述', '认定', '认定概述']
|
|
|
];
|
|
|
- let info = [['姓名:'+this.digUsername ,'','','','','自评分数:'+this.DigSelfSco,'','认定分数:'+this.computedSco]]
|
|
|
+ let info = [['姓名:'+this.digUsername ,'','','','自评分:'+this.DigSelfSco,'认定分:'+this.computedSco,'加权分:'+this.formulaScore]]
|
|
|
// var XLSX = require("xlsx");
|
|
|
let data = [
|
|
|
...info,
|
|
@@ -557,7 +599,6 @@ export default {
|
|
|
parent.children.map(child => [
|
|
|
parent.name, // 一级指标
|
|
|
child.name, // 二级指标
|
|
|
- child.evaMethod, // 评分方法
|
|
|
child.score, // 分值
|
|
|
child.sco1, // 自评
|
|
|
child.selfSummary, // 自评概述
|
|
@@ -577,7 +618,8 @@ export default {
|
|
|
const commonStyle = {
|
|
|
alignment: {
|
|
|
horizontal: "center",
|
|
|
- vertical: "center"
|
|
|
+ vertical: "center",
|
|
|
+ wrapText: true // 关键属性:启用自动换行
|
|
|
},
|
|
|
font: {
|
|
|
sz: 12
|
|
@@ -596,14 +638,13 @@ for (let r = 0; r < data.length; ++r) {
|
|
|
|
|
|
// 设置列宽
|
|
|
ws['!cols'] = [
|
|
|
- { wch: 20 }, // 一级指标
|
|
|
+ { wch: 15 }, // 一级指标
|
|
|
{ wch: 20 }, // 二级指标
|
|
|
- { wch: 30 }, // 评价方法
|
|
|
- { wch: 10 }, // 分值
|
|
|
- { wch: 10 }, // 自评
|
|
|
- { wch: 30 }, // 自评概述
|
|
|
- { wch: 10 }, // 认定
|
|
|
- { wch: 30 } // 认定概述
|
|
|
+ { wch: 8 }, // 分值
|
|
|
+ { wch: 8 }, // 自评
|
|
|
+ { wch: 13 }, // 自评概述
|
|
|
+ { wch: 13 }, // 认定
|
|
|
+ { wch: 16 } // 认定概述
|
|
|
];
|
|
|
|
|
|
// 设置行高
|
|
@@ -615,7 +656,18 @@ ws['!rows'] = [
|
|
|
console.log('kk',data);
|
|
|
// 合并单元格
|
|
|
ws['!merges'] = [];
|
|
|
-
|
|
|
+ // 设置打印参数
|
|
|
+ws['!page'] = {
|
|
|
+ orientation: 'portrait', // 强制竖向打印
|
|
|
+ margins: {left:0.5, right:0.5, top:0.75, bottom:0.75}, // 单位:英寸
|
|
|
+ fitToPage: true, // 启用自动缩放
|
|
|
+ fitToHeight: 0, // 不限制垂直页数
|
|
|
+ fitToWidth: 1 // 强制缩放到1页宽度
|
|
|
+ };
|
|
|
+
|
|
|
+ // 可选:压缩字体提升兼容性
|
|
|
+ if(!ws['A1'].s) ws['A1'].s = {};
|
|
|
+ ws['A1'].s.font = {sz:10}; // 设置基准字体10pt
|
|
|
|
|
|
// 记录合并单元格的逻辑
|
|
|
let startRow = 2; // 数据开始行
|
|
@@ -642,8 +694,9 @@ ws['!rows'] = [
|
|
|
previousParentName = currentParentName; // 更新前一个一级指标
|
|
|
}
|
|
|
ws['A1'].s = { alignment: { horizontal: 'left' } }
|
|
|
+ ws['E1'].s = { alignment: { horizontal: 'left' } }
|
|
|
ws['F1'].s = { alignment: { horizontal: 'left' } }
|
|
|
- ws['H1'].s = { alignment: { horizontal: 'left' } }
|
|
|
+ ws['G1'].s = { alignment: { horizontal: 'left' } }
|
|
|
// 检查最后一组
|
|
|
if (count > 0) {
|
|
|
ws['!merges'].push({
|
|
@@ -651,9 +704,9 @@ ws['!rows'] = [
|
|
|
e: { r: startRow + count, c: 0 }
|
|
|
});
|
|
|
}
|
|
|
- ws['!merges'].push( { s: { r: 0, c: 0 }, e: { r: 0, c: 4 } }, // 合并姓名部分(A1-E1)
|
|
|
- { s: { r: 0, c: 5 }, e: { r: 0, c: 6 } }, // 单独保留自评分数(G1)
|
|
|
- { s: { r: 0, c: 7 }, e: { r: 0, c: 7 } } // 单独保留认定分数(H1));
|
|
|
+ ws['!merges'].push( { s: { r: 0, c: 0 }, e: { r: 0, c: 3 } }, // 合并姓名部分(A1-E1)
|
|
|
+ // { s: { r: 0, c: 5 }, e: { r: 0, c: 6 } }, // 单独保留自评分数(G1)
|
|
|
+ // { s: { r: 0, c: 7 }, e: { r: 0, c: 7 } } // 单独保留认定分数(H1));
|
|
|
)
|
|
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, "sheet1"); //把sheet添加到workbook里,第三个参数是sheet名
|
|
@@ -967,8 +1020,8 @@ ws['!rows'] = [
|
|
|
_json["教师账号"] = res[i].eName;
|
|
|
_json["所属教研室"] = res[i].tea;
|
|
|
_json["考核进度"] = `${res[i].step}/${res[i].allStep}`;
|
|
|
- _json["自评分数"] = res[i].evaSca;
|
|
|
- _json["考核分数"] = res[i].cogSco;
|
|
|
+ _json["自评分"] = res[i].evaSca;
|
|
|
+ _json["认定分"] = res[i].cogSco;
|
|
|
array.push(_json);
|
|
|
}
|
|
|
|
|
@@ -1209,7 +1262,8 @@ ws['!rows'] = [
|
|
|
.get(this.$store.state.api + "selectTestExamineBase", params)
|
|
|
.then(res => {
|
|
|
// console.log("selectTestExamineBase", res.data[0][0]);
|
|
|
-
|
|
|
+ this.formula = res.data[0][0].formula?res.data[0][0].formula:"";
|
|
|
+ console.log("formula",this.formula)
|
|
|
this.PageBaseData = JSON.parse(res.data[0][0].json);
|
|
|
this.PageBaseDataTwo = JSON.parse(res.data[0][0].json);
|
|
|
// 处理数据来源
|