scanning_B.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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=${
  87. data.taskType.associationType.value
  88. }&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${
  89. res.dept
  90. }&accountObj=${encodeURIComponent(
  91. JSON.stringify(accountObj)
  92. )}&deptId=${res.deptId}`,
  93. });
  94. } else {
  95. uni.navigateTo({
  96. url: `/pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1`,
  97. });
  98. }
  99. });
  100. }
  101. },
  102. // 执行工单
  103. orderSign(workOrder) {
  104. uni.showLoading({
  105. title: "加载中",
  106. mask: true,
  107. });
  108. let postData = {
  109. content: workOrder.startDept.qrcode,
  110. taskTypeId: workOrder.taskType.id,
  111. gdState: workOrder.gdState.id,
  112. };
  113. //检验二维码的有效性
  114. post("/dept/scanning", postData).then((result) => {
  115. this.currentCode = result.code;
  116. if (result.state == 200 || result.state == 201) {
  117. if (result.account) {
  118. this.nextDeptOrder_s(workOrder, {
  119. account: result.account,
  120. accountName: result.name,
  121. accountId: result.id,
  122. });
  123. } else {
  124. this.nextDeptOrder_s(workOrder);
  125. }
  126. } else if (result.state == "0000") {
  127. uni.hideLoading();
  128. this.showSelectAccount();
  129. } else {
  130. uni.hideLoading();
  131. uni.showToast({
  132. icon: "none",
  133. title: "请求失败!",
  134. });
  135. }
  136. });
  137. },
  138. // 建单并签到
  139. buildAndOrderSign(speId) {
  140. uni.showLoading({
  141. title: "加载中",
  142. mask: true,
  143. });
  144. post("/workerOrder/specimenCreateAndSign", {
  145. speId,
  146. }).then((res) => {
  147. if (res.state == 200 || res.state == 201) {
  148. uni.hideLoading();
  149. if (res.status == 200) {
  150. // 跳转到扫描科室
  151. // type1: res.type, //type类型
  152. // id: data.id, //工单ID
  153. // deptCode: code, //二维码
  154. // dept: res.dept //科室名称
  155. uni.navigateTo({
  156. url: `/pages/scanning_code/scanning_code?type=${
  157. res.workOrder.taskType.associationType.value
  158. }&type1=${res.type}&id=${res.workOrder.id}&deptCode=${
  159. this.currentCode
  160. }&dept=${res.dept}&accountObj=${encodeURIComponent(
  161. JSON.stringify(undefined)
  162. )}&deptId=${res.deptId}`,
  163. });
  164. } else {
  165. uni.navigateTo({
  166. 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`,
  167. });
  168. }
  169. } else if (res.state == "0000") {
  170. uni.hideLoading();
  171. this.currentCode = res.code;
  172. this.res.workOrder = res.workOrder;
  173. this.showSelectAccount();
  174. } else {
  175. uni.hideLoading();
  176. uni.showToast({
  177. icon: "none",
  178. title: res.msg || "请求失败!",
  179. });
  180. }
  181. });
  182. },
  183. // 填写交接人账号-确认
  184. hosOk(data) {
  185. console.log(data);
  186. const {
  187. accountName,
  188. account,
  189. accountId
  190. } = data;
  191. if (!accountName && !account) {
  192. //没有填写交接人
  193. uni.showModal({
  194. title: "提示",
  195. content: "请填写交接人账号!",
  196. showCancel: false,
  197. success: function(res) {
  198. if (res.confirm) {
  199. console.log("用户点击确定");
  200. } else if (res.cancel) {
  201. console.log("用户点击取消");
  202. }
  203. },
  204. });
  205. return;
  206. } else if ((!accountName && account) || (accountName && !account)) {
  207. //没有填写交接人
  208. uni.showModal({
  209. title: "提示",
  210. content: "请填写正确的交接人账号!",
  211. showCancel: false,
  212. success: function(res) {
  213. if (res.confirm) {
  214. console.log("用户点击确定");
  215. } else if (res.cancel) {
  216. console.log("用户点击取消");
  217. }
  218. },
  219. });
  220. return;
  221. }
  222. this.hosModels.disjunctor = false;
  223. uni.showLoading({
  224. title: "加载中",
  225. mask: true,
  226. });
  227. this.nextDeptOrder_s(this.res.workOrder, data);
  228. },
  229. // 填写交接人账号-取消
  230. hosCancel() {
  231. this.hosModels.disjunctor = false;
  232. },
  233. // 填写交接人账号弹窗
  234. showSelectAccount() {
  235. this.hosModels = {
  236. title: "填写交接人账号",
  237. disjunctor: true,
  238. };
  239. },
  240. // 知道了
  241. showAlert() {
  242. uni.navigateTo({
  243. url: "../receiptpage/receiptpage",
  244. });
  245. },
  246. },
  247. onLoad(options) {
  248. this.res = JSON.parse(options.res);
  249. this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  250. console.log(this.infoDATA);
  251. // #ifdef APP-PLUS
  252. webHandle("no", "app");
  253. // #endif
  254. // #ifdef H5
  255. webHandle("no", "wx");
  256. // #endif
  257. },
  258. };
  259. </script>
  260. <style lang="less">
  261. .Scanning_B {
  262. padding: 0px 74rpx;
  263. .Scanning_top {
  264. height: 270rpx;
  265. .Scanning_top_icon {
  266. width: 140rpx;
  267. height: 140rpx;
  268. margin: 0 auto;
  269. margin-top: 116rpx;
  270. border-radius: 50%;
  271. line-height: 140rpx;
  272. text-align: center;
  273. .cubeic-ok {
  274. font-size: 140rpx;
  275. color: #35b34a;
  276. }
  277. .cubeic-close {
  278. font-size: 140rpx;
  279. color: #ff3b53;
  280. }
  281. }
  282. .Scanning_top_text {
  283. .text1 {
  284. margin-top: 40rpx;
  285. font-size: 48rpx;
  286. text-align: center;
  287. }
  288. }
  289. }
  290. .Scanning_cont {
  291. font-size: 32rpx;
  292. view {
  293. margin-bottom: 16rpx;
  294. text-align: center;
  295. }
  296. .text {
  297. margin-top: 24rpx;
  298. color: #35b34a;
  299. }
  300. .text1 {
  301. margin-top: 24rpx;
  302. color: #ff3b53;
  303. }
  304. }
  305. .foot_btn {
  306. line-height: 88rpx;
  307. height: 100rpx;
  308. margin-top: 40rpx;
  309. display: flex;
  310. justify-content: center;
  311. .btn3 {
  312. flex: 1;
  313. height: 88rpx;
  314. background-image: linear-gradient(to right, #72c172, #3bb197);
  315. color: #fff;
  316. border-radius: 8rpx;
  317. font-size: 32rpx;
  318. margin-top: 16rpx;
  319. margin-right: 16rpx;
  320. text-align: center;
  321. &:last-of-type {
  322. margin-right: 0;
  323. }
  324. }
  325. }
  326. }
  327. </style>