ge.vue 12 KB

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