|
|
@ -12,7 +12,7 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { countAnalysis } from 'config/api'; |
|
|
|
import { HospitalComplete } from 'config/api'; |
|
|
|
export default { |
|
|
|
name: 'Categorymap', |
|
|
|
data() { |
|
|
@ -22,45 +22,52 @@ export default { |
|
|
|
height: '', |
|
|
|
timer: null, |
|
|
|
list: [], |
|
|
|
xDataList: [], |
|
|
|
aList: [], // 未完成数组 |
|
|
|
bList: [], // 已完成数组 |
|
|
|
cList: [], // 进行中数组 |
|
|
|
dList: [], // 废弃的数组 |
|
|
|
eList: [], // 超时的数组 |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.drawLine(); |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.drawLine(); |
|
|
|
}, 10000); |
|
|
|
let wh = window.innerWidth; |
|
|
|
let hg = window.innerHeight; |
|
|
|
this.width = wh + 'px'; |
|
|
|
this.height = hg + 'px'; |
|
|
|
console.log(this.height); |
|
|
|
window.onresize = () => { |
|
|
|
return (() => { |
|
|
|
wh = window.innerWidth; |
|
|
|
hg = window.innerHeight; |
|
|
|
this.width = wh + 'px'; |
|
|
|
this.height = hg + 'px'; |
|
|
|
})(); |
|
|
|
}; |
|
|
|
// this.timer = setInterval(() => { |
|
|
|
// this.drawLine(); |
|
|
|
// }, 10000); |
|
|
|
// let wh = window.innerWidth; |
|
|
|
// let hg = window.innerHeight; |
|
|
|
// this.width = wh + 'px'; |
|
|
|
// this.height = hg + 'px'; |
|
|
|
// console.log(this.height); |
|
|
|
// window.onresize = () => { |
|
|
|
// return (() => { |
|
|
|
// wh = window.innerWidth; |
|
|
|
// hg = window.innerHeight; |
|
|
|
// this.width = wh + 'px'; |
|
|
|
// this.height = hg + 'px'; |
|
|
|
// })(); |
|
|
|
// }; |
|
|
|
}, |
|
|
|
destroyed() { |
|
|
|
clearInterval(this.timer); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
drawLine() { |
|
|
|
async drawLine() { |
|
|
|
// 基于准备好的dom,初始化echarts实例 |
|
|
|
let myChart = this.$echarts.init(document.getElementById('Categorymap')); |
|
|
|
await this.getData(); |
|
|
|
// 绘制图表 |
|
|
|
var option = { |
|
|
|
legend: { |
|
|
|
data: ['未完成', '已完成', '进行中', '废弃'], |
|
|
|
data: ['未完成', '已完成', '进行中', '废弃', '数据采集超时'], |
|
|
|
top: 30, |
|
|
|
}, |
|
|
|
xAxis: [ |
|
|
|
{ |
|
|
|
type: 'category', |
|
|
|
axisTick: { show: false }, |
|
|
|
data: ['附属医院', '人民医院', '第五人民医院', '国药同煤总医院'], |
|
|
|
data: this.xDataList, |
|
|
|
}, |
|
|
|
], |
|
|
|
yAxis: [{ type: 'value' }], |
|
|
@ -71,7 +78,7 @@ export default { |
|
|
|
barGap: 0, |
|
|
|
// label: labelOption, |
|
|
|
emphasis: { focus: 'series' }, |
|
|
|
data: [320, 332, 301, 334], |
|
|
|
data: this.aList, |
|
|
|
barWidth: 20, |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
@ -102,7 +109,7 @@ export default { |
|
|
|
type: 'bar', |
|
|
|
// label: labelOption, |
|
|
|
emphasis: { focus: 'series' }, |
|
|
|
data: [220, 182, 191, 234], |
|
|
|
data: this.bList, |
|
|
|
barWidth: 20, |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
@ -133,7 +140,7 @@ export default { |
|
|
|
type: 'bar', |
|
|
|
// label: labelOption, |
|
|
|
emphasis: { focus: 'series' }, |
|
|
|
data: [150, 232, 201, 154], |
|
|
|
data: this.cList, |
|
|
|
barWidth: 20, |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
@ -164,7 +171,38 @@ export default { |
|
|
|
type: 'bar', |
|
|
|
// label: labelOption, |
|
|
|
emphasis: { focus: 'series' }, |
|
|
|
data: [98, 77, 101, 99], |
|
|
|
data: this.dList, |
|
|
|
barWidth: 20, |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
|
label: { |
|
|
|
formatter: '{c}', |
|
|
|
show: true, |
|
|
|
position: 'top', |
|
|
|
textStyle: { |
|
|
|
fontSize: '12', |
|
|
|
color: '#000', |
|
|
|
}, |
|
|
|
}, |
|
|
|
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
|
|
|
{ offset: 0, color: '#f00' }, //柱图渐变色 |
|
|
|
{ offset: 1, color: '#F00' }, //柱图渐变色 |
|
|
|
]), |
|
|
|
}, |
|
|
|
emphasis: { |
|
|
|
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
|
|
|
{ offset: 0, color: '#F00' }, //柱图高亮渐变色 |
|
|
|
{ offset: 1, color: '#F00' }, //柱图高亮渐变色 |
|
|
|
]), |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '数据采集超时', |
|
|
|
type: 'bar', |
|
|
|
// label: labelOption, |
|
|
|
emphasis: { focus: 'series' }, |
|
|
|
data: this.eList, |
|
|
|
barWidth: 20, |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
@ -196,28 +234,29 @@ export default { |
|
|
|
}, |
|
|
|
async getData() { |
|
|
|
try { |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
conditionList: [], |
|
|
|
conditionListDate: [], |
|
|
|
hospitalId: '', |
|
|
|
hospitalization: '', |
|
|
|
inpatientId: '', |
|
|
|
inputStatus: '', |
|
|
|
testQuestionsId: '', |
|
|
|
}, |
|
|
|
}; |
|
|
|
const res = await countAnalysis(params); |
|
|
|
const params = { param: {} }; |
|
|
|
const res = await HospitalComplete(params); |
|
|
|
const { code, msg, data } = res.data; |
|
|
|
if (code === 200) { |
|
|
|
this.list = data; |
|
|
|
console.log(data); |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
this.forList(data[i]); |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log(msg); |
|
|
|
this.$message.error('获取数据失败'); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error('获取数据失败'); |
|
|
|
} |
|
|
|
}, |
|
|
|
forList(obj) { |
|
|
|
this.xDataList.push(obj.hospitalName); |
|
|
|
this.aList.push(obj.unfinished); |
|
|
|
this.bList.push(obj.completed); |
|
|
|
this.cList.push(obj.underway); |
|
|
|
this.dList.push(obj.discarded); |
|
|
|
this.eList.push(obj.overtime); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|