|
@ -1,61 +1,62 @@
|
|
|
<template>
|
|
|
<div class='cargoLaneIndex'>
|
|
|
<div class='grid-4 c-f14 c-border-b c-333 ptb15 bgc-fff'>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{deviceInfo.layer || 0}}</div>
|
|
|
<span>层数</span>
|
|
|
</div>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{deviceInfo.aisles || 0}}</div>
|
|
|
<span>货道数</span>
|
|
|
</div>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{0}}</div>
|
|
|
<span>启用</span>
|
|
|
</div>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{0}}</div>
|
|
|
<span>禁用</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class='bgc-fff p10'>
|
|
|
<div class='flex f_y_c f_x_s'>
|
|
|
<div style="width: 50%" class="pr10">
|
|
|
<van-button block type="info" class='c-border-r-5'>货道开启</van-button>
|
|
|
<van-sticky :offset-top="offsetTop">
|
|
|
<div class='grid-4 c-f14 c-border-b c-333 ptb15 bgc-fff'>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{deviceInfo.layer || 0}}</div>
|
|
|
<span>层数</span>
|
|
|
</div>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{deviceInfo.aisles || 0}}</div>
|
|
|
<span>货道数</span>
|
|
|
</div>
|
|
|
<div style="width: 50%" class="pl10">
|
|
|
<van-button block type="info" class='c-border-r-5'>货道关闭</van-button>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{openCount}}</div>
|
|
|
<span>启用</span>
|
|
|
</div>
|
|
|
<div class="c-t-center">
|
|
|
<div class='c-ff5e6c c-f16 mb5'>{{closeCount}}</div>
|
|
|
<span>禁用</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class='bgc-fff p10'>
|
|
|
<div class='flex f_y_c f_x_s'>
|
|
|
<div style="width: 50%" class="pr10">
|
|
|
<van-button @click="openAndCloseCargo(1)" block type="info" class='c-border-r-5'>货道开启</van-button>
|
|
|
</div>
|
|
|
<div style="width: 50%" class="pl10">
|
|
|
<van-button @click="openAndCloseCargo(0)" block type="info" class='c-border-r-5'>货道关闭</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <div>
|
|
|
<van-button type="info" class='mr10 c-border-r-5'>售卖</van-button>
|
|
|
<van-button type="info" class='c-border-r-5'>停售</van-button>
|
|
|
</div> -->
|
|
|
<div class='mt10'><van-button @click="findMediicinecabinetInventoryByDeviceId" type="info" style='width:100%;' class='c-border-r-5'>获取货道状态</van-button></div>
|
|
|
</div>
|
|
|
<div class='mt10'><van-button @click="findMediicinecabinetInventoryByDeviceId" type="info" style='width:100%;' class='c-border-r-5'>获取货道状态</van-button></div>
|
|
|
<div class='mt20 c-f14'>
|
|
|
<div class='flex f_y_c x-overflow'>
|
|
|
<div v-for='(citem, index) in list' :key="index">
|
|
|
<div>
|
|
|
<div class='c-t-center w50 ptb10 bgc-ccc' :class='(Math.ceil(number/6))!=index+1?"mr10":""'>{{index+1}}</div>
|
|
|
<div v-for='(item, j) in citem.list' :key="j">
|
|
|
<div @click="onSelect(item)" class='c-t-center w50 ptb10 mt10 bgc-fff c-border c-position-r'
|
|
|
:class="{'mr10': (Math.ceil(number/6))!=index+1, 'active': selectList.indexOf(item)!=-1}">
|
|
|
<div>
|
|
|
<div v-if='true' class='c-20d7ad'>正常</div>
|
|
|
<div v-else class='c-ff9526'>故障</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div v-if='true' class='c-20d7ad'>已启动</div>
|
|
|
<div v-else class='c-ff5e6c'>已停用</div>
|
|
|
</div>
|
|
|
<!-- <div>
|
|
|
<div v-if='true' class='c-20d7ad'>售卖</div>
|
|
|
<div v-else class='c-ff5e6c'>停售</div>
|
|
|
</div> -->
|
|
|
</div>
|
|
|
</van-sticky>
|
|
|
|
|
|
<div class='bgc-fff plr10 pt10'>
|
|
|
<div class=' c-f14 list'>
|
|
|
<div class="row row-header">
|
|
|
<div v-for='(item, i) in list[0].list' :key="i" class='c-t-center w50 ptb10 bgc-ccc' >{{i+1}}</div>
|
|
|
</div>
|
|
|
<div v-for='(citem, index) in list' :key="index" class="row ">
|
|
|
<div v-for='(item, j) in citem.list' :key="j">
|
|
|
<div @click="onSelect(item)" class='c-t-center w50 ptb10 mt10 bgc-fff c-border c-position-r'
|
|
|
:class="{'mr10': (Math.ceil(number/6))!=index+1, 'active': selectList.indexOf(item)!=-1}">
|
|
|
<!-- <div>
|
|
|
<div v-if='true' class='c-20d7ad'>正常</div>
|
|
|
<div v-else class='c-ff9526'>故障</div>
|
|
|
</div> -->
|
|
|
<div>
|
|
|
<div v-if='item.cargoState==1' class='c-20d7ad'>已开启</div>
|
|
|
<div v-else class='c-ff5e6c'>已关闭</div>
|
|
|
</div>
|
|
|
<!-- <div>
|
|
|
<div v-if='true' class='c-20d7ad'>售卖</div>
|
|
|
<div v-else class='c-ff5e6c'>停售</div>
|
|
|
</div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<!-- <div v-for='(item, i) in list[0].list' :key="i" class='c-t-center w50 ptb10 bgc-ccc' >{{i+1}}</div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@ -73,19 +74,23 @@ export default{
|
|
|
list: [],
|
|
|
activeKey: 0,
|
|
|
curItem: [],
|
|
|
selectList: []
|
|
|
selectList: [],
|
|
|
openCount: 0,
|
|
|
closeCount: 0
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
created() {
|
|
|
this.findMediicinecabinetInventoryByDeviceId()
|
|
|
this.findDeviceById()
|
|
|
},
|
|
|
methods:{
|
|
|
$refreshData(){
|
|
|
this.findMediicinecabinetInventoryByDeviceId()
|
|
|
$refreshData(noLoading){
|
|
|
this.findMediicinecabinetInventoryByDeviceId(noLoading)
|
|
|
},
|
|
|
findMediicinecabinetInventoryByDeviceId(){
|
|
|
this.$loading('加载中..')
|
|
|
findMediicinecabinetInventoryByDeviceId(noLoading){
|
|
|
if(!noLoading){
|
|
|
this.$loading('加载中..')
|
|
|
}
|
|
|
let p = {
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
@ -96,13 +101,19 @@ export default{
|
|
|
console.log('findMediicinecabinetInventoryByDeviceId', res)
|
|
|
this.$toast.clear()
|
|
|
if(res.detailModelList && res.detailModelList.length){
|
|
|
var openCount = 0, closeCount = 0
|
|
|
var list = _.map(res.detailModelList, v=>{
|
|
|
var key = _.keys(v)[0]
|
|
|
v[key].forEach(m => {
|
|
|
m.cargoState==1? openCount++ : closeCount++
|
|
|
});
|
|
|
return {
|
|
|
index: key,
|
|
|
list: v[key],
|
|
|
}
|
|
|
})
|
|
|
this.openCount = openCount
|
|
|
this.closeCount = closeCount
|
|
|
list = _.sortBy(list, 'index')
|
|
|
this.list = list
|
|
|
this.curItem = this.list[0]
|
|
@ -136,15 +147,76 @@ export default{
|
|
|
} else {
|
|
|
this.selectList.splice(i, 1)
|
|
|
}
|
|
|
},
|
|
|
openAndCloseCargo(cargoState){
|
|
|
if(!this.selectList || !this.selectList.length){
|
|
|
this.$toast('请选择要操作的通道')
|
|
|
return
|
|
|
}
|
|
|
this.$dialog.confirm({
|
|
|
title: '',
|
|
|
message: `确定${cargoState==1? '开启' : '关闭'}通道`,
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.$nextTick(()=>{
|
|
|
var ids = _.map(this.selectList, 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.selectList = []
|
|
|
this.$toast({
|
|
|
message: '操作成功',
|
|
|
forbidClick: true,
|
|
|
onClose: ()=>{
|
|
|
}
|
|
|
})
|
|
|
this.$refreshData(true)
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang='scss'>
|
|
|
.cargoLaneIndex{
|
|
|
.list{
|
|
|
overflow-y: auto;
|
|
|
padding-bottom: 10px;
|
|
|
.row{
|
|
|
display: -webkit-box;
|
|
|
>div{
|
|
|
width: 50px;
|
|
|
margin-right: 5px;
|
|
|
&:last-child{
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.grid-4{
|
|
|
display: grid;
|
|
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
|
// position: fixed;
|
|
|
// top: 0;
|
|
|
// left: 0;
|
|
|
// width: 100%;
|
|
|
}
|
|
|
.x-overflow{
|
|
|
overflow-x: auto;
|