checkPage.vue 17 KB

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