sponsorTaskBuild.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <view class="HomeItem">
  3. <view class="goWorkAll">
  4. <view class="title">{{taskName}}</view>
  5. <view class="goWorkSelect history">
  6. <view class="goWorkSelect-list">
  7. <view class="list-title">申请科室:</view>
  8. <view @click="searchDept('applyDept')" :class="applyDeptId ? 'black' : 'gray'">
  9. {{applyDept}}
  10. </view>
  11. <text class="right-icon newicon newicon-weibiaoti2010104" @click="searchDept('applyDept')"></text>
  12. <text class="toolbar-icon newicon newicon-saoma" @click="scan()"></text>
  13. </view>
  14. <view class="goWorkSelect-list">
  15. <view class="list-title">起点科室:</view>
  16. <view @click="searchDept('startDept')" :class="startDeptId ? 'black' : 'gray'">
  17. {{startDept}}
  18. </view>
  19. <text v-if="startTarget==202 || startTarget==204 || startTarget==205" class="right-icon newicon newicon-weibiaoti2010104" @click="searchDept('startDept')"></text>
  20. </view>
  21. <view class="goWorkSelect-list">
  22. <view class="list-title">终点科室:</view>
  23. <view @click="searchDept('endDept')" :class="endDeptId ? 'black' : 'gray'">
  24. {{endDept}}
  25. </view>
  26. <text v-if="endTarget==202 || endTarget==204 || endTarget==205" class="right-icon newicon newicon-weibiaoti2010104" @click="searchDept('endDept')"></text>
  27. </view>
  28. <view class="goWorkSelect-list besides" v-if="remarksSwitch==1">
  29. <view class="list-title">备注信息:</view>
  30. <textarea v-model="remark" :placeholder="remarksPrompts"/>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="foot_btn_spe">
  35. <view class="btn3" @click="submit">建单</view>
  36. <view class="btn3" @click="goBack">返回</view>
  37. </view>
  38. <uni-popup ref="alertDialog" type="dialog" :mask-click="false">
  39. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" :content="content" @confirm="dialogConfirm"
  40. @close="dialogClose"></uni-popup-dialog>
  41. </uni-popup>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. get,
  47. post,
  48. webHandle,
  49. SM
  50. } from "../../http/http.js";
  51. export default {
  52. data() {
  53. return {
  54. list:[],
  55. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  56. SMFlag:true,
  57. applyDept:"请选择申请科室",
  58. applyDeptId:null,
  59. startDept:"请选择起点科室",
  60. startDeptId:null,
  61. endDept:"请选择终点科室",
  62. endDeptId:null,
  63. remark:null,
  64. itemTaskType:null,
  65. remarksSwitch:null,
  66. remarksPrompts:null,
  67. startTarget:null,
  68. endTarget:null,
  69. taskTypeData:null, //点击的任务类型数据
  70. taskTypeId: null,
  71. content:null,
  72. tipsCreateOder:null
  73. };
  74. },
  75. methods: {
  76. // 清空缓存
  77. setSess(){
  78. uni.setStorageSync('applyDept', null)
  79. uni.setStorageSync('taskStartDept', null)
  80. uni.setStorageSync('taskEndDept', null)
  81. uni.setStorageSync('sponsorTaskBuildData', null)
  82. },
  83. // 返回
  84. goBack() {
  85. this.setSess();
  86. uni.navigateTo({
  87. url:'/pages/sponsorTask/sponsorTask'
  88. })
  89. },
  90. // 建单
  91. submit(){
  92. if(!this.applyDeptId){
  93. uni.showToast({
  94. icon: 'none',
  95. title: '申请科室不能为空'
  96. });
  97. return
  98. }
  99. if(!this.startDeptId){
  100. uni.showToast({
  101. icon: 'none',
  102. title: '起点科室不能为空'
  103. });
  104. return
  105. }
  106. if(!this.endDeptId){
  107. uni.showToast({
  108. icon: 'none',
  109. title: '终点科室不能为空'
  110. });
  111. return
  112. }
  113. this.content = `您将前往【${this.startDept}】执行【${this.taskName}】,送往【${this.endDept}】,确定建单吗?`
  114. this.$refs.alertDialog.open()
  115. },
  116. // 确定中转
  117. dialogConfirm(){
  118. uni.showLoading({
  119. title: "加载中",
  120. mask: true,
  121. });
  122. let data = {
  123. workOrder:{
  124. tipsCreateOder: null,
  125. worker:{
  126. id: uni.getStorageSync('userData').user.id
  127. },
  128. createDept: this.applyDeptId,
  129. startDept:{
  130. id: this.startDeptId
  131. },
  132. endDepts:{
  133. id: this.endDeptId
  134. },
  135. sourceId: 4,
  136. workOrderRemark: this.remark,
  137. taskType:{
  138. id : this.taskTypeId
  139. }
  140. }
  141. }
  142. if(this.tipsCreateOder == 1){
  143. data.tipsCreateOder = 1
  144. }else{
  145. data.tipsCreateOder = undefined
  146. }
  147. post("/api/startOrder", data).then((res2) => {
  148. uni.hideLoading();
  149. if (res2.status == 200) {
  150. this.tipsCreateOder = null
  151. uni.showToast({
  152. icon: 'none',
  153. title: '操作成功'
  154. });
  155. this.setSess()
  156. setTimeout(_=>{
  157. uni.redirectTo({
  158. url:'/pages/receiptpage/receiptpage'
  159. })
  160. },1500)
  161. } else if(res2.status == 1000033){
  162. this.tipsCreateOder = 1
  163. this.content = res2.msg
  164. this.$refs.alertDialog.close()
  165. setTimeout(_=>{
  166. this.$refs.alertDialog.open()
  167. },500)
  168. } else {
  169. uni.showToast({
  170. icon: 'none',
  171. title: res2.msg || '请求数据失败!'
  172. });
  173. }
  174. });
  175. },
  176. // 取消
  177. dialogClose(){
  178. this.tipsCreateOder = null
  179. this.$refs.alertDialog.close()
  180. },
  181. // 搜索科室
  182. searchDept(type){
  183. if(type=='startDept'){
  184. if(this.startTarget==201 || this.startTarget==203){
  185. return
  186. }
  187. }
  188. if(type=='endDept'){
  189. if(this.endTarget==201 || this.endTarget==203){
  190. return
  191. }
  192. }
  193. let data = {
  194. applyDept:this.applyDept,
  195. applyDeptId:this.applyDeptId,
  196. startDept:this.startDept,
  197. startDeptId:this.startDeptId,
  198. endDept:this.endDept,
  199. endDeptId:this.endDeptId,
  200. remark:this.remark
  201. }
  202. uni.setStorageSync('sponsorTaskBuildData', JSON.stringify(data))
  203. uni.navigateTo({
  204. url: `../taskTypeSearch/taskTypeSearch?type=${type}&startTarget=${this.startTarget}&endTarget=${this.endTarget}&taskTypeData=${JSON.stringify(this.taskTypeData)}&taskTypeId=${this.taskTypeId}&taskName=${this.taskName}`
  205. });
  206. },
  207. // 扫描科室
  208. scan(){
  209. if (!this.SMFlag) {
  210. return;
  211. }
  212. this.SMFlag = false;
  213. // let content = '87bdf1c7-1514-4fa8-8fa4-07f37c06bec7'
  214. SM().then((content) => {
  215. uni.showLoading({
  216. title: "加载中",
  217. mask: true,
  218. });
  219. let data = {
  220. getDeptInfo: true,
  221. content: content
  222. }
  223. post("/dept/scanning" , data).then((res2) => {
  224. this.SMFlag = true;
  225. uni.hideLoading();
  226. if (res2.state == 200) {
  227. this.applyDept = res2.data.dept
  228. this.applyDeptId = res2.data.id
  229. if(this.startTarget==201){
  230. this.startDept = res2.data.dept
  231. this.startDeptId = res2.data.id
  232. }
  233. if(this.endTarget==201){
  234. this.endDept = res2.data.dept
  235. this.endDeptId = res2.data.id
  236. }
  237. } else {
  238. uni.showToast({
  239. icon: 'none',
  240. title: res2.msg || '请求数据失败!'
  241. });
  242. }
  243. });
  244. }).catch(err => {
  245. this.SMFlag = true;
  246. });
  247. },
  248. getTaskType(id){
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. });
  253. let postData= {
  254. taskTypeId: id
  255. }
  256. post("/ser/getdeptList", postData).then((res) => {
  257. uni.hideLoading();
  258. this.taskTypeData = res
  259. this.startTarget = this.taskTypeData.startStatus
  260. this.endTarget = this.taskTypeData.endStatus
  261. if(this.startTarget==203){
  262. this.startDept = this.taskTypeData.startDept[0].dept
  263. this.startDeptId = this.taskTypeData.startDept[0].id
  264. }
  265. if(this.endTarget==203){
  266. this.endDept = this.taskTypeData.endDept[0].dept
  267. this.endDeptId = this.taskTypeData.endDept[0].id
  268. }
  269. this.remarksSwitch = this.taskTypeData.taskType.remarksSwitch
  270. this.remarksPrompts = this.taskTypeData.taskType.remarksPrompts
  271. });
  272. }
  273. },
  274. onUnload(){
  275. this.setSess();
  276. },
  277. onShow(options){
  278. },
  279. onLoad(options) {
  280. console.log(111, options)
  281. let sponsorTaskBuildData = uni.getStorageSync('sponsorTaskBuildData')
  282. let applyDept = uni.getStorageSync('applyDept')
  283. let taskStartDept = uni.getStorageSync('taskStartDept')
  284. let taskEndDept = uni.getStorageSync('taskEndDept')
  285. if(applyDept){
  286. // 科室类型:201:默认发起科室
  287. // 科室类型:202:固定科室范围
  288. // 科室类型:203:固定科室
  289. // 科室类型:204:自主填写
  290. // 科室类型:205:固定科室类型
  291. let data = JSON.parse(applyDept)
  292. this.applyDept = data.dept
  293. this.applyDeptId = data.id
  294. if(options.startTarget){
  295. this.startTarget = options.startTarget
  296. }
  297. if(options.endTarget){
  298. this.endTarget = options.endTarget
  299. }
  300. console.log(456, this.startTarget)
  301. if(this.startTarget==201){
  302. this.startDept = data.dept
  303. this.startDeptId = data.id
  304. }
  305. if(this.endTarget==201){
  306. this.endDept = data.dept
  307. this.endDeptId = data.id
  308. }
  309. }
  310. if (taskStartDept){
  311. let data = JSON.parse(taskStartDept)
  312. if(this.startTarget!=201){
  313. this.startDept = data.dept
  314. this.startDeptId = data.id
  315. }
  316. }
  317. if (taskEndDept){
  318. let data = JSON.parse(taskEndDept)
  319. if(this.endTarget!=201){
  320. this.endDept = data.dept
  321. this.endDeptId = data.id
  322. }
  323. }
  324. // 之前有填写过数据-回显
  325. if(sponsorTaskBuildData){
  326. let data = JSON.parse(sponsorTaskBuildData)
  327. console.log(777, data)
  328. if(!applyDept){
  329. if(data.applyDept){
  330. this.applyDept = data.applyDept
  331. this.applyDeptId = data.applyDeptId
  332. }
  333. }
  334. if(!taskStartDept){
  335. if(data.startDept && this.startTarget!=201){
  336. this.startDept = data.startDept
  337. this.startDeptId = data.startDeptId
  338. }
  339. }
  340. if(!taskEndDept){
  341. if(data.endDept && this.endTarget!=201){
  342. this.endDept = data.endDept
  343. this.endDeptId = data.endDeptId
  344. }
  345. }
  346. if(data.remark){
  347. this.remark = data.remark
  348. }
  349. }
  350. if(options.data){
  351. options.data = JSON.parse(options.data);
  352. this.getTaskType(options.data.id);
  353. this.taskTypeId = options.data.id;
  354. this.taskName = options.data.taskName;
  355. }
  356. if(options.taskTypeId){
  357. this.taskTypeId = options.taskTypeId;
  358. this.taskName = options.taskName;
  359. this.getTaskType(options.taskTypeId);
  360. }
  361. },
  362. };
  363. </script>
  364. <style scoped>
  365. /deep/ .uni-textarea-wrapper{
  366. border: 1rpx solid #E5E5E5;
  367. padding-left: 6rpx;
  368. }
  369. /deep/ .uni-textarea-placeholder{
  370. padding: 6rpx;
  371. }
  372. /deep/ .uni-button-color{
  373. color: #64BD7B;
  374. }
  375. </style>
  376. <style lang="less" scoped>
  377. .black{
  378. color: #000;
  379. width: 400rpx;
  380. // overflow:hidden;/*内容超出后隐藏*/
  381. // text-overflow:ellipsis;/*超出内容显示为省略号*/
  382. // white-space:nowrap;
  383. }
  384. .gray{
  385. color: #7b7b7b;
  386. width: 400rpx;
  387. // overflow:hidden;/*内容超出后隐藏*/
  388. // text-overflow:ellipsis;/*超出内容显示为省略号*/
  389. // white-space:nowrap;
  390. }
  391. .HomeItem {
  392. .foot_btn_spe {
  393. width: 100%;
  394. position: fixed;
  395. bottom: 30rpx;
  396. left: 0;
  397. line-height: 88rpx;
  398. height: 88rpx;
  399. text-align: center;
  400. display: flex;
  401. justify-content: space-between;
  402. flex-wrap: wrap;
  403. &::after {
  404. content: '';
  405. flex: 1;
  406. }
  407. view {
  408. height: 88rpx;
  409. width: 48%;
  410. margin: 0 1%;
  411. background-image: linear-gradient(to right, #72c172, #3bb197);
  412. color: #fff;
  413. border-radius: 8rpx;
  414. font-size: 32rpx;
  415. margin-top: 16rpx;
  416. }
  417. }
  418. .login {
  419. height: 420rpx;
  420. padding: 0 32rpx;
  421. padding-top: 164rpx;
  422. position: relative;
  423. z-index: 999;
  424. .savePassword {
  425. margin-top: 32rpx;
  426. }
  427. /deep/ uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
  428. border-color: #42b983 !important;
  429. }
  430. .login_input {
  431. margin-top: 32rpx;
  432. background-color: #ffffff;
  433. height: 72rpx;
  434. box-sizing: border-box;
  435. padding: 16rpx;
  436. }
  437. .title {
  438. font-size: 36rpx;
  439. color: #42b983;
  440. text-align: center;
  441. }
  442. .tips {
  443. font-size: 28rpx;
  444. color: red;
  445. margin-top: 16rpx;
  446. }
  447. .page_item_btn {
  448. height: 88rpx;
  449. background-image: linear-gradient(to right, #72c172, #3bb197);
  450. border-radius: 8rpx;
  451. line-height: 88rpx;
  452. color: #fff;
  453. font-size: 36rpx;
  454. font-weight: 700;
  455. margin-top: 64rpx;
  456. text-align: center;
  457. }
  458. }
  459. //上班页面
  460. .goWorkAll {
  461. overflow-y: auto;
  462. display: flex;
  463. flex-direction: column;
  464. justify-content: space-between;
  465. /deep/ .uni-radio-input-checked {
  466. background-color: #42b983 !important;
  467. border-color: #42b983 !important;
  468. }
  469. /deep/ .uni-checkbox-input-checked {
  470. color: #42b983 !important;
  471. }
  472. .title{
  473. text-align: center;
  474. color: #64BD7B;
  475. line-height: 80rpx;
  476. border-bottom: 1rpx solid #E5E5E5;
  477. }
  478. .goWorkSelect {
  479. &.history {
  480. padding-bottom: 16rpx;
  481. }
  482. &.combination {
  483. .goWorkSelect-head {}
  484. .goWorkSelect-list {}
  485. }
  486. .goWorkSelect-head {
  487. font-size: 28rpx;
  488. line-height: 80rpx;
  489. border-bottom: 2rpx solid #E5E5E5;
  490. text-align: center;
  491. }
  492. .besides{
  493. align-items: start !important;
  494. }
  495. .goWorkSelect-list {
  496. display: flex;
  497. flex-wrap: nowrap;
  498. align-items: center;
  499. padding: 20rpx;
  500. border-bottom: 1rpx solid #E5E5E5;
  501. position: relative;
  502. .list-title{
  503. width: 180rpx;
  504. }
  505. .input-sign{
  506. user-select: none;
  507. pointer-events: none;
  508. }
  509. .right-icon{
  510. font-size: 38rpx !important;
  511. margin: 0 40rpx 0 10rpx;
  512. position: relative;
  513. top: -2rpx;
  514. }
  515. .toolbar-icon{
  516. position: absolute;
  517. right: 20rpx;
  518. }
  519. .newicon{
  520. font-size: 32rpx;
  521. color: #b8b8b8;
  522. }
  523. .input-num {
  524. height: 60rpx;
  525. border: 2rpx solid #E5E5E5;
  526. border-radius: 5rpx;
  527. // width: 100%;
  528. padding-left: 10rpx;
  529. // padding-right: 10rpx;
  530. }
  531. .goWorkSelect-item {
  532. height: 52rpx;
  533. display: flex;
  534. align-items: center;
  535. border-bottom: 2rpx solid #e5e9ed;
  536. padding: 16rpx;
  537. &.relative {
  538. position: relative;
  539. .picker {
  540. position: absolute;
  541. width: 100%;
  542. padding-left: 64rpx;
  543. }
  544. }
  545. button {
  546. font-size: 32rpx;
  547. height: 52rpx;
  548. line-height: 52rpx;
  549. margin: 0;
  550. margin-left: 16rpx;
  551. color: rgb(7, 134, 60);
  552. font-weight: 700;
  553. }
  554. }
  555. }
  556. .goWorkSelect-list:last-child {
  557. border-bottom: none;
  558. }
  559. }
  560. }
  561. .goWork {
  562. margin: 0 auto 48rpx;
  563. width: 240rpx;
  564. height: 240rpx;
  565. .goWork_btn_E {
  566. width: 100%;
  567. height: 100%;
  568. background: #bee1a7;
  569. border-radius: 30%;
  570. .goWork_btn_W {
  571. width: 75%;
  572. height: 75%;
  573. background-image: linear-gradient(to right, #72c172, #3bb197);
  574. border-radius: 30%;
  575. margin: 0 auto;
  576. position: relative;
  577. top: 12.5%;
  578. line-height: 180rpx;
  579. color: #fff;
  580. font-size: 36rpx;
  581. text-align: center;
  582. }
  583. }
  584. }
  585. .goWork_text {
  586. width: 100%;
  587. view {
  588. text-align: center;
  589. }
  590. .goWork_text-p {
  591. font-size: 36rpx;
  592. margin-bottom: 48rpx;
  593. }
  594. }
  595. .botImg {
  596. height: 600rpx;
  597. width: 100%;
  598. position: fixed;
  599. bottom: 0;
  600. .img {
  601. height: 100%;
  602. background: url("../../static/img/BG.png") no-repeat center center;
  603. background-size: 100% 100%;
  604. }
  605. }
  606. }
  607. </style>