签入版本

This commit is contained in:
2026-10-10 19:17:02 +08:00
parent 3423dea03f
commit 32f941b631
232 changed files with 4264 additions and 6251 deletions
@@ -8,28 +8,46 @@
```vue
<template>
<BasicTable @register="registerTable" />
<BasicTable
:columns="columns"
:request="loadDataTable"
:row-key="(row) => row.id"
ref="tableRef"
scroll-x="1200"
>
<template #tableTitle>
<a-button type="primary" @click="handleAdd">新增</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link" @click="handleEdit(record)">编辑</a-button>
<a-button type="link" danger @click="handleDelete(record.id)">删除</a-button>
</a-space>
</template>
</template>
</BasicTable>
</template>
<script setup>
import { BasicTable, useTable } from '@/components/Table';
import { ref } from 'vue';
import { getExamplePage, exampleDelete } from '@/api/tool/example';
const [registerTable] = useTable({
api: getExamplePage, // 数据接口
columns: [ // 列定义
{ title: 'ID', field: 'id', width: 80 },
{ title: '名称', field: 'name' },
{ title: '状态', field: 'statusText', width: 100 },
{ title: '创建时间', field: 'createTime', width: 180 },
],
actionColumn: { // 操作列
width: 200,
actions: [
{ label: '编辑', onClick: handleEdit },
{ label: '删除', onClick: handleDelete, type: 'danger' },
],
},
});
const tableRef = ref();
const columns = [
{ title: 'ID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name' },
{ title: '状态', dataIndex: 'statusText', width: 100 },
{ title: '创建时间', dataIndex: 'createTime', width: 180 },
{ title: '操作', dataIndex: 'action', key: 'action', width: 200, fixed: 'right' },
];
// BasicTable 数据加载:返回值直接交给表格渲染
const loadDataTable = async (params) => await getExamplePage(params);
const handleAdd = () => {};
const handleEdit = (record) => {};
const handleDelete = async (id) => {};
</script>
```
@@ -17,13 +17,13 @@ import { BasicForm, useForm } from '@/components/Form';
const [registerForm] = useForm({
schemas: [
{
field: 'name',
name: 'name',
label: '名称',
component: 'Input',
required: true,
rules: [{ required: true, message: '请输入名称', trigger: ['blur'] }],
},
{
field: 'status',
name: 'status',
label: '状态',
component: 'Select',
componentProps: {
@@ -42,17 +42,21 @@ const [registerForm] = useForm({
```vue
<template>
<BasicModal @register="registerModal" @ok="handleSubmit" />
<basicModal @register="registerModal" @ok="handleSubmit">
<template #default>
<!-- 表单内容 -->
</template>
</basicModal>
</template>
<script setup>
import { BasicModal, useModal } from '@/components/Modal';
import { basicModal, useModal } from '@/components/Modal';
const [registerModal, { openModal, closeModal }] = useModal();
// 打开弹窗
const handleAdd = () => {
openModal(true, { isUpdate: false });
openModal();
};
// 提交
@@ -68,12 +72,11 @@ const handleSubmit = async () => {
```vue
<template>
<BasicUpload v-model="formData.avatar" :action="uploadUrl" />
<UploadImg v-model:image-url="formData.avatar" name="example" :fileSize="20" />
</template>
<script setup>
import { BasicUpload } from '@/components/Upload';
const uploadUrl = '/api/upload/uploadFile';
import UploadImg from '@/components/Upload/Image.vue';
</script>
```
@@ -81,11 +84,18 @@ const uploadUrl = '/api/upload/uploadFile';
```vue
<template>
<Editor v-model="formData.content" />
<Editor ref="editorRef" :height="editorHeight" name="content" />
</template>
<script setup>
import Editor from '@/components/Editor/index.vue';
import { ref } from 'vue';
import Editor from '@/components/Editor/tinymce.vue';
const editorRef = ref();
const editorHeight = 400;
// 提交时读取编辑器内容(真实项目回填:editorRef.value.myValue = html)
const getContent = () => editorRef.value?.myValue;
</script>
```
@@ -93,11 +103,13 @@ import Editor from '@/components/Editor/index.vue';
```vue
<template>
<Password v-model="formData.password" />
<Password :value="formData.password" :repeat="true" />
</template>
<script setup>
import { Password } from '@/components/Password';
// 组件内部维护输入值与强度校验,仅通过 value 单向传入初始值(无 v-model)
</script>
```
@@ -77,10 +77,10 @@ interface MenuItem {
const tabsViewStore = useTabsViewStore();
// 添加标签
tabsViewStore.addTab(route);
tabsViewStore.addTabs(route);
// 关闭标签
tabsViewStore.removeTab(route);
tabsViewStore.closeCurrentTab(route);
```
## 响应式布局
@@ -11,8 +11,6 @@
| userStore | `store/modules/user.ts` | Token / 用户信息 / 权限列表 / 登录登出 |
| asyncRouteStore | `store/modules/asyncRoute.ts` | 动态路由 / keep-alive 缓存 |
| projectSettingStore | `store/modules/projectSetting.ts` | 项目配置 |
| ossConfigStore | `store/modules/ossConfig.ts` | 云存储配置 |
| designSettingStore | `store/modules/designSetting.ts` | 主题设计 |
| lockscreenStore | `store/modules/lockscreen.ts` | 锁屏 |
| tabsViewStore | `store/modules/tabsView.ts` | 标签页 |