aosiyiliaouniapp/pages/wuliugenzong1/genzong.vue

859 lines
23 KiB
Vue
Raw Normal View History

2024-04-08 02:59:47 +00:00
<template>
<view class="page">
<view class="header">
<u-search placeholder="请查询" input-align="center" :show-action="false" @focus="onShowPopup"></u-search>
</view>
<hqs-popup title="向下滑动关闭" :from="popFrom" :mask-click="maskClick"
@back="onBack"
v-model="showPop">
<template v-slot:back>
<view>test</view>
</template>
<view>
<!-- <view class="list-item" @click="showPop = false">关闭弹窗</view> -->
<view class="bianju">
患者姓名:
</view>
<view class="bianju">
<u-input v-model="patientName" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入患者姓名"/>
</view>
</view>
<view>
<!-- <view class="list-item" @click="showPop = false">关闭弹窗</view> -->
<view class="bianju">
工单号:
</view>
<view class="bianju">
<u-input v-model="workOrderNo" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入工单号"/>
</view>
</view>
<view>
<!-- <view class="list-item" @click="showPop = false">关闭弹窗</view> -->
<view class="bianju">
创建开始时间:
</view>
<view class="bianju">
<u-datetime-picker
:show="show"
v-model="time1"
mode="datetime"
closeOnClickOverlay
format="YYYY-MM-DD HH:mm:ss"
@confirm = 'confirmDatePicker'
@close = "showDatePicker = false"
@cancel = "showDatePicker = false"
></u-datetime-picker>
<u-input v-model="createdStartDt" border="true" border-color="#dcdfe6" style="background-color:rgb(246,246,246)"
@focus="xianshi" placeholder="选择时间"/>
</view>
</view>
<view>
<!-- <view class="list-item" @click="showPop = false">关闭弹窗</view> -->
<view class="bianju">
创建结束时间:
</view>
<view class="bianju">
<u-datetime-picker
:show="show1"
v-model="time2"
mode="datetime"
closeOnClickOverlay
format="YYYY-MM-DD HH:mm:ss"
@confirm = 'confirmDatePicker1'
@close = "showDatePicker = false"
@cancel = "showDatePicker = false"
></u-datetime-picker>
<u-input v-model="createdEndDt" border="true" border-color="#dcdfe6" style="background-color:rgb(246,246,246)"
@focus="xianshi1" placeholder="选择时间"/>
</view>
</view>
<view class="bianju1">
<liu-checkBox v-model="workPlace" :checkType="checkType" :checkOptions="checkOptions" ref="checkBox" :activeColor="'#FF0000'" @checkChange="checkChange1" style="display: flex;align-items: stretch;"></liu-checkBox>
</view>
<template v-slot:bottom>
<view class="chaxunx">
<u-button type="info" size="medium" :ripple="true" ripple-bg-color="#909399" @click="result">重置</u-button>
<u-button type="primary" size="medium" :ripple="true" ripple-bg-color="#909399" @click="select">查询</u-button>
</view>
</template>
</hqs-popup>
<view class="page1">
<u-tabs :list="list2" @change="tabsChange"></u-tabs>
</view>
<view class="bottom">
<scroll-view scroll-y style="height: 92%;width: 100%;" @scrolltolower="onreachBottom" >
<view class="kawei" v-for="(item, index) in datas" :key="index">
<view class="geziWC">
<view style="padding-top: 20upx;padding-left: 10upx;" @click="tiaozhuan(item)">
<u-row gutter="16" style="padding-top: 30upx;">
<u-col span="3">
<u-tag justify="center" :text="item.status" :type="item.color" size="mini"/>
</u-col>
<u-col span="6.1">
<span style="padding-top: 40upx;font-size: 30upx;">
工单号:{{item.workOrderNo}}
</span>
</u-col>
<u-col span="1.9">
<u-tag :text="item.types" type="warning" size="mini" style="padding-top: 40upx;"/>
</u-col>
<!-- <u-col span="2">
<u-icon name="arrow-right" justify="center" @click="tiaozhuan"></u-icon>
</u-col> -->
</u-row>
</view>
<view class="" @click="tiaozhuan(item)">
<u-row gutter="16">
<view>
<view style="padding-top: 9upx;padding-left:50upx;font-size: 22upx;text-align-last: justify;width: 100upx;">
抓药人:
</view>
</view>
<span style="padding-top: 9upx;padding-left:30upx;font-size: 22upx;">
{{item.createdBy}}
</span>
</u-row>
<u-row gutter="16">
<view>
<view style="padding-top: 9upx;padding-left:50upx;font-size: 22upx;text-align-last: justify;width: 100upx;">
患者姓名:
</view>
</view>
<span style="padding-top: 9upx;padding-left:30upx;font-size: 22upx;">
{{item.patientName}}
</span>
</u-row>
<u-row gutter="16">
<view>
<view style="padding-top: 9upx;padding-left:50upx;font-size: 22upx;text-align-last: justify;width: 100upx;">
处方:
</view>
</view>
<span style="padding-top: 9upx;padding-left:30upx;font-size: 22upx;">
{{item.prescription}}
</span>
</u-row>
<u-row gutter="16">
<view>
<view style="padding-top: 9upx;padding-left:50upx;font-size: 22upx;text-align-last: justify;width: 100upx;">
工作地点:
</view>
</view>
<span style="padding-top: 9upx;padding-left:30upx;font-size: 22upx;">
{{item.workPlace}}
</span>
</u-row>
<u-row gutter="16">
<view>
<view style="padding-top: 9upx;padding-left:50upx;font-size: 22upx;text-align-last: justify;width: 100upx;">
创建时间:
</view>
</view>
<span style="padding-top: 9upx;padding-left:30upx;font-size: 22upx;">
{{item.createdDtFormatted}}
</span>
</u-row>
</view>
<u-row gutter="20" justify="end">
<u-col span="2.5">
<u-button size="mini" shape="circle" type="error" @click="querenguandan(item)" v-if="maps[item.status]">强制关单</u-button>
</u-col>
<u-col span="2.5">
<u-button size="mini" shape="circle" type="primary" @click="gongzuoqueren(item)" v-if="map[item.status]">工作确认</u-button>
</u-col>
</u-row>
</view>
</view>
</scroll-view>
</view>
<view class="fixed-button-container">
<u-col span="4">
<u-button class="fixed-button" type="primary" shape="circle" width="50" @click="chuangjian" :disabled="chuangjiananniu">创建工单</u-button>
</u-col>
</view>
<u-popup :show="showGD" mode="center" style="width: 600upx;">
<view style="width: 600upx;">
<view class="" style="margin-bottom: 10upx;">
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
患者姓名:
</view>
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
<u-input v-model="patientNameA" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入患者姓名"/>
</view>
</view>
<view class="" style="margin-bottom: 10upx;">
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
患者电话:
</view>
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
<u-input v-model="patientPhoneA" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入患者电话"/>
</view>
</view>
<view class="" style="margin-bottom: 10upx;">
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
药品数量:
</view>
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
<u-input v-model="prescriptionA" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入药品数量"/>
</view>
</view>
<view class="" style="margin-bottom: 10upx;">
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
工作地点:
</view>
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
<u-picker :show="shows" :columns="columns" @change="changeHandler" @confirm="confirm"></u-picker>
<u-input v-model="workPlaceA" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请选择工作地点" @touchstart="shows = true"/>
</view>
</view>
</view>
<view class="" style="display: flex;margin-top:30upx;justify-content: center;">
<u-col span="4">
<u-button shape="circle" type="error" @click="quxiao">取消</u-button>
</u-col>
<u-col span="4">
<u-button shape="circle" type="primary" @click="querentijiao">创建</u-button>
</u-col>
</view>
</u-popup>
<u-popup :show="showGB" mode="center" style="width: 600upx;">
<view style="width: 600upx;">
<view class="" style="margin-bottom: 10upx;">
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
关闭原因:
</view>
<view class="bianju" style="padding: 10upx 15upx 10upx 15upx;">
<u-input v-model="reason" :type="type" border="true" custom-style="background-color:rgb(246,246,246)" placeholder="请输入患者姓名"/>
</view>
</view>
</view>
<view class="" style="display: flex;margin-top:30upx;justify-content: center;">
<u-col span="4">
<u-button shape="circle" type="error" @click="quxiaoGB">取消</u-button>
</u-col>
<u-col span="4">
<u-button shape="circle" type="primary" @click="guandan">创建</u-button>
</u-col>
</view>
</u-popup>
<view class="" >
<u-notify style="height: 50upx;line-height: 50upx;" ref="uNotify" message="Hi uView"></u-notify>
</view>
</view>
</template>
<script>
import { getStatus,getGroupByWorkOrderNo,addWorkFlow } from "../../api/api.js"
export default {
data() {
return {
//查询的值
map:{
"工单开始":false,
"取未煎药":false,
"未煎药送达":false,
"煎药完成":false,
"取已煎药":false,
"已完成":false,
"强制关单":false,
"管理员":false,
},
maps:{
"工单开始":false,
"取未煎药":false,
"未煎药送达":false,
"煎药完成":false,
"取已煎药":false,
"已完成":false,
"强制关单":false,
"管理员":false,
},
chuangjiananniu:true,
gongdan:"AS202402120001",
a : 2,
b:2,
c:2,
d:2,
e:2,
f:2,
g:2,
datas:[],
title:"未煎药送达",
name:"我是今年",
prescriptionA:"",
workPlaceA:"",
patientPhoneA:"",
patientNameA:"",
workOrderNoA:"",
reason:"",
types:"",
type:"",
status:"",
patientName:"",
workOrderNo:'',
workPlace:"",
createdStartDt:"",
createdEndDt:"",
time1:"",
time2:"",
swiperCurrent:0,
pageNum:1,
pageSize:5,
list2: [{
name: '全部',
badge: {
value: 0,
}
},{
name: '工单开始',
badge: {
value: 0,
}
}, {
name: '取未煎药',
badge: {
value: 0,
}
}, {
name: '未煎药送达',
badge: {
value: 5,
}
}, {
name: '煎药完成',
badge: {
value: 0,
}
}, {
name: '取已煎药',
badge: {
value: 0,
}
}, {
name: '完成',
badge: {
value: 0,
}
}],
showPop: false,
dataGD:{},
//弹窗位置
popFrom: 'top',
list: new Array(20).fill(0),
maskClick: true,
value: '',
type: 'text',
show: false,
shows:false,
show1: false,
showGD:false,
showGB:false,
value1: Number(new Date()),
time:"",
checkType: 'single',//选择类型 单选 single 多选 multiple
// maxNum: 5, //复选最大可选数量
checkOptions: [{
id: 1,
name: '博奥中医院'
},{
id: 2,
name: '惠民道卫生服务中心'
},{
id: 3,
name: '奥斯医疗管理'
},{
id: 4,
name: '小山社区卫生服务中心'
},{
id: 5,
name: '大理社区卫生服务中心'
}],
columns: [['博奥中医院', '惠民道卫生服务中心', '奥斯医疗管理','小山社区卫生服务中心','大理社区卫生服务中心']],
}
},
onShow() {
this.quanxianjiazai()
getStatus().then((res)=>{
let a
for(a = 0 ;a<res.data.length;a++){
if(res.data[a].name=="己煎药送回"){
res.data[a].name="已完成"
}
}
this.list2 = res.data
})
this.select()
},
methods: {
quanxianjiazai(){
var res=uni.getStorageSync(
'token'
)
console.log(res.role)
let a
for(a=0;a<res.role.length;a++){
console.log(res.role[a])
if(res.role[a].roleId==1 || res.role[a].roleId==2){
this.map["工单开始"] = true
this.map["取未煎药"] = true
this.map["未煎药送达"] = true
this.map["煎药完成"] = true
this.map["取已煎药"] = true
this.maps["工单开始"] = true
this.maps["取未煎药"] = true
this.maps["未煎药送达"] = true
this.maps["煎药完成"] = true
this.maps["取已煎药"] = true
this.chuangjiananniu=false
return
}
if(res.role[a].roleId==3){
this.map["工单开始"] = true
this.map["取未煎药"] = true
this.map["煎药完成"] = true
this.map["取已煎药"] = true
}
if(res.role[a].roleId==4){
this.chuangjiananniu=false
}
if(res.role[a].roleId==5){
this.map["未煎药送达"] = true
}
}
},
tiaozhuan(e){
console.log(e)
uni.navigateTo({
url: '/pages/wuliugenzongX/genzong?param1='+e.workOrderNo
});
},
gongzuoqueren(e){
console.log(e)
let data = {
workOrderNo:e.workOrderNo,
workPlace : e.workPlace,
patientPhone : e.patientPhone,
prescription : e.prescription,
patientName : e.patientName,
}
addWorkFlow(data).then((res)=>{
console.log(res)
if(res.code == 200){
this.$refs.uNotify.show({
top: 20,
type: 'success',
message: "确认完成",
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
}else{
this.$refs.uNotify.show({
top: 20,
type: 'success',
message: res.message,
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
}
getStatus().then((res)=>{
this.list2 = res.data
})
this.select()
})
},
guandan(){
this.dataGD.reason = this.reason
addWorkFlow(this.dataGD).then((res)=>{
console.log(res)
if(res.code == 200){
this.$refs.uNotify.show({
top: 20,
type: 'success',
message: "关闭完成",
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
}else{
this.$refs.uNotify.show({
top: 20,
type: 'success',
message: res.message,
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
}
this.showGB = false
getStatus().then((res)=>{
this.list2 = res.data
})
this.select()
})
},
querentijiao(){
let data = {
workPlace : this.workPlaceA[0],
patientPhone : this.patientPhoneA,
prescription : this.prescriptionA,
patientName : this.patientNameA
}
if(this.workPlaceA =="" ||this.workPlaceA == undefined || this.workPlaceA == null){
this.$refs.uNotify.show({
top: 20,
type: 'error',
color: '#fff',
bgColor: 'red',
message: '工作地点不能为空',
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
return
}
if(this.patientPhoneA =="" ||this.patientPhoneA == undefined || this.patientPhoneA == null){
this.$refs.uNotify.show({
top: 20,
type: 'error',
color: '#fff',
bgColor: 'red',
message: '患者电话不能为空',
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
return
}
if(this.prescriptionA =="" ||this.prescriptionA == undefined || this.prescriptionA == null){
this.$refs.uNotify.show({
top: 20,
type: 'error',
color: '#fff',
bgColor: 'red',
message: '药剂数量不能为空',
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
return
}
if(this.patientNameA =="" ||this.patientNameA == undefined || this.patientNameA == null){
this.$refs.uNotify.show({
top: 20,
type: 'error',
color: '#fff',
bgColor: 'red',
message: '患者姓名不能为空',
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
return
}
addWorkFlow(data).then((res)=>{
console.log(res)
this.$refs.uNotify.show({
top: 20,
type: 'success',
message: res.message,
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
getStatus().then((res)=>{
this.list2 = res.data
})
this.select()
this.workPlaceA[0] = ""
this.patientPhoneA = ""
this.prescriptionA = ""
this.patientNameA = ""
this.showGD=false
})
},
quxiao(){
this.showGD=false
},
quxiaoGB(){
this.showGB=false
},
confirm(e) {
console.log('confirm', e.value)
this.workPlaceA = e.value
this.shows = false
},
changeHandler(e) {
this.shows = true
},
chuangjian(){
this.showGD=true
},
querenguandan(e){
console.log(e)
this.dataGD = {
workOrderNo:e.workOrderNo,
workPlace : e.workPlace,
patientPhone : e.patientPhone,
prescription : e.prescription,
patientName : e.patientName,
status : "强制关单"
}
this.showGB=true
},
result(){
this.patientName=""
this.workOrderNo=''
this.workPlace=""
this.createdStartDt=""
this.createdEndDt=""
this.time1=""
this.time2=""
this.$refs.checkBox.reset()
},
select(){
this.a = 2
if(this.status== "已完成"){
this.status = "己煎药送回"
}
let data={
workOrderNo:this.workOrderNo,
pageNum:this.pageNum,
pageSize:this.pageSize,
workPlace:this.workPlace,
status:this.status,
patientName:this.patientName,
createdStartDt:this.createdStartDt,
createdEndDt:this.createdEndDt
}
getGroupByWorkOrderNo(data).then((res)=>{
console.log(res)
let a
for(a=0;a<res.data.length;a++){
if(res.data[a].status=="工单开始"){
res.data[a].color = "info"
res.data[a].types="司机"
}else if(res.data[a].status=="己煎药送回"){
res.data[a].color = "success"
res.data[a].status = "已完成"
res.data[a].types="已完成"
}else if(res.data[a].status=="强制关单"){
res.data[a].types="管理员"
res.data[a].color = "error"
}else if(res.data[a].status=="煎药完成"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="取已煎药"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="取未煎药"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="未煎药送达"){
res.data[a].types = "煎药人"
res.data[a].color = "warning"
}
}
this.datas = res.data
this.showPop = false
})
},
// tabs调用接口
tabsChange(e){
console.log(e.name)
this.status=e.name
if(e.name=="全部"){
this.status=""
}
this.select()
},
// scroll-view到底部加载更多
onreachBottom() {
console.log(11111111111)
let data={
workOrderNo:this.workOrderNo,
pageNum:this.a,
pageSize:this.pageSize,
workPlace:this.workPlace,
status:this.status,
patientName:this.patientName,
createdStartDt:this.createdStartDt,
createdEndDt:this.createdEndDt
}
getGroupByWorkOrderNo(data).then((res)=>{
if(res.data.length>0){
this.a += 1
let a
for(a=0;a<res.data.length;a++){
if(res.data[a].status=="工单开始"){
res.data[a].color = "info"
res.data[a].types="司机"
}else if(res.data[a].status=="己煎药送回"){
res.data[a].color = "success"
res.data[a].status = "已完成"
res.data[a].types="已完成"
}else if(res.data[a].status=="强制关单"){
res.data[a].types = "管理员"
res.data[a].color = "error"
}else if(res.data[a].status=="煎药完成"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="取已煎药"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="取未煎药"){
res.data[a].types = "司机"
res.data[a].color = "warning"
}else if(res.data[a].status=="未煎药送达"){
res.data[a].types = "煎药人"
res.data[a].color = "warning"
}
this.datas.push(res.data[a])
}
}else{
this.$refs.uNotify.show({
top: 20,
type: 'error',
color: '#fff',
bgColor: 'red',
message: '没有新的数据了',
duration: 1000 * 3,
fontSize: 40,
safeAreaInsetTop:false
})
return
}
this.showPop = false
})
},
//选中状态发生变化时触发 data为选中对所有对象数据
checkChange1(data){
// 点击选中的所有item 数组 执行业务逻辑
console.log(data)
this.workPlace=data[0].name
},
confirmtime(e){
console.log(e);
//此处实现选择器值的接收
this.time = e.year +'-'+ e.month + '-'+
e.day+' '+ e.hour + ':'+ e.minute+ ':'+ e.second
},
onBack() {
uni.showToast({
title: 'test',
})
},
onShowPopup(e) {
this.showPop = true
},
showPopupFrom(from) {
this.popFrom = from
this.showPop = true
},
reset(){
this.$refs.checkBox.reset()
},
confirmDatePicker(e){
console.log(e)
console.log()
var date = new Date(e.value);
var year = date.getFullYear(); // 获取年份
var month = date.getMonth() + 1; // 获取月份注意月份从0开始需要加1
var day = date.getDate(); // 获取日期
var hour = date.getHours(); // 获取小时
var minute = date.getMinutes(); // 获取分钟
var second = date.getSeconds(); // 获取秒数
if(hour< 10){
hour = "0"+hour
}
if(minute< 10){
minute = "0"+minute
}
if(second< 10){
second = "0"+second
}
if(month< 10){
month = "0"+month
}
if(day< 10){
day = "0"+day
}
console.log(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second);
this.time1 = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
this.createdStartDt = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
this.show=false
},
confirmDatePicker1(e){
console.log(e)
console.log()
var date = new Date(e.value);
var year = date.getFullYear(); // 获取年份
var month = date.getMonth() + 1; // 获取月份注意月份从0开始需要加1
var day = date.getDate(); // 获取日期
var hour = date.getHours(); // 获取小时
var minute = date.getMinutes(); // 获取分钟
var second = date.getSeconds(); // 获取秒数
if(hour< 10){
hour = "0"+hour
}
if(minute< 10){
minute = "0"+minute
}
if(second< 10){
second = "0"+second
}
if(month< 10){
month = "0"+month
}
if(day< 10){
day = "0"+day
}
console.log(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second);
this.time2 = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
this.createdEndDt = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
this.show1=false
},
xianshi(){
this.show=true
},
xianshi1(){
this.show1=true
}
},
}
</script>
<style>
@import url("genzong.css");
</style>