checkPage.vue 17 KB

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