11 Commits
2.4.x ... 2.5.x

36 changed files with 2947 additions and 4261 deletions

View File

@@ -1,3 +1,18 @@
## v2.5.0 (2024-03-23)
### ✨ 新特性
* 新增代码批量生成功能 ([2353caf](https://github.com/Charles7c/continew-admin-ui/commit/2353caffa9ddfbf8c0f9657c1f2e89b14eff38db))
### 💎 功能优化
- 调整代码生成 API 地址 ([b4bb469](https://github.com/Charles7c/continew-admin-ui/commit/b4bb4693dfd694bcc5f10be32cf7d405af92367e))
- 适配部分 API 响应格式调整为 kv 格式的变化 ([6f5c35e](https://github.com/Charles7c/continew-admin-ui/commit/6f5c35ea77b1e3880bca477ec027d074915341e8))
- 调整文件管理配置存储库按钮风格 ([aeafc2e](https://github.com/Charles7c/continew-admin-ui/commit/aeafc2ece2012b53bfe8ff6c64fed9ad73f9d188))
- 代码生成字段配置增加字段排序信息 ([e9d3865](https://github.com/Charles7c/continew-admin-ui/commit/e9d38658920f49e0bb0600e779621c44d388057e))
- 优化部分 ref API 使用方式 ([e6fa9f6](https://github.com/Charles7c/continew-admin-ui/commit/e6fa9f60a927f639b8b7f6145982a395506b3150))
- 重构代码生成功能,由指定路径生成模式调整为下载模式,更方便复杂场景 ([7792cd3](https://github.com/Charles7c/continew-admin-ui/commit/7792cd398f6c4a2d10187cb548ba687dc8f62c84))
## v2.4.0 (2024-02-16) ## v2.4.0 (2024-02-16)
### ✨ 新特性 ### ✨ 新特性

View File

@@ -4,7 +4,7 @@
<img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License" /> <img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License" />
</a> </a>
<a href="https://github.com/Charles7c/continew-admin-ui" target="_blank"> <a href="https://github.com/Charles7c/continew-admin-ui" target="_blank">
<img src="https://img.shields.io/badge/RELEASE-v2.4.0-%23ff3f59.svg" alt="Release" /> <img src="https://img.shields.io/badge/RELEASE-v2.5.0-%23ff3f59.svg" alt="Release" />
</a> </a>
<a href="https://cn.vuejs.org/" target="_blank"> <a href="https://cn.vuejs.org/" target="_blank">
<img src="https://img.shields.io/badge/Vue-3.3.7-%236CB52D.svg?logo=Vue.js" alt="Release" /> <img src="https://img.shields.io/badge/Vue-3.3.7-%236CB52D.svg?logo=Vue.js" alt="Release" />

View File

@@ -0,0 +1,11 @@
/**
* Image resource files used to compress the output of the production environment
* 图片压缩
* https://www.npmjs.com/package/vite-plugin-image-optimizer
*/
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
export default function configImageOptimizerPlugin() {
const imageOptimizerPlugin = ViteImageOptimizer();
return imageOptimizerPlugin;
}

View File

@@ -1,37 +0,0 @@
/**
* Image resource files used to compress the output of the production environment
* 图片压缩
* https://github.com/anncwb/vite-plugin-imagemin
*/
import viteImagemin from 'vite-plugin-imagemin';
export default function configImageminPlugin() {
const imageminPlugin = viteImagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpeg: {
quality: 20,
},
pngquant: {
quality: [0.8, 0.9],
speed: 4,
},
svgo: {
plugins: [
{
name: 'removeViewBox',
},
{
name: 'removeEmptyAttrs',
active: false,
},
],
},
});
return imageminPlugin;
}

View File

@@ -3,7 +3,7 @@ import baseConfig from './vite.config.base';
import configCompressPlugin from './plugin/compress'; import configCompressPlugin from './plugin/compress';
import configVisualizerPlugin from './plugin/visualizer'; import configVisualizerPlugin from './plugin/visualizer';
// import configArcoResolverPlugin from './plugin/arcoResolver'; // import configArcoResolverPlugin from './plugin/arcoResolver';
import configImageminPlugin from './plugin/imagemin'; import configImageOptimizerPlugin from './plugin/imageOptimizer';
import createSvgIcon from './plugin/svg-icon'; import createSvgIcon from './plugin/svg-icon';
export default mergeConfig( export default mergeConfig(
@@ -13,7 +13,7 @@ export default mergeConfig(
configCompressPlugin('gzip'), configCompressPlugin('gzip'),
configVisualizerPlugin(), configVisualizerPlugin(),
// configArcoResolverPlugin(), // configArcoResolverPlugin(),
configImageminPlugin(), configImageOptimizerPlugin(),
createSvgIcon(true), createSvgIcon(true),
], ],
build: { build: {
@@ -29,5 +29,5 @@ export default mergeConfig(
chunkSizeWarningLimit: 2000, chunkSizeWarningLimit: 2000,
}, },
}, },
baseConfig baseConfig,
); );

View File

@@ -1,7 +1,7 @@
{ {
"name": "continew-admin-ui", "name": "continew-admin-ui",
"description": "ContiNew AdminContinue New Admin持续迭代优化的前后端分离中后台管理系统框架开箱即用持续提供舒适的开发体验。", "description": "ContiNew AdminContinue New Admin持续迭代优化的前后端分离中后台管理系统框架开箱即用持续提供舒适的开发体验。",
"version": "2.4.0", "version": "2.5.0",
"private": true, "private": true,
"author": "Charles7c", "author": "Charles7c",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -46,6 +46,7 @@
"mitt": "^3.0.1", "mitt": "^3.0.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"query-string": "^8.1.0", "query-string": "^8.1.0",
"sortablejs": "^1.15.1", "sortablejs": "^1.15.1",
"v-viewer": "^3.0.10", "v-viewer": "^3.0.10",
@@ -91,19 +92,21 @@
"rollup": "^4.9.1", "rollup": "^4.9.1",
"rollup-plugin-visualizer": "^5.11.0", "rollup-plugin-visualizer": "^5.11.0",
"sass": "^1.69.5", "sass": "^1.69.5",
"sharp": "^0.33.3",
"stylelint": "^16.0.2", "stylelint": "^16.0.2",
"stylelint-config-prettier": "^9.0.5", "stylelint-config-prettier": "^9.0.5",
"stylelint-config-rational-order": "^0.1.2", "stylelint-config-rational-order": "^0.1.2",
"stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^35.0.0", "stylelint-config-standard": "^35.0.0",
"stylelint-order": "^6.0.4", "stylelint-order": "^6.0.4",
"svgo": "^3.2.0",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"unplugin-auto-import": "^0.17.3", "unplugin-auto-import": "^0.17.3",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.26.0",
"vite": "^4.5.1", "vite": "^4.5.1",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vite-plugin-imagemin": "^0.6.1", "vite-plugin-image-optimizer": "^1.1.7",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-svg-loader": "^4.0.0", "vite-svg-loader": "^4.0.0",
"vue-tsc": "^1.8.26" "vue-tsc": "^1.8.26"

6766
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -49,8 +49,12 @@ export function listRoute() {
return axios.get<RouteRecordNormalized[]>(`${BASE_URL}/route`); return axios.get<RouteRecordNormalized[]>(`${BASE_URL}/route`);
} }
export interface SocialAuthAuthorizeResp {
authorizeUrl: string;
}
export function socialAuth(source: string) { export function socialAuth(source: string) {
return axios.get<string>(`/oauth/${source}`); return axios.get<SocialAuthAuthorizeResp>(`/oauth/${source}`);
} }
export function socialLogin(source: string, req: any) { export function socialLogin(source: string, req: any) {

View File

@@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import qs from 'query-string'; import qs from 'query-string';
const BASE_URL = '/tool/generator'; const BASE_URL = '/generator';
export interface TableRecord { export interface TableRecord {
tableName: string; tableName: string;
@@ -10,6 +10,7 @@ export interface TableRecord {
charset: string; charset: string;
createTime?: string; createTime?: string;
isConfiged: boolean; isConfiged: boolean;
disabled: boolean;
} }
export interface TableParam { export interface TableParam {
@@ -36,6 +37,7 @@ export interface FieldConfigRecord {
columnType: string; columnType: string;
fieldName: string; fieldName: string;
fieldType: string; fieldType: string;
fieldSort: number;
comment: string; comment: string;
isRequired: boolean; isRequired: boolean;
showInList: boolean; showInList: boolean;
@@ -56,7 +58,6 @@ export interface GenConfigRecord {
tableName: string; tableName: string;
moduleName: string; moduleName: string;
packageName: string; packageName: string;
frontendPath: string;
businessName: string; businessName: string;
author: string; author: string;
tablePrefix: string; tablePrefix: string;
@@ -87,6 +88,10 @@ export function preview(tableName: string) {
return axios.get<GeneratePreviewRecord[]>(`${BASE_URL}/preview/${tableName}`); return axios.get<GeneratePreviewRecord[]>(`${BASE_URL}/preview/${tableName}`);
} }
export function generate(tableName: string) { export function generate(tableNames: Array<string>) {
return axios.post(`${BASE_URL}/${tableName}`); return axios.request({
url: `${BASE_URL}/${tableNames}`,
method: 'post',
responseType: 'blob',
});
} }

View File

@@ -1,10 +1,11 @@
import { createPinia } from 'pinia'; import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import useAppStore from './modules/app'; import useAppStore from './modules/app';
import useUserStore from './modules/user'; import useUserStore from './modules/user';
import useDictStore from './modules/dict'; import useDictStore from './modules/dict';
import useTabBarStore from './modules/tab-bar'; import useTabBarStore from './modules/tab-bar';
const pinia = createPinia(); const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
export { useAppStore, useUserStore, useDictStore, useTabBarStore }; export { useAppStore, useUserStore, useDictStore, useTabBarStore };
export default pinia; export default pinia;

View File

@@ -27,7 +27,6 @@ const recursionMenu = (
}; };
const useAppStore = defineStore('app', { const useAppStore = defineStore('app', {
state: (): AppState => ({ ...defaultSettings, config: {} }), state: (): AppState => ({ ...defaultSettings, config: {} }),
getters: { getters: {
appCurrentSetting(state: AppState): AppState { appCurrentSetting(state: AppState): AppState {
return { ...state }; return { ...state };
@@ -155,6 +154,7 @@ const useAppStore = defineStore('app', {
); );
}, },
}, },
persist: true,
}); });
export default useAppStore; export default useAppStore;

View File

@@ -46,6 +46,9 @@ axios.interceptors.response.use(
) { ) {
return response; return response;
} }
if (response.config.responseType === 'blob') {
return response;
}
const res = response.data; const res = response.data;
if (res.success) { if (res.success) {
return res; return res;

View File

@@ -51,7 +51,7 @@
el.color el.color
}" class="tooltip-item-icon"></span><span>${el.seriesName}</span> }" class="tooltip-item-icon"></span><span>${el.seriesName}</span>
</p> </p>
<span class="tooltip-value">${el.value.toLocaleString()}</span> <span class="tooltip-value">${el.toLocaleString()}</span>
</div>` </div>`
) )
.reverse() .reverse()

View File

@@ -9,6 +9,7 @@
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const userStore = useUserStore(); const userStore = useUserStore();
const formRef = ref();
const loading = ref(false); const loading = ref(false);
const captchaLoading = ref(false); const captchaLoading = ref(false);
const captchaDisable = ref(false); const captchaDisable = ref(false);
@@ -47,7 +48,7 @@
*/ */
const handleSendCaptcha = () => { const handleSendCaptcha = () => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('email', (valid: any) => { formRef.value.validateField('email', (valid: any) => {
if (!valid) { if (!valid) {
captchaLoading.value = true; captchaLoading.value = true;
captchaBtnNameKey.value = 'login.captcha.ing'; captchaBtnNameKey.value = 'login.captcha.ing';

View File

@@ -9,6 +9,7 @@
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const userStore = useUserStore(); const userStore = useUserStore();
const formRef = ref();
const loading = ref(false); const loading = ref(false);
const captchaLoading = ref(false); const captchaLoading = ref(false);
const captchaDisable = ref(true); const captchaDisable = ref(true);
@@ -43,7 +44,7 @@
*/ */
const handleOpenBehaviorCaptcha = () => { const handleOpenBehaviorCaptcha = () => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('phone', (valid: any) => { formRef.value.validateField('phone', (valid: any) => {
if (!valid) { if (!valid) {
proxy.$refs.verifyRef.show(); proxy.$refs.verifyRef.show();
} }
@@ -65,7 +66,7 @@
*/ */
const handleSendCaptcha = (captchaParam: BehaviorCaptchaReq) => { const handleSendCaptcha = (captchaParam: BehaviorCaptchaReq) => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('phone', (valid: any) => { formRef.value.validateField('phone', (valid: any) => {
if (!valid) { if (!valid) {
captchaLoading.value = true; captchaLoading.value = true;
captchaBtnNameKey.value = 'login.captcha.ing'; captchaBtnNameKey.value = 'login.captcha.ing';

View File

@@ -17,7 +17,7 @@
*/ */
const handleSocialAuth = async (source: string) => { const handleSocialAuth = async (source: string) => {
const { data } = await socialAuth(source); const { data } = await socialAuth(source);
window.location.href = data; window.location.href = data.authorizeUrl;
}; };
const toggleLoginMode = () => { const toggleLoginMode = () => {

View File

@@ -10,6 +10,7 @@
'success_failure_status_enum', 'success_failure_status_enum',
); );
const queryFormRef = ref();
const loginLogList = ref<LoginLogRecord[]>([]); const loginLogList = ref<LoginLogRecord[]>([]);
const total = ref(0); const total = ref(0);
const loading = ref(false); const loading = ref(false);
@@ -55,7 +56,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -94,7 +95,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div class="header-query"> <div class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="status" hide-label> <a-form-item field="status" hide-label>
<a-select <a-select
v-model="queryParams.status" v-model="queryParams.status"

View File

@@ -10,6 +10,7 @@
'success_failure_status_enum' 'success_failure_status_enum'
); );
const queryFormRef = ref();
const operationLogList = ref<OperationLogRecord[]>([]); const operationLogList = ref<OperationLogRecord[]>([]);
const total = ref(0); const total = ref(0);
const loading = ref(false); const loading = ref(false);
@@ -56,7 +57,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -95,7 +96,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div class="header-query"> <div class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="description" hide-label> <a-form-item field="description" hide-label>
<a-input <a-input
v-model="queryParams.description" v-model="queryParams.description"

View File

@@ -12,6 +12,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { copy, copied } = useClipboard(); const { copy, copied } = useClipboard();
const queryFormRef = ref();
const systemLogList = ref<SystemLogRecord[]>([]); const systemLogList = ref<SystemLogRecord[]>([]);
const systemLog = ref<SystemLogDetailRecord>({ const systemLog = ref<SystemLogDetailRecord>({
traceId: '', traceId: '',
@@ -112,7 +113,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -151,7 +152,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div class="header-query"> <div class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="createTime" hide-label> <a-form-item field="createTime" hide-label>
<date-range-picker v-model="queryParams.createTime" /> <date-range-picker v-model="queryParams.createTime" />
</a-form-item> </a-form-item>

View File

@@ -4,7 +4,8 @@
import checkPermission from '@/utils/permission'; import checkPermission from '@/utils/permission';
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const queryFormRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const total = ref(0); const total = ref(0);
const loading = ref(false); const loading = ref(false);
@@ -63,7 +64,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -102,7 +103,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div class="header-query"> <div class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="nickname" hide-label> <a-form-item field="nickname" hide-label>
<a-input <a-input
v-model="queryParams.nickname" v-model="queryParams.nickname"

View File

@@ -16,6 +16,9 @@
'announcement_status_enum', 'announcement_status_enum',
); );
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({}); const dataDetail = ref<DataRecord>({});
const total = ref(0); const total = ref(0);
@@ -97,7 +100,7 @@
*/ */
const reset = () => { const reset = () => {
form.value = {}; form.value = {};
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -105,14 +108,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
@@ -185,7 +188,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -228,7 +231,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -267,7 +270,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="title" hide-label> <a-form-item field="title" hide-label>
<a-input <a-input
v-model="queryParams.title" v-model="queryParams.title"

View File

@@ -12,6 +12,7 @@
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const formRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const isEdit = ref(false); const isEdit = ref(false);
const logoFile = ref<FileItem>({ uid: '-1' }); const logoFile = ref<FileItem>({ uid: '-1' });
@@ -81,7 +82,7 @@
* 保存 * 保存
*/ */
const handleSave = () => { const handleSave = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
const optionList: DataRecord[] = Object.entries(form.value).map( const optionList: DataRecord[] = Object.entries(form.value).map(
(item) => { (item) => {
@@ -121,7 +122,7 @@
upload(formData) upload(formData)
.then((res) => { .then((res) => {
onSuccess(res); onSuccess(res);
form.value.site_logo = res.data; form.value.site_logo = res.data.url;
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}) })
.catch((error) => { .catch((error) => {
@@ -156,7 +157,7 @@
upload(formData) upload(formData)
.then((res) => { .then((res) => {
onSuccess(res); onSuccess(res);
form.value.site_favicon = res.data; form.value.site_favicon = res.data.url;
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}) })
.catch((error) => { .catch((error) => {

View File

@@ -15,6 +15,9 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum'); const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({}); const dataDetail = ref<DataRecord>({});
const ids = ref<Array<number>>([]); const ids = ref<Array<number>>([]);
@@ -64,7 +67,7 @@
.then((res) => { .then((res) => {
dataList.value = res.data; dataList.value = res.data;
setTimeout(() => { setTimeout(() => {
proxy.$refs.tableRef.expandAll(); tableRef.value.expandAll();
}, 0); }, 0);
}) })
.finally(() => { .finally(() => {
@@ -110,7 +113,7 @@
form.value = { form.value = {
sort: 999, sort: 999,
}; };
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -118,14 +121,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
@@ -197,7 +200,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -208,7 +211,7 @@
if (rowKeys.find((key: any) => key === rowKey)) { if (rowKeys.find((key: any) => key === rowKey)) {
if (record.children) { if (record.children) {
record.children.forEach((r) => { record.children.forEach((r) => {
proxy.$refs.tableRef.select(r.id); tableRef.value.select(r.id);
rowKeys.push(r.id); rowKeys.push(r.id);
if (r.children) { if (r.children) {
handleSelect(rowKeys, rowKey, r); handleSelect(rowKeys, rowKey, r);
@@ -221,7 +224,7 @@
rowKeys.findIndex((key: number | undefined) => key === r.id), rowKeys.findIndex((key: number | undefined) => key === r.id),
1, 1,
); );
proxy.$refs.tableRef.select(r.id, false); tableRef.value.select(r.id, false);
if (r.children) { if (r.children) {
handleSelect(rowKeys, rowKey, r); handleSelect(rowKeys, rowKey, r);
} }
@@ -297,7 +300,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
</script> </script>
@@ -316,7 +319,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="name" hide-label> <a-form-item field="name" hide-label>
<a-input <a-input
v-model="queryParams.name" v-model="queryParams.name"

View File

@@ -14,6 +14,9 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const total = ref(0); const total = ref(0);
const ids = ref<Array<number>>([]); const ids = ref<Array<number>>([]);
@@ -129,7 +132,7 @@
*/ */
const reset = () => { const reset = () => {
form.value = {}; form.value = {};
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -137,14 +140,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
@@ -191,7 +194,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -223,7 +226,7 @@
* 查询 * 查询
*/ */
const handleQuery = () => { const handleQuery = () => {
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
getList(); getList();
}; };
@@ -231,7 +234,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -272,7 +275,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="name" hide-label> <a-form-item field="name" hide-label>
<a-input <a-input
v-model="queryParams.name" v-model="queryParams.name"

View File

@@ -17,6 +17,8 @@
}, },
}); });
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const colors = ref(['primary', 'success', 'warning', 'error', 'default']); const colors = ref(['primary', 'success', 'warning', 'error', 'default']);
const total = ref(0); const total = ref(0);
@@ -95,7 +97,7 @@
sort: 999, sort: 999,
dictId: dictId.value, dictId: dictId.value,
}; };
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -103,14 +105,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {

View File

@@ -28,6 +28,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const route = useRoute(); const route = useRoute();
const fileStore = useFileStore(); const fileStore = useFileStore();
const queryFormRef = ref();
const loading = ref(false); const loading = ref(false);
// 文件列表数据 // 文件列表数据
const fileList = ref<FileItem[]>([]); const fileList = ref<FileItem[]>([]);
@@ -212,7 +213,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -393,7 +394,7 @@
<a-row justify="space-between" class="row-operate"> <a-row justify="space-between" class="row-operate">
<!-- 左侧区域 --> <!-- 左侧区域 -->
<a-space wrap> <a-space wrap>
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item hide-label> <a-form-item hide-label>
<a-upload <a-upload
v-permission="['system:file:upload']" v-permission="['system:file:upload']"
@@ -449,6 +450,14 @@
isBatchMode ? '取消批量' : '批量操作' isBatchMode ? '取消批量' : '批量操作'
}}</template> }}</template>
</a-button> </a-button>
<a-button
v-permission="['system:storage:list']"
type="primary"
@click="handleConfig"
>
<template #icon><icon-settings /></template>
<template #default>配置存储库</template>
</a-button>
<a-button-group> <a-button-group>
<a-tooltip content="视图" position="bottom"> <a-tooltip content="视图" position="bottom">
<a-button @click="fileStore.changeViewMode"> <a-button @click="fileStore.changeViewMode">
@@ -458,16 +467,6 @@
</template> </template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip content="配置存储库" position="bottom">
<a-button
v-permission="['system:storage:list']"
@click="handleConfig"
>
<template #icon>
<icon-settings />
</template>
</a-button>
</a-tooltip>
</a-button-group> </a-button-group>
</a-space> </a-space>
</a-row> </a-row>

View File

@@ -15,6 +15,9 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum'); const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const ids = ref<Array<number>>([]); const ids = ref<Array<number>>([]);
const title = ref(''); const title = ref('');
@@ -107,7 +110,7 @@
isHidden: false, isHidden: false,
sort: 999, sort: 999,
}; };
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -115,14 +118,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
@@ -170,7 +173,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -181,7 +184,7 @@
if (rowKeys.find((key: any) => key === rowKey)) { if (rowKeys.find((key: any) => key === rowKey)) {
if (record.children) { if (record.children) {
record.children.forEach((r) => { record.children.forEach((r) => {
proxy.$refs.tableRef.select(r.id); tableRef.value.select(r.id);
rowKeys.push(r.id); rowKeys.push(r.id);
if (r.children) { if (r.children) {
handleSelect(rowKeys, rowKey, r); handleSelect(rowKeys, rowKey, r);
@@ -194,7 +197,7 @@
rowKeys.findIndex((key: number | undefined) => key === r.id), rowKeys.findIndex((key: number | undefined) => key === r.id),
1, 1,
); );
proxy.$refs.tableRef.select(r.id, false); tableRef.value.select(r.id, false);
if (r.children) { if (r.children) {
handleSelect(rowKeys, rowKey, r); handleSelect(rowKeys, rowKey, r);
} }
@@ -231,7 +234,7 @@
*/ */
const handleExpandAll = () => { const handleExpandAll = () => {
expandAll.value = !expandAll.value; expandAll.value = !expandAll.value;
proxy.$refs.tableRef.expandAll(expandAll.value); tableRef.value.expandAll(expandAll.value);
}; };
/** /**
@@ -300,7 +303,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
</script> </script>
@@ -320,7 +323,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="title" hide-label> <a-form-item field="title" hide-label>
<a-input <a-input
v-model="queryParams.title" v-model="queryParams.title"

View File

@@ -3,6 +3,8 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { message_type_enum } = proxy.useDict('message_type_enum'); const { message_type_enum } = proxy.useDict('message_type_enum');
const queryFormRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({ const dataDetail = ref<DataRecord>({
id: 0, id: 0,
@@ -99,7 +101,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -130,7 +132,7 @@
read(ids).then((res) => { read(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -160,7 +162,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -199,7 +201,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="title" hide-label> <a-form-item field="title" hide-label>
<a-input <a-input
v-model="queryParams.title" v-model="queryParams.title"

View File

@@ -18,6 +18,9 @@
'dis_enable_status_enum', 'dis_enable_status_enum',
); );
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({}); const dataDetail = ref<DataRecord>({});
const total = ref(0); const total = ref(0);
@@ -170,7 +173,7 @@
dataScope: 4, dataScope: 4,
sort: 999, sort: 999,
}; };
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -178,7 +181,7 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
@@ -224,7 +227,7 @@
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
form.value.menuIds = getMenuAllCheckedKeys(); form.value.menuIds = getMenuAllCheckedKeys();
@@ -302,7 +305,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -385,7 +388,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -424,7 +427,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="name" hide-label> <a-form-item field="name" hide-label>
<a-input <a-input
v-model="queryParams.name" v-model="queryParams.name"

View File

@@ -7,6 +7,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { t } = useI18n(); const { t } = useI18n();
const formRef = ref();
const userStore = useUserStore(); const userStore = useUserStore();
const loading = ref(false); const loading = ref(false);
@@ -46,7 +47,7 @@
*/ */
const handleSave = () => { const handleSave = () => {
if (loading.value) return; if (loading.value) return;
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
loading.value = true; loading.value = true;
updateBasicInfo({ updateBasicInfo({
@@ -68,7 +69,7 @@
* 重置 * 重置
*/ */
const handleReset = () => { const handleReset = () => {
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
</script> </script>

View File

@@ -57,7 +57,7 @@
hideCancel: false, hideCancel: false,
onOk: () => { onOk: () => {
socialAuth(source).then((res) => { socialAuth(source).then((res) => {
window.location.href = res.data; window.location.href = res.data.authorizeUrl;
}); });
}, },
}); });

View File

@@ -9,6 +9,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { t } = useI18n(); const { t } = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
const formRef = ref();
const captchaTime = ref(60); const captchaTime = ref(60);
const captchaTimer = ref(); const captchaTimer = ref();
const captchaLoading = ref(false); const captchaLoading = ref(false);
@@ -72,7 +73,7 @@
*/ */
const handleSendCaptcha = () => { const handleSendCaptcha = () => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('newEmail', (valid: any) => { formRef.value.validateField('newEmail', (valid: any) => {
if (!valid) { if (!valid) {
captchaLoading.value = true; captchaLoading.value = true;
captchaBtnNameKey.value = 'userCenter.securitySettings.captcha.ing'; captchaBtnNameKey.value = 'userCenter.securitySettings.captcha.ing';
@@ -107,7 +108,7 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
resetCaptcha(); resetCaptcha();
}; };
@@ -115,7 +116,7 @@
* 修改 * 修改
*/ */
const handleUpdate = () => { const handleUpdate = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
updateEmail({ updateEmail({
newEmail: form.newEmail, newEmail: form.newEmail,

View File

@@ -9,6 +9,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { t } = useI18n(); const { t } = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
const formRef = ref();
const captchaTime = ref(60); const captchaTime = ref(60);
const captchaTimer = ref(); const captchaTimer = ref();
const captchaLoading = ref(false); const captchaLoading = ref(false);
@@ -74,7 +75,7 @@
*/ */
const handleOpenBehaviorCaptcha = () => { const handleOpenBehaviorCaptcha = () => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('newPhone', (valid: any) => { formRef.value.validateField('newPhone', (valid: any) => {
if (!valid) { if (!valid) {
proxy.$refs.verifyRef.show(); proxy.$refs.verifyRef.show();
} }
@@ -86,7 +87,7 @@
*/ */
const handleSendCaptcha = (captchaParam: BehaviorCaptchaReq) => { const handleSendCaptcha = (captchaParam: BehaviorCaptchaReq) => {
if (captchaLoading.value) return; if (captchaLoading.value) return;
proxy.$refs.formRef.validateField('newPhone', (valid: any) => { formRef.value.validateField('newPhone', (valid: any) => {
if (!valid) { if (!valid) {
captchaLoading.value = true; captchaLoading.value = true;
captchaBtnNameKey.value = 'userCenter.securitySettings.captcha.ing'; captchaBtnNameKey.value = 'userCenter.securitySettings.captcha.ing';
@@ -121,7 +122,7 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
resetCaptcha(); resetCaptcha();
}; };
@@ -129,7 +130,7 @@
* 修改 * 修改
*/ */
const handleUpdate = () => { const handleUpdate = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
updatePhone({ updatePhone({
newPhone: form.newPhone, newPhone: form.newPhone,

View File

@@ -9,6 +9,7 @@
const { t } = useI18n(); const { t } = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
const formRef = ref();
const visible = ref(false); const visible = ref(false);
// 表单数据 // 表单数据
@@ -84,14 +85,14 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef.resetFields(); formRef.value.resetFields();
}; };
/** /**
* 修改 * 修改
*/ */
const handleUpdate = () => { const handleUpdate = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
updatePassword({ updatePassword({
oldPassword: encryptByRsa(form.oldPassword) || '', oldPassword: encryptByRsa(form.oldPassword) || '',

View File

@@ -21,6 +21,9 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum'); const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({}); const dataDetail = ref<DataRecord>({});
const total = ref(0); const total = ref(0);
@@ -191,7 +194,7 @@
form.value = { form.value = {
gender: 1, gender: 1,
}; };
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
}; };
/** /**
@@ -201,7 +204,7 @@
visible.value = false; visible.value = false;
resetPasswordVisible.value = false; resetPasswordVisible.value = false;
userRoleVisible.value = false; userRoleVisible.value = false;
proxy.$refs.formRef?.resetFields(); formRef.value?.resetFields();
proxy.$refs.resetPasswordFormRef?.resetFields(); proxy.$refs.resetPasswordFormRef?.resetFields();
proxy.$refs.userRoleFormRef?.resetFields(); proxy.$refs.userRoleFormRef?.resetFields();
}; };
@@ -210,7 +213,7 @@
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
update(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
@@ -328,7 +331,7 @@
del(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
proxy.$refs.tableRef.selectAll(false); tableRef.value.selectAll(false);
}); });
}; };
@@ -424,7 +427,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -487,7 +490,7 @@
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="username" hide-label> <a-form-item field="username" hide-label>
<a-input <a-input
v-model="queryParams.username" v-model="queryParams.username"

View File

@@ -18,6 +18,7 @@
preview, preview,
generate, generate,
} from '@/api/tool/generator'; } from '@/api/tool/generator';
import {TableData} from "@arco-design/web-vue";
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { form_type_enum, query_type_enum } = proxy.useDict( const { form_type_enum, query_type_enum } = proxy.useDict(
@@ -25,12 +26,18 @@
'query_type_enum', 'query_type_enum',
); );
const queryFormRef = ref();
const formRef = ref();
const tableRef = ref();
const { copy, copied } = useClipboard(); const { copy, copied } = useClipboard();
const extensions = [java(), javascript()]; const extensions = [java(), javascript()];
const tableList = ref<TableRecord[]>([]); const tableList = ref<TableRecord[]>([]);
const fieldConfigList = ref<FieldConfigRecord[]>([]); const fieldConfigList = ref<FieldConfigRecord[]>([]);
const total = ref(0); const total = ref(0);
const ids = ref<Array<string>>([]);
const title = ref(''); const title = ref('');
const single = ref(true);
const multiple = ref(true);
const showQuery = ref(true); const showQuery = ref(true);
const loading = ref(false); const loading = ref(false);
const visible = ref(false); const visible = ref(false);
@@ -78,6 +85,45 @@
}; };
getList(); getList();
/**
* 点击行选择器
*/
const handleSelect = (rowKeys: any, rowKey: any, record: TableData) => {
if (rowKeys.find((key: any) => key === rowKey)) {
if (record.children) {
record.children.forEach((r) => {
tableRef.value.select(r.id);
rowKeys.push(r.id);
if (r.children) {
handleSelect(rowKeys, rowKey, r);
}
});
}
} else if (record.children) {
record.children.forEach((r) => {
rowKeys.splice(
rowKeys.findIndex((key: number | undefined) => key === r.id),
1,
);
tableRef.value.select(r.id, false);
if (r.children) {
handleSelect(rowKeys, rowKey, r);
}
});
}
};
/**
* 已选择的数据行发生改变
*
* @param rowKeys ID 列表
*/
const handleSelectionChange = (rowKeys: Array<any>) => {
ids.value = rowKeys;
single.value = rowKeys.length !== 1;
multiple.value = !rowKeys.length;
};
/** /**
* 打开配置对话框 * 打开配置对话框
* *
@@ -129,7 +175,7 @@
* 确定 * 确定
*/ */
const handleOk = () => { const handleOk = () => {
proxy.$refs.formRef.validate((valid: any) => { formRef.value.validate((valid: any) => {
if (!valid) { if (!valid) {
config.value.fieldConfigs = fieldConfigList.value; config.value.fieldConfigs = fieldConfigList.value;
config.value.genConfig = form.value; config.value.genConfig = form.value;
@@ -147,7 +193,7 @@
*/ */
const handleCancel = () => { const handleCancel = () => {
visible.value = false; visible.value = false;
proxy.$refs.formRef?.resetFields(); formRef.value.resetFields();
fieldConfigList.value = []; fieldConfigList.value = [];
}; };
@@ -197,14 +243,44 @@
} }
}); });
/**
* 批量生成代码
*/
const handleBatchGenerate = () => {
if (ids.value.length === 0) {
proxy.$message.info('请选择生成的表数据');
} else {
handleGenerate(ids.value);
}
}
/** /**
* 生成代码 * 生成代码
* *
* @param tableName 表名称 * @param tableNames 表名称
*/ */
const handleGenerate = (tableName: string) => { const handleGenerate = (tableNames: Array<string>) => {
generate(tableName).then((res) => { generate(tableNames).then((res) => {
proxy.$message.success(res.msg); const contentDisposition = res.headers['content-disposition'];
const pattern = new RegExp('filename=([^;]+\\.[^\\.;]+);*');
const result = pattern.exec(contentDisposition) || '';
// 对名字进行解码
const fileName = window.decodeURI(result[1]);
// 创建下载的链接
const blob = new Blob([res.data]);
const downloadElement = document.createElement('a');
const href = window.URL.createObjectURL(blob);
downloadElement.style.display = 'none';
downloadElement.href = href;
// 下载后文件名
downloadElement.download = fileName;
document.body.appendChild(downloadElement);
// 点击下载
downloadElement.click();
// 下载完成,移除元素
document.body.removeChild(downloadElement);
// 释放掉 blob 对象
window.URL.revokeObjectURL(href);
}); });
}; };
@@ -219,7 +295,7 @@
* 重置 * 重置
*/ */
const resetQuery = () => { const resetQuery = () => {
proxy.$refs.queryRef.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; };
@@ -254,17 +330,20 @@
<div class="app-container"> <div class="app-container">
<Breadcrumb :items="['menu.tool', 'menu.tool.generator.list']" /> <Breadcrumb :items="['menu.tool', 'menu.tool.generator.list']" />
<a-card class="general-card" :title="$t('menu.tool.generator.list')"> <a-card class="general-card" :title="$t('menu.tool.generator.list')">
<a-alert type="warning" style="margin-bottom: 15px">
默认已开启 Mock下载/导出类操作会出现错误例如下载的文件无法打开点击<a-link href="https://doc.charles7c.top/admin/other/faq.html#%E7%82%B9%E5%87%BB%E5%AF%BC%E5%87%BA%E6%8C%89%E9%92%AE%E6%8A%A5%E9%94%99">查看解决方法</a-link>
</a-alert>
<!-- 头部区域 --> <!-- 头部区域 -->
<div class="header"> <div class="header">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div v-if="showQuery" class="header-query"> <div v-if="showQuery" class="header-query">
<a-form ref="queryRef" :model="queryParams" layout="inline"> <a-form ref="queryFormRef" :model="queryParams" layout="inline">
<a-form-item field="tableName" hide-label> <a-form-item field="tableName" hide-label>
<a-input <a-input
v-model="queryParams.tableName" v-model="queryParams.tableName"
placeholder="输入表名称搜索" placeholder="输入表名称搜索"
allow-clear allow-clear
style="width: 150px" style="width: 230px"
@press-enter="handleQuery" @press-enter="handleQuery"
/> />
</a-form-item> </a-form-item>
@@ -276,18 +355,28 @@
<a-button @click="resetQuery"> <a-button @click="resetQuery">
<template #icon><icon-refresh /></template>重置 <template #icon><icon-refresh /></template>重置
</a-button> </a-button>
<a-button
type="outline"
@click="handleBatchGenerate"
>
<template #icon><icon-robot-add /></template>批量生成
</a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</div> </div>
<!-- 列表区域 --> <!-- 列表区域 -->
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="tableName" row-key="tableName"
:data="tableList" :data="tableList"
:loading="loading" :loading="loading"
:row-selection="{
type: 'checkbox',
showCheckedAll: true,
onlyCurrent: false,
}"
:pagination="{ :pagination="{
showTotal: true, showTotal: true,
showPageSize: true, showPageSize: true,
@@ -298,6 +387,8 @@
column-resizable column-resizable
stripe stripe
size="large" size="large"
@select="handleSelect"
@selection-change="handleSelectionChange"
@page-change="handlePageChange" @page-change="handlePageChange"
@page-size-change="handlePageSizeChange" @page-size-change="handlePageSizeChange"
> >
@@ -336,7 +427,7 @@
size="small" size="small"
:title="record.isConfiged ? '生成' : '请先进行生成配置'" :title="record.isConfiged ? '生成' : '请先进行生成配置'"
:disabled="!record.isConfiged" :disabled="!record.isConfiged"
@click="handleGenerate(record.tableName)" @click="handleGenerate([record.tableName])"
> >
<template #icon><icon-robot-add /></template>生成 <template #icon><icon-robot-add /></template>生成
</a-button> </a-button>
@@ -501,12 +592,6 @@
placeholder="项目模块包名例如top.charles7c.continew.admin.system" placeholder="项目模块包名例如top.charles7c.continew.admin.system"
/> />
</a-form-item> </a-form-item>
<a-form-item label="前端路径" field="frontendPath">
<a-input
v-model="form.frontendPath"
placeholder="前端项目 views 目录地址"
/>
</a-form-item>
<a-form-item label="去表前缀" field="tablePrefix"> <a-form-item label="去表前缀" field="tablePrefix">
<a-input <a-input
v-model="form.tablePrefix" v-model="form.tablePrefix"
@@ -526,8 +611,8 @@
<!-- 生成预览区域 --> <!-- 生成预览区域 -->
<a-modal <a-modal
:body-style="{ :body-style="{
paddingTop: 0, paddingTop: 0,
}" }"
title="生成预览" title="生成预览"
:visible="previewVisible" :visible="previewVisible"
width="70%" width="70%"