lincl vor 2 Jahren
Ursprung
Commit
e7f6c5642b

+ 8 - 0
mini-pro-web/src/api/api-medicineAbinet.js

@ -678,6 +678,14 @@ let service = {
		});
    },
	updateDeviceCargoStateApp: function(data) {
		return request({
			url: `${BASE}/baseDevice/updateDeviceCargoStateApp`,
			method: "post",
			data
		});
    },
};
export default service;

+ 75 - 6
mini-pro-web/src/views/device/cargoLane/index.vue

@ -32,7 +32,21 @@
                        <van-button @click="openAndCloseCargo(0)" block type="info" 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='flex f_y_c f_x_s mt10'>
                    <div style="width: 50%" class="pr10">
                        <van-button @click="findMediicinecabinetInventoryByDeviceId" type="info" style='width:100%;' class='c-border-r-5'>获取货道状态</van-button>
                        <!-- <van-button @click="openAndCloseCargo(1)" block type="info" class='c-border-r-5'>货道开启</van-button> -->
                    </div>
                    <div style="width: 50%" class="pl10">
                        <van-popover v-model="showPopover" :actions="actions" @select="updateDeviceCargoStateApp">
                        <template #reference>
                            <van-button @click="checkSelect" type="info" style='width:100%;' class='c-border-r-5'>设置货道状态</van-button>
                        </template>
                        </van-popover>
                    </div>
                </div>
                <!-- <div class='mt10'><van-button @click="findMediicinecabinetInventoryByDeviceId" type="info" style='width:100%;' class='c-border-r-5'>获取货道状态</van-button></div> -->
            </div>
        </van-sticky>
@ -81,7 +95,12 @@ export default{
            selectList: [],
            openCount: 0,
            closeCount: 0,
            faultCount: 0
            faultCount: 0,
            showPopover: false,
            actions: [
                { text: '故障', code: 1 },
                { text: '正常', code: 0 }
            ]
        }
    },
    created() {
@ -195,15 +214,65 @@ export default{
                        })
                })
            })
        }
        },
        checkSelect(){
            if(!this.selectList || !this.selectList.length){
                this.$toast('请选择要操作的通道')
                return
            }
            this.showPopover = true
        },
        updateDeviceCargoStateApp(action){
            if(!this.selectList || !this.selectList.length){
                this.$toast('请选择要操作的通道')
                return
            }
            this.$dialog.confirm({
                title: '',
                message: `确定将所选通道状态改为${action.text}`,
            })
            .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
                        faultState:  action.code		//必传		1故障,0正常
                    }
                    console.log('updateDeviceCargoStateApp', p)
                    medicineAbinetApi
                        .updateDeviceCargoStateApp(p)
                        .then(res=>{
                            console.log('updateDeviceCargoStateApp', res)
                            this.selectList = []
                            this.$toast({
                                message: '操作成功',
                                forbidClick: true,
                                onClose: ()=>{
                                }
                            })
                            this.$refreshData(true)
                        })
                        .catch(err=>{
                            console.error(err)
                        })
                })
            })
            .catch(()=>{
                resolve(1)
            })
        },
       
    },
}
</script>
<style scoped lang='scss'>
.cargoLaneIndex{
    .van-popover__wrapper{
        width: 100%;
    }
    .list{
        overflow-y: auto;
        padding-bottom: 10px;