createOrder.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">
  5. <text class="cubeic-ok newicon newicon-duigou"></text>
  6. </view>
  7. <view class="ScanTips">扫描成功</view>
  8. </view>
  9. <view class="Scanning_cont">
  10. <scroll-view scroll-y class="scrollContent">
  11. <view class="column">
  12. <view class="name">打包单号:</view>
  13. <view class="value">{{specimenPackageDTO.packCode}}</view>
  14. </view>
  15. <view class="column">
  16. <view class="name">打包科室:</view>
  17. <view class="value">{{specimenPackageDTO.packDeptDTO ? specimenPackageDTO.packDeptDTO.dept : ''}}</view>
  18. </view>
  19. <view class="column">
  20. <view class="name">终点科室:</view>
  21. <view class="value">{{specimenPackageDTO.targetDeptDTO ? specimenPackageDTO.targetDeptDTO.dept : ''}}</view>
  22. </view>
  23. <view class="column">
  24. <view class="name">检验科室:</view>
  25. <view class="value">
  26. <template v-if="specimenPackageDTO.endDeptList">
  27. <view class="valueBlock" v-for="item of specimenPackageDTO.endDeptList" :key="item.id">
  28. {{item.dept}}
  29. </view>
  30. </template>
  31. </view>
  32. </view>
  33. <view class="column">
  34. <view class="name">标本数:</view>
  35. <view class="value">{{specimenPackageDTO.specimenNum}}</view>
  36. </view>
  37. <view class="column">
  38. <view class="name">试管类型:</view>
  39. <view class="value">
  40. <view class="valueBlock" v-for="tube2 of tube" :key="tube2.id">
  41. <view class="valueItem" v-for="item of tube2" :key="item.id">{{item.name}}:{{item.size}}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </view>
  47. <view class="foot_btn_spe" v-if="config.id">
  48. <view class="column">
  49. <!-- 需要核对 -->
  50. <template v-if="config.drugsStartCheck === 1">
  51. <!-- 两个按钮-样式 设计如此,别BB -->
  52. <template v-if="(queryObj.type === 'build' || queryObj.type === 'receive') && (config.drugsCreateSign === 1 || config.drugsReceiveSign === 1) && !config.drugsStartManual">
  53. <view class="btn" @click="goIndex()">返回</view>
  54. <view class="btn" @click="createOrBuildOrder(undefined, 'scan')" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1">建单签到扫一扫</view>
  55. <view class="btn" @click="createOrBuildOrder(undefined, 'hand')" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1 && config.drugsStartManual">建单签到{{config.drugsStartManual.name}}</view>
  56. <view class="btn" @click="createOrBuildOrder(orderId, 'scan')" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1">接单签到扫一扫</view>
  57. <view class="btn" @click="createOrBuildOrder(orderId, 'hand')" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1 && config.drugsStartManual">接单签到{{config.drugsStartManual.name}}</view>
  58. </template>
  59. <!-- 三个按钮-样式 设计如此,别BB -->
  60. <template v-else-if="(queryObj.type === 'build' || queryObj.type === 'receive') && (config.drugsCreateSign === 1 || config.drugsReceiveSign === 1) && config.drugsStartManual">
  61. <view class="btn" @click="createOrBuildOrder(undefined, 'scan')" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1">建单签到扫一扫</view>
  62. <view class="btn" @click="createOrBuildOrder(undefined, 'hand')" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1 && config.drugsStartManual">建单签到{{config.drugsStartManual.name}}</view>
  63. <view class="btn" @click="createOrBuildOrder(orderId, 'scan')" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1">接单签到扫一扫</view>
  64. <view class="btn" @click="createOrBuildOrder(orderId, 'hand')" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1 && config.drugsStartManual">接单签到{{config.drugsStartManual.name}}</view>
  65. <view class="btnW100 grayBg" @click="goIndex()">返回</view>
  66. </template>
  67. </template>
  68. <!-- 不需要核对 -->
  69. <template v-if="config.drugsStartCheck !== 1">
  70. <view class="btn" @click="goIndex()">返回</view>
  71. <view class="btn" @click="createOrBuildOrder()" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1">建单并签到</view>
  72. <view class="btn" @click="createOrBuildOrder(orderId)" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1">接单并签到</view>
  73. </template>
  74. <!-- 查看 -->
  75. <template v-if="queryObj.type === 'view'">
  76. <view class="btnW100" @click="goIndex()">返回</view>
  77. </template>
  78. <!-- 终点科室核对 -->
  79. <template v-if="queryObj.type === 'end'">
  80. <view class="btn" @click="goIndex()">返回</view>
  81. <view class="btn" @click="toCheckPage()">批量交接</view>
  82. </template>
  83. </view>
  84. </view>
  85. <!-- 填写交接人工号弹窗 -->
  86. <selectAccount @click.stop.native v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  87. @cancel="hosCancel">
  88. </selectAccount>
  89. <!-- 动态密钥 -->
  90. <numberKeyModel v-if="showKey" :keyArr="keyArr" @cancel="showKey = false" @confirm="confirmKey($event)"></numberKeyModel>
  91. </view>
  92. </template>
  93. <script>
  94. import numberKeyModel from "@/components/numberKeyModel/numberKeyModel.vue";
  95. import {
  96. get,
  97. post,
  98. SM,
  99. webHandle
  100. } from "@/http/http.js";
  101. import chunk from 'lodash-es/chunk'
  102. export default {
  103. data() {
  104. return {
  105. queryObj: {}, //路由传递过来的数据
  106. specimenPackageDTO: {}, //标本包信息
  107. config: {}, //药品的业务流程配置
  108. orderId: undefined, //根据药包查询到的工单ID
  109. tube: [],//试管类型
  110. SMFlag: true, //控制扫码
  111. workOrder: {}, //工单信息
  112. // 填写交接人工号弹窗model
  113. hosModels: {
  114. disjunctor: false,
  115. },
  116. showKey:false,
  117. keyNum:4, //密钥位数
  118. isNumberKey:false, //是否开启动态密钥
  119. keyArr: [],
  120. };
  121. },
  122. components: {
  123. numberKeyModel,
  124. },
  125. onShow() {
  126. this.SMFlag = true;
  127. },
  128. methods: {
  129. // 返回
  130. goIndex(){
  131. uni.redirectTo({
  132. url: `/pages/receiptpage/receiptpage`,
  133. });
  134. },
  135. // 批量交接
  136. toCheckPage(){
  137. uni.redirectTo({
  138. url: `/pages/specimenPackage/checkPage/checkPage?packageType=${this.queryObj.packageType}&packageId=${this.queryObj.packageId}&orderId=${this.queryObj.orderId}`,
  139. });
  140. },
  141. // 根据配置跳转页面
  142. pageNavigateByConfig(config, responseData, queryObj, checkType){
  143. let packageType = queryObj.packageType;
  144. let orderId = responseData.orderId;
  145. let packageId = queryObj.packageId;
  146. let orderStateValue = responseData.orderStateValue;
  147. if(config.spePackageModel === 1){
  148. // 一单一包
  149. if(responseData.orderStateValue == 4){
  150. // 待到达
  151. if(config.drugsStartCheck === 1){
  152. // 起点科室支持核对
  153. if(checkType === 'scan'){
  154. // 扫码
  155. this.scanCode();
  156. }else if(checkType === 'hand'){
  157. // 手动输入
  158. this.fillInManually(config.drugsStartManual.value);
  159. }
  160. }else{
  161. // 起点科室不支持核对
  162. this.completeOrder(responseData, queryObj);
  163. }
  164. }
  165. }
  166. },
  167. // 扫一扫交接
  168. scanCode(){
  169. if (!this.SMFlag) {
  170. return;
  171. }
  172. this.SMFlag = false;
  173. SM().then((content) => {
  174. uni.showLoading({
  175. title: "加载中",
  176. mask: true,
  177. });
  178. this.bigScan(content);
  179. }).catch(err => {
  180. this.SMFlag = true;
  181. });
  182. },
  183. // 扫码
  184. bigScan(content){
  185. let postData = {
  186. type: this.queryObj.packageType,
  187. orderStateValue: this.workOrder.gdState.value,
  188. code: content,
  189. orderId: this.workOrder.id,
  190. }
  191. post("/transflow/bigScan", postData)
  192. .then((res) => {
  193. this.SMFlag = true;
  194. uni.hideLoading();
  195. if (res.codeBean) {
  196. if(res.codeBean.valid){
  197. this.pageCheckNavigateByConfig(this.config, this.workOrder, this.queryObj, res.codeBean.userDTO, res.codeBean.departmentDTO);
  198. }else{
  199. uni.showToast({
  200. icon: "none",
  201. title: res.codeBean.msg || "接口获取数据失败!",
  202. });
  203. }
  204. } else {
  205. uni.showToast({
  206. icon: "none",
  207. title: "接口获取数据失败!",
  208. });
  209. }
  210. });
  211. },
  212. // 获取配置
  213. getConfig() {
  214. let postData = {
  215. idx: 0,
  216. sum: 9999,
  217. hospitalConfig:{
  218. hosId:this.hosId,
  219. model:"all"
  220. }
  221. };
  222. post("/simple/data/fetchDataList/hospitalConfig",postData).then((result) => {
  223. if (result.status == 200) {
  224. this.keyArr = []
  225. for(let i of result.list){
  226. if(i.key=='digitalSecretKey'){
  227. if(i.value==1){
  228. this.isNumberKey = true
  229. }else{
  230. this.isNumberKey = false
  231. }
  232. }else if(i.key=='numberDigitalSecretKey'){
  233. this.keyNum = Number(i.value)
  234. }
  235. }
  236. for(let i = 0; i < this.keyNum; i++){
  237. this.keyArr.push({
  238. value:null
  239. })
  240. }
  241. console.log(444,this.keyArr)
  242. }
  243. });
  244. },
  245. confirmKey(data){
  246. this.padChange(data)
  247. this.showKey = false
  248. },
  249. isShowKey(){
  250. this.showKey = true
  251. },
  252. padChange(scannerCode){
  253. if(!this.isNumberKey){
  254. scannerCode = scannerCode.replace('\n','')
  255. }
  256. this.bigScan(scannerCode);
  257. },
  258. // 手动填写
  259. fillInManually(value){
  260. if(value == 1){
  261. // 填写工号
  262. this.showSelectAccount();
  263. }else if(value == 2){
  264. // 动态密钥
  265. this.isShowKey();
  266. }
  267. },
  268. // 填写交接人工号-确认
  269. hosOk(data) {
  270. console.log(data);
  271. const {
  272. accountName,
  273. account,
  274. accountId
  275. } = data;
  276. if (!accountName && !account) {
  277. //没有填写交接人
  278. uni.showModal({
  279. title: "提示",
  280. content: "请填写交接人工号!",
  281. showCancel: false,
  282. success: function(res) {
  283. if (res.confirm) {
  284. console.log("用户点击确定");
  285. } else if (res.cancel) {
  286. console.log("用户点击取消");
  287. }
  288. },
  289. });
  290. return;
  291. } else if ((!accountName && account) || (accountName && !account)) {
  292. //没有填写交接人
  293. uni.showModal({
  294. title: "提示",
  295. content: "请填写正确的交接人工号!",
  296. showCancel: false,
  297. success: function(res) {
  298. if (res.confirm) {
  299. console.log("用户点击确定");
  300. } else if (res.cancel) {
  301. console.log("用户点击取消");
  302. }
  303. },
  304. });
  305. return;
  306. }
  307. this.hosModels.disjunctor = false;
  308. this.validateAccount(data);
  309. },
  310. // 填写交接人工号-取消
  311. hosCancel() {
  312. this.hosModels.disjunctor = false;
  313. this.flag = true;
  314. },
  315. // 填写交接人工号弹窗
  316. showSelectAccount() {
  317. this.hosModels = {
  318. disjunctor: true,
  319. };
  320. },
  321. // 手动填写工号校验
  322. validateAccount(accountObj){
  323. const {
  324. accountName,
  325. account,
  326. accountId
  327. } = accountObj;
  328. uni.showLoading({
  329. title: "加载中",
  330. mask: true,
  331. });
  332. let postData = {
  333. extraType: 'inputAccountValid',
  334. type: this.queryObj.packageType,
  335. orderStateValue: this.workOrder.gdState.value,
  336. userId: accountId,
  337. orderId: this.workOrder.id,
  338. }
  339. post("/transflow/extra", postData)
  340. .then((res) => {
  341. uni.hideLoading();
  342. if(res.state == 200){
  343. if(res.data){
  344. if (res.data.codeBean) {
  345. if(res.data.codeBean.valid){
  346. this.pageCheckNavigateByConfig(this.config, this.workOrder, this.queryObj, { id: accountId, name: accountName }, res.data.codeBean.departmentDTO);
  347. }else{
  348. uni.showToast({
  349. icon: "none",
  350. title: res.data.codeBean.msg || "接口获取数据失败!",
  351. });
  352. }
  353. } else {
  354. uni.showToast({
  355. icon: "none",
  356. title: "接口获取数据失败!",
  357. });
  358. }
  359. }else{
  360. uni.showToast({
  361. icon: "none",
  362. title: "接口获取数据失败!",
  363. });
  364. }
  365. }else{
  366. uni.showToast({
  367. icon: "none",
  368. title: res.msg || "接口获取数据失败!",
  369. });
  370. }
  371. });
  372. },
  373. // 核对-根据配置跳转页面
  374. pageCheckNavigateByConfig(config, workOrder, queryObj, accountObj, departmentDTO){
  375. console.log(accountObj, departmentDTO);
  376. let packageType = queryObj.packageType;
  377. let orderId = workOrder.id;
  378. this.completeCheckOrder(workOrder, queryObj, accountObj);
  379. },
  380. // 核对-工单完成
  381. completeCheckOrder(workOrder, queryObj, accountObj){
  382. uni.showLoading({
  383. title: "加载中",
  384. mask: true,
  385. });
  386. let postData = {
  387. "type": queryObj.packageType,
  388. "orderId": workOrder.id,
  389. "packageId": +this.queryObj.packageId,
  390. "handover": accountObj ? accountObj.id : undefined,
  391. };
  392. post('/transflow/checkComplete', postData).then(res => {
  393. uni.hideLoading();
  394. if(res.state == 200){
  395. uni.showToast({
  396. icon: "none",
  397. title: workOrder.gdState.value == 4 ? "交接成功,请尽快送达科室!" : (workOrder.gdState.value == 5 ? "交接成功,完成配送!" : ""),
  398. duration: 60000,
  399. mask: true,
  400. complete(){
  401. setTimeout(() => {
  402. uni.hideToast();
  403. uni.redirectTo({
  404. url: `/pages/receiptpage/receiptpage`,
  405. });
  406. }, 2000)
  407. }
  408. });
  409. }else{
  410. uni.showToast({
  411. icon: "none",
  412. title: res.msg || "接口获取数据失败!",
  413. });
  414. }
  415. })
  416. },
  417. // 工单完成
  418. completeOrder(responseData, queryObj){
  419. uni.showLoading({
  420. title: "加载中",
  421. mask: true,
  422. });
  423. let postData = {
  424. "type": queryObj.packageType,
  425. "packageId": +this.queryObj.packageId,
  426. "orderId": responseData.orderId,
  427. };
  428. post('/transflow/checkComplete', postData).then(res => {
  429. uni.hideLoading();
  430. if(res.state == 200){
  431. uni.showToast({
  432. icon: "none",
  433. title: responseData.orderStateValue == 4 ? "交接成功,请尽快送达科室!" : (responseData.orderStateValue == 5 ? "交接成功,完成配送!" : ""),
  434. duration: 60000,
  435. mask: true,
  436. complete(){
  437. setTimeout(() => {
  438. uni.hideToast();
  439. uni.redirectTo({
  440. url: `/pages/receiptpage/receiptpage`,
  441. });
  442. }, 2000)
  443. }
  444. });
  445. }else{
  446. uni.showToast({
  447. icon: "none",
  448. title: res.msg || "接口获取数据失败!",
  449. });
  450. }
  451. })
  452. },
  453. // 建单并签到/接单并签到-orderId
  454. // 扫码scan/手动hand-checkType
  455. createOrBuildOrder(orderId, checkType){
  456. uni.showModal({
  457. title: "提示",
  458. content: `请确认是否${orderId ? '接' : '建'}单并签到?`,
  459. success: (result) => {
  460. if (result.confirm) {
  461. console.log("用户点击确定");
  462. let postData = {
  463. type: this.queryObj.packageType,
  464. id: +this.queryObj.packageId,
  465. orderId,
  466. };
  467. uni.showLoading({
  468. title: "加载中",
  469. mask: true,
  470. });
  471. post(`/transflow/createOrTakeOrder`, postData).then((ress) => {
  472. uni.hideLoading();
  473. if (ress.state == 200) {
  474. if(ress.data.msg){
  475. uni.showToast({
  476. icon: "none",
  477. title: ress.data.msg || "接口获取数据失败!",
  478. });
  479. }else{
  480. this.workOrder = {
  481. id: ress.data.orderId,
  482. gdState: {
  483. value: ress.data.orderStateValue,
  484. },
  485. };
  486. console.log('workOrder', this.workOrder);
  487. this.pageNavigateByConfig(this.config, ress.data, this.queryObj, checkType);
  488. }
  489. } else {
  490. uni.showToast({
  491. icon: "none",
  492. title: ress.msg || "接口获取数据失败!",
  493. });
  494. }
  495. });
  496. } else if (result.cancel) {
  497. console.log("用户点击取消");
  498. }
  499. },
  500. });
  501. },
  502. //获取页面信息
  503. getInfo(){
  504. uni.showLoading({
  505. title: "加载中",
  506. mask: true,
  507. });
  508. post(`/transflow/scanInfo`, {type: this.queryObj.packageType, id: +this.queryObj.packageId, orderStateValue: this.queryObj.type === 'end' ? '5' : '4'}).then(res => {
  509. uni.hideLoading();
  510. if(res.state == 200){
  511. if(res.data){
  512. this.specimenPackageDTO = res.data.dto || {};
  513. this.orderId = this.queryObj.orderId;
  514. this.config = res.data.taskTypeConfig || {};
  515. let tube = res.data.tube || [];
  516. this.tube = chunk(tube, 3);
  517. }
  518. }else{
  519. uni.showToast({
  520. icon: "none",
  521. title: res.msg || "接口获取数据失败!",
  522. });
  523. }
  524. })
  525. },
  526. },
  527. onLoad(options) {
  528. console.log(options, "options");
  529. this.queryObj = options;
  530. this.getInfo();
  531. this.getConfig();
  532. // #ifdef APP-PLUS
  533. webHandle("no", "app");
  534. // #endif
  535. // #ifdef H5
  536. webHandle("no", "wx");
  537. // #endif
  538. },
  539. };
  540. </script>
  541. <style lang="less" scoped>
  542. .Scanning_Result {
  543. background: #FAFBFD;
  544. padding: 0 48rpx;
  545. display: flex;
  546. flex-direction: column;
  547. height: 100vh;
  548. .Scanning_top {
  549. margin: 50rpx auto 64rpx;
  550. display: flex;
  551. flex-direction: column;
  552. align-items: center;
  553. .Scanning_top_icon {
  554. width: 128rpx;
  555. height: 128rpx;
  556. border-radius: 50%;
  557. .cubeic-ok {
  558. font-size: 128rpx;
  559. color: #35b34a;
  560. }
  561. }
  562. .ScanTips{
  563. margin-top: 34rpx;
  564. font-size: 38rpx;
  565. font-weight: bold;
  566. }
  567. }
  568. .Scanning_cont {
  569. flex: 1;
  570. min-height: 0;
  571. display: flex;
  572. flex-direction: column;
  573. .scrollContent{
  574. flex: 1;
  575. min-height: 0;
  576. }
  577. .column{
  578. display: flex;
  579. justify-content: center;
  580. font-size: 30rpx;
  581. margin-bottom: 32rpx;
  582. .name{
  583. font-weight: bold;
  584. word-break: break-all;
  585. flex-shrink: 0;
  586. }
  587. .value{
  588. word-break: break-all;
  589. flex: 1;
  590. .valueBlock{
  591. margin-top: 16rpx;
  592. display: flex;
  593. &:first-of-type{
  594. margin-top: 0;
  595. }
  596. .valueItem{
  597. flex: 1;
  598. }
  599. }
  600. }
  601. }
  602. }
  603. .foot_btn_spe {
  604. margin: 24rpx 0;
  605. display: flex;
  606. flex-direction: column;
  607. align-items: center;
  608. gap: 24rpx;
  609. font-weight: bold;
  610. .column{
  611. width: 100%;
  612. display: flex;
  613. justify-content: space-between;
  614. gap: 24rpx;
  615. flex-wrap: wrap;
  616. .grayBg{
  617. background: #8F939C!important;
  618. }
  619. .btn {
  620. height: 78rpx;
  621. width: calc(50% - 24rpx);
  622. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  623. color: #fff;
  624. border-radius: 4rpx;
  625. font-size: 30rpx;
  626. display: flex;
  627. justify-content: center;
  628. align-items: center;
  629. }
  630. .btnW100 {
  631. height: 78rpx;
  632. width: 100%;
  633. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  634. color: #fff;
  635. border-radius: 4rpx;
  636. font-size: 30rpx;
  637. display: flex;
  638. justify-content: center;
  639. align-items: center;
  640. }
  641. }
  642. }
  643. }
  644. </style>