lincl 3 years ago
parent
commit
391922194e

+ 1 - 0
mini-pro-web/src/router/index.js

@ -169,6 +169,7 @@ router.beforeEach(async (to, from, next) => {
                            })
                        })
                }).catch(err=>{
                    routerLoaded = true
                    console.error(err)
                })
            } else {

+ 32 - 0
mini-pro-web/src/router/replenishment.js

@ -65,6 +65,16 @@ const routeMap = [
                },
				component: () => import("@/views/replenishment/picking/list.vue")
            },
            {
                path: "/replenishment/picking/outList",
                name: "replenishmentOutList",
                meta: {
                    title: "出库单列表",
                    // hasTop: false,
                    hasBot: false
                },
				component: () => import("@/views/replenishment/picking/outList.vue")
            },
            {
                path: "/replenishment/picking/detail",
                name: "replenishmentPickingDetail",
@ -95,6 +105,28 @@ const routeMap = [
                },
				component: () => import("@/views/replenishment/stockUp/detail.vue")
            },
            {
                path: "/replenishment/stockUp/createOut",
                name: "replenishmentStockUpCreateOut",
                meta: {
                    title: "生成出药单",
                    // hasTop: false,
                    hasBot: false
                },
				component: () => import("@/views/replenishment/stockUp/createOut.vue")
            },
            {
                path: "/replenishment/stockUp/drugList",
                name: "ReplenishmentDrugSel",
                meta: {
                    title: "选择药品",
                    // hasTop: false,
                    hasBot: false
                },
				component: () => import("@/views/replenishment/stockUp/drugList.vue")
            },
            
            {
                path: "/replenishment/start/deviceList",

+ 8 - 1
mini-pro-web/src/store/modules/app.js

@ -9,7 +9,8 @@ const app = {
        pageTitle: "智能药房",
		platform: 'web',  //网页web   
		noTop: false,
		authMenu: []
		authMenu: [],
		drugList: []
	},
	mutations: {
		SET_NO_TOP: (state, bool) => {
@ -23,6 +24,9 @@ const app = {
        },
		SET_AUTH_MENU: (state, val) => {
            state.authMenu = val
        },
		SET_DRUG_LIST: (state, val) => {
            state.drugList = val
        }
	},
	actions: {
@ -37,6 +41,9 @@ const app = {
		},
		SetAuthMenu({ commit, state }, val) {
			commit('SET_AUTH_MENU', val)
		},
		SetDrugList({ commit, state }, val) {
			commit('SET_DRUG_LIST', val)
		}
	}
};

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

@ -38,7 +38,7 @@
                    </div>
                    <div>药品概况</div>
                </div>
                <div v-if="hasAuth('stockUp')" class='c-t-center' @click='gotoUrl("/replenishment/stockUp/detail", {deviceId: id})'>
                <div v-if="hasAuth('stockUp') || createOutAuth" class='c-t-center' @click='toApplyDrug() '>
                    <div>
                        <van-image class='ability' :src='require("@/assets/images/beihuo.png")'/>
                    </div>
@ -169,6 +169,9 @@ export default {
        };
    },
    computed:{
        createOutAuth(){
            return this.$hasAuth('replenishmentMgnt', 'pickingList','createOut')
        },
        cargoSettingAuth(){
            return this.hasAuth('cargoSetting')
        },
@ -215,6 +218,18 @@ export default {
            return _.find(this.menuAuth, v=>{
                return v.url == name
            })
        },
        toApplyDrug(){
            if(this.createOutAuth){
                this.gotoUrl("/replenishment/picking/list", {
                    deviceId: this.id,
                    status: 2
                })
            } else {
                this.gotoUrl("/replenishment/stockUp/detail", {
                    deviceId: this.id,
                })
            }
        }
    },
};

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

@ -652,6 +652,7 @@ export default {
				medicineAbinetApi
					.updateOrderOutStatus(p)
					.then(res=>{
						console.log('updateOrderOutStatus', res)
						if(res.status == 200){
							resolve()
							return

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

@ -7,7 +7,7 @@
            </div>
            <div class="row kitbox" v-for="(item, i) in drugList" :key="i">
                <div class="box-flex-1 pl10 ellipsis">{{item.drugName}}</div>
                <div class="tc">{{item.claim}}</div>
                <div class="tc">{{item.claim || item.quantity}}</div>
            </div>
        </div>
    </div>

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

@ -1,6 +1,6 @@
<template>
    <div class='replenishment-picking-list'>
        <van-sticky :offset-top="offsetTop">
    <div class='replenishment-picking-list' :class="{'show-one': status, hasBotBanner: status==2}">
        <van-sticky :offset-top="offsetTop" v-if="!status">
            <van-tabs v-model="active" @change="onChange">
                <!-- <van-tab title="全部"></van-tab> -->
                <van-tab title="备药中"></van-tab>
@ -36,10 +36,10 @@
                                <div>设备管理员</div>
                                <div>{{item.replenishErName}}</div>
                            </div>
                            <div class="row">
                            <!-- <div class="row">
                                <div>待入库设备</div>
                                <div>{{item.replenishEquName}}</div>
                            </div>
                            </div> -->
                            <div class="row">
                                <div>待入库品类</div>
                                <div>{{item.replenishCate}}</div>
@ -60,24 +60,40 @@
                </div>
            </div>
		</CustomList>
        <div class="bot-banner" v-if="status==2">
            <div class="kitbox">
                <div class="box-flex-1 plr5"><van-button @click="gotoUrl('/replenishment/picking/outList', {deviceId: deviceId, status: 1})" block plain color="#17b3ec" size="small" type="primary" round>出库单列表</van-button></div>
                <div class="box-flex-1 plr5"><van-button @click="gotoUrl('/replenishment/stockUp/detail', {deviceId: deviceId})" block color="#17b3ec" size="small" type="primary" round>新增药品申领单</van-button></div>
            </div>
        </div>
    </div>
</template>
<script>
import medicineAbinetApi from '@/api/api-medicineAbinet'
export default{
    name: 'replenishmentDeviceList',
    name: 'replenishmentPickingList',
    data(){
        return {
            deviceId: this.$route.query.deviceId,
            list: [],
            active: 0,
            waitCount: 0
            waitCount: 0,
            status: ""
            
        }
    },
    created() {
        
        this.status = this.$route.query.status
        if(this.status){
            this.active = this.status==1 || this.status==2? 0 : 1
        }
    },
    methods:{
        $refreshData(){
            debugger
            this.$refs.customList.refresh(true)
        },
        onLoad({page, pageSize, searchText}){
            var p = {
                deviceId: this.deviceId,
@ -93,6 +109,9 @@ export default{
            var func;
            if(this.active === 0){
                func = medicineAbinetApi.replenishList
                if(this.status){
                    p.state = this.status
                }
            } else if(this.active === 1){
                p.receiveState = 0
                func = medicineAbinetApi.outboundOrderList
@ -123,15 +142,19 @@ export default{
            this.$refs.customList.refresh(true)
        },
        gotoDetail(item){
            var query = {
            }
            if(this.active===0){
                query.idUp = item.id
            if(this.status == 2){
                this.gotoUrl('/replenishment/stockUp/createOut', {deviceId: this.deviceId, upId: item.id})
            } else {
                query.idOut = item.id
                var query = {
                }
                if(this.active===0){
                    query.idUp = item.id
                } else {
                    query.idOut = item.id
                }
                this.gotoUrl('./detail', query)
            }
            this.gotoUrl('./detail', query)
        }
    },
}
@ -164,7 +187,7 @@ export default{
                display: -webkit-box;
                div{
                    &:first-child{
                        width: 60px;
                        width: 72px;
                        position: relative;
                        text-align: justify;
                        text-align-last: justify;
@ -184,6 +207,32 @@ export default{
    .custom-list{
        height: calc(100vh - 50px);
    }
    &.show-one{
        .van-tab{
            display: none;
        }
        .custom-list{
            height: calc(100vh - 52px);
        }
        &.hasBotBanner{
            ::v-deep .van-list__placeholder{
                height: 55px;
            }
        }
        .bot-banner{
            padding: 10px 5px;
            position: fixed;
            bottom: 0;
            width: 100%;
            left: 0;
            background: #fff;
            z-index: 3;
            >div{
                -webkit-box-flex: 1;
            }
        }
    }
}
</style>
<style lang="scss">
@ -192,6 +241,11 @@ export default{
        .custom-list {
            height: calc(100vh - 96px);
        }
        &.show-one{
            .custom-list{
                height: calc(100vh - 98px);
            }
        }
    }
}
</style>

+ 26 - 0
mini-pro-web/src/views/replenishment/picking/outList.vue

@ -0,0 +1,26 @@
<template>
    <PickingList/>
</template>
<script>
import PickingList from './list'
export default{
    name: 'replenishmentOutList',
    components: {
        PickingList
    },
    data(){
        return {
            
        }
    },
    created() {
       
    },
    methods:{
       
    },
}
</script>
<style lang='scss' scoped>
</style>

+ 218 - 0
mini-pro-web/src/views/replenishment/stockUp/createOut.vue

@ -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>

+ 114 - 9
mini-pro-web/src/views/replenishment/stockUp/detail.vue

@ -1,11 +1,15 @@
<template>
    <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-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 class="tc">现药数</div>
                    <div class="tc">缺药数</div>
                    <div class="tc">操作</div>
                </div>
            </van-sticky>
@ -22,9 +26,18 @@
                <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">{{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>
@ -35,10 +48,27 @@ export default{
        return {
            deviceId: this.$route.query.deviceId,
            list: [],
            oriData: []
            oriData: [],
            replenisherName: "",
            replenisherId: "",
            replenishErList: [],
            showPicker: false
        }
    },
    computed:{
        createOutAuth(){
            return this.$hasAuth('replenishmentMgnt', 'pickingList','createOut')
        },
    },
    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)=>{
            var exist = _.find(this.list, v=>{
                return v.drugCode == item.drugCode
@ -76,11 +106,45 @@ export default{
                    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(){
            if(!this.list.length){
                this.$toast('请选择药品')
                return
            }
            if(this.createOutAuth && !this.replenisherId){
                this.$toast('请选择设备管理员')
                return
            }
            this.$loading('保存中..')
            var p = {
                list: [{
@ -100,24 +164,62 @@ export default{
                    jsonData: JSON.stringify(p),
                })
                .then(res => {
                    console.log('baseUpCreateUp', res)
                    if(res.status == 200){
                        // 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()
                    }
                })
                .catch(err=>{
                    console.error(err)
                })
                
        },
        del(item, k){
            this.list.splice(k, 1)
        },
        toAdd(){
            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>
@ -125,6 +227,9 @@ export default{
.replenishment-stock-up-detail{
    padding-bottom: 100px;
    .list{
        .van-cell{
            padding-left: 10px;
        }
        .row{
            padding: 10px 0;
            border-bottom: 1px solid #e1e1e1;

+ 57 - 0
mini-pro-web/src/views/replenishment/stockUp/drugList.vue

@ -0,0 +1,57 @@
<template>
    <div class="drug-list">
        <div class="list" v-if="list.length">
            <div 
                v-for="(item, i) in list" :key="i"
                @click="addDrug(item)"
                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.drugCode}}</span>
                </van-row>
                <!-- <van-row class="lh25">
                    <van-col span="12" class="c-999">规格:<span class="c-333">{{item.specif}}</span></van-col>
                    <van-col span="12" class="c-999">零售价:<span class="c-333">{{item.price}}</span></van-col>
                </van-row>
                <van-row class="lh25">
                    <van-col span="12" class="c-999">医保支付价:<span class="c-333"></span></van-col>
                    <van-col span="12" class="c-999">医保支付比例:<span class="c-333"></span></van-col>
                </van-row>
                <van-row class="lh25">
                    <van-col span="12" class="c-999">基药:<span class="c-333"></span></van-col>
                    <van-col span="12" class="c-999">药品类别:<span class="c-333"></span></van-col>
                </van-row> -->
                <!-- <div class="c-ff5e6c fs-14 lh25">高危药品:</div> -->
            </div>
        </div>
        <div v-else class="c-999 fs-14 tc pt20">
            <div v-if="value">搜索不到数据~~</div>
            <div v-else>请输入关键词进行搜索</div>
        </div>
    </div>
</template>
<script>
import medicineAbinetApi from '@/api/api-medicineAbinet'
export default {
    name: "ReplenishmentDrugSel",
    data(){
        return {
            list: []
        }
    },
    async created(){
        this.list = this.$store.state.app.drugList
        console.log(this.list)
    },
    methods: {
        addDrug(item){
            this.$EventBus.$emit('drug-sel', item)
            history.back()
        }
    }
};
</script>
<style lang="scss" scoped>
@import '@/views/drug/css/drugSel.scss';
</style>