otherCompleteOrder.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <template>
  2. <view class="HomeItem">
  3. <view class="goWorkAll">
  4. <view class="goWorkSelect combination" v-if="actionConfirmSwitch">
  5. <view class="goWorkSelect-head" v-if="actionConfirmType == 1">您需要完成以下所有动作,才可完成工单。如完成请勾选对应项!</view>
  6. <view class="goWorkSelect-head" v-if="actionConfirmType == 2">您需要完成以下至少一个动作,才可完成工单。如完成请勾选对应项!</view>
  7. <view class="goWorkSelect-head" v-if="actionConfirmType == 3">您需要完成以下一个动作,才可完成工单。如完成请勾选对应项!</view>
  8. <view class="goWorkSelect-list scroll">
  9. <checkbox-group @change="checkboxChange" v-if="actionConfirmType == 1 || actionConfirmType == 2">
  10. <label class="goWorkSelect-item relative" v-for="action in actions" :key="action.value">
  11. <view>
  12. <checkbox :value="action.value" :checked="action.checked" />
  13. </view>
  14. <view>{{action.name}}</view>
  15. </label>
  16. </checkbox-group>
  17. <radio-group @change="checkboxChange" v-if="actionConfirmType == 3">
  18. <label class="goWorkSelect-item relative" v-for="action in actions" :key="action.value">
  19. <view>
  20. <radio :value="action.value" :checked="action.checked" />
  21. </view>
  22. <view>{{action.name}}</view>
  23. </label>
  24. </radio-group>
  25. </view>
  26. </view>
  27. <view class="goWorkSelect history" v-if="actionPhotoSwitch">
  28. <view class="goWorkSelect-head">您需要拍摄现场照片才可完成工单!</view>
  29. <view class="goWorkSelect-list">
  30. <uni-file-picker :auto-upload="false" :limit="3" title="最多选择3张图片" v-model="imageValue" fileMediatype="image"
  31. mode="grid" @select="selectFile" @delete="deleteFile"></uni-file-picker>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="foot_btn_spe">
  36. <view class="btn1" @click="photographToOther(order)">完成工单</view>
  37. <view class="btn3" @click="goBack">返回</view>
  38. </view>
  39. <!-- 填写交接人账号弹窗 -->
  40. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  41. @cancel="hosCancel">
  42. </selectAccount>
  43. </view>
  44. </template>
  45. <script>
  46. import * as commonFun from '../../tools/commonFun.js';
  47. import {
  48. pathUrl
  49. } from "../../tools/photograph.js";
  50. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  51. import {
  52. get,
  53. post,
  54. webHandle
  55. } from "../../http/http.js";
  56. export default {
  57. components: {
  58. selectAccount,
  59. },
  60. data() {
  61. return {
  62. currentIndex: undefined,
  63. // 填写交接人账号弹窗model
  64. hosModels: {
  65. disjunctor: false,
  66. },
  67. currentCode: '', //当前拍照使用的科室二维码
  68. currentData: {}, //当前小扫描的工单对象
  69. orderId: undefined,
  70. order: {},
  71. // 拍照动作开关
  72. actionPhotoSwitch: false,
  73. // 确认动作开关
  74. actionConfirmSwitch: false,
  75. // 确认动作模式开关
  76. actionConfirmType: false,
  77. // 参数
  78. options: {},
  79. //动作列表
  80. actions: [],
  81. //图片列表
  82. imageValue: [],
  83. };
  84. },
  85. methods: {
  86. // 其他临床服务-运输过程-终点科室是否开通备注填写
  87. isOpenTransportationProcessRemarks(data, accountObj, funName){
  88. const tasktype = data.taskType;
  89. console.log(tasktype, data);
  90. if(tasktype.associationType.value === 'other' && tasktype.carryingCourses[this.currentIndex].logSwitch && data.gdState.value == 5){
  91. uni.navigateTo({
  92. url: `../../pages/transportationProcessRemarks/transportationProcessRemarks?data=${data ? encodeURIComponent(JSON.stringify(data)) : ''}&accountObj=${accountObj ? encodeURIComponent(JSON.stringify(accountObj)) : ''}&currentCode=${this.currentCode}&funName=${funName}&actions=${this.actions ? encodeURIComponent(JSON.stringify(this.actions)) : ''}&imageValue=${this.imageValue ? encodeURIComponent(JSON.stringify(this.imageValue)) : ''}`
  93. })
  94. }else{
  95. commonFun[funName](this, data, accountObj);
  96. }
  97. },
  98. // 填写交接人账号-确认
  99. hosOk(data) {
  100. console.log(data);
  101. const {
  102. accountName,
  103. account,
  104. accountId
  105. } = data;
  106. if (!accountName && !account) {
  107. //没有填写交接人
  108. uni.showModal({
  109. title: '提示',
  110. content: "请填写交接人账号!",
  111. showCancel: false,
  112. success: function(res) {
  113. if (res.confirm) {
  114. console.log('用户点击确定');
  115. } else if (res.cancel) {
  116. console.log('用户点击取消');
  117. }
  118. }
  119. });
  120. return;
  121. } else if (!accountName && account || accountName && !account) {
  122. //没有填写交接人
  123. uni.showModal({
  124. title: '提示',
  125. content: "请填写正确的交接人账号!",
  126. showCancel: false,
  127. success: function(res) {
  128. if (res.confirm) {
  129. console.log('用户点击确定');
  130. } else if (res.cancel) {
  131. console.log('用户点击取消');
  132. }
  133. }
  134. });
  135. return;
  136. }
  137. this.hosModels.disjunctor = false;
  138. let associationTypeValue = this.currentData.taskType.associationType.value;
  139. console.log(associationTypeValue)
  140. if(this.actionPhotoSwitch && this.actionConfirmSwitch){
  141. this.isOpenTransportationProcessRemarks(this.currentData, data, 'uploadToOther');
  142. }else if(this.actionConfirmSwitch){
  143. // 动作
  144. this.isOpenTransportationProcessRemarks(this.currentData, data, 'nextDeptOrder_ss');
  145. }else if(this.actionPhotoSwitch){
  146. // 拍照
  147. this.isOpenTransportationProcessRemarks(this.currentData, data, 'uploadToOther');
  148. }
  149. },
  150. // 填写交接人账号-取消
  151. hosCancel() {
  152. this.hosModels.disjunctor = false;
  153. },
  154. // 填写交接人账号弹窗
  155. showSelectAccount() {
  156. this.hosModels = {
  157. title: '填写交接人账号',
  158. disjunctor: true,
  159. }
  160. },
  161. // 拍照-其他
  162. photographToOther(data) {
  163. this.currentData = data;
  164. let actions = this.actions.filter(v => v.checked);
  165. let imageValue = this.imageValue;
  166. console.log(actions);
  167. console.log(imageValue);
  168. if(
  169. this.actionConfirmSwitch &&
  170. (
  171. (this.actionConfirmType == 1 && this.actions.length !== actions.length) ||
  172. (this.actionConfirmType == 2 && !actions.length) ||
  173. (this.actionConfirmType == 3 && !actions.length)
  174. )
  175. ){
  176. let title = '';
  177. if(this.actionConfirmType == 1){
  178. title = '您需要完成以下所有动作,才可完成工单!';
  179. }else if(this.actionConfirmType == 2){
  180. title = '您需要完成以下至少一个动作,才可完成工单!';
  181. }else if(this.actionConfirmType == 3){
  182. title = '您需要完成以下一个动作,才可完成工单!';
  183. }
  184. uni.showToast({
  185. icon: "none",
  186. title,
  187. duration: 2000
  188. });
  189. return;
  190. }
  191. if(this.actionPhotoSwitch && !imageValue.length){
  192. uni.showToast({
  193. icon: "none",
  194. title: '您需要完成拍照,才可完成工单!',
  195. duration: 2000
  196. });
  197. return;
  198. }
  199. uni.showLoading({
  200. title: "加载中",
  201. mask: true,
  202. });
  203. // 其他临床服务
  204. let content;
  205. if(this.currentIndex == 0){
  206. content = data.startDept.qrcode;
  207. }else if(this.currentIndex == 1){
  208. content = data.endDepts[0].qrcode;
  209. }
  210. //检验二维码的有效性
  211. post("/dept/scanning", {
  212. content,
  213. taskTypeId: data.taskType.id,
  214. gdState: data.gdState.id,
  215. }).then((result) => {
  216. this.currentCode = result.code;
  217. if (result.state == 200 || result.state == 201) {
  218. let accountObj = undefined;
  219. if (result.account) {
  220. accountObj = {
  221. account: result.account,
  222. accountName: result.name,
  223. accountId: result.id,
  224. };
  225. } else {
  226. accountObj = undefined;
  227. }
  228. if(this.actionPhotoSwitch && this.actionConfirmSwitch){
  229. this.isOpenTransportationProcessRemarks(data, accountObj, 'uploadToOther');
  230. }else if(this.actionConfirmSwitch){
  231. // 动作
  232. this.isOpenTransportationProcessRemarks(data, accountObj, 'nextDeptOrder_ss');
  233. }else if(this.actionPhotoSwitch){
  234. // 拍照
  235. this.isOpenTransportationProcessRemarks(data, accountObj, 'uploadToOther');
  236. }
  237. } else if (result.state == '0000') {
  238. uni.hideLoading();
  239. this.showSelectAccount();
  240. } else {
  241. uni.hideLoading();
  242. uni.showToast({
  243. icon: "none",
  244. title: "请求失败!",
  245. });
  246. }
  247. });
  248. },
  249. // 返回
  250. goBack() {
  251. uni.navigateBack();
  252. },
  253. // 选择动作
  254. checkboxChange: function (e) {
  255. let items = this.actions;
  256. let values = [];
  257. if(this.actionConfirmType == 1 || this.actionConfirmType == 2){
  258. values = e.detail.value || [];
  259. }else if(this.actionConfirmType == 3){
  260. values = [e.detail.value];
  261. }
  262. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  263. const item = items[i]
  264. if(values.includes(item.value)){
  265. this.$set(item,'checked',true)
  266. }else{
  267. this.$set(item,'checked',false)
  268. }
  269. }
  270. },
  271. // 获取上传状态
  272. selectFile(e) {
  273. console.log('选择文件:', e)
  274. this.imageValue = this.imageValue.concat(e.tempFiles);
  275. },
  276. // 移除
  277. deleteFile(e) {
  278. console.log('移除:', e);
  279. },
  280. },
  281. onLoad(options) {
  282. console.log(options);
  283. this.options = options;
  284. if(options.order){
  285. options.order = JSON.parse(options.order);
  286. this.order = options.order;
  287. if(this.order.gdState.value == 4){
  288. this.currentIndex = 0;
  289. }else if(this.order.gdState.value == 5){
  290. this.currentIndex = 1;
  291. }
  292. }
  293. if(options.orderId){
  294. this.orderId = options.orderId;
  295. }
  296. if(options.taskType){
  297. options.taskType = JSON.parse(options.taskType);
  298. this.actionConfirmSwitch = options.taskType.carryingCourses[this.currentIndex].actionConfirmSwitch;
  299. let actions = options.taskType.carryingCourses[this.currentIndex].actionRemarks || "";
  300. this.actions = actions.split('$').map((v, i) => ({
  301. value: i,
  302. name: v,
  303. }));
  304. this.actionPhotoSwitch = options.taskType.carryingCourses[this.currentIndex].actionPhotoSwitch;
  305. this.actionConfirmType = options.taskType.carryingCourses[this.currentIndex].actionConfirmType;
  306. }
  307. },
  308. };
  309. </script>
  310. <style lang="less" scoped>
  311. .HomeItem {
  312. .foot_btn_spe {
  313. width: 100%;
  314. position: fixed;
  315. bottom: 30rpx;
  316. left: 0;
  317. line-height: 88rpx;
  318. height: 88rpx;
  319. text-align: center;
  320. display: flex;
  321. justify-content: space-between;
  322. flex-wrap: wrap;
  323. &::after {
  324. content: '';
  325. flex: 1;
  326. }
  327. view {
  328. height: 88rpx;
  329. width: 48%;
  330. margin: 0 1%;
  331. background-image: linear-gradient(to right, #72c172, #3bb197);
  332. color: #fff;
  333. border-radius: 8rpx;
  334. font-size: 32rpx;
  335. margin-top: 16rpx;
  336. }
  337. }
  338. .login {
  339. height: 420rpx;
  340. padding: 0 32rpx;
  341. padding-top: 164rpx;
  342. position: relative;
  343. z-index: 999;
  344. .savePassword {
  345. margin-top: 32rpx;
  346. }
  347. /deep/ uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
  348. border-color: #42b983 !important;
  349. }
  350. .login_input {
  351. margin-top: 32rpx;
  352. background-color: #ffffff;
  353. height: 72rpx;
  354. box-sizing: border-box;
  355. padding: 16rpx;
  356. }
  357. .title {
  358. font-size: 36rpx;
  359. color: #42b983;
  360. text-align: center;
  361. }
  362. .tips {
  363. font-size: 28rpx;
  364. color: red;
  365. margin-top: 16rpx;
  366. }
  367. .page_item_btn {
  368. height: 88rpx;
  369. background-image: linear-gradient(to right, #72c172, #3bb197);
  370. border-radius: 8rpx;
  371. line-height: 88rpx;
  372. color: #fff;
  373. font-size: 36rpx;
  374. font-weight: 700;
  375. margin-top: 64rpx;
  376. text-align: center;
  377. }
  378. }
  379. //上班页面
  380. .goWorkAll {
  381. height: calc(100vh - 118rpx);
  382. overflow-y: auto;
  383. display: flex;
  384. flex-direction: column;
  385. justify-content: space-between;
  386. /deep/ .uni-radio-input-checked {
  387. background-color: #42b983 !important;
  388. border-color: #42b983 !important;
  389. }
  390. /deep/ .uni-checkbox-input-checked {
  391. color: #42b983 !important;
  392. }
  393. .goWorkSelect {
  394. &.history {
  395. height: 356rpx;
  396. padding-bottom: 16rpx;
  397. }
  398. &.combination {
  399. .goWorkSelect-head {}
  400. .goWorkSelect-list {}
  401. }
  402. .goWorkSelect-head {
  403. font-size: 28rpx;
  404. padding: 16rpx 0;
  405. color: #42b983;
  406. border-bottom: 2rpx solid #42b983;
  407. text-align: center;
  408. }
  409. .goWorkSelect-list {
  410. padding: 16rpx;
  411. .goWorkSelect-item {
  412. height: 52rpx;
  413. display: flex;
  414. align-items: center;
  415. border-bottom: 2rpx solid #e5e9ed;
  416. padding: 16rpx;
  417. &.relative {
  418. position: relative;
  419. .picker {
  420. position: absolute;
  421. width: 100%;
  422. padding-left: 64rpx;
  423. }
  424. }
  425. button {
  426. font-size: 32rpx;
  427. height: 52rpx;
  428. line-height: 52rpx;
  429. margin: 0;
  430. margin-left: 16rpx;
  431. color: rgb(7, 134, 60);
  432. font-weight: 700;
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .goWork {
  439. margin: 0 auto 48rpx;
  440. width: 240rpx;
  441. height: 240rpx;
  442. .goWork_btn_E {
  443. width: 100%;
  444. height: 100%;
  445. background: #bee1a7;
  446. border-radius: 30%;
  447. .goWork_btn_W {
  448. width: 75%;
  449. height: 75%;
  450. background-image: linear-gradient(to right, #72c172, #3bb197);
  451. border-radius: 30%;
  452. margin: 0 auto;
  453. position: relative;
  454. top: 12.5%;
  455. line-height: 180rpx;
  456. color: #fff;
  457. font-size: 36rpx;
  458. text-align: center;
  459. }
  460. }
  461. }
  462. .goWork_text {
  463. width: 100%;
  464. view {
  465. text-align: center;
  466. }
  467. .goWork_text-p {
  468. font-size: 36rpx;
  469. margin-bottom: 48rpx;
  470. }
  471. }
  472. .botImg {
  473. height: 600rpx;
  474. width: 100%;
  475. position: fixed;
  476. bottom: 0;
  477. .img {
  478. height: 100%;
  479. background: url("../../static/img/BG.png") no-repeat center center;
  480. background-size: 100% 100%;
  481. }
  482. }
  483. }
  484. </style>