提交 e7f148cc 编写于 作者: zhentian.jia's avatar zhentian.jia

m学习效果api对接

上级 cbea0693
此差异已折叠。
......@@ -348,16 +348,17 @@ export function getLearnOrganization(data) {
let arr = [];
return arr;
}
let organization = [
{
label: "全部",
value: 0
},
];
// let organization = [
// {
// label: "全部",
// value: 0
// },
// ];
let organization = [];
for (let i = 0; i < data.length; i++) {
let obj = {
label: data[i].hospital_name,
value: data[i].hospital_id,
label: data[i].hospitalName,
value: data[i].hospitalId,
index: i,
};
organization.push(obj);
......
<template>
<div class="learning-effect">
<!-- <el-button type="default" size="small" @click="exportPDF">导出明细</el-button> -->
<div class="education" ref="education"></div>
<div class="learning" ref="learning"></div>
<div class="chart" ref="education"></div>
<div class="chart" ref="learning"></div>
</div>
</template>
<script>
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import * as operationData from "../../utils/operation";
import * as chartData from "../../utils/learning/chartData";
import echarts from "echarts";
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
let vm = null;
export default {
props: {
formInline: {
type: Object
},
activeName: {
type: String
},
},
data() {
return {
echartsData: {
......@@ -24,58 +32,14 @@ export default {
},
created() {
vm = this;
vm.setData();
},
mounted() {
commonUtil.resizeHeight();
this.$on("search", () => {
this.search();
});
},
methods: {
exportPDF() {
let element = '';
element = document.querySelector('.data-all-wrap');
console.log(element);
if(element == null) {
return
}
setTimeout(() => {
html2Canvas(element).then(function(canvas) {
let contentWidth = canvas.width;
let contentHeight = canvas.height;
//一页pdf显示html页面生成的canvas高度;
let pageHeight = contentWidth / 592.28 * 841.89;
//未生成pdf的html页面高度
let leftHeight = contentHeight;
//页面偏移
let position = 0;
//a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
let imgWidth = 595.28;
let imgHeight = 592.28 / contentWidth * contentHeight;
let pageData = canvas.toDataURL('image/jpeg', 1.0);
let pdf = new JsPDF('', 'pt', 'a4');
//有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
//当内容未超过pdf一页显示的范围,无需分页
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
} else {
while (leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight;
position -= 841.89;
//避免添加空白页
if (leftHeight > 0) {
pdf.addPage();
}
}
}
let title = "导出学情报告";
pdf.save(title + '.pdf');
});
}, 0);
},
updateResize() {
this.$nextTick(function() {
window.onresize = function() {
......@@ -84,7 +48,26 @@ export default {
};
});
},
setData() {
search() {
let req = {
projectId: vm.projectId,
beginDate: operationData.setDuringTime(vm.formInline.during,'begin'),
endDate: operationData.setDuringTime(vm.formInline.during,'end'),
hospitalIdList: vm.formInline.organization,
originalFlag: vm.formInline.checked == false ? 0 : 1,
regionId: vm.formInline.region[vm.formInline.region.length - 1],
timeFlag: vm.formInline.timeFlag,
};
openLoading(vm);
if(req.regionId == "000") {
req.regionId = "310";
}
// console.log("0 req", req);
vm.POST("stats/report/studyEffect", req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
}
});
setTimeout(function() {
vm.setEducation();
vm.setLearning();
......@@ -206,13 +189,15 @@ export default {
<style lang='scss' rel='stylesheet/scss'>
.learning-effect {
width: 100%;
.learning,
.education {
margin-top: 40px;
min-width: 400px;
height: 400px;
background: #fff;
background: #fff;
overflow: hidden;
padding: 10px;
.chart {
position: relative;
margin: 20px auto 0 auto;
// width: 100%;
width: 860px;
height: 350px;
}
}
</style>
......@@ -27,7 +27,7 @@
@change="changeOrganization"
multiple
collapse-tags
:disabled="formInline.region.length < 3"
:disabled="areaLen < 3"
style="width:330px"
>
<el-option
......@@ -53,7 +53,7 @@
size="small"
v-model="formInline.timeFlag"
placeholder="请选择"
style="width:330px"
style="width:330px;"
>
<el-option
v-for="item in timeFlagList"
......@@ -136,7 +136,11 @@
></examination-analysisfrom>
</el-tab-pane>
<el-tab-pane label="学习效果分析" name="fifth" >
<learning-effect ref="childEffect"></learning-effect>
<learning-effect
ref="childEffect"
:formInline="formInline"
:activeName="activeName"
></learning-effect>
</el-tab-pane>
</el-tabs>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" center>
......@@ -255,7 +259,8 @@ export default {
value: 2,
label: '开始时间结束时间',
}
]
],
areaLen: 1,
};
},
computed: {
......@@ -293,10 +298,21 @@ export default {
vm.displayExam = res.data.existExam;
vm.flag = res.data.flag;
}
// if(type !=2) {
// vm.getRegionOption();
// }
});
let reqInfo = {
projectId: vm.projectId,
};
// openLoading(vm);
// vm.GET("stats/region/info", reqInfo).then(res => {
// closeLoading(vm);
// if (res.code == "000000") {
// // vm.showOriginal = res.data.status;
// // vm.roleType = res.data.roleType;
// // vm.displayExam = res.data.existExam;
// // vm.flag = res.data.flag;
// }
// });
},
beforeLeave(activeName, oldActiveName) {
// console.log('action',activeName,'oldActive',oldActiveName)
......@@ -323,7 +339,10 @@ export default {
// console.log('vm.dialogData.region',vm.dialogData.region)
}, 20);
// console.log('region',value,vm.formInline);
if (value.length >= 3) {
let areaArr = value[value.length -1].split('_');
vm.areaLen = areaArr.length;
console.log('areaArr!!',areaArr);
if (areaArr.length >= 3) {
this.getOrganizationList();
this.organizationNotice = "请选择机构";
} else {
......@@ -421,24 +440,20 @@ export default {
}
});
},
//获取机构列表
getOrganizationList() {
this.organizationList = [];
let countyId = vm.formInline.region[vm.formInline.region.length - 1];
let type = 3;
if(vm.formInline.region.length == 4) {
type = 5;
}
vm.organizationList = [];
let regionId = vm.formInline.region[vm.formInline.region.length - 1];
let req = {
projectId: vm.projectId,
type: type,
id: countyId
regionId : regionId
};
openLoading(vm);
vm.reportGET("report/portal/getOrganizationList", req).then(res => {
vm.GET("stats/region/hospital", req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.organizationList = operationData.getLearnOrganization(
res.data.hospitalList
res.data.list
);
}
});
......@@ -467,6 +482,7 @@ export default {
this.$refs.childDataAll.$emit("search");
this.$refs.childCrowd.$emit("search");
this.$refs.childCourse.$emit("search");
this.$refs.childEffect.$emit("search");
// if (this.activeName == "first") {
// this.organizationNum = this.getOrganizationNum();
......@@ -689,6 +705,7 @@ export default {
}
.tag-group {
margin-left: 78px;
margin-bottom: 20px;
.el-tag {
margin-right: 20px;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册