Executed.vue 8.9 KB

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