ge.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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="8">
  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="8">
  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="8">
  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?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] && !(this.historyData[this.historyData
  313. .length - 1].comment === "自动结束")) {
  314. this.list1.push({
  315. title: "待审批"
  316. })
  317. }
  318. this.active = this.list1.length - 1
  319. uni.hideLoading()
  320. }
  321. },
  322. dataForm(comment, pass) {
  323. this.form = {
  324. comment: this.form.pz ? this.form.pz : comment,
  325. result: pass,
  326. baseId: this.data.baseId,
  327. taskId: this.data.id,
  328. formData: this.data.formData
  329. }
  330. },
  331. passTrue(comment, pass, type) {
  332. this.dataForm(comment, pass)
  333. if (pass === 'RESULT_TRUE' && this.data.isCandidate == "1") {
  334. this.submitPass()
  335. return
  336. }
  337. if (pass === 'RESULT_FALSE') {
  338. this.getRejectListHistory()
  339. return
  340. }
  341. if (pass === 'RESULT_CASE_OF') {
  342. this.getCurrentHouXuanZu()
  343. this.selectTitle = '请选择转交人'
  344. this.nextTitle = '请选择转交人'
  345. this.$refs.popup.open(type)
  346. return
  347. }
  348. this.nextTitle = '下一步审批人'
  349. this.type = type
  350. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  351. this.$refs.popup.open(type)
  352. },
  353. async getCurrentHouXuanZu() {
  354. uni.showLoading({
  355. title: '加载中',
  356. mask: true
  357. })
  358. const {
  359. data: res
  360. } = await this.$httpRequest({
  361. url: '/app/currentPL?groupId=' + this.data.baseGroupId + '&baseId=' + this.data.baseId,
  362. method: 'get',
  363. urlType: this.$getUrlType()
  364. });
  365. if (res.code === 200) {
  366. this.dataTree = res.data
  367. uni.hideLoading()
  368. }
  369. },
  370. async submitPass() {
  371. uni.showLoading({
  372. mask: true,
  373. title: '正在提交',
  374. })
  375. if (this.form.result !== 'RESULT_FALSE' && this.data.isCandidate == "0") {
  376. if (!this.form.nextApproval) {
  377. uni.hideLoading()
  378. uni.showModal({
  379. content: '请选择批准人',
  380. title: '提交失败',
  381. showCancel: false
  382. })
  383. return
  384. }
  385. }
  386. const {
  387. data: res
  388. } = await this.$httpRequest({
  389. url: '/app/nextStep',
  390. method: 'post',
  391. data: this.form,
  392. urlType: this.$getUrlType()
  393. });
  394. if (res.code === 200) {
  395. uni.hideLoading()
  396. uni.showModal({
  397. title: "提交成功",
  398. icon: "OK",
  399. showCancel: false,
  400. success() {
  401. uni.navigateTo({
  402. url: "../../pages/app/index"
  403. })
  404. uni.navigateBack()
  405. }
  406. })
  407. } else {
  408. uni.showModal({
  409. title: "提交失败",
  410. icon: "ERROR",
  411. showCancel: false,
  412. content: res.msg
  413. })
  414. }
  415. uni.hideLoading()
  416. },
  417. dateFormat(time) {
  418. let date = new Date(time);
  419. let year = date.getFullYear();
  420. // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  421. let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  422. let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  423. let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  424. let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  425. let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  426. // 拼接
  427. // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  428. return year + "/" + month + "/" + day;
  429. }
  430. }
  431. }
  432. </script>
  433. <style lang="scss" scoped>
  434. .desc {
  435. padding: 10rpx 30rpx;
  436. }
  437. .u-page {
  438. &__button-item {
  439. margin: 0 15px 5px 0;
  440. }
  441. }
  442. .u-demo-block__content {
  443. flex-direction: row;
  444. flex-wrap: wrap;
  445. align-items: center;
  446. }
  447. .popup-content {
  448. height: 800rpx;
  449. }
  450. .geHeight {
  451. height: 100%;
  452. position: relative;
  453. }
  454. .bomButtonBody {
  455. border-top: 5rpx #f7f7f7 solid;
  456. padding: 30rpx 0 50rpx 0;
  457. width: 100%;
  458. }
  459. .status-btn {
  460. /* #ifndef APP-NVUE */
  461. display: flex;
  462. /* #endif */
  463. flex-direction: row;
  464. align-items: center;
  465. justify-content: center;
  466. height: 92rpx;
  467. margin: 30rpx;
  468. background-color: #007AFF;
  469. }
  470. .example-body {
  471. /* #ifndef APP-NVUE */
  472. display: block;
  473. /* #endif */
  474. padding: 15px;
  475. flex-direction: row;
  476. }
  477. .check-btn {
  478. display: flex;
  479. justify-content: space-between;
  480. margin-bottom: 10px;
  481. }
  482. </style>