continueScanning.vue 10 KB

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