|
@ -0,0 +1,761 @@
|
|
|
<template>
|
|
|
<div class='replenishment-start-device-detail fs-14' :class="{'is-view': isView}">
|
|
|
<!-- <van-sticky v-if="!isView" :offset-top="offsetTop"> -->
|
|
|
<div v-if="!isView" class="bgc-17b3ec c-fff">
|
|
|
<div class="pt10 plr15 ellipsis_1">当前货柜:{{deviceInfo.device.equName}}</div>
|
|
|
<van-row>
|
|
|
<van-col span="8">
|
|
|
<div class="tc pt10 pb10">
|
|
|
<div class="fs-20">{{deviceInfo.deviceCapacity||0}}</div>
|
|
|
<div class="fs-12 pt5">设备容量</div>
|
|
|
</div>
|
|
|
</van-col>
|
|
|
<van-col span="8">
|
|
|
<div class="tc pt10 pb10">
|
|
|
<div class="fs-20">
|
|
|
<span>{{deviceInfo.inStock||0}}</span>
|
|
|
<span class="fs-12">/{{((deviceInfo.inStockRate||0) * 100).toFixed(2)}}%</span>
|
|
|
</div>
|
|
|
<div class="fs-12 pt5">在架库存</div>
|
|
|
</div>
|
|
|
</van-col>
|
|
|
<van-col span="8">
|
|
|
<div class="tc pt10 pb10">
|
|
|
<div class="fs-20">{{deviceInfo.outOfStock||0}}</div>
|
|
|
<div class="fs-12 pt5">缺药库存</div>
|
|
|
</div>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
<div class="kitbox fs-12 plr10 pb5">
|
|
|
<div class="box-flex-1"> 共:{{deviceInfo.device.layer}}层</div>
|
|
|
<div class="box-flex-1 ml5">总货道:{{deviceInfo.totalCargo}}</div>
|
|
|
<div class="box-flex-1 ml5">故障:{{faultCount || 0}}</div>
|
|
|
<div class="box-flex-1 ml5">关闭:{{deviceInfo.closedCargo || 0}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- </van-sticky> -->
|
|
|
<div class="fs-14 pl15 ptb10 bgc-fff kitbox">
|
|
|
<div class="box-flex-1 lh24">
|
|
|
<span>从上往下数</span>
|
|
|
<div class="color-block"></div>
|
|
|
<span class="ml5 fs-12">已关闭</span>
|
|
|
<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&&$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>
|
|
|
</div>
|
|
|
<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>
|
|
|
<div class=" list-panel">
|
|
|
<div class="kitbox">
|
|
|
<div class="left-list">
|
|
|
<van-sidebar v-model="activeKey">
|
|
|
<van-sidebar-item v-for="(item, i) in list" :key="i" :title="i==0? '药品库' : (i)+'层'" />
|
|
|
</van-sidebar>
|
|
|
</div>
|
|
|
<div class="list box-flex-1 bgc-fff">
|
|
|
<div v-if="activeKey===0" class="plr10">
|
|
|
<div class="search-panel">
|
|
|
<form action="/">
|
|
|
<van-search
|
|
|
v-model="searchText"
|
|
|
placeholder="搜索"
|
|
|
show-action
|
|
|
@search="onSearch"
|
|
|
@cancel="onSearch"
|
|
|
shape="round">
|
|
|
</van-search>
|
|
|
</form>
|
|
|
</div>
|
|
|
<template v-for="(item, k) in curItem.list" >
|
|
|
<div v-if="item.isShow" @click="toQuick(item)" class="drug-item kitbox" :key="k">
|
|
|
<div class="sort" v-if="!curOrder" ><div>{{k+1}}</div></div>
|
|
|
<div class="photo">
|
|
|
<img src="@/assets/images/drug_default.png" alt="">
|
|
|
</div>
|
|
|
<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.drugCode}}</div>
|
|
|
<div>规格:{{item.specif}}</div>
|
|
|
<div>当前库存量:{{item.qty||item.inventoryNum||Number(item.total||0)}}</div>
|
|
|
<div v-if="curOrder">未放置数量:{{accessLeftNum(item)}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
<template v-else>
|
|
|
<template v-for="(item, k) in curItem.list">
|
|
|
<div class="item" v-if="item.state!=20" :key="k">
|
|
|
<ProductItem :old="true" :bussuness="bussuness" @onChange="onChange($event, item)" :data="item" :index="k" :isView="isView"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
</template>
|
|
|
</div>
|
|
|
</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" type="primary" round>货道管理</van-button></div>
|
|
|
<template v-else>
|
|
|
<div class="box-flex-1 plr5"><van-button @click="openAndCloseCargo" block plain color="#17b3ec" type="primary" round>关闭/开启货道</van-button></div>
|
|
|
<div class="box-flex-1 plr5"><van-button @click="mergeAndSplitCargo" block plain color="#17b3ec" type="primary" round>合并/拆分货道</van-button></div>
|
|
|
<div class="plr5"><van-button @click="changeManage" class="w50" block plain color="red" round type="primary" >取消</van-button></div>
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<van-popup v-model="showOrderPicker">
|
|
|
<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.docTime}}</div>
|
|
|
<div class="break-all">申领品类:{{item.replenishCate}}</div>
|
|
|
<div class="break-all">申请数量:{{item.replenishInventory}}</div>
|
|
|
</div>
|
|
|
<div class="pl15 box-v-middle">
|
|
|
<van-button @click="updateStockUpStatus(item, 1)" size="mini" type="info">导入</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
|
import ProductItem from '@/components/ProductItem'
|
|
|
export default{
|
|
|
name: 'replenishmentStartOldDeviceDetail',
|
|
|
components: {
|
|
|
ProductItem
|
|
|
},
|
|
|
props: ['isView'],
|
|
|
data(){
|
|
|
return {
|
|
|
deviceInfo: {device: ''},
|
|
|
deviceId: this.$route.query.deviceId,
|
|
|
list: [{
|
|
|
index: -1,
|
|
|
list: []
|
|
|
}],
|
|
|
activeKey: 0,
|
|
|
curItem: [],
|
|
|
openCount: 0,
|
|
|
closeCount: 0,
|
|
|
faultCount: 0,
|
|
|
outDetailList: [],
|
|
|
deviceDrugList: [],
|
|
|
showDeviceDrug: true,
|
|
|
curOrder: '',
|
|
|
orderList: [],
|
|
|
showOrderPicker: false,
|
|
|
|
|
|
selItemList: [],
|
|
|
isManage: false,
|
|
|
bussuness: '',
|
|
|
searchText: ''
|
|
|
}
|
|
|
},
|
|
|
watch:{
|
|
|
activeKey(n){
|
|
|
this.curItem = this.list[n]
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.initPage()
|
|
|
this.findDeviceById()
|
|
|
},
|
|
|
methods:{
|
|
|
$refreshData(){
|
|
|
this.findMediicinecabinetInventoryByDeviceId()
|
|
|
this.getDrugInventoryCount()
|
|
|
if(this.curOrder){
|
|
|
this.queryUpListByDeviceIdAndStatus()
|
|
|
}
|
|
|
},
|
|
|
async initPage(){
|
|
|
this.$loading('加载中..')
|
|
|
await this.queryUpListByDeviceIdAndStatus()
|
|
|
await this.queryUpListByStatus()
|
|
|
await this.getDrugInventoryCount()
|
|
|
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.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=>{
|
|
|
v.isShow = true
|
|
|
return this.accessLeftNum(v)>0
|
|
|
})
|
|
|
} else {
|
|
|
this.curOrder = ''
|
|
|
this.list[0].list = this.deviceDrugList
|
|
|
}
|
|
|
this.queryUpListByStatus()
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
async queryUpListByStatus(){
|
|
|
//查询已领取 未导入的备药单
|
|
|
let p = {
|
|
|
replenishEr: this.user.id,
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
|
console.log('queryUpListByStatus', p)
|
|
|
await medicineAbinetApi
|
|
|
.queryUpListByStatus(p)
|
|
|
.then(res=>{
|
|
|
console.log('queryUpListByStatus', res)
|
|
|
this.orderList = res.detailModelList
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
async queryUpListByDeviceIdAndStatus(){
|
|
|
//查询是否存在未完成备药单
|
|
|
let p = {
|
|
|
replenishEr: this.user.id,
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
|
console.log('queryUpListByDeviceIdAndStatus', p)
|
|
|
await medicineAbinetApi
|
|
|
.queryUpListByDeviceIdAndStatus(p)
|
|
|
.then(res=>{
|
|
|
console.log('queryUpListByDeviceIdAndStatus', res)
|
|
|
if(res && res.detailModelList && res.detailModelList.length){
|
|
|
var mediicinestockout = res.detailModelList[0].mediicinestockout
|
|
|
mediicinestockout.outId = res.detailModelList[0].id
|
|
|
this.curOrder = mediicinestockout
|
|
|
this.list[0].list = _.filter(this.curOrder.mediicinestockoutdetails, v=>{
|
|
|
v.isShow = true
|
|
|
return this.accessLeftNum(v)>0
|
|
|
})
|
|
|
console.log(this.list[0])
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
async getDrugInventoryCount(){
|
|
|
let p = {
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
|
console.log('getDrugInventoryCount', p)
|
|
|
await medicineAbinetApi
|
|
|
.getDrugInventoryCount(p)
|
|
|
.then(res=>{
|
|
|
console.log('getDrugInventoryCount', res)
|
|
|
_.each(res.detailModelList, v=>{
|
|
|
v.isShow = true
|
|
|
})
|
|
|
if(!this.curOrder){
|
|
|
this.list[0].list = res.detailModelList
|
|
|
}
|
|
|
this.deviceDrugList = res.detailModelList
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
async getOutDetailByUserIdAndDeviceId(){
|
|
|
let p = {
|
|
|
deviceId: this.deviceId,
|
|
|
userId: this.user.id
|
|
|
}
|
|
|
console.log('getOutDetailByUserIdAndDeviceId', p)
|
|
|
await medicineAbinetApi
|
|
|
.getOutDetailByUserIdAndDeviceId(p)
|
|
|
.then(res=>{
|
|
|
console.log('getOutDetailByUserIdAndDeviceId', res)
|
|
|
res.detailModelList.forEach(v=>{
|
|
|
var exist = _.find(this.deviceDrugList, m=>{
|
|
|
return v.drugCode == m.drugCode
|
|
|
})
|
|
|
v.qty = (exist&&exist.qty) || 0
|
|
|
v.isShow = true
|
|
|
})
|
|
|
this.outDetailList = res.detailModelList
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
findMediicinecabinetInventoryByDeviceId(){
|
|
|
this.list.splice(1, this.list.length)
|
|
|
let p = {
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
|
console.log('params', p)
|
|
|
medicineAbinetApi
|
|
|
.findMediicinecabinetInventoryByDeviceId(p)
|
|
|
.then(res=>{
|
|
|
console.log('findMediicinecabinetInventoryByDeviceId', res)
|
|
|
this.$toast.clear()
|
|
|
if(res.detailModelList && res.detailModelList.length){
|
|
|
var openCount = 0, closeCount = 0, faultCount = 0
|
|
|
var list = _.map(res.detailModelList, v=>{
|
|
|
var key = _.keys(v)[0]
|
|
|
v[key].forEach(m => {
|
|
|
m.layerNo = Number(m.layerNo)
|
|
|
m.wayerNo = Number(m.wayerNo)
|
|
|
m.isActive = false
|
|
|
m.cargoState==1? openCount++ : closeCount++
|
|
|
if(m.faultState==1){
|
|
|
faultCount++
|
|
|
}
|
|
|
});
|
|
|
return {
|
|
|
index: key,
|
|
|
list: v[key],
|
|
|
}
|
|
|
})
|
|
|
this.openCount = openCount
|
|
|
this.closeCount = closeCount
|
|
|
this.faultCount = faultCount
|
|
|
list = _.sortBy(list, 'index')
|
|
|
this.list = this.list.concat(list)
|
|
|
this.curItem = this.list[this.activeKey]
|
|
|
console.log(list, this.curItem)
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
findDeviceById(){
|
|
|
let p = {
|
|
|
deviceId: this.deviceId
|
|
|
}
|
|
|
console.log('params', p)
|
|
|
medicineAbinetApi
|
|
|
.findDeviceById(p)
|
|
|
.then(res=>{
|
|
|
console.log('findDeviceById', res)
|
|
|
this.$toast.clear()
|
|
|
this.deviceInfo = res.obj
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
changeShowDrug(){
|
|
|
this.showDeviceDrug = !this.showDeviceDrug
|
|
|
this.list[0].list = this.showDeviceDrug? this.deviceDrugList : this.outDetailList
|
|
|
},
|
|
|
toQuick(item){
|
|
|
if(this.isView){
|
|
|
return
|
|
|
}
|
|
|
this.gotoUrl('/replenishment/oldStart/quick', {
|
|
|
deviceId: this.deviceId,
|
|
|
drugName: item.drugName,
|
|
|
drugCode: item.drugCode,
|
|
|
drugId: item.drugId,
|
|
|
qty: item.qty||item.inventoryNum||Number(item.total||0),
|
|
|
quantity: this.accessLeftNum(item),
|
|
|
outDetailId: item.id,
|
|
|
specif: encodeURIComponent(item.specif)
|
|
|
})
|
|
|
},
|
|
|
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(()=>{
|
|
|
this.$loading('保存中..')
|
|
|
var ids = []
|
|
|
this.selItemList.forEach(v=>{
|
|
|
if(v.state == 21){
|
|
|
var cargoIds = v.merge.split(',')
|
|
|
cargoIds.forEach(m => {
|
|
|
ids.push(this.list[Number(v.layerNo)].list[Number(m)-1].id)
|
|
|
})
|
|
|
} else {
|
|
|
ids.push(v.id)
|
|
|
}
|
|
|
})
|
|
|
console.log('ids', ids)
|
|
|
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.findDeviceById()
|
|
|
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){
|
|
|
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
|
|
|
})
|
|
|
console.log(this.selItemList, 'this.selectList')
|
|
|
|
|
|
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.findDeviceById()
|
|
|
this.$refreshData()
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
onSearch(){
|
|
|
_.each(this.list[0].list, v=>{
|
|
|
v.isShow = v.drugName.indexOf(this.searchText)!=-1
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
<style lang='scss' scoped>
|
|
|
.replenishment-start-device-detail{
|
|
|
display: -webkit-box;
|
|
|
-webkit-box-orient: vertical;
|
|
|
height: 100vh;
|
|
|
.list-panel{
|
|
|
-webkit-box-flex: 1;
|
|
|
position: relative;
|
|
|
>.kitbox{
|
|
|
height: 100%;
|
|
|
width: 100%;
|
|
|
position: absolute;
|
|
|
}
|
|
|
}
|
|
|
.list{
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
align-content: flex-start;
|
|
|
.item{
|
|
|
margin-left: 5px;
|
|
|
margin-bottom: 5px;
|
|
|
height: 80px;
|
|
|
.components-product-item{
|
|
|
width: 90px;
|
|
|
}
|
|
|
}
|
|
|
.drug-item{
|
|
|
margin-top: 10px;
|
|
|
img{
|
|
|
width: 60px;
|
|
|
border-radius: 5px;
|
|
|
}
|
|
|
.sort{
|
|
|
display: -webkit-box;
|
|
|
padding-right: 10px;
|
|
|
padding-top: 20px;
|
|
|
>div{
|
|
|
font-size: 14px;
|
|
|
line-height: 20px;
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
background: #17b3ec;
|
|
|
border-radius: 50%;
|
|
|
color: #fff;
|
|
|
text-align: center
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.left-list, .list{
|
|
|
height: 100%;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
|
.color-block{
|
|
|
background: #ff9526;
|
|
|
width: 10px;
|
|
|
height: 10px;
|
|
|
display: inline-block;
|
|
|
margin-left: 20px;
|
|
|
border-radius: 2px;
|
|
|
&.red{
|
|
|
background: #ff5e6c;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.is-view{
|
|
|
.bot-banner{
|
|
|
display: none;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.van-popup{
|
|
|
border-radius: 10px;
|
|
|
}
|
|
|
.order-list{
|
|
|
max-height: 50vh;
|
|
|
overflow-y: auto;
|
|
|
padding: 0 15px;
|
|
|
width: 80vw;
|
|
|
.order-item{
|
|
|
border-bottom: 1px solid #e1e1e1;
|
|
|
&:last-child{
|
|
|
border-bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.bot-banner{
|
|
|
padding: 10px 5px;
|
|
|
position: relative;
|
|
|
bottom: 0;
|
|
|
width: 100%;
|
|
|
left: 0;
|
|
|
background: #fff;
|
|
|
z-index: 3;
|
|
|
>div{
|
|
|
-webkit-box-flex: 1;
|
|
|
.van-button{
|
|
|
padding: 0;
|
|
|
font-size: 13px;
|
|
|
height: 36px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|
|
|
.mainNobotHasTop{
|
|
|
.replenishment-start-device-detail{
|
|
|
height: calc(100vh - 46px);
|
|
|
}
|
|
|
}
|
|
|
@supports(bottom: env(safe-area-inset-bottom)){
|
|
|
.replenishment-start-device-detail{
|
|
|
.bot-banner{
|
|
|
&::after{
|
|
|
content: "";
|
|
|
height: env(safe-area-inset-bottom);
|
|
|
width: 100%;
|
|
|
display: block;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|