smallScreen.vue 12 KB

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