lincl 3 years ago
parent
commit
f8ec9eac13

+ 3 - 0
mini-pro-web/src/assets/styles/index.scss

@ -49,6 +49,9 @@ html {
#app{
  height: 100%;
}
.over-hidden{
  overflow: hidden;
}
// *,
// *:before,

+ 2 - 0
mini-pro-web/src/router/index.js

@ -130,6 +130,7 @@ function formatAuthMenu(menu){
router.beforeEach(async (to, from, next) => {
    // _from=ihealth&_platform=webApp
    // debugger
    if(to.query._noTop==1){
        store.dispatch('SetNoTop', true)
    }
@ -176,6 +177,7 @@ router.beforeEach(async (to, from, next) => {
                next()
            }
        } else {
            routerLoaded = false
            if( whiteList.indexOf(to.path) > -1) {
                next()
            } else {

+ 3 - 1
mini-pro-web/src/store/modules/user.js

@ -14,7 +14,9 @@ const user = {
            }
        },
        REMOVE_USER: (state, user) => {
            state.info = {}
            for(var k in state){
                delete state[k]
            }
        },
    },

+ 1 - 1
mini-pro-web/src/views/device/infoLog/TimePicker.vue

@ -55,7 +55,7 @@ export default{
<style scoped lang='scss'>
.infoLog-filter-panel{
    position: fixed;
    top: 0;
    top: 50px;
    left: 0;
    width: 100%;
    background: #fff;

+ 2 - 8
mini-pro-web/src/views/device/temperature/index.vue

@ -139,7 +139,7 @@ export default{
            if(n==0){
                this.form.checked1 = false;
                this.form.temperature = '';
                this.heat = 1
                this.form.heat = 1
            } else {
                this.form.temperature = this.temperature;
            }
@ -175,8 +175,6 @@ export default{
                this.$toast('请设置温度预警值')
                return
            }
            if(!this.form.humiditycontrol){
                this.$toast('请开启湿度控制')
                return
@ -185,7 +183,6 @@ export default{
                this.$toast('请设置目标湿度值')
                return
            }
            if(!this.checked2){
                this.$toast('请开启湿度预警')
                return
@ -195,9 +192,6 @@ export default{
                return
            }
            let json = {}
            Object.assign(json, JSON.parse(JSON.stringify(this.form)));
            json.humiditycontrol = json.humiditycontrol?'1':'0';
@ -229,7 +223,7 @@ export default{
                    this.form.humiditycontrol = res.obj.device.humiditycontrol&&res.obj.device.humiditycontrol==1?true:false;
                    this.form.temperature = res.obj.device.temperature;
                    this.form.temperaturecontrol = res.obj.device.temperaturecontrol&&res.obj.device.temperaturecontrol==1?true:false;
                    this.form.heat = res.obj.device.heat;
                    this.form.heat = 1; //res.obj.device.heat;
                    this.checked1 = res.obj.device.warningTemperatureHeight!==null||res.obj.device.warningTemperatureLow!==null;
                    this.checked2 = res.obj.device.waringHumidityHeight!==null||res.obj.device.waringHumidityLow!==null;
                    this.form.waringHumidityHeight = res.obj.device.waringHumidityHeight;

+ 224 - 79
mini-pro-web/src/views/index/Index.vue

@ -1,11 +1,27 @@
<template>
	<div class="index-wrap">
        <!-- <div class="home-text">首页</div> -->
        <div class="mask" v-show="drowMenuShow"></div>
        <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 class="panel  sbzl">
        <div class="panel mt10 sbzl">
            <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 f-bold fs-12">在线率:{{ overview.onlineRate }}</div>
@ -127,6 +143,7 @@
	</div>
</template>
<script>
import { findOneUser} from "@/api/login";
import * as echarts from 'echarts';
import medicineAbinetApi from '@/api/api-medicineAbinet'
export default {
@ -134,6 +151,32 @@ export default {
	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() {
    	return {
            medicineBag:'1',
@ -165,14 +208,22 @@ export default {
            prescriptionStatics:{
                total:'- -',
                drugTotal:'- -'
            }
            },
            drowMenuShow: false,
            townList: [],
            communityList: [],
            selcommunity: '',
            activeKey: 0,
            defaultOption: [
                { townName: '全部', town: "", children: [{hospitalCode: '', hospitalName: '全部'}] },
            ],
            
    	}
  	},
	created(){
		this.countall();
		this.medicine();
        this.prescriptions();
		this.refreshData()
        this.getOrgList()
        console.log('this.$store.user.state',this.$store.state.user.curRoleCode)
        if(this.$store.state.user.curRoleCode =='replenisher'){
            this.medicineShow = false;
@ -185,10 +236,9 @@ export default {
  	methods: {
        // 设备概况 运营数据
		countall(){
            var p = this.getTownParams()
			medicineAbinetApi
				.countAllDevice({
					userId: this.user.id
				})
				.countAllDevice(p)
				.then(res=>{
                    // console.log('countall', res);
                    this.overview = res.obj.overview;
@ -205,11 +255,11 @@ export default {
        },
        // 取药次数
        medicine(){
            var p = this.getTownParams()
            p.day = this.medicineBag
            console.log('medicine', p)
            medicineAbinetApi
				.getmedicine({
                    userId: this.user.id,
                    day:this.medicineBag
				})
				.getmedicine(p)
				.then(res=>{
                    console.log('medicine', res)
                    this.medicineData = true;
@ -222,11 +272,10 @@ export default {
        },
        // 电子处方单
        prescriptions(){
            var p = this.getTownParams()
            p.day = this.prescriptionBag
            medicineAbinetApi
				.getprescriptions({
                    userId: this.user.id,
                    day:this.prescriptionBag
				})
				.getprescriptions(p)
				.then(res=>{
                    // console.log('prescriptions', res)
                    this.prescriptionStatics = res.obj;
@ -275,74 +324,170 @@ export default {
        },
        echartsData(){
            if(this.sales){
                var p = this.getTownParams()
                p.day = this.salesBag
                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>

+ 72 - 1
mini-pro-web/src/views/index/scss/index.scss

@ -10,8 +10,71 @@
        color:#fff;
    }
    .select{
        padding:0 5px;
        width: 345px;
        height:30px; 
        margin: 0 auto;
        position: relative;
        z-index: 5;
        .drop-menu{
            position: relative;
            .van-sidebar-item--select::before{
                background-color: #17b3ec;
            }
            .drop-menu-title{
                border-radius: 5px;
                padding: 5px 15px;
                background: #fff;
                border: 1px solid #e1e1e1;
                text-align: left;
                .van-icon{
                    position: absolute;
                    right: 10px;
                    top: 8px;
                }
            }
            .drop-menu-area{
                background: #f7f8fa;
                margin-top: 10px;
                position: absolute;
                width: 100%;
                left: 0;
                display: none;
                border: 1px solid #e1e1e1;
                border-radius: 5px;
                // border-bottom-left-radius: 5px;
                // border-bottom-right-radius: 5px;
                height: calc(100% - 40px);
                z-index: 5;
                .drop-menu-area-right{
                    height: 100%;
                    overflow-y: auto;
                    background: #fff;
                    -webkit-box-flex: 1;
                    >div{
                        padding: 10px 15px;
                        // border-bottom: 1px solid #e1e1e1;
                        &:last-child{
                            border-bottom: 0;
                        }
                    }
                }
            }
            &.active{
                height: calc(100vh - 49px);
                .drop-menu-area{
                    display: -webkit-box;
                }
               .drop-menu-title{
                   color: #17b3ec;
                //    border-bottom-left-radius: 0;
                //    border-bottom-right-radius: 0;
                //    border-bottom: 1px solid #fff;
                    .van-icon{
                        transform: rotate(-180deg);
                    }
                } 
            }
        }
    }
	.panel{
		width: 345px;
@ -251,4 +314,12 @@
        width:100%;
        height:55px;
    }
    .mask{
        width: 100vh;
        height: 100vh;
        position: fixed;
        background-color: rgba($color: #000000, $alpha: 0.3);
        z-index: 4;
        top: 0;
    }
}

+ 1 - 9
mini-pro-web/src/views/personal/index.vue

@ -50,17 +50,9 @@ export default{
        }
    },
    methods:{
        redirectToLogin() {
            let appId = process.env.VUE_APP_APPID,
                protocol = window.location.protocol,
                host = window.location.host,
                redirctWxAuthUrl = encodeURIComponent(`${protocol}//${host}${process.env.VUE_APP_PRE_PATH}/login`),
                wxAuthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirctWxAuthUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
            
            location.replace(wxAuthUrl)
        },
        async logout(){
            await this.$store.dispatch('LogOut')
            console.log(this.$store.getters.user)
            this.gotoUrl('/login')
        },
    },

+ 4 - 0
mini-pro-web/src/views/replenishment/start/quick.vue

@ -192,6 +192,10 @@ export default{
            this.allNum = num
        },
        sumit(){
            if(!this.selItemList || !this.selItemList.length){
                this.$toast("请选择操作货道")
                return
            }
            if(!this.repAll){
                var exist = _.find(this.selItemList, v=>{
                    return v.qty > this.num

+ 15 - 1
mini-pro-web/src/views/replenishment/stockUp/detail.vue

@ -128,7 +128,21 @@ export default{
                        jsonData: JSON.stringify({obj:p}),
                    })
                    .then(res => {
                        resolve()
                        console.log('baseOutCreateUp', res)
                        if(res && res.status==200){
                            var item = JSON.parse(res.message)
                            medicineAbinetApi
                                .changeMoreReceiveState({
                                    outIds: item.out.id,
                                    state: 1
                                })
                                .then(res => {
                                    resolve()
                                })
                                .catch(err=>{
                                    console.error(err)
                                })
                        }
                    })
                    .catch(err=>{
                        console.error(err)