ge.vue 14 KB

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