geApproval.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  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.historyData[this.historyData.length - 1].comment === "流程结束")) {
  434. this.list1.push({
  435. title: "待审批"
  436. })
  437. }
  438. }
  439. this.active = this.list1.length - 1
  440. }
  441. },
  442. dataForm(comment, pass) {
  443. this.form = {
  444. comment: this.pz ? this.pz : comment,
  445. result: pass,
  446. baseId: this.data.baseId,
  447. taskId: this.data.id,
  448. nextApproval: this.nextApproval,
  449. nextUserName: this.nextUserName,
  450. formData: this.data.formData
  451. }
  452. },
  453. passTrue(comment, pass, type) {
  454. this.type = type
  455. this.dataForm(comment, pass)
  456. if (pass !== 'RESULT_CASE_OF' && 2.0 >= parseFloat(this.data.formData.total_time) && this.data.formData
  457. .is_lh === '不离沪' && this.data.formData.is_middle_level_leader === '否') {
  458. this.submitPass()
  459. return
  460. }
  461. if (pass === 'RESULT_TRUE' && this.data.isCandidate == "1") {
  462. this.submitPass()
  463. return
  464. }
  465. if (pass === 'RESULT_FALSE') {
  466. this.getRejectListHistory()
  467. return
  468. }
  469. if (pass === 'RESULT_CASE_OF') {
  470. this.getCurrentHouXuanZu()
  471. this.selectTitle = '请选择转交人'
  472. this.nextTitle = '请选择转交人'
  473. this.$refs.popup.open(type)
  474. return
  475. }
  476. this.getNextHouXuanZu()
  477. this.nextTitle = '下一步审批人'
  478. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  479. this.$refs.popup.open('bottom')
  480. },
  481. async getRejectListHistory() {
  482. uni.showLoading({
  483. title: '加载中',
  484. mask: true
  485. })
  486. let id = this.data.taskId ? this.data.taskId : this.data.id
  487. const {
  488. data: res
  489. } = await this.$httpRequest({
  490. url: '/app/reject/ctr?taskId=' + id,
  491. method: 'get',
  492. data: this.queryParams,
  493. urlType: this.$getUrlType()
  494. });
  495. if (res.code === 200) {
  496. if (res.data.length == 0) {
  497. this.submitPass()
  498. return
  499. }
  500. this.$refs.popup2.open('bottom')
  501. this.rejectHistoryData = res.data
  502. uni.hideLoading()
  503. }
  504. },
  505. async submitPass() {
  506. uni.showLoading({
  507. mask: true,
  508. title: '正在提交'
  509. })
  510. if (this.form.result !== 'RESULT_FALSE' && this.data.isCandidate == "0" && 2.0 < parseFloat(this.data
  511. .formData.total_time)) {
  512. if (!this.nextApproval) {
  513. uni.showModal({
  514. content: '请选择批准人',
  515. title: '提交失败',
  516. showCancel: false
  517. })
  518. this.isDisabled = false
  519. return
  520. }
  521. }
  522. this.form.nextApproval = this.nextApproval
  523. this.form.nextUserName = this.nextUserName
  524. const {
  525. data: res
  526. } = await this.$httpRequest({
  527. url: '/app/nextStep',
  528. method: 'post',
  529. data: this.form,
  530. urlType: this.$getUrlType()
  531. });
  532. if (res.code === 200) {
  533. let that = this
  534. uni.hideLoading()
  535. uni.showModal({
  536. title: "提交成功",
  537. icon: "OK",
  538. showCancel: false,
  539. success() {
  540. setTimeout(() => {
  541. that.isDisabled = false
  542. }, 1000)
  543. uni.navigateBack()
  544. }
  545. })
  546. } else {
  547. uni.hideLoading()
  548. uni.showModal({
  549. title: "提交失败",
  550. icon: "ERROR",
  551. showCancel: false,
  552. content: res.msg
  553. })
  554. }
  555. setTimeout(() => {
  556. this.isDisabled = false
  557. }, 1000)
  558. setTimeout(() => {
  559. this.isDisabled = false
  560. uni.hideLoading()
  561. }, 1000)
  562. },
  563. dateFormat(time) {
  564. let date = new Date(time);
  565. let year = date.getFullYear();
  566. // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  567. let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  568. let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  569. let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  570. let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  571. let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  572. // 拼接
  573. // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  574. return year + "/" + month + "/" + day;
  575. }
  576. }
  577. }
  578. </script>
  579. <style lang="scss" scoped>
  580. .desc {
  581. padding: 10rpx;
  582. }
  583. .popup-content {
  584. height: 100%;
  585. }
  586. .geHeight {
  587. height: 100%;
  588. position: relative;
  589. }
  590. .bomButtonBody {
  591. border-top: 5rpx #f5f5f5 solid;
  592. padding: 30rpx 0 50rpx 0;
  593. width: 100%;
  594. background-color: #ffffff;
  595. }
  596. .status-btn {
  597. /* #ifndef APP-NVUE */
  598. display: flex;
  599. /* #endif */
  600. flex-direction: row;
  601. align-items: center;
  602. justify-content: center;
  603. height: 92rpx;
  604. margin: 30rpx;
  605. background-color: #007AFF;
  606. }
  607. .example-body {
  608. /* #ifndef APP-NVUE */
  609. display: block;
  610. /* #endif */
  611. padding: 15px;
  612. flex-direction: row;
  613. }
  614. </style>