hldy_app_mini/pages/NursingNew/component/pleasetake/component/takehomep.vue

318 lines
7.8 KiB
Vue
Raw Normal View History

2025-11-28 17:34:02 +08:00
<template>
<view>
<view class="buttons-father">
<view class="boxtwo">
<view class="ipt">
2025-12-05 10:10:53 +08:00
<input type="text" placeholder="物料名称/物料简拼" v-model="form.wlParamInfo" @confirm="search"/>
<image src="/static/index/procurement/x.png" mode="aspectFill" v-if="form.wlParamInfo"
@click="search(0)"></image>
2025-11-28 17:34:02 +08:00
</view>
2025-12-05 10:10:53 +08:00
<view class="scr" @click="search">
2025-11-28 17:34:02 +08:00
检索
</view>
2025-12-02 09:41:23 +08:00
<view class="shx" @click="ification = true">
2025-11-28 17:34:02 +08:00
<image src="/static/index/requestform/shaixuan.png" mode="aspectFill"></image>
<view class="shx-font">
筛选
</view>
</view>
2025-12-02 09:41:23 +08:00
<view class="shx" @click="chongzhi"
v-if="form.categoryId!=''||form.wlParamInfo!='' " >
2025-11-28 17:34:02 +08:00
<image src="/static/index/requestform/chongzhi.png" mode="aspectFill"></image>
<view class="shx-font">
重置
</view>
</view>
</view>
<view class="boxtwo flexend">
<view class="qlthbtn">
<image src="/static/index/requestform/ql0.png" mode="aspectFill"></image>
2025-12-04 08:36:59 +08:00
<view class="shx-font" @click="changePage(1)">
2025-11-28 17:34:02 +08:00
请领单
</view>
</view>
<view class="qlthbtn">
<image src="/static/index/requestform/ql1.png" mode="aspectFill"></image>
2025-12-04 08:36:59 +08:00
<view class="shx-font" @click="changePage(2)">
2025-11-28 17:34:02 +08:00
回退单
</view>
</view>
<view class="qlthbtn">
<image src="/static/index/requestform/ql2.png" mode="aspectFill"></image>
<view class="shx-font">
退货
</view>
</view>
</view>
</view>
2025-12-03 14:15:33 +08:00
<addwl :Material="addMaterial" @delall="delall" @del="adddel" @submit="submit"></addwl>
2025-12-02 09:41:23 +08:00
<carditem :InvoicingList="listarr" @scrolltolower="scrolltolower" :status="status" @comfig="comfig"></carditem>
2025-12-02 13:33:11 +08:00
<takeing :show="takeshow" :objtake="objtake" @fill="takeshow = false" @right="right"></takeing>
2025-12-02 09:41:23 +08:00
<cgdclass @confirm="confirm" :show="ification" :typenum="0" ref="classication" @fill="ification = false"></cgdclass>
<medetails :show="detaishow" @fill="detaishow = false" @confirm="confirm" :objtake="objtake"></medetails>
2025-12-02 15:59:32 +08:00
<tanchuang @back="tanshow = false" :show="tanshow" font="确定将该物料从本次请领清单中移除吗?" @right="del"></tanchuang>
2025-12-03 14:15:33 +08:00
<takerecord :objtake="objtake" :show="recordshow" @fill="recordshow = false"></takerecord>
2025-12-04 08:38:32 +08:00
<submits :show="subshow" :list="addMaterial" @fill="subshow = false" @config="tijiao"></submits>
2025-11-28 17:34:02 +08:00
</view>
</template>
<script setup lang="ts">
2025-12-02 13:34:13 +08:00
import { ref, onMounted, onBeforeUnmount, computed, nextTick, watch, reactive } from 'vue';
2025-12-04 08:38:32 +08:00
import { queryInvoicingList,wlzd,queryGwcInfo,addGwc ,deleteGwcWl,removeAllGwc,submitQld} from '../api/api.js'
2025-12-02 09:41:23 +08:00
import addwl from '../common/addwl.vue';
import carditem from '../common/carditem.vue';
import takeing from '../common/takeing.vue';
import cgdclass from '../common/cgdclass.vue';
import medetails from '../common/medetails.vue';
2025-12-02 15:59:32 +08:00
import tanchuang from '../common/tanchuang.vue';
2025-12-03 14:15:33 +08:00
import takerecord from '../common/takerecord.vue';
import submits from '../common/submits.vue'
2025-12-02 09:41:23 +08:00
const form = reactive({
2025-11-28 17:34:02 +08:00
pageNo:1,
pageSize:10,
nuId:uni.getStorageSync('nuId'),
2025-12-08 10:35:18 +08:00
elderId:uni.getStorageSync('NUall').elderId,
2025-11-28 17:34:02 +08:00
wlParamInfo:'',
categoryId:'',
typeId:'',
medicationId:''
})
2025-12-02 09:41:23 +08:00
const takeshow = ref(false)
const ification = ref(false)
const detaishow = ref(false)
2025-12-02 15:59:32 +08:00
const tanshow = ref(false)
2025-12-03 14:15:33 +08:00
const recordshow = ref(false)
2025-12-04 08:38:32 +08:00
const subshow = ref(false)
2025-12-02 09:41:23 +08:00
const classication = ref<InstanceType<typeof ChildComponent>>()
2025-11-28 17:34:02 +08:00
onMounted(()=>{
config()
2025-12-04 08:38:32 +08:00
wuliao()
2025-11-28 17:34:02 +08:00
})
2025-12-02 13:33:11 +08:00
const addMaterial = ref([])
const wuliao = () =>{
let obj = {
nuId:form.nuId,
elderId:form.elderId
}
queryGwcInfo(obj).then(res=>{
2025-12-05 10:10:53 +08:00
console.log(res,obj)
2025-12-02 13:33:11 +08:00
addMaterial.value = res.result
})
}
2025-11-28 17:34:02 +08:00
const listarr = ref([])
2025-12-02 09:41:23 +08:00
const status = ref('loadmore')
2025-11-28 17:34:02 +08:00
const config = ()=>{
2025-12-02 09:41:23 +08:00
queryInvoicingList(form).then(res=>{
2025-11-28 17:34:02 +08:00
res.result.records.forEach(item=>{
item.zk = false;
item.scrollleft = 0;
})
listarr.value.push(...res.result.records)
2025-12-02 09:41:23 +08:00
status.value = (res.result.total == listarr.value.length ? 'nomore' : 'loadmore')
2025-11-28 17:34:02 +08:00
})
}
2025-12-05 10:10:53 +08:00
const search = (x : number) => {
if (x === 0) { form.wlParamInfo = '' }
form.pageNo = 1;
listarr.value = [];
config();
}
2025-12-02 09:41:23 +08:00
const scrolltolower = ( ) => {
2025-12-03 14:15:33 +08:00
if (status.value=='loading'||status.value=='nomore') { return }
2025-12-02 09:41:23 +08:00
status.value = 'loading';
form.pageNo++;
config()
}
2025-12-03 14:15:33 +08:00
const submit = ()=>{
2025-12-04 08:38:32 +08:00
wuliao();
subshow.value = true;
2025-12-03 14:15:33 +08:00
}
const adddel = (v)=>{
console.log(v)
listarr.value.forEach(item=>{
if(item.wlId == v.wlId){
2025-12-04 08:38:32 +08:00
console.log(item)
2025-12-03 14:15:33 +08:00
objtake.value = item
}
})
2025-12-04 08:38:32 +08:00
if(!objtake.value.wlId){
objtake.value = v;
}
2025-12-03 14:15:33 +08:00
tanshow.value = true;
console.log(objtake.value)
}
const del = ()=>{
let obj = {
nuId:form.nuId,
elderId:form.elderId,
wlId:objtake.value.wlId
2025-12-02 15:59:32 +08:00
}
2025-12-04 08:38:32 +08:00
console.log(obj)
2025-12-03 14:15:33 +08:00
deleteGwcWl(obj).then(res=>{
if(res.success){
2025-12-04 08:38:32 +08:00
wuliao();
2025-12-03 14:15:33 +08:00
tanshow.value = false;
objtake.value.isAdd = null;
objtake.value.qlNum = null;
}else{
uni.showToast({
icon:'none',
title:res.message
})
}
})
}
const delall = () =>{
2025-12-04 08:38:32 +08:00
console.log({nuId:form.nuId, elderId:form.elderId})
2025-12-03 14:15:33 +08:00
removeAllGwc({nuId:form.nuId, elderId:form.elderId}).then(res=>{
if(res.success){
wuliao();
listarr.value.forEach(item=>{
item.isAdd = null;
item.qlNum = null;
item.gwcId = null;
})
}else{
uni.showToast({
icon:'none',
title:res.message
})
}
})
}
2025-12-02 09:41:23 +08:00
const objtake = ref({})
const comfig=(v,i,t)=>{
console.log(v,i,t)
switch (t){
case 0:
2025-12-02 15:59:32 +08:00
objtake.value = v;
if(v.isAdd==1){
tanshow.value = true;
}else{
takeshow.value = true;
}
2025-12-02 09:41:23 +08:00
break;
case 1:
2025-12-03 14:15:33 +08:00
objtake.value = v;
recordshow.value = true;
2025-12-02 09:41:23 +08:00
break;
case 2:
objtake.value = v;
detaishow.value = true;
break;
case 3:
let obj = {
nuId:form.nuId,
elderId:form.elderId,
wlId:v.wlId,
izZd:v.zhiDingId?false:true
}
wlzd(obj).then(res=>{
console.log(obj,res)
if(res.success){
2025-12-03 14:15:33 +08:00
// objtake.value = v;
// objtake.value.zk = false;
// objtake.value.scrollleft = 0;
// objtake.value = v.zhiDingId?false:true;
// listarr.value.splice(i,1);
// listarr.value.unshift(v)
2025-12-02 09:41:23 +08:00
listarr.value = [];
form.pageNo = 1;
2025-12-03 14:15:33 +08:00
2025-12-02 09:41:23 +08:00
config()
}else{
uni.showToast({
icon:'none',
title:res.message
})
}
})
break;
default:
break;
}
}
2025-12-02 13:33:11 +08:00
const right = (e,v) =>{
2025-12-04 08:38:32 +08:00
console.log(v)
2025-12-02 13:33:11 +08:00
let obj = {
2025-12-04 08:38:32 +08:00
kfId:v.nuId,
2025-12-02 13:33:11 +08:00
wlId:v.wlId,
qlNum:e,
nuId:form.nuId,
elderId:form.elderId
}
addGwc(obj).then(res=>{
if(res.success){
takeshow.value = false;
2025-12-02 15:59:32 +08:00
v.isAdd = 1;
2025-12-03 14:15:33 +08:00
v.qlNum = e;
2025-12-02 13:33:11 +08:00
wuliao();
}else{
uni.showToast({
icon:'none',
title:res.message
})
}
})
}
2025-12-04 08:38:32 +08:00
const tijiao = ()=>{
let obj = {
nuId:form.nuId,
elderId:form.elderId
}
submitQld(obj).then(res=>{
if(res.success&&res.result.status=='success'){
2025-12-05 10:10:53 +08:00
uni.showToast({
icon:'success',
title:'提交成功'
})
setTimeout(()=>{
subshow.value = false;
wuliao();
},800)
2025-12-04 08:38:32 +08:00
}else{
uni.showToast({
icon:'none',
title:res.result.message
})
}
console.log(res)
})
}
2025-12-02 09:41:23 +08:00
const confirm = (e)=>{
form.categoryId = e.categoryId;
form.typeId = e.typeId;
form.medicationId = e.medicationId;
form.pageNo=1;
listarr.value = [];
config();
ification.value = false;
console.log(e)
}
const chongzhi=()=>{
form.categoryId = '';
form.typeId = '';
form.medicationId = '';
form.pageNo=1;
form.wlParamInfo= '',
listarr.value = [];
classication.value.typescroll(1,-1,{});
classication.value.qingkong();
classication.value.config();
}
2025-12-02 13:34:13 +08:00
const emit = defineEmits(['changePageNumber']) // 也可以用类型签名(见下面)
2025-12-04 08:36:59 +08:00
const changePage = (index:number) => {
emit('changePageNumber', index)
2025-12-02 13:34:13 +08:00
}
2025-11-28 17:34:02 +08:00
</script>
<style lang="less" scoped>
@import "../css/take.less";
</style>