continueScanning.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">{{scanCount}}</view>
  5. <view class="tips" v-if="workOrder.gdState && workOrder.gdState.value == 4">您已到达<text class="red">起点科室-{{workOrder.startDept.dept}},</text>请扫描核对药包码。</view>
  6. <view class="tips" v-if="workOrder.gdState && workOrder.gdState.value == 5">您已到达<text class="red">终点科室-{{workOrder.endDeptNames}}</text>,请扫描核对药包码。</view>
  7. </view>
  8. <view class="Scanning_cont">
  9. <scroll-view scroll-y class="scrollContent">
  10. <view class="column">
  11. <view class="name">单号:</view>
  12. <view class="value">{{drugsBag.packid}}</view>
  13. </view>
  14. <view class="column">
  15. <view class="name">申请科室:</view>
  16. <view class="value">{{drugsBag.target ? drugsBag.target.dept : ''}}</view>
  17. </view>
  18. <view class="column">
  19. <view class="name">发药科室:</view>
  20. <view class="value">{{drugsBag.launch ? drugsBag.launch.dept : ''}}</view>
  21. </view>
  22. <view class="column" v-if="config.showDrugsBagTypeCount == 1">
  23. <view class="name">种类数:</view>
  24. <view class="value">{{drugsBag.drugsTypeCount}}</view>
  25. </view>
  26. <view class="column" v-if="config.showDrugsBagTypeCount == 1">
  27. <view class="name">药品数:</view>
  28. <view class="value">{{drugsBag.drugsCount}}</view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. <view class="foot_btn_spe">
  33. <view class="column">
  34. <view class="btn" @click="Scanning_again()">继续扫描</view>
  35. <view class="btn" @click="hand_again()">手动录入</view>
  36. </view>
  37. <view class="column">
  38. <view class="btn" @click="checkHandover()">核对交接</view>
  39. </view>
  40. </view>
  41. <!-- 手动查询药品弹窗 -->
  42. <handViewDrugsBag v-if="drugbagModels.disjunctor" :title="drugbagModels.title"
  43. :disjunctor="drugbagModels.disjunctor" @ok="drugbagOk" @cancel="drugbagCancel">
  44. </handViewDrugsBag>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. get,
  50. post,
  51. SM,
  52. webHandle
  53. } from "@/http/http.js";
  54. export default {
  55. data() {
  56. return {
  57. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  58. config: {}, //配置
  59. workOrder: {}, //工单信息
  60. drugsBag: {}, //药包信息
  61. queryObj: {}, //路由传递过来的数据
  62. scanCount: '', //已扫描数量
  63. SMFlag: true,
  64. // 手动查询弹窗model
  65. drugbagModels: {
  66. disjunctor: false,
  67. },
  68. };
  69. },
  70. onShow() {
  71. this.SMFlag = true;
  72. },
  73. methods: {
  74. // 手动查询药品-确认
  75. drugbagOk(data) {
  76. console.log(data);
  77. if (!data.id) {
  78. //没有查询到药品
  79. uni.showModal({
  80. title: '提示',
  81. content: "没有查询到发药单号!",
  82. showCancel: false,
  83. success: function(res) {
  84. if (res.confirm) {
  85. console.log('用户点击确定');
  86. } else if (res.cancel) {
  87. console.log('用户点击取消');
  88. }
  89. }
  90. });
  91. return;
  92. }
  93. this.drugbagModels.disjunctor = false;
  94. this.hand_scanning_common(data.packid, 'hand');
  95. },
  96. // 手动查询药品-取消
  97. drugbagCancel() {
  98. this.drugbagModels.disjunctor = false;
  99. },
  100. // 手动查询药品弹窗
  101. showHandViewDrugsbag() {
  102. this.drugbagModels = {
  103. title: '填写发药单号',
  104. disjunctor: true,
  105. }
  106. },
  107. // 手动录入
  108. hand_again() {
  109. this.showHandViewDrugsbag();
  110. },
  111. // 核对交接
  112. checkHandover(){
  113. uni.navigateTo({
  114. url: `/pages/newDrug/checkPage/checkPage?drugsBagType=${this.queryObj.drugsBagType}&orderId=${this.queryObj.orderId}`,
  115. });
  116. },
  117. // 继续扫描
  118. Scanning_again(isFlag = false) {
  119. if (!this.SMFlag) {
  120. return;
  121. }
  122. this.SMFlag = false;
  123. SM().then((ress1) => {
  124. this.hand_scanning_common(ress1, 'scan', isFlag);
  125. }).catch(err => {
  126. this.SMFlag = true;
  127. });
  128. },
  129. // 手动输入和扫码公共方法
  130. hand_scanning_common(ress1, type, isFlag = false) {
  131. // ----------------
  132. uni.showLoading({
  133. title: "加载中",
  134. mask: true,
  135. });
  136. //检验二维码的有效性
  137. post("/dept/scanning", {
  138. content: ress1,
  139. }).then((result) => {
  140. this.SMFlag = true;
  141. if (result.state == 200 || result.state == 201) {
  142. let codes = result.code;
  143. if (codes) {
  144. this.input_common(ress1, type, isFlag);
  145. } else {
  146. uni.hideLoading();
  147. }
  148. } else {
  149. uni.hideLoading();
  150. uni.showToast({
  151. icon: "none",
  152. title: result.info || "接口获取数据失败!",
  153. });
  154. }
  155. });
  156. // ------------------------------
  157. },
  158. // 录入到工单
  159. input_common(ress1, type, isFlag = false){
  160. uni.showLoading({
  161. title: "加载中",
  162. mask: true,
  163. });
  164. post("/transflow/scanBind", { type: this.queryObj.drugsBagType, orderId: this.queryObj.orderId, code: ress1 }).then((ress) => {
  165. uni.hideLoading();
  166. if (ress.state == 200) {
  167. if(ress.data.msg){
  168. uni.showToast({
  169. icon: "none",
  170. title: ress.data.msg || "接口获取数据失败!",
  171. });
  172. }else{
  173. uni.redirectTo({
  174. url: `/pages/newDrug/continueScanning/continueScanning?drugsBagType=${this.queryObj.drugsBagType}&orderId=${this.queryObj.orderId}&scanOrHand=${type}&drugsBagId=${ress.data.dto.id}&orderStateValue=${this.queryObj.orderStateValue}`,
  175. });
  176. }
  177. } else {
  178. uni.showToast({
  179. icon: "none",
  180. title: ress.msg || "接口获取数据失败!",
  181. });
  182. }
  183. });
  184. },
  185. //获取页面信息
  186. getInfo(){
  187. uni.showLoading({
  188. title: "加载中",
  189. mask: true,
  190. });
  191. let info$ = post(`/transflow/scanInfo`, {type: this.queryObj.drugsBagType, id: +this.queryObj.drugsBagId, orderStateValue: this.queryObj.orderStateValue, orderId: +this.queryObj.orderId});
  192. let config$ = post(`/simple/data/fetchDataList/taskTypeConfig`, {
  193. "idx": 0,
  194. "sum": 1,
  195. "taskTypeConfig": {
  196. "taskTypeDTO": {
  197. "hosId": {
  198. "id": this.hosId
  199. },
  200. "ordinaryField": {
  201. "key": "ordinary_field",
  202. "value": this.queryObj.drugsBagType
  203. }
  204. }
  205. }
  206. });
  207. Promise.all([info$, config$]).then(result => {
  208. uni.hideLoading();
  209. let [info, config] = result || [];
  210. if(info.state == 200){
  211. if(info.data){
  212. this.scanCount = info.data.scanCount;
  213. this.drugsBag = info.data.dto || {};
  214. let workOrder = info.data.workOrder || {};
  215. workOrder.endDeptNames = workOrder.endDepts.map(v=>v.dept).toString();
  216. this.workOrder = workOrder;
  217. }
  218. }else{
  219. uni.showToast({
  220. icon: "none",
  221. title: info.msg || "接口获取数据失败!",
  222. });
  223. }
  224. if(config.status == 200){
  225. let list = config.list || [];
  226. this.config = list.length ? list[0] : {};
  227. }else{
  228. uni.showToast({
  229. icon: "none",
  230. title: config.msg || "接口获取数据失败!",
  231. });
  232. }
  233. })
  234. },
  235. },
  236. onLoad(options) {
  237. console.log(options, "options");
  238. this.queryObj = options;
  239. this.getInfo();
  240. // #ifdef APP-PLUS
  241. webHandle("no", "app");
  242. // #endif
  243. // #ifdef H5
  244. webHandle("no", "wx");
  245. // #endif
  246. },
  247. };
  248. </script>
  249. <style lang="less" scoped>
  250. .Scanning_Result {
  251. background: #FAFBFD;
  252. padding: 0 24rpx;
  253. display: flex;
  254. flex-direction: column;
  255. height: 100vh;
  256. .Scanning_top {
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. .tips{
  261. margin: 24rpx 0 40rpx;
  262. text-align: justify;
  263. font-weight: bold;
  264. font-size: 30rpx;
  265. }
  266. .Scanning_top_icon {
  267. font-size: 140rpx;
  268. color: #FF0000;
  269. font-weight: bold;
  270. }
  271. }
  272. .Scanning_cont {
  273. flex: 1;
  274. min-height: 0;
  275. display: flex;
  276. flex-direction: column;
  277. .scrollContent{
  278. flex: 1;
  279. min-height: 0;
  280. }
  281. .column{
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. font-size: 30rpx;
  286. margin-bottom: 32rpx;
  287. .name{
  288. font-weight: bold;
  289. word-break: break-all;
  290. flex-shrink: 0;
  291. }
  292. .value{
  293. word-break: break-all;
  294. }
  295. }
  296. }
  297. .foot_btn_spe {
  298. margin: 24rpx 0;
  299. display: flex;
  300. flex-direction: column;
  301. align-items: center;
  302. gap: 24rpx;
  303. font-weight: bold;
  304. .column{
  305. width: 100%;
  306. height: 78rpx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. gap: 24rpx;
  311. .btn {
  312. height: 100%;
  313. flex: 1;
  314. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  315. color: #fff;
  316. border-radius: 4rpx;
  317. font-size: 30rpx;
  318. display: flex;
  319. justify-content: center;
  320. align-items: center;
  321. }
  322. }
  323. }
  324. }
  325. </style>