checkPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">
  5. <text :class="{ red: workOrder.gdState && workOrder.gdState.value == 4 }">{{workOrder.startDept ? workOrder.startDept.dept : ''}}</text>
  6. <text class="newicon newicon-arrow-right-full"></text>
  7. <text :class="{ red: workOrder.gdState && workOrder.gdState.value == 5 }">{{workOrder.endDeptNames || ''}}</text>
  8. </view>
  9. </view>
  10. <view class="Scanning_cont">
  11. <view class="column head">
  12. <view class="value1">单号<text class="red">({{drugsBagList.length}})</text></view>
  13. <view class="value2">种类数</view>
  14. <view class="value3">总数</view>
  15. </view>
  16. <scroll-view scroll-y class="scrollContent">
  17. <view class="column" v-for="item in drugsBagList" :key="item.id" @click="toDetail(item.id)">
  18. <view class="value1">{{item.packid}}</view>
  19. <view class="value2">{{item.drugsTypeCount}}</view>
  20. <view class="value3">{{item.drugsCount}}</view>
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <view class="foot_btn_spe">
  25. <view class="column">
  26. <view class="btn" @click="scanCode()">扫一扫交接</view>
  27. <view class="btn" @click="fillInManually(config.drugsStartManual.value)" v-if="workOrder.gdState && workOrder.gdState.value == 4 && config.drugsStartManual">{{config.drugsStartManual.name}}</view>
  28. <view class="btn" @click="fillInManually(config.drugsEndManual.value)" v-if="workOrder.gdState && workOrder.gdState.value == 5 && config.drugsEndManual">{{config.drugsEndManual.name}}</view>
  29. </view>
  30. </view>
  31. <!-- 填写交接人工号弹窗 -->
  32. <selectAccount @click.stop.native v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  33. @cancel="hosCancel">
  34. </selectAccount>
  35. <!-- 动态密钥 -->
  36. <numberKeyModel v-if="showKey" :keyArr="keyArr" @cancel="showKey = false" @confirm="confirmKey($event)"></numberKeyModel>
  37. </view>
  38. </template>
  39. <script>
  40. import numberKeyModel from "@/components/numberKeyModel/numberKeyModel.vue";
  41. import {
  42. get,
  43. post,
  44. SM,
  45. webHandle
  46. } from "@/http/http.js";
  47. export default {
  48. data() {
  49. return {
  50. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  51. drugsBagList: [], //药包列表
  52. queryObj: {}, //路由传递过来的数据
  53. workOrder: {}, //工单信息
  54. config: {}, //配置
  55. SMFlag: true, //控制扫码
  56. // 填写交接人工号弹窗model
  57. hosModels: {
  58. disjunctor: false,
  59. },
  60. showKey:false,
  61. keyNum:4, //密钥位数
  62. isNumberKey:false, //是否开启动态密钥
  63. keyArr: [],
  64. };
  65. },
  66. components: {
  67. numberKeyModel,
  68. },
  69. onShow() {
  70. this.SMFlag = true;
  71. },
  72. methods: {
  73. // 获取配置
  74. getConfig() {
  75. let postData = {
  76. idx: 0,
  77. sum: 9999,
  78. hospitalConfig:{
  79. hosId:this.hosId,
  80. model:"all"
  81. }
  82. };
  83. post("/simple/data/fetchDataList/hospitalConfig",postData).then((result) => {
  84. if (result.status == 200) {
  85. this.keyArr = []
  86. for(let i of result.list){
  87. if(i.key=='digitalSecretKey'){
  88. if(i.value==1){
  89. this.isNumberKey = true
  90. }else{
  91. this.isNumberKey = false
  92. }
  93. }else if(i.key=='numberDigitalSecretKey'){
  94. this.keyNum = Number(i.value)
  95. }
  96. }
  97. for(let i = 0; i < this.keyNum; i++){
  98. this.keyArr.push({
  99. value:null
  100. })
  101. }
  102. console.log(444,this.keyArr)
  103. }
  104. });
  105. },
  106. confirmKey(data){
  107. this.padChange(data)
  108. this.showKey = false
  109. },
  110. isShowKey(){
  111. this.showKey = true
  112. },
  113. padChange(scannerCode){
  114. if(!this.isNumberKey){
  115. scannerCode = scannerCode.replace('\n','')
  116. }
  117. this.bigScan(scannerCode);
  118. },
  119. // 手动填写
  120. fillInManually(value){
  121. if(value == 1){
  122. // 填写工号
  123. this.showSelectAccount();
  124. }else if(value == 2){
  125. // 动态密钥
  126. this.isShowKey();
  127. }
  128. },
  129. // 填写交接人工号-确认
  130. hosOk(data) {
  131. console.log(data);
  132. const {
  133. accountName,
  134. account,
  135. accountId
  136. } = data;
  137. if (!accountName && !account) {
  138. //没有填写交接人
  139. uni.showModal({
  140. title: "提示",
  141. content: "请填写交接人工号!",
  142. showCancel: false,
  143. success: function(res) {
  144. if (res.confirm) {
  145. console.log("用户点击确定");
  146. } else if (res.cancel) {
  147. console.log("用户点击取消");
  148. }
  149. },
  150. });
  151. return;
  152. } else if ((!accountName && account) || (accountName && !account)) {
  153. //没有填写交接人
  154. uni.showModal({
  155. title: "提示",
  156. content: "请填写正确的交接人工号!",
  157. showCancel: false,
  158. success: function(res) {
  159. if (res.confirm) {
  160. console.log("用户点击确定");
  161. } else if (res.cancel) {
  162. console.log("用户点击取消");
  163. }
  164. },
  165. });
  166. return;
  167. }
  168. this.hosModels.disjunctor = false;
  169. this.validateAccount(data);
  170. },
  171. // 填写交接人工号-取消
  172. hosCancel() {
  173. this.hosModels.disjunctor = false;
  174. this.flag = true;
  175. },
  176. // 填写交接人工号弹窗
  177. showSelectAccount() {
  178. this.hosModels = {
  179. disjunctor: true,
  180. };
  181. },
  182. // 手动填写工号校验
  183. validateAccount(accountObj){
  184. const {
  185. accountName,
  186. account,
  187. accountId
  188. } = accountObj;
  189. uni.showLoading({
  190. title: "加载中",
  191. mask: true,
  192. });
  193. let postData = {
  194. extraType: 'inputAccountValid',
  195. type: this.queryObj.drugsBagType,
  196. orderStateValue: this.workOrder.gdState.value,
  197. userId: accountId,
  198. orderId: this.workOrder.id,
  199. }
  200. post("/transflow/extra", postData)
  201. .then((res) => {
  202. uni.hideLoading();
  203. if(res.state == 200){
  204. if(res.data){
  205. if (res.data.codeBean) {
  206. if(res.data.codeBean.valid){
  207. this.pageNavigateByConfig(this.config, this.workOrder, this.queryObj, { id: accountId, name: accountName }, res.data.codeBean.departmentDTO);
  208. }else{
  209. uni.showToast({
  210. icon: "none",
  211. title: res.data.codeBean.msg || "接口获取数据失败!",
  212. });
  213. }
  214. } else {
  215. uni.showToast({
  216. icon: "none",
  217. title: "接口获取数据失败!",
  218. });
  219. }
  220. }else{
  221. uni.showToast({
  222. icon: "none",
  223. title: "接口获取数据失败!",
  224. });
  225. }
  226. }else{
  227. uni.showToast({
  228. icon: "none",
  229. title: res.msg || "接口获取数据失败!",
  230. });
  231. }
  232. });
  233. },
  234. // 工单完成
  235. completeOrder(workOrder, queryObj, accountObj){
  236. uni.showLoading({
  237. title: "加载中",
  238. mask: true,
  239. });
  240. let postData = {
  241. "type": queryObj.drugsBagType,
  242. "orderId": workOrder.id,
  243. "handover": accountObj ? accountObj.id : undefined,
  244. };
  245. post('/transflow/checkComplete', postData).then(res => {
  246. uni.hideLoading();
  247. if(res.state == 200){
  248. uni.showToast({
  249. icon: "none",
  250. title: workOrder.gdState.value == 4 ? "交接成功,请尽快送达科室!" : (workOrder.gdState.value == 5 ? "交接成功,完成配送!" : ""),
  251. duration: 60000,
  252. mask: true,
  253. complete(){
  254. setTimeout(() => {
  255. uni.hideToast();
  256. uni.redirectTo({
  257. url: `/pages/receiptpage/receiptpage`,
  258. });
  259. }, 2000)
  260. }
  261. });
  262. }else{
  263. uni.showToast({
  264. icon: "none",
  265. title: res.msg || "接口获取数据失败!",
  266. });
  267. }
  268. })
  269. },
  270. // 根据配置跳转页面
  271. pageNavigateByConfig(config, workOrder, queryObj, accountObj, departmentDTO){
  272. console.log(accountObj, departmentDTO);
  273. let drugsBagType = queryObj.drugsBagType;
  274. let orderId = workOrder.id;
  275. if(workOrder.gdState.value == 4){
  276. // 待到达
  277. if(config.drugsStartPhoto === 1){
  278. // 起点科室支持拍照留存
  279. uni.navigateTo({
  280. url: `/pages/newDrug/photoRetention/photoRetention?drugsBagType=${drugsBagType}&orderId=${orderId}&accountId=${accountObj ? accountObj.id : ''}&accountName=${accountObj ? accountObj.name : ''}&accountDeptName=${departmentDTO ? departmentDTO.dept : ''}`,
  281. });
  282. }else{
  283. // 起点科室不支持拍照留存
  284. this.completeOrder(workOrder, queryObj, accountObj);
  285. }
  286. }else if(workOrder.gdState.value == 5){
  287. // 待送达
  288. if(config.drugsEndPhoto === 1){
  289. // 起点科室支持拍照留存
  290. uni.navigateTo({
  291. url: `/pages/newDrug/photoRetention/photoRetention?drugsBagType=${drugsBagType}&orderId=${orderId}&accountId=${accountObj ? accountObj.id : ''}&accountName=${accountObj ? accountObj.name : ''}&accountDeptName=${departmentDTO ? departmentDTO.dept : ''}`,
  292. });
  293. }else{
  294. // 起点科室不支持拍照留存
  295. this.completeOrder(workOrder, queryObj, accountObj);
  296. }
  297. }
  298. },
  299. // 扫一扫交接
  300. scanCode(){
  301. if (!this.SMFlag) {
  302. return;
  303. }
  304. this.SMFlag = false;
  305. SM().then((content) => {
  306. uni.showLoading({
  307. title: "加载中",
  308. mask: true,
  309. });
  310. this.bigScan(content);
  311. }).catch(err => {
  312. this.SMFlag = true;
  313. });
  314. },
  315. // 详情
  316. toDetail(drugsBagId){
  317. uni.navigateTo({
  318. url: `/pages/newDrug/detail?drugsBagType=${this.queryObj.drugsBagType}&drugsBagId=${drugsBagId}`,
  319. });
  320. },
  321. // 扫码
  322. bigScan(content){
  323. let postData = {
  324. type: this.queryObj.drugsBagType,
  325. orderStateValue: this.workOrder.gdState.value,
  326. code: content,
  327. orderId: this.workOrder.id,
  328. }
  329. post("/transflow/bigScan", postData)
  330. .then((res) => {
  331. this.SMFlag = true;
  332. uni.hideLoading();
  333. if (res.codeBean) {
  334. if(res.codeBean.valid){
  335. this.pageNavigateByConfig(this.config, this.workOrder, this.queryObj, res.codeBean.userDTO, res.codeBean.departmentDTO);
  336. }else{
  337. uni.showToast({
  338. icon: "none",
  339. title: res.codeBean.msg || "接口获取数据失败!",
  340. });
  341. }
  342. } else {
  343. uni.showToast({
  344. icon: "none",
  345. title: "接口获取数据失败!",
  346. });
  347. }
  348. });
  349. },
  350. // 初始化
  351. init(){
  352. uni.showLoading({
  353. title: "加载中",
  354. mask: true,
  355. });
  356. let info$ = post(`/transflow/extra`, {type: this.queryObj.drugsBagType, extraType: 'orderInfo', orderId: +this.queryObj.orderId, checkComplete: '1'});
  357. let config$ = post(`/simple/data/fetchDataList/taskTypeConfig`, {
  358. "idx": 0,
  359. "sum": 1,
  360. "taskTypeConfig": {
  361. "taskTypeDTO": {
  362. "hosId": {
  363. "id": this.hosId
  364. },
  365. "ordinaryField": {
  366. "key": "ordinary_field",
  367. "value": this.queryObj.drugsBagType
  368. }
  369. }
  370. }
  371. });
  372. Promise.all([info$, config$]).then(result => {
  373. uni.hideLoading();
  374. let [info, config] = result || [];
  375. if(info.state == 200){
  376. if(info.data){
  377. this.drugsBagList = info.data.drugsBagList || [];
  378. if(Array.isArray(info.data.workOrder.endDepts)){
  379. info.data.workOrder.endDeptNames = info.data.workOrder.endDepts.map(v => v.dept).join();
  380. }
  381. this.workOrder = info.data.workOrder || {};
  382. }
  383. }else{
  384. uni.showToast({
  385. icon: "none",
  386. title: info.msg || "接口获取数据失败!",
  387. });
  388. }
  389. if(config.status == 200){
  390. let list = config.list || [];
  391. this.config = list.length ? list[0] : {};
  392. }else{
  393. uni.showToast({
  394. icon: "none",
  395. title: config.msg || "接口获取数据失败!",
  396. });
  397. }
  398. })
  399. },
  400. },
  401. onLoad(options) {
  402. console.log(options, "options");
  403. this.queryObj = options;
  404. this.init();
  405. this.getConfig();
  406. // #ifdef APP-PLUS
  407. webHandle("no", "app");
  408. // #endif
  409. // #ifdef H5
  410. webHandle("no", "wx");
  411. // #endif
  412. },
  413. };
  414. </script>
  415. <style lang="less" scoped>
  416. .Scanning_Result {
  417. background: #FAFBFD;
  418. padding: 0 24rpx;
  419. display: flex;
  420. flex-direction: column;
  421. height: 100vh;
  422. .Scanning_top {
  423. margin: 24rpx auto;
  424. .Scanning_top_icon {
  425. font-size: 30rpx;
  426. font-weight: bold;
  427. .newicon{
  428. margin: 0 32rpx;
  429. }
  430. }
  431. }
  432. .Scanning_cont {
  433. flex: 1;
  434. min-height: 0;
  435. display: flex;
  436. flex-direction: column;
  437. .scrollContent{
  438. flex: 1;
  439. min-height: 0;
  440. }
  441. .column{
  442. display: flex;
  443. justify-content: center;
  444. align-items: center;
  445. font-size: 28rpx;
  446. padding: 32rpx 24rpx;
  447. color: #565656;
  448. border-bottom: 1rpx solid #D9D9D9;
  449. gap: 8rpx;
  450. &.head{
  451. font-size: 30rpx;
  452. color: #000000;
  453. border: 1rpx solid #D9D9D9;
  454. box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(0,0,0,0.16);
  455. background: #FBFCFE;
  456. }
  457. .value1{
  458. flex: 2;
  459. text-align: left;
  460. word-break: break-all;
  461. flex-shrink: 0;
  462. }
  463. .value2,.value3{
  464. flex: 1;
  465. text-align: center;
  466. word-break: break-all;
  467. flex-shrink: 0;
  468. }
  469. }
  470. }
  471. .foot_btn_spe {
  472. margin: 24rpx 0;
  473. display: flex;
  474. flex-direction: column;
  475. align-items: center;
  476. gap: 24rpx;
  477. font-weight: bold;
  478. .column{
  479. width: 100%;
  480. height: 78rpx;
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. gap: 24rpx;
  485. .btn {
  486. height: 100%;
  487. flex: 1;
  488. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  489. color: #fff;
  490. border-radius: 4rpx;
  491. font-size: 30rpx;
  492. display: flex;
  493. justify-content: center;
  494. align-items: center;
  495. }
  496. }
  497. }
  498. }
  499. </style>