geApproval.vue 15 KB

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