Explorar o código

Merge branch 'master' of http://192.168.1.220:10080/Amoy2/intelligent-medicine-cabinet

chenyue %!s(int64=3) %!d(string=hai) anos
pai
achega
5aa24f58fa

+ 21 - 19
mini-pro-web/src/api/login.js

@ -134,27 +134,29 @@ export function findOneUserFormat(data) {
			params: data
		})
		.then(res=>{
			// "saasAdmin": "管理员"; regionAdmin" "区域管理员" ; communityAdmin "社区管理员" ;  "  "replenisher": "补货员"
			var temArr = ['saasAdmin', 'regionAdmin', 'communityAdmin', 'replenisher']
			var roleList = _.map(res.obj.role, v=>{
				return {
					id: v.id,
					code: v.code,
					name: v.name
			if(res && res.obj){
				// "saasAdmin": "管理员"; regionAdmin" "区域管理员" ; communityAdmin "社区管理员" ;  "  "replenisher": "补货员"
				var temArr = ['saasAdmin', 'regionAdmin', 'communityAdmin', 'replenisher']
				var roleList = _.map(res.obj.role, v=>{
					return {
						id: v.id,
						code: v.code,
						name: v.name
					}
				})
				roleList = _.sortBy(roleList, v=>{
					return temArr.indexOf(v.code)
				})
				var curRole = roleList[0]
				var userInfo = {
					roleList,
					curRoleId: curRole.id,
					curRoleCode: curRole.code,
					curRoleName: curRole.name
				}
			})
			roleList = _.sortBy(roleList, v=>{
				return temArr.indexOf(v.code)
			})
			var curRole = roleList[0]
			var userInfo = {
				roleList,
				curRoleId: curRole.id,
				curRoleCode: curRole.code,
				curRoleName: curRole.name
				resolve(userInfo)
			}
			resolve(userInfo)
		})
		.catch(err=>{
			reject(err)

+ 12 - 2
mini-pro-web/src/components/ProductItem/index.vue

@ -1,10 +1,10 @@
<template>
    <div @click="toSet" class='components-product-item' 
        :class="{'pitem-full':data.cargoCapacity==data.qty, 'pitem-close': data.cargoState!=1, 'pitem-fault': data.faultState==1, 'pitem-active': isActive}">
        :class="{'pitem-full':data.cargoCapacity==data.qty, 'pitem-close': data.cargoState!=1, 'pitem-fault': data.faultState==1, 'pitem-active': isActive, 'pitem-main': data.state==21}">
        <div :style="'height: '+ (rate) +'%'" class="pitem-bg"></div>
        <div class="pitem-inner" >
            <div class="kitbox " >
                <div class="box-flex-1">{{data.wayerNo}}号位</div>
                <div class="box-flex-1">{{wayerNo}}号位</div>
                <div>{{data.qty}}/{{data.cargoCapacity}}</div>
            </div>
            <template v-if="data.shelfStatus==1">
@ -27,6 +27,13 @@ export default{
        }
    },
    computed:{
        wayerNo(){
            if(this.data.state==21){
                var arr = this.data.merge.split(",")
                return arr[0] + '~' + arr[arr.length-1]
            }
            return this.data.wayerNo
        },
        rate(){
            var {data} = this
            return (data.qty||0) / (data.cargoCapacity||5) * 100
@ -143,5 +150,8 @@ export default{
            display: block;
        }
    }
    &.pitem-main{
        width: 280px!important;
    }
}
</style>

+ 3 - 4
mini-pro-web/src/mixins/common.js

@ -190,11 +190,11 @@ Vue.mixin({
            return fmt;
        },
        $hasAuth(url, url1, url2){
            function func(list, name){
            function func(list, name, isLeaf){
                var e = _.find(list, v=>{
                    return v.url == name
                })
                return (e&&e.children) || ''
                return isLeaf? e : ((e&&e.children) || '')
            }
            var temp = func(this.$store.state.app.authMenu, url)
@ -212,8 +212,7 @@ Vue.mixin({
            if(!url2){
                return temp
            } 
            return func(temp, url2)
            return func(temp, url2, true)
        }
    }
})

+ 22 - 11
mini-pro-web/src/router/index.js

@ -147,17 +147,28 @@ router.beforeEach(async (to, from, next) => {
    .then(res=>{
        if((store.getters.user && store.getters.user.accessToken)) {
            if(!routerLoaded){
                findLoginRoleMenuTree({
                    roleId: store.getters.user.curRoleId
                })
                .then(res=>{
                    routerLoaded = true
                    var routeList = formatAuthMenu(res.detailModelList)
                    store.dispatch('SetAuthMenu', routeList)
                    console.log('routeList', routeList)
                    next()
                })
                .catch(err=>{
                findOneUserFormat({
                    id: store.getters.user.id
                }).then(userInfo2 => {
                    var userInfo = _.assignIn(store.getters.user, userInfo2);
                    store
                        .dispatch('SetLoginUser', userInfo)
                        .then(res=>{
                            findLoginRoleMenuTree({
                                roleId: store.getters.user.curRoleId
                            })
                            .then(res=>{
                                routerLoaded = true
                                var routeList = formatAuthMenu(res.detailModelList)
                                store.dispatch('SetAuthMenu', routeList)
                                console.log('routeList', routeList)
                                next()
                            })
                            .catch(err=>{
                                console.error(err)
                            })
                        })
                }).catch(err=>{
                    console.error(err)
                })
            } else {

+ 2 - 2
mini-pro-web/src/router/replenishment.js

@ -59,7 +59,7 @@ const routeMap = [
                path: "/replenishment/picking/list",
                name: "replenishmentPickingList",
                meta: {
                    title: "备药单详情",
                    title: "药品申领详情",
                    // hasTop: false,
                    hasBot: false
                },
@ -69,7 +69,7 @@ const routeMap = [
                path: "/replenishment/picking/detail",
                name: "replenishmentPickingDetail",
                meta: {
                    title: "备药单详情",
                    title: "药品申领详情",
                    // hasTop: false,
                    hasBot: false
                },

+ 1 - 0
mini-pro-web/src/views/device/cargoLane/setting.vue

@ -255,6 +255,7 @@ export default{
            }
            
            var p = {
                userId: this.user.id,
                cargoIds: ids.join(','),
                isMerge
            }

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

@ -31,7 +31,7 @@
                    </div>
                    <div class="lh20 ptb10 kitbox">
                        <div class="box-flex-1">
                            <div>待补药品数量:{{item.daibushangpinshuliang}}</div>
                            <div>待入库药品数量:{{item.daibushangpinshuliang}}</div>
                            <div>未设药品货道:{{item.weishezhishangpinhuodao}}</div>
                            <div>设备所属:{{item.community}}</div>
                            <div >设备编号:{{item.equNum}}</div>

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

@ -17,21 +17,21 @@
        </div>
        <div v-if='form.temperaturecontrol'>
            <div class='c-333 c-f14 bgc-fff p15 c-border-b' >
                <div class='flex f_y_c'>
                <!-- <div class='flex f_y_c'>
                    <span>加热控制:</span>
                    <van-radio-group class='ml20' v-model="form.heat" direction="horizontal">
                        <van-radio name="0">关闭</van-radio>
                        <van-radio name="1">开启</van-radio>
                    </van-radio-group>
                </div>
                <div class='flex mt20'>
                </div> -->
                <div class='flex '>
                    <div class='lh46'>请设置目标温度值:</div>
                    <div style='flex:1' class='ml10'>
                        <div class='flex f_y_c'><van-field class='c-border w80' v-model="form.temperature" maxlength='2' type="digit" /><span class='ml10'>度</span></div>
                        <!-- <van-notice-bar class='bgc-fff pl0' wrapable :scrollable="false" >可输入的值范围为: {{form.heat==0?'2-25°':form.heat==1?'20-40°':''}}</van-notice-bar> -->
                    </div>
                </div>
                <div class='mt10'>最后一次发送的温度值为 22°</div>
                <!-- <div class='mt10'>最后一次发送的温度值为 22°</div> -->
                <div class='mt10 c-999'>指令发送成功后,请等待设备生效,设备每隔十分钟左右会返回一次最新实时温度值</div>
            </div>
            <div class='mt10 p10 bgc-fff c-f14 c-333 c-border-tb' v-if='form.temperaturecontrol'>
@ -69,7 +69,7 @@
                    <van-slider button-size='30px' v-model="form.humidity" @change="onChange" />
                    <div class='ml15'>{{form.humidity}}%</div>
                </div>
                <div class='mt20'>最后一次发送的湿度调整值为%</div>
                <!-- <div class='mt20'>最后一次发送的湿度调整值为%</div> -->
                <div class='mt10 c-999'>指令发送成功后,请等待设备生效,设备每隔十分钟左右会返回一次最新实时湿度值</div>
            </div>
            <div class='mt10 p10 bgc-fff c-f14 c-333 c-border-tb' v-if='form.humiditycontrol'>
@ -112,7 +112,7 @@ export default{
                temperature: '',
                humiditycontrol: '',
                temperaturecontrol:'',
                heat: '',
                heat: 1,
                warningTemperatureHeight: '',
                waringHumidityHeight: '',
                warningTemperatureLow: '',
@ -139,7 +139,7 @@ export default{
            if(n==0){
                this.form.checked1 = false;
                this.form.temperature = '';
                this.heat = ''
                this.heat = 1
            } else {
                this.form.temperature = this.temperature;
            }
@ -202,7 +202,7 @@ export default{
            Object.assign(json, JSON.parse(JSON.stringify(this.form)));
            json.humiditycontrol = json.humiditycontrol?'1':'0';
            json.temperaturecontrol = json.temperaturecontrol?'1':'0'
            json.heat = !json.heat&&json.heat!=0?'0':this.form.heat
            json.heat = 1
            medicineAbinetApi.updateTAndH(json).then(res=>{
                this.$toast.clear()
                if(res.status==200){

+ 1 - 1
mini-pro-web/src/views/drug/list.vue

@ -21,7 +21,7 @@
                class="item mb10 bgc-fff btb-e1e1e1 pt10 pb10 plr15">
                <van-row class="lh25 c-333">
                    <span class="fs-17">{{item.drugName}}</span>
                    <span class="fs-14 ml20">处方名称/项目名称:{{item.drugName}}</span>
                    <span class="fs-14 ml20">药品编码:{{item.drugCode}}</span>
                </van-row>
                <van-row class="lh25">
                    <van-col span="12" class="c-999">规格:<span class="c-333">{{item.specif}}</span></van-col>

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

@ -1,7 +1,7 @@
<template>
	<div class="index-wrap">
        <!-- <div class="home-text">首页</div> -->
        <div class="select">
        <div class="select" v-if="false">
            
        </div>
        <!-- 设备概况 -->
@ -35,7 +35,7 @@
                    <van-row>
                    <van-col class="col col-tl" span="12">
                        <div class="operations-num">{{ maintain.addTotal }}</div>
                        <div class="operations-text"><span><img class="img" src="../../assets/images/waiting-equipment.png" alt=""></span>待补设备数</div>
                        <div class="operations-text"><span><img class="img" src="../../assets/images/waiting-equipment.png" alt=""></span>待入库设备数</div>
                    </van-col>
                    <van-col class="col" span="12">
                        <div class="operations-num">{{ maintain.hcWaringTotalNum }}</div>

+ 53 - 0
mini-pro-web/src/views/machine/components/Dialog.vue

@ -0,0 +1,53 @@
<template>
	<div class="machine-index-dialog">
		<van-popup v-model="show" >
			<div class="fs-14 c-646566 tc pt20 pb20">
				打印完成
			</div>
			<div class="btn tc  fs-16 c-17b3ec">
				<van-button @click="close" type="default" block>返回首页({{times}}s)</van-button>
			</div>
		</van-popup>
	</div>
</template>
<script>
var countDownFunc
export default {
  	data() {
    	return {
			show: true,
			times: 30
    	}
  	},
	mounted(){
		this.countDown()
	},
  	methods: {
		countDown(){
			this.times = 30
			countDownFunc = setInterval(()=>{
				if(this.times === 0){
					this.close()
				}
				this.times--
			}, 1000)
		},
		close(){
			clearInterval(countDownFunc)
			this.$emit('back')
		}
    },
}
</script>
<style lang="scss" scoped>
.machine-index-dialog {
	.van-popup {
		border-radius: 10px;
		width: 70vw;
		.van-button{
			border: 0;
			color: #17b3ec;
		}
	}
}
</style>

+ 101 - 34
mini-pro-web/src/views/machine/index.vue

@ -1,6 +1,6 @@
<template>
	<div class="machine-index" >
		<div v-show="step==3&&rsType!=3&&!inOut" class="back-btn" @click="onPrev">
		<div v-show="step==2 || (step==3&&rsType!=3&&!inOut)" class="back-btn" @click="onPrev">
			<img src="./img/fanhui_icon.png" alt="">
			<span>{{times}}s</span>
		</div>
@ -81,11 +81,13 @@
			</template>
		</div>
		<Dialog ref="Dialog" v-if="showPrintComplete" @back="onPrev"/>
		<Scan @onComplete="onComplete" v-show="step==2" @onBack="step=1"/>
		<Result @showOrderDetail="showOrderDetail" @outDrug="sendShipment" @onPrint="SetPrintPage" :rsType.sync="rsType" :orderList="orderList" :orderdetail="orderdetail" v-show="step==3" @onBack="step=2" @onBackIndex="step=1"/>
		<Result @showOrderDetail="checkCardNo" @outDrug="sendShipment" @onPrint="SetPrintPage" :rsType.sync="rsType" :orderList="orderList" :orderdetail="orderdetail" v-show="step==3" @onBack="step=2" @onBackIndex="step=1"/>
	</div>
</template>
<script>
import Dialog from './components/Dialog.vue';
import Scan from './components/Scan.vue';
import Result from './components/Result.vue';
import medicineAbinetApi from '@/api/api-medicineAbinet'
@ -94,7 +96,8 @@ export default {
	name: "machineIndex",
	components: {
		Scan,
		Result
		Result,
		Dialog
  	},
  	data() {
    	return {
@ -122,13 +125,19 @@ export default {
			times: 30,
			shippingType: '', //取药方式(1、扫码,2、医保卡)
			inOut: false,
			eventName: ''
			eventName: '',
			showPrintComplete: false,
			nextOrderDetail: '',
			oldCardNo: ''
    	}
  	},
	watch:{
		step(n){
			if(n!=3){
			if(n==2){
				this.countDown()
			}else if(n!=3){
				this.rsType = 0
				this.oldCardNo = ''
			}
		},
		rsType(n){
@ -153,19 +162,25 @@ export default {
	},
  	methods: {
		onPrev(){
			if(this.rsType == 5){
			this.nextOrderDetail = ''
			this.showPrintComplete = false
			if(this.step == 2){
				this.step = 1
			} else if(this.rsType==1 || this.rsType==2 || this.rsType==4){
				var orderLen = this.orderList&&this.orderList.length>1
				if(orderLen){
					if(this.rsType==4){
						this.orderList.splice(this.orderList.indexOf(this.orderInfo), 1)
					}
					this.rsType = 5
				} else {
			} else {
				if(this.rsType == 5){
					this.step = 1
				}
			} 
				} else if(this.rsType==1 || this.rsType==2 || this.rsType==4){
					var orderLen = this.orderList&&this.orderList.length>1
					if(orderLen){
						if(this.rsType==4){
							this.orderList.splice(this.orderList.indexOf(this.orderInfo), 1)
						}
						this.rsType = 5
					} else {
						this.step = 1
					}
				} 
			}
		},
		devinfoAdvList(){
			var p = {
@ -199,6 +214,7 @@ export default {
			this.$toast.clear()
            this.$loading('加载中..')
			this.shippingType = pickUpNum? 1 : 2
			this.oldCardNo = cardNum? cardNo : ''
            let p = {
                deviceId: this.deviceNum, //设备编号
				pickUpNum, //取药码
@ -322,12 +338,10 @@ export default {
			console.log(msg.data)
			var msgobj = JSON.parse(msg.data)
			if (msgobj.type == 'ShipInfo') {
				debugger
				var item = this.orderdetail[this.currindex]
				if (msgobj.mess == ( item.layerNo +";"+ item.wayerNo) ) {
					this.updateOrderOutStatus(item.id, 2, msgobj.mess)
						.then(res=>{
							debugger
							this.currindex++;
							if (this.orderdetail.length > this.currindex) {
								this.$loading(`正在出第${this.currindex+1}个药..`)
@ -340,7 +354,6 @@ export default {
							}
						})
						.catch(err=>{
							debugger
							console.error(err)
							this.shipComplete("更新订单状态失败:"+ (err&&err.message))
						})
@ -374,18 +387,56 @@ export default {
					return
				}
				this.clearReadCardCountDown()
				if (msgobj.mess.indexOf("异常") != -1 || msgobj.mess.indexOf("读取信息失败") != -1) {
					this.$toast(msgobj.mess)
					return
				try{
					if (msgobj.mess.indexOf("异常") != -1 || msgobj.mess.indexOf("读取信息失败") != -1) {
						if(this.nextOrderDetail){
							this.$toast.loading({
								duration: 0,
								forbidClick: true, // 禁用背景点击
								loadingType: 'loading',
								message: msgobj.mess,
								onClose: ()=>{
									this.onPrev()
								}
							});
						} else {
							this.$toast(msgobj.mess)
						}
						return
					}
					var arr = msgobj.mess.split("\n");
					var json = {}
					arr.forEach(v => {
						var tmp = v.split(":")
						json[tmp[0]] = tmp[1]
					});
					var cardNo = json['卡号']
					if(this.nextOrderDetail){
						if(cardNo != this.oldCardNo){
							this.$toast.loading({
								duration: 0,
								forbidClick: true, // 禁用背景点击
								loadingType: 'loading',
								message: "医保卡信息不匹配,请重新操作",
								onClose: ()=>{
									this.onPrev()
								}
							});
						} else {
							var order = this.nextOrderDetail
							this.nextOrderDetail = ''
							this.showOrderDetail(order)
						}
						return
					}
					this.checkOrderAndReturn({cardNum: cardNo})
				}catch(e){
					console.error(e)
				}
				var arr = msgobj.mess.split("\n");
				var json = {}
				arr.forEach(v => {
					var tmp = v.split(":")
					json[tmp[0]] = tmp[1]
				});
				this.checkOrderAndReturn({cardNum: json['卡号']})
			} else if(msgobj.type == 'PrintComplete'){
				this.showPrintComplete = true
				return
				this.$dialog.alert({
					title: '',
					message: '打印完成',
@ -407,7 +458,19 @@ export default {
			this.$loading('读取中..')
			this.clearReadCardCountDown()
			readCardCountDown = setTimeout(()=>{
				this.$toast('读取医保卡失败')
				if(this.nextOrderDetail){
					this.$toast.loading({
						duration: 0,
						forbidClick: true, // 禁用背景点击
						loadingType: 'loading',
						message: "读取医保卡失败",
						onClose: ()=>{
							this.onPrev()
						}
					});
				} else {
					this.$toast('读取医保卡失败')
				}
			}, 10 * 1000)
			var obj = {
@ -579,7 +642,6 @@ export default {
		},
		updateOrderOutStatus(shipmentLogId, status, msg){
			return new Promise((resolve, reject)=>{
				debugger
				var p = {
					shipmentLogId: shipmentLogId || '',
					status: status || '',
@ -590,7 +652,6 @@ export default {
				medicineAbinetApi
					.updateOrderOutStatus(p)
					.then(res=>{
						debugger
						if(res.status == 200){
							resolve()
							return
@ -598,7 +659,6 @@ export default {
						reject()
					})
					.catch(err=>{
						debugger
						console.error(err)
						reject()
					})
@ -659,7 +719,6 @@ export default {
			}
		},
		resetTimeoutInterval(){
			return
			this.clearTimeoutInterval()
			timeoutInterval = setTimeout(()=>{
				var msg = "出药超时,请联系管理员"
@ -719,6 +778,14 @@ export default {
				}
				this.systemUpdate()
			}
		},
		checkCardNo(item){
			if(this.oldCardNo){
				this.nextOrderDetail = item
				this.sendReadCard()
			} else {
				this.showOrderDetail(item)
			}
		}
    },
	destroyed() {

+ 4 - 4
mini-pro-web/src/views/order/components/Filter.vue

@ -16,7 +16,7 @@
                                </van-sidebar>
                            </div>
                            <div class="drop-menu-area-right">
                                <div v-for="(item, i) in communityList" :key="i" @click="selcommunity=item;drowMenuShow=false;onSearch()">{{item.hospitalName}}</div>
                                <div v-for="(item, i) in communityList" :key="i" @click="selcommunity=item;drowMenuShow=false;">{{item.hospitalName}}</div>
                            </div>
                        </div>
                    </div>
@ -143,8 +143,8 @@ export default{
                endTime = new Date()
            } else if(dateType > 2000){
                var time = this.$moment().years(dateType)
                startTime = time.startOf('year')
                endTime = time.endOf('year')
                startTime = time.startOf('year').toDate()
                endTime = time.endOf('year').toDate()
            } else {
                if(this.startDate){
                    startTime = this.startDate
@ -188,7 +188,7 @@ export default{
                if(role=='communityAdmin' || role=="replenisher"){
                    var g = _.groupBy(userArea, 'town')
                    for(var k in g){
                        var tmp = g[k][0].concat([])
                        var tmp = JSON.parse(JSON.stringify(g[k][0]))
                        tmp.children = g[k]
                        townList.push(tmp)
                    }

+ 19 - 11
mini-pro-web/src/views/order/list.vue

@ -5,7 +5,7 @@
                <form action="/">
                    <van-search
                        v-model="searchText"
                        placeholder="订单号、金额、手机号"
                        placeholder="订单号、手机号"
                        show-action
                        @search="onSearch"
                        shape="round"
@ -164,15 +164,24 @@ export default{
    methods:{
        onLoad({page, pageSize, searchText}){
            var { startDate, endDate } = this
            var p = {
				startTime: startDate? this.$moment(startDate).format('YYYY-MM-DD 00:00:00') : '',
				endTime: endDate? this.$moment(endDate).format('YYYY-MM-DD 23:59:59') : '',
                userId: this.user.id,
				community: this.selcommunity? this.selcommunity.hospitalCode : '',
				content: searchText,
				sellState: this.sellState,
                page: page,
                size: pageSize
            var p 
            if(this.searchText){
                p = {
                    userId: this.user.id,
                    content: this.searchText,
                    page: page,
                    size: pageSize
                }
            } else {
                p = {
                    startTime: startDate? this.$moment(startDate).format('YYYY-MM-DD 00:00:00') : '',
                    endTime: endDate? this.$moment(endDate).format('YYYY-MM-DD 23:59:59') : '',
                    userId: this.user.id,
                    community: this.selcommunity? (this.selcommunity.hospitalCode||this.selcommunity.hospital) : '',
                    sellState: this.sellState,
                    page: page,
                    size: pageSize
                } 
            }
            console.log('params', p)
            medicineAbinetApi
@ -280,7 +289,6 @@ export default{
            this.communityList = item.children
        },
        onSubmit(data){
            debugger
            this.startDate = data.startTime
            this.endDate = data.endTime
            this.selcommunity = data.selcommunity

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

@ -51,7 +51,7 @@
					<van-row class="">
						<van-col @click="gotoUrl('/replenishment/picking/list')" span="6" class="tc ">
							<div class="fs-23 c-17b3ec"><img src="@/assets/images/dingdanguanli.png" alt=""></div>
							<div class="fs-14 c-666 pt5">备药单</div>
							<div class="fs-14 c-666 pt5">药品申领</div>
						</van-col>
						<van-col @click="gotoUrl('/replenishment/record/list')" span="6" class="tc">
							<div class="fs-23 c-ff9526"><img src="@/assets/images/shebeiguanli.png" alt=""></div>

+ 5 - 5
mini-pro-web/src/views/replenishment/picking/list.vue

@ -21,7 +21,7 @@
			<div class="list plr15 pt10">
                <div @click="gotoDetail(item)" v-for="(item, i) in list" :key="i" class="item bgc-fff plr15 c-333 fs-14">
                    <div class=" ptb10 kitbox bb-e1e1e1">
                        <div class="box-flex-1 fs-14">备药单号:{{item.docNum}}</div>
                        <div class="box-flex-1 fs-14">药品申领单号:{{item.docNum}}</div>
                        <div class="">
                            <span v-if="active===0&&item.state==2" class="c-ff9526">未生成</span>
                            <span v-if="active===0&&item.state==1" class="c-17b3ec">已生成</span>
@ -33,19 +33,19 @@
                    <div class="lh20 ptb10 kitbox">
                        <div class="box-flex-1">
                            <div class="row">
                                <div>补货员</div>
                                <div>设备管理员</div>
                                <div>{{item.replenishErName}}</div>
                            </div>
                            <div class="row">
                                <div>待补设备</div>
                                <div>待入库设备</div>
                                <div>{{item.replenishEquName}}</div>
                            </div>
                            <div class="row">
                                <div>待补品类</div>
                                <div>待入库品类</div>
                                <div>{{item.replenishCate}}</div>
                            </div>
                            <div class="row">
                                <div>待补库存</div>
                                <div>待入库库存</div>
                                <div>{{item.replenishInventory}}</div>
                            </div>
                            <div class="row">

+ 321 - 46
mini-pro-web/src/views/replenishment/start/deviceDetail.vue

@ -48,14 +48,11 @@
                <div class="color-block ml10 red"></div>
                <span class="ml5 fs-12">故障</span>
            </div>
            <div class="plr15" v-if="!isView&&this.outDetailList&&this.outDetailList.length">
            <div class="plr15" v-if="!isView&&this.outDetailList&&this.outDetailList.length&&$hasAuth('device', 'operate','replenish')">
                <van-button v-if="curOrder" @click="updateStockUpStatus(curOrder, 2)" type="primary" color="#17b3ec" size="mini">完成入库</van-button>
                <van-button v-else-if="orderList&&orderList.length" @click="showOrderPicker=true" type="primary" color="#17b3ec" size="mini">导入备药单药品</van-button>
                <!-- <van-button v-else @click="changeShowDrug" type="primary" color="#17b3ec" size="mini">{{showDeviceDrug? '备药单药品' : '导入备药单药品'}}</van-button> -->
                <van-button v-else-if="orderList&&orderList.length" @click="showOrderPicker=true" type="primary" color="#17b3ec" size="mini">导入申领药品单</van-button>
            </div>
            <div class="plr15" v-if="isView">
                
            <div class="plr15" v-if="isView&&$hasAuth('device', 'operate','replenish')">
                <van-button @click="gotoUrl('/replenishment/start/deviceDetail', {deviceId: deviceId})" type="primary" color="#17b3ec" size="mini">点击进行入库</van-button>
            </div>
        </div>
@ -74,26 +71,39 @@
                        <div class="box-flex-1 pl10">
                            <div class="fs-15 ellipsis_1 c-333">{{item.drugName}}</div>
                            <div class="fs-14 c-666">
                                <div>设备库存:{{item.qty||item.inventoryNum}}</div>
                                <div v-if="!showDeviceDrug">申领数量:{{item.quantity}}</div>
                                <div>当前库存量:{{item.qty||item.inventoryNum||Number(item.total||0)}}</div>
                                <div v-if="curOrder">未放置数量:{{accessLeftNum(item)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <template v-else>
                    <div class="item" v-for="(item, k) in curItem.list" :key="k">
                        <ProductItem :data="item" :index="k" :isView="isView"/>
                    </div>
                    <template v-for="(item, k) in curItem.list">
                        <div class="item" v-if="item.state!=20" :key="k">
                            <ProductItem :bussuness="bussuness" @onChange="onChange($event, item)" :data="item" :index="k" :isView="isView"/>
                        </div>
                    </template>
                </template>
            </div>
        </div>
        
        <div class="bot-banner">
            <div class="kitbox">
                <div v-if="!isManage" class="box-flex-1 plr5"><van-button @click="changeManage" block plain color="#17b3ec" size="small" type="primary" round>货道管理</van-button></div>
                <template v-else>
                    <div class="box-flex-1 plr5"><van-button @click="openAndCloseCargo" block plain color="#17b3ec" size="small" type="primary" round>关闭/开启货道</van-button></div>
                    <div class="box-flex-1 plr5"><van-button @click="mergeAndSplitCargo" block plain color="#17b3ec" size="small" type="primary" round>合并/拆分货道</van-button></div>
                    <div class="plr5"><van-button @click="changeManage" class="w50" block plain color="red" size="small" round type="primary" >取消</van-button></div>
                </template>
            </div>
        </div>
        <van-popup v-model="showOrderPicker">
            <div class="tc fs-16 pt15 pb10">备药单选择</div>
            <div class="tc fs-16 pt15 pb10">药品申领单选择</div>
            <div class="order-list" v-if="orderList&&orderList.length">
                <div class="order-item kitbox ptb10" v-for="item in orderList" :key="item.id">
                    <div class="box-flex-1">
                        <div class="break-all">备药单:{{item.docNum}}</div>
                        <div class="break-all">药品申领单号:{{item.docNum}}</div>
                        <div class="break-all">新增日期:{{item.docTime}}</div>
                        <div class="break-all">申领品类:{{item.replenishCate}}</div>
                        <div class="break-all">申请数量:{{item.replenishInventory}}</div>
@ -133,7 +143,11 @@ export default{
            showDeviceDrug: true,
            curOrder: '',
            orderList: [],
            showOrderPicker: false
            showOrderPicker: false,
            selItemList: [],
            isManage: false,
            bussuness: ''
        }
    },
    watch:{
@ -148,6 +162,10 @@ export default{
    methods:{
        $refreshData(){
            this.findMediicinecabinetInventoryByDeviceId()
            this.getDrugInventoryCount()
            if(this.curOrder){
                this.queryUpListByDeviceIdAndStatus()
            }
        },
        async initPage(){
            this.$loading('加载中..')
@ -157,33 +175,63 @@ export default{
            await this.getOutDetailByUserIdAndDeviceId()
            this.findMediicinecabinetInventoryByDeviceId()
        },
        checkUpdateStockUpStatus(item, status){
            return new Promise((resolve, reject)=>{
                if(status == 2){
                    this.$dialog.confirm({
                        title: '完成入库',
                        confirmButtonText: "完成入库",
                        message: `请确认药品申领单:${item.docNum} 是否全部完成药品入库,完成后生效并删除此药品申领单`,
                    })
                    .then(() => {
                        resolve(true)
                    })
                    .catch(()=>{
                        resolve(false)
                    })
                } else {
                    resolve(true)
                }
            })
        },
        updateStockUpStatus(item, status){
            this.$toast('加载中..')
            //查备药单详情
            let p = {
                id: item.id,
                status
            }
            console.log('updateStockUpStatus', p)
            medicineAbinetApi
                .updateStockUpStatus(p)
                .then(res=>{
                    this.$toast.clear()
                    console.log('updateStockUpStatus', res)
                    if(res && res.status == 200){
                        if(status == 1){
                            this.curOrder = item
                            // this.list[0].list = res.obj.list
            this.checkUpdateStockUpStatus(item, status).then(res=>{
                if(!res){
                    return
                }
                this.$toast('加载中..')
                //查备药单详情
                let p = {
                    equNum: this.deviceInfo.device.equNum,
                    id: item.outId || item.id,
                    status
                }
                console.log('updateStockUpStatus', p)
                medicineAbinetApi
                    .updateStockUpStatus(p)
                    .then(res=>{
                        this.$toast.clear()
                        console.log('updateStockUpStatus', res)
                        if(res && res.status == 200){
                            if(status == 1){
                                this.showOrderPicker = false
                                var mediicinestockout = res.obj.mediicinestockout
                                mediicinestockout.outId = res.obj.id
                                this.curOrder = mediicinestockout
                                this.list[0].list = _.filter(this.curOrder.mediicinestockoutdetails, v=>{
                                    return this.accessLeftNum(v)>0
                                })
                            } else {
                                this.curOrder = ''
                                this.list[0].list = this.deviceDrugList
                            }
                            this.queryUpListByStatus()
                            this.showOrderPicker = false
                        } else {
                            this.curOrder = ''
                        }
                    }
                })
                .catch(err=>{
                    console.error(err)
                })
                    })
                    .catch(err=>{
                        console.error(err)
                    })
            })
        },
        async queryUpListByStatus(){
            //查询已领取 未导入的备药单
@ -214,7 +262,12 @@ export default{
                .then(res=>{
                    console.log('queryUpListByDeviceIdAndStatus', res)
                    if(res && res.detailModelList && res.detailModelList.length){
                        this.curOrder = res.detailModelList[0]
                        var mediicinestockout = res.detailModelList[0].mediicinestockout
                        mediicinestockout.outId = res.detailModelList[0].id
                        this.curOrder = mediicinestockout
                        this.list[0].list = _.filter(this.curOrder.mediicinestockoutdetails, v=>{
                            return this.accessLeftNum(v)>0
                        })
                    }
                })
                .catch(err=>{
@ -230,7 +283,9 @@ export default{
                .getDrugInventoryCount(p)
                .then(res=>{
                    console.log('getDrugInventoryCount', res)
                    this.list[0].list = res.detailModelList
                    if(!this.curOrder){
                        this.list[0].list = res.detailModelList
                    }
                    this.deviceDrugList = res.detailModelList
                })
                .catch(err=>{
@ -275,6 +330,7 @@ export default{
                        var list = _.map(res.detailModelList, v=>{
                            var key = _.keys(v)[0]
                            v[key].forEach(m => {
                                m.isActive = false
                                m.cargoState==1? openCount++ : closeCount++
                                if(m.faultState==1){
                                    faultCount++
@ -328,10 +384,211 @@ export default{
                drugName: item.drugName,
                drugCode: item.drugCode,
                drugId: item.drugId,
                qty: item.qty||item.inventoryNum,
                quantity: item.quantity,
                qty: item.qty||item.inventoryNum||Number(item.total||0),
                quantity: this.accessLeftNum(item),  
                outDetailId: item.id
            })
        }
        },
        accessLeftNum(item){
            var left = (item.quantity||0) - (item.batchNum||0)
            return left<0? 0 : left
        },
        changeManage(){
            if(this.isManage){
                this.selItemList.forEach(v=>{
                    v.isActive = false
                })
                this.selItemList = []
                this.bussuness = '';
            } else{
                this.bussuness = 'quick';
            }
            this.isManage = !this.isManage
        },
        onChange(isActive, item){
            item.isActive = isActive
            if(isActive){
                this.selItemList.push(item)
            } else {
                this.selItemList.splice(this.selItemList.indexOf(item), 1)
            }
        },
        checkOpenOrClose(){
            return new Promise((resolve, reject)=>{
                var g = _.groupBy(this.selItemList, 'cargoState')
                if(g[1] && g[0]){
                    this.$dialog.confirm({
                        title: '货道设置',
                        message: `选中货道已包含"关闭"和"开启"货道,请选择`,
                        confirmButtonText: '全部开启',
                        cancelButtonText: '全部关闭'
                    })
                    .then(() => {
                        resolve(1)
                    })
                    .catch(()=>{
                        resolve(0)
                    })
                } else {
                    resolve(g[1]? 0 : 1)
                }
            })
        },
        openAndCloseCargo(){
            if(!this.selItemList || !this.selItemList.length){
                this.$toast('请选择要操作的货道')
                return
            }
            this.checkOpenOrClose().then(cargoState=>{
                this.$nextTick(()=>{
                    var ids = _.map(this.selItemList, v=>{
                        return v.id
                    })
                    this.$loading('保存中..')
                    let p = {
                        cargoIds: ids.join(','),//必穿		货道id,多个id,英文逗号隔开,例如   1,2 		4,5,6
                        cargoState 		//必传		1开启,0关闭
                    }
                    console.log('params', p)
                    medicineAbinetApi
                        .openAndCloseCargo(p)
                        .then(res=>{
                            console.log('openAndCloseCargo', res)
                            this.selItemList.forEach(v=>{
                                v.isActive = false
                                v.cargoState = cargoState
                            })
                            this.selItemList = []
                            this.$toast({
                                message: '操作成功',
                                forbidClick: true,
                                onClose: ()=>{
                                }
                            })
                            this.setBackRefresh(true)
                        })
                        .catch(err=>{
                            console.error(err)
                        })
                })
            })
        },
        checkMerge(){
            return new Promise((resolve, reject)=>{
                var exist = _.find(this.selItemList, v=>{
                    return !!v.drugCode
                })
                if(exist){
                    this.$toast.clear()
                    this.$dialog.confirm({
                        message: '当前合并货道存在药品,需把药品下架并取出,如您继续合并默认下架全部药品',
                        confirmButtonText: '继续合并'
                    })
                    .then(() => {
                        this.$loading('保存中..')
                        resolve(true)
                    })
                    .catch(() => {
                        resolve(false)
                    });
                    return 
                }
                resolve(true)
            })
        },
        checkSplit(){
            return new Promise((resolve, reject)=>{
                this.$toast.clear()
                this.$dialog.confirm({
                    message: '货道拆分后请取下货道上的药品',
                    confirmButtonText: '继续拆分'
                })
                .then(() => {
                    resolve(true)
                })
                .catch(() => {
                    resolve(false)
                });
            })
        },
        async mergeAndSplitCargo(){
            this.$loading('保存中..')
            var ids = []
            var g = _.groupBy(this.selItemList, 'state')
            if((g['21'] || g['20']) && g['1']){
                this.$toast.clear()
                this.$dialog.alert({
                    title: '货道设置',
                    message: `当前选中货道包含合并,您需要先手动拆分合并的货道`,
                    confirmButtonText: '我已知悉',
                })
                return
            }
            var isMerge = g['21']? false : true
            if(isMerge){
                console.log(this.selItemList, 'this.selectList')
                if(!this.selItemList.length || this.selItemList.length<2){
                    this.$toast('至少选择两个相邻的货道')
                    return
                }
                var list = _.sortBy(this.selItemList, ['layerNo', 'wayerNo'])
                var exist = _.find(list, (v, i)=>{
                    var next = list[i+1]
                    if(next){
                        if(next && v.layerNo!=next.layerNo){
                            return true
                        }
                        if(Number(v.wayerNo)+1 != Number(next.wayerNo)){
                            return true
                        }
                    }
                    return false
                })
                if(exist){
                    this.$toast('只能选择相邻的货道进行合并')
                    return 
                }
                if(!await this.checkMerge()){
                    return
                }
                ids = _.map(list, v=>{
                    return v.id
                })
            } else {
                if(!this.selItemList.length || this.selItemList.length>1 || this.selItemList[0].state!=21){
                    this.$toast('请选择一个主货道')
                    return
                }
                if(!await this.checkSplit()){
                    return
                }
                this.$loading('保存中..')
                var item = this.selItemList[0]
                ids.push(item.id)
            }
            
            var p = {
                userId: this.user.id,
                cargoIds: ids.join(','),
                isMerge
            }
            console.log(p)
            medicineAbinetApi
                .mergeAndSplitCargo(p)
                .then(res=>{
                    console.log('mergeAndSplitCargo', res)
                    if(res.status == 200){
                        this.selItemList = []
                        this.$toast('操作成功')
                        this.$refreshData()
                    } 
                })
                .catch(err=>{
                    console.error(err)
                })
        },
    },
}
</script>
@ -343,10 +600,11 @@ export default{
    .list{
        display: flex;
        flex-wrap: wrap;
        overflow-y: auto;
        align-content: flex-start;
        .item{
            margin-left: 5px;
            margin-bottom: 5px;
            height: 80px;
            .components-product-item{
                width: 90px;
            }
@ -360,7 +618,8 @@ export default{
        }
    }
    .left-list, .list{
        height: calc(100vh - 158px);
        height: calc(100vh - 210px);
        overflow-y: auto;
    }
    .color-block{
        background: #ff9526;
@ -378,6 +637,9 @@ export default{
        .list, .left-list{
            height: calc(100vh - 44px);
        }
        .bot-banner{
            display: none;
        }
    }
    .van-popup{
@ -395,6 +657,19 @@ export default{
            }
        }
    }
    .bot-banner{
        padding: 10px 5px;
        position: absolute;
        bottom: 0;
        width: 100%;
        left: 0;
        background: #fff;
        z-index: 3;
        >div{
            -webkit-box-flex: 1;
        }
    }
}
</style>
@ -402,7 +677,7 @@ export default{
.mainNobotHasTop{
    .replenishment-start-device-detail{
        .list, .left-list{
            height: calc(100vh - 206px);
            height: calc(100vh - 258px);
        }
        &.is-view{
            .list, .left-list{

+ 32 - 10
mini-pro-web/src/views/replenishment/start/quick.vue

@ -9,8 +9,8 @@
                    <div class="fs-15 ellipsis_1 c-333">{{query.drugName}}</div>
                    <div class="fs-14 c-666 kitbox">
                        <div class="box-flex-1">
                            <div>设备库存:{{query.qty}}</div>
                            <div>申领数量:{{query.quantity}}</div>
                            <div>当前库存量:{{query.qty}}</div>
                            <div v-if="outDetailId">未放置数量:{{query.quantity}}</div>
                        </div>
                        <div class="stepper kitbox">
                            <van-stepper v-model="num" integer min="0" max="99" />
@ -38,9 +38,15 @@
            </div>
            <div class="list box-flex-1 bgc-fff">
                <template v-if="curItem">
                    <div class="item" v-for="(item, k) in curItem.list" :key="k">
                        <ProductItem bussuness="quick" @onChange="onChange($event, item)" :data="item" :index="k"/>
                    </div>
                    <template v-for="(item, k) in curItem.list">
                        <div class="item" v-if="item.state!=20" :key="k">
                            <ProductItem bussuness="quick" @onChange="onChange($event, item)" :data="item" :index="k"/>
                        </div>
                    </template>
                    <!-- <div class="item" v-for="(item, k) in curItem.list" :key="k">
                        <ProductItem v-if="item.state!=20" bussuness="quick" @onChange="onChange($event, item)" :data="item" :index="k"/>
                    </div> -->
                </template>
            </div>
        </div>
@ -80,12 +86,12 @@ export default{
            outDetailList: [],
            deviceDrugList: [],
            showDeviceDrug: true,
            repAll: true
            repAll: true,
            outDetailId: this.$route.query.outDetailId || ''
        }
    },
    watch:{
        activeKey(n){
            console.log(this.selItemList, 'this.selItemList')
            this.curItem = ''
            this.$nextTick(()=>{
                this.curItem = this.list[n]
@ -199,6 +205,10 @@ export default{
                    return
                }
            }
            if(this.outDetailId && this.query.quantity<this.allNum){
                this.$toast('当前补货数量超过了未放置数量,请重新设置')
                return
            }
            this.$dialog.confirm({
                title: '补货设置',
                message: `确定进行补货?`,
@ -216,13 +226,23 @@ export default{
                    this.$loading('保存中..')
                    let p = {
                        list: JSON.stringify({list: list}),
                        userId: this.user.id 
                        userId: this.user.id,
                        outDetailId: this.outDetailId
                    }
                    console.log('params', p)
                    medicineAbinetApi
                        .batchAddInventory(p)
                        .then(res=>{
                            this.query.qty += this.allNum
                            this.query.quantity -= this.allNum
                            if(this.query.quantity<0){
                                this.query.quantity = 0
                            }
                            this.allNum = 0
                            console.log('batchAddInventory', res)
                            this.selItemList.forEach(v=>{
                                v.isActive = false
                            })
                            this.selItemList = []
                            this.$toast({
                                message: '操作成功',
@ -405,6 +425,7 @@ export default{
            }
            
            var p = {
                userId: this.user.id,
                cargoIds: ids.join(','),
                isMerge
            }
@ -452,11 +473,11 @@ export default{
    .list{
        display: flex;
        flex-wrap: wrap;
        overflow-y: auto;
        // min-height: calc(100vh - 130px);
        align-content: flex-start;
        .item{
            margin-left: 5px;
            margin-bottom: 5px;
            height: 80px;
            .components-product-item{
                width: 90px;
            }
@ -465,6 +486,7 @@ export default{
    }
    .left-list, .list{
        height: calc(100vh - 178px);
        overflow-y: auto;
    }
    .color-block{
        background: #ff9526;

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

@ -22,11 +22,9 @@
                <van-button plain @click="toAdd" block round type="info">新增药品</van-button>
            </div>
            <div class="pl8 pr15">
                <van-button  block @click="submit" round type="info">生成备药单</van-button>
                <van-button  block @click="submit" round type="info">生成药品申领单</van-button>
            </div>
        </div>
        <!-- <BotFloatButton :fix="true">下一步,生成备药单</BotFloatButton> -->
    </div>
</template>
<script>

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

@ -31,7 +31,7 @@
                    </div>
                    <div class="lh20 ptb10 kitbox">
                        <div class="box-flex-1">
                            <div>待补药品数量:{{item.daibushangpinshuliang}}</div>
                            <div>待入库药品数量:{{item.daibushangpinshuliang}}</div>
                            <div>未设药品货道:{{item.weishezhishangpinhuodao}}</div>
                            <div>设备所属:{{item.community}}</div>
                            <div >设备编号:{{item.equNum}}</div>