MyStart.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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="handleView(record)">查看</a>
  32. </template>
  33. </span>
  34. </s-table>
  35. </div>
  36. <detail-audit-scrap :audit="false" ref="detailAuditScrapModal" @ok="handleOk"/>
  37. </a-card>
  38. </template>
  39. <script>
  40. import { STable, Ellipsis } from '@/components'
  41. import AssignForm from './modules/AssignForm'
  42. import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
  43. import { getTaskPageStart } from '@/api/activiti/activiti'
  44. export default {
  45. name: 'TaskList',
  46. components: {
  47. STable,
  48. Ellipsis,
  49. DetailAuditScrap,
  50. AssignForm
  51. },
  52. data () {
  53. return {
  54. mdl: {},
  55. // 查询参数
  56. queryParam: {
  57. },
  58. // 表头
  59. columns: [
  60. {
  61. title: '序号',
  62. dataIndex: 'index',
  63. customRender: (text, record, index) => {
  64. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  65. }
  66. },
  67. {
  68. title: '类型',
  69. dataIndex: 'targetCode',
  70. customRender: (text, record, index) => {
  71. if (text === 'supplier') {
  72. return '供应商审批'
  73. } else if (text === 'sb_info_scrap' || text === '设备报废审批') {
  74. return '设备报废审批'
  75. }
  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 getTaskPageStart(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. handleView (record) {
  148. this.visible = false
  149. if (record.targetCode === 'sb_info_scrap') {
  150. this.$refs.detailAuditScrapModal.base(record)
  151. }
  152. },
  153. handleOk () {
  154. this.visible = true
  155. this.$refs.table.refresh()
  156. },
  157. onSelectChange (selectedRowKeys, selectedRows) {
  158. this.selectedRowKeys = selectedRowKeys
  159. this.selectedRows = selectedRows
  160. },
  161. resetSearchForm () {
  162. this.queryParam = {
  163. }
  164. this.$refs.table.refresh(true)
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="less" scoped>
  170. </style>