km-contribute-center.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <a-card>
  3. <a-tabs v-model="activeKey">
  4. <a-tab-pane key="all" tab="全部">
  5. <sd-data-table
  6. v-if="!loading"
  7. ref="all"
  8. data-url="api/xcoa-mobile/v1/km-workflow-list/entrylist"
  9. :columns="columns"
  10. :actions="actions"
  11. show-selection
  12. :row-key="'instId'"
  13. :search-fields="['TITLE']"
  14. :filter-expressions="expressions.all"
  15. @rowClick="rowClick"
  16. >
  17. </sd-data-table>
  18. </a-tab-pane>
  19. <a-tab-pane key="processing" tab="审批中">
  20. <sd-data-table
  21. v-if="!loading"
  22. ref="processing"
  23. data-url="api/xcoa-mobile/v1/km-workflow-list/entrylist"
  24. :columns="columns"
  25. :actions="actions"
  26. show-selection
  27. :row-key="'instId'"
  28. :search-fields="['TITLE']"
  29. :filter-expressions="expressions.processing"
  30. @rowClick="rowClick"
  31. >
  32. </sd-data-table>
  33. </a-tab-pane>
  34. <a-tab-pane key="completed" tab="已结束">
  35. <sd-data-table
  36. v-if="!loading"
  37. ref="completed"
  38. data-url="api/xcoa-mobile/v1/km-workflow-list/entrylist"
  39. :columns="columns"
  40. :actions="actions"
  41. show-selection
  42. :row-key="'instId'"
  43. :search-fields="['TITLE']"
  44. :filter-expressions="expressions.completed"
  45. @rowClick="rowClick"
  46. >
  47. </sd-data-table>
  48. </a-tab-pane>
  49. </a-tabs>
  50. </a-card>
  51. </template>
  52. <script>
  53. import { Modal } from 'ant-design-vue'
  54. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  55. import TableColumnTypes from '@/common/services/table-column-types'
  56. import FlowcenterService from '@/flowcenter/flowcenter-service'
  57. import TableActionTypes from '@/common/services/table-action-types'
  58. import KmKnowledageService from '../km-knowledage-service'
  59. import components from './_import-components/km-contribute-center-import'
  60. const columns = [
  61. {
  62. title: '创建时间',
  63. dataIndex: 'startDate',
  64. sdRender: TableColumnTypes.dateTime,
  65. sorter: true,
  66. defaultSortOrder: 'desc',
  67. },
  68. {
  69. title: '标题',
  70. dataIndex: 'title',
  71. sdClickable: true,
  72. },
  73. {
  74. title: '发起人',
  75. dataIndex: 'creatorName',
  76. },
  77. {
  78. title: '处理状态',
  79. dataIndex: 'activeStepNames',
  80. },
  81. ]
  82. export default {
  83. name: 'KmContributeCenter',
  84. metaInfo: {
  85. title: '投稿中心',
  86. },
  87. components,
  88. data() {
  89. return {
  90. columns,
  91. activeKey: 'all',
  92. expressions: {
  93. all: [
  94. {
  95. dataType: 'str',
  96. name: 'FORMID',
  97. op: 'eq',
  98. stringValue: 'kmKnowledge',
  99. },
  100. ],
  101. processing: [
  102. {
  103. dataType: 'str',
  104. name: 'FORMID',
  105. op: 'eq',
  106. stringValue: 'kmKnowledge',
  107. },
  108. {
  109. dataType: 'str',
  110. name: 'status',
  111. op: 'ne',
  112. stringValue: '5',
  113. },
  114. ],
  115. completed: [
  116. {
  117. dataType: 'str',
  118. name: 'FORMID',
  119. op: 'eq',
  120. stringValue: 'kmKnowledge',
  121. },
  122. {
  123. dataType: 'str',
  124. name: 'status',
  125. op: 'eq',
  126. stringValue: '5',
  127. },
  128. ],
  129. },
  130. loading: true, // 为了先获取当前用户有权限的分类再展示数据加的参数
  131. actions: [
  132. {
  133. label: '删除',
  134. id: 'delete',
  135. type: TableActionTypes.batch, // 批处理按钮,选中文档时才能点击
  136. permission: null,
  137. callback: (keys) => {
  138. this.deleteRows(keys)
  139. },
  140. },
  141. ],
  142. }
  143. },
  144. created() {
  145. this.fnGetUserAsAdminList()
  146. },
  147. methods: {
  148. // 获取当前用户管理的分类id列表
  149. fnGetUserAsAdminList() {
  150. KmKnowledageService.getUserAsAdminList().then((res) => {
  151. if (res.status === 200) {
  152. const filter = {
  153. // 过滤作废的
  154. dataType: 'str',
  155. name: 'CATEGORYID',
  156. op: 'in',
  157. stringValue: res.data.join(','),
  158. }
  159. this.expressions.all.push(filter)
  160. this.expressions.processing.push(filter)
  161. this.expressions.completed.push(filter)
  162. this.loading = false
  163. }
  164. })
  165. },
  166. // 查看详情
  167. rowClick(record) {
  168. const url = `/sd-webflow/done-pages/` + record.instId
  169. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  170. if (refreshFlag) this.$refs[this.activeKey].refresh()
  171. })
  172. },
  173. // 删除数据
  174. deleteRows(selectedRowKeys) {
  175. Modal.confirm({
  176. title: '你确定删除这项内容吗?',
  177. content: '删除这条数据后,就无法恢复初始的状态。',
  178. okText: '删除',
  179. okType: 'danger',
  180. onOk: () => {
  181. const params = {
  182. flowCallbackBeanName: 'formBeanCleanerCallBack',
  183. processInstanceIds: selectedRowKeys.join(','),
  184. }
  185. FlowcenterService.fnDarftsDelete(params).then((res) => {
  186. if (res.status === 200) {
  187. this.$refs[this.activeKey].clearSelection(true)
  188. this.$refs[this.activeKey].refresh()
  189. }
  190. })
  191. },
  192. })
  193. },
  194. },
  195. }
  196. </script>
  197. <style module lang="scss">
  198. @use '@/common/design' as *;
  199. </style>