index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div>
  3. <van-sticky>
  4. <van-nav-bar :title="generateTitle($route.name,$route.params.title||$route.meta.title)"
  5. :left-text="$t('common.button.back')" left-arrow @click-left="$router.push({ name: 'dashboard' })" />
  6. <van-search v-model="subject" show-action placeholder="请输入搜索关键词" @search="onSearch">
  7. <template #left>
  8. <van-icon name="bars" :class="{'ibps-active':$utils.isNotEmpty(typeId)}" class="ibps-pr-5"
  9. @click="clickType" />
  10. </template>
  11. <template #action>
  12. <van-icon name="filter-o" :class="{'ibps-active':stateActive}" @click="clickMoreSearch" />
  13. </template>
  14. </van-search>
  15. </van-sticky>
  16. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  17. <van-list v-model="loading" :finished="finished" @load="loadData">
  18. <van-cell v-for="(item,index) in listData" :key="item.id+index" :title="item.procDefName"
  19. :label="getTaskDesc(item.subject)" size="large" @click="onClick(item,index)">
  20. <template slot="icon">
  21. <ibps-avatar :icon="_randomIcon(index)" :text="item.name" :bg-color="_randomColor(index)" radius="4"
  22. icon-prefix="ibps-icon" class="ibps-mr-10" />
  23. </template>
  24. <span>{{ item.createTime|formatRelativeTime }}</span>
  25. <div>
  26. <!-- <van-tag plain :type=" item.status | optionsFilter(bpmnStatusOptions,'type')">{{ item.status | optionsFilter(bpmnStatusOptions) }}</van-tag> -->
  27. <van-tag size="medium"
  28. :color="item.status | optionsFilter(bpmnStatusOptions,'type') | optionsFilter(colorOptions,'color','type')"
  29. :text-color="item.status | optionsFilter(bpmnStatusOptions,'type') | optionsFilter(colorOptions,'textColor','type')">
  30. {{ item.status| optionsFilter(bpmnStatusOptions) }}</van-tag>
  31. </div>
  32. </van-cell>
  33. <ibps-list-result-page :result-type="resultType" :error-type="errorType" :result-message="resultMessage" />
  34. </van-list>
  35. </van-pull-refresh>
  36. <ibps-more-search :show="moreSearchPopup" :search-forms="searchForms" @callback="onMoreSearch"
  37. @close="show => moreSearchPopup = show" @reset-form="resetForm" />
  38. <ibps-type-tree v-model="typeTreePopup" title="流程分类" category-key="FLOW_TYPE" @node-click="clickTypeNode"
  39. @close="visible => typeTreePopup = visible" />
  40. <ibps-bpmn-formrender-dialog :visible="formrenderVisible" :title="formrenderTitle" :inst-id="instId"
  41. @close="visible => formrenderVisible = visible" />
  42. </div>
  43. </template>
  44. <script>
  45. import { handled } from '@/api/platform/office/bpmReceived'
  46. import ActionUtils from '@/utils/action'
  47. import i18n from '@/utils/i18n'
  48. import random from '@/mixins/random'
  49. import bpmnStatus from '@/mixins/bpmnStatus'
  50. import IbpsMoreSearch from '@/components/ibps-more-search'
  51. import IbpsTypeTree from '@/business/platform/cat/type/tree'
  52. import IbpsAvatar from '@/components/ibps-avatar'
  53. import IbpsListResultPage from '@/components/ibps-list-result-page'
  54. import IbpsBpmnFormrenderDialog from '@/business/platform/bpmn/form/dialog'
  55. export default {
  56. components: {
  57. IbpsMoreSearch,
  58. IbpsTypeTree,
  59. IbpsAvatar,
  60. IbpsListResultPage,
  61. IbpsBpmnFormrenderDialog
  62. },
  63. mixins: [random, bpmnStatus],
  64. data() {
  65. return {
  66. stateActive: false,
  67. moreSearchPopup: false,
  68. typeTreePopup: false,
  69. searchForms: {
  70. forms: [
  71. { prop: 'Q^inst.subject_^SL', label: '事务名称', fieldType: 'text' },
  72. // { prop: 'Q^inst.proc_def_name_^SL', label: '事务说明', fieldType: 'text' },
  73. { prop: 'Q^inst.subject_^SL', label: '事务说明', fieldType: 'text' },
  74. { prop: ['Q^inst.create_time_^DL', 'Q^inst.create_time_^DG'], label: '创建时间', fieldType: 'dateRange', options: { datefmt: 'yyyy-MM-dd' } },
  75. {
  76. prop: 'Q^inst.status_^S', label: '状态', fieldType: 'checker', cols: 3, options: [
  77. { value: 'all', label: '全部' },
  78. { value: 'end', label: '结束' },
  79. { value: 'manualend', label: '人工结束' }
  80. ]
  81. }
  82. ]
  83. },
  84. subject: '',
  85. typeId: '',
  86. checker: '',
  87. moreParams: {},
  88. listData: [],
  89. pagination: {},
  90. sorts: {},
  91. loading: false,
  92. finished: false,
  93. refreshing: false,
  94. resultType: 'init',
  95. errorType: null,
  96. resultMessage: null,
  97. instId: '',
  98. formrenderVisible: false,
  99. formrenderTitle: ''
  100. }
  101. },
  102. methods: {
  103. generateTitle(name, title) { // generateTitle by vue-i18n
  104. return i18n.generateTitle(name, title)
  105. },
  106. /**
  107. * 加载数据
  108. */
  109. loadData() {
  110. this.loading = true
  111. handled(this.getSearcFormData()).then(response => {
  112. // 处理数据
  113. ActionUtils.handleListData(this, response.data)
  114. }).catch((e) => {
  115. ActionUtils.handleErrorData(this, e)
  116. })
  117. },
  118. /**
  119. * 获取格式化参数
  120. */
  121. getSearcFormData() {
  122. let params = { 'end': '1' }
  123. if (this.$utils.isNotEmpty(this.subject)) {
  124. params['Q^subject_^SL'] = this.subject
  125. }
  126. if (this.$utils.isNotEmpty(this.moreParams)) {
  127. params = Object.assign(params, this.moreParams)
  128. }
  129. return ActionUtils.formatParams(
  130. params,
  131. this.pagination,
  132. this.sorts)
  133. },
  134. /**
  135. * 下拉刷新
  136. */
  137. onRefresh() {
  138. this.refreshing = true
  139. this.finished = false
  140. this.loading = true
  141. this.onSearch()
  142. },
  143. /**
  144. * 查询
  145. */
  146. onSearch() {
  147. this.stateActive = false
  148. ActionUtils.initListData(this)
  149. this.loadData()
  150. },
  151. /**
  152. * 高级查询
  153. */
  154. onMoreSearch(params) {
  155. if (this.$utils.isNotEmpty(this.typeId)) {
  156. params['Q^type_id_^SL'] = this.typeId
  157. }
  158. this.moreParams = params
  159. this.onSearch()
  160. if (this.$utils.isNotEmpty(params)) {
  161. this.stateActive = true
  162. }
  163. },
  164. /**
  165. * 弹窗更多查询条件
  166. */
  167. clickMoreSearch() {
  168. this.moreSearchPopup = true
  169. this.stateActive = false
  170. },
  171. /**
  172. * 重置表单
  173. */
  174. resetForm() {
  175. this.typeId = ''
  176. this.checker = ''
  177. },
  178. clickType() {
  179. this.typeTreePopup = true
  180. },
  181. clickTypeNode(data) {
  182. this.typeId = data.id
  183. this.onMoreSearch({})
  184. },
  185. getTaskDesc(v) {
  186. if (!v.includes('#')) {
  187. return ''
  188. }
  189. return v.split('#')[1] || ''
  190. },
  191. onClick(item) {
  192. this.instId = item.id
  193. this.formrenderTitle = item.procDefName
  194. this.formrenderVisible = true
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. ::v-deep .van-cell__title {
  201. width: 65%;
  202. .van-cell__label {
  203. overflow-wrap: break-word;
  204. }
  205. }
  206. </style>