smallScreen.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="smallScreen">
  3. <view class="smallScreen_scan" @click="Scan_ss(sData,sType)">
  4. <slot></slot>
  5. </view>
  6. <!-- 填写交接人账号弹窗 -->
  7. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  8. @cancel="hosCancel">
  9. </selectAccount>
  10. </view>
  11. </template>
  12. <script>
  13. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  14. import {
  15. post,
  16. SM
  17. } from "../../http/http.js";
  18. export default {
  19. data() {
  20. return {
  21. currentCode: '', //当前小扫描的科室二维码
  22. currentData: {}, //当前小扫描的工单对象
  23. // 填写交接人账号弹窗model
  24. hosModels: {
  25. disjunctor: false,
  26. },
  27. }
  28. },
  29. props:{
  30. sData:{
  31. type:Object
  32. },
  33. sType:{
  34. type:Number
  35. }
  36. },
  37. methods: {
  38. // 如果不是静配,药配,标本配送,标本轮巡
  39. // 科室签到(小扫描)
  40. nextDeptOrder_ss(data, accountObj) {
  41. let isKs = 0;
  42. let ids = [];
  43. let id = data.id;
  44. ids.push(id);
  45. let list = {
  46. code: "",
  47. ids: ids,
  48. };
  49. let code = "";
  50. let type = "";
  51. if (this.currentCode) {
  52. let gdStateValue = data.gdState.value; //工单状态value
  53. let associationTypeValue = data.taskType.associationType.value; //关联类型value
  54. // 患者陪检,并且工单状态是待到达
  55. if (
  56. gdStateValue == "4" &&
  57. associationTypeValue == "inspect"
  58. ) {
  59. list.code = this.currentCode; //其他
  60. type = "handleIns";
  61. }
  62. // 其他临床服务,并且工单状态是待到达||工单状态待送达
  63. if (
  64. (associationTypeValue == "other" &&
  65. gdStateValue == "4") ||
  66. gdStateValue == "5"
  67. ) {
  68. code = this.currentCode;
  69. type = "orderSign/" + code;
  70. list = {
  71. ids
  72. };
  73. if (accountObj) {
  74. list.handover = [accountObj.accountId];
  75. }
  76. isKs = 1;
  77. }
  78. if (
  79. (gdStateValue == "5" &&
  80. associationTypeValue == "inspect") ||
  81. associationTypeValue == "patientTransport"
  82. ) {
  83. code = this.currentCode;
  84. type = "orderSign/" + code;
  85. list = {
  86. ids
  87. };
  88. if (accountObj) {
  89. list.handover = [accountObj.accountId];
  90. }
  91. isKs = 1;
  92. }
  93. if (gdStateValue == "8") {
  94. code = this.currentCode; //患者陪检--检查
  95. type = "orderSign/" + code;
  96. list = {
  97. ids
  98. };
  99. if (accountObj) {
  100. list.handover = [accountObj.accountId];
  101. }
  102. isKs = 1;
  103. }
  104. if (
  105. gdStateValue == "4" &&
  106. associationTypeValue == "patientTransport"
  107. ) {
  108. list = {
  109. code: this.currentCode, //患者转运--检查
  110. ids: ids,
  111. };
  112. type = "handleTrans";
  113. }
  114. post("/workerOrder/" + type, list).then((res) => {
  115. uni.hideLoading();
  116. if (res) {
  117. if (res.status == 200) {
  118. if (
  119. gdStateValue == "4" &&
  120. associationTypeValue == "other"
  121. ) {
  122. uni.navigateTo({
  123. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  124. });
  125. }
  126. if (
  127. gdStateValue == "4" &&
  128. associationTypeValue != "other"
  129. ) {
  130. uni.navigateTo({
  131. url: `../../pages/scanning_Result/scanning_Result?type=${
  132. associationTypeValue
  133. }&type1=${res.type}&id=${data.id}&deptCode=${
  134. list.code
  135. }&patient=${res.patient}&patientCode=${
  136. res.patientCode
  137. }&deptName=${res.deptName}&bedNum=${
  138. res.bedNum
  139. }&status=${res.status}&msg=${
  140. res.msg
  141. }&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  142. });
  143. }
  144. if (gdStateValue == "8") {
  145. uni.navigateTo({
  146. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  147. });
  148. }
  149. if (gdStateValue == "5") {
  150. uni.navigateTo({
  151. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  152. });
  153. }
  154. } else {
  155. console.log(res, "扫描失败");
  156. if (res.type == "trans-ddd-1") {
  157. //起点科室扫描腕带码失败
  158. uni.navigateTo({
  159. url: `../../pages/scanning_Result/scanning_Result?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}`,
  160. });
  161. } else {
  162. uni.navigateTo({
  163. url: `../../pages/scanning_Result/scanning_Result?type=${
  164. associationTypeValue
  165. }&type1=${res.type}&id=${data.id}&status=600&msg=${
  166. res.msg
  167. }&isKs=${isKs}&model=${encodeURIComponent(
  168. JSON.stringify(res)
  169. )}`,
  170. });
  171. }
  172. }
  173. } else {
  174. uni.navigateTo({
  175. url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}`,
  176. });
  177. }
  178. });
  179. }
  180. },
  181. // 如果不是患者陪检或患者转运或其他
  182. // 科室签到
  183. nextDeptOrder_s(data, accountObj) {
  184. console.log(data, accountObj)
  185. let ids = [];
  186. let id = data.id;
  187. ids.push(id);
  188. let code = "";
  189. let postData = {
  190. ids
  191. };
  192. if (accountObj) {
  193. postData.handover = [accountObj.accountId];
  194. }
  195. if (this.currentCode) {
  196. code = this.currentCode;
  197. // 科室签到
  198. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  199. uni.hideLoading();
  200. if (res.status == 200) {
  201. // 跳转到扫描科室
  202. // type1: res.type, //type类型
  203. // id: data.id, //工单ID
  204. // deptCode: code, //二维码
  205. // dept: res.dept //科室名称
  206. uni.navigateTo({
  207. 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))}`,
  208. });
  209. } else {
  210. uni.navigateTo({
  211. url: `../../pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1`,
  212. });
  213. }
  214. });
  215. }
  216. },
  217. // type==1 如果不是静配,药配,标本配送,标本轮巡
  218. // type==2 如果不是患者陪检,患者转运,其他
  219. // 扫码(小扫描)
  220. Scan_ss(data, type) {
  221. this.currentData = data;
  222. console.log(data, 'data');
  223. SM().then((ress1) => {
  224. uni.showLoading({
  225. title: "加载中",
  226. mask: true,
  227. });
  228. //检验二维码的有效性
  229. post("/dept/scanning", {
  230. content: ress1,
  231. taskTypeId: data.taskType.id,
  232. gdState: data.gdState.id,
  233. }).then((result) => {
  234. this.currentCode = result.code;
  235. if (result.state == 200 || result.state == 201) {
  236. if (result.account) {
  237. if (type == 1) {
  238. this.nextDeptOrder_ss(this.currentData, {
  239. account: result.account,
  240. accountName: result.name,
  241. accountId: result.id,
  242. });
  243. } else if (type == 2) {
  244. this.nextDeptOrder_s(this.currentData, {
  245. account: result.account,
  246. accountName: result.name,
  247. accountId: result.id,
  248. });
  249. }
  250. } else {
  251. this.nextDeptOrder_ss(this.currentData);
  252. }
  253. } else if (result.state == '0000') {
  254. uni.hideLoading();
  255. this.showSelectAccount(); //yeye
  256. } else {
  257. uni.hideLoading();
  258. uni.showToast({
  259. icon: "none",
  260. title: "请求失败!",
  261. });
  262. }
  263. });
  264. });
  265. },
  266. // 填写交接人账号-确认
  267. hosOk(data) {
  268. console.log(data);
  269. const {
  270. accountName,
  271. account,
  272. accountId
  273. } = data;
  274. if (!accountName && !account) {
  275. //没有填写交接人
  276. uni.showModal({
  277. title: '提示',
  278. content: "请填写交接人账号!",
  279. showCancel: false,
  280. success: function(res) {
  281. if (res.confirm) {
  282. console.log('用户点击确定');
  283. } else if (res.cancel) {
  284. console.log('用户点击取消');
  285. }
  286. }
  287. });
  288. return;
  289. } else if (!accountName && account || accountName && !account) {
  290. //没有填写交接人
  291. uni.showModal({
  292. title: '提示',
  293. content: "请填写正确的交接人账号!",
  294. showCancel: false,
  295. success: function(res) {
  296. if (res.confirm) {
  297. console.log('用户点击确定');
  298. } else if (res.cancel) {
  299. console.log('用户点击取消');
  300. }
  301. }
  302. });
  303. return;
  304. }
  305. this.hosModels.disjunctor = false;
  306. let associationTypeValue = this.currentData.taskType.associationType.value;
  307. console.log(associationTypeValue)
  308. if (
  309. associationTypeValue !== "patientTransport" &&
  310. associationTypeValue !== "inspect" &&
  311. associationTypeValue !== "other"
  312. ) {
  313. this.nextDeptOrder_s(this.currentData, data);
  314. }
  315. if (
  316. associationTypeValue !== "jPBag" &&
  317. associationTypeValue !== "drugsBag" &&
  318. associationTypeValue !== "specimen" &&
  319. associationTypeValue !== "specimenPlan"
  320. ) {
  321. this.nextDeptOrder_ss(this.currentData, data);
  322. }
  323. },
  324. // 填写交接人账号-取消
  325. hosCancel() {
  326. this.hosModels.disjunctor = false;
  327. },
  328. // 填写交接人账号弹窗
  329. showSelectAccount() {
  330. this.hosModels = {
  331. title: '填写交接人账号',
  332. disjunctor: true,
  333. }
  334. },
  335. },
  336. components: {
  337. selectAccount
  338. }
  339. };
  340. </script>
  341. <style lang="less">
  342. .smallScreen{
  343. width: 100%;
  344. height: 100%;
  345. .smallScreen_scan{
  346. width: 100%;
  347. height: 100%;
  348. }
  349. }
  350. </style>