mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-15 21:35:34 +00:00
style: 优化前端代码格式和样式顺序
refactor: 调整样式属性顺序以提高可读性 fix: 修复请求异常处理中的错误日志输出 chore: 添加stylelint相关依赖和配置 docs: 更新存储工具类的文档注释
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: [
|
||||||
|
"stylelint-config-recommended",
|
||||||
|
"stylelint-config-recommended-scss",
|
||||||
|
"stylelint-config-recommended-vue/scss",
|
||||||
|
"stylelint-config-html/vue",
|
||||||
|
"stylelint-config-recess-order",
|
||||||
|
],
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
"stylelint-prettier", // 统一代码风格,格式冲突时以 Prettier 规则为准
|
||||||
|
],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["**/*.{vue,html}"],
|
||||||
|
customSyntax: "postcss-html",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.{css,scss}"],
|
||||||
|
customSyntax: "postcss-scss",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
"prettier/prettier": true, // 强制执行 Prettier 格式化规则(需配合 .prettierrc 配置文件)
|
||||||
|
"no-empty-source": null, // 允许空的样式文件
|
||||||
|
"declaration-property-value-no-unknown": null, // 允许非常规数值格式 ,如 height: calc(100% - 50)
|
||||||
|
// 允许使用未知伪类
|
||||||
|
"selector-pseudo-class-no-unknown": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignorePseudoClasses: ["global", "export", "deep"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 允许使用未知伪元素
|
||||||
|
"at-rule-no-unknown": null, // 禁用默认的未知 at-rule 检查
|
||||||
|
"scss/at-rule-no-unknown": true, // 启用 SCSS 特定的 at-rule 检查
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
module.exports = {
|
||||||
|
// 继承的规则
|
||||||
|
extends: ["@commitlint/config-conventional"],
|
||||||
|
// 自定义规则
|
||||||
|
rules: {
|
||||||
|
// @see https://commitlint.js.org/#/reference-rules
|
||||||
|
|
||||||
|
// 提交类型枚举,git提交type必须是以下类型
|
||||||
|
"type-enum": [
|
||||||
|
2,
|
||||||
|
"always",
|
||||||
|
[
|
||||||
|
"feat", // 新增功能
|
||||||
|
"fix", // 修复缺陷
|
||||||
|
"docs", // 文档变更
|
||||||
|
"style", // 代码格式(不影响功能,例如空格、分号等格式修正)
|
||||||
|
"refactor", // 代码重构(不包括 bug 修复、功能新增)
|
||||||
|
"perf", // 性能优化
|
||||||
|
"test", // 添加疏漏测试或已有测试改动
|
||||||
|
"build", // 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)
|
||||||
|
"ci", // 修改 CI 配置、脚本
|
||||||
|
"revert", // 回滚 commit
|
||||||
|
"chore", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
|
||||||
|
"wip", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
|
||||||
|
],
|
||||||
|
],
|
||||||
|
"subject-case": [0], // subject大小写不做校验
|
||||||
|
},
|
||||||
|
|
||||||
|
prompt: {
|
||||||
|
messages: {
|
||||||
|
type: "选择你要提交的类型 :",
|
||||||
|
scope: "选择一个提交范围(可选):",
|
||||||
|
customScope: "请输入自定义的提交范围 :",
|
||||||
|
subject: "填写简短精炼的变更描述 :\n",
|
||||||
|
body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
|
||||||
|
breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
|
||||||
|
footerPrefixesSelect: "选择关联issue前缀(可选):",
|
||||||
|
customFooterPrefix: "输入自定义issue前缀 :",
|
||||||
|
footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
|
||||||
|
generatingByAI: "正在通过 AI 生成你的提交简短描述...",
|
||||||
|
generatedSelectByAI: "选择一个 AI 生成的简短描述:",
|
||||||
|
confirmCommit: "是否提交或修改commit ?",
|
||||||
|
},
|
||||||
|
// prettier-ignore
|
||||||
|
types: [
|
||||||
|
{ value: "feat", name: "特性: ✨ 新增功能", emoji: ":sparkles:" },
|
||||||
|
{ value: "fix", name: "修复: 🐛 修复缺陷", emoji: ":bug:" },
|
||||||
|
{ value: "docs", name: "文档: 📝 文档变更(更新README文件,或者注释)", emoji: ":memo:" },
|
||||||
|
{ value: "style", name: "格式: 🌈 代码格式(空格、格式化、缺失的分号等)", emoji: ":lipstick:" },
|
||||||
|
{ value: "refactor", name: "重构: 🔄 代码重构(不修复错误也不添加特性的代码更改)", emoji: ":recycle:" },
|
||||||
|
{ value: "perf", name: "性能: 🚀 性能优化", emoji: ":zap:" },
|
||||||
|
{ value: "test", name: "测试: 🧪 添加疏漏测试或已有测试改动", emoji: ":white_check_mark:"},
|
||||||
|
{ value: "build", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 vite 配置等)", emoji: ":package:"},
|
||||||
|
{ value: "ci", name: "集成: ⚙️ 修改 CI 配置、脚本", emoji: ":ferris_wheel:"},
|
||||||
|
{ value: "revert", name: "回退: ↩️ 回滚 commit",emoji: ":rewind:"},
|
||||||
|
{ value: "chore", name: "其他: 🛠️ 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: ":hammer:"},
|
||||||
|
{ value: "wip", name: "开发中: 🚧 开发阶段临时提交", emoji: ":construction:"},
|
||||||
|
],
|
||||||
|
useEmoji: true,
|
||||||
|
emojiAlign: "center",
|
||||||
|
useAI: false,
|
||||||
|
aiNumber: 1,
|
||||||
|
themeColorCode: "",
|
||||||
|
scopes: [],
|
||||||
|
allowCustomScopes: true,
|
||||||
|
allowEmptyScopes: true,
|
||||||
|
customScopesAlign: "bottom",
|
||||||
|
customScopesAlias: "custom",
|
||||||
|
emptyScopesAlias: "empty",
|
||||||
|
upperCaseSubject: false,
|
||||||
|
markBreakingChangeMode: false,
|
||||||
|
allowBreakingChanges: ["feat", "fix"],
|
||||||
|
breaklineNumber: 100,
|
||||||
|
breaklineChar: "|",
|
||||||
|
skipQuestions: [],
|
||||||
|
issuePrefixes: [{ value: "closed", name: "closed: ISSUES has been processed" }],
|
||||||
|
customIssuePrefixAlign: "top",
|
||||||
|
emptyIssuePrefixAlias: "skip",
|
||||||
|
customIssuePrefixAlias: "custom",
|
||||||
|
allowCustomIssuePrefix: true,
|
||||||
|
allowEmptyIssuePrefix: true,
|
||||||
|
confirmColorize: true,
|
||||||
|
maxHeaderLength: Infinity,
|
||||||
|
maxSubjectLength: Infinity,
|
||||||
|
minSubjectLength: 0,
|
||||||
|
scopeOverrides: undefined,
|
||||||
|
defaultBody: "",
|
||||||
|
defaultIssues: "",
|
||||||
|
defaultScope: "",
|
||||||
|
defaultSubject: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -113,6 +113,13 @@
|
|||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"sass": "^1.89.2",
|
"sass": "^1.89.2",
|
||||||
|
"stylelint": "^16.25.0",
|
||||||
|
"stylelint-config-html": "^1.1.0",
|
||||||
|
"stylelint-config-recess-order": "^6.1.0",
|
||||||
|
"stylelint-config-recommended": "^15.0.0",
|
||||||
|
"stylelint-config-recommended-scss": "^14.1.0",
|
||||||
|
"stylelint-config-recommended-vue": "^1.6.1",
|
||||||
|
"stylelint-prettier": "^5.0.3",
|
||||||
"terser": "^5.43.1",
|
"terser": "^5.43.1",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"typescript-eslint": "^8.38.0",
|
"typescript-eslint": "^8.38.0",
|
||||||
|
|||||||
@@ -166,9 +166,9 @@ defineExpose({ setCron });
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.interval-tab-form {
|
.interval-tab-form {
|
||||||
width: 100%;
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 16px 8px;
|
gap: 16px 8px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item {
|
.form-item {
|
||||||
@@ -177,11 +177,11 @@ defineExpose({ setCron });
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form-actions {
|
.form-actions {
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 16px;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 响应式调整
|
// 响应式调整
|
||||||
|
|||||||
@@ -43,20 +43,20 @@ const displayText = computed(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.json-pretty-wrapper {
|
.json-pretty-wrapper {
|
||||||
overflow: auto;
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border-radius: 4px;
|
overflow: auto;
|
||||||
background-color: var(--el-fill-color-blank);
|
background-color: var(--el-fill-color-blank);
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.json-pretty-fallback {
|
.json-pretty-fallback {
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-word;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family:
|
font-family:
|
||||||
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
||||||
monospace;
|
monospace;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
word-break: break-all;
|
||||||
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -313,34 +313,22 @@ const onError = (error: any) => {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-upload--picture-card) {
|
|
||||||
position: relative;
|
|
||||||
width: v-bind("props.style.width ?? '150px'");
|
|
||||||
height: v-bind("props.style.height ?? '150px'");
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
.single-upload__delete-btn {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.single-upload {
|
.single-upload {
|
||||||
&__image {
|
&__image {
|
||||||
border-radius: 6px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__delete-btn {
|
&__delete-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
right: 1px;
|
right: 1px;
|
||||||
|
display: none;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #ff7901;
|
color: #ff7901;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
display: none;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #ff4500;
|
color: #ff4500;
|
||||||
@@ -353,9 +341,21 @@ const onError = (error: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload--picture-card) {
|
||||||
|
position: relative;
|
||||||
|
width: v-bind("props.style.width ?? '150px'");
|
||||||
|
height: v-bind("props.style.height ?? '150px'");
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.single-upload__delete-btn {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.el-upload__tip {
|
.el-upload__tip {
|
||||||
|
margin-top: 7px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
margin-top: 7px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ const handleLock = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-name {
|
&-name {
|
||||||
font-size: 14px;
|
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
|
font-size: 14px;
|
||||||
color: var(--top-header-text-color);
|
color: var(--top-header-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,35 +147,35 @@ function handleShowForm(show = false) {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.lockpage {
|
.lockpage {
|
||||||
z-index: 3000;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
inset: 0;
|
z-index: 3000;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
.unlock-container {
|
.unlock-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.5rem;
|
top: 0.5rem;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
padding-top: 1.25rem;
|
|
||||||
height: 4rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #fff;
|
height: 4rem;
|
||||||
flex-direction: column;
|
|
||||||
cursor: pointer;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
|
padding-top: 1.25rem;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 12px;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
|
||||||
@media (min-width: 640px) {
|
@media (min-width: 640px) {
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
@@ -188,47 +188,42 @@ function handleShowForm(show = false) {
|
|||||||
|
|
||||||
.time-container {
|
.time-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
.hour-container {
|
.hour-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
backdrop-filter: blur(8px);
|
justify-content: center;
|
||||||
border-radius: 16px;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
|
font-size: 220px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #bababa;
|
color: #bababa;
|
||||||
background-color: #141313;
|
background-color: #141313;
|
||||||
justify-content: center;
|
border-radius: 16px;
|
||||||
align-items: center;
|
backdrop-filter: blur(8px);
|
||||||
font-size: 220px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.minute-container {
|
.minute-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
backdrop-filter: blur(8px);
|
justify-content: center;
|
||||||
border-radius: 16px;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
display: flex;
|
font-size: 220px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #bababa;
|
color: #bababa;
|
||||||
background-color: #141313;
|
background-color: #141313;
|
||||||
justify-content: center;
|
border-radius: 16px;
|
||||||
align-items: center;
|
backdrop-filter: blur(8px);
|
||||||
font-size: 220px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.meridiem {
|
.meridiem {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 1.25rem;
|
|
||||||
top: 1.25rem;
|
top: 1.25rem;
|
||||||
|
left: 1.25rem;
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,18 +231,18 @@ function handleShowForm(show = false) {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgb(0 0 0 / 50%);
|
background-color: rgb(0 0 0 / 50%);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
.entry-content {
|
.entry-content {
|
||||||
width: 260px;
|
width: 260px;
|
||||||
text-align: center;
|
|
||||||
color: #bababa;
|
color: #bababa;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-container {
|
.avatar-container {
|
||||||
@@ -263,8 +258,8 @@ function handleShowForm(show = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
font-size: 0.875rem;
|
|
||||||
margin: 0.625rem 0;
|
margin: 0.625rem 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
color: var(--logo-title-text-color);
|
color: var(--logo-title-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,22 +269,22 @@ function handleShowForm(show = false) {
|
|||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 0.875rem;
|
|
||||||
margin-top: 0.625rem;
|
margin-top: 0.625rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
color: #ed6f6f;
|
color: #ed6f6f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between; // 左右对齐
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between; // 左右对齐
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
|
|
||||||
.back-button,
|
.back-button,
|
||||||
.login-button,
|
.login-button,
|
||||||
.entry-button {
|
.entry-button {
|
||||||
padding: 0;
|
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-button {
|
.login-button {
|
||||||
@@ -315,8 +310,8 @@ function handleShowForm(show = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.time-display {
|
.time-display {
|
||||||
font-size: 3rem;
|
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
font-size: 3rem;
|
||||||
|
|
||||||
.meridiem-display {
|
.meridiem-display {
|
||||||
font-size: 1.875rem;
|
font-size: 1.875rem;
|
||||||
|
|||||||
@@ -648,6 +648,123 @@ const handleCloseDrawer = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 主题颜色选择器样式 */
|
||||||
|
.theme-color-selector {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.color-label {
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-options {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-option {
|
||||||
|
position: relative;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid var(--el-border-color-light);
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
transition: all 0.3s var(--el-transition-duration);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--el-color-primary-light-3);
|
||||||
|
box-shadow: var(--el-box-shadow);
|
||||||
|
transform: translateY(-2px) scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
border-color: var(--el-color-primary);
|
||||||
|
box-shadow: var(--el-box-shadow-dark);
|
||||||
|
transform: translateY(-1px) scale(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-check {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--el-color-white);
|
||||||
|
background: var(--el-overlay-color-lighter);
|
||||||
|
border-radius: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-wrapper {
|
||||||
|
.custom-color-picker {
|
||||||
|
:deep(.el-color-picker__trigger) {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border: 2px solid var(--el-border-color-light);
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
transition: all 0.3s var(--el-transition-duration);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--el-color-primary-light-3);
|
||||||
|
box-shadow: var(--el-box-shadow);
|
||||||
|
transform: translateY(-2px) scale(1.05);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-color-picker__color) {
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-color-picker__color-inner) {
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-color-picker__icon) {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 深色模式适配 */
|
||||||
|
.dark & {
|
||||||
|
.color-option {
|
||||||
|
border-color: var(--el-border-color);
|
||||||
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--el-color-primary-light-3);
|
||||||
|
box-shadow: var(--el-box-shadow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-wrapper {
|
||||||
|
.custom-color-picker {
|
||||||
|
:deep(.el-color-picker__trigger) {
|
||||||
|
border-color: var(--el-border-color);
|
||||||
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--el-color-primary-light-3);
|
||||||
|
box-shadow: var(--el-box-shadow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* 深色模式适配 */
|
/* 深色模式适配 */
|
||||||
.dark {
|
.dark {
|
||||||
.action-footer {
|
.action-footer {
|
||||||
@@ -677,125 +794,6 @@ const handleCloseDrawer = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 主题颜色选择器样式 */
|
|
||||||
.theme-color-selector {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
|
|
||||||
.color-label {
|
|
||||||
flex-shrink: 0;
|
|
||||||
min-width: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-options {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-option {
|
|
||||||
position: relative;
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
cursor: pointer;
|
|
||||||
border: 2px solid var(--el-border-color-light);
|
|
||||||
border-radius: 6px;
|
|
||||||
transition: all 0.3s var(--el-transition-duration);
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
transform: translateY(-2px) scale(1.05);
|
|
||||||
box-shadow: var(--el-box-shadow);
|
|
||||||
border-color: var(--el-color-primary-light-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.is-active {
|
|
||||||
border-color: var(--el-color-primary);
|
|
||||||
transform: translateY(-1px) scale(1.08);
|
|
||||||
box-shadow: var(--el-box-shadow-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-check {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
color: var(--el-color-white);
|
|
||||||
background: var(--el-overlay-color-lighter);
|
|
||||||
border-radius: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-picker-wrapper {
|
|
||||||
.custom-color-picker {
|
|
||||||
:deep(.el-color-picker__trigger) {
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
border: 2px solid var(--el-border-color-light);
|
|
||||||
border-radius: 6px;
|
|
||||||
transition: all 0.3s var(--el-transition-duration);
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
transform: translateY(-2px) scale(1.05);
|
|
||||||
box-shadow: var(--el-box-shadow);
|
|
||||||
border-color: var(--el-color-primary-light-3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-color-picker__color) {
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-color-picker__color-inner) {
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-color-picker__icon) {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 深色模式适配 */
|
|
||||||
.dark {
|
|
||||||
.theme-color-selector {
|
|
||||||
.color-option {
|
|
||||||
border-color: var(--el-border-color);
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--el-color-primary-light-3);
|
|
||||||
box-shadow: var(--el-box-shadow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-picker-wrapper {
|
|
||||||
.custom-color-picker {
|
|
||||||
:deep(.el-color-picker__trigger) {
|
|
||||||
border-color: var(--el-border-color);
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--el-color-primary-light-3);
|
|
||||||
box-shadow: var(--el-box-shadow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 复制配置对话框样式 */
|
/* 复制配置对话框样式 */
|
||||||
:deep(.copy-config-dialog) {
|
:deep(.copy-config-dialog) {
|
||||||
.el-message-box__content {
|
.el-message-box__content {
|
||||||
|
|||||||
@@ -790,8 +790,8 @@ onUnmounted(() => {
|
|||||||
border: 1px solid var(--el-border-color-light);
|
border: 1px solid var(--el-border-color-light);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--el-fill-color-light);
|
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
|
background-color: var(--el-fill-color-light);
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
transform: scale(1.1);
|
transform: scale(1.1);
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
@import url("./vxe-table.css");
|
@import url("./vxe-table.css");
|
||||||
|
|
||||||
.app-container {
|
.app-container {
|
||||||
padding: 12px;
|
|
||||||
border-radius: 4px;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
padding: 12px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进度条颜色
|
// 进度条颜色
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ httpRequest.interceptors.response.use(
|
|||||||
return Promise.reject(new Error(jsonData.msg || "服务异常"));
|
return Promise.reject(new Error(jsonData.msg || "服务异常"));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error("请求异常:", e);
|
||||||
// 如果无法解析为JSON,则使用默认错误处理
|
// 如果无法解析为JSON,则使用默认错误处理
|
||||||
ElMessage.error(error.message || "请求异常");
|
ElMessage.error(error.message || "请求异常");
|
||||||
return Promise.reject(new Error(error.message || "请求异常"));
|
return Promise.reject(new Error(error.message || "请求异常"));
|
||||||
|
|||||||
+54
-390
@@ -1,400 +1,64 @@
|
|||||||
<!-- 角色授权 -->
|
/**
|
||||||
<template>
|
* 存储工具类
|
||||||
<!-- 分配权限弹窗 -->
|
* 提供localStorage和sessionStorage操作方法
|
||||||
<el-drawer
|
*/
|
||||||
v-model="drawerVisible"
|
export class Storage {
|
||||||
:title="'【' + props.roleName + '】权限分配'"
|
/**
|
||||||
:size="drawerSize"
|
* localStorage 存储
|
||||||
>
|
*/
|
||||||
<el-container>
|
static set(key: string, value: any): void {
|
||||||
<!-- 数据权限 -->
|
localStorage.setItem(key, JSON.stringify(value));
|
||||||
<el-aside>
|
|
||||||
<div class="border-r-1 border-r-[#f0f0f0] b-r-solid h-[100%] p-[20px] box-border">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<div style="display: flex; gap: 10px">
|
|
||||||
<div style="width: 10px; background-color: #409eff"></div>
|
|
||||||
<div>
|
|
||||||
<span style="font-size: 16px">数据授权</span>
|
|
||||||
<el-tooltip placement="right">
|
|
||||||
<template #content>
|
|
||||||
<span>授权用户可操作的数据范围</span>
|
|
||||||
</template>
|
|
||||||
<el-icon class="ml-1 inline-block cursor-pointer">
|
|
||||||
<QuestionFilled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3">
|
|
||||||
<el-form ref="dataFormRef" :model="permissionState">
|
|
||||||
<el-form-item prop="data_scope">
|
|
||||||
<el-select v-model="permissionState.data_scope">
|
|
||||||
<el-option :key="1" label="仅本人数据权限" :value="1" />
|
|
||||||
<el-option :key="2" label="本部门数据权限" :value="2" />
|
|
||||||
<el-option :key="3" label="本部门及以下数据权限" :value="3" />
|
|
||||||
<el-option :key="4" label="全部数据权限" :value="4" />
|
|
||||||
<el-option :key="5" label="自定义数据权限" :value="5" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="permissionState.data_scope === 5 && deptTreeData.length"
|
|
||||||
class="mt-5 max-h-[60vh] b-1 b-solid b-[#e5e7eb] p-10px overflow-auto box-border"
|
|
||||||
>
|
|
||||||
<el-input v-model="deptFilterText" placeholder="部门名称" />
|
|
||||||
<el-tree
|
|
||||||
ref="deptTreeRef"
|
|
||||||
node-key="value"
|
|
||||||
show-checkbox
|
|
||||||
:data="deptTreeData"
|
|
||||||
:filter-node-method="handleFilter"
|
|
||||||
default-expand-all
|
|
||||||
:highlight-current="true"
|
|
||||||
:check-strictly="!parentChildLinked"
|
|
||||||
style="height: calc(100% - 60px); overflow-y: auto; margin-top: 10px"
|
|
||||||
@check="deptTreeCheck"
|
|
||||||
>
|
|
||||||
<template #empty>
|
|
||||||
<el-empty :image-size="80" description="暂无数据" />
|
|
||||||
</template>
|
|
||||||
</el-tree>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-aside>
|
|
||||||
|
|
||||||
<!-- 菜单权限 -->
|
|
||||||
<el-main>
|
|
||||||
<div style="display: flex; gap: 10px">
|
|
||||||
<div style="width: 10px; background-color: #409eff"></div>
|
|
||||||
<div>
|
|
||||||
<span style="font-size: 16px">菜单授权</span>
|
|
||||||
<el-tooltip placement="right">
|
|
||||||
<template #content>
|
|
||||||
<span>授权用户可操作的菜单权限</span>
|
|
||||||
</template>
|
|
||||||
<el-icon class="ml-1 inline-block cursor-pointer">
|
|
||||||
<QuestionFilled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3 flex-x-between">
|
|
||||||
<el-input v-model="permFilterText" placeholder="菜单名称" />
|
|
||||||
<div class="flex-center ml-5">
|
|
||||||
<el-button type="primary" size="small" plain @click="togglePermTree">
|
|
||||||
<template #icon>
|
|
||||||
<Switch />
|
|
||||||
</template>
|
|
||||||
{{ isExpanded ? "收缩" : "展开" }}
|
|
||||||
</el-button>
|
|
||||||
<el-checkbox
|
|
||||||
v-model="parentChildLinked"
|
|
||||||
class="ml-5"
|
|
||||||
@change="handleParentChildLinkedChange"
|
|
||||||
>
|
|
||||||
父子联动
|
|
||||||
</el-checkbox>
|
|
||||||
|
|
||||||
<el-tooltip placement="bottom">
|
|
||||||
<template #content>
|
|
||||||
如果只需勾选菜单权限,不需要勾选子菜单或者按钮权限,请关闭父子联动
|
|
||||||
</template>
|
|
||||||
<el-icon class="ml-1 color-[--el-color-primary] inline-block cursor-pointer">
|
|
||||||
<QuestionFilled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5 max-h-[65vh] b-1 b-solid b-[#e5e7eb] p-10px overflow-auto box-border">
|
|
||||||
<el-tree
|
|
||||||
ref="permTreeRef"
|
|
||||||
node-key="value"
|
|
||||||
show-checkbox
|
|
||||||
:data="menuTreeData"
|
|
||||||
:filter-node-method="handleFilter"
|
|
||||||
default-expand-all
|
|
||||||
:highlight-current="true"
|
|
||||||
:check-strictly="!parentChildLinked"
|
|
||||||
style="height: calc(100% - 60px); overflow: auto; margin-top: 10px"
|
|
||||||
@check="menuTreeCheck"
|
|
||||||
>
|
|
||||||
<template #empty>
|
|
||||||
<el-empty :image-size="80" description="暂无数据" />
|
|
||||||
</template>
|
|
||||||
</el-tree>
|
|
||||||
</div>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
|
||||||
<el-button type="primary" @click.stop="handleDrawerSave">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-drawer>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// 添加 props 来接收 dictType
|
|
||||||
const props = defineProps({
|
|
||||||
roleName: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
roleId: {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
import { listToTree, formatTree } from "@/utils/common";
|
|
||||||
import RoleAPI, {
|
|
||||||
permissionDataType,
|
|
||||||
permissionDeptType,
|
|
||||||
permissionMenuType,
|
|
||||||
} from "@/api/module_system/role";
|
|
||||||
import DeptAPI from "@/api/module_system/dept";
|
|
||||||
import MenuAPI from "@/api/module_system/menu";
|
|
||||||
import type { TreeInstance } from "element-plus";
|
|
||||||
import { useAppStore } from "@/store/modules/app.store";
|
|
||||||
import { DeviceEnum } from "@/enums/settings/device.enum";
|
|
||||||
import { useUserStore } from "@/store";
|
|
||||||
|
|
||||||
const appStore = useAppStore();
|
|
||||||
const drawerSize = computed(() => (appStore.device === DeviceEnum.DESKTOP ? "800px" : "90%"));
|
|
||||||
const emit = defineEmits(["update:modelValue", "saved"]);
|
|
||||||
|
|
||||||
const permTreeRef = ref<TreeInstance>();
|
|
||||||
const deptTreeRef = ref<TreeInstance>();
|
|
||||||
const deptFilterText = ref("");
|
|
||||||
const permFilterText = ref("");
|
|
||||||
const dataFormRef = ref();
|
|
||||||
const drawerVisible = computed({
|
|
||||||
get() {
|
|
||||||
return props.modelValue;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emit("update:modelValue", value);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const isExpanded = ref(true);
|
|
||||||
const parentChildLinked = ref(false);
|
|
||||||
const loading = ref<boolean>(false);
|
|
||||||
const deptTreeData = ref<permissionDeptType[]>([]);
|
|
||||||
const menuTreeData = ref<permissionMenuType[]>([]);
|
|
||||||
const permissionState = ref<permissionDataType>({
|
|
||||||
role_ids: [],
|
|
||||||
menu_ids: [],
|
|
||||||
data_scope: 1,
|
|
||||||
dept_ids: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化方法,用于打开抽屉并加载数据
|
|
||||||
const init = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 获取全部部门树
|
|
||||||
const deptResponse = await DeptAPI.getDeptList();
|
|
||||||
deptTreeData.value = formatTree(listToTree(deptResponse.data.data));
|
|
||||||
|
|
||||||
// 获取全部菜单树
|
|
||||||
const menuResponse = await MenuAPI.getMenuList();
|
|
||||||
menuTreeData.value = formatTree(listToTree(menuResponse.data.data));
|
|
||||||
|
|
||||||
// 获取角色详情
|
|
||||||
const roleResponse = await RoleAPI.getRoleDetail(props.roleId);
|
|
||||||
|
|
||||||
// 更新权限状态
|
|
||||||
permissionState.value = {
|
|
||||||
role_ids: [props.roleId],
|
|
||||||
menu_ids: roleResponse.data.data.menus?.map((menu) => menu.id) || [],
|
|
||||||
data_scope: roleResponse.data.data.data_scope || 1,
|
|
||||||
dept_ids: roleResponse.data.data.depts?.map((dept) => dept.id) || [],
|
|
||||||
};
|
|
||||||
|
|
||||||
// 根据保存的权限数据判断是否应该开启父子联动
|
|
||||||
parentChildLinked.value = checkParentChildLinked(
|
|
||||||
permissionState.value.menu_ids,
|
|
||||||
menuTreeData.value
|
|
||||||
);
|
|
||||||
|
|
||||||
// 回显菜单树选中项
|
|
||||||
if (permTreeRef.value) {
|
|
||||||
await permTreeRef.value.setCheckedKeys(permissionState.value.menu_ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改:增加对 deptTreeRef.value 的存在性判断,并添加日志
|
|
||||||
if (permissionState.value.data_scope === 5 && deptTreeRef.value) {
|
|
||||||
// await 一定不能丢,否则到导致初始化时候deptTreeRef.value 为 undefined
|
|
||||||
await deptTreeRef.value.setCheckedKeys(permissionState.value.dept_ids);
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
|
||||||
ElMessage.error("获取权限数据失败: " + error.message);
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
// handleCancel()
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// 取消按钮处理函数
|
static get<T>(key: string, defaultValue?: T): T {
|
||||||
function handleCancel() {
|
const value = localStorage.getItem(key);
|
||||||
drawerVisible.value = false;
|
if (!value) return defaultValue as T;
|
||||||
}
|
|
||||||
|
|
||||||
// 保存权限分配
|
try {
|
||||||
async function handleDrawerSave() {
|
return JSON.parse(value);
|
||||||
try {
|
} catch {
|
||||||
if (props.roleId === 1) {
|
// 如果解析失败,返回原始字符串
|
||||||
ElMessage.warning("系统默认角色,不可操作");
|
return value as unknown as T;
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
|
|
||||||
// 构造提交数据
|
|
||||||
const submitData: permissionDataType = {
|
|
||||||
role_ids: [props.roleId],
|
|
||||||
menu_ids: (permTreeRef.value?.getCheckedKeys() || []).map((key) => Number(key)),
|
|
||||||
data_scope: permissionState.value.data_scope,
|
|
||||||
dept_ids: (deptTreeRef.value?.getCheckedKeys() || []).map((key) => Number(key)),
|
|
||||||
};
|
|
||||||
|
|
||||||
await RoleAPI.setPermission(submitData);
|
|
||||||
|
|
||||||
// 更新全局用户状态,刷新权限信息
|
|
||||||
const userStore = useUserStore();
|
|
||||||
await userStore.getUserInfo();
|
|
||||||
|
|
||||||
drawerVisible.value = false;
|
|
||||||
emit("saved");
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 部门树选择回调
|
|
||||||
const deptTreeCheck = (checkedIds: number[]) => {
|
|
||||||
permissionState.value.dept_ids = checkedIds;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 菜单选择变更回调
|
|
||||||
const menuTreeCheck = (checkedIds: number[]) => {
|
|
||||||
permissionState.value.menu_ids = checkedIds;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 展开/收缩 菜单权限树
|
|
||||||
function togglePermTree() {
|
|
||||||
isExpanded.value = !isExpanded.value;
|
|
||||||
if (permTreeRef.value) {
|
|
||||||
Object.values(permTreeRef.value.store.nodesMap).forEach((node: any) => {
|
|
||||||
if (isExpanded.value) {
|
|
||||||
node.expand();
|
|
||||||
} else {
|
|
||||||
node.collapse();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 部门筛选
|
|
||||||
watch(deptFilterText, (val) => {
|
|
||||||
deptTreeRef.value!.filter(val);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 菜单筛选
|
|
||||||
watch(permFilterText, (val) => {
|
|
||||||
permTreeRef.value!.filter(val);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 树节点过滤
|
|
||||||
function handleFilter(value: string, data: { [key: string]: any }) {
|
|
||||||
if (!value) return true;
|
|
||||||
return data.label.includes(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查权限数据是否遵循父子联动模式
|
|
||||||
function checkParentChildLinked(menuIds: number[], menuTreeData: permissionMenuType[]): boolean {
|
|
||||||
if (!menuIds.length || !menuTreeData.length) return false;
|
|
||||||
|
|
||||||
// 创建一个映射来快速查找菜单项
|
|
||||||
const menuMap = new Map<number, permissionMenuType>();
|
|
||||||
const buildMenuMap = (menus: permissionMenuType[]) => {
|
|
||||||
menus.forEach((menu) => {
|
|
||||||
menuMap.set(menu.id, menu);
|
|
||||||
if (menu.children) {
|
|
||||||
buildMenuMap(menu.children);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
buildMenuMap(menuTreeData);
|
|
||||||
|
|
||||||
let hasParentChildConflict = false;
|
|
||||||
|
|
||||||
// 检查每个选中的菜单项
|
|
||||||
for (const menuId of menuIds) {
|
|
||||||
const menu = menuMap.get(menuId);
|
|
||||||
if (!menu) continue;
|
|
||||||
|
|
||||||
// 如果选中了父菜单,检查是否有子菜单未被选中
|
|
||||||
if (menu.children && menu.children.length > 0) {
|
|
||||||
const hasUnselectedChildren = menu.children.some((child) => !menuIds.includes(child.id));
|
|
||||||
if (hasUnselectedChildren) {
|
|
||||||
hasParentChildConflict = true;
|
|
||||||
break; // 发现冲突,直接返回false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果选中了子菜单,检查父菜单是否也被选中
|
|
||||||
const parentMenu = findParentMenu(menuId, menuTreeData);
|
|
||||||
if (parentMenu && !menuIds.includes(parentMenu.id)) {
|
|
||||||
hasParentChildConflict = true;
|
|
||||||
break; // 发现冲突,直接返回false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有发现父子冲突,说明是父子联动模式
|
static remove(key: string): void {
|
||||||
return !hasParentChildConflict;
|
localStorage.removeItem(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找父菜单
|
/**
|
||||||
function findParentMenu(
|
* localStorage 清空
|
||||||
menuId: number,
|
*/
|
||||||
menuTreeData: permissionMenuType[]
|
static clear(): void {
|
||||||
): permissionMenuType | null {
|
localStorage.clear();
|
||||||
for (const menu of menuTreeData) {
|
}
|
||||||
if (menu.children) {
|
|
||||||
for (const child of menu.children) {
|
/**
|
||||||
if (child.id === menuId) {
|
* sessionStorage 存储
|
||||||
return menu;
|
*/
|
||||||
}
|
static sessionSet(key: string, value: any): void {
|
||||||
// 递归查找更深层的父菜单
|
sessionStorage.setItem(key, JSON.stringify(value));
|
||||||
const found = findParentMenu(menuId, [child]);
|
}
|
||||||
if (found) return found;
|
|
||||||
}
|
static sessionGet<T>(key: string, defaultValue?: T): T {
|
||||||
|
const value = sessionStorage.getItem(key);
|
||||||
|
if (!value) return defaultValue as T;
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.parse(value);
|
||||||
|
} catch {
|
||||||
|
// 如果解析失败,返回原始字符串
|
||||||
|
return value as unknown as T;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
static sessionRemove(key: string): void {
|
||||||
|
sessionStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* sessionStorage 清空
|
||||||
|
*/
|
||||||
|
static sessionClear(): void {
|
||||||
|
sessionStorage.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 父子菜单节点是否联动
|
|
||||||
function handleParentChildLinkedChange(val: any) {
|
|
||||||
parentChildLinked.value = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await init();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
|
|||||||
@@ -592,8 +592,8 @@ onMounted(async () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.avatar-wrapper {
|
.avatar-wrapper {
|
||||||
margin-bottom: 16px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
.el-upload {
|
.el-upload {
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -605,12 +605,12 @@ onMounted(async () => {
|
|||||||
// top: 50%;
|
// top: 50%;
|
||||||
// left: 50%;
|
// left: 50%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
opacity: 0;
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
background: var(--el-color-primary);
|
background: var(--el-color-primary);
|
||||||
|
border-radius: 50%;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 提升 hover 样式优先级 */
|
/* 提升 hover 样式优先级 */
|
||||||
|
|||||||
@@ -436,25 +436,25 @@ onUnmounted(() => {
|
|||||||
.chatgpt-container {
|
.chatgpt-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 120px);
|
height: calc(100vh - 120px);
|
||||||
background: var(--el-bg-color);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background: var(--el-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主聊天区域
|
// 主聊天区域
|
||||||
.main-chat {
|
.main-chat {
|
||||||
flex: 1;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.chat-navbar {
|
.chat-navbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
padding: 16px 24px;
|
padding: 16px 24px;
|
||||||
border-bottom: 1px solid var(--el-border-color-light);
|
|
||||||
background: var(--el-bg-color);
|
background: var(--el-bg-color);
|
||||||
|
border-bottom: 1px solid var(--el-border-color-light);
|
||||||
|
|
||||||
.navbar-left {
|
.navbar-left {
|
||||||
h2 {
|
h2 {
|
||||||
@@ -467,13 +467,13 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.navbar-right {
|
.navbar-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.connection-status {
|
.connection-status {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
||||||
.status-icon {
|
.status-icon {
|
||||||
@@ -497,9 +497,9 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.chat-messages {
|
.chat-messages {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
padding-bottom: 120px; // 为底部输入框留出空间
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background: var(--el-bg-color);
|
background: var(--el-bg-color);
|
||||||
padding-bottom: 120px; // 为底部输入框留出空间
|
|
||||||
|
|
||||||
// 欢迎界面
|
// 欢迎界面
|
||||||
.welcome-screen {
|
.welcome-screen {
|
||||||
@@ -520,17 +520,17 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
margin: 0 0 16px;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0 0 16px;
|
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-subtitle {
|
.welcome-subtitle {
|
||||||
font-size: 16px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
|
font-size: 16px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-prompts {
|
.example-prompts {
|
||||||
@@ -540,18 +540,18 @@ onUnmounted(() => {
|
|||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
|
|
||||||
.prompt-card {
|
.prompt-card {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
background: var(--el-bg-color-page);
|
background: var(--el-bg-color-page);
|
||||||
border: 1px solid var(--el-border-color-light);
|
border: 1px solid var(--el-border-color-light);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
text-align: left;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border-color: var(--el-color-primary);
|
border-color: var(--el-color-primary);
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
h4 {
|
h4 {
|
||||||
@@ -564,8 +564,8 @@ onUnmounted(() => {
|
|||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -574,40 +574,40 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
// 消息列表
|
// 消息列表
|
||||||
.messages-list {
|
.messages-list {
|
||||||
padding: 24px;
|
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
padding: 24px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
.message-group {
|
.message-group {
|
||||||
margin-bottom: 32px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
.message-avatar {
|
.message-avatar {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--el-color-primary);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: white;
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
color: white;
|
||||||
|
background: var(--el-color-primary);
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-avatar {
|
.ai-avatar {
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--el-color-success);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: white;
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
color: white;
|
||||||
|
background: var(--el-color-success);
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,23 +641,23 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(code) {
|
:deep(code) {
|
||||||
background: var(--el-fill-color-light);
|
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border-radius: 4px;
|
|
||||||
font-family: "JetBrains Mono", "Courier New", monospace;
|
font-family: "JetBrains Mono", "Courier New", monospace;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
background: var(--el-fill-color-light);
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(pre) {
|
:deep(pre) {
|
||||||
background: var(--el-fill-color-light);
|
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
border-radius: 8px;
|
|
||||||
overflow-x: auto;
|
|
||||||
margin: 12px 0;
|
margin: 12px 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
background: var(--el-fill-color-light);
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
code {
|
code {
|
||||||
background: none;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
background: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,8 +682,8 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.typing-indicator {
|
.typing-indicator {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
color: var(--el-text-color-secondary);
|
color: var(--el-text-color-secondary);
|
||||||
|
|
||||||
.typing-dots {
|
.typing-dots {
|
||||||
@@ -693,8 +693,8 @@ onUnmounted(() => {
|
|||||||
span {
|
span {
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--el-text-color-secondary);
|
background: var(--el-text-color-secondary);
|
||||||
|
border-radius: 50%;
|
||||||
animation: typing 1.4s infinite;
|
animation: typing 1.4s infinite;
|
||||||
|
|
||||||
&:nth-child(2) {
|
&:nth-child(2) {
|
||||||
@@ -716,8 +716,8 @@ onUnmounted(() => {
|
|||||||
transition: opacity 0.2s ease;
|
transition: opacity 0.2s ease;
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
padding: 4px 8px;
|
|
||||||
min-height: auto;
|
min-height: auto;
|
||||||
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,13 +736,13 @@ onUnmounted(() => {
|
|||||||
// 输入区域
|
// 输入区域
|
||||||
.chat-input {
|
.chat-input {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
z-index: 10;
|
||||||
padding: 16px 24px 24px;
|
padding: 16px 24px 24px;
|
||||||
background: var(--el-bg-color);
|
background: var(--el-bg-color);
|
||||||
border-top: 1px solid var(--el-border-color-light);
|
border-top: 1px solid var(--el-border-color-light);
|
||||||
z-index: 10;
|
|
||||||
|
|
||||||
.input-wrapper {
|
.input-wrapper {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
@@ -753,8 +753,8 @@ onUnmounted(() => {
|
|||||||
background: var(--el-bg-color-page);
|
background: var(--el-bg-color-page);
|
||||||
border: 1px solid var(--el-border-color);
|
border: 1px solid var(--el-border-color);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
transition: border-color 0.2s ease;
|
|
||||||
box-shadow: var(--el-box-shadow-light);
|
box-shadow: var(--el-box-shadow-light);
|
||||||
|
transition: border-color 0.2s ease;
|
||||||
|
|
||||||
&:focus-within {
|
&:focus-within {
|
||||||
border-color: var(--el-color-primary);
|
border-color: var(--el-color-primary);
|
||||||
@@ -763,13 +763,13 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.message-input {
|
.message-input {
|
||||||
:deep(.el-textarea__inner) {
|
:deep(.el-textarea__inner) {
|
||||||
border: none;
|
|
||||||
box-shadow: none;
|
|
||||||
background: transparent;
|
|
||||||
resize: none;
|
|
||||||
padding: 16px 60px 16px 16px;
|
padding: 16px 60px 16px 16px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
resize: none;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
@@ -94,15 +94,15 @@ watch(
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.internal-app-container {
|
.internal-app-container {
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
background: var(--el-bg-color);
|
background: var(--el-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.internal-app-content {
|
.internal-app-content {
|
||||||
flex: 1;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,15 +115,15 @@ watch(
|
|||||||
.loading-overlay {
|
.loading-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
background: var(--el-bg-color);
|
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: var(--el-bg-color);
|
||||||
|
|
||||||
.loading-icon {
|
.loading-icon {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
@@ -132,8 +132,8 @@ watch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: var(--el-text-color-regular);
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -506,28 +506,28 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-grid-card {
|
.app-grid-card {
|
||||||
height: calc(100vh - 200px);
|
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: calc(100vh - 200px);
|
||||||
|
|
||||||
:deep(.el-card__footer) {
|
:deep(.el-card__footer) {
|
||||||
margin-top: auto;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
margin-top: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-grid {
|
.app-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-card-el {
|
.app-card-el {
|
||||||
@@ -544,21 +544,21 @@ onMounted(() => {
|
|||||||
|
|
||||||
.app-info-header {
|
.app-info-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-name-el {
|
.app-name-el {
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
margin: 0 0 4px 0;
|
margin: 0 0 4px 0;
|
||||||
line-height: 1.3;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.3;
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-card-content {
|
.app-card-content {
|
||||||
@@ -566,13 +566,13 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.app-description {
|
.app-description {
|
||||||
font-size: 14px;
|
|
||||||
color: var(--el-text-color-regular);
|
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
line-clamp: 2;
|
line-clamp: 2;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-meta-info {
|
.app-meta-info {
|
||||||
@@ -585,17 +585,17 @@ onMounted(() => {
|
|||||||
|
|
||||||
.app-meta-row {
|
.app-meta-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-item {
|
.meta-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
white-space: nowrap;
|
align-items: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-item.left {
|
.meta-item.left {
|
||||||
@@ -607,13 +607,13 @@ onMounted(() => {
|
|||||||
.meta-item.right {
|
.meta-item.right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
text-align: right;
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-icon {
|
.meta-icon {
|
||||||
color: var(--el-text-color-placeholder);
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
color: var(--el-text-color-placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-item span {
|
.meta-item span {
|
||||||
@@ -629,8 +629,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 12px;
|
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +641,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -736,7 +736,7 @@
|
|||||||
:value="dict.dict_type || ''"
|
:value="dict.dict_type || ''"
|
||||||
>
|
>
|
||||||
<span style="float: left">{{ dict.dict_name }}</span>
|
<span style="float: left">{{ dict.dict_name }}</span>
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px">
|
<span style="float: right; font-size: 13px; color: #8492a6">
|
||||||
{{ dict.dict_type }}
|
{{ dict.dict_type }}
|
||||||
</span>
|
</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|||||||
@@ -787,12 +787,12 @@ onMounted(() => {
|
|||||||
.data-table__content {
|
.data-table__content {
|
||||||
.file-name {
|
.file-name {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.file-name-clickable {
|
.file-name-clickable {
|
||||||
cursor: pointer;
|
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--el-color-primary-light-3);
|
color: var(--el-color-primary-light-3);
|
||||||
@@ -805,31 +805,31 @@ onMounted(() => {
|
|||||||
.grid-view {
|
.grid-view {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
||||||
height: calc(100vh - 200px);
|
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
height: calc(100vh - 200px);
|
||||||
|
|
||||||
.grid-item {
|
.grid-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
// 使用系统主题颜色
|
// 使用系统主题颜色
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
.item-name {
|
.item-name {
|
||||||
|
margin-bottom: 5px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-breadcrumb__item) {
|
:deep(.el-breadcrumb__item) {
|
||||||
&.is-link {
|
&.is-link {
|
||||||
cursor: pointer;
|
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--el-color-primary-light-3);
|
color: var(--el-color-primary-light-3);
|
||||||
|
|||||||
@@ -116,13 +116,9 @@ onMounted(() => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
// 添加伪元素作为背景层
|
|
||||||
.login-container {
|
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-bar {
|
.action-bar {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
default-expand-all
|
default-expand-all
|
||||||
:highlight-current="true"
|
:highlight-current="true"
|
||||||
:check-strictly="!parentChildLinked"
|
:check-strictly="!parentChildLinked"
|
||||||
style="height: calc(100% - 60px); overflow-y: auto; margin-top: 10px"
|
style="height: calc(100% - 60px); margin-top: 10px; overflow-y: auto"
|
||||||
@check="deptTreeCheck"
|
@check="deptTreeCheck"
|
||||||
>
|
>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
default-expand-all
|
default-expand-all
|
||||||
:highlight-current="true"
|
:highlight-current="true"
|
||||||
:check-strictly="!parentChildLinked"
|
:check-strictly="!parentChildLinked"
|
||||||
style="height: calc(100% - 60px); overflow: auto; margin-top: 10px"
|
style="height: calc(100% - 60px); margin-top: 10px; overflow: auto"
|
||||||
@check="menuTreeCheck"
|
@check="menuTreeCheck"
|
||||||
>
|
>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
|
|||||||
@@ -28,6 +28,6 @@
|
|||||||
"types": ["node", "vite/client", "element-plus/global"]
|
"types": ["node", "vite/client", "element-plus/global"]
|
||||||
},
|
},
|
||||||
|
|
||||||
"include": ["mock/**/*.ts", "src/**/*.ts", "src/**/*.vue", "vite.config.ts", "eslint.config.ts", "uno.config.ts"],
|
"include": ["src/**/*.ts", "src/**/*.vue", "vite.config.ts", "eslint.config.ts", "uno.config.ts"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-12
@@ -1,5 +1,5 @@
|
|||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { type ConfigEnv, type UserConfig, loadEnv, defineConfig, PluginOption } from "vite";
|
import { type ConfigEnv, loadEnv, defineConfig } from "vite";
|
||||||
|
|
||||||
import AutoImport from "unplugin-auto-import/vite";
|
import AutoImport from "unplugin-auto-import/vite";
|
||||||
import Components from "unplugin-vue-components/vite";
|
import Components from "unplugin-vue-components/vite";
|
||||||
@@ -202,16 +202,16 @@ export default defineConfig(({ mode }: ConfigEnv) => {
|
|||||||
minify: isProduction ? "terser" : false, // 只在生产环境启用压缩
|
minify: isProduction ? "terser" : false, // 只在生产环境启用压缩
|
||||||
terserOptions: isProduction
|
terserOptions: isProduction
|
||||||
? {
|
? {
|
||||||
compress: {
|
compress: {
|
||||||
keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题
|
keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题
|
||||||
drop_console: true, // 生产环境去除 console.log, console.warn, console.error 等
|
drop_console: true, // 生产环境去除 console.log, console.warn, console.error 等
|
||||||
drop_debugger: true, // 生产环境去除 debugger
|
drop_debugger: true, // 生产环境去除 debugger
|
||||||
pure_funcs: ["console.log", "console.info"], // 移除指定的函数调用
|
pure_funcs: ["console.log", "console.info"], // 移除指定的函数调用
|
||||||
},
|
},
|
||||||
format: {
|
format: {
|
||||||
comments: true, // 删除注释
|
comments: true, // 删除注释
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
@@ -237,7 +237,6 @@ export default defineConfig(({ mode }: ConfigEnv) => {
|
|||||||
return "exceljs";
|
return "exceljs";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 其他模块保持当前拆分方式
|
// 其他模块保持当前拆分方式
|
||||||
const module = id.toString().split("node_modules/")[1].split("/")[0];
|
const module = id.toString().split("node_modules/")[1].split("/")[0];
|
||||||
if (["birpc", "hookable"].includes(module)) return;
|
if (["birpc", "hookable"].includes(module)) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user