|
@ -1,11 +1,15 @@
|
|
<template>
|
|
<template>
|
|
<div class='replenishment-stock-up-detail fs-14'>
|
|
<div class='replenishment-stock-up-detail fs-14'>
|
|
<div class="list bgc-fff ">
|
|
|
|
|
|
<div class="list bgc-fff mb10 ">
|
|
<van-sticky :offset-top="offsetTop">
|
|
<van-sticky :offset-top="offsetTop">
|
|
|
|
<van-field
|
|
|
|
v-model="replenisherName"
|
|
|
|
@click="showPicker=true"
|
|
|
|
label="设备管理员" placeholder="请选择设备管理员" readonly is-link input-align="right"/>
|
|
<div class="row kitbox bgc-fff" >
|
|
<div class="row kitbox bgc-fff" >
|
|
<div class="box-flex-1 pl10">药品名称</div>
|
|
<div class="box-flex-1 pl10">药品名称</div>
|
|
<div class="tc">现料数</div>
|
|
|
|
<div class="tc">缺料数</div>
|
|
|
|
|
|
<div class="tc">现药数</div>
|
|
|
|
<div class="tc">缺药数</div>
|
|
<div class="tc">操作</div>
|
|
<div class="tc">操作</div>
|
|
</div>
|
|
</div>
|
|
</van-sticky>
|
|
</van-sticky>
|
|
@ -22,9 +26,18 @@
|
|
<van-button plain @click="toAdd" block round type="info">新增药品</van-button>
|
|
<van-button plain @click="toAdd" block round type="info">新增药品</van-button>
|
|
</div>
|
|
</div>
|
|
<div class="pl8 pr15">
|
|
<div class="pl8 pr15">
|
|
<van-button block @click="submit" round type="info">生成药品申领单</van-button>
|
|
|
|
|
|
<van-button block @click="submit" round type="info">{{createOutAuth? '生成出库并领取' : '生成药品申领单'}}</van-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<van-popup v-model="showPicker" round position="bottom">
|
|
|
|
<van-picker
|
|
|
|
show-toolbar
|
|
|
|
:columns="replenishErList"
|
|
|
|
@cancel="showPicker = false"
|
|
|
|
@confirm="onConfirm"
|
|
|
|
/>
|
|
|
|
</van-popup>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
@ -35,10 +48,27 @@ export default{
|
|
return {
|
|
return {
|
|
deviceId: this.$route.query.deviceId,
|
|
deviceId: this.$route.query.deviceId,
|
|
list: [],
|
|
list: [],
|
|
oriData: []
|
|
|
|
|
|
oriData: [],
|
|
|
|
replenisherName: "",
|
|
|
|
replenisherId: "",
|
|
|
|
replenishErList: [],
|
|
|
|
showPicker: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
computed:{
|
|
|
|
createOutAuth(){
|
|
|
|
return this.$hasAuth('replenishmentMgnt', 'pickingList','createOut')
|
|
|
|
},
|
|
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
if(this.createOutAuth){
|
|
|
|
this.getUserListByDeviceId()
|
|
|
|
if(this.user.curRoleCode == 'replenisher'){
|
|
|
|
this.replenisherName = this.user.name
|
|
|
|
this.replenisherId = this.user.id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
this.$EventBus.$on('drug-sel', (item)=>{
|
|
this.$EventBus.$on('drug-sel', (item)=>{
|
|
var exist = _.find(this.list, v=>{
|
|
var exist = _.find(this.list, v=>{
|
|
return v.drugCode == item.drugCode
|
|
return v.drugCode == item.drugCode
|
|
@ -76,11 +106,45 @@ export default{
|
|
console.error(err)
|
|
console.error(err)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
baseOutCreateUp(item){
|
|
|
|
return new Promise((resolve, reject)=>{
|
|
|
|
var drugs = _.map(item.list, v=>{
|
|
|
|
return {
|
|
|
|
"drugId": v.drugId, //药品id
|
|
|
|
"qty": v.outofstock
|
|
|
|
}
|
|
|
|
})
|
|
|
|
var p = {
|
|
|
|
upId: item.info.id,
|
|
|
|
remark: "",
|
|
|
|
replenishEr: this.replenisherId,
|
|
|
|
deviceId: this.deviceId,
|
|
|
|
drugs,
|
|
|
|
userId: this.user.id
|
|
|
|
}
|
|
|
|
console.log('baseOutCreateUp', JSON.stringify(p))
|
|
|
|
medicineAbinetApi
|
|
|
|
.baseOutCreateUp({
|
|
|
|
jsonData: JSON.stringify({obj:p}),
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
resolve()
|
|
|
|
})
|
|
|
|
.catch(err=>{
|
|
|
|
console.error(err)
|
|
|
|
reject()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
submit(){
|
|
submit(){
|
|
if(!this.list.length){
|
|
if(!this.list.length){
|
|
this.$toast('请选择药品')
|
|
this.$toast('请选择药品')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
if(this.createOutAuth && !this.replenisherId){
|
|
|
|
this.$toast('请选择设备管理员')
|
|
|
|
return
|
|
|
|
}
|
|
this.$loading('保存中..')
|
|
this.$loading('保存中..')
|
|
var p = {
|
|
var p = {
|
|
list: [{
|
|
list: [{
|
|
@ -100,24 +164,62 @@ export default{
|
|
jsonData: JSON.stringify(p),
|
|
jsonData: JSON.stringify(p),
|
|
})
|
|
})
|
|
.then(res => {
|
|
.then(res => {
|
|
|
|
console.log('baseUpCreateUp', res)
|
|
if(res.status == 200){
|
|
if(res.status == 200){
|
|
// this.setBackRefresh()
|
|
// this.setBackRefresh()
|
|
this.$emitRefreshPage('replenishmentStockUpDeviceList')
|
|
|
|
this.$toast('生成成功')
|
|
|
|
|
|
if(this.createOutAuth){
|
|
|
|
return this.baseOutCreateUp(JSON.parse(res.message))
|
|
|
|
} else {
|
|
|
|
return Promise.resolve()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(res=>{
|
|
|
|
// this.$emitRefreshPage('replenishmentStockUpDeviceList')
|
|
|
|
this.$toast('生成成功')
|
|
|
|
if(this.createOutAuth){
|
|
|
|
history.go(-2)
|
|
|
|
} else{
|
|
history.back()
|
|
history.back()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch(err=>{
|
|
.catch(err=>{
|
|
console.error(err)
|
|
console.error(err)
|
|
})
|
|
})
|
|
|
|
|
|
},
|
|
},
|
|
del(item, k){
|
|
del(item, k){
|
|
this.list.splice(k, 1)
|
|
this.list.splice(k, 1)
|
|
},
|
|
},
|
|
toAdd(){
|
|
toAdd(){
|
|
this.gotoUrl('/drugList', {deviceId: this.deviceId, bussiness: 6})
|
|
this.gotoUrl('/drugList', {deviceId: this.deviceId, bussiness: 6})
|
|
}
|
|
|
|
|
|
},
|
|
|
|
onConfirm(value) {
|
|
|
|
this.replenisherName = value.text;
|
|
|
|
this.replenisherId = value.id;
|
|
|
|
this.showPicker = false;
|
|
|
|
},
|
|
|
|
getUserListByDeviceId(){
|
|
|
|
this.$loading('加载中..')
|
|
|
|
if(!this.deviceId){
|
|
|
|
return
|
|
|
|
}
|
|
|
|
medicineAbinetApi
|
|
|
|
.getUserListByDeviceId({
|
|
|
|
deviceId: this.deviceId
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
this.$toast.clear()
|
|
|
|
console.log('getUserListByDeviceId', res)
|
|
|
|
this.replenishErList = _.map(res.detailModelList || [], v=>{
|
|
|
|
return {
|
|
|
|
text: v.name,
|
|
|
|
id: v.id
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}).catch(err=>{
|
|
|
|
console.error(err)
|
|
|
|
})
|
|
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@ -125,6 +227,9 @@ export default{
|
|
.replenishment-stock-up-detail{
|
|
.replenishment-stock-up-detail{
|
|
padding-bottom: 100px;
|
|
padding-bottom: 100px;
|
|
.list{
|
|
.list{
|
|
|
|
.van-cell{
|
|
|
|
padding-left: 10px;
|
|
|
|
}
|
|
.row{
|
|
.row{
|
|
padding: 10px 0;
|
|
padding: 10px 0;
|
|
border-bottom: 1px solid #e1e1e1;
|
|
border-bottom: 1px solid #e1e1e1;
|