|
@ -1,11 +1,27 @@
|
|
<template>
|
|
<template>
|
|
<div class="index-wrap">
|
|
<div class="index-wrap">
|
|
<!-- <div class="home-text">首页</div> -->
|
|
<!-- <div class="home-text">首页</div> -->
|
|
|
|
<div class="mask" v-show="drowMenuShow"></div>
|
|
<div class="select" >
|
|
<div class="select" >
|
|
|
|
|
|
|
|
<div class="drop-menu" :class="{active: drowMenuShow}">
|
|
|
|
<div class="drop-menu-title tc fs-14" @click="drowMenuShow=!drowMenuShow">
|
|
|
|
<span class="v-middle">{{selcommunityName}}</span>
|
|
|
|
<van-icon name="arrow-down" />
|
|
|
|
</div>
|
|
|
|
<div class="drop-menu-area kitbox">
|
|
|
|
<div class="drop-menu-area-left" v-if="townList&&townList.length">
|
|
|
|
<van-sidebar v-model="activeKey">
|
|
|
|
<van-sidebar-item v-for="(item, i) in townList" :key="i" :title="item.townName" />
|
|
|
|
</van-sidebar>
|
|
|
|
</div>
|
|
|
|
<div class="drop-menu-area-right fs-14">
|
|
|
|
<div v-for="(item, i) in communityList" :key="i" @click="onSelect(item)">{{item.hospitalName}}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 设备概况 -->
|
|
<!-- 设备概况 -->
|
|
<div class="panel sbzl">
|
|
|
|
|
|
<div class="panel mt10 sbzl">
|
|
<div class="kitbox pt15 plr15 box-flex-c">
|
|
<div class="kitbox pt15 plr15 box-flex-c">
|
|
<div class="box-flex-c c-333 fs-16 f-bold">设备概况</div>
|
|
<div class="box-flex-c c-333 fs-16 f-bold">设备概况</div>
|
|
<div class="box-flex-c c-333 f-bold fs-12">在线率:{{ overview.onlineRate }}</div>
|
|
<div class="box-flex-c c-333 f-bold fs-12">在线率:{{ overview.onlineRate }}</div>
|
|
@ -127,6 +143,7 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
|
|
import { findOneUser} from "@/api/login";
|
|
import * as echarts from 'echarts';
|
|
import * as echarts from 'echarts';
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
export default {
|
|
export default {
|
|
@ -134,6 +151,32 @@ export default {
|
|
components: {
|
|
components: {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
watch: {
|
|
|
|
drowMenuShow(n){
|
|
|
|
var body = document.getElementsByTagName('body')[0]
|
|
|
|
if(n){
|
|
|
|
body.classList.add('over-hidden')
|
|
|
|
} else {
|
|
|
|
body.classList.remove('over-hidden')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
activeKey(n){
|
|
|
|
this.loadChildren()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed:{
|
|
|
|
selcommunityName(){
|
|
|
|
if(this.selcommunity){
|
|
|
|
if(this.selcommunity.hospitalCode === ''){
|
|
|
|
var item = this.townList[this.activeKey]
|
|
|
|
return item.town === ''? "全部" : item.townName
|
|
|
|
} else {
|
|
|
|
return this.selcommunity.hospitalName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "全部"
|
|
|
|
}
|
|
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
medicineBag:'1',
|
|
medicineBag:'1',
|
|
@ -165,14 +208,22 @@ export default {
|
|
prescriptionStatics:{
|
|
prescriptionStatics:{
|
|
total:'- -',
|
|
total:'- -',
|
|
drugTotal:'- -'
|
|
drugTotal:'- -'
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
drowMenuShow: false,
|
|
|
|
townList: [],
|
|
|
|
communityList: [],
|
|
|
|
selcommunity: '',
|
|
|
|
activeKey: 0,
|
|
|
|
defaultOption: [
|
|
|
|
{ townName: '全部', town: "", children: [{hospitalCode: '', hospitalName: '全部'}] },
|
|
|
|
],
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
this.countall();
|
|
|
|
this.medicine();
|
|
|
|
this.prescriptions();
|
|
|
|
|
|
this.refreshData()
|
|
|
|
this.getOrgList()
|
|
console.log('this.$store.user.state',this.$store.state.user.curRoleCode)
|
|
console.log('this.$store.user.state',this.$store.state.user.curRoleCode)
|
|
if(this.$store.state.user.curRoleCode =='replenisher'){
|
|
if(this.$store.state.user.curRoleCode =='replenisher'){
|
|
this.medicineShow = false;
|
|
this.medicineShow = false;
|
|
@ -185,10 +236,9 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// 设备概况 运营数据
|
|
// 设备概况 运营数据
|
|
countall(){
|
|
countall(){
|
|
|
|
var p = this.getTownParams()
|
|
medicineAbinetApi
|
|
medicineAbinetApi
|
|
.countAllDevice({
|
|
|
|
userId: this.user.id
|
|
|
|
})
|
|
|
|
|
|
.countAllDevice(p)
|
|
.then(res=>{
|
|
.then(res=>{
|
|
// console.log('countall', res);
|
|
// console.log('countall', res);
|
|
this.overview = res.obj.overview;
|
|
this.overview = res.obj.overview;
|
|
@ -205,11 +255,11 @@ export default {
|
|
},
|
|
},
|
|
// 取药次数
|
|
// 取药次数
|
|
medicine(){
|
|
medicine(){
|
|
|
|
var p = this.getTownParams()
|
|
|
|
p.day = this.medicineBag
|
|
|
|
console.log('medicine', p)
|
|
medicineAbinetApi
|
|
medicineAbinetApi
|
|
.getmedicine({
|
|
|
|
userId: this.user.id,
|
|
|
|
day:this.medicineBag
|
|
|
|
})
|
|
|
|
|
|
.getmedicine(p)
|
|
.then(res=>{
|
|
.then(res=>{
|
|
console.log('medicine', res)
|
|
console.log('medicine', res)
|
|
this.medicineData = true;
|
|
this.medicineData = true;
|
|
@ -222,11 +272,10 @@ export default {
|
|
},
|
|
},
|
|
// 电子处方单
|
|
// 电子处方单
|
|
prescriptions(){
|
|
prescriptions(){
|
|
|
|
var p = this.getTownParams()
|
|
|
|
p.day = this.prescriptionBag
|
|
medicineAbinetApi
|
|
medicineAbinetApi
|
|
.getprescriptions({
|
|
|
|
userId: this.user.id,
|
|
|
|
day:this.prescriptionBag
|
|
|
|
})
|
|
|
|
|
|
.getprescriptions(p)
|
|
.then(res=>{
|
|
.then(res=>{
|
|
// console.log('prescriptions', res)
|
|
// console.log('prescriptions', res)
|
|
this.prescriptionStatics = res.obj;
|
|
this.prescriptionStatics = res.obj;
|
|
@ -275,74 +324,170 @@ export default {
|
|
},
|
|
},
|
|
echartsData(){
|
|
echartsData(){
|
|
if(this.sales){
|
|
if(this.sales){
|
|
|
|
var p = this.getTownParams()
|
|
|
|
p.day = this.salesBag
|
|
medicineAbinetApi
|
|
medicineAbinetApi
|
|
.getechartsData({
|
|
|
|
userId: this.user.id,
|
|
|
|
day:this.salesBag
|
|
|
|
})
|
|
|
|
.then(res=>{
|
|
|
|
// console.log('echartsData', res);
|
|
|
|
this.amount = res.obj.amount;
|
|
|
|
this.count = res.obj.amountdateList.map((item) =>{
|
|
|
|
return item.count
|
|
|
|
});
|
|
|
|
this.date = res.obj.amountdateList.map((item) =>{
|
|
|
|
return item.date
|
|
|
|
});
|
|
|
|
|
|
.getechartsData(p)
|
|
|
|
.then(res=>{
|
|
|
|
// console.log('echartsData', res);
|
|
|
|
this.amount = res.obj.amount;
|
|
|
|
this.count = res.obj.amountdateList.map((item) =>{
|
|
|
|
return item.count
|
|
|
|
});
|
|
|
|
this.date = res.obj.amountdateList.map((item) =>{
|
|
|
|
return item.date
|
|
|
|
});
|
|
|
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
|
var myChart;
|
|
|
|
if (myChart != null && myChart != "" && myChart != undefined){
|
|
|
|
// chartDom.clear();
|
|
|
|
myChart.dispose();
|
|
|
|
// document.getElementById('sales-chart').innerHTML = '';
|
|
|
|
}
|
|
|
|
var chartDom = document.getElementById('sales-chart');
|
|
|
|
myChart = echarts.init(chartDom);
|
|
|
|
var option;
|
|
|
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
|
var myChart;
|
|
|
|
if (myChart != null && myChart != "" && myChart != undefined){
|
|
|
|
// chartDom.clear();
|
|
|
|
myChart.dispose();
|
|
|
|
// document.getElementById('sales-chart').innerHTML = '';
|
|
|
|
}
|
|
|
|
var chartDom = document.getElementById('sales-chart');
|
|
|
|
myChart = echarts.init(chartDom);
|
|
|
|
var option;
|
|
|
|
|
|
option = {
|
|
|
|
grid:{
|
|
|
|
left: '3%',
|
|
|
|
right: '4%',
|
|
|
|
bottom: '2%',
|
|
|
|
top:'5%',
|
|
|
|
containLabel: true
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis'
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
boundaryGap: false,
|
|
|
|
data: this.date,
|
|
|
|
axisTick:{
|
|
|
|
show:false, // X轴刻度隐藏
|
|
|
|
|
|
option = {
|
|
|
|
grid:{
|
|
|
|
left: '3%',
|
|
|
|
right: '4%',
|
|
|
|
bottom: '2%',
|
|
|
|
top:'5%',
|
|
|
|
containLabel: true
|
|
},
|
|
},
|
|
axisLabel:{
|
|
|
|
fontSize:'8', // X轴文字字体大小
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
data: this.count,
|
|
|
|
type: 'line'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
// if (myChart != null && myChart != "" && myChart != undefined) {
|
|
|
|
// myChart.dispose();
|
|
|
|
// }
|
|
|
|
option && myChart.setOption(option);
|
|
|
|
})
|
|
|
|
.catch(err=>{
|
|
|
|
console.error(err)
|
|
|
|
})
|
|
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis'
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
boundaryGap: false,
|
|
|
|
data: this.date,
|
|
|
|
axisTick:{
|
|
|
|
show:false, // X轴刻度隐藏
|
|
|
|
},
|
|
|
|
axisLabel:{
|
|
|
|
fontSize:'8', // X轴文字字体大小
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
data: this.count,
|
|
|
|
type: 'line'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
// if (myChart != null && myChart != "" && myChart != undefined) {
|
|
|
|
// myChart.dispose();
|
|
|
|
// }
|
|
|
|
option && myChart.setOption(option);
|
|
|
|
})
|
|
|
|
.catch(err=>{
|
|
|
|
console.error(err)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
refreshData(){
|
|
|
|
this.countall();
|
|
|
|
this.medicine();
|
|
|
|
this.prescriptions();
|
|
|
|
},
|
|
|
|
getTownParams(){
|
|
|
|
var p = {
|
|
|
|
userId: this.user.id,
|
|
|
|
}
|
|
|
|
if(this.selcommunity){
|
|
|
|
if(this.selcommunity.hospitalCode===''){
|
|
|
|
var item = this.townList[this.activeKey]
|
|
|
|
if(item.town === ''){
|
|
|
|
p.level = '';
|
|
|
|
p.area = '';
|
|
|
|
} else {
|
|
|
|
p.level = 2;
|
|
|
|
p.area = item.town;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
p.level = 3; //(name = "level", value = "1、市级、2、区级、3、社区", required = false)
|
|
|
|
p.area = this.selcommunity.hospitalCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return p
|
|
|
|
},
|
|
|
|
|
|
|
|
getOrgList(){
|
|
|
|
findOneUser({
|
|
|
|
id: this.user.id
|
|
|
|
}).then(async res => {
|
|
|
|
// "saasAdmin": "管理员"; regionAdmin" "区域管理员" ; communityAdmin "社区管理员" ; "replenisher": "补货员"
|
|
|
|
var role = this.user.curRoleCode
|
|
|
|
var userArea = res.obj.userArea
|
|
|
|
var townList = [].concat(this.defaultOption)
|
|
|
|
if(role=='communityAdmin' || role=="replenisher"){
|
|
|
|
var g = _.groupBy(userArea, 'town')
|
|
|
|
for(var k in g){
|
|
|
|
var tmp = JSON.parse(JSON.stringify(g[k][0]))
|
|
|
|
tmp.children = g[k]
|
|
|
|
townList.push(tmp)
|
|
|
|
}
|
|
|
|
this.townList = townList
|
|
|
|
} else {
|
|
|
|
if(role == 'regionAdmin'){
|
|
|
|
userArea.forEach(v => {
|
|
|
|
v.children = []
|
|
|
|
});
|
|
|
|
this.townList = townList.concat(userArea)
|
|
|
|
} else if(role=='saasAdmin'){
|
|
|
|
await medicineAbinetApi
|
|
|
|
.baseTownList({ filters: "city=350200"})//写死厦门市
|
|
|
|
.then(res => {
|
|
|
|
console.log('baseTownList', res)
|
|
|
|
if (res.status == 200) {
|
|
|
|
var detailModelList = res.detailModelList;
|
|
|
|
detailModelList.forEach((item) => {
|
|
|
|
item.town = item.code
|
|
|
|
item.townName = item.name
|
|
|
|
item.children = [];
|
|
|
|
});
|
|
|
|
this.townList = townList.concat(detailModelList)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.loadChildren()
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async loadChildren(){
|
|
|
|
var item = this.townList[this.activeKey]
|
|
|
|
if(!item.children || !item.children.length){
|
|
|
|
await medicineAbinetApi
|
|
|
|
.findOrgList({ code: item.town, paeg: 1, pageSize: 999 })
|
|
|
|
.then(res => {
|
|
|
|
console.log('findOrgList', res)
|
|
|
|
if (res.status == 200) {
|
|
|
|
res.detailModelList.forEach(v=>{
|
|
|
|
v.hospitalName = v.name
|
|
|
|
v.hospitalCode = v.code
|
|
|
|
})
|
|
|
|
item.children = [{hospitalCode: '', hospitalName: '全部'}] .concat (res.detailModelList)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(err=>{
|
|
|
|
item.children = []
|
|
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.communityList = item.children
|
|
},
|
|
},
|
|
|
|
onSelect(item){
|
|
|
|
this.selcommunity = item;
|
|
|
|
this.drowMenuShow = false;
|
|
|
|
this.refreshData()
|
|
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|