Executed.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-show="visible">
  4. <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
  5. <a-form layout="inline">
  6. <a-row :gutter="48">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="关键字">
  9. <a-input v-model.trim="queryParam.taskName" placeholder="请输入名称/类型名称" />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6 || 24" :sm="24">
  13. <span class="table-page-search-submitButtons">
  14. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  15. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  16. </span>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </div>
  21. <div class="table-operator" style="margin-bottom: 8px;">
  22. <a-row>
  23. <a-col :md="16">
  24. <!-- <a-button type="primary" icon="plus" @click="handleAdd()">新增</a-button> -->
  25. <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0">
  26. <a-menu slot="overlay">
  27. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  28. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  29. </a-popconfirm>
  30. </a-menu>
  31. <a-button style="margin-left: 8px">
  32. 批量操作 <a-icon type="down" />
  33. </a-button>
  34. </a-dropdown>
  35. </a-col>
  36. </a-row>
  37. </div>
  38. <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :alert="options.alert" :rowSelection="options.rowSelection" showPagination="auto">
  39. <span slot="action" slot-scope="record">
  40. <template>
  41. <a @click="handleView(record)">查看</a>
  42. <operation-button @click="handleEdit(record)">修改</operation-button>
  43. <operation-button :type="2" title="确认发送" @confirm="handleSend(record.id)">发送</operation-button>
  44. </template>
  45. </span>
  46. </s-table>
  47. </div>
  48. </a-card>
  49. </template>
  50. <script>
  51. import { STable, Ellipsis } from '@/components'
  52. import { getWorplacePublishPage, sendWorkflow } from '@/api/workflow/publish'
  53. export default {
  54. name: 'WorkflowTaskList',
  55. components: {
  56. STable,
  57. Ellipsis,
  58. },
  59. props: {
  60. personalType: {
  61. type: [Number, null],
  62. default: 2,
  63. },
  64. status: {
  65. type: [Number, null],
  66. default: 1,
  67. },
  68. },
  69. data() {
  70. return {
  71. advanced: false,
  72. visible: true,
  73. // 查询参数
  74. queryParam: {},
  75. // 表头
  76. columns: [
  77. {
  78. title: '序号',
  79. dataIndex: 'index',
  80. customRender: (text, record, index) => {
  81. return `${
  82. (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
  83. }`
  84. },
  85. },
  86. {
  87. title: '标题',
  88. dataIndex: 'taskName',
  89. },
  90. {
  91. title: '发起人',
  92. dataIndex: 'applyUserName',
  93. },
  94. {
  95. title: '发起时间',
  96. dataIndex: 'applyTime',
  97. },
  98. {
  99. title: '上一处理人',
  100. dataIndex: 'lastUserName',
  101. },
  102. {
  103. title: '处理时间',
  104. dataIndex: 'handleTime',
  105. },
  106. {
  107. title: '当前处理人',
  108. dataIndex: 'currentUserName',
  109. },
  110. {
  111. title: '操作',
  112. key: 'action',
  113. width: '200px',
  114. align: 'center',
  115. scopedSlots: { customRender: 'action' },
  116. },
  117. ],
  118. // 下拉框map
  119. // 加载数据方法 必须为 Promise 对象
  120. loadData: (parameter) => {
  121. parameter = {
  122. personalType: this.personalType,
  123. status: this.status,
  124. ...parameter,
  125. ...this.queryParam,
  126. dataScope: {
  127. sortBy: 'desc',
  128. sortName: 'task.created_time',
  129. },
  130. }
  131. return getWorplacePublishPage(Object.assign(parameter, this.queryParam)).then((res) => {
  132. return res.data
  133. })
  134. },
  135. selectedRowKeys: [],
  136. selectedRows: [],
  137. options: {
  138. alert: {
  139. show: true,
  140. clear: () => {
  141. this.selectedRowKeys = []
  142. },
  143. },
  144. rowSelection: {
  145. selectedRowKeys: this.selectedRowKeys,
  146. onChange: this.onSelectChange,
  147. },
  148. },
  149. optionAlertShow: false,
  150. statusMap: {},
  151. }
  152. },
  153. created() {
  154. // 下拉框map
  155. this.tableOption()
  156. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FLOW_TASK_STATUS)
  157. },
  158. methods: {
  159. tableOption() {
  160. if (!this.optionAlertShow) {
  161. this.options = {
  162. alert: {
  163. show: true,
  164. clear: () => {
  165. this.selectedRowKeys = []
  166. },
  167. },
  168. rowSelection: {
  169. selectedRowKeys: this.selectedRowKeys,
  170. onChange: this.onSelectChange,
  171. getCheckboxProps: (record) => ({
  172. props: {
  173. disabled: false,
  174. name: record.id,
  175. },
  176. }),
  177. },
  178. }
  179. this.optionAlertShow = true
  180. } else {
  181. this.options = {
  182. alert: false,
  183. rowSelection: null,
  184. }
  185. this.optionAlertShow = false
  186. }
  187. },
  188. batchDelete(id) {
  189. let ids = []
  190. if (this.BaseTool.String.isBlank(id)) {
  191. const length = this.selectedRows.length
  192. if (length === 0) {
  193. this.$message.info('请选择要删除的记录')
  194. return
  195. }
  196. ids = this.selectedRows.map((item) => item.id)
  197. } else {
  198. ids = [id]
  199. }
  200. // deleteWorkflowTasks(ids).then((res) => {
  201. // this.$message.info('删除成功')
  202. // this.handleOk()
  203. // this.$refs.table.clearSelected()
  204. // })
  205. },
  206. handleAdd() {},
  207. handleEdit(record) {},
  208. handleView(record) {},
  209. handleSend(id) {
  210. sendWorkflow({ id }).then((res) => {
  211. this.$message.info('发送成功')
  212. this.$refs.table.refresh()
  213. })
  214. },
  215. handleOk(values) {
  216. this.visible = true
  217. this.$refs.table.refresh()
  218. },
  219. onSelectChange(selectedRowKeys, selectedRows) {
  220. this.selectedRowKeys = selectedRowKeys
  221. this.selectedRows = selectedRows
  222. },
  223. resetSearchForm() {
  224. this.queryParam = {}
  225. this.$refs.table.refresh(true)
  226. },
  227. handleEnter() {
  228. this.$refs.table.refresh(true)
  229. },
  230. },
  231. }
  232. </script>