cancelBlood.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <text @click.stop="selectAccountHandler(data, index)">
  3. <text class="text">{{data.patientName}}</text><text>{{data.hosNum}}</text>
  4. <!-- 取消发血弹窗 -->
  5. <selectAccount2 @click.stop.native v-if="hosModels2.disjunctor" :content="hosModels2.content" :disjunctor="hosModels2.disjunctor" @ok="hosOk2"
  6. @cancel="hosCancel2" :tips="hosModels2.tips" :cancelBloodHandover="cancelBloodHandover">
  7. </selectAccount2>
  8. </text>
  9. </template>
  10. <script>
  11. import {
  12. post
  13. } from "@/http/http.js";
  14. export default {
  15. data() {
  16. return {
  17. // 弹窗model
  18. hosModels2: {
  19. disjunctor: false,
  20. },
  21. coopData: {},
  22. isShowTips: false,
  23. };
  24. },
  25. props: {
  26. data: {
  27. type: Object,
  28. },
  29. index: {
  30. type: Number,
  31. },
  32. signType4: {
  33. type: Boolean,
  34. default: false,
  35. },
  36. cancelBlood: {
  37. type: Number,
  38. default: 0,
  39. },
  40. cancelBloodHandover: {
  41. type: Number,
  42. default: 0,
  43. },
  44. dataList: {
  45. type: Object,
  46. },
  47. type: {
  48. type: String,
  49. },
  50. },
  51. methods: {
  52. cancelBloodHandler(data){
  53. console.log(data);
  54. console.log(this.coopData);
  55. uni.showLoading({
  56. title: "加载中",
  57. mask: true,
  58. });
  59. let postData = {
  60. "type": "bloodTake",
  61. service: 'cancelBlood',
  62. bloodIds: this.coopData.children.map(v => v.children).flat().map(v => v.id).toString(),
  63. closeOrder: this.isShowTips ? 1 : 0,
  64. handoverUser: data.accountId,
  65. cancelReason: data.cancelReason,
  66. };
  67. post('/transflow/extra', postData).then(res => {
  68. uni.hideLoading();
  69. if(res.state == 200){
  70. uni.showModal({
  71. title: "提示",
  72. content: "操作成功!",
  73. showCancel: false,
  74. success: (res) => {
  75. if (res.confirm) {
  76. console.log("用户点击确定");
  77. if(this.type == 'start'){
  78. if(this.isShowTips){
  79. uni.navigateTo({
  80. url: `/pages/receiptpage/receiptpage`,
  81. });
  82. }else{
  83. // 触发自定义事件并传递参数给上一页
  84. uni.$emit('refresh', { refresh: true });
  85. // 跳转回上一页
  86. uni.navigateBack({
  87.     delta: 1
  88. });
  89. }
  90. }else if(this.type == 'end'){
  91. if(this.isShowTips){
  92. uni.navigateTo({
  93. url: `/pages/receiptpage/receiptpage`,
  94. });
  95. }else{
  96. this.$emit('refresh');
  97. }
  98. }
  99. } else if (res.cancel) {
  100. console.log("用户点击取消");
  101. }
  102. },
  103. });
  104. }else{
  105. uni.showToast({
  106. icon: "none",
  107. title: res.msg || "接口获取数据失败!",
  108. });
  109. }
  110. })
  111. },
  112. // 确认
  113. hosOk2(data) {
  114. console.log(data);
  115. const {
  116. accountName,
  117. account,
  118. accountId,
  119. cancelReason,
  120. } = data;
  121. if (!cancelReason) {
  122. //没有填写交接人
  123. uni.showModal({
  124. title: "提示",
  125. content: "请填写取消原因!",
  126. showCancel: false,
  127. success: function(res) {
  128. if (res.confirm) {
  129. console.log("用户点击确定");
  130. } else if (res.cancel) {
  131. console.log("用户点击取消");
  132. }
  133. },
  134. });
  135. return;
  136. }
  137. // 必填交接人
  138. if(this.cancelBloodHandover == 1){
  139. if (!accountName && !account) {
  140. //没有填写交接人
  141. uni.showModal({
  142. title: "提示",
  143. content: "请填写交接人工号!",
  144. showCancel: false,
  145. success: function(res) {
  146. if (res.confirm) {
  147. console.log("用户点击确定");
  148. } else if (res.cancel) {
  149. console.log("用户点击取消");
  150. }
  151. },
  152. });
  153. return;
  154. } else if ((!accountName && account) || (accountName && !account)) {
  155. //没有填写交接人
  156. uni.showModal({
  157. title: "提示",
  158. content: "请填写正确的交接人工号!",
  159. showCancel: false,
  160. success: function(res) {
  161. if (res.confirm) {
  162. console.log("用户点击确定");
  163. } else if (res.cancel) {
  164. console.log("用户点击取消");
  165. }
  166. },
  167. });
  168. return;
  169. }
  170. }
  171. this.hosModels2.disjunctor = false;
  172. this.cancelBloodHandler(data);
  173. },
  174. // 取消
  175. hosCancel2() {
  176. this.hosModels2.disjunctor = false;
  177. },
  178. // 取消发血弹窗
  179. showSelectAccount2(isShowTips = false) {
  180. this.isShowTips = isShowTips;
  181. this.hosModels2 = {
  182. content: `请填写取消送血原因和交接人信息`,
  183. disjunctor: true,
  184. tips: isShowTips ? '本患者取消送血后,工单将关闭!' : '',
  185. };
  186. },
  187. // 取消发血
  188. selectAccountHandler(data, index){
  189. if(this.cancelBlood != 1 || !this.signType4){
  190. return;
  191. }
  192. this.coopData = data;
  193. let arr = this.dataList.children.filter((v, i) => i !== index);
  194. if(arr.length){
  195. let flag = false;
  196. if(this.type == 'end'){
  197. // 其他患者的血都是"病房接收"状态
  198. flag = arr.map(v => v.children).flat().map(v => v.children).flat().every(v => v.state.value == 5);
  199. }
  200. this.showSelectAccount2(flag);
  201. }else{
  202. // 没有其他患者
  203. this.showSelectAccount2(true);
  204. }
  205. },
  206. },
  207. };
  208. </script>
  209. <style lang="less" scoped>
  210. .text{
  211. margin-right: 16rpx
  212. }
  213. </style>