MyTask.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-if="visible">
  4. <div class="table-page-search-wrapper">
  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.keyword" placeholder="请输入名称/类型名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="8 || 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. <s-table
  22. ref="table"
  23. size="small"
  24. rowKey="id"
  25. :columns="columns"
  26. :data="loadData"
  27. showPagination="auto"
  28. >
  29. <span slot="action" slot-scope="record">
  30. <template>
  31. <a @click="handleAudit(record)">审批</a>
  32. <a-divider type="vertical" />
  33. <a @click="handleChange(record)">转签</a>
  34. </template>
  35. </span>
  36. </s-table>
  37. </div>
  38. <detail-audit-scrap ref="detailAuditScrapModal" @ok="handleOk"/>
  39. <assign-form ref="assignForm" @ok="handleOk"/>
  40. </a-card>
  41. </template>
  42. <script>
  43. import { STable, Ellipsis } from '@/components'
  44. import AssignForm from './modules/AssignForm'
  45. import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
  46. import { getTaskPage } from '@/api/activiti/activiti'
  47. import { fetchCustomFieldTemplateData } from '@/api/customize/fieldTemplateData'
  48. export default {
  49. name: 'TaskList',
  50. components: {
  51. STable,
  52. Ellipsis,
  53. DetailAuditScrap,
  54. AssignForm
  55. },
  56. data () {
  57. return {
  58. mdl: {},
  59. // 查询参数
  60. queryParam: {
  61. },
  62. // 表头
  63. columns: [
  64. {
  65. title: '序号',
  66. dataIndex: 'index',
  67. customRender: (text, record, index) => {
  68. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  69. }
  70. },
  71. {
  72. title: '类型',
  73. dataIndex: 'targetCode',
  74. customRender: (text, record, index) => {
  75. return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
  76. }
  77. },
  78. {
  79. title: '任务名称',
  80. dataIndex: 'targetName'
  81. },
  82. {
  83. title: '申请人',
  84. dataIndex: 'userName'
  85. },
  86. {
  87. title: '创建时间',
  88. dataIndex: 'applyTime'
  89. },
  90. {
  91. title: '操作',
  92. key: 'action',
  93. width: '220px',
  94. align: 'center',
  95. scopedSlots: { customRender: 'action' }
  96. }
  97. ],
  98. // 加载数据方法 必须为 Promise 对象
  99. loadData: parameter => {
  100. return getTaskPage(Object.assign(parameter, this.queryParam))
  101. .then(res => {
  102. return res.data
  103. })
  104. },
  105. selectedRowKeys: [],
  106. selectedRows: [],
  107. menus: [],
  108. visible: true,
  109. options: {
  110. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  111. rowSelection: {
  112. selectedRowKeys: this.selectedRowKeys,
  113. onChange: this.onSelectChange
  114. }
  115. },
  116. optionAlertShow: false
  117. }
  118. },
  119. created () {
  120. this.tableOption()
  121. },
  122. methods: {
  123. tableOption () {
  124. if (!this.optionAlertShow) {
  125. this.options = {
  126. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  127. rowSelection: {
  128. selectedRowKeys: this.selectedRowKeys,
  129. onChange: this.onSelectChange,
  130. getCheckboxProps: record => ({
  131. props: {
  132. disabled: false,
  133. name: record.id
  134. }
  135. })
  136. }
  137. }
  138. this.optionAlertShow = true
  139. } else {
  140. this.options = {
  141. alert: false,
  142. rowSelection: null
  143. }
  144. this.optionAlertShow = false
  145. }
  146. },
  147. handleAudit (record) {
  148. this.visible = false
  149. fetchCustomFieldTemplateData({ id: record.targetId }).then(res => {
  150. const templateData = JSON.parse(res.data.data)
  151. record.remark = res.data.remark
  152. this.$refs.detailAuditScrapModal.base(record, templateData)
  153. })
  154. },
  155. handleChange (record) {
  156. fetchCustomFieldTemplateData({ id: record.targetId }).then(res => {
  157. record.remark = res.data.remark
  158. this.$refs.assignForm.base(record)
  159. })
  160. //this.$refs.assignForm.base(record)
  161. },
  162. handleOk () {
  163. this.visible = true
  164. this.$refs.table.refresh()
  165. },
  166. onSelectChange (selectedRowKeys, selectedRows) {
  167. this.selectedRowKeys = selectedRowKeys
  168. this.selectedRows = selectedRows
  169. },
  170. resetSearchForm () {
  171. this.queryParam = {
  172. }
  173. this.$refs.table.refresh(true)
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="less" scoped>
  179. </style>