geReserveApproval.vue 16 KB

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