sponsorTaskBuild.vue 14 KB

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