Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
106 lines
2.3 KiB
Vue
106 lines
2.3 KiB
Vue
<script lang="ts" setup>
|
|
import type {
|
|
OnActionClickParams,
|
|
VxeGridListeners,
|
|
VxeTableGridOptions,
|
|
} from '#/adapter/vxe-table';
|
|
import type { AgentApi } from '#/api/agent';
|
|
|
|
import { Page, useVbenDrawer } from '@vben/common-ui';
|
|
|
|
import { Button, Space } from 'ant-design-vue';
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
import { getAgentMembershipConfigList } from '#/api/agent';
|
|
|
|
import { useColumns, useGridFormSchema } from './data';
|
|
import Form from './modules/form.vue';
|
|
|
|
// 表单抽屉
|
|
const [FormDrawer, formDrawerApi] = useVbenDrawer({
|
|
connectedComponent: Form,
|
|
destroyOnClose: true,
|
|
});
|
|
|
|
// 表格配置
|
|
const [Grid, gridApi] = useVbenVxeGrid({
|
|
formOptions: {
|
|
schema: useGridFormSchema(),
|
|
submitOnChange: true,
|
|
},
|
|
gridEvents: {
|
|
sortChange: () => {
|
|
gridApi.query();
|
|
},
|
|
} as VxeGridListeners<AgentApi.AgentMembershipConfigListItem>,
|
|
gridOptions: {
|
|
columns: useColumns(),
|
|
height: 'auto',
|
|
keepSource: true,
|
|
proxyConfig: {
|
|
ajax: {
|
|
query: async ({ page }, formValues) => {
|
|
const res = await getAgentMembershipConfigList({
|
|
page: page.currentPage,
|
|
pageSize: page.pageSize,
|
|
level_name: formValues.level_name,
|
|
});
|
|
return res;
|
|
},
|
|
},
|
|
props: {
|
|
result: 'items',
|
|
total: 'total',
|
|
},
|
|
},
|
|
rowConfig: {
|
|
keyField: 'id',
|
|
},
|
|
toolbarConfig: {
|
|
custom: true,
|
|
export: false,
|
|
refresh: { code: 'query' },
|
|
search: true,
|
|
zoom: true,
|
|
},
|
|
} as VxeTableGridOptions<AgentApi.AgentMembershipConfigListItem>,
|
|
});
|
|
|
|
// 操作处理函数
|
|
function onActionClick(
|
|
e: OnActionClickParams<AgentApi.AgentMembershipConfigListItem>,
|
|
) {
|
|
switch (e.code) {
|
|
case 'edit': {
|
|
onEdit(e.row);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 编辑处理
|
|
function onEdit(row: AgentApi.AgentMembershipConfigListItem) {
|
|
formDrawerApi.setData(row).open();
|
|
}
|
|
|
|
// 刷新处理
|
|
function onRefresh() {
|
|
gridApi.query();
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Page auto-content-height>
|
|
<FormDrawer @success="onRefresh" />
|
|
<Grid table-title="代理会员配置列表">
|
|
<template #operation="{ row }">
|
|
<Space>
|
|
<Button type="link" @click="onActionClick({ code: 'edit', row })">
|
|
配置
|
|
</Button>
|
|
</Space>
|
|
</template>
|
|
</Grid>
|
|
</Page>
|
|
</template>
|