chore: antd 全局改为紧凑布局

This commit is contained in:
wangxuefeng 2025-02-06 11:54:13 +08:00
parent 2cc93d4262
commit 38f9e74cdf
9 changed files with 99 additions and 90 deletions

View File

@ -4,7 +4,6 @@ import vueJsx from "@vitejs/plugin-vue-jsx";
import qiankun from "vite-plugin-qiankun"; import qiankun from "vite-plugin-qiankun";
import path from "path"; import path from "path";
import less from "@farmfe/js-plugin-less"; import less from "@farmfe/js-plugin-less";
import yargsParser from "yargs-parser";
import Components from "unplugin-vue-components/vite"; import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers"; import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
@ -15,26 +14,7 @@ import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
// TEST: "test", // TEST: "test",
// }; // };
const argv = yargsParser(process.argv.slice(2)); // const env = process.env.NODE_ENV;
const env = process.env.NODE_ENV;
console.log("argv", argv);
console.log("env", env);
// let base: string;
// switch (argv.mode) {
// case "staging":
// case "test":
// base = "https://custom-chart.shiyue.com/";
// break;
// case "production":
// base = "https://custom-chart.shiyuegame.com/";
// break;
// default:
// base = "http://localhost:8080/";
// }
// if (env === ENVS.DEVELOPMENT) base = "http://localhost:8080/";
// console.log("base", base);
export default defineConfig({ export default defineConfig({
plugins: [less()], plugins: [less()],
@ -54,8 +34,7 @@ export default defineConfig({
], ],
server: { server: {
cors: true, cors: true,
open: false, open: true,
port: 8080,
}, },
compilation: { compilation: {
resolve: { resolve: {

View File

@ -21,7 +21,7 @@
"@farmfe/js-plugin-less": "^1.12.1", "@farmfe/js-plugin-less": "^1.12.1",
"@sy/y-code-chart": "^1.2.1", "@sy/y-code-chart": "^1.2.1",
"@vueuse/core": "^10.11.0", "@vueuse/core": "^10.11.0",
"ant-design-vue": "^4.1.2", "ant-design-vue": "^4.2.6",
"axios": "^1.6.7", "axios": "^1.6.7",
"core-js": "^3.40.0", "core-js": "^3.40.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",

16
pnpm-lock.yaml generated
View File

@ -24,7 +24,7 @@ importers:
specifier: ^10.11.0 specifier: ^10.11.0
version: 10.11.1(vue@3.5.13(typescript@5.3.3)) version: 10.11.1(vue@3.5.13(typescript@5.3.3))
ant-design-vue: ant-design-vue:
specifier: ^4.1.2 specifier: ^4.2.6
version: 4.2.6(vue@3.5.13(typescript@5.3.3)) version: 4.2.6(vue@3.5.13(typescript@5.3.3))
axios: axios:
specifier: ^1.6.7 specifier: ^1.6.7
@ -564,12 +564,14 @@ packages:
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@farmfe/core-linux-x64-musl@1.6.6': '@farmfe/core-linux-x64-musl@1.6.6':
resolution: {integrity: sha512-h8FoBNbe5LoYZrq27JriaS6JJJHK9sc92jKOTrNes5u1qixw5GAPgMq4smq97koEkOwPaQfueQUTfa8pHiIg1Q==} resolution: {integrity: sha512-h8FoBNbe5LoYZrq27JriaS6JJJHK9sc92jKOTrNes5u1qixw5GAPgMq4smq97koEkOwPaQfueQUTfa8pHiIg1Q==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@farmfe/core-win32-arm64-msvc@1.6.6': '@farmfe/core-win32-arm64-msvc@1.6.6':
resolution: {integrity: sha512-X4gIoSwbPmf0Lx0ZLC5dzcOm4DZR+4i+7u4sF3f7jb95GQuWR6vF1L6tk6IY5ftyaz8xFuFcDpd6WO2km+VMwQ==} resolution: {integrity: sha512-X4gIoSwbPmf0Lx0ZLC5dzcOm4DZR+4i+7u4sF3f7jb95GQuWR6vF1L6tk6IY5ftyaz8xFuFcDpd6WO2km+VMwQ==}
@ -792,46 +794,55 @@ packages:
resolution: {integrity: sha512-WXveUPKtfqtaNvpf0iOb0M6xC64GzUX/OowbqfiCSXTdi/jLlOmH0Ba94/OkiY2yTGTwteo4/dsHRfh5bDCZ+w==} resolution: {integrity: sha512-WXveUPKtfqtaNvpf0iOb0M6xC64GzUX/OowbqfiCSXTdi/jLlOmH0Ba94/OkiY2yTGTwteo4/dsHRfh5bDCZ+w==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.28.0': '@rollup/rollup-linux-arm-musleabihf@4.28.0':
resolution: {integrity: sha512-yLc3O2NtOQR67lI79zsSc7lk31xjwcaocvdD1twL64PK1yNaIqCeWI9L5B4MFPAVGEVjH5k1oWSGuYX1Wutxpg==} resolution: {integrity: sha512-yLc3O2NtOQR67lI79zsSc7lk31xjwcaocvdD1twL64PK1yNaIqCeWI9L5B4MFPAVGEVjH5k1oWSGuYX1Wutxpg==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.28.0': '@rollup/rollup-linux-arm64-gnu@4.28.0':
resolution: {integrity: sha512-+P9G9hjEpHucHRXqesY+3X9hD2wh0iNnJXX/QhS/J5vTdG6VhNYMxJ2rJkQOxRUd17u5mbMLHM7yWGZdAASfcg==} resolution: {integrity: sha512-+P9G9hjEpHucHRXqesY+3X9hD2wh0iNnJXX/QhS/J5vTdG6VhNYMxJ2rJkQOxRUd17u5mbMLHM7yWGZdAASfcg==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.28.0': '@rollup/rollup-linux-arm64-musl@4.28.0':
resolution: {integrity: sha512-1xsm2rCKSTpKzi5/ypT5wfc+4bOGa/9yI/eaOLW0oMs7qpC542APWhl4A37AENGZ6St6GBMWhCCMM6tXgTIplw==} resolution: {integrity: sha512-1xsm2rCKSTpKzi5/ypT5wfc+4bOGa/9yI/eaOLW0oMs7qpC542APWhl4A37AENGZ6St6GBMWhCCMM6tXgTIplw==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-powerpc64le-gnu@4.28.0': '@rollup/rollup-linux-powerpc64le-gnu@4.28.0':
resolution: {integrity: sha512-zgWxMq8neVQeXL+ouSf6S7DoNeo6EPgi1eeqHXVKQxqPy1B2NvTbaOUWPn/7CfMKL7xvhV0/+fq/Z/J69g1WAQ==} resolution: {integrity: sha512-zgWxMq8neVQeXL+ouSf6S7DoNeo6EPgi1eeqHXVKQxqPy1B2NvTbaOUWPn/7CfMKL7xvhV0/+fq/Z/J69g1WAQ==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.28.0': '@rollup/rollup-linux-riscv64-gnu@4.28.0':
resolution: {integrity: sha512-VEdVYacLniRxbRJLNtzwGt5vwS0ycYshofI7cWAfj7Vg5asqj+pt+Q6x4n+AONSZW/kVm+5nklde0qs2EUwU2g==} resolution: {integrity: sha512-VEdVYacLniRxbRJLNtzwGt5vwS0ycYshofI7cWAfj7Vg5asqj+pt+Q6x4n+AONSZW/kVm+5nklde0qs2EUwU2g==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-s390x-gnu@4.28.0': '@rollup/rollup-linux-s390x-gnu@4.28.0':
resolution: {integrity: sha512-LQlP5t2hcDJh8HV8RELD9/xlYtEzJkm/aWGsauvdO2ulfl3QYRjqrKW+mGAIWP5kdNCBheqqqYIGElSRCaXfpw==} resolution: {integrity: sha512-LQlP5t2hcDJh8HV8RELD9/xlYtEzJkm/aWGsauvdO2ulfl3QYRjqrKW+mGAIWP5kdNCBheqqqYIGElSRCaXfpw==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.28.0': '@rollup/rollup-linux-x64-gnu@4.28.0':
resolution: {integrity: sha512-Nl4KIzteVEKE9BdAvYoTkW19pa7LR/RBrT6F1dJCV/3pbjwDcaOq+edkP0LXuJ9kflW/xOK414X78r+K84+msw==} resolution: {integrity: sha512-Nl4KIzteVEKE9BdAvYoTkW19pa7LR/RBrT6F1dJCV/3pbjwDcaOq+edkP0LXuJ9kflW/xOK414X78r+K84+msw==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.28.0': '@rollup/rollup-linux-x64-musl@4.28.0':
resolution: {integrity: sha512-eKpJr4vBDOi4goT75MvW+0dXcNUqisK4jvibY9vDdlgLx+yekxSm55StsHbxUsRxSTt3JEQvlr3cGDkzcSP8bw==} resolution: {integrity: sha512-eKpJr4vBDOi4goT75MvW+0dXcNUqisK4jvibY9vDdlgLx+yekxSm55StsHbxUsRxSTt3JEQvlr3cGDkzcSP8bw==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.28.0': '@rollup/rollup-win32-arm64-msvc@4.28.0':
resolution: {integrity: sha512-Vi+WR62xWGsE/Oj+mD0FNAPY2MEox3cfyG0zLpotZdehPFXwz6lypkGs5y38Jd/NVSbOD02aVad6q6QYF7i8Bg==} resolution: {integrity: sha512-Vi+WR62xWGsE/Oj+mD0FNAPY2MEox3cfyG0zLpotZdehPFXwz6lypkGs5y38Jd/NVSbOD02aVad6q6QYF7i8Bg==}
@ -1691,18 +1702,21 @@ packages:
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
farm-plugin-replace-dirname-linux-arm64-musl@0.2.1: farm-plugin-replace-dirname-linux-arm64-musl@0.2.1:
resolution: {integrity: sha512-m3gH8ggczbRYTHZSNp3LjIQIcqhvDO4O78bxXc8O1ozKD8M47/YfQLyQV06M7H4rZ8s6XV3Bb1kAcRAASp3M5A==} resolution: {integrity: sha512-m3gH8ggczbRYTHZSNp3LjIQIcqhvDO4O78bxXc8O1ozKD8M47/YfQLyQV06M7H4rZ8s6XV3Bb1kAcRAASp3M5A==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
farm-plugin-replace-dirname-linux-x64-gnu@0.2.1: farm-plugin-replace-dirname-linux-x64-gnu@0.2.1:
resolution: {integrity: sha512-MehKkoM2RFw3sCnEu9nCbXKjxtC3hfTad0h/dC+Z8iEBcLEReVLoNzHWWUa6BxkxqDtB82/BWO/ObSUj/VUnwQ==} resolution: {integrity: sha512-MehKkoM2RFw3sCnEu9nCbXKjxtC3hfTad0h/dC+Z8iEBcLEReVLoNzHWWUa6BxkxqDtB82/BWO/ObSUj/VUnwQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
farm-plugin-replace-dirname-linux-x64-musl@0.2.1: farm-plugin-replace-dirname-linux-x64-musl@0.2.1:
resolution: {integrity: sha512-o1qPZi16N/sHOteZYJVv6UmZFK3QKpVQrywk/4spJI0mPH9A9Y+G6iBE2Tqjb3d+1Hb6phr++EBJHZ2x1ajtGQ==} resolution: {integrity: sha512-o1qPZi16N/sHOteZYJVv6UmZFK3QKpVQrywk/4spJI0mPH9A9Y+G6iBE2Tqjb3d+1Hb6phr++EBJHZ2x1ajtGQ==}

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import zhCN from 'ant-design-vue/es/locale/zh_CN'; import zhCN from 'ant-design-vue/es/locale/zh_CN';
import { legacyLogicalPropertiesTransformer, StyleProvider, ConfigProvider } from 'ant-design-vue'; import { legacyLogicalPropertiesTransformer, StyleProvider, ConfigProvider,theme } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn'; import 'dayjs/locale/zh-cn';
@ -9,11 +9,17 @@ dayjs.locale('zh-cn');
ConfigProvider.config({ ConfigProvider.config({
prefixCls: 'ycode-ant', prefixCls: 'ycode-ant',
}) })
</script> </script>
<template> <template>
<a-config-provider :locale="zhCN" :transformers="[legacyLogicalPropertiesTransformer]" prefix-cls="ycode-ant"> <a-config-provider
:theme="{
algorithm: theme.compactAlgorithm,
}"
:locale="zhCN"
:transformers="[legacyLogicalPropertiesTransformer]"
prefix-cls="ycode-ant"
>
<StyleProvider hash-priority="high"> <StyleProvider hash-priority="high">
<router-view /> <router-view />
</StyleProvider> </StyleProvider>

View File

@ -103,7 +103,7 @@ const routeList: RouteType[] = [
path: "page-info", path: "page-info",
name: "page-info", name: "page-info",
component: () => component: () =>
import("@/views/page-show-info/page-info/index,.vue"), import("@/views/page-show-info/page-info/index.vue"),
meta: { title: "项目报表" }, meta: { title: "项目报表" },
isMenu: true, isMenu: true,
children: [], children: [],

View File

@ -1,36 +1,41 @@
export const moduleCfgCols = [ export const moduleCfgCols = [
{ dataIndex: 'modular_id', title: '编号', align: 'center'}, { dataIndex: "modular_id", title: "编号", align: "center" },
{ dataIndex: 'modular_name', title: '数据来源名称', align: 'center'}, { dataIndex: "modular_name", title: "数据来源名称", align: "center" },
{ dataIndex: 'project_name', title: '项目名称', align: 'center'}, { dataIndex: "project_name", title: "项目名称", align: "center" },
{ dataIndex: 'is_show', title: '展示状态', align: 'center'}, { dataIndex: "is_show", title: "展示状态", align: "center" },
{ dataIndex: 'original_type_handle', title: '数据源类型', align: 'center'}, { dataIndex: "original_type_handle", title: "数据源类型", align: "center" },
// { dataIndex: 'sort', title: '排序', align: 'center'}, // { dataIndex: 'sort', title: '排序', align: 'center'},
{ dataIndex: 'action', title: '操作', align: 'center'}, { dataIndex: "action", title: "操作", align: "center" },
]; ];
export const viewCfgCols = [ export const viewCfgCols = [
{ dataIndex: 'field_name', title: '字段名称', align: 'center'}, { dataIndex: "field_name", title: "字段名称", align: "center" },
{ dataIndex: 'field_title', title: '字段标题', align: 'center'}, { dataIndex: "field_title", title: "字段标题", align: "center" },
{ dataIndex: 'field_numerical_name', title: '字段类型', align: 'center', width: 120}, {
{ dataIndex: 'show_type', title: '展示类型', align: 'center', width: 120}, dataIndex: "field_numerical_name",
{ dataIndex: 'field_type_name', title: '搜索类型', align: 'center'}, title: "字段类型",
{ dataIndex: 'is_search', title: '是否可搜索', align: 'center'}, align: "center",
{ dataIndex: 'sort', title: '排序', align: 'center'}, width: 120,
{ dataIndex: 'belong_to_table', title: '所属表名称', align: 'center'}, },
{ dataIndex: 'is_other_database', title: '数据库特配', align: 'center'}, { dataIndex: "show_type", title: "展示类型", align: "center", width: 120 },
{ dataIndex: 'original_type', title: '数据源类型', align: 'center'}, { dataIndex: "field_type_name", title: "搜索类型", align: "center" },
{ dataIndex: 'original_sql', title: '数据源', align: 'center', width: 400}, { dataIndex: "is_search", title: "是否可搜索", align: "center" },
{ dataIndex: 'action', title: '操作', align: 'center', width: 120}, { dataIndex: "sort", title: "排序", align: "center" },
{ dataIndex: "belong_to_table", title: "所属表名称", align: "center" },
{ dataIndex: "is_other_database", title: "数据库特配", align: "center" },
{ dataIndex: "original_type", title: "数据源类型", align: "center" },
{ dataIndex: "original_sql", title: "数据源", align: "center", width: 400 },
{ dataIndex: "action", title: "操作", align: "center", width: 120 },
]; ];
export const originalTypes = [ export const originalTypes = [
{ label: 'sql', value: 1 }, { label: "sql", value: 1 },
{ label: 'json', value: 2 }, { label: "json", value: 2 },
] ];
export const showTypeOpts = [ export const showTypeOpts = [
{ label: '文本', value: 'text' }, { label: "文本", value: "text" },
{ label: '图片', value: 'img' }, { label: "图片", value: "img" },
{ label: '链接', value: 'link' }, { label: "链接", value: "link" },
{ label: '富文本', value: 'richText' }, { label: "富文本", value: "richText" },
] ];

View File

@ -10,7 +10,7 @@
@change="search" @change="search"
/> />
<a-select <a-select
placeholder="请选项目" placeholder="请选项目"
v-model:value="projectId" v-model:value="projectId"
:options="projectSel" :options="projectSel"
allow-clear allow-clear

View File

@ -276,7 +276,7 @@ const getPageInfoData = () => {
}; };
}); });
} }
getAllCardsData(); getAllCardsData();
} }
}) })
@ -302,7 +302,6 @@ const getAllCardsData = async () => {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './style.less';
.view-box { .view-box {
height: 100%; height: 100%;
@ -340,5 +339,4 @@ const getAllCardsData = async () => {
.vue-grid-item { .vue-grid-item {
height: auto; height: auto;
} }
</style> </style>

View File

@ -1,30 +1,30 @@
import { fileURLToPath, URL } from 'node:url'; import { fileURLToPath, URL } from "node:url";
import { defineConfig } from 'vite'; import { defineConfig } from "vite";
import vue from '@vitejs/plugin-vue'; import vue from "@vitejs/plugin-vue";
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from "@vitejs/plugin-vue-jsx";
import Components from 'unplugin-vue-components/vite'; import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import qiankun from 'vite-plugin-qiankun' import qiankun from "vite-plugin-qiankun";
import yargsParser from 'yargs-parser' import yargsParser from "yargs-parser";
const argv = yargsParser(process.argv.slice(2)) const argv = yargsParser(process.argv.slice(2));
console.log(process.env.DEV_ENV) console.log(process.env.DEV_ENV);
let base: string let base: string;
switch (argv.mode) { switch (argv.mode) {
case 'staging': case "staging":
case 'test': case "test":
base = 'https://custom-chart.shiyue.com/' base = "https://custom-chart.shiyue.com/";
break break;
case 'production': case "production":
base = 'https://custom-chart.shiyuegame.com/' base = "https://custom-chart.shiyuegame.com/";
break break;
default: default:
base = 'http://localhost:8080/' base = "http://localhost:8080/";
} }
if (process.env.DEV_ENV === 'development') { if (process.env.DEV_ENV === "development") {
base = 'http://localhost:8080/' base = "http://localhost:8080/";
} }
// https://vitejs.dev/config/ // https://vitejs.dev/config/
@ -33,9 +33,9 @@ export default defineConfig({
sourcemap: false, sourcemap: false,
rollupOptions: { rollupOptions: {
output: { output: {
assetFileNames: '[name]-ycode-[hash:8].[ext]', assetFileNames: "[name]-ycode-[hash:8].[ext]",
chunkFileNames: '[name]-ycode-[hash:8].js', chunkFileNames: "[name]-ycode-[hash:8].js",
entryFileNames: '[name]-ycode-[hash:8].js', entryFileNames: "[name]-ycode-[hash:8].js",
}, },
}, },
}, },
@ -44,7 +44,7 @@ export default defineConfig({
preprocessorOptions: { preprocessorOptions: {
less: { less: {
modifyVars: { modifyVars: {
'ant-prefix': 'ycode-ant', "ant-prefix": "ycode-ant",
}, },
}, },
}, },
@ -53,24 +53,31 @@ export default defineConfig({
vue(), vue(),
vueJsx(), vueJsx(),
Components({ Components({
resolvers: [AntDesignVueResolver({ resolvers: [
importStyle: 'less', AntDesignVueResolver({
})], importStyle: "less",
}),
],
}),
qiankun("y-code-app", {
useDevMode: process.env.DEV_ENV === "development",
}), }),
qiankun('y-code-app', { useDevMode: process.env.DEV_ENV === 'development' }),
], ],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), "@": fileURLToPath(new URL("./src", import.meta.url)),
}, },
}, },
base, base,
define: { define: {
_BASE_HOST_: `'${base}'`, _BASE_HOST_: `'${base}'`,
}, },
optimizeDeps: {
force: true, // 强制重新预构建依赖
},
server: { server: {
hmr: true, hmr: true,
host: '0.0.0.0', host: "0.0.0.0",
port: 8080, port: 8080,
}, },
}); });