peng
2026-03-18 b89df58e3b783f3d718bd85a3e4c6a3bd9ee353c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
  <div style="margin-right: 30px">
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-divider type="vertical" />
      <a-button @click="loadData()" type="primary" icon="search">刷新</a-button>
      <!--<a-button type="primary" icon="download" @click="handleExportXls('Activity')">导出</a-button>-->
    </div>
 
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="infoTable"
        :scroll="{ x: true }"
        :columns="defaultColumns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider v-if="record.id != 1 && record.id != 2" type="vertical" />
          <a-popconfirm
            v-if="record.id != 1 && record.id != 2"
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
 
    <!-- 表单区域 -->
    <CustTypeModal ref="modalForm" @ok="modalFormOk"></CustTypeModal>
  </div>
</template>
 
<script>
import CustTypeModal from './CustTypeModal'
import { JeecgListMixin } from '@tievd/cube-block/lib/mixins/JeecgListMixin'
 
export default {
  name: 'ActivityList',
 
  mixins: [JeecgListMixin],
 
  components: {
    CustTypeModal,
  },
 
  data() {
    return {
      description: 'Activity列表',
      // 表头
      columns: [],
      // 列定义
      defaultColumns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '客户类型',
          align: 'center',
          dataIndex: 'clientName',
        },
        {
          title: '规则配置',
          align: 'center',
          dataIndex: 'endTime',
          customRender: (t, r) => {
            if (r.clientConfigs.length > 1) {
              let x = r.clientConfigs.map((el, index) => {
                return (
                  <div>
                    条件{index + 1}: {this.transformConfigText(el)}
                  </div>
                )
              })
              return {
                children: x,
              }
            } else {
              let x = r.clientConfigs.map((el, index) => {
                return <div>{this.transformConfigText(el)}</div>
              })
              return {
                children: x,
              }
            }
          },
        },
 
        {
          title: '操作',
          dataIndex: 'action',
          width: 150,
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/jyz/clientConfig/list',
        delete: '/jyz/clientConfig/delete',
        deleteBatch: '/jyz/activity/deleteBatch',
        exportXlsUrl: '/jyz/activity/exportXls',
      },
    }
  },
 
  methods: {
    transformConfigText(obj) {
      var text = ''
      if (obj.timeStr == '1,YEARS') {
        text += '近1年'
      }
      if (obj.timeStr == '3,MONTHS') {
        text += '近3月'
      }
      if (obj.timeStr == '6,MONTHS') {
        text += '近6月'
      }
      if (obj.timeStr == '7,DAYS') {
        text += '近7天'
      }
      if (obj.timeStr == '30,DAYS') {
        text += '近30天'
      }
      if (obj.countType == 1) {
        text += '累计加油'
      }
      if (obj.countType == 2) {
        text += '每月加油'
      }
      if (obj.countRef == -1) {
        text += `小于${obj.countNum}次`
      }
      if (obj.countRef == 0) {
        text += `等于${obj.countNum}次`
      }
      if (obj.countRef == 1) {
        text += `大于${obj.countNum}次`
      }
      return text
    },
  },
 
  created() {},
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .ant-table-body {
  height: 500px;
}
</style>