zyf-model-engine 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.editorconfig +15 -0
  2. package/.env +13 -0
  3. package/.env.development +20 -0
  4. package/.env.production +25 -0
  5. package/.env.test +25 -0
  6. package/.eslintignore +15 -0
  7. package/.eslintrc-auto-import.json +65 -0
  8. package/.eslintrc.cjs +66 -0
  9. package/.husky/commit-msg +4 -0
  10. package/.husky/pre-commit +5 -0
  11. package/.prettierignore +9 -0
  12. package/.prettierrc.cjs +41 -0
  13. package/.stylelintignore +4 -0
  14. package/.stylelintrc.cjs +40 -0
  15. package/.vscode/extensions.json +14 -0
  16. package/.vscode/settings.json +92 -0
  17. package/CHANGELOG.md +246 -0
  18. package/LICENSE +21 -0
  19. package/README.md +205 -0
  20. package/auto-imports.d.ts +132 -0
  21. package/build/getEnv.ts +46 -0
  22. package/build/plugins.ts +138 -0
  23. package/build/proxy.ts +28 -0
  24. package/commitlint.config.cjs +84 -0
  25. package/components.d.ts +28 -0
  26. package/index.html +105 -0
  27. package/lint-staged.config.cjs +8 -0
  28. package/package.json +108 -0
  29. package/postcss.config.cjs +5 -0
  30. package/public/logo.png +0 -0
  31. package/src/App.vue +16 -0
  32. package/src/api/config/servicePort.ts +3 -0
  33. package/src/api/enums/httpEnum.ts +35 -0
  34. package/src/api/helper/axiosCancel.ts +50 -0
  35. package/src/api/helper/axiosFileCancel.ts +62 -0
  36. package/src/api/helper/checkStatus.ts +97 -0
  37. package/src/api/index.ts +142 -0
  38. package/src/api/interface/index.ts +27 -0
  39. package/src/assets/global-icons/icon-demo.svg +1 -0
  40. package/src/assets/iconfont/iconfont.scss +44 -0
  41. package/src/assets/iconfont/iconfont.ttf +0 -0
  42. package/src/assets/images/empty-img.png +0 -0
  43. package/src/assets/option-icons/add.svg +1 -0
  44. package/src/assets/option-icons/check.svg +1 -0
  45. package/src/assets/option-icons/config.svg +1 -0
  46. package/src/assets/option-icons/del.svg +1 -0
  47. package/src/assets/option-icons/detail.svg +1 -0
  48. package/src/assets/option-icons/edit.svg +2 -0
  49. package/src/assets/option-icons/export.svg +1 -0
  50. package/src/assets/option-icons/folder.svg +1 -0
  51. package/src/assets/option-icons/full-screen.svg +1 -0
  52. package/src/assets/option-icons/more.svg +1 -0
  53. package/src/assets/option-icons/return.svg +1 -0
  54. package/src/assets/option-icons/search.svg +1 -0
  55. package/src/components/CSvgIcon/index.scss +23 -0
  56. package/src/components/CSvgIcon/index.vue +74 -0
  57. package/src/components/CTree/index.scss +48 -0
  58. package/src/components/CTree/index.vue +176 -0
  59. package/src/components/CTree/interface/index.ts +6 -0
  60. package/src/components/Dialog/index.scss +74 -0
  61. package/src/components/Dialog/index.vue +87 -0
  62. package/src/components/Empty/index.scss +16 -0
  63. package/src/components/Empty/index.vue +43 -0
  64. package/src/components/Grid/components/GridItem.vue +68 -0
  65. package/src/components/Grid/index.vue +167 -0
  66. package/src/components/Grid/interface/index.ts +6 -0
  67. package/src/components/Loading/index.scss +67 -0
  68. package/src/components/Loading/index.vue +13 -0
  69. package/src/components/Overflow/index.vue +76 -0
  70. package/src/components/ProTable/components/ColSetting.vue +45 -0
  71. package/src/components/ProTable/components/Pagination.vue +29 -0
  72. package/src/components/ProTable/components/SearchForm/components/SearchFormItem.vue +93 -0
  73. package/src/components/ProTable/components/SearchForm/index.scss +12 -0
  74. package/src/components/ProTable/components/SearchForm/index.vue +91 -0
  75. package/src/components/ProTable/components/TableColumn.vue +56 -0
  76. package/src/components/ProTable/index.scss +14 -0
  77. package/src/components/ProTable/index.vue +274 -0
  78. package/src/components/ProTable/interface/index.ts +86 -0
  79. package/src/components/ScrollBox/index.vue +44 -0
  80. package/src/components/SvgIcon/index.vue +20 -0
  81. package/src/components/Tabs/index.vue +142 -0
  82. package/src/config/index.ts +12 -0
  83. package/src/config/nprogress.ts +12 -0
  84. package/src/config/piniaPersist.ts +19 -0
  85. package/src/config/serviceLoading.ts +45 -0
  86. package/src/enums/httpEnum.ts +24 -0
  87. package/src/hooks/interface/index.ts +32 -0
  88. package/src/hooks/useOnline.ts +27 -0
  89. package/src/hooks/useTable.ts +167 -0
  90. package/src/main.ts +35 -0
  91. package/src/plugins/button/button.vue +56 -0
  92. package/src/plugins/index.js +26 -0
  93. package/src/plugins/index.vue +24 -0
  94. package/src/plugins/msg/msg.vue +56 -0
  95. package/src/stores/commonStore.ts +9 -0
  96. package/src/stores/index.ts +8 -0
  97. package/src/stores/interface/index.ts +1 -0
  98. package/src/styles/common.scss +87 -0
  99. package/src/styles/element.scss +233 -0
  100. package/src/styles/reset.scss +20 -0
  101. package/src/styles/var.scss +2 -0
  102. package/src/typings/global.d.ts +37 -0
  103. package/src/typings/window.d.ts +8 -0
  104. package/src/utils/color.ts +59 -0
  105. package/src/utils/commonUtils.ts +175 -0
  106. package/src/utils/errorHandler.ts +28 -0
  107. package/src/utils/is.ts +147 -0
  108. package/src/utils/layoutUtils.ts +83 -0
  109. package/src/utils/localUtils.ts +42 -0
  110. package/src/utils/serviceDict.ts +9 -0
  111. package/src/vite-env.d.ts +6 -0
  112. package/tsconfig.json +50 -0
  113. package/vite.config.ts +76 -0
@@ -0,0 +1,46 @@
1
+ import path from "path";
2
+
3
+ export function isDevFn(mode: string): boolean {
4
+ return mode === "development";
5
+ }
6
+
7
+ export function isProdFn(mode: string): boolean {
8
+ return mode === "production";
9
+ }
10
+
11
+ export function isTestFn(mode: string): boolean {
12
+ return mode === "test";
13
+ }
14
+
15
+ /**
16
+ * 是否生成包预览
17
+ */
18
+ export function isReportMode(): boolean {
19
+ return process.env.VITE_REPORT === "true";
20
+ }
21
+
22
+ // Read all environment variable configuration files to process.env
23
+ export function wrapperEnv(envConf: Recordable): ViteEnv {
24
+ const ret: any = {};
25
+
26
+ for (const envName of Object.keys(envConf)) {
27
+ let realName = envConf[envName].replace(/\\n/g, "\n");
28
+ realName = realName === "true" ? true : realName === "false" ? false : realName;
29
+ if (envName === "VITE_PORT") realName = Number(realName);
30
+ if (envName === "VITE_PROXY") {
31
+ try {
32
+ realName = JSON.parse(realName);
33
+ } catch (error) {}
34
+ }
35
+ ret[envName] = realName;
36
+ }
37
+ return ret;
38
+ }
39
+
40
+ /**
41
+ * 获取用户根目录
42
+ * @param dir file path
43
+ */
44
+ export function getRootPath(...dir: string[]) {
45
+ return path.resolve(process.cwd(), ...dir);
46
+ }
@@ -0,0 +1,138 @@
1
+ import { resolve } from "path";
2
+ import { PluginOption } from "vite";
3
+ import { VitePWA } from "vite-plugin-pwa";
4
+ import { visualizer } from "rollup-plugin-visualizer";
5
+ import { createHtmlPlugin } from "vite-plugin-html";
6
+ import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
7
+ import AutoImport from "unplugin-auto-import/vite";
8
+ import Components from "unplugin-vue-components/vite";
9
+ // import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
10
+ import vue from "@vitejs/plugin-vue";
11
+ import vueJsx from "@vitejs/plugin-vue-jsx";
12
+ import eslintPlugin from "vite-plugin-eslint";
13
+ import dts from "vite-plugin-dts";
14
+ /**
15
+ * 创建 vite 插件
16
+ * @param viteEnv
17
+ */
18
+ export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
19
+ const { VITE_GLOB_APP_TITLE, VITE_REPORT, VITE_PWA, VITE_USER_NODE_ENV } = viteEnv;
20
+ return [
21
+ vue(),
22
+ dts(),
23
+ // vue 可以使用 jsx/tsx 语法
24
+ vueJsx(),
25
+ AutoImport({
26
+ // 在哪些文件里可以直接引入
27
+ include: [
28
+ /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
29
+ /\.vue$/,
30
+ /\.md$/ // .md
31
+ ],
32
+ // 自动引入哪些包
33
+ imports: [
34
+ // 自动引入整个模块
35
+ "vue",
36
+ {
37
+ "element-plus": ["ElMessage", "ElMessageBox", "ElNotification"], //消息提示/通知
38
+ "@/api/index": ["http", "axiosController", "axiosFileController"], // axios请求api
39
+ "@/utils/validate.ts": [["*", "validate"]], //文本校验函数
40
+ "@/utils/is/index.ts": [["*", "is"]], //判断值类型
41
+ "@/utils/serviceDict": [["*", "serviceDict"]] //字典库
42
+ }
43
+ ],
44
+ // 声明文件
45
+ // resolvers: [ElementPlusResolver()],
46
+ // Auto import inside Vue template
47
+ vueTemplate: true,
48
+ dirs: ["@/utils"],
49
+ dts: true,
50
+ eslintrc: {
51
+ enabled: true,
52
+ filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
53
+ globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
54
+ } //auto generation auto-imports.d.ts file
55
+ }),
56
+ // 自动注册组件 无需再手动引入
57
+ //https://github.com/antfu/unplugin-auto-import/blob/HEAD/src/types.ts
58
+ Components(
59
+ VITE_USER_NODE_ENV === "development"
60
+ ? {
61
+ dts: true, //默认生成的文件位置
62
+ dirs: ["src/components"], // 要搜索组件的目录的相对路径
63
+ extensions: ["vue", "jsx", "tsx"], // 文件类型
64
+ // deep: false, // 搜索子目录
65
+ // ui库解析器,也可以自定义,需要安装相关UI库
66
+ // resolvers: [],
67
+ include: [/.vue$/, /.vue?vue/],
68
+ exclude: [/[\/]node_modules[\/]/, /[\/].git[\/]/, /[\/].nuxt[\/]/]
69
+ }
70
+ : {}
71
+ ),
72
+ // esLint 报错信息显示在浏览器界面上
73
+ eslintPlugin(),
74
+ // 注入变量到 html 文件
75
+ createHtmlPlugin({
76
+ minify: true,
77
+ pages: [
78
+ {
79
+ entry: "/src/main.ts",
80
+ filename: "index.html",
81
+ template: "index.html",
82
+ injectOptions: {
83
+ data: { title: VITE_GLOB_APP_TITLE }
84
+ }
85
+ }
86
+ ]
87
+ }),
88
+ // 使用 svg 图标
89
+ // <SvgIcon name="xianxingdaoyu" />
90
+ createSvgIconsPlugin({
91
+ iconDirs: [
92
+ resolve(process.cwd(), "src/assets/global-icons"),
93
+ resolve(process.cwd(), "src/assets/option-icons"),
94
+ resolve(process.cwd(), "src/assets/route-icons")
95
+ ]
96
+ // appoint svg icon using mode
97
+ // symbolId: "icon-[dir]-[name]"
98
+ }),
99
+ // vitePWA
100
+ VITE_PWA && createVitePwa(viteEnv),
101
+ // 是否生成包预览,分析依赖包大小做优化处理
102
+ VITE_REPORT && (visualizer({ filename: "stats.html", gzipSize: true, brotliSize: true }) as Plugin)
103
+ ];
104
+ };
105
+
106
+ /**
107
+ * @description VitePwa
108
+ * @param viteEnv
109
+ */
110
+ const createVitePwa = (viteEnv: ViteEnv): PluginOption | PluginOption[] => {
111
+ const { VITE_GLOB_APP_TITLE } = viteEnv;
112
+ return VitePWA({
113
+ registerType: "autoUpdate",
114
+ manifest: {
115
+ name: VITE_GLOB_APP_TITLE,
116
+ short_name: VITE_GLOB_APP_TITLE,
117
+ theme_color: "#ffffff",
118
+ icons: [
119
+ {
120
+ src: "/logo.png",
121
+ sizes: "192x192",
122
+ type: "image/png"
123
+ },
124
+ {
125
+ src: "/logo.png",
126
+ sizes: "512x512",
127
+ type: "image/png"
128
+ },
129
+ {
130
+ src: "/logo.png",
131
+ sizes: "512x512",
132
+ type: "image/png",
133
+ purpose: "any maskable"
134
+ }
135
+ ]
136
+ }
137
+ });
138
+ };
package/build/proxy.ts ADDED
@@ -0,0 +1,28 @@
1
+ import type { ProxyOptions } from "vite";
2
+
3
+ type ProxyItem = [string, string];
4
+
5
+ type ProxyList = ProxyItem[];
6
+
7
+ type ProxyTargetList = Record<string, ProxyOptions>;
8
+
9
+ /**
10
+ * 创建代理,用于解析 .env.development 代理配置
11
+ * @param list
12
+ */
13
+ export function createProxy(list: ProxyList = []) {
14
+ const ret: ProxyTargetList = {};
15
+ for (const [prefix, target] of list) {
16
+ const isHttps = /^https:\/\//.test(target);
17
+ // https://github.com/http-party/node-http-proxy#options
18
+ ret[prefix] = {
19
+ target: target,
20
+ changeOrigin: true,
21
+ ws: true,
22
+ rewrite: path => path.replace(new RegExp(`^${prefix}`), ""),
23
+ // https is require secure=false
24
+ ...(isHttps ? { secure: false } : {})
25
+ };
26
+ }
27
+ return ret;
28
+ }
@@ -0,0 +1,84 @@
1
+ // @see: https://cz-git.qbenben.com/zh/guide
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+
5
+ const scopes = fs
6
+ .readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true })
7
+ .filter(dirent => dirent.isDirectory())
8
+ .map(dirent => dirent.name.replace(/s$/, ""));
9
+
10
+ /** @type {import('cz-git').UserConfig} */
11
+ module.exports = {
12
+ ignores: [commit => commit.includes("init")],
13
+ extends: ["@commitlint/config-conventional"],
14
+ rules: {
15
+ // @see: https://commitlint.js.org/#/reference-rules
16
+ "body-leading-blank": [2, "always"],
17
+ "footer-leading-blank": [1, "always"],
18
+ "header-max-length": [2, "always", 108],
19
+ "subject-empty": [2, "never"],
20
+ "type-empty": [2, "never"],
21
+ "subject-case": [0],
22
+ "type-enum": [
23
+ 2,
24
+ "always",
25
+ [
26
+ "feat",
27
+ "fix",
28
+ "docs",
29
+ "style",
30
+ "refactor",
31
+ "perf",
32
+ "test",
33
+ "build",
34
+ "ci",
35
+ "chore",
36
+ "revert",
37
+ "wip",
38
+ "workflow",
39
+ "types",
40
+ "release"
41
+ ]
42
+ ]
43
+ },
44
+ prompt: {
45
+ messages: {
46
+ type: "选择你要提交的类型 :",
47
+ scope: "选择一个提交范围(可选):",
48
+ customScope: "请输入自定义的提交范围 :",
49
+ subject: "填写简短精炼的变更描述 :\n",
50
+ body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
51
+ breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
52
+ footerPrefixsSelect: "选择关联issue前缀(可选):",
53
+ customFooterPrefixs: "输入自定义issue前缀 :",
54
+ footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
55
+ confirmCommit: "是否提交或修改commit ?"
56
+ },
57
+ types: [
58
+ { value: "feat", name: "特性: 🚀 新增功能", emoji: "🚀" },
59
+ { value: "fix", name: "修复: 🧩 修复缺陷", emoji: "🧩" },
60
+ { value: "docs", name: "文档: 📚 文档变更", emoji: "📚" },
61
+ { value: "style", name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" },
62
+ { value: "refactor", name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" },
63
+ { value: "perf", name: "性能: ⚡️ 性能优化", emoji: "⚡️" },
64
+ { value: "test", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
65
+ {
66
+ value: "build",
67
+ name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)",
68
+ emoji: "📦️"
69
+ },
70
+ { value: "ci", name: "集成: 🎡 修改 CI 配置、脚本", emoji: "🎡" },
71
+ { value: "revert", name: "回退: ⏪️ 回滚 commit", emoji: "⏪️" },
72
+ { value: "chore", name: "其他: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" },
73
+ { value: "wip", name: "开发: 🕔 正在开发中", emoji: "🕔" },
74
+ { value: "workflow", name: "工作流: 📋 工作流程改进", emoji: "📋" },
75
+ { value: "types", name: "类型: 🔰 类型定义文件修改", emoji: "🔰" }
76
+ ],
77
+ useEmoji: true,
78
+ scopes: [...scopes],
79
+ customScopesAlign: "bottom",
80
+ emptyScopesAlias: "empty",
81
+ customScopesAlias: "custom",
82
+ allowBreakingChanges: ["feat", "fix"]
83
+ }
84
+ };
@@ -0,0 +1,28 @@
1
+ // generated by unplugin-vue-components
2
+ // We suggest you to commit this file into source control
3
+ // Read more: https://github.com/vuejs/core/pull/3399
4
+ import '@vue/runtime-core'
5
+
6
+ export {}
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface GlobalComponents {
10
+ ColSetting: typeof import('./src/components/ProTable/components/ColSetting.vue')['default']
11
+ CSvgIcon: typeof import('./src/components/CSvgIcon/index.vue')['default']
12
+ CTree: typeof import('./src/components/CTree/index.vue')['default']
13
+ Dialog: typeof import('./src/components/Dialog/index.vue')['default']
14
+ Empty: typeof import('./src/components/Empty/index.vue')['default']
15
+ Grid: typeof import('./src/components/Grid/index.vue')['default']
16
+ GridItem: typeof import('./src/components/Grid/components/GridItem.vue')['default']
17
+ Loading: typeof import('./src/components/Loading/index.vue')['default']
18
+ Overflow: typeof import('./src/components/Overflow/index.vue')['default']
19
+ Pagination: typeof import('./src/components/ProTable/components/Pagination.vue')['default']
20
+ ProTable: typeof import('./src/components/ProTable/index.vue')['default']
21
+ ScrollBox: typeof import('./src/components/ScrollBox/index.vue')['default']
22
+ SearchForm: typeof import('./src/components/ProTable/components/SearchForm/index.vue')['default']
23
+ SearchFormItem: typeof import('./src/components/ProTable/components/SearchForm/components/SearchFormItem.vue')['default']
24
+ SvgIcon: typeof import('./src/components/SvgIcon/index.vue')['default']
25
+ TableColumn: typeof import('./src/components/ProTable/components/TableColumn.vue')['default']
26
+ Tabs: typeof import('./src/components/Tabs/index.vue')['default']
27
+ }
28
+ }
package/index.html ADDED
@@ -0,0 +1,105 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/logo.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title><%- title %></title>
8
+ </head>
9
+ <body>
10
+ <div id="app">
11
+ <style>
12
+ html,
13
+ body,
14
+ #app {
15
+ width: 100%;
16
+ height: 100%;
17
+ padding: 0;
18
+ margin: 0;
19
+ }
20
+ .loading-box {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ justify-content: center;
25
+ width: 100%;
26
+ height: 100%;
27
+ }
28
+ .loading-box .loading-wrap {
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ padding: 98px;
33
+ }
34
+ .dot {
35
+ position: relative;
36
+ box-sizing: border-box;
37
+ display: inline-block;
38
+ width: 32px;
39
+ height: 32px;
40
+ font-size: 32px;
41
+ transform: rotate(45deg);
42
+ animation: ant-rotate 1.2s infinite linear;
43
+ }
44
+ .dot i {
45
+ position: absolute;
46
+ display: block;
47
+ width: 14px;
48
+ height: 14px;
49
+ background-color: #409eff;
50
+ border-radius: 100%;
51
+ opacity: 0.3;
52
+ transform: scale(0.75);
53
+ transform-origin: 50% 50%;
54
+ animation: ant-spin-move 1s infinite linear alternate;
55
+ }
56
+ .dot i:nth-child(1) {
57
+ top: 0;
58
+ left: 0;
59
+ }
60
+ .dot i:nth-child(2) {
61
+ top: 0;
62
+ right: 0;
63
+ animation-delay: 0.4s;
64
+ }
65
+ .dot i:nth-child(3) {
66
+ right: 0;
67
+ bottom: 0;
68
+ animation-delay: 0.8s;
69
+ }
70
+ .dot i:nth-child(4) {
71
+ bottom: 0;
72
+ left: 0;
73
+ animation-delay: 1.2s;
74
+ }
75
+
76
+ @keyframes ant-rotate {
77
+ to {
78
+ transform: rotate(405deg);
79
+ }
80
+ }
81
+
82
+ @keyframes ant-spin-move {
83
+ to {
84
+ opacity: 1;
85
+ }
86
+ }
87
+ </style>
88
+ <div class="loading-box">
89
+ <div class="loading-wrap">
90
+ <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ <script>
95
+ const globalState = JSON.parse(window.localStorage.getItem("%VITE_GLOB_DEMO_KEY%" + "global"));
96
+ if (globalState) {
97
+ const dot = document.querySelectorAll(".dot i");
98
+ const html = document.querySelector("html");
99
+ dot.forEach(item => (item.style.background = globalState.primary));
100
+ if (globalState.isDark) html.style.background = "#141414";
101
+ }
102
+ </script>
103
+ <script type="module" src="/src/main.ts"></script>
104
+ </body>
105
+ </html>
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
3
+ "{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"],
4
+ "package.json": ["prettier --write"],
5
+ "*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
6
+ "*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
7
+ "*.md": ["prettier --write"]
8
+ };
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "zyf-model-engine",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "main": "zyf-model-engine.ts",
6
+ "description": "插件发布测试",
7
+ "author": {
8
+ "name": "huzk",
9
+ "email": "913134323@qq.com"
10
+ },
11
+ "license": "MIT",
12
+ "types": "lib/index.d.ts",
13
+ "scripts": {
14
+ "dev": "vite",
15
+ "build": " vite build --mode production",
16
+ "build:dev": "vue-tsc && vite build --mode development",
17
+ "build:test": "vue-tsc && vite build --mode test",
18
+ "build:test-no-check": "vite build --mode test",
19
+ "build:pro": "vue-tsc && vite build --mode production",
20
+ "build:pro-no-check": "vite build --mode production",
21
+ "type:check": "vue-tsc --noEmit --skipLibCheck",
22
+ "preview": "npm run build:dev && vite preview",
23
+ "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
24
+ "lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
25
+ "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
26
+ "lint:lint-staged": "lint-staged",
27
+ "prepare": "husky install",
28
+ "release": "standard-version",
29
+ "commit": "git add -A && czg && git push"
30
+ },
31
+ "dependencies": {
32
+ "@element-plus/icons-vue": "^2.1.0",
33
+ "@vueuse/core": "^10.3.0",
34
+ "axios": "^1.4.0",
35
+ "dayjs": "^1.11.9",
36
+ "element-plus": "^2.3.4",
37
+ "nprogress": "^0.2.0",
38
+ "pinia": "^2.1.6",
39
+ "pinia-plugin-persistedstate": "^3.2.0",
40
+ "qs": "^6.11.2",
41
+ "screenfull": "^6.0.2",
42
+ "vue": "^3.3.4"
43
+ },
44
+ "devDependencies": {
45
+ "@commitlint/cli": "^17.6.7",
46
+ "@commitlint/config-conventional": "^17.6.7",
47
+ "@types/nprogress": "^0.2.0",
48
+ "@types/qs": "^6.9.7",
49
+ "@typescript-eslint/eslint-plugin": "^6.2.1",
50
+ "@typescript-eslint/parser": "^6.2.1",
51
+ "@vitejs/plugin-vue": "^4.2.3",
52
+ "@vitejs/plugin-vue-jsx": "^3.0.1",
53
+ "autoprefixer": "^10.4.14",
54
+ "cz-git": "^1.7.0",
55
+ "czg": "^1.7.0",
56
+ "eslint": "^8.46.0",
57
+ "eslint-config-prettier": "^8.9.0",
58
+ "eslint-plugin-prettier": "^5.0.0",
59
+ "eslint-plugin-vue": "^9.16.1",
60
+ "husky": "^8.0.3",
61
+ "lint-staged": "^13.2.3",
62
+ "postcss": "^8.4.27",
63
+ "postcss-html": "^1.5.0",
64
+ "prettier": "^3.0.0",
65
+ "rollup-plugin-visualizer": "^5.9.2",
66
+ "sass": "1.64.2",
67
+ "standard-version": "^9.5.0",
68
+ "stylelint": "^15.10.2",
69
+ "stylelint-config-html": "^1.1.0",
70
+ "stylelint-config-recess-order": "^4.3.0",
71
+ "stylelint-config-recommended-scss": "^12.0.0",
72
+ "stylelint-config-recommended-vue": "^1.5.0",
73
+ "stylelint-config-standard": "^34.0.0",
74
+ "stylelint-config-standard-scss": "^10.0.0",
75
+ "typescript": "4.3.5",
76
+ "unplugin-auto-import": "^0.11.2",
77
+ "unplugin-vue-components": "^0.22.8",
78
+ "unplugin-vue-setup-extend-plus": "^1.0.0",
79
+ "vite": "^4.4.8",
80
+ "vite-plugin-compression": "^0.5.1",
81
+ "vite-plugin-dts": "^4.2.4",
82
+ "vite-plugin-eslint": "^1.8.1",
83
+ "vite-plugin-html": "^3.2.0",
84
+ "vite-plugin-pwa": "^0.16.4",
85
+ "vite-plugin-svg-icons": "^2.0.1",
86
+ "vue-tsc": "^1.8.8"
87
+ },
88
+ "engines": {
89
+ "node": ">=16.0.0"
90
+ },
91
+ "browserslist": {
92
+ "production": [
93
+ "> 1%",
94
+ "not dead",
95
+ "not op_mini all"
96
+ ],
97
+ "development": [
98
+ "last 1 chrome version",
99
+ "last 1 firefox version",
100
+ "last 1 safari version"
101
+ ]
102
+ },
103
+ "config": {
104
+ "commitizen": {
105
+ "path": "node_modules/cz-git"
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ plugins: {
3
+ autoprefixer: {}
4
+ }
5
+ };
Binary file
package/src/App.vue ADDED
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <el-config-provider :locale="zhCn" :size="size[1]" :button="buttonConfig">
3
+ <test></test>
4
+ </el-config-provider>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { ElConfigProvider } from "element-plus";
9
+ import zhCn from "element-plus/es/locale/lang/zh-cn";
10
+ import { AssemblySizeType } from "@/stores/interface/index";
11
+ import test from "@/plugins/index.vue";
12
+ const size: AssemblySizeType[] = ["large", "default", "small"];
13
+
14
+ // element button config
15
+ const buttonConfig = reactive({ autoInsertSpace: false });
16
+ </script>
@@ -0,0 +1,3 @@
1
+ // 后端微服务模块前缀
2
+ export const PORT = "/api/xcj";
3
+ export const UploadUrl = "/basic/xcj_sys_file/upload";
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description:请求配置
3
+ */
4
+ export enum ResultEnum {
5
+ SUCCESS = 200,
6
+ ERROR = 500,
7
+ OVERDUE = 401,
8
+ TIMEOUT = 30000,
9
+ TYPE = "success"
10
+ }
11
+
12
+ /**
13
+ * @description:请求方法
14
+ */
15
+ export enum RequestEnum {
16
+ GET = "GET",
17
+ POST = "POST",
18
+ PATCH = "PATCH",
19
+ PUT = "PUT",
20
+ DELETE = "DELETE"
21
+ }
22
+
23
+ /**
24
+ * @description:常用的 contentTyp 类型
25
+ */
26
+ export enum ContentTypeEnum {
27
+ // json
28
+ JSON = "application/json;charset=UTF-8",
29
+ // text
30
+ TEXT = "text/plain;charset=UTF-8",
31
+ // form-data 一般配合qs
32
+ FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
33
+ // form-data 上传
34
+ FORM_DATA = "multipart/form-data;charset=UTF-8"
35
+ }
@@ -0,0 +1,50 @@
1
+ // ? 暂未使用,目前使用全局 Loading 来控制重复请求
2
+ import { CustomAxiosRequestConfig } from "../index";
3
+ import qs from "qs";
4
+
5
+ // 声明一个 Map 用于存储每个请求的标识 和 取消函数
6
+ export let pendingMap = new Map<string, AbortController>();
7
+
8
+ // 序列化参数
9
+ export const getPendingUrl = (config: CustomAxiosRequestConfig) =>
10
+ [config.method, config.url, qs.stringify(config.data), qs.stringify(config.params)].join("&");
11
+
12
+ export class AxiosCanceler {
13
+ /**
14
+ * @description: 添加请求
15
+ * @param {Object} config
16
+ * @return void
17
+ */
18
+ addPending(config: CustomAxiosRequestConfig) {
19
+ // 在请求开始前,对之前的请求做检查取消操作
20
+ this.removePending(config);
21
+ const url = getPendingUrl(config);
22
+ const controller = new AbortController();
23
+ config.signal = controller.signal;
24
+ pendingMap.set(url, controller);
25
+ }
26
+
27
+ /**
28
+ * @description: 移除请求
29
+ * @param {Object} config
30
+ */
31
+ removePending(config: CustomAxiosRequestConfig) {
32
+ const url = getPendingUrl(config);
33
+ // 如果在 pending 中存在当前请求标识,需要取消当前请求
34
+ const controller = pendingMap.get(url);
35
+ if (controller) {
36
+ controller.abort();
37
+ pendingMap.delete(url);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @description: 清空所有pending
43
+ */
44
+ removeAllPending() {
45
+ pendingMap.forEach(controller => {
46
+ controller && controller.abort();
47
+ });
48
+ pendingMap.clear();
49
+ }
50
+ }