geEntry.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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.historyData[this.historyData.length - 1].comment === "流程结束")) {
  497. this.list1.push({
  498. title: "待审批"
  499. })
  500. }
  501. }
  502. this.active = this.list1.length - 1
  503. uni.hideLoading()
  504. }
  505. },
  506. dataForm(comment, pass) {
  507. this.form = {
  508. comment: this.pz ? this.pz : comment,
  509. result: pass,
  510. baseId: this.data.baseId,
  511. taskId: this.data.id,
  512. nextApproval: this.nextApproval,
  513. nextUserName: this.nextUserName,
  514. formData: this.data.formData
  515. }
  516. },
  517. passTrue(comment, pass, type) {
  518. this.dataForm(comment, pass)
  519. if (pass === 'RESULT_TRUE' && this.data.isCandidate == "1") {
  520. this.submitPass()
  521. return
  522. }
  523. if (pass === 'RESULT_FALSE') {
  524. this.getRejectListHistory()
  525. return
  526. }
  527. if (pass === 'RESULT_CASE_OF') {
  528. this.getCurrentHouXuanZu()
  529. this.selectTitle = '请选择转交人'
  530. this.nextTitle = '请选择转交人'
  531. this.$refs.popup.open(type)
  532. return
  533. }
  534. this.getHouXuanZu()
  535. this.nextTitle = '下一步审批人'
  536. this.type = type
  537. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  538. this.$refs.popup.open(type)
  539. },
  540. async getCurrentHouXuanZu() {
  541. uni.showLoading({
  542. title: '加载中',
  543. mask: true
  544. })
  545. const {
  546. data: res
  547. } = await this.$httpRequest({
  548. url: '/app/currentPL?taskId='+ this.data.id +'&groupId=' + this.data.baseGroupId + '&baseId=' + this.data.baseId,
  549. method: 'get'
  550. });
  551. if (res.code === 200) {
  552. this.dataTree = res.data
  553. uni.hideLoading()
  554. }
  555. },
  556. async submitPass() {
  557. uni.showLoading({
  558. mask: true,
  559. title: '正在提交'
  560. })
  561. if (this.form.result !== 'RESULT_FALSE' && this.data.isCandidate == "0" && 2.0 < parseFloat(this.data
  562. .formData.total_time)) {
  563. if (!this.nextApproval) {
  564. uni.showModal({
  565. content: '请选择批准人',
  566. title: '提交失败',
  567. showCancel: false
  568. })
  569. this.isDisabled = false
  570. return
  571. }
  572. }
  573. this.form.nextApproval = this.nextApproval
  574. this.form.nextUserName = this.nextUserName
  575. const {
  576. data: res
  577. } = await this.$httpRequest({
  578. url: '/app/nextStep',
  579. method: 'post',
  580. data: this.form
  581. });
  582. if (res.code === 200) {
  583. uni.hideLoading()
  584. uni.showModal({
  585. title: "提交成功",
  586. icon: "OK",
  587. showCancel: false,
  588. success() {
  589. setTimeout(() => {
  590. this.isDisabled = false
  591. }, 1000)
  592. uni.navigateBack()
  593. }
  594. })
  595. } else {
  596. uni.showModal({
  597. title: "提交失败",
  598. icon: "ERROR",
  599. showCancel: false,
  600. content: res.msg
  601. })
  602. }
  603. setTimeout(() => {
  604. this.isDisabled = false
  605. }, 1000)
  606. setTimeout(() => {
  607. this.isDisabled = false
  608. uni.hideLoading()
  609. }, 1000)
  610. },
  611. dateFormat(time) {
  612. let date = new Date(time);
  613. let year = date.getFullYear();
  614. // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  615. let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  616. let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  617. let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  618. let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  619. let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  620. // 拼接
  621. // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  622. return year + "/" + month + "/" + day;
  623. }
  624. }
  625. }
  626. </script>
  627. <style lang="scss" scoped>
  628. .desc {
  629. padding: 10rpx;
  630. }
  631. .u-page {
  632. &__button-item {
  633. margin: 0 15px 5px 0;
  634. }
  635. }
  636. .u-demo-block__content {
  637. flex-direction: row;
  638. flex-wrap: wrap;
  639. align-items: center;
  640. }
  641. .popup-content {
  642. height: 800rpx;
  643. }
  644. .geHeight {
  645. height: 100%;
  646. position: relative;
  647. }
  648. .bomButtonBody {
  649. border-top: 5rpx #f7f7f7 solid;
  650. padding: 30rpx 0 50rpx 0;
  651. width: 100%;
  652. background-color: #ffffff;
  653. }
  654. .status-btn {
  655. /* #ifndef APP-NVUE */
  656. display: flex;
  657. /* #endif */
  658. flex-direction: row;
  659. align-items: center;
  660. justify-content: center;
  661. height: 92rpx;
  662. margin: 30rpx;
  663. background-color: #007AFF;
  664. }
  665. .example-body {
  666. /* #ifndef APP-NVUE */
  667. display: block;
  668. /* #endif */
  669. padding: 15px;
  670. flex-direction: row;
  671. }
  672. .check-btn {
  673. display: flex;
  674. justify-content: space-between;
  675. margin-bottom: 10px;
  676. }
  677. </style>