scanning_B.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="Scanning_B">
  3. <view class="Scanning_top" v-if="res.status==200">
  4. <view class="Scanning_top_icon">
  5. <text class="cubeic-ok icon_transport transport-duigou"></text>
  6. </view>
  7. <view class="Scanning_top_text">
  8. <view class="text1">扫描成功</view>
  9. </view>
  10. </view>
  11. <view class="Scanning_top" v-if="res.status!=200">
  12. <view class="Scanning_top_icon">
  13. <text class="cubeic-close icon_transport transport-shibai"></text>
  14. </view>
  15. <view class="Scanning_top_text">
  16. <view class="text1">扫描失败</view>
  17. </view>
  18. </view>
  19. <view class="Scanning_cont" v-if="res.status==200">
  20. <view>标本类型 : {{infoDATA.stype.name||'-'}}</view>
  21. <view>标本编码 : {{infoDATA.scode||'-'}}</view>
  22. <view>患者床号 : {{infoDATA.bedNum||'-'}}</view>
  23. <view>申请科室 : {{infoDATA.sickRoom||'-'}}</view>
  24. <view>检查科室 : {{infoDATA.checkDept||'-'}}</view>
  25. </view>
  26. <view class="Scanning_cont" v-if="res.status!=200">
  27. <view>{{res.msg}}</view>
  28. </view>
  29. <view class="foot_btn">
  30. <view class="btn3" @click="showAlert()">知道了</view>
  31. <block v-if="res.scanCodeSpecimenOrderSign==1">
  32. <view class="btn3" @click="orderSign(res.workOrder)" v-if="res.workOrder">执行工单</view>
  33. <view class="btn3" @click="buildAndOrderSign(res.data.id)" v-if="!res.workOrder && res.data">建单并签到</view>
  34. </block>
  35. </view>
  36. <!-- 填写交接人账号弹窗 -->
  37. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  38. @cancel="hosCancel">
  39. </selectAccount>
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. post,
  45. webHandle
  46. } from '../../http/http.js'
  47. export default {
  48. data() {
  49. return {
  50. infoDATA: {},
  51. res: {},
  52. // 填写交接人账号弹窗model
  53. hosModels: {
  54. disjunctor: false,
  55. },
  56. currentCode: ''
  57. };
  58. },
  59. methods: {
  60. // 如果不是患者陪检或患者转运或其他
  61. // 科室签到
  62. nextDeptOrder_s(data, accountObj) {
  63. console.log(data, accountObj)
  64. let ids = [];
  65. let id = data.id;
  66. ids.push(id);
  67. let code = "";
  68. let postData = {
  69. ids
  70. };
  71. if (accountObj) {
  72. postData.handover = [accountObj.accountId];
  73. }
  74. if (this.currentCode) {
  75. code = this.currentCode;
  76. // 科室签到
  77. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  78. uni.hideLoading();
  79. if (res.status == 200) {
  80. // 跳转到扫描科室
  81. // type1: res.type, //type类型
  82. // id: data.id, //工单ID
  83. // deptCode: code, //二维码
  84. // dept: res.dept //科室名称
  85. uni.navigateTo({
  86. url: `/pages/scanning_code/scanning_code?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  87. });
  88. } else {
  89. uni.navigateTo({
  90. url: `/pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1`,
  91. });
  92. }
  93. });
  94. }
  95. },
  96. // 执行工单
  97. orderSign(workOrder) {
  98. uni.showLoading({
  99. title: "加载中",
  100. mask: true,
  101. });
  102. let postData = {
  103. content: workOrder.startDept.qrcode,
  104. taskTypeId: workOrder.taskType.id,
  105. gdState: workOrder.gdState.id,
  106. };
  107. //检验二维码的有效性
  108. post("/dept/scanning", postData).then((result) => {
  109. this.currentCode = result.code;
  110. if (result.state == 200 || result.state == 201) {
  111. if (result.account) {
  112. this.nextDeptOrder_s(workOrder, {
  113. account: result.account,
  114. accountName: result.name,
  115. accountId: result.id,
  116. });
  117. } else {
  118. this.nextDeptOrder_s(workOrder);
  119. }
  120. } else if (result.state == '0000') {
  121. uni.hideLoading();
  122. this.showSelectAccount();
  123. } else {
  124. uni.hideLoading();
  125. uni.showToast({
  126. icon: "none",
  127. title: "请求失败!",
  128. });
  129. }
  130. });
  131. },
  132. // 建单并签到
  133. buildAndOrderSign(speId) {
  134. uni.showLoading({
  135. title: "加载中",
  136. mask: true,
  137. });
  138. post("/workerOrder/specimenCreateAndSign", {
  139. speId
  140. }).then((res) => {
  141. if (res.state == 200 || res.state == 201) {
  142. uni.hideLoading();
  143. if (res.status == 200) {
  144. // 跳转到扫描科室
  145. // type1: res.type, //type类型
  146. // id: data.id, //工单ID
  147. // deptCode: code, //二维码
  148. // dept: res.dept //科室名称
  149. uni.navigateTo({
  150. url: `/pages/scanning_code/scanning_code?type=${res.workOrder.taskType.associationType.value}&type1=${res.type}&id=${res.workOrder.id}&deptCode=${this.currentCode}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(undefined))}&deptId=${res.deptId}`,
  151. });
  152. } else {
  153. uni.navigateTo({
  154. url: `/pages/scanning_Result/scanning_Result?type=${res.workOrder.taskType.associationType.value}&type1=${res.type}&id=${res.workOrder.id}&status=600&msg=${res.msg}&isKs=1`,
  155. });
  156. }
  157. } else if (res.state == '0000') {
  158. uni.hideLoading();
  159. this.currentCode = res.code;
  160. this.res.workOrder = res.workOrder;
  161. this.showSelectAccount();
  162. } else {
  163. uni.hideLoading();
  164. uni.showToast({
  165. icon: "none",
  166. title: "请求失败!",
  167. });
  168. }
  169. })
  170. },
  171. // 填写交接人账号-确认
  172. hosOk(data) {
  173. console.log(data);
  174. const {
  175. accountName,
  176. account,
  177. accountId
  178. } = data;
  179. if (!accountName && !account) {
  180. //没有填写交接人
  181. uni.showModal({
  182. title: '提示',
  183. content: "请填写交接人账号!",
  184. showCancel: false,
  185. success: function(res) {
  186. if (res.confirm) {
  187. console.log('用户点击确定');
  188. } else if (res.cancel) {
  189. console.log('用户点击取消');
  190. }
  191. }
  192. });
  193. return;
  194. } else if (!accountName && account || accountName && !account) {
  195. //没有填写交接人
  196. uni.showModal({
  197. title: '提示',
  198. content: "请填写正确的交接人账号!",
  199. showCancel: false,
  200. success: function(res) {
  201. if (res.confirm) {
  202. console.log('用户点击确定');
  203. } else if (res.cancel) {
  204. console.log('用户点击取消');
  205. }
  206. }
  207. });
  208. return;
  209. }
  210. this.hosModels.disjunctor = false;
  211. uni.showLoading({
  212. title: "加载中",
  213. mask: true,
  214. });
  215. this.nextDeptOrder_s(this.res.workOrder, data);
  216. },
  217. // 填写交接人账号-取消
  218. hosCancel() {
  219. this.hosModels.disjunctor = false;
  220. },
  221. // 填写交接人账号弹窗
  222. showSelectAccount() {
  223. this.hosModels = {
  224. title: '填写交接人账号',
  225. disjunctor: true,
  226. }
  227. },
  228. // 知道了
  229. showAlert() {
  230. uni.navigateTo({
  231. url: '../receiptpage/receiptpage'
  232. });
  233. }
  234. },
  235. onLoad(options) {
  236. this.res = JSON.parse(options.res);
  237. this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  238. console.log(this.infoDATA)
  239. // #ifdef APP-PLUS
  240. webHandle('no', 'app')
  241. // #endif
  242. // #ifdef H5
  243. webHandle('no', 'wx')
  244. // #endif
  245. }
  246. };
  247. </script>
  248. <style lang="less">
  249. .Scanning_B {
  250. padding: 0px 74rpx;
  251. .Scanning_top {
  252. height: 270rpx;
  253. .Scanning_top_icon {
  254. width: 140rpx;
  255. height: 140rpx;
  256. margin: 0 auto;
  257. margin-top: 116rpx;
  258. border-radius: 50%;
  259. line-height: 140rpx;
  260. text-align: center;
  261. .cubeic-ok {
  262. font-size: 140rpx;
  263. color: #35b34a
  264. }
  265. .cubeic-close {
  266. font-size: 140rpx;
  267. color: #ff3b53;
  268. }
  269. }
  270. .Scanning_top_text {
  271. .text1 {
  272. margin-top: 40rpx;
  273. font-size: 48rpx;
  274. text-align: center;
  275. }
  276. }
  277. }
  278. .Scanning_cont {
  279. font-size: 32rpx;
  280. view {
  281. margin-bottom: 16rpx;
  282. text-align: center;
  283. }
  284. .text {
  285. margin-top: 24rpx;
  286. color: #35b34a;
  287. }
  288. .text1 {
  289. margin-top: 24rpx;
  290. color: #ff3b53;
  291. }
  292. }
  293. .foot_btn {
  294. line-height: 88rpx;
  295. height: 100rpx;
  296. margin-top: 40rpx;
  297. display: flex;
  298. justify-content: center;
  299. .btn3 {
  300. flex: 1;
  301. height: 88rpx;
  302. background-image: linear-gradient(to right, #72c172, #3bb197);
  303. color: #fff;
  304. border-radius: 8rpx;
  305. font-size: 32rpx;
  306. margin-top: 16rpx;
  307. margin-right: 16rpx;
  308. text-align: center;
  309. &:last-of-type {
  310. margin-right: 0;
  311. }
  312. }
  313. }
  314. }
  315. </style>