geEntry.vue 17 KB

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