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
171
172
173
174
175
176
177
178
179
180
181
182
| <script lang="ts" setup>
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { UmsMemberProfileApi } from '#/api/ums/member/profile';
|
| import { ref } from 'vue';
|
| import { Page } from '@vben/common-ui';
|
| import { message, Tag } from 'ant-design-vue';
|
| import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
| import {
| approveProfileChange,
| getProfileChangePage,
| } from '#/api/ums/member/profile';
| import { $t } from '#/locales';
|
| import RejectModal from './modules/reject-modal.vue';
|
| defineOptions({ name: 'UmsMemberProfileChange' });
|
| /** 审核状态 */
| const ChangeStatus = {
| PENDING: 0,
| APPROVED: 10,
| REJECTED: 20,
| } as const;
|
| const statusOptions = [
| { label: '待审核', value: ChangeStatus.PENDING },
| { label: '已通过', value: ChangeStatus.APPROVED },
| { label: '已驳回', value: ChangeStatus.REJECTED },
| ];
|
| const rejectModalRef = ref<InstanceType<typeof RejectModal>>();
|
| function useSearchSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'memberNo',
| label: '会员编号',
| component: 'Input',
| componentProps: { placeholder: '请输入会员编号', allowClear: true },
| },
| {
| fieldName: 'memberName',
| label: '会员名称',
| component: 'Input',
| componentProps: { placeholder: '请输入会员名称', allowClear: true },
| },
| {
| fieldName: 'status',
| label: '审核状态',
| component: 'Select',
| componentProps: {
| options: statusOptions,
| placeholder: '请选择状态',
| allowClear: true,
| },
| },
| ];
| }
|
| /** 审核通过 */
| async function handleApprove(row: UmsMemberProfileApi.ChangeRecord) {
| await approveProfileChange(row.id!);
| message.success('审核通过,资料已更新到会员信息');
| gridApi.query();
| }
|
| /** 驳回 */
| function handleReject(row: UmsMemberProfileApi.ChangeRecord) {
| rejectModalRef.value?.show(row.id!);
| }
|
| const [Grid, gridApi] = useVbenVxeGrid({
| formOptions: {
| schema: useSearchSchema(),
| },
| gridOptions: {
| columns: [
| { field: 'memberNo', title: '会员编号', width: 180, fixed: 'left' },
| { field: 'memberName', title: '会员名称', minWidth: 130 },
| {
| field: 'status',
| title: '审核状态',
| width: 100,
| slots: { default: 'status' },
| },
| {
| field: 'changeSummary',
| title: '变更内容',
| minWidth: 360,
| showOverflow: 'tooltip',
| },
| { field: 'contactPhone', title: '联系电话', minWidth: 130 },
| {
| field: 'createTime',
| title: '提交时间',
| width: 165,
| formatter: 'formatDateTime',
| },
| {
| field: 'auditTime',
| title: '审核时间',
| width: 165,
| formatter: 'formatDateTime',
| },
| {
| field: 'auditRemark',
| title: '审核意见',
| minWidth: 180,
| showOverflow: 'tooltip',
| },
| {
| title: '操作',
| width: 150,
| fixed: 'right',
| slots: { default: 'actions' },
| },
| ],
| height: 'auto',
| keepSource: true,
| proxyConfig: {
| ajax: {
| query: async ({ page }, formValues) => {
| return await getProfileChangePage({
| pageNo: page.currentPage,
| pageSize: page.pageSize,
| ...formValues,
| });
| },
| },
| },
| rowConfig: { keyField: 'id', isHover: true },
| toolbarConfig: { refresh: true, search: true },
| } as VxeTableGridOptions<UmsMemberProfileApi.ChangeRecord>,
| });
| </script>
|
| <template>
| <Page auto-content-height>
| <RejectModal ref="rejectModalRef" @success="gridApi.query()" />
| <Grid table-title="会员资料变更审核">
| <template #status="{ row }">
| <Tag v-if="row.status === ChangeStatus.PENDING" color="processing">
| 待审核
| </Tag>
| <Tag v-else-if="row.status === ChangeStatus.APPROVED" color="success">
| 已通过
| </Tag>
| <Tag v-else color="error">已驳回</Tag>
| </template>
| <template #actions="{ row }">
| <TableAction
| :actions="[
| {
| label: '通过',
| type: 'link',
| auth: ['ums:member:change:audit'],
| ifShow: () => row.status === ChangeStatus.PENDING,
| popConfirm: {
| title: `确认通过会员 ${row.memberName} 的资料变更吗?通过后将直接更新会员资料`,
| confirm: handleApprove.bind(null, row),
| },
| },
| {
| label: '驳回',
| type: 'link',
| danger: true,
| auth: ['ums:member:change:audit'],
| ifShow: () => row.status === ChangeStatus.PENDING,
| onClick: handleReject.bind(null, row),
| },
| ]"
| />
| </template>
| <template #empty>暂无资料变更申请</template>
| </Grid>
| </Page>
| </template>
|
|