|
@ -0,0 +1,218 @@
|
|
|
<template>
|
|
|
<div class='replenishment-stock-up-detail fs-14'>
|
|
|
<div class="list bgc-fff mb10 ">
|
|
|
<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="box-flex-1 pl10">药品名称</div>
|
|
|
<div class="tc">缺药数</div>
|
|
|
<div class="tc">操作</div>
|
|
|
</div>
|
|
|
</van-sticky>
|
|
|
<div v-for="(item, i) in list" :key="i" class="row kitbox">
|
|
|
<div class="box-flex-1 pl10 ellipsis">{{item.drugName}}</div>
|
|
|
<div class="tc"><van-stepper v-model="item.outofstock" min="1" max="99"/></div>
|
|
|
<div class="tc c-red"><span @click="del(item, i)">删除</span></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="btns">
|
|
|
<div class="pl15 pr8">
|
|
|
<van-button plain @click="toAdd" block round type="info">选择药品</van-button>
|
|
|
</div>
|
|
|
<div class="pl8 pr15">
|
|
|
<van-button block @click="submit" round type="info">{{createOutAuth? '生成出库并领取' : '生成药品申领单'}}</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<van-popup v-model="showPicker" round position="bottom">
|
|
|
<van-picker
|
|
|
show-toolbar
|
|
|
:columns="replenishErList"
|
|
|
@cancel="showPicker = false"
|
|
|
@confirm="onConfirm"
|
|
|
/>
|
|
|
</van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
|
export default{
|
|
|
name: 'replenishmentStockUpCreateOut',
|
|
|
data(){
|
|
|
return {
|
|
|
upId: this.$route.query.upId,
|
|
|
deviceId: this.$route.query.deviceId,
|
|
|
list: [],
|
|
|
oriData: [],
|
|
|
replenisherName: "",
|
|
|
replenisherId: "",
|
|
|
replenishErList: [],
|
|
|
showPicker: false,
|
|
|
delList: []
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
|
createOutAuth(){
|
|
|
return this.$hasAuth('replenishmentMgnt', 'pickingList','createOut')
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
this.getUpDetailById()
|
|
|
this.getUserListByDeviceId()
|
|
|
this.$EventBus.$on('drug-sel', (item)=>{
|
|
|
var index = _.findIndex(this.delList, v=>{
|
|
|
return v.drugCode == item.drugCode
|
|
|
})
|
|
|
this.delList.splice(index, 1)
|
|
|
this.list.push(item)
|
|
|
})
|
|
|
},
|
|
|
methods:{
|
|
|
getUpDetailById(){
|
|
|
this.$loading('加载中..')
|
|
|
let p = {
|
|
|
idUp: this.upId
|
|
|
}
|
|
|
console.log('params', p)
|
|
|
medicineAbinetApi
|
|
|
.getUpDetailById(p)
|
|
|
.then(res=>{
|
|
|
this.$toast.clear()
|
|
|
console.log('getUpDetailById', res)
|
|
|
// this.model = res.obj.info || {}
|
|
|
res.obj.list.forEach(v => {
|
|
|
if(v.price){
|
|
|
v.totalPrice = (Number(v.price) * Number(v.outofstock)).toFixed(2)
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.list = res.obj.list
|
|
|
if(res.obj.info.replenishEr){
|
|
|
this.replenisherId = res.obj.info.replenishEr||""
|
|
|
this.replenisherName = res.obj.info.replenishErName||""
|
|
|
} else if(this.user.curRoleCode == 'replenisher'){
|
|
|
this.replenisherName = this.user.name
|
|
|
this.replenisherId = this.user.id
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
submit(){
|
|
|
if(!this.list.length){
|
|
|
this.$toast('请选择药品')
|
|
|
return
|
|
|
}
|
|
|
if(this.createOutAuth && !this.replenisherId){
|
|
|
this.$toast('请选择设备管理员')
|
|
|
return
|
|
|
}
|
|
|
this.$loading('保存中..')
|
|
|
var drugs = _.map(this.list, v=>{
|
|
|
return {
|
|
|
"drugId": v.drugId, //药品id
|
|
|
"qty": v.outofstock
|
|
|
}
|
|
|
})
|
|
|
var p = {
|
|
|
upId: this.upId,
|
|
|
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 => {
|
|
|
this.$toast('生成成功')
|
|
|
this.$emitRefreshPage("replenishmentPickingList")
|
|
|
history.back()
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
del(item, k){
|
|
|
this.delList.push(item)
|
|
|
this.list.splice(k, 1)
|
|
|
},
|
|
|
toAdd(){
|
|
|
this.$store
|
|
|
.dispatch("SetDrugList", this.delList)
|
|
|
.then(() => {
|
|
|
this.gotoUrl('/replenishment/stockUp/drugList', {})
|
|
|
});
|
|
|
},
|
|
|
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>
|
|
|
<style lang='scss' scoped>
|
|
|
.replenishment-stock-up-detail{
|
|
|
padding-bottom: 100px;
|
|
|
.list{
|
|
|
.van-cell{
|
|
|
padding-left: 10px;
|
|
|
}
|
|
|
.row{
|
|
|
padding: 10px 0;
|
|
|
border-bottom: 1px solid #e1e1e1;
|
|
|
line-height: 28px;
|
|
|
>div:nth-child(3){
|
|
|
width: 60px;
|
|
|
}
|
|
|
>div:nth-child(2){
|
|
|
width: 120px;
|
|
|
}
|
|
|
&:last-child{
|
|
|
border-bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.btns{
|
|
|
position: fixed;
|
|
|
width: 100%;
|
|
|
left: 0;
|
|
|
bottom: 20px;
|
|
|
display: -webkit-box;
|
|
|
>div{
|
|
|
width: 50%;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|