WaitWork.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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" :scroll="{x: 1300, y: BaseTool.Constant.scrollY }" 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="handleAudit(record.id)">审核</a>
  42. </template>
  43. </span>
  44. </s-table>
  45. </div>
  46. <AuditDetail ref="auditDetail" @ok="handleOk" />
  47. </a-card>
  48. </template>
  49. <script>
  50. import { STable, Ellipsis } from '@/components'
  51. import { getWorplacePublishPage, getWorkflowBomInfo } from '@/api/workflow/publish'
  52. import AuditDetail from './modules/AuditDetail.vue'
  53. export default {
  54. name: 'WorkflowTaskList',
  55. components: {
  56. STable,
  57. Ellipsis,
  58. AuditDetail,
  59. },
  60. props: {
  61. personalType: {
  62. type: [Number, null],
  63. default: 2,
  64. },
  65. status: {
  66. type: [Number, null],
  67. default: 0,
  68. },
  69. },
  70. data() {
  71. return {
  72. advanced: false,
  73. visible: true,
  74. // 查询参数
  75. queryParam: {},
  76. // 表头
  77. columns: [
  78. {
  79. title: '序号',
  80. dataIndex: 'index',
  81. checked: true,
  82. width: 80,
  83. customRender: (text, record, index) => {
  84. return `${
  85. (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
  86. }`
  87. },
  88. },
  89. {
  90. title: '标题',
  91. checked: true,
  92. width: 300,
  93. dataIndex: 'taskName',
  94. },
  95. {
  96. title: '发起人',
  97. checked: true,
  98. width: 140,
  99. dataIndex: 'applyUserName',
  100. },
  101. {
  102. title: '发起时间',
  103. checked: true,
  104. width: 140,
  105. dataIndex: 'applyTime',
  106. },
  107. {
  108. title: '上一处理人',
  109. checked: true,
  110. width: 140,
  111. dataIndex: 'lastUserName',
  112. },
  113. {
  114. title: '接收时间',
  115. checked: true,
  116. width: 140,
  117. dataIndex: 'createdTime',
  118. },
  119. {
  120. title: '当前节点',
  121. checked: true,
  122. width: 140,
  123. dataIndex: 'nodeRemark',
  124. },
  125. {
  126. title: '催办次数',
  127. checked: true,
  128. width: 120,
  129. dataIndex: 'reminderNum',
  130. },
  131. {
  132. title: '已阅标识',
  133. checked: true,
  134. width: 120,
  135. dataIndex: 'readFlag',
  136. fixed: 'right',
  137. customRender: (text, record, index) => {
  138. return this.yesMap[text]
  139. },
  140. },
  141. {
  142. title: '操作',
  143. key: 'action',
  144. width: '200px',
  145. checked: true,
  146. fixed: 'right',
  147. align: 'center',
  148. scopedSlots: { customRender: 'action' },
  149. },
  150. ],
  151. // 下拉框map
  152. // 加载数据方法 必须为 Promise 对象
  153. loadData: (parameter) => {
  154. parameter = {
  155. personalType: this.personalType,
  156. status: this.status,
  157. ...parameter,
  158. ...this.queryParam,
  159. dataScope: {
  160. sortBy: 'desc',
  161. sortName: 'task.created_time',
  162. },
  163. }
  164. return getWorplacePublishPage(Object.assign(parameter, this.queryParam)).then((res) => {
  165. return res.data
  166. })
  167. },
  168. selectedRowKeys: [],
  169. selectedRows: [],
  170. options: {
  171. alert: {
  172. show: true,
  173. clear: () => {
  174. this.selectedRowKeys = []
  175. },
  176. },
  177. rowSelection: {
  178. selectedRowKeys: this.selectedRowKeys,
  179. onChange: this.onSelectChange,
  180. },
  181. },
  182. optionAlertShow: false,
  183. statusMap: {},
  184. yesMap: {},
  185. }
  186. },
  187. created() {
  188. // 下拉框map
  189. this.tableOption()
  190. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FLOW_TASK_STATUS)
  191. this.yesMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  192. },
  193. methods: {
  194. tableOption() {
  195. if (!this.optionAlertShow) {
  196. this.options = {
  197. alert: {
  198. show: true,
  199. clear: () => {
  200. this.selectedRowKeys = []
  201. },
  202. },
  203. rowSelection: {
  204. selectedRowKeys: this.selectedRowKeys,
  205. onChange: this.onSelectChange,
  206. getCheckboxProps: (record) => ({
  207. props: {
  208. disabled: false,
  209. name: record.id,
  210. },
  211. }),
  212. },
  213. }
  214. this.optionAlertShow = true
  215. } else {
  216. this.options = {
  217. alert: false,
  218. rowSelection: null,
  219. }
  220. this.optionAlertShow = false
  221. }
  222. },
  223. batchDelete(id) {
  224. let ids = []
  225. if (this.BaseTool.String.isBlank(id)) {
  226. const length = this.selectedRows.length
  227. if (length === 0) {
  228. this.$message.info('请选择要删除的记录')
  229. return
  230. }
  231. ids = this.selectedRows.map((item) => item.id)
  232. } else {
  233. ids = [id]
  234. }
  235. // deleteWorkflowTasks(ids).then((res) => {
  236. // this.$message.info('删除成功')
  237. // this.handleOk()
  238. // this.$refs.table.clearSelected()
  239. // })
  240. },
  241. handleAudit(id) {
  242. getWorkflowBomInfo({ id }).then((res) => {
  243. this.visible = false
  244. this.$refs.auditDetail.base(res.data)
  245. })
  246. },
  247. handleOk(values) {
  248. this.visible = true
  249. this.$refs.table.refresh()
  250. },
  251. onSelectChange(selectedRowKeys, selectedRows) {
  252. this.selectedRowKeys = selectedRowKeys
  253. this.selectedRows = selectedRows
  254. },
  255. resetSearchForm() {
  256. this.queryParam = {}
  257. this.$refs.table.refresh(true)
  258. },
  259. handleEnter() {
  260. this.$refs.table.refresh(true)
  261. },
  262. },
  263. }
  264. </script>