geApproval.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <view class="geHeight">
  3. <view style="height: 100%;">
  4. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  5. <view>
  6. <uni-row>
  7. <uni-col :span="6">
  8. <view class="desc">
  9. 请假类型
  10. </view>
  11. </uni-col>
  12. <uni-col :span="18">
  13. <view class="desc">
  14. {{$dictTranslation(data.formData.type,'app_vacate_type','dict')}}
  15. </view>
  16. </uni-col>
  17. </uni-row>
  18. </view>
  19. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  20. <view>
  21. <uni-row>
  22. <uni-col :span="6">
  23. <view class="desc">
  24. 请假原因
  25. </view>
  26. </uni-col>
  27. <uni-col :span="18">
  28. <view class="desc">
  29. {{data.formData.reason}}
  30. </view>
  31. </uni-col>
  32. </uni-row>
  33. </view>
  34. <view>
  35. <uni-row>
  36. <uni-col :span="6">
  37. <view class="desc">
  38. 是否中层领导
  39. </view>
  40. </uni-col>
  41. <uni-col :span="18">
  42. <view class="desc">
  43. {{data.formData.is_middle_level_leader}}
  44. </view>
  45. </uni-col>
  46. </uni-row>
  47. </view>
  48. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  49. <view>
  50. <uni-row>
  51. <uni-col :span="6">
  52. <view class="desc">
  53. 申请人
  54. </view>
  55. </uni-col>
  56. <uni-col :span="18">
  57. <view class="desc">
  58. {{data.formData.apply_user_name}}
  59. </view>
  60. </uni-col>
  61. </uni-row>
  62. <uni-row>
  63. <uni-col :span="6">
  64. <view class="desc">
  65. 开始时间
  66. </view>
  67. </uni-col>
  68. <uni-col :span="18">
  69. <view class="desc">
  70. {{dateFormat(data.formData.leave_start_time)}}
  71. </view>
  72. </uni-col>
  73. </uni-row>
  74. <uni-row>
  75. <uni-col :span="6">
  76. <view class="desc">
  77. 结束时间
  78. </view>
  79. </uni-col>
  80. <uni-col :span="18">
  81. <view class="desc">
  82. {{dateFormat(data.formData.leave_end_time)}}
  83. </view>
  84. </uni-col>
  85. </uni-row>
  86. <uni-row>
  87. <uni-col :span="6">
  88. <view class="desc">
  89. 天数
  90. </view>
  91. </uni-col>
  92. <uni-col :span="18">
  93. <view class="desc">
  94. {{data.formData.total_time}}
  95. </view>
  96. </uni-col>
  97. </uni-row>
  98. <uni-row>
  99. <uni-col :span="6">
  100. <view class="desc">
  101. 是否离沪
  102. </view>
  103. </uni-col>
  104. <uni-col :span="18">
  105. <view class="desc">
  106. {{data.formData.is_lh}}
  107. </view>
  108. </uni-col>
  109. </uni-row>
  110. <uni-row>
  111. <uni-col :span="6">
  112. <view class="desc">
  113. 出行方式
  114. </view>
  115. </uni-col>
  116. <uni-col :span="18">
  117. <view class="desc" v-if="data.formData.trip_mode">
  118. {{data.formData.trip_mode}}
  119. </view>
  120. </uni-col>
  121. </uni-row>
  122. <uni-row>
  123. <uni-col :span="6">
  124. <view class="desc">
  125. 出行地点
  126. </view>
  127. </uni-col>
  128. <uni-col :span="18">
  129. <view class="desc" v-if="data.formData.trip_address">
  130. {{data.formData.trip_address}}
  131. </view>
  132. </uni-col>
  133. </uni-row>
  134. <uni-row>
  135. <uni-col :span="6">
  136. <view class="desc">
  137. 详细地址
  138. </view>
  139. </uni-col>
  140. <uni-col :span="18">
  141. <view class="desc" v-if="data.formData.detail_addr">
  142. {{data.formData.detail_addr}}
  143. </view>
  144. </uni-col>
  145. </uni-row>
  146. </view>
  147. <view class="desc">
  148. <view class="desc">
  149. 图片
  150. </view>
  151. <view style="width: 100%;overflow-x: scroll;white-space: nowrap">
  152. <u-upload v-if="data.pageType >= 1 && data.pageType <= 2" :fileList="data.formData.imgUrls" multiple
  153. width="120" height="120" useBeforeRead="true" disabled="true" uploadIcon="clock">
  154. </u-upload>
  155. <u-upload v-if="data.pageType >= 3" :fileList="data.formData.imgUrls" multiple width="120"
  156. height="120" useBeforeRead="true" disabled="true" uploadIcon="clock">
  157. </u-upload>
  158. </view>
  159. </view>
  160. <view class="desc">
  161. <view>
  162. <uni-steps :options="list1" :active="active" direction="column" active-color="rgb(55,186,189)" />
  163. </view>
  164. </view>
  165. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  166. <view class="desc" v-if="data.pageType === 1">
  167. <view class="desc" style="color: #bababa;">
  168. 批注:
  169. </view>
  170. <view class="desc">
  171. <!-- <u--textarea v-model="pz" border="bottom"></u--textarea> -->
  172. <uni-easyinput type="textarea" v-model="pz" primaryColor="rgb(55,186,189)" :inputBorder="false">
  173. </uni-easyinput>
  174. </view>
  175. </view>
  176. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  177. </view>
  178. <view v-if="data.pageType == 3" class="bomButtonBody" style="height: 10%;">
  179. <uni-row v-if="list1 && list1.length === 1">
  180. <uni-col>
  181. <view class="desc">
  182. <u-button :disabled="isDisabled" color="rgb(55,186,189)" shape="circle" size="large"
  183. @click="revoke">撤销
  184. </u-button>
  185. </view>
  186. </uni-col>
  187. </uni-row>
  188. <uni-row>
  189. <uni-col>
  190. <view class="desc">
  191. <u-button :disabled="isDisabled" color="rgb(55,186,189)" shape="circle" size="large"
  192. @click="againLaunch">再次发起
  193. </u-button>
  194. </view>
  195. </uni-col>
  196. </uni-row>
  197. </view>
  198. <u-gap height="110" bgColor="#f5f5f5"></u-gap>
  199. <view v-if="data.pageType === 1 && zindeButtion === 1 && data.isEnd === '0'" class="bomButtonBody"
  200. style="position: fixed;bottom: 0">
  201. <uni-row>
  202. <uni-col :span="10">
  203. <view class="desc">
  204. <u-button color="rgb(55,186,189)" shape="circle" size="large"
  205. @click="passTrue('同意','RESULT_TRUE','bottom')">同意,下一步
  206. </u-button>
  207. </view>
  208. </uni-col>
  209. <uni-col :span="7.5">
  210. <view class="desc">
  211. <u-button color="rgb(188, 188, 188)" shape="circle" size="large"
  212. @click="passTrue('驳回','RESULT_FALSE','bottom')">驳回</u-button>
  213. </view>
  214. </uni-col>
  215. <uni-col :span="7.5">
  216. <view class="desc">
  217. <u-button color="rgb(136, 188, 160)" shape="circle" size="large"
  218. @click="passTrue('驳回','RESULT_CASE_OF','bottom')">转交</u-button>
  219. </view>
  220. </uni-col>
  221. </uni-row>
  222. </view>
  223. <view>
  224. <!-- 普通弹窗 -->
  225. <uni-popup ref="popup" background-color="#fff" @change="propChange">
  226. <view :style="{'height': approvalPopupHeight+'px'}"
  227. :class="{ 'popup-height': type === 'left' || type === 'right' }">
  228. <view class="desc">
  229. <uni-row>
  230. <uni-col :span="8">
  231. <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
  232. </view>
  233. </uni-col>
  234. <uni-col :span="13">
  235. <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
  236. {{nextTitle}}
  237. </view>
  238. </uni-col>
  239. <uni-col :span="3">
  240. <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
  241. 确认
  242. </view>
  243. </uni-col>
  244. </uni-row>
  245. </view>
  246. <view class="desc">
  247. <uni-row>
  248. <uni-col>
  249. <view class="desc">
  250. <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
  251. :localdata="dataTree" v-model="nextUserName" @change="nextApprovalChange">
  252. </uni-data-picker>
  253. </view>
  254. </uni-col>
  255. </uni-row>
  256. </view>
  257. </view>
  258. </uni-popup>
  259. </view>
  260. <view>
  261. <!-- 驳回选择弹窗 -->
  262. <uni-popup ref="popup2" background-color="#fff" @change="propChange">
  263. <view style="height: 800rpx;">
  264. <view class="desc">
  265. <view style="text-align: center;font-size: 30rpx;color: rgb(98, 98, 98);">
  266. 驳回至以下任意流程
  267. </view>
  268. </view>
  269. <view style="padding: 20rpx 10rpx;">
  270. <uni-list v-for="item in rejectHistoryData">
  271. <uni-list-item :clickable="true" @click="rejectSubmit(item)" :title="item.comment" />
  272. </uni-list>
  273. </view>
  274. </view>
  275. </uni-popup>
  276. </view>
  277. </view>
  278. </template>
  279. <script>
  280. export default {
  281. data() {
  282. return {
  283. pz: '',
  284. nextApproval: '',
  285. nextUserName: '',
  286. app_vacate_type: uni.getStorageSync('app_vacate_type'),
  287. data: uni.getStorageSync("approval"),
  288. form: {},
  289. dataTree: [],
  290. queryParams: {},
  291. historyData: [],
  292. active: 0,
  293. list1: [],
  294. isDisabled: false,
  295. actions: [],
  296. type: 'center',
  297. zindeButtion: 1,
  298. selectTitle: '',
  299. nextTitle: '',
  300. rejectHistoryData: [],
  301. approvalPopupHeight: 0,
  302. }
  303. },
  304. onLoad() {
  305. this.getNextHouXuanZu()
  306. this.getListHistory()
  307. this.readTask()
  308. this.approvalPopupHeight = parseInt(uni.getStorageSync('windowHeight')) / 2 + 50
  309. console.log(uni.getStorageSync('windowHeight'))
  310. if (this.data.baseName && this.data.pageType === 1) {
  311. uni.setNavigationBarTitle({
  312. title: this.data.baseName
  313. })
  314. }
  315. },
  316. methods: {
  317. nextApprovalChange(e) {
  318. this.nextUserName = e.detail.value[1].text
  319. this.nextApproval = e.detail.value[1].value
  320. },
  321. propChange(e) {
  322. if (e.show) {
  323. this.zindeButtion = 0
  324. } else {
  325. this.zindeButtion = 1
  326. }
  327. },
  328. rejectSubmit(item) {
  329. this.form.rejectBaseId = item.baseId
  330. this.nextApproval = item.operator
  331. this.submitPass()
  332. },
  333. againLaunch() {
  334. this.$goto('../hr/leave')
  335. },
  336. async revoke() {
  337. const {
  338. data: res
  339. } = await this.$httpRequest({
  340. url: '/app/revoke?taskId=' + this.data.id,
  341. method: 'get',
  342. urlType: this.$getUrlType()
  343. });
  344. if (res.code === 200) {
  345. uni.showModal({
  346. title: "撤销成功",
  347. icon: "OK",
  348. showCancel: false,
  349. success() {
  350. uni.navigateBack()
  351. }
  352. })
  353. } else {
  354. uni.showModal({
  355. title: "撤销失败",
  356. content: res.msg,
  357. showCancel: false,
  358. success() {
  359. uni.navigateBack()
  360. }
  361. })
  362. }
  363. },
  364. async readTask() {
  365. const {
  366. data: res
  367. } = await this.$httpRequest({
  368. url: '/app/rt?taskId=' + this.data.id,
  369. method: 'get',
  370. urlType: this.$getUrlType()
  371. });
  372. if (res.code === 200) {}
  373. },
  374. async getCurrentHouXuanZu() {
  375. uni.showLoading({
  376. title: '加载中',
  377. mask: true
  378. })
  379. const {
  380. data: res
  381. } = await this.$httpRequest({
  382. url: '/app/currentPL?taskId=' + this.data.id + '&groupId=' + this.data.baseGroupId +
  383. '&baseId=' + this.data.baseId,
  384. method: 'get',
  385. urlType: this.$getUrlType()
  386. });
  387. if (res.code === 200) {
  388. this.dataTree = res.data
  389. uni.hideLoading()
  390. }
  391. },
  392. async getNextHouXuanZu() {
  393. const {
  394. data: res
  395. } = await this.$httpRequest({
  396. url: '/app/pL?taskId=' + this.data.id + '&groupId=' + this.data.baseGroupId + '&baseId=' +
  397. this.data.baseId,
  398. method: 'get',
  399. urlType: this.$getUrlType()
  400. });
  401. if (res.code === 200) {
  402. this.dataTree = res.data
  403. }
  404. },
  405. async getListHistory() {
  406. let id = this.data.taskId ? this.data.taskId : this.data.id
  407. const {
  408. data: res
  409. } = await this.$httpRequest({
  410. url: '/app/ctr?taskId=' + id,
  411. method: 'get',
  412. data: this.queryParams,
  413. urlType: this.$getUrlType()
  414. });
  415. if (res.code === 200) {
  416. this.historyData = res.data
  417. this.list1
  418. if (0 != this.historyData.length) {
  419. for (var i = 0; i < this.historyData.length; i++) {
  420. this.list1.push({
  421. title: this.historyData[i].comment,
  422. desc: this.historyData[i].createTime
  423. })
  424. }
  425. } else {
  426. this.list1.push({
  427. title: "待审批"
  428. })
  429. }
  430. if (this.historyData[this.historyData.length - 1]) {
  431. if (!(this.historyData[this.historyData.length - 1].comment === "同意并结束") &&
  432. !(this.historyData[this.historyData.length - 1].comment === "自动结束")) {
  433. this.list1.push({
  434. title: "待审批"
  435. })
  436. }
  437. }
  438. this.active = this.list1.length - 1
  439. }
  440. },
  441. dataForm(comment, pass) {
  442. this.form = {
  443. comment: this.pz ? this.pz : comment,
  444. result: pass,
  445. baseId: this.data.baseId,
  446. taskId: this.data.id,
  447. nextApproval: this.nextApproval,
  448. nextUserName: this.nextUserName,
  449. formData: this.data.formData
  450. }
  451. },
  452. passTrue(comment, pass, type) {
  453. this.type = type
  454. this.dataForm(comment, pass)
  455. if (pass !== 'RESULT_CASE_OF' && 2.0 >= parseFloat(this.data.formData.total_time) && this.data.formData
  456. .is_lh === '不离沪') {
  457. this.submitPass()
  458. return
  459. }
  460. if (pass === 'RESULT_TRUE' && this.data.isCandidate == "1") {
  461. this.submitPass()
  462. return
  463. }
  464. if (pass === 'RESULT_FALSE') {
  465. this.getRejectListHistory()
  466. return
  467. }
  468. if (pass === 'RESULT_CASE_OF') {
  469. this.getCurrentHouXuanZu()
  470. this.selectTitle = '请选择转交人'
  471. this.nextTitle = '请选择转交人'
  472. this.$refs.popup.open(type)
  473. return
  474. }
  475. this.nextTitle = '下一步审批人'
  476. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  477. this.$refs.popup.open('bottom')
  478. },
  479. async getRejectListHistory() {
  480. uni.showLoading({
  481. title: '加载中',
  482. mask: true
  483. })
  484. let id = this.data.taskId ? this.data.taskId : this.data.id
  485. const {
  486. data: res
  487. } = await this.$httpRequest({
  488. url: '/app/reject/ctr?taskId=' + id,
  489. method: 'get',
  490. data: this.queryParams,
  491. urlType: this.$getUrlType()
  492. });
  493. if (res.code === 200) {
  494. if (res.data.length == 0) {
  495. this.submitPass()
  496. return
  497. }
  498. this.$refs.popup2.open('bottom')
  499. this.rejectHistoryData = res.data
  500. uni.hideLoading()
  501. }
  502. },
  503. async submitPass() {
  504. uni.showLoading({
  505. mask: true,
  506. title: '正在提交'
  507. })
  508. if (this.form.result !== 'RESULT_FALSE' && this.data.isCandidate == "0" && 2.0 < parseFloat(this.data
  509. .formData.total_time)) {
  510. if (!this.nextApproval) {
  511. uni.showModal({
  512. content: '请选择批准人',
  513. title: '提交失败',
  514. showCancel: false
  515. })
  516. this.isDisabled = false
  517. return
  518. }
  519. }
  520. this.form.nextApproval = this.nextApproval
  521. this.form.nextUserName = this.nextUserName
  522. const {
  523. data: res
  524. } = await this.$httpRequest({
  525. url: '/app/nextStep',
  526. method: 'post',
  527. data: this.form,
  528. urlType: this.$getUrlType()
  529. });
  530. if (res.code === 200) {
  531. let that = this
  532. uni.hideLoading()
  533. uni.showModal({
  534. title: "提交成功",
  535. icon: "OK",
  536. showCancel: false,
  537. success() {
  538. setTimeout(() => {
  539. that.isDisabled = false
  540. }, 1000)
  541. uni.navigateBack()
  542. }
  543. })
  544. } else {
  545. uni.hideLoading()
  546. uni.showModal({
  547. title: "提交失败",
  548. icon: "ERROR",
  549. showCancel: false,
  550. content: res.msg
  551. })
  552. }
  553. setTimeout(() => {
  554. this.isDisabled = false
  555. }, 1000)
  556. setTimeout(() => {
  557. this.isDisabled = false
  558. uni.hideLoading()
  559. }, 1000)
  560. },
  561. dateFormat(time) {
  562. let date = new Date(time);
  563. let year = date.getFullYear();
  564. // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  565. let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  566. let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  567. let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  568. let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  569. let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  570. // 拼接
  571. // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  572. return year + "/" + month + "/" + day;
  573. }
  574. }
  575. }
  576. </script>
  577. <style lang="scss" scoped>
  578. .desc {
  579. padding: 10rpx;
  580. }
  581. .popup-content {
  582. height: 100%;
  583. }
  584. .geHeight {
  585. height: 100%;
  586. position: relative;
  587. }
  588. .bomButtonBody {
  589. border-top: 5rpx #f5f5f5 solid;
  590. padding: 30rpx 0 50rpx 0;
  591. width: 100%;
  592. background-color: #ffffff;
  593. }
  594. .status-btn {
  595. /* #ifndef APP-NVUE */
  596. display: flex;
  597. /* #endif */
  598. flex-direction: row;
  599. align-items: center;
  600. justify-content: center;
  601. height: 92rpx;
  602. margin: 30rpx;
  603. background-color: #007AFF;
  604. }
  605. .example-body {
  606. /* #ifndef APP-NVUE */
  607. display: block;
  608. /* #endif */
  609. padding: 15px;
  610. flex-direction: row;
  611. }
  612. </style>