index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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-if='value1==0 && baseReady'>
  10. <u-list-item v-for="(item, index) in baseList" :key="getBaseListKey(item, 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 class='grid-item'
  18. :customStyle="{width:33+'%',height:220+'rpx'}"
  19. v-for="listItem in getFormsByType(Object.keys(item)[0])" :key="listItem.id || listItem.code || listItem.name"
  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="item.id || item.processInstanceId || 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="item.id || item.processInstanceId || 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="item.id || item.processInstanceId || 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. baseReady: false,
  187. baseList: [],
  188. defaultList: [],
  189. list: [],
  190. doneList: [],
  191. copyList: []
  192. }
  193. },
  194. computed: {
  195. colOptions() {
  196. return [{
  197. label: '流程节点',
  198. key: 'name'
  199. },
  200. {
  201. label: '流程发起人',
  202. key: `startUserNickname`
  203. }
  204. ]
  205. }
  206. },
  207. onShow() {
  208. this.getBaseList()
  209. page = 1
  210. this.list = []
  211. this.getList()
  212. donePage = 1
  213. this.doneList = []
  214. this.getDoneList()
  215. copyPage = 1
  216. this.copyList = []
  217. this.getCopyList()
  218. },
  219. methods: {
  220. getBaseListKey(item, index) {
  221. const key = Object.keys(item || {})[0]
  222. return key || index
  223. },
  224. getFormsByType(dictType) {
  225. return (this.defaultList || []).filter(item => item.dictType === dictType)
  226. },
  227. scrolltolower() {
  228. if (isEnd) return
  229. page++
  230. this.getList()
  231. },
  232. scrolltolowerDone() {
  233. if (doneIsEnd) return
  234. donePage++
  235. this.getDoneList()
  236. },
  237. scrolltolowerCopy() {
  238. if (copyIsEnd) return
  239. copyPage++
  240. this.getCopyList()
  241. },
  242. async getBaseList() {
  243. this.baseReady = false
  244. this.defaultList = await getBpmCustomFormList({status: 1})
  245. console.log(this.defaultList,'this.defaultList')
  246. this.baseList = await getByCode('collaborative_type')
  247. this.baseReady = true
  248. },
  249. handleDetail(item, type, isEdit = true) {
  250. //'pages/home' + this.listData.miniHandleRouter
  251. ///wt/components/feeApplication/taskSubmit
  252. let params = JSON.stringify({
  253. id: item.id,
  254. processInstanceId: item.processInstance?.id || item.processDefinitionId || '',
  255. type: type,
  256. isEdit: isEdit
  257. })
  258. let queryParams = `params=${params}`
  259. let url = '/pages/home/wt/components/formParser/routerView'
  260. uni.navigateTo({
  261. url: `${url}?${queryParams}`
  262. })
  263. },
  264. async handleDetailRecode(item, type, isEdit = false) {
  265. //'pages/home' + this.listData.miniHandleRouter
  266. ///wt/components/feeApplication/taskSubmit
  267. console.log('handleDetailRecode~~~', item)
  268. if(this.value1 == 3) {
  269. const readStatus = await ccReaderTask({
  270. id: item.id
  271. });
  272. console.log('readStatus~~', readStatus);
  273. if(readStatus) {
  274. item.isRead = 1;
  275. }
  276. }
  277. let params = JSON.stringify({
  278. processInstanceId: this.value1 == 3 ? item.processInstanceId : item.id,
  279. type: type,
  280. isEdit: isEdit
  281. })
  282. let queryParams = `params=${params}`
  283. let url = '/pages/home/wt/components/formParser/routerView'
  284. uni.navigateTo({
  285. url: `${url}?${queryParams}`
  286. })
  287. },
  288. handleDetailView(item) {
  289. uni.navigateTo({
  290. url: `/pages/home/wt/components/detail?processInstanceId=${ this.value1 == 3 ? item.processInstanceId : item.processInstance?.id || item.id}`
  291. })
  292. },
  293. handleWithdraw(row) {
  294. const processDefinitionKey = row.processDefinitionId.split(':')[0]
  295. uni.showModal({
  296. title: '提示',
  297. content: '是否确认撤回?',
  298. success: (res) => {
  299. if (res.confirm) {
  300. withdrawTask({
  301. processInstanceId: row.id,
  302. businessId: row.businessId,
  303. processDefinitionKey: processDefinitionKey,
  304. }).then(() => {
  305. uni.showToast({
  306. title: '撤回成功',
  307. icon: 'success'
  308. })
  309. // 刷新列表
  310. donePage = 1
  311. this.doneList = []
  312. this.getDoneList()
  313. page = 1
  314. this.list = []
  315. this.getList()
  316. copyPage = 1
  317. this.copyList = []
  318. this.getCopyList()
  319. }).catch(err => {
  320. uni.showToast({
  321. title: err.message || '撤回失败',
  322. icon: 'error'
  323. })
  324. })
  325. }
  326. }
  327. })
  328. },
  329. async getList() {
  330. let paging = {
  331. pageNo: page,
  332. pageSize: size,
  333. processType: 1
  334. }
  335. let par = Object.assign(paging, this.params)
  336. isEnd = false
  337. const data = await getTodoTaskPage(par)
  338. this.list.push(...data.list)
  339. this.list.forEach(item => {
  340. item.startUserNickname = item.processInstance.startUserNickname
  341. })
  342. isEnd = this.list.length >= data.count
  343. },
  344. async getDoneList() {
  345. const params = {
  346. pageNo: donePage,
  347. pageSize: 8,
  348. ...this.searchData,
  349. processType: 1
  350. }
  351. doneIsEnd = false
  352. const data = await getProcessInstancePage(params)
  353. this.doneList.push(...data.list)
  354. doneIsEnd = this.doneList.length >= data.count
  355. },
  356. async getCopyList() {
  357. const params = {
  358. pageNo: copyPage,
  359. pageSize: 8,
  360. ...this.searchData,
  361. // processType: 1
  362. }
  363. copyIsEnd = false
  364. const data = await getProcessInstanceCopyPage(params)
  365. this.copyList.push(...data.list)
  366. copyIsEnd = this.copyList.length >= data.count
  367. },
  368. change1(index) {
  369. console.log(index)
  370. this.value1 = index
  371. this.title = this.tabbarItems[index].text
  372. },
  373. click1(index) {
  374. this.value1 = index
  375. this.title = this.tabbarItems[index].text
  376. },
  377. }
  378. }
  379. </script>
  380. <style scoped lang="scss">
  381. .blacklog-container {
  382. height: 100vh;
  383. display: flex;
  384. flex-direction: column;
  385. }
  386. .dot {
  387. width: 10rpx;
  388. height: 10rpx;
  389. border-radius: 50%;
  390. background-color: red;
  391. display: inline-block;
  392. margin-right: 5rpx;
  393. }
  394. .grid-text {
  395. font-size: 15px;
  396. color: #333;
  397. padding: 10rpx 0 20rpx 0rpx;
  398. margin-top: 10rpx;
  399. /* #ifndef APP-PLUS */
  400. box-sizing: border-box;
  401. /* #endif */
  402. }
  403. .grid-item {
  404. display: flex;
  405. justify-content: space-evenly;
  406. border-right: 1px solid #f3f3f3;
  407. border-bottom: 1px solid #f3f3f3;
  408. }
  409. .list-container {
  410. height: 80%;
  411. padding: 24rpx;
  412. background: $page-bg;
  413. overflow: hidden;
  414. // position: absolute;
  415. // top: 88rpx;
  416. // bottom: 0;
  417. // left: 0;
  418. // right: 0;
  419. /deep/ .u-list {
  420. height: 100% !important;
  421. }
  422. }
  423. .no_data {
  424. position: fixed;
  425. top: 50%;
  426. left: 50%;
  427. transform: translate(-50%, -50%);
  428. color: #999;
  429. font-size: 50rpx;
  430. }
  431. .kd-card {
  432. font-size: 34rpx;
  433. color: #333;
  434. background-color: #fff;
  435. border-radius: 10rpx;
  436. word-break: break-all;
  437. margin-bottom: 24rpx;
  438. min-height: 220rpx;
  439. .status {
  440. font-weight: normal;
  441. }
  442. .card-title {
  443. font-size: 0.9rem;
  444. font-weight: bold;
  445. border-bottom: 1px solid #f1f1f1;
  446. padding: 10rpx 30rpx;
  447. color: #353535;
  448. }
  449. }
  450. .tabbarBox {
  451. height: 30rpx;
  452. }
  453. ::v-deep .tabbarItem {
  454. .uicon-file-text,
  455. .uicon-edit-pen,
  456. .uicon-arrow-upward {
  457. font-size: 20px !important;
  458. top: 2px !important;
  459. line-height: 14px !important;
  460. }
  461. }
  462. .navBarBox {
  463. height: 140rpx;
  464. }
  465. .blacklog-container {
  466. height: 100vh;
  467. display: flex;
  468. flex-direction: column;
  469. }
  470. .kd-card-1 {
  471. font-size: 34rpx;
  472. color: #333;
  473. background-color: #fff;
  474. border-radius: 10rpx;
  475. word-break: break-all;
  476. margin-bottom: 24rpx;
  477. .status-1 {
  478. font-weight: normal;
  479. }
  480. .card-title-1 {
  481. font-size: 0.9rem;
  482. font-weight: bold;
  483. .card-time-1 {
  484. font-weight: normal;
  485. color: #bfbfbf;
  486. font-size: 0.9rem;
  487. align-self: center;
  488. }
  489. }
  490. .card-footer-1,
  491. .card-title-1 {
  492. display: flex;
  493. justify-content: space-between;
  494. padding: 30rpx 30rpx;
  495. }
  496. .card-footer-1 {
  497. padding: 10rpx 30rpx 18rpx 30rpx;
  498. font-size: 0.8rem;
  499. /deep/ .u-button {
  500. width: 48%;
  501. }
  502. }
  503. .card-body-1 {
  504. padding: 0 28rpx;
  505. position: relative;
  506. min-height: 150rpx;
  507. }
  508. .card-body-1:after {
  509. content: '';
  510. position: absolute;
  511. left: auto;
  512. top: auto;
  513. bottom: 10rpx;
  514. right: auto;
  515. height: 1rpx;
  516. width: 91%;
  517. background-color: #f1f1f1;
  518. }
  519. .card-col-1 {
  520. padding: 8rpx 0;
  521. display: flex;
  522. // line-height: ;
  523. .content-1 {
  524. flex: 1;
  525. overflow: hidden;
  526. font-size: 0.9rem;
  527. }
  528. .label-1 {
  529. font-size: 0.9rem;
  530. color: #999;
  531. width: 25%;
  532. }
  533. }
  534. }
  535. .kd-card-2 {
  536. font-size: 34rpx;
  537. color: #333;
  538. background-color: #fff;
  539. border-radius: 10rpx;
  540. word-break: break-all;
  541. margin-bottom: 24rpx;
  542. padding-bottom: 24rpx;
  543. .status-1 {
  544. font-weight: normal;
  545. }
  546. .card-title-1 {
  547. font-size: 0.9rem;
  548. font-weight: bold;
  549. .card-time-1 {
  550. font-weight: normal;
  551. color: #bfbfbf;
  552. font-size: 0.9rem;
  553. align-self: center;
  554. }
  555. }
  556. .card-footer-1,
  557. .card-title-1 {
  558. display: flex;
  559. justify-content: space-between;
  560. padding: 30rpx 30rpx;
  561. }
  562. .card-footer-1 {
  563. padding: 10rpx 30rpx 18rpx 30rpx;
  564. font-size: 0.8rem;
  565. /deep/ .u-button {
  566. width: 48%;
  567. }
  568. }
  569. .card-body-1 {
  570. padding: 0 28rpx;
  571. position: relative;
  572. // min-height: 150rpx;
  573. }
  574. .card-body-1:after {
  575. content: '';
  576. position: absolute;
  577. left: auto;
  578. top: auto;
  579. bottom: 10rpx;
  580. right: auto;
  581. height: 1rpx;
  582. width: 91%;
  583. background-color: #f1f1f1;
  584. }
  585. .card-col-1 {
  586. padding: 8rpx 0;
  587. display: flex;
  588. // line-height: ;
  589. .content-1 {
  590. flex: 1;
  591. overflow: hidden;
  592. font-size: 0.9rem;
  593. }
  594. .label-1 {
  595. font-size: 0.9rem;
  596. color: #999;
  597. width: 25%;
  598. }
  599. .content-2 {
  600. overflow: hidden;
  601. color: #999;
  602. font-size: 0.9rem;
  603. }
  604. }
  605. }
  606. </style>