flowIndex.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <a-card :bordered="false">
  3. <s-table
  4. ref="tableRef"
  5. :columns="columns"
  6. :data="loadData"
  7. :alert="options.alert.show"
  8. bordered
  9. :row-key="(record) => record.id"
  10. :tool-config="toolConfig"
  11. :row-selection="options.rowSelection"
  12. >
  13. <template #operator class="table-operator">
  14. <a-space>
  15. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizServiceCustomerFlowAdd')">
  16. <template #icon><plus-outlined /></template>
  17. 新增
  18. </a-button>
  19. <xn-batch-button
  20. v-if="hasPerm('bizServiceCustomerFlowBatchDelete')"
  21. buttonName="批量删除"
  22. icon="DeleteOutlined"
  23. :selectedRowKeys="selectedRowKeys"
  24. @batchCallBack="deleteBatchBizServiceCustomerFlow"
  25. />
  26. </a-space>
  27. </template>
  28. <template #bodyCell="{ column, record }">
  29. <template v-if="column.dataIndex === 'action'">
  30. <a-space>
  31. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizServiceCustomerFlowEdit')">编辑</a>
  32. <a-divider type="vertical" v-if="hasPerm(['bizServiceCustomerFlowEdit', 'bizServiceCustomerFlowDelete'], 'and')" />
  33. <a-popconfirm title="确定要删除吗?" @confirm="deleteBizServiceCustomerFlow(record)">
  34. <a-button type="link" danger size="small" v-if="hasPerm('bizServiceCustomerFlowDelete')">删除</a-button>
  35. </a-popconfirm>
  36. </a-space>
  37. </template>
  38. </template>
  39. </s-table>
  40. </a-card>
  41. <Form ref="formRef" @successful="tableRef.refresh()" />
  42. </template>
  43. <script setup name="bizservicecustomerflow">
  44. import { cloneDeep } from 'lodash-es'
  45. import Form from './flowForm.vue'
  46. import bizServiceCustomerFlowApi from '@/api/biz/bizServiceCustomerFlowApi'
  47. const tableRef = ref()
  48. const formRef = ref()
  49. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  50. const columns = [
  51. {
  52. title: '序号',
  53. width: 50,
  54. dataIndex: 'serial',
  55. align:'center'
  56. },
  57. {
  58. title: '操作类型 1:充值 2:消费',
  59. dataIndex: 'operateType'
  60. },
  61. {
  62. title: '操作前账户余额',
  63. dataIndex: 'operateAmountBegin'
  64. },
  65. {
  66. title: '操作金额',
  67. dataIndex: 'operateAmount'
  68. },
  69. {
  70. title: '操作后账户余额',
  71. dataIndex: 'operateAmountAfter'
  72. },
  73. {
  74. title: '操作时间',
  75. dataIndex: 'createTime',
  76. align: 'center'
  77. },
  78. ]
  79. // 操作栏通过权限判断是否显示
  80. if (hasPerm(['bizServiceCustomerFlowEdit', 'bizServiceCustomerFlowDelete'])) {
  81. columns.push({
  82. title: '操作',
  83. dataIndex: 'action',
  84. align: 'center',
  85. width: 150
  86. })
  87. }
  88. const selectedRowKeys = ref([])
  89. // 列表选择配置
  90. const options = {
  91. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  92. alert: {
  93. show: true,
  94. clear: () => {
  95. selectedRowKeys.value = ref([])
  96. }
  97. },
  98. rowSelection: {
  99. onChange: (selectedRowKey, selectedRows) => {
  100. selectedRowKeys.value = selectedRowKey
  101. }
  102. }
  103. }
  104. const loadData = (parameter) => {
  105. return bizServiceCustomerFlowApi.bizServiceCustomerFlowPage(parameter).then((data) => {
  106. return data
  107. })
  108. }
  109. // 重置
  110. const reset = () => {
  111. searchFormRef.value.resetFields()
  112. tableRef.value.refresh(true)
  113. }
  114. // 删除
  115. const deleteBizServiceCustomerFlow = (record) => {
  116. let params = [
  117. {
  118. id: record.id
  119. }
  120. ]
  121. bizServiceCustomerFlowApi.bizServiceCustomerFlowDelete(params).then(() => {
  122. tableRef.value.refresh(true)
  123. })
  124. }
  125. // 批量删除
  126. const deleteBatchBizServiceCustomerFlow = (params) => {
  127. bizServiceCustomerFlowApi.bizServiceCustomerFlowDelete(params).then(() => {
  128. tableRef.value.clearRefreshSelected()
  129. })
  130. }
  131. </script>