index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <template>
  2. <view class="blacklog-container">
  3. <uni-nav-bar height="100rpx" fixed="true" statusBar="true" left-icon="back" :title="title" @clickLeft="back"
  4. background-color="#157A2C" color="#fff"></uni-nav-bar>
  5. <!-- <div>
  6. <u-search placeholder="搜索模板名称" shape="square" v-model="keyword"></u-search>
  7. </div> -->
  8. <view class="list-container">
  9. <u-list v-show='value1==0'>
  10. <u-list-item v-for="(item, index) in baseList" :key="index">
  11. <view class="kd-card">
  12. <view class="card-title">
  13. <text>{{ Object.values(item)[0] }}</text>
  14. </view>
  15. <view>
  16. <u-grid :border="true">
  17. <u-grid-item v-if='listItem.dictType== Object.keys(item)[0]' class='grid-item'
  18. :customStyle="{width:33+'%',height:220+'rpx'}"
  19. v-for="(listItem,listIndex) in defaultList" :key="listIndex"
  20. @click="handleDetail(listItem,'add')">
  21. <zui-svg-icon style="position: relative;bottom: -14px" :icon="listItem.icon"
  22. width="3rem" />
  23. <text class="grid-text">{{listItem.name}}</text>
  24. </u-grid-item>
  25. </u-grid>
  26. </view>
  27. </view>
  28. </u-list-item>
  29. </u-list>
  30. <u-list v-show='value1==1' @scrolltolower="scrolltolower">
  31. <view v-show="list.length === 0" class="no_data">
  32. <u-empty mode="data" textSize="30"></u-empty>
  33. </view>
  34. <u-list-item v-for="(item, index) in list" :key="index">
  35. <view class="kd-card-1">
  36. <view class="card-title-1">
  37. <text>{{ item.processInstance.name }}</text>
  38. <text class="card-time-1">{{ item.createTime }}</text>
  39. </view>
  40. <view>
  41. <view class="card-body-1">
  42. <view class="card-col-1" v-for="itm in colOptions">
  43. <text class="label-1">{{ itm.label }}</text>
  44. <text class="content-1">{{ item[itm.key] }}</text>
  45. </view>
  46. </view>
  47. <view class="card-footer-1">
  48. <u-button type="success" @click="handleDetail(item, 'approve')">处理</u-button>
  49. <u-button type="info" @click="handleDetailView(item, 'detail')">流程详情</u-button>
  50. </view>
  51. </view>
  52. </view>
  53. </u-list-item>
  54. </u-list>
  55. <u-list v-show='value1==2' @scrolltolower="scrolltolowerDone">
  56. <view v-show="doneList.length === 0" class="no_data">
  57. <u-empty mode="data" textSize="30"></u-empty>
  58. </view>
  59. <!-- @click.native="handleDetailView(item)" -->
  60. <u-list-item v-for="(item, index) in doneList" :key="index" >
  61. <view class="kd-card-2">
  62. <view class="card-title-1">
  63. <text>{{ item.name }}</text>
  64. <text :class="resultClass[item.result]">{{ handleResult[item.result] }}</text>
  65. </view>
  66. <view>
  67. <view class="card-body-1">
  68. <!-- <view class="card-col-1">
  69. <text class="label-1">审批意见</text>
  70. <text class="content-1">{{ item.reason }}</text>
  71. </view> -->
  72. <view class="card-col-1">
  73. <text class="label-1">处理时间</text>
  74. <text class="content-1">{{ item.endTime }}</text>
  75. <text v-if="item.status == 1" class="content-2" @click.stop="handleWithdraw(item)">撤回</text>
  76. </view>
  77. <view class="card-col-1">
  78. <!-- <text class="label-1" @click.stop="handleDetail(item,'view','false')">提交记录</text> -->
  79. </view>
  80. </view>
  81. <view class="card-footer-1">
  82. <u-button type="success" @click="handleDetailRecode(item, 'view')">提交记录</u-button>
  83. <u-button type="info" @click="handleDetailView(item, 'detail')">流程详情</u-button>
  84. </view>
  85. </view>
  86. </view>
  87. </u-list-item>
  88. </u-list>
  89. <u-list v-show='value1==3' @scrolltolower="scrolltolowerCopy">
  90. <view v-show="copyList.length === 0" class="no_data">
  91. <u-empty mode="data" textSize="30"></u-empty>
  92. </view>
  93. <!-- @click.native="handleDetailView(item)" -->
  94. <u-list-item v-for="(item, index) in copyList" :key="index" >
  95. <view class="kd-card-2">
  96. <view class="card-title-1">
  97. <text><text v-if="item.isRead == 0" class="dot"></text> {{ item.name }}</text>
  98. <text :class="resultClass[item.result]">{{ handleResult[item.result] }}</text>
  99. </view>
  100. <view>
  101. <view class="card-body-1">
  102. <!-- <view class="card-col-1">
  103. <text class="label-1">审批意见</text>
  104. <text class="content-1">{{ item.reason }}</text>
  105. </view> -->
  106. <view class="card-col-1">
  107. <text class="label-1">处理时间</text>
  108. <text class="content-1">{{ item.endTime }}</text>
  109. </view>
  110. <view class="card-col-1">
  111. <!-- <text class="label-1" @click.stop="handleDetail(item,'view','false')">提交记录</text> -->
  112. </view>
  113. </view>
  114. <view class="card-footer-1">
  115. <u-button type="success" @click="handleDetailRecode(item, 'view')">提交记录</u-button>
  116. <u-button type="info" @click="handleDetailView(item, 'detail')">流程详情</u-button>
  117. </view>
  118. </view>
  119. </view>
  120. </u-list-item>
  121. </u-list>
  122. </view>
  123. <u-tabbar class="tabbarBox" :value="value1" @change="change1" :fixed="true" :placeholder='false'
  124. :safeAreaInsetBottom="true">
  125. <u-tabbar-item class='tabbarItem' v-for="item in tabbarItems" :text="item.text" :icon="item.icon"
  126. @click="click1"></u-tabbar-item>
  127. </u-tabbar>
  128. </view>
  129. </template>
  130. <script>
  131. import {
  132. getTodoTaskPage,
  133. getProcessInstancePage,
  134. getProcessInstanceCopyPage,
  135. ccReaderTask,
  136. withdrawTask
  137. } from '@/api/wt/index.js'
  138. let [page, size, isEnd] = [1, 10, true]
  139. let [donePage, doneSize, doneIsEnd] = [1, 10, true]
  140. let [copyPage, copySize, copyIsEnd] = [1, 10, true]
  141. import {
  142. getBpmCustomFormList,
  143. } from '@/api/wt/index.js'
  144. import {
  145. getByCode
  146. } from '@/api/pda/common.js'
  147. import svgIcon from '@/components/svg-icon.vue'
  148. export default {
  149. components: {
  150. svgIcon
  151. },
  152. data() {
  153. return {
  154. value1: 0,
  155. title: '申请',
  156. handleResult: {
  157. 1: '处理中',
  158. 2: '通过',
  159. 3: '不通过',
  160. 4: '已取消',
  161. },
  162. resultClass: {
  163. 1: 'text-warning',
  164. 2: 'text-primary',
  165. 3: 'text-danger',
  166. 4: 'text-normal',
  167. },
  168. tabbarItems: [{
  169. text: '申请',
  170. icon: 'file-text',
  171. },
  172. {
  173. text: '我审批的',
  174. icon: 'edit-pen',
  175. },
  176. {
  177. text: '我提交的',
  178. icon: 'arrow-upward',
  179. },
  180. {
  181. text: '我的抄送',
  182. icon: 'file-text',
  183. }
  184. ],
  185. keyword: '',
  186. baseList: [],
  187. defaultList: [],
  188. list: [],
  189. doneList: [],
  190. copyList: []
  191. }
  192. },
  193. computed: {
  194. colOptions() {
  195. return [{
  196. label: '流程节点',
  197. key: 'name'
  198. },
  199. {
  200. label: '流程发起人',
  201. key: `startUserNickname`
  202. }
  203. ]
  204. }
  205. },
  206. onShow() {
  207. this.getBaseList()
  208. page = 1
  209. this.list = []
  210. this.getList()
  211. donePage = 1
  212. this.doneList = []
  213. this.getDoneList()
  214. copyPage = 1
  215. this.copyList = []
  216. this.getCopyList()
  217. },
  218. methods: {
  219. scrolltolower() {
  220. if (isEnd) return
  221. page++
  222. this.getList()
  223. },
  224. scrolltolowerDone() {
  225. if (doneIsEnd) return
  226. donePage++
  227. this.getDoneList()
  228. },
  229. scrolltolowerCopy() {
  230. if (copyIsEnd) return
  231. copyPage++
  232. this.getCopyList()
  233. },
  234. async getBaseList() {
  235. this.defaultList = await getBpmCustomFormList({status: 1})
  236. console.log(this.defaultList,'this.defaultList')
  237. this.baseList = await getByCode('collaborative_type')
  238. },
  239. handleDetail(item, type, isEdit = true) {
  240. //'pages/home' + this.listData.miniHandleRouter
  241. ///wt/components/feeApplication/taskSubmit
  242. let params = JSON.stringify({
  243. id: item.id,
  244. processInstanceId: item.processInstance?.id || item.processDefinitionId || '',
  245. type: type,
  246. isEdit: isEdit
  247. })
  248. let queryParams = `params=${params}`
  249. let url = '/pages/home/wt/components/formParser/routerView'
  250. uni.navigateTo({
  251. url: `${url}?${queryParams}`
  252. })
  253. },
  254. async handleDetailRecode(item, type, isEdit = false) {
  255. //'pages/home' + this.listData.miniHandleRouter
  256. ///wt/components/feeApplication/taskSubmit
  257. console.log('handleDetailRecode~~~', item)
  258. if(this.value1 == 3) {
  259. const readStatus = await ccReaderTask({
  260. id: item.id
  261. });
  262. console.log('readStatus~~', readStatus);
  263. if(readStatus) {
  264. item.isRead = 1;
  265. }
  266. }
  267. let params = JSON.stringify({
  268. processInstanceId: this.value1 == 3 ? item.processInstanceId : item.id,
  269. type: type,
  270. isEdit: isEdit
  271. })
  272. let queryParams = `params=${params}`
  273. let url = '/pages/home/wt/components/formParser/routerView'
  274. uni.navigateTo({
  275. url: `${url}?${queryParams}`
  276. })
  277. },
  278. handleDetailView(item) {
  279. uni.navigateTo({
  280. url: `/pages/home/wt/components/detail?processInstanceId=${ this.value1 == 3 ? item.processInstanceId : item.processInstance?.id || item.id}`
  281. })
  282. },
  283. handleWithdraw(row) {
  284. const processDefinitionKey = row.processDefinitionId.split(':')[0]
  285. uni.showModal({
  286. title: '提示',
  287. content: '是否确认撤回?',
  288. success: (res) => {
  289. if (res.confirm) {
  290. withdrawTask({
  291. processInstanceId: row.id,
  292. businessId: row.businessId,
  293. processDefinitionKey: processDefinitionKey,
  294. }).then(() => {
  295. uni.showToast({
  296. title: '撤回成功',
  297. icon: 'success'
  298. })
  299. // 刷新列表
  300. donePage = 1
  301. this.doneList = []
  302. this.getDoneList()
  303. page = 1
  304. this.list = []
  305. this.getList()
  306. copyPage = 1
  307. this.copyList = []
  308. this.getCopyList()
  309. }).catch(err => {
  310. uni.showToast({
  311. title: err.message || '撤回失败',
  312. icon: 'error'
  313. })
  314. })
  315. }
  316. }
  317. })
  318. },
  319. async getList() {
  320. let paging = {
  321. pageNo: page,
  322. pageSize: size,
  323. processType: 1
  324. }
  325. let par = Object.assign(paging, this.params)
  326. isEnd = false
  327. const data = await getTodoTaskPage(par)
  328. this.list.push(...data.list)
  329. this.list.forEach(item => {
  330. item.startUserNickname = item.processInstance.startUserNickname
  331. })
  332. isEnd = this.list.length >= data.count
  333. },
  334. async getDoneList() {
  335. const params = {
  336. pageNo: donePage,
  337. pageSize: 8,
  338. ...this.searchData,
  339. processType: 1
  340. }
  341. doneIsEnd = false
  342. const data = await getProcessInstancePage(params)
  343. this.doneList.push(...data.list)
  344. doneIsEnd = this.doneList.length >= data.count
  345. },
  346. async getCopyList() {
  347. const params = {
  348. pageNo: copyPage,
  349. pageSize: 8,
  350. ...this.searchData,
  351. // processType: 1
  352. }
  353. copyIsEnd = false
  354. const data = await getProcessInstanceCopyPage(params)
  355. this.copyList.push(...data.list)
  356. copyIsEnd = this.copyList.length >= data.count
  357. },
  358. change1(index) {
  359. console.log(index)
  360. this.value1 = index
  361. this.title = this.tabbarItems[index].text
  362. },
  363. click1(index) {
  364. this.value1 = index
  365. this.title = this.tabbarItems[index].text
  366. },
  367. }
  368. }
  369. </script>
  370. <style scoped lang="scss">
  371. .blacklog-container {
  372. height: 100vh;
  373. display: flex;
  374. flex-direction: column;
  375. }
  376. .dot {
  377. width: 10rpx;
  378. height: 10rpx;
  379. border-radius: 50%;
  380. background-color: red;
  381. display: inline-block;
  382. margin-right: 5rpx;
  383. }
  384. .grid-text {
  385. font-size: 15px;
  386. color: #333;
  387. padding: 10rpx 0 20rpx 0rpx;
  388. margin-top: 10rpx;
  389. /* #ifndef APP-PLUS */
  390. box-sizing: border-box;
  391. /* #endif */
  392. }
  393. .grid-item {
  394. display: flex;
  395. justify-content: space-evenly;
  396. border-right: 1px solid #f3f3f3;
  397. border-bottom: 1px solid #f3f3f3;
  398. }
  399. .list-container {
  400. height: 80%;
  401. padding: 24rpx;
  402. background: $page-bg;
  403. overflow: hidden;
  404. // position: absolute;
  405. // top: 88rpx;
  406. // bottom: 0;
  407. // left: 0;
  408. // right: 0;
  409. /deep/ .u-list {
  410. height: 100% !important;
  411. }
  412. }
  413. .no_data {
  414. position: fixed;
  415. top: 50%;
  416. left: 50%;
  417. transform: translate(-50%, -50%);
  418. color: #999;
  419. font-size: 50rpx;
  420. }
  421. .kd-card {
  422. font-size: 34rpx;
  423. color: #333;
  424. background-color: #fff;
  425. border-radius: 10rpx;
  426. word-break: break-all;
  427. margin-bottom: 24rpx;
  428. min-height: 220rpx;
  429. .status {
  430. font-weight: normal;
  431. }
  432. .card-title {
  433. font-size: 0.9rem;
  434. font-weight: bold;
  435. border-bottom: 1px solid #f1f1f1;
  436. padding: 10rpx 30rpx;
  437. color: #353535;
  438. }
  439. }
  440. .tabbarBox {
  441. height: 30rpx;
  442. }
  443. ::v-deep .tabbarItem {
  444. .uicon-file-text,
  445. .uicon-edit-pen,
  446. .uicon-arrow-upward {
  447. font-size: 20px !important;
  448. top: 2px !important;
  449. line-height: 14px !important;
  450. }
  451. }
  452. .navBarBox {
  453. height: 140rpx;
  454. }
  455. .blacklog-container {
  456. height: 100vh;
  457. display: flex;
  458. flex-direction: column;
  459. }
  460. .kd-card-1 {
  461. font-size: 34rpx;
  462. color: #333;
  463. background-color: #fff;
  464. border-radius: 10rpx;
  465. word-break: break-all;
  466. margin-bottom: 24rpx;
  467. .status-1 {
  468. font-weight: normal;
  469. }
  470. .card-title-1 {
  471. font-size: 0.9rem;
  472. font-weight: bold;
  473. .card-time-1 {
  474. font-weight: normal;
  475. color: #bfbfbf;
  476. font-size: 0.9rem;
  477. align-self: center;
  478. }
  479. }
  480. .card-footer-1,
  481. .card-title-1 {
  482. display: flex;
  483. justify-content: space-between;
  484. padding: 30rpx 30rpx;
  485. }
  486. .card-footer-1 {
  487. padding: 10rpx 30rpx 18rpx 30rpx;
  488. font-size: 0.8rem;
  489. /deep/ .u-button {
  490. width: 48%;
  491. }
  492. }
  493. .card-body-1 {
  494. padding: 0 28rpx;
  495. position: relative;
  496. min-height: 150rpx;
  497. }
  498. .card-body-1:after {
  499. content: '';
  500. position: absolute;
  501. left: auto;
  502. top: auto;
  503. bottom: 10rpx;
  504. right: auto;
  505. height: 1rpx;
  506. width: 91%;
  507. background-color: #f1f1f1;
  508. }
  509. .card-col-1 {
  510. padding: 8rpx 0;
  511. display: flex;
  512. // line-height: ;
  513. .content-1 {
  514. flex: 1;
  515. overflow: hidden;
  516. font-size: 0.9rem;
  517. }
  518. .label-1 {
  519. font-size: 0.9rem;
  520. color: #999;
  521. width: 25%;
  522. }
  523. }
  524. }
  525. .kd-card-2 {
  526. font-size: 34rpx;
  527. color: #333;
  528. background-color: #fff;
  529. border-radius: 10rpx;
  530. word-break: break-all;
  531. margin-bottom: 24rpx;
  532. padding-bottom: 24rpx;
  533. .status-1 {
  534. font-weight: normal;
  535. }
  536. .card-title-1 {
  537. font-size: 0.9rem;
  538. font-weight: bold;
  539. .card-time-1 {
  540. font-weight: normal;
  541. color: #bfbfbf;
  542. font-size: 0.9rem;
  543. align-self: center;
  544. }
  545. }
  546. .card-footer-1,
  547. .card-title-1 {
  548. display: flex;
  549. justify-content: space-between;
  550. padding: 30rpx 30rpx;
  551. }
  552. .card-footer-1 {
  553. padding: 10rpx 30rpx 18rpx 30rpx;
  554. font-size: 0.8rem;
  555. /deep/ .u-button {
  556. width: 48%;
  557. }
  558. }
  559. .card-body-1 {
  560. padding: 0 28rpx;
  561. position: relative;
  562. // min-height: 150rpx;
  563. }
  564. .card-body-1:after {
  565. content: '';
  566. position: absolute;
  567. left: auto;
  568. top: auto;
  569. bottom: 10rpx;
  570. right: auto;
  571. height: 1rpx;
  572. width: 91%;
  573. background-color: #f1f1f1;
  574. }
  575. .card-col-1 {
  576. padding: 8rpx 0;
  577. display: flex;
  578. // line-height: ;
  579. .content-1 {
  580. flex: 1;
  581. overflow: hidden;
  582. font-size: 0.9rem;
  583. }
  584. .label-1 {
  585. font-size: 0.9rem;
  586. color: #999;
  587. width: 25%;
  588. }
  589. .content-2 {
  590. overflow: hidden;
  591. color: #999;
  592. font-size: 0.9rem;
  593. }
  594. }
  595. }
  596. </style>