-
AR K056
{{ formatModel(emodel) }}
@@ -11,12 +10,121 @@
import { api } from '@/api';
import { formatModel, useForm } from '@/components/AnForm';
import { useTable } from '@/components/AnTable';
+import { useSelection } from '@/components/AnTable/plugins/useSelectionPlugin';
+import { useRefresh } from '@/components/AnTable/plugins/useRefreshPlugin';
+import { useColumnConfig } from '@/components/AnTable/plugins/useColumnConfig';
+import { Ref } from 'vue';
+import { Button, Message } from '@arco-design/web-vue';
+import { delConfirm, sleep } from '@/utils';
const { component: UserTable } = useTable({
+ plugins: [
+ useRefresh(),
+ useColumnConfig(),
+ (() => {
+ let selected: Ref
;
+ return {
+ id: 'deletemany',
+ options(options: any) {
+ let selectPlugin = options.plugins.find((i: any) => i.id === 'selection');
+ if (!selectPlugin) {
+ selectPlugin = useSelection();
+ options.plugins.push(selectPlugin);
+ }
+ selected = selectPlugin.provide.selected;
+ return options;
+ },
+ action() {
+ const loading = ref(false);
+ const onClick = async () => {
+ await delConfirm();
+ loading.value = true;
+ await sleep(3000);
+ loading.value = false;
+ selected.value = [];
+ Message.success('提示: 删除成功!');
+ };
+ return () => (
+
+ );
+ },
+ };
+ })(),
+ (() => {
+ let selected: Ref;
+ return {
+ id: 'export',
+ options(options: any) {
+ let selectPlugin = options.plugins.find((i: any) => i.id === 'selection');
+ if (!selectPlugin) {
+ selectPlugin = useSelection();
+ options.plugins.push(selectPlugin);
+ }
+ selected = selectPlugin.provide.selected;
+ return options;
+ },
+ action() {
+ const onClick = async () => {
+ await delConfirm('确认导出选中数据吗?');
+ await sleep(3000);
+ selected.value = [];
+ Message.success('提示: 删除成功!');
+ };
+ return () => (
+
+ );
+ },
+ };
+ })(),
+ (() => {
+ return {
+ id: 'import',
+ action() {
+ const onClick = async () => {
+ Message.success('提示: TODO!');
+ };
+ return () => (
+
+ );
+ },
+ };
+ })(),
+ (() => {
+ return {
+ id: 'format',
+ options(options) {
+ for (const column of options.columns ?? []) {
+ if (column.render) {
+ continue;
+ }
+ column.render = ({ record, column }) => record[column.dataIndex!] ?? '-';
+ }
+ },
+ };
+ })(),
+ ],
data(search) {
return api.user.getUsers(search);
},
- pagination: {
+ paging: {
hide: false,
},
columns: [
@@ -29,10 +137,6 @@ const { component: UserTable } = useTable({
dataIndex: 'nickname',
title: '用户名称',
},
- // {
- // dataIndex: 'description',
- // title: '用户描述',
- // },
{
dataIndex: 'username',
title: '登录账号',
@@ -64,23 +168,49 @@ const { component: UserTable } = useTable({
{
title: '操作',
type: 'button',
- width: 140,
+ width: 180,
configable: false,
buttons: [
{
text: '修改',
},
{
- text: '修改',
- visible: () => false,
+ text: '移动',
+ // visible: () => false,
},
{
- text: '修改',
+ text: '删除',
disable: () => true,
},
],
},
],
+ search: [
+ {
+ field: 'username',
+ label: '用户名称',
+ setter: 'input',
+ },
+ ],
+ create: {
+ title: '新增',
+ modalProps: {
+ width: 111,
+ },
+ items: [
+ {
+ field: 'title',
+ label: '标题',
+ setter: 'input',
+ },
+ ],
+ submit: async model => {
+ return 1;
+ },
+ },
+ modify: {
+ extend: true,
+ },
});
const { component: UpForm, model: emodel } = useForm({
diff --git a/src/types/auto-component.d.ts b/src/types/auto-component.d.ts
index 9d208b9..fa220c6 100644
--- a/src/types/auto-component.d.ts
+++ b/src/types/auto-component.d.ts
@@ -11,6 +11,7 @@ declare module '@vue/runtime-core' {
ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb']
ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem']
AButton: typeof import('@arco-design/web-vue')['Button']
+ ACard: typeof import('@arco-design/web-vue')['Card']
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox']
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
ADivider: typeof import('@arco-design/web-vue')['Divider']
@@ -20,8 +21,8 @@ declare module '@vue/runtime-core' {
AEmpty: typeof import('@arco-design/web-vue')['Empty']
AForm: typeof import('@arco-design/web-vue')['Form']
AFormItem: typeof import('@arco-design/web-vue')['FormItem']
+ AImage: typeof import('@arco-design/web-vue')['Image']
AInput: typeof import('@arco-design/web-vue')['Input']
- AInputNumber: typeof import('@arco-design/web-vue')['InputNumber']
AInputPassword: typeof import('@arco-design/web-vue')['InputPassword']
AInputSearch: typeof import('@arco-design/web-vue')['InputSearch']
ALayout: typeof import('@arco-design/web-vue')['Layout']
@@ -29,15 +30,20 @@ declare module '@vue/runtime-core' {
ALayoutHeader: typeof import('@arco-design/web-vue')['LayoutHeader']
ALayoutSider: typeof import('@arco-design/web-vue')['LayoutSider']
ALink: typeof import('@arco-design/web-vue')['Link']
+ AList: typeof import('@arco-design/web-vue')['List']
+ AListItem: typeof import('@arco-design/web-vue')['ListItem']
+ AListItemMeta: typeof import('@arco-design/web-vue')['ListItemMeta']
AMenu: typeof import('@arco-design/web-vue')['Menu']
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem']
+ AModal: typeof import('@arco-design/web-vue')['Modal']
AniEmpty: typeof import('./../components/empty/AniEmpty.vue')['default']
- APopover: typeof import('@arco-design/web-vue')['Popover']
+ APagination: typeof import('@arco-design/web-vue')['Pagination']
AScrollbar: typeof import('@arco-design/web-vue')['Scrollbar']
ASpace: typeof import('@arco-design/web-vue')['Space']
ASpin: typeof import('@arco-design/web-vue')['Spin']
ATag: typeof import('@arco-design/web-vue')['Tag']
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
+ ATree: typeof import('@arco-design/web-vue')['Tree']
AUpload: typeof import('@arco-design/web-vue')['Upload']
BaseOption: typeof import('./../components/editor/components/BaseOption.vue')['default']
BreadCrumb: typeof import('./../components/breadcrumb/bread-crumb.vue')['default']