scanning_B.vue 10 KB

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