geReserveApproval.vue 16 KB

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