geReserveApproval.vue 16 KB

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