scanning_B.vue 10 KB

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