123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <template>
- <text @click.stop="selectAccountHandler(data, index)">
- <text class="text">{{data.patientName}}</text><text>{{data.hosNum}}</text>
- <!-- 取消发血弹窗 -->
- <selectAccount2 @click.stop.native v-if="hosModels2.disjunctor" :content="hosModels2.content" :disjunctor="hosModels2.disjunctor" @ok="hosOk2"
- @cancel="hosCancel2" :tips="hosModels2.tips" :cancelBloodHandover="cancelBloodHandover">
- </selectAccount2>
- </text>
- </template>
- <script>
- import {
- post
- } from "@/http/http.js";
- export default {
- data() {
- return {
- // 弹窗model
- hosModels2: {
- disjunctor: false,
- },
-
- coopData: {},
- isShowTips: false,
- };
- },
- props: {
- data: {
- type: Object,
- },
- index: {
- type: Number,
- },
- signType4: {
- type: Boolean,
- default: false,
- },
- cancelBlood: {
- type: Number,
- default: 0,
- },
- cancelBloodHandover: {
- type: Number,
- default: 0,
- },
- dataList: {
- type: Object,
- },
- type: {
- type: String,
- },
- },
- methods: {
- cancelBloodHandler(data){
- console.log(data);
- console.log(this.coopData);
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- let postData = {
- "type": "bloodTake",
- service: 'cancelBlood',
- bloodIds: this.coopData.children.map(v => v.children).flat().map(v => v.id).toString(),
- closeOrder: this.isShowTips ? 1 : 0,
- handoverUser: data.accountId,
- cancelReason: data.cancelReason,
- };
-
- post('/transflow/extra', postData).then(res => {
- uni.hideLoading();
- if(res.state == 200){
- uni.showModal({
- title: "提示",
- content: "操作成功!",
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- console.log("用户点击确定");
- if(this.type == 'start'){
- if(this.isShowTips){
- uni.navigateTo({
- url: `/pages/receiptpage/receiptpage`,
- });
- }else{
- // 触发自定义事件并传递参数给上一页
- uni.$emit('refresh', { refresh: true });
-
- // 跳转回上一页
- uni.navigateBack({
- delta: 1
- });
- }
- }else if(this.type == 'end'){
- if(this.isShowTips){
- uni.navigateTo({
- url: `/pages/receiptpage/receiptpage`,
- });
- }else{
- this.$emit('refresh');
- }
- }
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- }else{
- uni.showToast({
- icon: "none",
- title: res.msg || "接口获取数据失败!",
- });
- }
- })
- },
- // 确认
- hosOk2(data) {
- console.log(data);
- const {
- accountName,
- account,
- accountId,
- cancelReason,
- } = data;
-
- if (!cancelReason) {
- //没有填写交接人
- uni.showModal({
- title: "提示",
- content: "请填写取消原因!",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- console.log("用户点击确定");
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- return;
- }
-
- // 必填交接人
- if(this.cancelBloodHandover == 1){
- if (!accountName && !account) {
- //没有填写交接人
- uni.showModal({
- title: "提示",
- content: "请填写交接人工号!",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- console.log("用户点击确定");
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- return;
- } else if ((!accountName && account) || (accountName && !account)) {
- //没有填写交接人
- uni.showModal({
- title: "提示",
- content: "请填写正确的交接人工号!",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- console.log("用户点击确定");
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- return;
- }
- }
-
- this.hosModels2.disjunctor = false;
- this.cancelBloodHandler(data);
- },
- // 取消
- hosCancel2() {
- this.hosModels2.disjunctor = false;
- },
- // 取消发血弹窗
- showSelectAccount2(isShowTips = false) {
- this.isShowTips = isShowTips;
- this.hosModels2 = {
- content: `请填写取消送血原因和交接人信息`,
- disjunctor: true,
- tips: isShowTips ? '本患者取消送血后,工单将关闭!' : '',
- };
- },
- // 取消发血
- selectAccountHandler(data, index){
- if(this.cancelBlood != 1 || !this.signType4){
- return;
- }
- this.coopData = data;
- let arr = this.dataList.children.filter((v, i) => i !== index);
- if(arr.length){
- let flag = false;
- if(this.type == 'end'){
- // 其他患者的血都是"病房接收"状态
- flag = arr.map(v => v.children).flat().map(v => v.children).flat().every(v => v.state.value == 5);
- }
- this.showSelectAccount2(flag);
- }else{
- // 没有其他患者
- this.showSelectAccount2(true);
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .text{
- margin-right: 16rpx
- }
- </style>
|