feat: 🚀 添加新的表格封装
This commit is contained in:
parent
b2fed0a09b
commit
71ba1bb264
|
@ -1,9 +1,39 @@
|
|||
// @ts-check
|
||||
// @see: https://www.prettier.cn
|
||||
|
||||
/** @type {import("prettier").Config} */
|
||||
export default {
|
||||
bracketSpacing: true,
|
||||
singleQuote: false,
|
||||
arrowParens: "avoid",
|
||||
trailingComma: "none"
|
||||
// 超过最大值换行
|
||||
printWidth: 200,
|
||||
// 缩进字节数
|
||||
tabWidth: 1,
|
||||
// 使用制表符而不是空格缩进行
|
||||
useTabs: true,
|
||||
// 结尾不用分号(true有,false没有)
|
||||
semi: true,
|
||||
// 使用单引号(true单引号,false双引号)
|
||||
singleQuote: true,
|
||||
// 更改引用对象属性的时间 可选值"<as-needed|consistent|preserve>"
|
||||
quoteProps: 'as-needed',
|
||||
// 在对象,数组括号与文字之间加空格 "{ foo: bar }"
|
||||
bracketSpacing: true,
|
||||
// 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"<none|es5|all>",默认none
|
||||
trailingComma: 'all',
|
||||
// 在JSX中使用单引号而不是双引号
|
||||
jsxSingleQuote: true,
|
||||
// (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号 ,always:不省略括号
|
||||
arrowParens: 'avoid',
|
||||
// 如果文件顶部已经有一个 doclock,这个选项将新建一行注释,并打上@format标记。
|
||||
insertPragma: false,
|
||||
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
||||
requirePragma: false,
|
||||
// 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
|
||||
proseWrap: 'preserve',
|
||||
// 在html中空格是否是敏感的 "css" - 遵守CSS显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
// 换行符使用 lf 结尾是 可选值"<auto|lf|crlf|cr>"
|
||||
endOfLine: 'auto',
|
||||
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码
|
||||
rangeStart: 0,
|
||||
rangeEnd: Infinity,
|
||||
|
||||
vueIndentScriptAndStyle: false, // Vue文件脚本和样式标签缩进
|
||||
};
|
||||
|
|
20
Dockerfile
20
Dockerfile
|
@ -1,20 +0,0 @@
|
|||
FROM node:20-alpine as build-stage
|
||||
|
||||
WORKDIR /app
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@latest --activate
|
||||
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
COPY .npmrc package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
RUN pnpm build
|
||||
|
||||
FROM nginx:stable-alpine as production-stage
|
||||
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
99
build/cdn.ts
99
build/cdn.ts
|
@ -1,4 +1,4 @@
|
|||
import { Plugin as importToCDN } from "vite-plugin-cdn-import";
|
||||
import { Plugin as importToCDN } from 'vite-plugin-cdn-import';
|
||||
|
||||
/**
|
||||
* @description 打包时采用`cdn`模式,仅限外网使用(默认不采用,如果需要采用cdn模式,请在 .env.production 文件,将 VITE_CDN 设置成true)
|
||||
|
@ -6,55 +6,50 @@ import { Plugin as importToCDN } from "vite-plugin-cdn-import";
|
|||
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
||||
*/
|
||||
export const cdn = importToCDN({
|
||||
//(prodUrl解释: name: 对应下面modules的name,version: 自动读取本地package.json中dependencies依赖中对应包的版本号,path: 对应下面modules的path,当然也可写完整路径,会替换prodUrl)
|
||||
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
|
||||
modules: [
|
||||
{
|
||||
name: "vue",
|
||||
var: "Vue",
|
||||
path: "vue.global.prod.min.js"
|
||||
},
|
||||
{
|
||||
name: "vue-router",
|
||||
var: "VueRouter",
|
||||
path: "vue-router.global.min.js"
|
||||
},
|
||||
{
|
||||
name: "vue-i18n",
|
||||
var: "VueI18n",
|
||||
path: "vue-i18n.runtime.global.prod.min.js"
|
||||
},
|
||||
// 项目中没有直接安装vue-demi,但是pinia用到了,所以需要在引入pinia前引入vue-demi(https://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77)
|
||||
{
|
||||
name: "vue-demi",
|
||||
var: "VueDemi",
|
||||
path: "index.iife.min.js"
|
||||
},
|
||||
{
|
||||
name: "pinia",
|
||||
var: "Pinia",
|
||||
path: "pinia.iife.min.js"
|
||||
},
|
||||
{
|
||||
name: "element-plus",
|
||||
var: "ElementPlus",
|
||||
path: "index.full.min.js",
|
||||
css: "index.min.css"
|
||||
},
|
||||
{
|
||||
name: "axios",
|
||||
var: "axios",
|
||||
path: "axios.min.js"
|
||||
},
|
||||
{
|
||||
name: "dayjs",
|
||||
var: "dayjs",
|
||||
path: "dayjs.min.js"
|
||||
},
|
||||
{
|
||||
name: "echarts",
|
||||
var: "echarts",
|
||||
path: "echarts.min.js"
|
||||
}
|
||||
]
|
||||
//(prodUrl解释: name: 对应下面modules的name,version: 自动读取本地package.json中dependencies依赖中对应包的版本号,path: 对应下面modules的path,当然也可写完整路径,会替换prodUrl)
|
||||
prodUrl: 'https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}',
|
||||
modules: [
|
||||
{
|
||||
name: 'vue',
|
||||
var: 'Vue',
|
||||
path: 'vue.global.prod.min.js',
|
||||
},
|
||||
{
|
||||
name: 'vue-router',
|
||||
var: 'VueRouter',
|
||||
path: 'vue-router.global.min.js',
|
||||
},
|
||||
// 项目中没有直接安装vue-demi,但是pinia用到了,所以需要在引入pinia前引入vue-demi(https://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77)
|
||||
{
|
||||
name: 'vue-demi',
|
||||
var: 'VueDemi',
|
||||
path: 'index.iife.min.js',
|
||||
},
|
||||
{
|
||||
name: 'pinia',
|
||||
var: 'Pinia',
|
||||
path: 'pinia.iife.min.js',
|
||||
},
|
||||
{
|
||||
name: 'element-plus',
|
||||
var: 'ElementPlus',
|
||||
path: 'index.full.min.js',
|
||||
css: 'index.min.css',
|
||||
},
|
||||
{
|
||||
name: 'axios',
|
||||
var: 'axios',
|
||||
path: 'axios.min.js',
|
||||
},
|
||||
{
|
||||
name: 'dayjs',
|
||||
var: 'dayjs',
|
||||
path: 'dayjs.min.js',
|
||||
},
|
||||
{
|
||||
name: 'echarts',
|
||||
var: 'echarts',
|
||||
path: 'echarts.min.js',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -4,31 +4,12 @@
|
|||
* 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
|
||||
* 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
|
||||
*/
|
||||
const include = [
|
||||
"qs",
|
||||
"mitt",
|
||||
"dayjs",
|
||||
"axios",
|
||||
"pinia",
|
||||
"vue-i18n",
|
||||
"vue-types",
|
||||
"js-cookie",
|
||||
"vue-tippy",
|
||||
"pinyin-pro",
|
||||
"sortablejs",
|
||||
"@vueuse/core",
|
||||
"@pureadmin/utils",
|
||||
"responsive-storage"
|
||||
];
|
||||
const include = ['qs', 'mitt', 'dayjs', 'axios', 'pinia', 'vue-types', 'js-cookie', 'vue-tippy', 'pinyin-pro', 'sortablejs', '@vueuse/core', '@pureadmin/utils', 'responsive-storage'];
|
||||
|
||||
/**
|
||||
* 在预构建中强制排除的依赖项
|
||||
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
||||
*/
|
||||
const exclude = [
|
||||
"@iconify-icons/ep",
|
||||
"@iconify-icons/ri",
|
||||
"@pureadmin/theme/dist/browser-utils"
|
||||
];
|
||||
const exclude = ['@iconify-icons/ep', '@iconify-icons/ri', '@pureadmin/theme/dist/browser-utils'];
|
||||
|
||||
export { include, exclude };
|
||||
|
|
116
build/plugins.ts
116
build/plugins.ts
|
@ -1,66 +1,54 @@
|
|||
import { cdn } from "./cdn";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import { pathResolve } from "./utils";
|
||||
import { viteBuildInfo } from "./info";
|
||||
import svgLoader from "vite-svg-loader";
|
||||
import type { PluginOption } from "vite";
|
||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import Inspector from "vite-plugin-vue-inspector";
|
||||
import { configCompressPlugin } from "./compress";
|
||||
import removeNoMatch from "vite-plugin-router-warn";
|
||||
import { visualizer } from "rollup-plugin-visualizer";
|
||||
import removeConsole from "vite-plugin-remove-console";
|
||||
import { themePreprocessorPlugin } from "@pureadmin/theme";
|
||||
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
|
||||
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
||||
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
||||
import { cdn } from './cdn';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { viteBuildInfo } from './info';
|
||||
import svgLoader from 'vite-svg-loader';
|
||||
import type { PluginOption } from 'vite';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import Inspector from 'vite-plugin-vue-inspector';
|
||||
import { configCompressPlugin } from './compress';
|
||||
import removeNoMatch from 'vite-plugin-router-warn';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import removeConsole from 'vite-plugin-remove-console';
|
||||
import { themePreprocessorPlugin } from '@pureadmin/theme';
|
||||
import { genScssMultipleScopeVars } from '../src/layout/theme';
|
||||
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
|
||||
|
||||
export function getPluginsList(
|
||||
VITE_CDN: boolean,
|
||||
VITE_COMPRESSION: ViteCompression,
|
||||
VITE_PORT: number
|
||||
): PluginOption[] {
|
||||
const lifecycle = process.env.npm_lifecycle_event;
|
||||
return [
|
||||
vue(),
|
||||
// jsx、tsx语法支持
|
||||
vueJsx(),
|
||||
VueI18nPlugin({
|
||||
jitCompilation: false,
|
||||
include: [pathResolve("../locales/**")]
|
||||
}),
|
||||
// 按下Command(⌘)+Shift(⇧),然后点击页面元素会自动打开本地IDE并跳转到对应的代码位置
|
||||
Inspector(),
|
||||
viteBuildInfo(VITE_PORT),
|
||||
/**
|
||||
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||
* 非必要具体看 https://github.com/vuejs/router/issues/521 和 https://github.com/vuejs/router/issues/359
|
||||
* vite-plugin-router-warn只在开发环境下启用,只处理vue-router文件并且只在服务启动或重启时运行一次,性能消耗可忽略不计
|
||||
*/
|
||||
removeNoMatch(),
|
||||
// mock支持
|
||||
vitePluginFakeServer({
|
||||
logger: false,
|
||||
include: "mock",
|
||||
infixName: false,
|
||||
enableProd: true
|
||||
}),
|
||||
// 自定义主题
|
||||
themePreprocessorPlugin({
|
||||
scss: {
|
||||
multipleScopeVars: genScssMultipleScopeVars(),
|
||||
extract: true
|
||||
}
|
||||
}),
|
||||
// svg组件化支持
|
||||
svgLoader(),
|
||||
VITE_CDN ? cdn : null,
|
||||
configCompressPlugin(VITE_COMPRESSION),
|
||||
// 线上环境删除console
|
||||
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
|
||||
// 打包分析
|
||||
lifecycle === "report"
|
||||
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
||||
: (null as any)
|
||||
];
|
||||
export function getPluginsList(VITE_CDN: boolean, VITE_COMPRESSION: ViteCompression, VITE_PORT: number): PluginOption[] {
|
||||
const lifecycle = process.env.npm_lifecycle_event;
|
||||
return [
|
||||
vue(),
|
||||
// jsx、tsx语法支持
|
||||
vueJsx(),
|
||||
// 按下Command(⌘)+Shift(⇧),然后点击页面元素会自动打开本地IDE并跳转到对应的代码位置
|
||||
Inspector(),
|
||||
viteBuildInfo(VITE_PORT),
|
||||
/**
|
||||
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||
* 非必要具体看 https://github.com/vuejs/router/issues/521 和 https://github.com/vuejs/router/issues/359
|
||||
* vite-plugin-router-warn只在开发环境下启用,只处理vue-router文件并且只在服务启动或重启时运行一次,性能消耗可忽略不计
|
||||
*/
|
||||
removeNoMatch(),
|
||||
// mock支持
|
||||
vitePluginFakeServer({
|
||||
logger: false,
|
||||
include: 'mock',
|
||||
infixName: false,
|
||||
enableProd: true,
|
||||
}),
|
||||
// 自定义主题
|
||||
themePreprocessorPlugin({
|
||||
scss: {
|
||||
multipleScopeVars: genScssMultipleScopeVars(),
|
||||
extract: true,
|
||||
},
|
||||
}),
|
||||
// svg组件化支持
|
||||
svgLoader(),
|
||||
VITE_CDN ? cdn : null,
|
||||
configCompressPlugin(VITE_COMPRESSION),
|
||||
// 线上环境删除console
|
||||
removeConsole({ external: ['src/assets/iconfont/iconfont.js'] }),
|
||||
// 打包分析
|
||||
lifecycle === 'report' ? visualizer({ open: true, brotliSize: true, filename: 'report.html' }) : (null as any),
|
||||
];
|
||||
}
|
||||
|
|
351
eslint.config.js
351
eslint.config.js
|
@ -1,181 +1,176 @@
|
|||
import js from "@eslint/js";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import * as parserVue from "vue-eslint-parser";
|
||||
import configPrettier from "eslint-config-prettier";
|
||||
import pluginPrettier from "eslint-plugin-prettier";
|
||||
import { defineFlatConfig } from "eslint-define-config";
|
||||
import * as parserTypeScript from "@typescript-eslint/parser";
|
||||
import pluginTypeScript from "@typescript-eslint/eslint-plugin";
|
||||
import js from '@eslint/js';
|
||||
import pluginTypeScript from '@typescript-eslint/eslint-plugin';
|
||||
import * as parserTypeScript from '@typescript-eslint/parser';
|
||||
import configPrettier from 'eslint-config-prettier';
|
||||
import { defineFlatConfig } from 'eslint-define-config';
|
||||
import pluginPrettier from 'eslint-plugin-prettier';
|
||||
import pluginVue from 'eslint-plugin-vue';
|
||||
import * as parserVue from 'vue-eslint-parser';
|
||||
|
||||
export default defineFlatConfig([
|
||||
{
|
||||
...js.configs.recommended,
|
||||
ignores: [
|
||||
"**/.*",
|
||||
"dist/*",
|
||||
"*.d.ts",
|
||||
"public/*",
|
||||
"src/assets/**",
|
||||
"src/**/iconfont/**"
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// index.d.ts
|
||||
RefType: "readonly",
|
||||
EmitType: "readonly",
|
||||
TargetContext: "readonly",
|
||||
ComponentRef: "readonly",
|
||||
ElRef: "readonly",
|
||||
ForDataType: "readonly",
|
||||
AnyFunction: "readonly",
|
||||
PropType: "readonly",
|
||||
Writable: "readonly",
|
||||
Nullable: "readonly",
|
||||
NonNullable: "readonly",
|
||||
Recordable: "readonly",
|
||||
ReadonlyRecordable: "readonly",
|
||||
Indexable: "readonly",
|
||||
DeepPartial: "readonly",
|
||||
Without: "readonly",
|
||||
Exclusive: "readonly",
|
||||
TimeoutHandle: "readonly",
|
||||
IntervalHandle: "readonly",
|
||||
Effect: "readonly",
|
||||
ChangeEvent: "readonly",
|
||||
WheelEvent: "readonly",
|
||||
ImportMetaEnv: "readonly",
|
||||
Fn: "readonly",
|
||||
PromiseFn: "readonly",
|
||||
ComponentElRef: "readonly",
|
||||
parseInt: "readonly",
|
||||
parseFloat: "readonly"
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
prettier: pluginPrettier
|
||||
},
|
||||
rules: {
|
||||
...configPrettier.rules,
|
||||
...pluginPrettier.configs.recommended.rules,
|
||||
"no-debugger": "off",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_"
|
||||
}
|
||||
],
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
endOfLine: "auto"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
||||
languageOptions: {
|
||||
parser: parserTypeScript,
|
||||
parserOptions: {
|
||||
sourceType: "module"
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
"@typescript-eslint": pluginTypeScript
|
||||
},
|
||||
rules: {
|
||||
...pluginTypeScript.configs.strict.rules,
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-redeclare": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/prefer-as-const": "warn",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"error",
|
||||
{ disallowTypeAnnotations: false, fixStyle: "inline-type-imports" }
|
||||
],
|
||||
"@typescript-eslint/prefer-literal-enum-member": [
|
||||
"error",
|
||||
{ allowBitwiseExpressions: true }
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/*.d.ts"],
|
||||
rules: {
|
||||
"eslint-comments/no-unlimited-disable": "off",
|
||||
"import/no-duplicates": "off",
|
||||
"unused-imports/no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/*.?([cm])js"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/no-var-requires": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/*.vue"],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
$: "readonly",
|
||||
$$: "readonly",
|
||||
$computed: "readonly",
|
||||
$customRef: "readonly",
|
||||
$ref: "readonly",
|
||||
$shallowRef: "readonly",
|
||||
$toRef: "readonly"
|
||||
},
|
||||
parser: parserVue,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
},
|
||||
extraFileExtensions: [".vue"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
sourceType: "module"
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
vue: pluginVue
|
||||
},
|
||||
processor: pluginVue.processors[".vue"],
|
||||
rules: {
|
||||
...pluginVue.configs.base.rules,
|
||||
...pluginVue.configs["vue3-essential"].rules,
|
||||
...pluginVue.configs["vue3-recommended"].rules,
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"vue/no-v-html": "off",
|
||||
"vue/require-default-prop": "off",
|
||||
"vue/require-explicit-emits": "off",
|
||||
"vue/multi-word-component-names": "off",
|
||||
"vue/no-setup-props-reactivity-loss": "off",
|
||||
"vue/html-self-closing": [
|
||||
"error",
|
||||
{
|
||||
html: {
|
||||
void: "always",
|
||||
normal: "always",
|
||||
component: "always"
|
||||
},
|
||||
svg: "always",
|
||||
math: "always"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
{
|
||||
...js.configs.recommended,
|
||||
ignores: ['**/.*', 'dist/*', '*.d.ts', 'public/*', 'src/assets/**', 'src/**/iconfont/**'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// index.d.ts
|
||||
RefType: 'readonly',
|
||||
EmitType: 'readonly',
|
||||
TargetContext: 'readonly',
|
||||
ComponentRef: 'readonly',
|
||||
ElRef: 'readonly',
|
||||
ForDataType: 'readonly',
|
||||
AnyFunction: 'readonly',
|
||||
PropType: 'readonly',
|
||||
Writable: 'readonly',
|
||||
Nullable: 'readonly',
|
||||
NonNullable: 'readonly',
|
||||
Recordable: 'readonly',
|
||||
ReadonlyRecordable: 'readonly',
|
||||
Indexable: 'readonly',
|
||||
DeepPartial: 'readonly',
|
||||
Without: 'readonly',
|
||||
Exclusive: 'readonly',
|
||||
TimeoutHandle: 'readonly',
|
||||
IntervalHandle: 'readonly',
|
||||
Effect: 'readonly',
|
||||
ChangeEvent: 'readonly',
|
||||
WheelEvent: 'readonly',
|
||||
ImportMetaEnv: 'readonly',
|
||||
Fn: 'readonly',
|
||||
PromiseFn: 'readonly',
|
||||
ComponentElRef: 'readonly',
|
||||
parseInt: 'readonly',
|
||||
parseFloat: 'readonly',
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
prettier: pluginPrettier,
|
||||
},
|
||||
rules: {
|
||||
...configPrettier.rules,
|
||||
...pluginPrettier.configs.recommended.rules,
|
||||
'no-debugger': 'off',
|
||||
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'prettier/prettier': [
|
||||
'error',
|
||||
{
|
||||
endOfLine: 'auto',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.?([cm])ts', '**/*.?([cm])tsx'],
|
||||
languageOptions: {
|
||||
parser: parserTypeScript,
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': pluginTypeScript,
|
||||
},
|
||||
rules: {
|
||||
...pluginTypeScript.configs.strict.rules,
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/prefer-as-const': 'warn',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-import-type-side-effects': 'error',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
'error',
|
||||
{
|
||||
disallowTypeAnnotations: false,
|
||||
fixStyle: 'inline-type-imports',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.d.ts'],
|
||||
rules: {
|
||||
'eslint-comments/no-unlimited-disable': 'off',
|
||||
'import/no-duplicates': 'off',
|
||||
'unused-imports/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.?([cm])js'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.vue'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
$: 'readonly',
|
||||
$$: 'readonly',
|
||||
$computed: 'readonly',
|
||||
$customRef: 'readonly',
|
||||
$ref: 'readonly',
|
||||
$shallowRef: 'readonly',
|
||||
$toRef: 'readonly',
|
||||
},
|
||||
parser: parserVue,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
extraFileExtensions: ['.vue'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
vue: pluginVue,
|
||||
},
|
||||
processor: pluginVue.processors['.vue'],
|
||||
rules: {
|
||||
...pluginVue.configs.base.rules,
|
||||
...pluginVue.configs['vue3-essential'].rules,
|
||||
...pluginVue.configs['vue3-recommended'].rules,
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'vue/no-v-html': 'off',
|
||||
'vue/require-default-prop': 'off',
|
||||
'vue/require-explicit-emits': 'off',
|
||||
'vue/no-useless-template-attributes': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/no-setup-props-reactivity-loss': 'off',
|
||||
'vue/html-self-closing': [
|
||||
'error',
|
||||
{
|
||||
html: {
|
||||
void: 'always',
|
||||
normal: 'always',
|
||||
component: 'always',
|
||||
},
|
||||
svg: 'always',
|
||||
math: 'always',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// @ts-check
|
||||
export default {
|
||||
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
|
||||
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
|
||||
"prettier --write--parser json"
|
||||
],
|
||||
"package.json": ["prettier --write"],
|
||||
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
|
||||
"*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
|
||||
"*.md": ["prettier --write"]
|
||||
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
|
||||
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
|
||||
'package.json': ['prettier --write'],
|
||||
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
|
||||
'*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
|
||||
'*.md': ['prettier --write'],
|
||||
};
|
||||
|
|
414
package.json
414
package.json
|
@ -1,210 +1,208 @@
|
|||
{
|
||||
"name": "bunny-admin-element",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
"bunny-admin-element",
|
||||
"bunny-cli",
|
||||
"element-plus",
|
||||
"tailwindcss",
|
||||
"typescript",
|
||||
"pinia",
|
||||
"vue3",
|
||||
"vite",
|
||||
"esm"
|
||||
],
|
||||
"homepage": "https://gitee.com/BunnyBoss/bunny-admin-element-thin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitee.com/BunnyBoss/bunny-admin-element-thin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/BunnyBoss/bunny-admin-element-thin/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Bunny0212",
|
||||
"email": "1319900154@qq.com",
|
||||
"url": "https://github.com/xiaoxian521"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
||||
"serve": "pnpm vite",
|
||||
"start": "vite",
|
||||
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build && generate-version-file",
|
||||
"build:staging": "rimraf dist && vite build --mode staging",
|
||||
"report": "rimraf dist && vite build",
|
||||
"preview": "vite preview",
|
||||
"preview:build": "pnpm build && vite preview",
|
||||
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
||||
"svgo": "svgo -f . -r",
|
||||
"clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install",
|
||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
||||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
|
||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{html,vue,css,scss}\" --cache-location node_modules/.cache/stylelint/",
|
||||
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
|
||||
"prepare": "husky install",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"commit": "git pull && git add -A && git-cz && git push"
|
||||
},
|
||||
"dependencies": {
|
||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||
"@howdyjs/mouse-menu": "^2.1.3",
|
||||
"@infectoone/vue-ganttastic": "^2.3.2",
|
||||
"@logicflow/core": "^1.2.27",
|
||||
"@logicflow/extension": "^1.2.27",
|
||||
"@pureadmin/descriptions": "^1.2.1",
|
||||
"@pureadmin/table": "^3.1.2",
|
||||
"@pureadmin/utils": "^2.4.7",
|
||||
"@vue-flow/background": "^1.3.0",
|
||||
"@vue-flow/core": "^1.33.6",
|
||||
"@vueuse/core": "^10.9.0",
|
||||
"@vueuse/motion": "^2.1.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||
"@zxcvbn-ts/core": "^3.0.4",
|
||||
"animate.css": "^4.1.1",
|
||||
"axios": "^1.6.8",
|
||||
"china-area-data": "^5.0.1",
|
||||
"cropperjs": "^1.6.2",
|
||||
"dayjs": "^1.11.11",
|
||||
"echarts": "^5.5.0",
|
||||
"el-table-infinite-scroll": "^3.0.3",
|
||||
"element-plus": "2.7.1",
|
||||
"intro.js": "^7.2.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"localforage": "^1.10.0",
|
||||
"mint-filter": "^4.0.3",
|
||||
"mitt": "^3.0.1",
|
||||
"mqtt": "4.3.7",
|
||||
"nprogress": "^0.2.0",
|
||||
"path": "^0.12.7",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"pinyin-pro": "^3.20.4",
|
||||
"plus-pro-components": "^0.1.1",
|
||||
"qrcode": "^1.5.3",
|
||||
"qs": "^6.12.1",
|
||||
"responsive-storage": "^2.2.0",
|
||||
"sortablejs": "^1.15.2",
|
||||
"swiper": "^11.1.1",
|
||||
"terser": "^5.31.0",
|
||||
"typeit": "^8.8.3",
|
||||
"v-contextmenu": "^3.2.0",
|
||||
"v3-infinite-loading": "^1.3.1",
|
||||
"version-rocket": "^1.7.1",
|
||||
"vite-plugin-vue-inspector": "^5.1.3",
|
||||
"vue": "^3.4.27",
|
||||
"vue-i18n": "^9.13.1",
|
||||
"vue-json-pretty": "^2.4.0",
|
||||
"vue-pdf-embed": "^2.0.3",
|
||||
"vue-router": "^4.3.2",
|
||||
"vue-tippy": "^6.4.1",
|
||||
"vue-types": "^5.1.2",
|
||||
"vue-virtual-scroller": "2.0.0-beta.8",
|
||||
"vue-waterfall-plugin-next": "^2.4.3",
|
||||
"vue3-danmaku": "^1.6.0",
|
||||
"vue3-puzzle-vcode": "^1.1.7",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"vxe-table": "^4.6.9",
|
||||
"wavesurfer.js": "^7.7.13",
|
||||
"xgplayer": "^3.0.17",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.3.0",
|
||||
"@commitlint/config-conventional": "^19.2.2",
|
||||
"@commitlint/types": "^19.0.3",
|
||||
"@eslint/js": "^9.2.0",
|
||||
"@faker-js/faker": "^8.4.1",
|
||||
"@iconify-icons/ep": "^1.2.12",
|
||||
"@iconify-icons/ri": "^1.2.10",
|
||||
"@iconify/vue": "^4.1.2",
|
||||
"@intlify/unplugin-vue-i18n": "^4.0.0",
|
||||
"@pureadmin/theme": "^3.2.0",
|
||||
"@types/dagre": "^0.7.52",
|
||||
"@types/gradient-string": "^1.1.6",
|
||||
"@types/intro.js": "^5.1.5",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/node": "^20.12.11",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/qs": "^6.9.15",
|
||||
"@types/sortablejs": "^1.15.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"boxen": "^7.1.1",
|
||||
"commitizen": "^4.2.4",
|
||||
"commitlint": "^17.0.1",
|
||||
"cssnano": "^7.0.1",
|
||||
"cz-git": "^1.3.2",
|
||||
"dagre": "^0.8.5",
|
||||
"eslint": "^9.2.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-define-config": "^2.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"gradient-string": "^2.0.2",
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8.4.38",
|
||||
"postcss-html": "^1.7.0",
|
||||
"postcss-import": "^16.1.0",
|
||||
"postcss-scss": "^4.0.9",
|
||||
"prettier": "^3.2.5",
|
||||
"rimraf": "^5.0.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.0",
|
||||
"stylelint": "^16.5.0",
|
||||
"stylelint-config-recess-order": "^5.0.1",
|
||||
"stylelint-config-recommended-vue": "^1.5.0",
|
||||
"stylelint-config-standard-scss": "^13.1.0",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"svgo": "^3.3.0",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.11",
|
||||
"vite-plugin-cdn-import": "^0.3.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-fake-server": "^2.1.1",
|
||||
"vite-plugin-remove-console": "^2.2.0",
|
||||
"vite-plugin-router-warn": "^1.0.0",
|
||||
"vite-svg-loader": "^5.1.0",
|
||||
"vue-eslint-parser": "^9.4.2",
|
||||
"vue-tsc": "^1.8.27"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
||||
"pnpm": ">=9"
|
||||
},
|
||||
"pnpm": {
|
||||
"allowedDeprecatedVersions": {
|
||||
"are-we-there-yet": "*",
|
||||
"sourcemap-codec": "*",
|
||||
"domexception": "*",
|
||||
"w3c-hr-time": "*",
|
||||
"inflight": "*",
|
||||
"npmlog": "*",
|
||||
"rimraf": "*",
|
||||
"stable": "*",
|
||||
"gauge": "*",
|
||||
"abab": "*",
|
||||
"glob": "*"
|
||||
},
|
||||
"peerDependencyRules": {
|
||||
"allowedVersions": {
|
||||
"eslint": "9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-git"
|
||||
}
|
||||
}
|
||||
"name": "bunny-admin-element",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"keywords": [
|
||||
"bunny-admin-element",
|
||||
"bunny-cli",
|
||||
"element-plus",
|
||||
"tailwindcss",
|
||||
"typescript",
|
||||
"pinia",
|
||||
"vue3",
|
||||
"vite",
|
||||
"esm"
|
||||
],
|
||||
"homepage": "https://gitee.com/BunnyBoss/bunny-admin-element-thin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitee.com/BunnyBoss/bunny-admin-element-thin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/BunnyBoss/bunny-admin-element-thin/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Bunny0212",
|
||||
"email": "1319900154@qq.com",
|
||||
"url": "https://github.com/xiaoxian521"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
||||
"serve": "pnpm vite",
|
||||
"start": "vite",
|
||||
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build && generate-version-file",
|
||||
"build:staging": "rimraf dist && vite build --mode staging",
|
||||
"report": "rimraf dist && vite build",
|
||||
"preview": "vite preview",
|
||||
"preview:build": "pnpm build && vite preview",
|
||||
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
||||
"svgo": "svgo -f . -r",
|
||||
"clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install",
|
||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
||||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
|
||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{html,vue,css,scss}\" --cache-location node_modules/.cache/stylelint/",
|
||||
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
|
||||
"prepare": "husky install",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"commit": "git pull && git add -A && git-cz && git push"
|
||||
},
|
||||
"dependencies": {
|
||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||
"@howdyjs/mouse-menu": "^2.1.3",
|
||||
"@infectoone/vue-ganttastic": "^2.3.2",
|
||||
"@logicflow/core": "^1.2.27",
|
||||
"@logicflow/extension": "^1.2.27",
|
||||
"@pureadmin/descriptions": "^1.2.1",
|
||||
"@pureadmin/table": "^3.1.2",
|
||||
"@pureadmin/utils": "^2.4.7",
|
||||
"@vue-flow/background": "^1.3.0",
|
||||
"@vue-flow/core": "^1.33.6",
|
||||
"@vueuse/core": "^10.9.0",
|
||||
"@vueuse/motion": "^2.1.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||
"@zxcvbn-ts/core": "^3.0.4",
|
||||
"animate.css": "^4.1.1",
|
||||
"axios": "^1.6.8",
|
||||
"china-area-data": "^5.0.1",
|
||||
"commitlint": "^19.4.1",
|
||||
"cropperjs": "^1.6.2",
|
||||
"dayjs": "^1.11.11",
|
||||
"echarts": "^5.5.0",
|
||||
"el-table-infinite-scroll": "^3.0.3",
|
||||
"element-plus": "2.7.1",
|
||||
"intro.js": "^7.2.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"localforage": "^1.10.0",
|
||||
"mint-filter": "^4.0.3",
|
||||
"mitt": "^3.0.1",
|
||||
"mqtt": "4.3.7",
|
||||
"nprogress": "^0.2.0",
|
||||
"path": "^0.12.7",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"pinyin-pro": "^3.20.4",
|
||||
"plus-pro-components": "^0.1.1",
|
||||
"qrcode": "^1.5.3",
|
||||
"qs": "^6.12.1",
|
||||
"responsive-storage": "^2.2.0",
|
||||
"sortablejs": "^1.15.2",
|
||||
"swiper": "^11.1.1",
|
||||
"terser": "^5.31.0",
|
||||
"typeit": "^8.8.3",
|
||||
"v-contextmenu": "^3.2.0",
|
||||
"v3-infinite-loading": "^1.3.1",
|
||||
"version-rocket": "^1.7.1",
|
||||
"vite-plugin-vue-inspector": "^5.1.3",
|
||||
"vue": "^3.4.27",
|
||||
"vue-json-pretty": "^2.4.0",
|
||||
"vue-pdf-embed": "^2.0.3",
|
||||
"vue-router": "^4.3.2",
|
||||
"vue-tippy": "^6.4.1",
|
||||
"vue-types": "^5.1.2",
|
||||
"vue-virtual-scroller": "2.0.0-beta.8",
|
||||
"vue-waterfall-plugin-next": "^2.4.3",
|
||||
"vue3-danmaku": "^1.6.0",
|
||||
"vue3-puzzle-vcode": "^1.1.7",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"vxe-table": "^4.6.18",
|
||||
"wavesurfer.js": "^7.7.13",
|
||||
"xgplayer": "^3.0.17",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.3.0",
|
||||
"@commitlint/config-conventional": "^19.2.2",
|
||||
"@commitlint/types": "^19.0.3",
|
||||
"@eslint/js": "^9.2.0",
|
||||
"@faker-js/faker": "^8.4.1",
|
||||
"@iconify-icons/ep": "^1.2.12",
|
||||
"@iconify-icons/ri": "^1.2.10",
|
||||
"@iconify/vue": "^4.1.2",
|
||||
"@pureadmin/theme": "^3.2.0",
|
||||
"@types/dagre": "^0.7.52",
|
||||
"@types/gradient-string": "^1.1.6",
|
||||
"@types/intro.js": "^5.1.5",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/node": "^20.12.11",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/qs": "^6.9.15",
|
||||
"@types/sortablejs": "^1.15.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"boxen": "^7.1.1",
|
||||
"commitizen": "^4.2.4",
|
||||
"cssnano": "^7.0.1",
|
||||
"cz-git": "^1.3.2",
|
||||
"dagre": "^0.8.5",
|
||||
"eslint": "^9.2.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-define-config": "^2.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"gradient-string": "^2.0.2",
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8.4.38",
|
||||
"postcss-html": "^1.7.0",
|
||||
"postcss-import": "^16.1.0",
|
||||
"postcss-scss": "^4.0.9",
|
||||
"prettier": "^3.2.5",
|
||||
"rimraf": "^5.0.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.0",
|
||||
"stylelint": "^16.5.0",
|
||||
"stylelint-config-recess-order": "^5.0.1",
|
||||
"stylelint-config-recommended-vue": "^1.5.0",
|
||||
"stylelint-config-standard-scss": "^13.1.0",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"svgo": "^3.3.0",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.11",
|
||||
"vite-plugin-cdn-import": "^0.3.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-fake-server": "^2.1.1",
|
||||
"vite-plugin-remove-console": "^2.2.0",
|
||||
"vite-plugin-router-warn": "^1.0.0",
|
||||
"vite-svg-loader": "^5.1.0",
|
||||
"vue-eslint-parser": "^9.4.2",
|
||||
"vue-tsc": "^1.8.27"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
||||
"pnpm": ">=9"
|
||||
},
|
||||
"pnpm": {
|
||||
"allowedDeprecatedVersions": {
|
||||
"are-we-there-yet": "*",
|
||||
"sourcemap-codec": "*",
|
||||
"domexception": "*",
|
||||
"w3c-hr-time": "*",
|
||||
"inflight": "*",
|
||||
"npmlog": "*",
|
||||
"rimraf": "*",
|
||||
"stable": "*",
|
||||
"gauge": "*",
|
||||
"abab": "*",
|
||||
"glob": "*"
|
||||
},
|
||||
"peerDependencyRules": {
|
||||
"allowedVersions": {
|
||||
"eslint": "9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-git"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
820
pnpm-lock.yaml
820
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,12 @@
|
|||
// @ts-check
|
||||
|
||||
/** @type {import('postcss-load-config').Config} */
|
||||
/** @type {import("postcss-load-config").Config} */
|
||||
export default {
|
||||
plugins: {
|
||||
"postcss-import": {},
|
||||
"tailwindcss/nesting": {},
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
||||
}
|
||||
plugins: {
|
||||
'postcss-import': {},
|
||||
'tailwindcss/nesting': {},
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
<template>
|
||||
<div class="main">
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||
:columns="column"
|
||||
:data="dataList"
|
||||
:header-cell-style="cellHeaderStyle"
|
||||
:loading="loading"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
row-key="id"
|
||||
table-layout="auto"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { cellHeaderStyle } from "@/components/TableBar/utils/tableStyle";
|
||||
import PureTable from "@pureadmin/table";
|
||||
import type { PropType } from "vue";
|
||||
|
||||
// * 传入数据
|
||||
defineProps({
|
||||
// 表格数据
|
||||
dataList: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
// 表格列字段
|
||||
column: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
size: {
|
||||
type: String as PropType<any>,
|
||||
default: "default"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
|
@ -1,96 +1,80 @@
|
|||
<script lang="ts" setup>
|
||||
import {
|
||||
getCurrentInstance,
|
||||
nextTick,
|
||||
onMounted,
|
||||
PropType,
|
||||
ref,
|
||||
unref,
|
||||
watch
|
||||
} from "vue";
|
||||
import { rendTipProps } from "@/components/TableBar/utils/tableConfig";
|
||||
import {
|
||||
cellHeaderStyle,
|
||||
getDropdownItemStyle,
|
||||
iconClass,
|
||||
topClass
|
||||
} from "@/components/TableBar/utils/tableStyle";
|
||||
import PureTable from "@pureadmin/table";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import RefreshIcon from "@/assets/table-bar/refresh.svg?component";
|
||||
import CollapseIcon from "@/assets/table-bar/collapse.svg?component";
|
||||
import SettingIcon from "@/assets/table-bar/settings.svg?component";
|
||||
import { cloneDeep, getKeyList, isBoolean, isFunction } from "@pureadmin/utils";
|
||||
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
||||
import Sortable from "sortablejs";
|
||||
import { $t } from "@/plugins/i18n";
|
||||
import { DeleteFilled, EditPen } from "@element-plus/icons-vue";
|
||||
import { useRenderIcon } from "@/components/CommonIcon/src/hooks";
|
||||
import Refresh from "@iconify-icons/ep/refresh";
|
||||
import { FormInstance } from "element-plus";
|
||||
import { getCurrentInstance, nextTick, onMounted, PropType, ref, unref, watch } from 'vue';
|
||||
import { rendTipProps } from '@/components/TableBar/utils/tableConfig';
|
||||
import { cellHeaderStyle, getDropdownItemStyle, iconClass, topClass } from '@/components/TableBar/utils/tableStyle';
|
||||
import PureTable from '@pureadmin/table';
|
||||
import { useRoute } from 'vue-router';
|
||||
import RefreshIcon from '@/assets/table-bar/refresh.svg?component';
|
||||
import CollapseIcon from '@/assets/table-bar/collapse.svg?component';
|
||||
import SettingIcon from '@/assets/table-bar/settings.svg?component';
|
||||
import { cloneDeep, getKeyList, isBoolean, isFunction } from '@pureadmin/utils';
|
||||
import DragIcon from '@/assets/table-bar/drag.svg?component';
|
||||
import Sortable from 'sortablejs';
|
||||
import { DeleteFilled, EditPen } from '@element-plus/icons-vue';
|
||||
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
||||
import Refresh from '@iconify-icons/ep/refresh';
|
||||
import { FormInstance } from 'element-plus';
|
||||
|
||||
// * 传入数据
|
||||
const props = defineProps({
|
||||
// 表格数据
|
||||
dataList: { type: Array<any>, default: [] },
|
||||
// 表格列字段
|
||||
column: { type: Array as PropType<any>, default: () => [] },
|
||||
// 是否加载
|
||||
loading: { type: Boolean, default: false },
|
||||
// 表格头部查询
|
||||
tableQueryFormVisible: { type: Boolean, default: true },
|
||||
// 页面字体大小,small | default | large
|
||||
size: { type: String as PropType<any>, default: "default" },
|
||||
// 分页器参数
|
||||
pagination: { type: Object, default: Object },
|
||||
// 选择行发生变化
|
||||
handleSelectionChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 分页大小变化
|
||||
handleSizeChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 当前页变化
|
||||
handleCurrentChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type: Object as PropType<any>,
|
||||
default: Object
|
||||
},
|
||||
// 表格的key值
|
||||
tableKey: {
|
||||
type: [String, Number] as PropType<string | number>,
|
||||
default: "0"
|
||||
},
|
||||
// 表格标题
|
||||
tableTitle: { type: String, default: "" },
|
||||
// 表格修改
|
||||
tableEdit: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
}, // 表格删除
|
||||
tableDelete: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 刷新时
|
||||
onReFresh: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
onSearch: { type: Function as PropType<any> },
|
||||
model: { type: Object as PropType<any> }
|
||||
// 表格数据
|
||||
dataList: { type: Array<any>, default: [] },
|
||||
// 表格列字段
|
||||
column: { type: Array as PropType<any>, default: () => [] },
|
||||
// 是否加载
|
||||
loading: { type: Boolean, default: false },
|
||||
// 表格头部查询
|
||||
tableQueryFormVisible: { type: Boolean, default: true },
|
||||
// 页面字体大小,small | default | large
|
||||
size: { type: String as PropType<any>, default: 'default' },
|
||||
// 分页器参数
|
||||
pagination: { type: Object, default: Object },
|
||||
// 选择行发生变化
|
||||
handleSelectionChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
// 分页大小变化
|
||||
onPageSizeChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
// 当前页变化
|
||||
onPageCurrentChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type: Object as PropType<any>,
|
||||
default: Object,
|
||||
},
|
||||
// 表格的key值
|
||||
tableKey: {
|
||||
type: [String, Number] as PropType<string | number>,
|
||||
default: '0',
|
||||
},
|
||||
// 表格标题
|
||||
tableTitle: { type: String, default: '' },
|
||||
// 表格修改
|
||||
tableEdit: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
}, // 表格删除
|
||||
tableDelete: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
// 刷新时
|
||||
onReFresh: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
onSearch: { type: Function as PropType<any> },
|
||||
model: { type: Object as PropType<any> },
|
||||
});
|
||||
|
||||
const emit = defineEmits(["changeColumn"]);
|
||||
const { t, locale } = useI18n();
|
||||
const emit = defineEmits(['changeColumn']);
|
||||
const route = useRoute();
|
||||
// 是否全选
|
||||
const checkAll = ref(true);
|
||||
|
@ -100,16 +84,10 @@ const isIndeterminate = ref(false);
|
|||
// 动态行
|
||||
const dynamicColumns = ref(props.column);
|
||||
// 过滤是否选中的列
|
||||
const filterColumns = cloneDeep(props.column).filter(column =>
|
||||
isBoolean(column?.hide)
|
||||
? !column.hide
|
||||
: !(isFunction(column?.hide) && column?.hide())
|
||||
);
|
||||
const filterColumns = cloneDeep(props.column).filter(column => (isBoolean(column?.hide) ? !column.hide : !(isFunction(column?.hide) && column?.hide())));
|
||||
// 选择当前列
|
||||
const checkedColumns = ref(getKeyList(cloneDeep(filterColumns), "label"));
|
||||
const checkColumnList = ref(
|
||||
getKeyList(cloneDeep(dynamicColumns.value), "label")
|
||||
);
|
||||
const checkedColumns = ref(getKeyList(cloneDeep(filterColumns), 'label'));
|
||||
const checkColumnList = ref(getKeyList(cloneDeep(dynamicColumns.value), 'label'));
|
||||
const instance = getCurrentInstance()!;
|
||||
const ruleFormRef = ref<FormInstance>();
|
||||
|
||||
|
@ -118,7 +96,7 @@ const ruleFormRef = ref<FormInstance>();
|
|||
* @param value 修改样式大小 larger | default | small
|
||||
*/
|
||||
const handleTableSizeClick = (value: string) => {
|
||||
size.value = value;
|
||||
size.value = value;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -126,11 +104,9 @@ const handleTableSizeClick = (value: string) => {
|
|||
* @param val 是否全部显示
|
||||
*/
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
checkedColumns.value = val ? checkColumnList.value : [];
|
||||
isIndeterminate.value = false;
|
||||
dynamicColumns.value.map(column =>
|
||||
val ? (column.hide = false) : (column.hide = true)
|
||||
);
|
||||
checkedColumns.value = val ? checkColumnList.value : [];
|
||||
isIndeterminate.value = false;
|
||||
dynamicColumns.value.map(column => (val ? (column.hide = false) : (column.hide = true)));
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -138,11 +114,10 @@ const handleCheckAllChange = (val: boolean) => {
|
|||
* @param value
|
||||
*/
|
||||
const handleCheckedColumnsChange = (value: string[]) => {
|
||||
checkedColumns.value = value;
|
||||
const checkedCount = value.length;
|
||||
checkAll.value = checkedCount === checkColumnList.value.length;
|
||||
isIndeterminate.value =
|
||||
checkedCount > 0 && checkedCount < checkColumnList.value.length;
|
||||
checkedColumns.value = value;
|
||||
const checkedCount = value.length;
|
||||
checkAll.value = checkedCount === checkColumnList.value.length;
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < checkColumnList.value.length;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -150,9 +125,7 @@ const handleCheckedColumnsChange = (value: string[]) => {
|
|||
* @param label
|
||||
*/
|
||||
const handleCheckColumnListChange = (label: string) => {
|
||||
dynamicColumns.value.filter(item => item.label === label)[0].hide = !(
|
||||
event.target as any
|
||||
).checked;
|
||||
dynamicColumns.value.filter(item => item.label === label)[0].hide = !(event.target as any).checked;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -160,72 +133,67 @@ const handleCheckColumnListChange = (label: string) => {
|
|||
* @param label
|
||||
*/
|
||||
const isFixedColumn = (label: string) => {
|
||||
return dynamicColumns.value.filter(item => item.label === label)[0].fixed;
|
||||
return dynamicColumns.value.filter(item => item.label === label)[0].fixed;
|
||||
};
|
||||
|
||||
/**
|
||||
* * 重置自定义表格列字段
|
||||
*/
|
||||
const onReset = async () => {
|
||||
// 重置列表值
|
||||
const list = [];
|
||||
// 全选按钮设为true
|
||||
checkAll.value = true;
|
||||
isIndeterminate.value = false;
|
||||
// 当前选中的列
|
||||
checkedColumns.value = getKeyList(cloneDeep(filterColumns), "label");
|
||||
// ? 重新赋值,拖拽排序不会改变原有值,响应式数据的特性 直接对 ref 或 reactive 创建的变量进行赋值可能不会触发视图的更新
|
||||
// ? Proxy 来追踪属性的访问和修改,使用异步方式确保正确更新视图
|
||||
checkColumnList.value = [];
|
||||
await nextTick(() => {
|
||||
checkColumnList.value = getKeyList(filterColumns, "label");
|
||||
});
|
||||
// 重置列表值
|
||||
const list = [];
|
||||
// 全选按钮设为true
|
||||
checkAll.value = true;
|
||||
isIndeterminate.value = false;
|
||||
// 当前选中的列
|
||||
checkedColumns.value = getKeyList(cloneDeep(filterColumns), 'label');
|
||||
// ? 重新赋值,拖拽排序不会改变原有值,响应式数据的特性 直接对 ref 或 reactive 创建的变量进行赋值可能不会触发视图的更新
|
||||
// ? Proxy 来追踪属性的访问和修改,使用异步方式确保正确更新视图
|
||||
checkColumnList.value = [];
|
||||
await nextTick(() => {
|
||||
checkColumnList.value = getKeyList(filterColumns, 'label');
|
||||
});
|
||||
|
||||
// checkedColumns 是原有顺序,根据这个顺序重新得到list
|
||||
checkedColumns.value.forEach(item => {
|
||||
dynamicColumns.value.forEach(column => {
|
||||
if (column.label == item) {
|
||||
list.push(column);
|
||||
}
|
||||
});
|
||||
});
|
||||
// checkedColumns 是原有顺序,根据这个顺序重新得到list
|
||||
checkedColumns.value.forEach(item => {
|
||||
dynamicColumns.value.forEach(column => {
|
||||
if (column.label == item) {
|
||||
list.push(column);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
emit("changeColumn", list);
|
||||
emit('changeColumn', list);
|
||||
};
|
||||
|
||||
/** 列展示拖拽排序 */
|
||||
const rowDrop = (event: any) => {
|
||||
nextTick(() => {
|
||||
const wrapper: HTMLElement = (
|
||||
instance?.proxy?.$refs[`GroupRef${unref(props.tableKey)}`] as any
|
||||
).$el.firstElementChild;
|
||||
Sortable.create(wrapper, {
|
||||
animation: 300,
|
||||
handle: ".drag-btn",
|
||||
onEnd: ({ newIndex, oldIndex, item }) => {
|
||||
const targetThElem = item;
|
||||
const wrapperElem = targetThElem.parentNode as HTMLElement;
|
||||
const oldColumn = dynamicColumns.value[oldIndex];
|
||||
const newColumn = dynamicColumns.value[newIndex];
|
||||
if (oldColumn?.fixed || newColumn?.fixed) {
|
||||
// 当前列存在fixed属性 则不可拖拽
|
||||
const oldThElem = wrapperElem.children[oldIndex] as HTMLElement;
|
||||
if (newIndex > oldIndex) {
|
||||
wrapperElem.insertBefore(targetThElem, oldThElem);
|
||||
} else {
|
||||
wrapperElem.insertBefore(
|
||||
targetThElem,
|
||||
oldThElem ? oldThElem.nextElementSibling : oldThElem
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const currentRow = dynamicColumns.value.splice(oldIndex, 1)[0];
|
||||
dynamicColumns.value.splice(newIndex, 0, currentRow);
|
||||
emit("changeColumn", dynamicColumns.value);
|
||||
}
|
||||
});
|
||||
}).then();
|
||||
nextTick(() => {
|
||||
const wrapper: HTMLElement = (instance?.proxy?.$refs[`GroupRef${unref(props.tableKey)}`] as any).$el.firstElementChild;
|
||||
Sortable.create(wrapper, {
|
||||
animation: 300,
|
||||
handle: '.drag-btn',
|
||||
onEnd: ({ newIndex, oldIndex, item }) => {
|
||||
const targetThElem = item;
|
||||
const wrapperElem = targetThElem.parentNode as HTMLElement;
|
||||
const oldColumn = dynamicColumns.value[oldIndex];
|
||||
const newColumn = dynamicColumns.value[newIndex];
|
||||
if (oldColumn?.fixed || newColumn?.fixed) {
|
||||
// 当前列存在fixed属性 则不可拖拽
|
||||
const oldThElem = wrapperElem.children[oldIndex] as HTMLElement;
|
||||
if (newIndex > oldIndex) {
|
||||
wrapperElem.insertBefore(targetThElem, oldThElem);
|
||||
} else {
|
||||
wrapperElem.insertBefore(targetThElem, oldThElem ? oldThElem.nextElementSibling : oldThElem);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const currentRow = dynamicColumns.value.splice(oldIndex, 1)[0];
|
||||
dynamicColumns.value.splice(newIndex, 0, currentRow);
|
||||
emit('changeColumn', dynamicColumns.value);
|
||||
},
|
||||
});
|
||||
}).then();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -233,234 +201,141 @@ const rowDrop = (event: any) => {
|
|||
* @param formEl
|
||||
*/
|
||||
const resetForm = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
props.onSearch();
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
props.onSearch();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
watch([() => props.column], () => {
|
||||
dynamicColumns.value = props.column;
|
||||
});
|
||||
watch([() => props.column], () => {
|
||||
dynamicColumns.value = props.column;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<!-- 表单设置,外加插槽 -->
|
||||
<el-form
|
||||
v-show="tableQueryFormVisible"
|
||||
ref="ruleFormRef"
|
||||
:inline="true"
|
||||
:model="model"
|
||||
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto"
|
||||
@submit="onSearch"
|
||||
>
|
||||
<slot name="tableForm" />
|
||||
<el-form-item>
|
||||
<el-button
|
||||
:icon="useRenderIcon('ri:search-line')"
|
||||
:loading="loading"
|
||||
type="primary"
|
||||
@click="onSearch"
|
||||
>
|
||||
{{ $t("buttons.search") }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:icon="useRenderIcon(Refresh)"
|
||||
@click="resetForm(ruleFormRef)"
|
||||
>
|
||||
{{ $t("buttons.rest") }}</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="main">
|
||||
<!-- 表单设置,外加插槽 -->
|
||||
<el-form v-show="tableQueryFormVisible" ref="ruleFormRef" :inline="true" :model="model" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto" @submit="onSearch">
|
||||
<slot name="tableForm" />
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="loading" type="primary" @click="onSearch"> 搜索 </el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(ruleFormRef)"> 重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格头部设置 -->
|
||||
<div class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
||||
<div class="flex justify-between w-full h-[60px] p-4">
|
||||
<!-- 自定义左边头部内容 -->
|
||||
<slot name="tableTitle">
|
||||
<p class="font-bold truncate">
|
||||
{{ tableTitle ? tableTitle : t(route.meta.title) }}
|
||||
</p>
|
||||
</slot>
|
||||
<!-- 表格头部设置 -->
|
||||
<div class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
||||
<div class="flex justify-between w-full h-[60px] p-4">
|
||||
<!-- 自定义左边头部内容 -->
|
||||
<slot name="tableTitle">
|
||||
<p class="font-bold truncate">
|
||||
{{ tableTitle ? tableTitle : route.meta.title }}
|
||||
</p>
|
||||
</slot>
|
||||
|
||||
<!-- 自定义表格操作内容 -->
|
||||
<slot name="tableOperation">
|
||||
<div class="flex items-center justify-around">
|
||||
<!-- 插槽内容 -->
|
||||
<div class="mr-4">
|
||||
<slot name="tableButtons" />
|
||||
</div>
|
||||
<!-- 自定义表格操作内容 -->
|
||||
<slot name="tableOperation">
|
||||
<div class="flex items-center justify-around">
|
||||
<!-- 插槽内容 -->
|
||||
<div class="mr-4">
|
||||
<slot name="tableButtons" />
|
||||
</div>
|
||||
|
||||
<!-- 表格刷新按钮 -->
|
||||
<RefreshIcon
|
||||
v-tippy="rendTipProps('刷新')"
|
||||
:class="`w-[16px] ${iconClass()}} ${loading ? 'animate-spin' : ''}`"
|
||||
@click="onReFresh"
|
||||
/>
|
||||
<el-divider direction="vertical" />
|
||||
<!-- 表格刷新按钮 -->
|
||||
<RefreshIcon v-tippy="rendTipProps('刷新')" :class="`w-[16px] ${iconClass()}} ${loading ? 'animate-spin' : ''}`" @click="onReFresh" />
|
||||
<el-divider direction="vertical" />
|
||||
|
||||
<!-- 选择表格大小 -->
|
||||
<el-dropdown trigger="click">
|
||||
<CollapseIcon :class="`w-[16px] ${iconClass()}`" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="translation">
|
||||
<el-dropdown-item
|
||||
:style="getDropdownItemStyle(size, 'large')"
|
||||
@click="handleTableSizeClick('large')"
|
||||
>
|
||||
{{ $t("style.larger") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:style="getDropdownItemStyle(size, 'default')"
|
||||
@click="handleTableSizeClick('default')"
|
||||
>
|
||||
{{ t("style.default") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:style="getDropdownItemStyle(size, 'small')"
|
||||
@click="handleTableSizeClick('small')"
|
||||
>
|
||||
{{ t("style.small") }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-divider direction="vertical" />
|
||||
<!-- 选择表格大小 -->
|
||||
<el-dropdown trigger="click">
|
||||
<CollapseIcon :class="`w-[16px] ${iconClass()}`" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="translation">
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'large')" @click="handleTableSizeClick('large')"> 大 </el-dropdown-item>
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'default')" @click="handleTableSizeClick('default')"> 默认 </el-dropdown-item>
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'small')" @click="handleTableSizeClick('small')"> 小 </el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-divider direction="vertical" />
|
||||
|
||||
<!-- 表格列设置 -->
|
||||
<el-popover
|
||||
:popper-style="{ padding: 0 }"
|
||||
placement="bottom-start"
|
||||
trigger="click"
|
||||
width="200"
|
||||
>
|
||||
<template #reference>
|
||||
<SettingIcon
|
||||
v-tippy="rendTipProps('列设置')"
|
||||
:class="`w-[16px] ${iconClass()}`"
|
||||
/>
|
||||
</template>
|
||||
<!-- 表格列设置 -->
|
||||
<el-popover :popper-style="{ padding: 0 }" placement="bottom-start" trigger="click" width="200">
|
||||
<template #reference>
|
||||
<SettingIcon v-tippy="rendTipProps('列设置')" :class="`w-[16px] ${iconClass()}`" />
|
||||
</template>
|
||||
|
||||
<div :class="topClass()">
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="isIndeterminate"
|
||||
class="!-mr-1"
|
||||
label="列展示"
|
||||
@change="handleCheckAllChange"
|
||||
/>
|
||||
<el-button link type="primary" @click="onReset">
|
||||
{{ t("buttons.rest") }}</el-button
|
||||
>
|
||||
</div>
|
||||
<div :class="topClass()">
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" class="!-mr-1" label="列展示" @change="handleCheckAllChange" />
|
||||
<el-button link type="primary" @click="onReset"> 重置</el-button>
|
||||
</div>
|
||||
|
||||
<div class="pt-[6px] pl-[11px]">
|
||||
<el-scrollbar max-height="36vh">
|
||||
<el-checkbox-group
|
||||
:ref="`GroupRef${unref(props.tableKey)}`"
|
||||
:modelValue="checkedColumns"
|
||||
@change="handleCheckedColumnsChange"
|
||||
>
|
||||
<el-space
|
||||
:alignment="'flex-start'"
|
||||
:size="0"
|
||||
direction="vertical"
|
||||
>
|
||||
<div
|
||||
v-for="(item, index) in checkColumnList"
|
||||
:key="index"
|
||||
class="flex items-center"
|
||||
>
|
||||
<DragIcon
|
||||
:class="`drag-btn w-[16px] mr-2 ${isFixedColumn(item) ? '!cursor-no-drop' : '!cursor-grab'}`"
|
||||
@mouseenter.prevent="rowDrop"
|
||||
/>
|
||||
<el-checkbox
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
@change="handleCheckColumnListChange(item)"
|
||||
>
|
||||
<span
|
||||
:title="item"
|
||||
class="inline-block w-[120px] truncate hover:text-text_color_primary"
|
||||
>
|
||||
{{ item }}
|
||||
</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-space>
|
||||
</el-checkbox-group>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
<slot name="tableSelect" />
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||
:columns="column"
|
||||
:data="dataList"
|
||||
:header-cell-style="cellHeaderStyle"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:paginationSmall="size === 'small'"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
row-key="id"
|
||||
stripe
|
||||
table-layout="fixed"
|
||||
v-bind="$attrs"
|
||||
@page-size-change="handleSizeChange"
|
||||
@page-current-change="handleCurrentChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template
|
||||
v-for="item in column"
|
||||
:key="item.prop"
|
||||
v-slot:[item.slot]="scope"
|
||||
v-bind="item"
|
||||
>
|
||||
<slot :name="item.slot" v-bind="scope" />
|
||||
<slot v-if="item.slot === 'operation'" name="operation">
|
||||
<el-button
|
||||
:icon="EditPen"
|
||||
link
|
||||
type="warning"
|
||||
@click="tableEdit(scope)"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-popconfirm
|
||||
:title="t('table.popConfirmTitle')"
|
||||
@confirm="tableDelete(scope)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button :icon="DeleteFilled" link type="danger"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</slot>
|
||||
</template>
|
||||
</pure-table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt-[6px] pl-[11px]">
|
||||
<el-scrollbar max-height="36vh">
|
||||
<el-checkbox-group :ref="`GroupRef${unref(props.tableKey)}`" :modelValue="checkedColumns" @change="handleCheckedColumnsChange">
|
||||
<el-space :alignment="'flex-start'" :size="0" direction="vertical">
|
||||
<div v-for="(item, index) in checkColumnList" :key="index" class="flex items-center">
|
||||
<DragIcon :class="`drag-btn w-[16px] mr-2 ${isFixedColumn(item) ? '!cursor-no-drop' : '!cursor-grab'}`" @mouseenter.prevent="rowDrop" />
|
||||
<el-checkbox :key="index" :label="item" :value="item" @change="handleCheckColumnListChange(item)">
|
||||
<span :title="item" class="inline-block w-[120px] truncate hover:text-text_color_primary">
|
||||
{{ item }}
|
||||
</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-space>
|
||||
</el-checkbox-group>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
<slot name="tableSelect" />
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||
:columns="column"
|
||||
:data="dataList"
|
||||
:header-cell-style="cellHeaderStyle"
|
||||
:loading="loading"
|
||||
:on-page-current-change="onPageCurrentChange"
|
||||
:on-page-size-change="onPageSizeChange"
|
||||
:pagination="pagination"
|
||||
:paginationSmall="size === 'small'"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
row-key="id"
|
||||
stripe
|
||||
table-layout="fixed"
|
||||
v-bind="$attrs"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template v-for="item in column" :key="item.prop" v-slot:[item.slot]="scope" v-bind="item">
|
||||
<slot :name="item.slot" v-bind="scope" />
|
||||
<slot v-if="item.slot === 'operation'" name="operation">
|
||||
<el-button :icon="EditPen" link type="warning" @click="tableEdit(scope)">修改</el-button>
|
||||
<el-popconfirm title="是否确认删除" @confirm="tableDelete(scope)">
|
||||
<template #reference>
|
||||
<el-button :icon="DeleteFilled" link type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</slot>
|
||||
</template>
|
||||
</pure-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dropdown-menu__item i) {
|
||||
margin: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
<template>
|
||||
<div class="main mt-2 p-2 bg-bg_color">
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||
:columns="column"
|
||||
:data="dataList"
|
||||
:header-cell-style="cellHeaderStyle"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:paginationSmall="size === 'small'"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
row-key="id"
|
||||
table-layout="auto"
|
||||
@selection-change="handleSelectionChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
@page-current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { cellHeaderStyle } from "@/components/TableBar/utils/tableStyle";
|
||||
import PureTable from "@pureadmin/table";
|
||||
import type { PropType } from "vue";
|
||||
|
||||
// * 传入数据
|
||||
defineProps({
|
||||
// 表格数据
|
||||
dataList: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
// 表格列字段
|
||||
column: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
// 是否加载
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 页面字体大小,small | default | large
|
||||
size: {
|
||||
type: String as PropType<any>,
|
||||
default: "default"
|
||||
},
|
||||
// 分页器参数
|
||||
pagination: {
|
||||
type: Object,
|
||||
default: Object
|
||||
},
|
||||
// 一页大小变化
|
||||
handleSelectionChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 分页大小变化
|
||||
handleSizeChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 当前页变化
|
||||
handleCurrentChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
|
@ -1,105 +0,0 @@
|
|||
<template>
|
||||
<div class="main">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto"
|
||||
>
|
||||
<slot name="tableForm" />
|
||||
</el-form>
|
||||
|
||||
<div class="mt-2 p-2 bg-bg_color">
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||
:columns="column"
|
||||
:data="dataList"
|
||||
:header-cell-style="cellHeaderStyle"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:paginationSmall="size === 'small'"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
row-key="id"
|
||||
table-layout="auto"
|
||||
@selection-change="handleSelectionChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
@page-current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from "vue";
|
||||
import { cellHeaderStyle } from "@/components/TableBar/utils/tableStyle";
|
||||
import PureTable from "@pureadmin/table";
|
||||
|
||||
// * 传入数据
|
||||
defineProps({
|
||||
// 表格数据
|
||||
dataList: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
// 表格列字段
|
||||
column: {
|
||||
type: Array<any>,
|
||||
default: []
|
||||
},
|
||||
// 是否加载
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 页面字体大小,small | default | large
|
||||
size: {
|
||||
type: String as PropType<any>,
|
||||
default: "default"
|
||||
},
|
||||
// 分页器参数
|
||||
pagination: {
|
||||
type: Object,
|
||||
default: Object
|
||||
},
|
||||
// 一页大小变化
|
||||
handleSelectionChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 分页大小变化
|
||||
handleSizeChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 当前页变化
|
||||
handleCurrentChange: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {}
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type: Object as PropType<any>,
|
||||
default: Object
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dropdown-menu__item i) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
margin: 24px 24px 0 !important;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,204 @@
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, PropType, ref } from 'vue';
|
||||
import { rendTipProps } from '@/components/TableBar/utils/tableConfig';
|
||||
import { getDropdownItemStyle, iconClass } from '@/components/TableBar/utils/tableStyle';
|
||||
import { useRoute } from 'vue-router';
|
||||
import RefreshIcon from '@/assets/table-bar/refresh.svg?component';
|
||||
import CollapseIcon from '@/assets/table-bar/collapse.svg?component';
|
||||
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
||||
import Refresh from '@iconify-icons/ep/refresh';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import { Pagination } from '../../../../types/pagination/pagination';
|
||||
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table';
|
||||
import { pageSizes } from '@/enum/baseConstant';
|
||||
|
||||
// * 传入数据
|
||||
const props = defineProps({
|
||||
// 表格数据
|
||||
dataList: { type: Array<any>, default: [] },
|
||||
// 表格列字段
|
||||
column: { type: Array as PropType<any>, default: () => [] },
|
||||
// 是否加载
|
||||
loading: { type: Boolean, default: false },
|
||||
// 表格头部查询
|
||||
tableQueryFormVisible: { type: Boolean, default: true },
|
||||
// 页面字体大小,medium | small | mini
|
||||
size: { type: String as PropType<any>, default: 'medium' },
|
||||
// 分页器参数
|
||||
pagination: { type: Object as PropType<Pagination>, default: Object },
|
||||
// 当前页变化
|
||||
onPageChange: {
|
||||
type: Function as PropType<any>,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type: Object as PropType<any>,
|
||||
default: Object,
|
||||
},
|
||||
// 表格标题
|
||||
tableTitle: { type: String, default: '' },
|
||||
// 表格修改
|
||||
onTableEdit: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
}, // 表格删除
|
||||
onTableDelete: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => {},
|
||||
},
|
||||
// 刷新时
|
||||
onReFresh: {
|
||||
type: Function as PropType<any>,
|
||||
},
|
||||
onSearch: { type: Function as PropType<any> },
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
// 表格样式大小
|
||||
const size = ref(props.size);
|
||||
const toolbarRef = ref<VxeToolbarInstance>();
|
||||
const tableRef = ref<VxeTableInstance>();
|
||||
const ruleFormRef = ref<FormInstance>();
|
||||
|
||||
/**
|
||||
* * 修改表格样式大小
|
||||
* @param value 修改样式大小 medium | small | mini
|
||||
*/
|
||||
const handleTableSizeClick = (value: string) => {
|
||||
size.value = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
* @param formEl
|
||||
*/
|
||||
const resetForm = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
props.onSearch();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
const $table = tableRef.value;
|
||||
const $toolbarRef = toolbarRef.value;
|
||||
if ($table && $toolbarRef) {
|
||||
$table.connect($toolbarRef);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<!-- 表单设置,外加插槽 -->
|
||||
<el-form v-show="tableQueryFormVisible" ref="ruleFormRef" :inline="true" :model="form" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto" @submit="onSearch">
|
||||
<slot name="tableForm" />
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="loading" type="primary" @click="onSearch"> 搜索 </el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(ruleFormRef)"> 重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格头部设置 -->
|
||||
<div class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
||||
<div class="flex justify-between w-full h-[60px] p-4">
|
||||
<!-- 自定义左边头部内容 -->
|
||||
<slot name="tableTitle">
|
||||
<p class="font-bold truncate">
|
||||
{{ tableTitle ? tableTitle : route.meta.title }}
|
||||
</p>
|
||||
</slot>
|
||||
|
||||
<!-- 自定义表格操作内容 -->
|
||||
<slot name="tableOperation">
|
||||
<div class="flex items-center justify-around">
|
||||
<!-- 插槽内容 -->
|
||||
<div class="mr-4">
|
||||
<slot name="tableButtons" />
|
||||
</div>
|
||||
|
||||
<!-- 表格刷新按钮 -->
|
||||
<RefreshIcon v-tippy="rendTipProps('刷新')" :class="`w-[16px] ${iconClass()}} ${loading ? 'animate-spin' : ''}`" @click="onReFresh" />
|
||||
<el-divider direction="vertical" />
|
||||
|
||||
<!-- 选择表格大小 -->
|
||||
<el-dropdown trigger="click">
|
||||
<CollapseIcon :class="`w-[16px] ${iconClass()}`" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="translation">
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'medium')" @click="handleTableSizeClick('medium')"> 大 </el-dropdown-item>
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'small')" @click="handleTableSizeClick('small')"> 默认 </el-dropdown-item>
|
||||
<el-dropdown-item :style="getDropdownItemStyle(size, 'mini')" @click="handleTableSizeClick('mini')"> 小 </el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-divider direction="vertical" />
|
||||
<vxe-toolbar ref="toolbarRef" custom export print />
|
||||
<el-divider direction="vertical" />
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
<slot name="tableSelect" />
|
||||
<!-- 表格 -->
|
||||
<vxe-table
|
||||
ref="tableRef"
|
||||
:column-config="{ resizable: true }"
|
||||
:custom-config="{}"
|
||||
:data="dataList"
|
||||
:export-config="{}"
|
||||
:loading="loading"
|
||||
:print-config="{}"
|
||||
:row-config="{ isHover: true }"
|
||||
:size="size"
|
||||
:tooltip-config="{ enterable: true, showAll: true }"
|
||||
:tree-config="{ transform: true, rowField: 'id', parentField: 'parentId' }"
|
||||
align="center"
|
||||
border
|
||||
header-align="center"
|
||||
round
|
||||
show-overflow
|
||||
stripe
|
||||
>
|
||||
<slot name="tableType">
|
||||
<vxe-column title="序号" type="seq" width="70" />
|
||||
</slot>
|
||||
<vxe-column v-for="item in column" :key="item.prop" :field="item.prop" :title="item.label">
|
||||
<template v-if="$slots[item.prop]" #default="scope">
|
||||
<slot :name="item.prop" v-bind="scope" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<template #empty>
|
||||
<div>
|
||||
<img alt="" src="https://pic2.zhimg.com/50/v2-f7031359103859e1ed38559715ef5f3f_hd.gif" />
|
||||
<p>不用再看了,没有更多数据了!</p>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-table>
|
||||
<vxe-pager
|
||||
v-show="onPageChange !== undefined"
|
||||
:background="true"
|
||||
:current-page="pagination.currentPage"
|
||||
:layouts="['Home', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'End', 'Sizes', 'FullJump', 'Total']"
|
||||
:loading="loading"
|
||||
:on-page-change="onPageChange"
|
||||
:page-size="pagination.pageSize"
|
||||
:page-sizes="pageSizes"
|
||||
:pager-count="5"
|
||||
:size="size"
|
||||
:total="pagination.total"
|
||||
border
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dropdown-menu__item i) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,30 +1,28 @@
|
|||
import { computed } from "vue";
|
||||
import { useEpThemeStoreHook } from "@/store/epTheme";
|
||||
import { computed } from 'vue';
|
||||
import { useEpThemeStoreHook } from '@/store/modules/epTheme';
|
||||
|
||||
/**
|
||||
* * 表格头部样式
|
||||
*/
|
||||
export const cellHeaderStyle = () => ({
|
||||
background: "var(--el-fill-color-light)",
|
||||
color: "var(--el-text-color-primary)"
|
||||
background: 'var(--el-fill-color-light)',
|
||||
color: 'var(--el-text-color-primary)',
|
||||
});
|
||||
|
||||
// * icon 样式
|
||||
export const iconClass = () =>
|
||||
"text-black dark:text-white duration-100 hover:!text-primary cursor-pointer outline-none ";
|
||||
export const iconClass = () => 'text-black dark:text-white duration-100 hover:!text-primary cursor-pointer outline-none ';
|
||||
|
||||
// * 顶部样式
|
||||
export const topClass = () =>
|
||||
"flex justify-between pt-[3px] px-[11px] border-b-[1px] border-solid border-[#dcdfe6] dark:border-[#303030]";
|
||||
export const topClass = () => 'flex justify-between pt-[3px] px-[11px] border-b-[1px] border-solid border-[#dcdfe6] dark:border-[#303030]';
|
||||
|
||||
/**
|
||||
* * 拖拽列样式
|
||||
*/
|
||||
export const getDropdownItemStyle = computed(() => {
|
||||
return (size: string, s: string) => {
|
||||
return {
|
||||
background: s === size ? useEpThemeStoreHook().epThemeColor : "",
|
||||
color: s === size ? "#fff" : "var(--el-text-color-primary)"
|
||||
};
|
||||
};
|
||||
return (size: string, s: string) => {
|
||||
return {
|
||||
background: s === size ? useEpThemeStoreHook().epThemeColor : '',
|
||||
color: s === size ? '#fff' : 'var(--el-text-color-primary)',
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
import axios from "axios";
|
||||
import type { App } from "vue";
|
||||
import axios from 'axios';
|
||||
import type { App } from 'vue';
|
||||
|
||||
let config: object = {};
|
||||
const { VITE_PUBLIC_PATH } = import.meta.env;
|
||||
|
||||
const setConfig = (cfg?: unknown) => {
|
||||
config = Object.assign(config, cfg);
|
||||
config = Object.assign(config, cfg);
|
||||
};
|
||||
|
||||
const getConfig = (key?: string): PlatformConfigs => {
|
||||
if (typeof key === "string") {
|
||||
const arr = key.split(".");
|
||||
if (arr && arr.length) {
|
||||
let data = config;
|
||||
arr.forEach(v => {
|
||||
if (data && typeof data[v] !== "undefined") {
|
||||
data = data[v];
|
||||
} else {
|
||||
data = null;
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
if (typeof key === 'string') {
|
||||
const arr = key.split('.');
|
||||
if (arr && arr.length) {
|
||||
let data = config;
|
||||
arr.forEach(v => {
|
||||
if (data && typeof data[v] !== 'undefined') {
|
||||
data = data[v];
|
||||
} else {
|
||||
data = null;
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
};
|
||||
|
||||
/** 获取项目动态全局配置 */
|
||||
export const getPlatformConfig = async (app: App): Promise<undefined> => {
|
||||
app.config.globalProperties.$config = getConfig();
|
||||
return axios({
|
||||
method: "get",
|
||||
url: `${VITE_PUBLIC_PATH}platform-config.json`
|
||||
})
|
||||
.then(({ data: config }) => {
|
||||
let $config = app.config.globalProperties.$config;
|
||||
// 自动注入系统配置
|
||||
if (app && $config && typeof config === "object") {
|
||||
$config = Object.assign($config, config);
|
||||
app.config.globalProperties.$config = $config;
|
||||
// 设置全局配置
|
||||
setConfig($config);
|
||||
}
|
||||
return $config;
|
||||
})
|
||||
.catch(() => {
|
||||
throw "请在public文件夹下添加platform-config.json配置文件";
|
||||
});
|
||||
app.config.globalProperties.$config = getConfig();
|
||||
return axios({
|
||||
method: 'get',
|
||||
url: `${VITE_PUBLIC_PATH}platform-config.json`,
|
||||
})
|
||||
.then(({ data: config }) => {
|
||||
let $config = app.config.globalProperties.$config;
|
||||
// 自动注入系统配置
|
||||
if (app && $config && typeof config === 'object') {
|
||||
$config = Object.assign($config, config);
|
||||
app.config.globalProperties.$config = $config;
|
||||
// 设置全局配置
|
||||
setConfig($config);
|
||||
}
|
||||
return $config;
|
||||
})
|
||||
.catch(() => {
|
||||
throw '请在public文件夹下添加platform-config.json配置文件';
|
||||
});
|
||||
};
|
||||
|
||||
/** 本地响应式存储的命名空间 */
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import type { Option } from '../../types/enum/options';
|
||||
|
||||
/**
|
||||
* * 是否默认
|
||||
*/
|
||||
export const isDefaultOptions: Option[] = [
|
||||
{ value: true, label: '是' },
|
||||
{ value: false, label: '否' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 是否显示
|
||||
*/
|
||||
export const isDefaultVisibleOptions: Option[] = [
|
||||
{ value: true, label: '显示' },
|
||||
{ value: false, label: '不显示' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 性别
|
||||
*/
|
||||
export const sexConstant: Option[] = [
|
||||
{ value: 1, label: '男' },
|
||||
{ value: 0, label: '女' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 分页默认数组个数
|
||||
*/
|
||||
export const pageSizes: number[] = [10, 30, 50, 100, 150, 200, 300];
|
|
@ -0,0 +1,29 @@
|
|||
// ? 表单选项
|
||||
import type { Option } from '../../types/enum/options';
|
||||
|
||||
/**
|
||||
* * 默认状态
|
||||
*/
|
||||
export const defaultStatus: Option[] = [
|
||||
{ value: '', label: '' },
|
||||
{ value: 1, label: '启用' },
|
||||
{ value: 0, label: '禁用' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 是否错误
|
||||
*/
|
||||
export const isErrorStatus: Option[] = [
|
||||
{ value: '', label: '' },
|
||||
{ value: false, label: '未出错' },
|
||||
{ value: true, label: '错误' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 默认状态
|
||||
*/
|
||||
export const statusConstant: Option[] = [
|
||||
{ value: '', label: '' },
|
||||
{ value: 1, label: '是' },
|
||||
{ value: 0, label: '否' },
|
||||
];
|
|
@ -0,0 +1,10 @@
|
|||
import type { Option } from '../../../types/enum/options';
|
||||
|
||||
/**
|
||||
* 图标选项
|
||||
*/
|
||||
export const faviconCategory: Option[] = [
|
||||
{ value: '', label: '' },
|
||||
{ value: 'web', label: 'web 前台' },
|
||||
{ value: 'admin', label: 'admin 后台' },
|
||||
];
|
|
@ -0,0 +1,21 @@
|
|||
import type { Option } from '../../../types/enum/options';
|
||||
|
||||
/**
|
||||
* * 用户反馈
|
||||
*/
|
||||
export const feedback: Option[] = [
|
||||
{ value: '', label: '' },
|
||||
{ value: 1, label: '已处理' },
|
||||
{ value: 0, label: '未处理' },
|
||||
{ value: -1, label: '其它问题' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 反馈类型选择
|
||||
*/
|
||||
export const feedbackTypeOptions: Option[] = [
|
||||
{ label: '优化建议', value: '优化建议' },
|
||||
{ label: 'bug反馈', value: 'bug反馈' },
|
||||
{ label: '新增功能建议', value: '新增功能建议' },
|
||||
{ label: '其它', value: '其它' },
|
||||
];
|
|
@ -0,0 +1,25 @@
|
|||
import type { Option } from '../../../types/enum/options';
|
||||
|
||||
/**
|
||||
* * 布局方式
|
||||
*/
|
||||
export const layoutConstant: Option[] = [
|
||||
{ value: 'ltr', label: '从左到右' },
|
||||
{ value: 'rtl', label: '从右到左' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 文章显示模式
|
||||
*/
|
||||
export const articleModeConstant: Option[] = [
|
||||
{ value: 'album', label: '相册模式' },
|
||||
{ value: 'list', label: '列表模式' },
|
||||
];
|
||||
|
||||
/**
|
||||
* * 默认状态
|
||||
*/
|
||||
export const userStatus: Option[] = [
|
||||
{ value: 0, label: '启用' },
|
||||
{ value: 1, label: '禁用' },
|
||||
];
|
88
src/main.ts
88
src/main.ts
|
@ -1,67 +1,67 @@
|
|||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
import { setupStore } from "@/store";
|
||||
import { getPlatformConfig } from "./config";
|
||||
import { MotionPlugin } from "@vueuse/motion";
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import { setupStore } from '@/store';
|
||||
import { getPlatformConfig } from './config';
|
||||
import { MotionPlugin } from '@vueuse/motion';
|
||||
// import { useEcharts } from "@/plugins/echarts";
|
||||
import { createApp, type Directive } from "vue";
|
||||
import { useElementPlus } from "@/plugins/elementPlus";
|
||||
import { injectResponsiveStorage } from "@/utils/responsive";
|
||||
import { createApp, type Directive } from 'vue';
|
||||
import { useElementPlus } from '@/plugins/elementPlus';
|
||||
import { injectResponsiveStorage } from '@/utils/responsive';
|
||||
|
||||
import Table from "@pureadmin/table";
|
||||
import Table from '@pureadmin/table';
|
||||
// import PureDescriptions from "@pureadmin/descriptions";
|
||||
// 引入重置样式
|
||||
import "./style/reset.scss";
|
||||
import './style/reset.scss';
|
||||
// 导入公共样式
|
||||
import "./style/index.scss";
|
||||
import './style/index.scss';
|
||||
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
||||
import "./style/tailwind.css";
|
||||
import "element-plus/dist/index.css";
|
||||
import './style/tailwind.css';
|
||||
import 'element-plus/dist/index.css';
|
||||
// 导入字体图标
|
||||
import "./assets/iconfont/iconfont.js";
|
||||
import "./assets/iconfont/iconfont.css";
|
||||
import './assets/iconfont/iconfont.js';
|
||||
import './assets/iconfont/iconfont.css';
|
||||
// 自定义指令
|
||||
import * as directives from "@/directives";
|
||||
import * as directives from '@/directives';
|
||||
// 全局注册@iconify/vue图标库
|
||||
import {
|
||||
FontIcon,
|
||||
IconifyIconOffline,
|
||||
IconifyIconOnline
|
||||
} from "./components/CommonIcon";
|
||||
import { FontIcon, IconifyIconOffline, IconifyIconOnline } from './components/CommonIcon';
|
||||
// 全局注册按钮级别权限组件
|
||||
import { Auth } from "@/components/Auth";
|
||||
import { Perms } from "@/components/Perms";
|
||||
import { Auth } from '@/components/Auth';
|
||||
import { Perms } from '@/components/Perms';
|
||||
// 全局注册vue-tippy
|
||||
import "tippy.js/dist/tippy.css";
|
||||
import "tippy.js/themes/light.css";
|
||||
import VueTippy from "vue-tippy";
|
||||
import { useEcharts } from "@/plugins/echarts";
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
import 'tippy.js/themes/light.css';
|
||||
import VueTippy from 'vue-tippy';
|
||||
import { useEcharts } from '@/plugins/echarts';
|
||||
// 完整导入 表格库
|
||||
import VxeUITable from 'vxe-table';
|
||||
import 'vxe-table/lib/style.css';
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
Object.keys(directives).forEach(key => {
|
||||
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
||||
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
||||
});
|
||||
|
||||
app.component("IconifyIconOffline", IconifyIconOffline);
|
||||
app.component("IconifyIconOnline", IconifyIconOnline);
|
||||
app.component("FontIcon", FontIcon);
|
||||
app.component('IconifyIconOffline', IconifyIconOffline);
|
||||
app.component('IconifyIconOnline', IconifyIconOnline);
|
||||
app.component('FontIcon', FontIcon);
|
||||
|
||||
app.component("Auth", Auth);
|
||||
app.component("Perms", Perms);
|
||||
app.component('Auth', Auth);
|
||||
app.component('Perms', Perms);
|
||||
|
||||
app.use(VueTippy);
|
||||
|
||||
getPlatformConfig(app).then(async config => {
|
||||
setupStore(app);
|
||||
app.use(router);
|
||||
await router.isReady();
|
||||
injectResponsiveStorage(app, config);
|
||||
app
|
||||
.use(MotionPlugin)
|
||||
.use(useElementPlus)
|
||||
.use(Table)
|
||||
// .use(PureDescriptions)
|
||||
.use(useEcharts);
|
||||
app.mount("#app");
|
||||
setupStore(app);
|
||||
app.use(router);
|
||||
await router.isReady();
|
||||
injectResponsiveStorage(app, config);
|
||||
app
|
||||
.use(MotionPlugin)
|
||||
.use(useElementPlus)
|
||||
.use(Table)
|
||||
.use(VxeUITable)
|
||||
// .use(PureDescriptions)
|
||||
.use(useEcharts);
|
||||
app.mount('#app');
|
||||
});
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
export const columns = [
|
||||
{ prop: 'id', label: 'id' },
|
||||
{ prop: 'name', label: 'name' },
|
||||
{ prop: 'nickname', label: 'nickname' },
|
||||
{ prop: 'role', label: 'role' },
|
||||
{ prop: 'sex', label: 'sex' },
|
||||
{ prop: 'age', label: 'age' },
|
||||
{ prop: 'address', label: 'address' },
|
||||
];
|
|
@ -1,66 +1,264 @@
|
|||
<script setup lang="ts">
|
||||
import { initRouter } from "@/router/utils";
|
||||
import { storageLocal } from "@pureadmin/utils";
|
||||
import { type CSSProperties, ref, computed } from "vue";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||
<script lang="ts" setup>
|
||||
import { initRouter } from '@/router/utils';
|
||||
import { storageLocal } from '@pureadmin/utils';
|
||||
import { computed, type CSSProperties, ref } from 'vue';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { usePermissionStoreHook } from '@/store/modules/permission';
|
||||
import TablePlusVxeBar from '@/components/TableBar/src/TablePlusVxeBar.vue';
|
||||
import { columns } from '@/views/permission/page/columns';
|
||||
|
||||
defineOptions({
|
||||
name: "PermissionPage"
|
||||
name: 'PermissionPage',
|
||||
});
|
||||
|
||||
const elStyle = computed((): CSSProperties => {
|
||||
return {
|
||||
width: "85vw",
|
||||
justifyContent: "start"
|
||||
};
|
||||
return {
|
||||
width: '85vw',
|
||||
justifyContent: 'start',
|
||||
};
|
||||
});
|
||||
|
||||
const username = ref(useUserStoreHook()?.username);
|
||||
|
||||
const options = [
|
||||
{
|
||||
value: "admin",
|
||||
label: "管理员角色"
|
||||
},
|
||||
{
|
||||
value: "common",
|
||||
label: "普通角色"
|
||||
}
|
||||
{
|
||||
value: 'admin',
|
||||
label: '管理员角色',
|
||||
},
|
||||
{
|
||||
value: 'common',
|
||||
label: '普通角色',
|
||||
},
|
||||
];
|
||||
|
||||
function onChange() {
|
||||
useUserStoreHook()
|
||||
.loginByUsername({ username: username.value, password: "admin123" })
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
storageLocal().removeItem("async-routes");
|
||||
usePermissionStoreHook().clearAllCachePage();
|
||||
initRouter();
|
||||
}
|
||||
});
|
||||
useUserStoreHook()
|
||||
.loginByUsername({ username: username.value, password: 'admin123' })
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
storageLocal().removeItem('async-routes');
|
||||
usePermissionStoreHook().clearAllCachePage();
|
||||
initRouter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const dataList = [
|
||||
{
|
||||
id: 10001,
|
||||
name: 'Test1',
|
||||
nickname: 'T1',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 28,
|
||||
address: 'Shenzhen',
|
||||
},
|
||||
{
|
||||
id: 10002,
|
||||
name: 'Test2',
|
||||
nickname: 'T2',
|
||||
role: 'Test',
|
||||
sex: 'Women',
|
||||
age: 22,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 10003,
|
||||
name: 'Test3',
|
||||
nickname: 'T3',
|
||||
role: 'PM',
|
||||
sex: 'Man',
|
||||
age: 32,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 10004,
|
||||
name: 'Test4',
|
||||
nickname: 'T4',
|
||||
role: 'Designer',
|
||||
sex: 'Women',
|
||||
age: 23,
|
||||
address: 'test abc',
|
||||
},
|
||||
{
|
||||
id: 10005,
|
||||
name: 'Test5',
|
||||
nickname: 'T5',
|
||||
role: 'Develop',
|
||||
sex: 'Women',
|
||||
age: 30,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 10006,
|
||||
name: 'Test6',
|
||||
nickname: 'T6',
|
||||
role: 'Designer',
|
||||
sex: 'Women',
|
||||
age: 21,
|
||||
address: 'Shenzhen',
|
||||
},
|
||||
{
|
||||
id: 10007,
|
||||
name: 'Test7',
|
||||
nickname: 'T7',
|
||||
role: 'Test',
|
||||
sex: 'Man',
|
||||
age: 29,
|
||||
address: 'Shenzhen',
|
||||
},
|
||||
{
|
||||
id: 10008,
|
||||
name: 'Test8',
|
||||
nickname: 'T8',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 35,
|
||||
address: 'test abc',
|
||||
},
|
||||
{
|
||||
id: 10009,
|
||||
name: 'Test9',
|
||||
nickname: 'T9',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 35,
|
||||
address: 'Shenzhen',
|
||||
},
|
||||
{
|
||||
id: 100010,
|
||||
name: 'Test10',
|
||||
nickname: 'T10',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 35,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100011,
|
||||
name: 'Test11',
|
||||
nickname: 'T11',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 49,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100012,
|
||||
name: 'Test12',
|
||||
nickname: 'T12',
|
||||
role: 'Develop',
|
||||
sex: 'Women',
|
||||
age: 45,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 100013,
|
||||
name: 'Test13',
|
||||
nickname: 'T13',
|
||||
role: 'Test',
|
||||
sex: 'Women',
|
||||
age: 35,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100014,
|
||||
name: 'Test14',
|
||||
nickname: 'T14',
|
||||
role: 'Test',
|
||||
sex: 'Man',
|
||||
age: 29,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 100015,
|
||||
name: 'Test15',
|
||||
nickname: 'T15',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 39,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100016,
|
||||
name: 'Test16',
|
||||
nickname: 'T16',
|
||||
role: 'Test',
|
||||
sex: 'Women',
|
||||
age: 35,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100017,
|
||||
name: 'Test17',
|
||||
nickname: 'T17',
|
||||
role: 'Test',
|
||||
sex: 'Man',
|
||||
age: 39,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 100018,
|
||||
name: 'Test18',
|
||||
nickname: 'T18',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 44,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100019,
|
||||
name: 'Test19',
|
||||
nickname: 'T19',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 39,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100020,
|
||||
name: 'Test20',
|
||||
nickname: 'T20',
|
||||
role: 'Test',
|
||||
sex: 'Women',
|
||||
age: 35,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
{
|
||||
id: 100021,
|
||||
name: 'Test21',
|
||||
nickname: 'T21',
|
||||
role: 'Test',
|
||||
sex: 'Man',
|
||||
age: 39,
|
||||
address: 'Shanghai',
|
||||
},
|
||||
{
|
||||
id: 100022,
|
||||
name: 'Test22',
|
||||
nickname: 'T22',
|
||||
role: 'Develop',
|
||||
sex: 'Man',
|
||||
age: 44,
|
||||
address: 'Guangzhou',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p class="mb-2">
|
||||
模拟后台根据不同角色返回对应路由,观察左侧菜单变化(管理员角色可查看系统管理菜单、普通角色不可查看系统管理菜单)
|
||||
</p>
|
||||
<el-card shadow="never" :style="elStyle">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>当前角色:{{ username }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-select v-model="username" class="!w-[160px]" @change="onChange">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-card>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-2">模拟后台根据不同角色返回对应路由,观察左侧菜单变化(管理员角色可查看系统管理菜单、普通角色不可查看系统管理菜单)</p>
|
||||
<el-card :style="elStyle" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>当前角色:{{ username }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-select v-model="username" class="!w-[160px]" @change="onChange">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-card>
|
||||
|
||||
<TablePlusVxeBar :column="columns" :data-list="dataList" :loading="false" />
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
import type { Directive } from "vue";
|
||||
import type { CopyEl, OptimizeOptions, RippleOptions } from "@/directives";
|
||||
import type { Directive } from 'vue';
|
||||
import type { CopyEl, OptimizeOptions, RippleOptions } from '@/directives';
|
||||
|
||||
declare module "vue" {
|
||||
export interface ComponentCustomProperties {
|
||||
/** `Loading` 动画加载指令,具体看:https://element-plus.org/zh-CN/component/loading.html#%E6%8C%87%E4%BB%A4 */
|
||||
vLoading: Directive<Element, boolean>;
|
||||
/** 按钮权限指令(根据路由`meta`中的`auths`字段进行判断)*/
|
||||
vAuth: Directive<HTMLElement, string | Array<string>>;
|
||||
/** 文本复制指令(默认双击复制) */
|
||||
vCopy: Directive<CopyEl, string>;
|
||||
/** 长按指令 */
|
||||
vLongpress: Directive<HTMLElement, Function>;
|
||||
/** 防抖、节流指令 */
|
||||
vOptimize: Directive<HTMLElement, OptimizeOptions>;
|
||||
/** 按钮权限指令(根据登录接口返回的`permissions`字段进行判断)*/
|
||||
vPerms: Directive<HTMLElement, string | Array<string>>;
|
||||
/**
|
||||
* `v-ripple`指令,用法如下:
|
||||
* 1. `v-ripple`代表启用基本的`ripple`功能
|
||||
* 2. `v-ripple="{ class: 'text-red' }"`代表自定义`ripple`颜色,支持`tailwindcss`,生效样式是`color`
|
||||
* 3. `v-ripple.center`代表从中心扩散
|
||||
*/
|
||||
vRipple: Directive<HTMLElement, RippleOptions>;
|
||||
}
|
||||
declare module 'vue' {
|
||||
export interface ComponentCustomProperties {
|
||||
/** `Loading` 动画加载指令,具体看:https://element-plus.org/zh-CN/component/loading.html#%E6%8C%87%E4%BB%A4 */
|
||||
vLoading: Directive<Element, boolean>;
|
||||
/** 按钮权限指令(根据路由`meta`中的`auths`字段进行判断)*/
|
||||
vAuth: Directive<HTMLElement, string | Array<string>>;
|
||||
/** 文本复制指令(默认双击复制) */
|
||||
vCopy: Directive<CopyEl, string>;
|
||||
/** 长按指令 */
|
||||
vLongpress: Directive<HTMLElement, Function>;
|
||||
/** 防抖、节流指令 */
|
||||
vOptimize: Directive<HTMLElement, OptimizeOptions>;
|
||||
/** 按钮权限指令(根据登录接口返回的`permissions`字段进行判断)*/
|
||||
vPerms: Directive<HTMLElement, string | Array<string>>;
|
||||
/**
|
||||
* `v-ripple`指令,用法如下:
|
||||
* 1. `v-ripple`代表启用基本的`ripple`功能
|
||||
* 2. `v-ripple="{ class: 'text-red' }"`代表自定义`ripple`颜色,支持`tailwindcss`,生效样式是`color`
|
||||
* 3. `v-ripple.center`代表从中心扩散
|
||||
*/
|
||||
vRipple: Directive<HTMLElement, RippleOptions>;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// 默认option选项
|
||||
export interface Option {
|
||||
value: string | number | boolean | undefined;
|
||||
label: string | undefined;
|
||||
}
|
||||
|
||||
// 属性结构
|
||||
export interface TreeData {
|
||||
value: string;
|
||||
label: string;
|
||||
children?: TreeData[];
|
||||
}
|
|
@ -1,193 +1,186 @@
|
|||
import type { ECharts } from "echarts";
|
||||
import type { TableColumns } from "@pureadmin/table";
|
||||
import type { ECharts } from 'echarts';
|
||||
import type { TableColumns } from '@pureadmin/table';
|
||||
|
||||
/**
|
||||
* 全局类型声明,无需引入直接在 `.vue` 、`.ts` 、`.tsx` 文件使用即可获得类型提示
|
||||
*/
|
||||
declare global {
|
||||
/**
|
||||
* 平台的名称、版本、运行所需的`node`和`pnpm`版本、依赖、最后构建时间的类型提示
|
||||
*/
|
||||
const __APP_INFO__: {
|
||||
pkg: {
|
||||
name: string;
|
||||
version: string;
|
||||
engines: {
|
||||
node: string;
|
||||
pnpm: string;
|
||||
};
|
||||
dependencies: Recordable<string>;
|
||||
devDependencies: Recordable<string>;
|
||||
};
|
||||
lastBuildTime: string;
|
||||
};
|
||||
/**
|
||||
* 平台的名称、版本、运行所需的`node`和`pnpm`版本、依赖、最后构建时间的类型提示
|
||||
*/
|
||||
const __APP_INFO__: {
|
||||
pkg: {
|
||||
name: string;
|
||||
version: string;
|
||||
engines: {
|
||||
node: string;
|
||||
pnpm: string;
|
||||
};
|
||||
dependencies: Recordable<string>;
|
||||
devDependencies: Recordable<string>;
|
||||
};
|
||||
lastBuildTime: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window 的类型提示
|
||||
*/
|
||||
interface Window {
|
||||
// Global vue app instance
|
||||
__APP__: App<Element>;
|
||||
webkitCancelAnimationFrame: (handle: number) => void;
|
||||
mozCancelAnimationFrame: (handle: number) => void;
|
||||
oCancelAnimationFrame: (handle: number) => void;
|
||||
msCancelAnimationFrame: (handle: number) => void;
|
||||
webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
}
|
||||
/**
|
||||
* Window 的类型提示
|
||||
*/
|
||||
interface Window {
|
||||
// Global vue app instance
|
||||
__APP__: App<Element>;
|
||||
webkitCancelAnimationFrame: (handle: number) => void;
|
||||
mozCancelAnimationFrame: (handle: number) => void;
|
||||
oCancelAnimationFrame: (handle: number) => void;
|
||||
msCancelAnimationFrame: (handle: number) => void;
|
||||
webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document 的类型提示
|
||||
*/
|
||||
interface Document {
|
||||
webkitFullscreenElement?: Element;
|
||||
mozFullScreenElement?: Element;
|
||||
msFullscreenElement?: Element;
|
||||
}
|
||||
/**
|
||||
* Document 的类型提示
|
||||
*/
|
||||
interface Document {
|
||||
webkitFullscreenElement?: Element;
|
||||
mozFullScreenElement?: Element;
|
||||
msFullscreenElement?: Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打包压缩格式的类型声明
|
||||
*/
|
||||
type ViteCompression =
|
||||
| "none"
|
||||
| "gzip"
|
||||
| "brotli"
|
||||
| "both"
|
||||
| "gzip-clear"
|
||||
| "brotli-clear"
|
||||
| "both-clear";
|
||||
/**
|
||||
* 打包压缩格式的类型声明
|
||||
*/
|
||||
type ViteCompression = 'none' | 'gzip' | 'brotli' | 'both' | 'gzip-clear' | 'brotli-clear' | 'both-clear';
|
||||
|
||||
/**
|
||||
* 全局自定义环境变量的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
|
||||
*/
|
||||
interface ViteEnv {
|
||||
VITE_PORT: number;
|
||||
VITE_PUBLIC_PATH: string;
|
||||
VITE_ROUTER_HISTORY: string;
|
||||
VITE_CDN: boolean;
|
||||
VITE_HIDE_HOME: string;
|
||||
VITE_COMPRESSION: ViteCompression;
|
||||
}
|
||||
/**
|
||||
* 全局自定义环境变量的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
|
||||
*/
|
||||
interface ViteEnv {
|
||||
VITE_PORT: number;
|
||||
VITE_PUBLIC_PATH: string;
|
||||
VITE_ROUTER_HISTORY: string;
|
||||
VITE_CDN: boolean;
|
||||
VITE_HIDE_HOME: string;
|
||||
VITE_COMPRESSION: ViteCompression;
|
||||
}
|
||||
|
||||
/**
|
||||
* 继承 `@pureadmin/table` 的 `TableColumns` ,方便全局直接调用
|
||||
*/
|
||||
interface TableColumnList extends Array<TableColumns> {}
|
||||
/**
|
||||
* 继承 `@pureadmin/table` 的 `TableColumns` ,方便全局直接调用
|
||||
*/
|
||||
interface TableColumnList extends Array<TableColumns> {}
|
||||
|
||||
/**
|
||||
* 对应 `public/platform-config.json` 文件的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||
*/
|
||||
interface PlatformConfigs {
|
||||
Version?: string;
|
||||
Title?: string;
|
||||
FixedHeader?: boolean;
|
||||
HiddenSideBar?: boolean;
|
||||
MultiTagsCache?: boolean;
|
||||
MaxTagsLevel?: number;
|
||||
KeepAlive?: boolean;
|
||||
Locale?: string;
|
||||
Layout?: string;
|
||||
Theme?: string;
|
||||
DarkMode?: boolean;
|
||||
OverallStyle?: string;
|
||||
Grey?: boolean;
|
||||
Weak?: boolean;
|
||||
HideTabs?: boolean;
|
||||
HideFooter?: boolean;
|
||||
Stretch?: boolean | number;
|
||||
SidebarStatus?: boolean;
|
||||
EpThemeColor?: string;
|
||||
ShowLogo?: boolean;
|
||||
ShowModel?: string;
|
||||
MenuArrowIconNoTransition?: boolean;
|
||||
CachingAsyncRoutes?: boolean;
|
||||
TooltipEffect?: Effect;
|
||||
ResponsiveStorageNameSpace?: string;
|
||||
MenuSearchHistory?: number;
|
||||
}
|
||||
/**
|
||||
* 对应 `public/platform-config.json` 文件的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||
*/
|
||||
interface PlatformConfigs {
|
||||
Version?: string;
|
||||
Title?: string;
|
||||
FixedHeader?: boolean;
|
||||
HiddenSideBar?: boolean;
|
||||
MultiTagsCache?: boolean;
|
||||
MaxTagsLevel?: number;
|
||||
KeepAlive?: boolean;
|
||||
Locale?: string;
|
||||
Layout?: string;
|
||||
Theme?: string;
|
||||
DarkMode?: boolean;
|
||||
OverallStyle?: string;
|
||||
Grey?: boolean;
|
||||
Weak?: boolean;
|
||||
HideTabs?: boolean;
|
||||
HideFooter?: boolean;
|
||||
Stretch?: boolean | number;
|
||||
SidebarStatus?: boolean;
|
||||
EpThemeColor?: string;
|
||||
ShowLogo?: boolean;
|
||||
ShowModel?: string;
|
||||
MenuArrowIconNoTransition?: boolean;
|
||||
CachingAsyncRoutes?: boolean;
|
||||
TooltipEffect?: Effect;
|
||||
ResponsiveStorageNameSpace?: string;
|
||||
MenuSearchHistory?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 与 `PlatformConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||
*/
|
||||
interface StorageConfigs {
|
||||
version?: string;
|
||||
title?: string;
|
||||
fixedHeader?: boolean;
|
||||
hiddenSideBar?: boolean;
|
||||
multiTagsCache?: boolean;
|
||||
keepAlive?: boolean;
|
||||
locale?: string;
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
darkMode?: boolean;
|
||||
grey?: boolean;
|
||||
weak?: boolean;
|
||||
hideTabs?: boolean;
|
||||
hideFooter?: boolean;
|
||||
sidebarStatus?: boolean;
|
||||
epThemeColor?: string;
|
||||
themeColor?: string;
|
||||
overallStyle?: string;
|
||||
showLogo?: boolean;
|
||||
showModel?: string;
|
||||
menuSearchHistory?: number;
|
||||
username?: string;
|
||||
}
|
||||
/**
|
||||
* 与 `PlatformConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明
|
||||
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||
*/
|
||||
interface StorageConfigs {
|
||||
version?: string;
|
||||
title?: string;
|
||||
fixedHeader?: boolean;
|
||||
hiddenSideBar?: boolean;
|
||||
multiTagsCache?: boolean;
|
||||
keepAlive?: boolean;
|
||||
locale?: string;
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
darkMode?: boolean;
|
||||
grey?: boolean;
|
||||
weak?: boolean;
|
||||
hideTabs?: boolean;
|
||||
hideFooter?: boolean;
|
||||
sidebarStatus?: boolean;
|
||||
epThemeColor?: string;
|
||||
themeColor?: string;
|
||||
overallStyle?: string;
|
||||
showLogo?: boolean;
|
||||
showModel?: string;
|
||||
menuSearchHistory?: number;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* `responsive-storage` 本地响应式 `storage` 的类型声明
|
||||
*/
|
||||
interface ResponsiveStorage {
|
||||
locale: {
|
||||
locale?: string;
|
||||
};
|
||||
layout: {
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
darkMode?: boolean;
|
||||
sidebarStatus?: boolean;
|
||||
epThemeColor?: string;
|
||||
themeColor?: string;
|
||||
overallStyle?: string;
|
||||
};
|
||||
configure: {
|
||||
grey?: boolean;
|
||||
weak?: boolean;
|
||||
hideTabs?: boolean;
|
||||
hideFooter?: boolean;
|
||||
showLogo?: boolean;
|
||||
showModel?: string;
|
||||
multiTagsCache?: boolean;
|
||||
stretch?: boolean | number;
|
||||
};
|
||||
tags?: Array<any>;
|
||||
}
|
||||
/**
|
||||
* `responsive-storage` 本地响应式 `storage` 的类型声明
|
||||
*/
|
||||
interface ResponsiveStorage {
|
||||
locale: {
|
||||
locale?: string;
|
||||
};
|
||||
layout: {
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
darkMode?: boolean;
|
||||
sidebarStatus?: boolean;
|
||||
epThemeColor?: string;
|
||||
themeColor?: string;
|
||||
overallStyle?: string;
|
||||
};
|
||||
configure: {
|
||||
grey?: boolean;
|
||||
weak?: boolean;
|
||||
hideTabs?: boolean;
|
||||
hideFooter?: boolean;
|
||||
showLogo?: boolean;
|
||||
showModel?: string;
|
||||
multiTagsCache?: boolean;
|
||||
stretch?: boolean | number;
|
||||
};
|
||||
tags?: Array<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台里所有组件实例都能访问到的全局属性对象的类型声明
|
||||
*/
|
||||
interface GlobalPropertiesApi {
|
||||
$echarts: ECharts;
|
||||
$storage: ResponsiveStorage;
|
||||
$config: PlatformConfigs;
|
||||
}
|
||||
/**
|
||||
* 平台里所有组件实例都能访问到的全局属性对象的类型声明
|
||||
*/
|
||||
interface GlobalPropertiesApi {
|
||||
$echarts: ECharts;
|
||||
$storage: ResponsiveStorage;
|
||||
$config: PlatformConfigs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩展 `Element`
|
||||
*/
|
||||
interface Element {
|
||||
// v-ripple 作用于 src/directives/ripple/index.ts 文件
|
||||
_ripple?: {
|
||||
enabled?: boolean;
|
||||
centered?: boolean;
|
||||
class?: string;
|
||||
circle?: boolean;
|
||||
touched?: boolean;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 扩展 `Element`
|
||||
*/
|
||||
interface Element {
|
||||
// v-ripple 作用于 src/directives/ripple/index.ts 文件
|
||||
_ripple?: {
|
||||
enabled?: boolean;
|
||||
centered?: boolean;
|
||||
class?: string;
|
||||
circle?: boolean;
|
||||
touched?: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,14 @@ type RefType<T> = T | null;
|
|||
|
||||
type EmitType = (event: string, ...args: any[]) => void;
|
||||
|
||||
type TargetContext = "_self" | "_blank";
|
||||
type TargetContext = '_self' | '_blank';
|
||||
|
||||
type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
||||
ComponentElRef<T> | null;
|
||||
type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
|
||||
|
||||
type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||
|
||||
type ForDataType<T> = {
|
||||
[P in T]?: ForDataType<T[P]>;
|
||||
[P in T]?: ForDataType<T[P]>;
|
||||
};
|
||||
|
||||
type AnyFunction<T> = (...args: any[]) => T;
|
||||
|
@ -20,7 +19,7 @@ type AnyFunction<T> = (...args: any[]) => T;
|
|||
type PropType<T> = VuePropType<T>;
|
||||
|
||||
type Writable<T> = {
|
||||
-readonly [P in keyof T]: T[P];
|
||||
-readonly [P in keyof T]: T[P];
|
||||
};
|
||||
|
||||
type Nullable<T> = T | null;
|
||||
|
@ -30,15 +29,15 @@ type NonNullable<T> = T extends null | undefined ? never : T;
|
|||
type Recordable<T = any> = Record<string, T>;
|
||||
|
||||
type ReadonlyRecordable<T = any> = {
|
||||
readonly [key: string]: T;
|
||||
readonly [key: string]: T;
|
||||
};
|
||||
|
||||
type Indexable<T = any> = {
|
||||
[key: string]: T;
|
||||
[key: string]: T;
|
||||
};
|
||||
|
||||
type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
|
||||
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
||||
|
@ -49,30 +48,30 @@ type TimeoutHandle = ReturnType<typeof setTimeout>;
|
|||
|
||||
type IntervalHandle = ReturnType<typeof setInterval>;
|
||||
|
||||
type Effect = "light" | "dark";
|
||||
type Effect = 'light' | 'dark';
|
||||
|
||||
interface ChangeEvent extends Event {
|
||||
target: HTMLInputElement;
|
||||
target: HTMLInputElement;
|
||||
}
|
||||
|
||||
interface WheelEvent {
|
||||
path?: EventTarget[];
|
||||
path?: EventTarget[];
|
||||
}
|
||||
|
||||
interface ImportMetaEnv extends ViteEnv {
|
||||
__: unknown;
|
||||
__: unknown;
|
||||
}
|
||||
|
||||
interface Fn<T = any, R = T> {
|
||||
(...arg: T[]): R;
|
||||
(...arg: T[]): R;
|
||||
}
|
||||
|
||||
interface PromiseFn<T = any, R = T> {
|
||||
(...arg: T[]): Promise<R>;
|
||||
(...arg: T[]): Promise<R>;
|
||||
}
|
||||
|
||||
interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||
$el: T;
|
||||
$el: T;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// 分页参数接口
|
||||
export interface Pagination {
|
||||
currentPage: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
pageSizes: number[];
|
||||
}
|
|
@ -1,108 +1,108 @@
|
|||
// 全局路由类型声明
|
||||
|
||||
import type { RouteComponent, RouteLocationNormalized } from "vue-router";
|
||||
import type { FunctionalComponent } from "vue";
|
||||
import type { RouteComponent, RouteLocationNormalized } from 'vue-router';
|
||||
import type { FunctionalComponent } from 'vue';
|
||||
|
||||
declare global {
|
||||
interface ToRouteType extends RouteLocationNormalized {
|
||||
meta: CustomizeRouteMeta;
|
||||
}
|
||||
interface ToRouteType extends RouteLocationNormalized {
|
||||
meta: CustomizeRouteMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 完整子路由的`meta`配置表
|
||||
*/
|
||||
interface CustomizeRouteMeta {
|
||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
||||
title: string;
|
||||
/** 菜单图标 `可选` */
|
||||
icon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 菜单名称右侧的额外图标 */
|
||||
extraIcon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||
showLink?: boolean;
|
||||
/** 是否显示父级菜单 `可选` */
|
||||
showParent?: boolean;
|
||||
/** 页面级别权限设置 `可选` */
|
||||
roles?: Array<string>;
|
||||
/** 按钮级别权限设置 `可选` */
|
||||
auths?: Array<string>;
|
||||
/** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
|
||||
keepAlive?: boolean;
|
||||
/** 内嵌的`iframe`链接 `可选` */
|
||||
frameSrc?: string;
|
||||
/** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
|
||||
frameLoading?: boolean;
|
||||
/** 页面加载动画(两种模式,第二种权重更高,第一种直接采用`vue`内置的`transitions`动画,第二种是使用`animate.css`编写进、离场动画,平台更推荐使用第二种模式,已经内置了`animate.css`,直接写对应的动画名即可)`可选` */
|
||||
transition?: {
|
||||
/**
|
||||
* @description 当前路由动画效果
|
||||
* @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
|
||||
* @see animate.css {@link https://animate.style}
|
||||
*/
|
||||
name?: string;
|
||||
/** 进场动画 */
|
||||
enterTransition?: string;
|
||||
/** 离场动画 */
|
||||
leaveTransition?: string;
|
||||
};
|
||||
/** 当前菜单名称或自定义信息禁止添加到标签页(默认`false`) */
|
||||
hiddenTag?: boolean;
|
||||
/** 当前菜单名称是否固定显示在标签页且不可关闭(默认`false`) */
|
||||
fixedTag?: boolean;
|
||||
/** 动态路由可打开的最大数量 `可选` */
|
||||
dynamicLevel?: number;
|
||||
/** 将某个菜单激活
|
||||
* (主要用于通过`query`或`params`传参的路由,当它们通过配置`showLink: false`后不在菜单中显示,就不会有任何菜单高亮,
|
||||
* 而通过设置`activePath`指定激活菜单即可获得高亮,`activePath`为指定激活菜单的`path`)
|
||||
*/
|
||||
activePath?: string;
|
||||
}
|
||||
/**
|
||||
* @description 完整子路由的`meta`配置表
|
||||
*/
|
||||
interface CustomizeRouteMeta {
|
||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
||||
title: string;
|
||||
/** 菜单图标 `可选` */
|
||||
icon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 菜单名称右侧的额外图标 */
|
||||
extraIcon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||
showLink?: boolean;
|
||||
/** 是否显示父级菜单 `可选` */
|
||||
showParent?: boolean;
|
||||
/** 页面级别权限设置 `可选` */
|
||||
roles?: Array<string>;
|
||||
/** 按钮级别权限设置 `可选` */
|
||||
auths?: Array<string>;
|
||||
/** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
|
||||
keepAlive?: boolean;
|
||||
/** 内嵌的`iframe`链接 `可选` */
|
||||
frameSrc?: string;
|
||||
/** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
|
||||
frameLoading?: boolean;
|
||||
/** 页面加载动画(两种模式,第二种权重更高,第一种直接采用`vue`内置的`transitions`动画,第二种是使用`animate.css`编写进、离场动画,平台更推荐使用第二种模式,已经内置了`animate.css`,直接写对应的动画名即可)`可选` */
|
||||
transition?: {
|
||||
/**
|
||||
* @description 当前路由动画效果
|
||||
* @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
|
||||
* @see animate.css {@link https://animate.style}
|
||||
*/
|
||||
name?: string;
|
||||
/** 进场动画 */
|
||||
enterTransition?: string;
|
||||
/** 离场动画 */
|
||||
leaveTransition?: string;
|
||||
};
|
||||
/** 当前菜单名称或自定义信息禁止添加到标签页(默认`false`) */
|
||||
hiddenTag?: boolean;
|
||||
/** 当前菜单名称是否固定显示在标签页且不可关闭(默认`false`) */
|
||||
fixedTag?: boolean;
|
||||
/** 动态路由可打开的最大数量 `可选` */
|
||||
dynamicLevel?: number;
|
||||
/** 将某个菜单激活
|
||||
* (主要用于通过`query`或`params`传参的路由,当它们通过配置`showLink: false`后不在菜单中显示,就不会有任何菜单高亮,
|
||||
* 而通过设置`activePath`指定激活菜单即可获得高亮,`activePath`为指定激活菜单的`path`)
|
||||
*/
|
||||
activePath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 完整子路由配置表
|
||||
*/
|
||||
interface RouteChildrenConfigsTable {
|
||||
/** 子路由地址 `必填` */
|
||||
path: string;
|
||||
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
||||
name?: string;
|
||||
/** 路由重定向 `可选` */
|
||||
redirect?: string;
|
||||
/** 按需加载组件 `可选` */
|
||||
component?: RouteComponent;
|
||||
meta?: CustomizeRouteMeta;
|
||||
/** 子路由配置项 */
|
||||
children?: Array<RouteChildrenConfigsTable>;
|
||||
}
|
||||
/**
|
||||
* @description 完整子路由配置表
|
||||
*/
|
||||
interface RouteChildrenConfigsTable {
|
||||
/** 子路由地址 `必填` */
|
||||
path: string;
|
||||
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
||||
name?: string;
|
||||
/** 路由重定向 `可选` */
|
||||
redirect?: string;
|
||||
/** 按需加载组件 `可选` */
|
||||
component?: RouteComponent;
|
||||
meta?: CustomizeRouteMeta;
|
||||
/** 子路由配置项 */
|
||||
children?: Array<RouteChildrenConfigsTable>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 整体路由配置表(包括完整子路由)
|
||||
*/
|
||||
interface RouteConfigsTable {
|
||||
/** 路由地址 `必填` */
|
||||
path: string;
|
||||
/** 路由名字(保持唯一)`可选` */
|
||||
name?: string;
|
||||
/** `Layout`组件 `可选` */
|
||||
component?: RouteComponent;
|
||||
/** 路由重定向 `可选` */
|
||||
redirect?: string;
|
||||
meta?: {
|
||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
|
||||
title: string;
|
||||
/** 菜单图标 `可选` */
|
||||
icon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||
showLink?: boolean;
|
||||
/** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
|
||||
rank?: number;
|
||||
};
|
||||
/** 子路由配置项 */
|
||||
children?: Array<RouteChildrenConfigsTable>;
|
||||
}
|
||||
/**
|
||||
* @description 整体路由配置表(包括完整子路由)
|
||||
*/
|
||||
interface RouteConfigsTable {
|
||||
/** 路由地址 `必填` */
|
||||
path: string;
|
||||
/** 路由名字(保持唯一)`可选` */
|
||||
name?: string;
|
||||
/** `Layout`组件 `可选` */
|
||||
component?: RouteComponent;
|
||||
/** 路由重定向 `可选` */
|
||||
redirect?: string;
|
||||
meta?: {
|
||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
|
||||
title: string;
|
||||
/** 菜单图标 `可选` */
|
||||
icon?: string | FunctionalComponent | IconifyIcon;
|
||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||
showLink?: boolean;
|
||||
/** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
|
||||
rank?: number;
|
||||
};
|
||||
/** 子路由配置项 */
|
||||
children?: Array<RouteChildrenConfigsTable>;
|
||||
}
|
||||
}
|
||||
|
||||
// https://router.vuejs.org/zh/guide/advanced/meta.html#typescript
|
||||
declare module "vue-router" {
|
||||
interface RouteMeta extends CustomizeRouteMeta {}
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends CustomizeRouteMeta {}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
import type { VNode } from "vue";
|
||||
import type Vue from "vue";
|
||||
import type Vue, { VNode } from 'vue';
|
||||
|
||||
declare module "*.tsx" {
|
||||
import Vue from "compatible-vue";
|
||||
export default Vue;
|
||||
declare module '*.tsx' {
|
||||
import Vue from 'compatible-vue';
|
||||
export default Vue;
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface Element extends VNode {}
|
||||
interface ElementClass extends Vue {}
|
||||
interface ElementAttributesProperty {
|
||||
$props: any;
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
namespace JSX {
|
||||
interface Element extends VNode {}
|
||||
|
||||
interface ElementClass extends Vue {}
|
||||
|
||||
interface ElementAttributesProperty {
|
||||
$props: any;
|
||||
}
|
||||
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
|
||||
interface IntrinsicAttributes {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
declare module "*.vue" {
|
||||
import type { DefineComponent } from "vue";
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue';
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
}
|
||||
|
||||
declare module "*.scss" {
|
||||
const scss: Record<string, string>;
|
||||
export default scss;
|
||||
declare module '*.scss' {
|
||||
const scss: Record<string, string>;
|
||||
export default scss;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// 返回响应内容
|
||||
export interface Result<T> {
|
||||
code: number;
|
||||
data: T;
|
||||
message: string;
|
||||
}
|
|
@ -1,32 +1,31 @@
|
|||
import { getPluginsList } from "./build/plugins";
|
||||
import { exclude, include } from "./build/optimize";
|
||||
import { type ConfigEnv, loadEnv, type UserConfigExport } from "vite";
|
||||
import { __APP_INFO__, alias, root, wrapperEnv } from "./build/utils";
|
||||
import { serverOptions } from "./build/server";
|
||||
import { buildEnvironment } from "./build/buildEnv";
|
||||
import { getPluginsList } from './build/plugins';
|
||||
import { exclude, include } from './build/optimize';
|
||||
import { type ConfigEnv, loadEnv, type UserConfigExport } from 'vite';
|
||||
import { __APP_INFO__, alias, root, wrapperEnv } from './build/utils';
|
||||
import { serverOptions } from './build/server';
|
||||
import { buildEnvironment } from './build/buildEnv';
|
||||
|
||||
export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } =
|
||||
wrapperEnv(loadEnv(mode, root));
|
||||
return {
|
||||
base: VITE_PUBLIC_PATH,
|
||||
root,
|
||||
resolve: { alias },
|
||||
// 服务端渲染
|
||||
server: serverOptions(mode),
|
||||
plugins: getPluginsList(VITE_CDN, VITE_COMPRESSION, VITE_PORT),
|
||||
// https://cn.vitejs.dev/config/dep-optimization-options.html#dep-optimization-options
|
||||
optimizeDeps: { include, exclude },
|
||||
esbuild: {
|
||||
pure: ["console.log", "debugger"],
|
||||
jsxFactory: "h",
|
||||
jsxFragment: "Fragment",
|
||||
jsxInject: "import { h } from 'vue';"
|
||||
},
|
||||
build: buildEnvironment(),
|
||||
define: {
|
||||
__INTLIFY_PROD_DEVTOOLS__: false,
|
||||
__APP_INFO__: JSON.stringify(__APP_INFO__)
|
||||
}
|
||||
};
|
||||
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } = wrapperEnv(loadEnv(mode, root));
|
||||
return {
|
||||
base: VITE_PUBLIC_PATH,
|
||||
root,
|
||||
resolve: { alias },
|
||||
// 服务端渲染
|
||||
server: serverOptions(mode),
|
||||
plugins: getPluginsList(VITE_CDN, VITE_COMPRESSION, VITE_PORT),
|
||||
// https://cn.vitejs.dev/config/dep-optimization-options.html#dep-optimization-options
|
||||
optimizeDeps: { include, exclude },
|
||||
esbuild: {
|
||||
pure: ['console.log', 'debugger'],
|
||||
jsxFactory: 'h',
|
||||
jsxFragment: 'Fragment',
|
||||
jsxInject: "import { h } from 'vue';",
|
||||
},
|
||||
build: buildEnvironment(),
|
||||
define: {
|
||||
__INTLIFY_PROD_DEVTOOLS__: false,
|
||||
__APP_INFO__: JSON.stringify(__APP_INFO__),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue