| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <div class="h-full overflow-hidden">
- <n-card title="用户管理" :bordered="false" class="rounded-16px shadow-sm">
- <n-space class="pb-12px" justify="space-between">
- <!-- <n-space>
- <n-button type="primary" @click="handleAddTable">
- <icon-ic-round-plus class="mr-4px text-20px" />
- 新增
- </n-button>
- <n-button type="error">
- <icon-ic-round-delete class="mr-4px text-20px" />
- 删除
- </n-button>
- <n-button type="success">
- <icon-uil:export class="mr-4px text-20px" />
- 导出Excel
- </n-button>
- </n-space> -->
- <!-- <n-space align="center" :size="18">
- <n-button size="small" type="primary" @click="getTableData">
- <icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
- 刷新表格
- </n-button>
- <column-setting v-model:columns="columns" />
- </n-space> -->
- </n-space>
- <n-data-table :columns="columns" :data="tableData" :pagination="pagination" />
- <!-- <table-action-modal v-model:visible="visible" :type="modalType" :edit-data="editData" /> -->
- </n-card>
- </div>
- </template>
- <script setup lang="ts">
- import { ref } from 'vue';
- import type { Ref } from 'vue';
- // import type { SelectAll_1Res } from './api';
- import type { DataTableColumns, PaginationProps } from 'naive-ui';
- // import { query } from '~/src/service/api/user';
- // import type { QueryParams } from '~/src/service/api/user';
- import { selectAll_1 } from '~/src/service/api/user';
- const tableData = ref<any[]>([]);
- const pagination: PaginationProps = ref({
- page: 1,
- pageSize: 10,
- showSizePicker: true,
- pageSizes: [10, 20, 50]
- // onChange: (page: number) => {
- // // 处理页码变化
- // },
- // onUpdatePageSize: (pageSize: number) => {
- // // 处理每页显示数量变化
- // }
- }).value;
- async function getTableData() {
- // const pageNum = pagination.page as number;
- // const pageSize = pagination.pageSize as number;
- // const params: any = {};
- selectAll_1().then(res => {
- // console.log(res);
- tableData.value = res.data as [];
- });
- }
- type RowData = {
- key: number
- id: number
- name: string
- description: string
- createTime: string
- modifyTime: string
- createUid: number
- disabled: string
- }
- const columns: Ref<DataTableColumns<RowData>> = ref([
- {
- type: 'selection',
- align: 'center',
- },
- {
- key: 'id',
- title: "ID",
- align: 'center'
- },
- {
- key: 'name',
- title: '部门名称',
- align: 'center'
- },
- {
- key: 'description',
- title: '部门地址',
- align: 'center'
- },
- {
- key: 'createTime',
- title: '创建时间',
- align: 'center'
- },
- {
- key: 'modifyTime',
- title: '修改时间',
- align: 'center'
- },
- {
- key: 'createUid',
- title: '创建用户ID',
- align: 'center'
- },
- {
- key: 'disabled',
- title: '状态',
- align: 'center'
- }
- ]) as Ref<DataTableColumns<any>>;
- function init() {
- getTableData();
- }
- // 初始化
- init();
- </script>
|