chore: 优化代码

This commit is contained in:
xlsea 2025-04-23 15:59:45 +08:00
parent 82b6ff6c92
commit 8b237b3f61
21 changed files with 50 additions and 461 deletions

View File

@ -1,90 +0,0 @@
name: 🐞 Bug提交
description: 在使用软件或功能的过程中遇到了错误
title: '[Bug]: '
labels: [ "bug?" ]
body:
- type: markdown
attributes:
value: |
## 请按照以下要求进行提交
### 1. 提交后需要指定标签和截止时间。
---
- type: markdown
attributes:
value: |
## 环境信息
请根据实际使用环境修改以下信息。
- type: input
id: env-program-ver
attributes:
label: 软件版本
validations:
required: true
- type: dropdown
id: env-vm-ver
attributes:
label: 运行环境
description: 选择运行软件的系统版本
options:
- Windows (64)
- Windows (32/x84)
- MacOS
- Linux
- Ubuntu
- CentOS
- ArchLinux
- UNIX (Android)
- 其它(请在下方说明)
validations:
required: true
- type: dropdown
id: env-vm-arch
attributes:
label: 运行架构
description: (可选) 选择运行软件的系统架构
options:
- AMD64
- x86
- ARM [32] (别名AArch32 / ARMv7
- ARM [64] (别名AArch64 / ARMv8
- 其它
- type: textarea
id: reproduce-steps
attributes:
label: 重现步骤
description: |
我们需要执行哪些操作才能让 bug 出现?
简洁清晰的重现步骤能够帮助我们更迅速地定位问题所在。
validations:
required: true
- type: textarea
id: expected
attributes:
label: 期望的结果是什么?
validations:
required: true
- type: textarea
id: actual
attributes:
label: 实际的结果是什么?
validations:
required: true
- type: textarea
id: logging
attributes:
label: 日志记录(可选)
render: golang
- type: textarea
id: extra-desc
attributes:
label: 补充说明(可选)

View File

@ -1,90 +0,0 @@
name: 🐞 Bug Report
description: Encountered an error while using the software or feature
title: '[Bug]: '
labels: [ "bug?" ]
body:
- type: markdown
attributes:
value: |
## Please submit according to the following requirements
### 1. After submission, you need to specify the label and deadline.
---
- type: markdown
attributes:
value: |
## Environment Information
Please modify the following information according to the actual usage environment.
- type: input
id: env-program-ver
attributes:
label: Software Version
validations:
required: true
- type: dropdown
id: env-vm-ver
attributes:
label: Operating Environment
description: Select the system version on which the software is running
options:
- Windows (64)
- Windows (32/x84)
- MacOS
- Linux
- Ubuntu
- CentOS
- ArchLinux
- UNIX (Android)
- Other (please specify below)
validations:
required: true
- type: dropdown
id: env-vm-arch
attributes:
label: Operating Architecture
description: (Optional) Select the system architecture on which the software is running
options:
- AMD64
- x86
- ARM [32] (AliasAArch32 / ARMv7
- ARM [64] (AliasAArch64 / ARMv8
- Other
- type: textarea
id: reproduce-steps
attributes:
label: Reproduce Steps
description: |
What operations do we need to perform to make the bug appear?
The concise and clear reproduction steps can help us locate the problem more quickly.
validations:
required: true
- type: textarea
id: expected
attributes:
label: What is the expected result?
validations:
required: true
- type: textarea
id: actual
attributes:
label: What is the actual result?
validations:
required: true
- type: textarea
id: logging
attributes:
label: Logging (Optional)
render: golang
- type: textarea
id: extra-desc
attributes:
label: Additional Description (Optional)

View File

@ -1,48 +0,0 @@
---
name: 🚀 功能请求
description: 提出一个想法以帮助我们改进W&B
title: "[功能]: "
labels:
- "功能请求"
body:
- type: markdown
attributes:
value: |
**感谢 :heart: 您花时间填写此功能请求报告!**
我们恳请您搜索看看您的功能是否[已经存在](https://github.com/soybeanjs/soybean-admin/issues?q=is%3Aissue+sort%3Acreated-desc+)。
我们也很乐意接受用户的贡献。有关更多详细信息,请参阅[此处](https://github.com/soybeanjs/soybean-admin/blob/main/README.zh_CN.md#%E5%A6%82%E4%BD%95%E8%B4%A1%E7%8C%AE)。
- type: textarea
attributes:
label: 描述
description: |
对您感兴趣的功能的清晰简洁的描述。
validations:
required: true
- type: textarea
attributes:
label: 建议的解决方案
description: |
描述您想要的解决方案。对您希望发生的事情的清晰简洁的描述。
validations:
required: true
- type: textarea
attributes:
label: 替代方案
description: |
描述您考虑过的替代方案。
对您考虑过的任何替代解决方案或功能的清晰简洁的描述。
validations:
required: false
- type: textarea
attributes:
label: 额外的上下文
description: |
在此处添加有关问题的其他上下文。
validations:
required: false

View File

@ -1,48 +0,0 @@
---
name: 🚀 Feature Request
description: Suggest an idea to help us improve W&B
title: "[Feature]: "
labels:
- "feature_request"
body:
- type: markdown
attributes:
value: |
**Thanks :heart: for taking the time to fill out this feature request report!**
We kindly ask that you search to see if an issue [already exists](https://github.com/soybeanjs/soybean-admin/issues?q=is%3Aissue+sort%3Acreated-desc+) for your feature.
We are also happy to accept contributions from our users. For more details see [here](https://github.com/soybeanjs/soybean-admin/blob/main/README.md#how-to-contribute).
- type: textarea
attributes:
label: Description
description: |
A clear and concise description of the feature you're interested in.
validations:
required: true
- type: textarea
attributes:
label: Suggested Solution
description: |
Describe the solution you'd like. A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Alternatives
description: |
Describe alternatives you've considered.
A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Additional Context
description: |
Add any other context about the problem here.
validations:
required: false

View File

@ -1,30 +0,0 @@
---
name: Lint Code
permissions:
contents: write
on:
pull_request:
branches: [main]
jobs:
lint:
name: Lint All Code
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
# To change branch master or main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: (docs|.github)
VALIDATE_MARKDOWN: false

View File

@ -1,25 +0,0 @@
name: Release
permissions:
contents: write
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npx githublogen
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@ -56,12 +56,12 @@
"@sa/hooks": "workspace:*",
"@sa/materials": "workspace:*",
"@sa/utils": "workspace:*",
"@tinymce/tinymce-vue": "^6.1.0",
"@vueuse/core": "13.0.0",
"clipboard": "2.0.11",
"dayjs": "1.11.13",
"defu": "6.1.4",
"echarts": "5.6.0",
"highlight.js": "^11.11.1",
"jsencrypt": "^3.3.2",
"json5": "2.2.3",
"monaco-editor": "^0.52.0",
@ -69,11 +69,9 @@
"nprogress": "0.2.0",
"pinia": "3.0.1",
"tailwind-merge": "3.0.2",
"tinymce": "^7",
"vue": "3.5.13",
"vue-draggable-plus": "0.6.0",
"vue-i18n": "11.1.2",
"vue-json-pretty": "^2.4.0",
"vue-router": "4.5.0"
},
"devDependencies": {

View File

@ -29,9 +29,6 @@ importers:
'@sa/utils':
specifier: workspace:*
version: link:packages/utils
'@tinymce/tinymce-vue':
specifier: ^6.1.0
version: 6.1.0(tinymce@7.8.0)(vue@3.5.13(typescript@5.8.2))
'@vueuse/core':
specifier: 13.0.0
version: 13.0.0(vue@3.5.13(typescript@5.8.2))
@ -47,6 +44,9 @@ importers:
echarts:
specifier: 5.6.0
version: 5.6.0
highlight.js:
specifier: ^11.11.1
version: 11.11.1
jsencrypt:
specifier: ^3.3.2
version: 3.3.2
@ -68,9 +68,6 @@ importers:
tailwind-merge:
specifier: 3.0.2
version: 3.0.2
tinymce:
specifier: ^7
version: 7.8.0
vue:
specifier: 3.5.13
version: 3.5.13(typescript@5.8.2)
@ -80,9 +77,6 @@ importers:
vue-i18n:
specifier: 11.1.2
version: 11.1.2(vue@3.5.13(typescript@5.8.2))
vue-json-pretty:
specifier: ^2.4.0
version: 2.4.0(vue@3.5.13(typescript@5.8.2))
vue-router:
specifier: 4.5.0
version: 4.5.0(vue@3.5.13(typescript@5.8.2))
@ -1053,15 +1047,6 @@ packages:
vue-eslint-parser:
optional: true
'@tinymce/tinymce-vue@6.1.0':
resolution: {integrity: sha512-7JdaKMOaohuFWpjKwRmaZJbT/eNVUUYHG93R7+lUf7SUN+hSqd2spbuqZcki+tG9kaSAGd2ZmvJIsmzWDNAzpw==}
peerDependencies:
tinymce: ^7.0.0 || ^6.0.0 || ^5.5.1
vue: ^3.0.0
peerDependenciesMeta:
tinymce:
optional: true
'@trysound/sax@0.2.0':
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
engines: {node: '>=10.13.0'}
@ -3788,9 +3773,6 @@ packages:
resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==}
engines: {node: '>=12.0.0'}
tinymce@7.8.0:
resolution: {integrity: sha512-MUER5MWV9mkOB4expgbWknh/C5ZJvOXQlMVSx4tJxTuYtcUCDB6bMZ34fWNOIc8LvrnXmGHGj0eGQuxjQyRgrA==}
to-object-path@0.3.0:
resolution: {integrity: sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg==}
engines: {node: '>=0.10.0'}
@ -4116,12 +4098,6 @@ packages:
peerDependencies:
vue: ^3.0.0
vue-json-pretty@2.4.0:
resolution: {integrity: sha512-e9bP41DYYIc2tWaB6KuwqFJq5odZ8/GkE6vHQuGcbPn37kGk4a3n1RNw3ZYeDrl66NWXgTlOfS+M6NKkowmkWw==}
engines: {node: '>= 10.0.0', npm: '>= 5.0.0'}
peerDependencies:
vue: '>=3.0.0'
vue-router@4.5.0:
resolution: {integrity: sha512-HDuk+PuH5monfNuY+ct49mNmkCRK4xJAV9Ts4z9UFc4rzdDnxQLyCMGGc8pKhZhHTVzfanpNwB/lwqevcBwI4w==}
peerDependencies:
@ -4884,12 +4860,6 @@ snapshots:
- '@types/eslint'
- supports-color
'@tinymce/tinymce-vue@6.1.0(tinymce@7.8.0)(vue@3.5.13(typescript@5.8.2))':
dependencies:
vue: 3.5.13(typescript@5.8.2)
optionalDependencies:
tinymce: 7.8.0
'@trysound/sax@0.2.0': {}
'@types/crypto-js@4.2.2': {}
@ -8050,8 +8020,6 @@ snapshots:
fdir: 6.4.3(picomatch@4.0.2)
picomatch: 4.0.2
tinymce@7.8.0: {}
to-object-path@0.3.0:
dependencies:
kind-of: 3.2.2
@ -8405,10 +8373,6 @@ snapshots:
'@vue/devtools-api': 6.6.4
vue: 3.5.13(typescript@5.8.2)
vue-json-pretty@2.4.0(vue@3.5.13(typescript@5.8.2)):
dependencies:
vue: 3.5.13(typescript@5.8.2)
vue-router@4.5.0(vue@3.5.13(typescript@5.8.2)):
dependencies:
'@vue/devtools-api': 6.6.4

View File

@ -1,71 +1,40 @@
<script setup lang="ts">
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import { computed } from 'vue';
import hljs from 'highlight.js/lib/core';
import json from 'highlight.js/lib/languages/json';
hljs.registerLanguage('json', json);
defineOptions({
name: 'JsonPreview'
});
interface Props {
// json
data: any;
//
deep?: number;
//
showDoubleQuotes?: boolean;
// /
showLength?: boolean;
// 线
showLine?: boolean;
//
showLineNumber?: boolean;
//
showIcon?: boolean;
//
showSelectController?: boolean;
//
collapsedLevel?: number;
//
highlightMouseoverNode?: boolean;
code?: string;
showLineNumbers?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
deep: 3,
showDoubleQuotes: true,
showLength: false,
showLine: true,
showLineNumber: false,
showIcon: true,
showSelectController: false,
collapsedLevel: 1,
highlightMouseoverNode: false
code: '',
showLineNumbers: false
});
// JSON
const jsonData = computed(() => {
if (!props.data) return null;
/** 格式化JSON数据 */
const jsonData = computed<string>(() => {
if (!props.code) return '';
try {
return typeof props.data === 'string' ? JSON.parse(props.data) : props.data;
return typeof props.code === 'string'
? JSON.stringify(JSON.parse(props.code), null, '\t')
: JSON.stringify(props.code, null, '\t');
} catch {
return null;
return props.code;
}
});
</script>
<template>
<div class="json-preview">
<VueJsonPretty
v-if="jsonData"
:data="jsonData"
:deep="deep"
:show-double-quotes="showDoubleQuotes"
:show-length="showLength"
:show-line="showLine"
:show-line-number="showLineNumber"
:show-icon="showIcon"
:show-select-controller="showSelectController"
:collapsed-level="collapsedLevel"
:highlight-mouseover-node="highlightMouseoverNode"
/>
<span v-else-if="props.data">{{ props.data }}</span>
<div v-else class="empty-data">暂无数据</div>
<NCode :code="jsonData" :hljs="hljs" language="json" :show-line-numbers="showLineNumbers" />
</div>
</template>

View File

@ -17,30 +17,14 @@ export function setupLoading() {
toggleHtmlClass(DARK_CLASS).add();
}
const loadingClasses = [
'left-0 top-0',
'left-0 bottom-0 animate-delay-500',
'right-0 top-0 animate-delay-1000',
'right-0 bottom-0 animate-delay-1500'
];
const logoWithClass = systemLogo.replace('<svg', `<svg class="size-128px text-primary"`);
const dot = loadingClasses
.map(item => {
return `<div class="absolute w-16px h-16px bg-primary rounded-8px animate-pulse ${item}"></div>`;
})
.join('\n');
const loading = `
<div class="fixed-center flex-col bg-layout" style="${primaryColor}">
${logoWithClass}
<div class="w-120px h-120px my-36px">
<div class="w-120px h-120px my-36px">
<div class="relative h-full animate-spin">
${dot}
<img src="${systemLogo}" width="120" />
</div>
</div>
<h2 class="text-28px font-500 text-#646464">${$t('system.title')}</h2>
<h2 class="text-28px font-500 text-primary">${$t('system.title')}</h2>
</div>`;
const app = document.getElementById('app');

View File

@ -4,12 +4,12 @@ export const themeSettings: App.Theme.ThemeSetting = {
grayscale: false,
colourWeakness: false,
recommendColor: false,
themeColor: '#646CFF',
themeColor: '#0E42D2',
otherColor: {
info: '#646CFF',
success: '#52C41A',
warning: '#FAAD14',
error: '#F5222D'
info: '#0E42D2',
success: '#009A29',
warning: '#D25F00',
error: '#CB2634'
},
isInfoFollowPrimary: true,
resetCacheStrategy: 'close',

View File

@ -12,6 +12,7 @@ declare module 'vue' {
BetterScroll: typeof import('./../components/custom/better-scroll.vue')['default']
BooleanTag: typeof import('./../components/custom/boolean-tag.vue')['default']
ButtonIcon: typeof import('./../components/custom/button-icon.vue')['default']
CodeMirror: typeof import('./../components/custom/code-mirror.vue')['default']
copy: typeof import('./../components/custom/role-select copy.vue')['default']
CountTo: typeof import('./../components/custom/count-to.vue')['default']
DarkModeContainer: typeof import('./../components/common/dark-mode-container.vue')['default']
@ -64,6 +65,7 @@ declare module 'vue' {
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCode: typeof import('naive-ui')['NCode']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NColorPicker: typeof import('naive-ui')['NColorPicker']

View File

@ -60,4 +60,6 @@ declare namespace NaiveUI {
import('@sa/hooks').TableConfig<A, GetTreeTableData<A>, TableColumn<TableDataWithIndex<GetTreeTableData<A>>>>,
'apiFn' | 'apiParams' | 'columns' | 'immediate'
>;
type CodeMirrorLang = 'js' | 'json';
}

View File

@ -2,6 +2,7 @@
import { useDict } from '@/hooks/business/dict';
import { getBrowserIcon, getOsIcon } from '@/utils/format';
import { $t } from '@/locales';
defineOptions({
name: 'LoginInforViewDrawer'
});

View File

@ -52,10 +52,10 @@ function closeDrawer() {
</NDescriptionsItem>
<NDescriptionsItem label="操作时间">{{ props.rowData?.operTime }}</NDescriptionsItem>
<NDescriptionsItem label="请求参数">
<JsonPreview :data="props.rowData?.operParam" />
<JsonPreview :code="props.rowData?.operParam" />
</NDescriptionsItem>
<NDescriptionsItem label="返回参数">
<JsonPreview :data="props.rowData?.jsonResult" />
<JsonPreview :code="props.rowData?.jsonResult" />
</NDescriptionsItem>
<NDescriptionsItem label="消耗时间">
{{ `${props.rowData?.costTime} ms` }}

View File

@ -1,7 +1,7 @@
<script setup lang="tsx">
import { ref } from 'vue';
import { NButton, NPopconfirm, NTooltip } from 'naive-ui';
import { useBoolean } from '@sa/hooks';
import { ref } from 'vue';
import { jsonClone } from '@sa/utils';
import {
fetchBatchDeleteGenTable,
@ -10,12 +10,12 @@ import {
fetchGetGenTableList,
fetchSynchGenDbList
} from '@/service/api/tool';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import { useDownload } from '@/hooks/business/download';
import { $t } from '@/locales';
import ButtonIcon from '@/components/custom/button-icon.vue';
import SvgIcon from '@/components/custom/svg-icon.vue';
import { useDownload } from '@/hooks/business/download';
import GenTableSearch from './modules/gen-table-search.vue';
import GenTableImportDrawer from './modules/gen-table-import-drawer.vue';
import GenTableOperateDrawer from './modules/gen-table-operate-drawer.vue';

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { $t } from '@/locales';
import { useNaiveForm } from '@/hooks/common/form';
import { $t } from '@/locales';
defineOptions({
name: 'GenTableDbSearch'

View File

@ -1,9 +1,9 @@
<script setup lang="tsx">
import { watch } from 'vue';
import { fetchGetGenDbList, fetchImportGenTable } from '@/service/api/tool';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import { $t } from '@/locales';
import GenTableDbSearch from './gen-table-db-search.vue';
defineOptions({

View File

@ -4,10 +4,6 @@ import type { FormInst, SelectOption } from 'naive-ui';
import { NCheckbox, NInput, NSelect, NTabs } from 'naive-ui';
import { useLoading } from '@sa/hooks';
import { jsonClone } from '@sa/utils';
import { fetchGetDictTypeOption } from '@/service/api/system';
import { fetchGetGenTableInfo, fetchUpdateGenTable } from '@/service/api/tool';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import {
genHtmlTypeOptions,
genJavaTypeOptions,
@ -15,7 +11,11 @@ import {
genTplCategoryOptions,
genTypeOptions
} from '@/constants/business';
import { fetchGetDictTypeOption } from '@/service/api/system';
import { fetchGetGenTableInfo, fetchUpdateGenTable } from '@/service/api/tool';
import { useAppStore } from '@/store/modules/app';
import { useFormRules } from '@/hooks/common/form';
import { $t } from '@/locales';
defineOptions({
name: 'GenTableOperateDrawer'

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { useLoading } from '@sa/hooks';
import { ref, watch } from 'vue';
import { useClipboard } from '@vueuse/core';
import { useLoading } from '@sa/hooks';
import { fetchGetGenPreview } from '@/service/api/tool';
import MonacoEditor from '@/components/common/monaco-editor.vue';

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { $t } from '@/locales';
import { useNaiveForm } from '@/hooks/common/form';
import { $t } from '@/locales';
defineOptions({
name: 'GenTableSearch'