fix: 修复管理端前端 lint 与构建问题
- 收敛 easyflow-ui-admin 的 lint、格式和类型问题 - 修正 demo 页面与管理端前端构建失败点 - 验证 pnpm lint 与 pnpm build 均已通过
This commit is contained in:
@@ -5,12 +5,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { EasyFlowFormModal } from '@easyflow/common-ui';
|
||||
|
||||
import {
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElMessage,
|
||||
} from 'element-plus';
|
||||
import { ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus';
|
||||
|
||||
import { api } from '#/api/request';
|
||||
import DictSelect from '#/components/dict/DictSelect.vue';
|
||||
@@ -41,14 +36,16 @@ interface CategoryPermissionTreeNode {
|
||||
label: string;
|
||||
}
|
||||
|
||||
const RESOURCE_SCOPE_GROUPS: Array<{ label: string; resourceType: ResourceType }> =
|
||||
[
|
||||
{ resourceType: 'BOT', label: $t('bot.chatAssistant') },
|
||||
{ resourceType: 'PLUGIN', label: $t('menus.ai.plugin') },
|
||||
{ resourceType: 'WORKFLOW', label: $t('menus.ai.workflow') },
|
||||
{ resourceType: 'KNOWLEDGE', label: $t('menus.ai.documentCollection') },
|
||||
{ resourceType: 'RESOURCE', label: $t('menus.ai.resources') },
|
||||
];
|
||||
const RESOURCE_SCOPE_GROUPS: Array<{
|
||||
label: string;
|
||||
resourceType: ResourceType;
|
||||
}> = [
|
||||
{ resourceType: 'BOT', label: $t('bot.chatAssistant') },
|
||||
{ resourceType: 'PLUGIN', label: $t('menus.ai.plugin') },
|
||||
{ resourceType: 'WORKFLOW', label: $t('menus.ai.workflow') },
|
||||
{ resourceType: 'KNOWLEDGE', label: $t('menus.ai.documentCollection') },
|
||||
{ resourceType: 'RESOURCE', label: $t('menus.ai.resources') },
|
||||
];
|
||||
|
||||
const saveForm = ref<FormInstance>();
|
||||
const dialogVisible = ref(false);
|
||||
@@ -270,29 +267,31 @@ function buildScopeItemsFromTree(): CategoryScopeItem[] {
|
||||
}
|
||||
|
||||
function getCategoryScopeDetail(roleId: number | string) {
|
||||
api.get('/api/v1/sysRoleCategoryScope/detail', {
|
||||
params: { roleId },
|
||||
}).then((res) => {
|
||||
if (res.errorCode !== 0) {
|
||||
categoryScopeEditable.value = false;
|
||||
api
|
||||
.get('/api/v1/sysRoleCategoryScope/detail', {
|
||||
params: { roleId },
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.errorCode !== 0) {
|
||||
categoryScopeEditable.value = false;
|
||||
categoryScopeDetail.value = {
|
||||
roleId,
|
||||
scopes: buildDefaultScopes(),
|
||||
};
|
||||
syncCategoryTreeCheckedKeys(categoryScopeDetail.value.scopes);
|
||||
return;
|
||||
}
|
||||
categoryScopeEditable.value = !!res.data?.editable;
|
||||
categoryScopeDetail.value = {
|
||||
roleId,
|
||||
scopes: buildDefaultScopes(),
|
||||
scopes: (res.data?.scopes || buildDefaultScopes()).map((item: any) => ({
|
||||
categoryIds: item.categoryIds || [],
|
||||
resourceType: item.resourceType,
|
||||
scopeMode: item.scopeMode || 'CUSTOM',
|
||||
})),
|
||||
};
|
||||
syncCategoryTreeCheckedKeys(categoryScopeDetail.value.scopes);
|
||||
return;
|
||||
}
|
||||
categoryScopeEditable.value = !!res.data?.editable;
|
||||
categoryScopeDetail.value = {
|
||||
roleId,
|
||||
scopes: (res.data?.scopes || buildDefaultScopes()).map((item: any) => ({
|
||||
categoryIds: item.categoryIds || [],
|
||||
resourceType: item.resourceType,
|
||||
scopeMode: item.scopeMode || 'CUSTOM',
|
||||
})),
|
||||
};
|
||||
syncCategoryTreeCheckedKeys(categoryScopeDetail.value.scopes);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function saveCategoryScope(roleId: number | string) {
|
||||
@@ -375,9 +374,9 @@ async function saveCategoryScope(roleId: number | string) {
|
||||
<style scoped>
|
||||
.role-category-scope-panel {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.role-category-scope-group {
|
||||
@@ -385,16 +384,16 @@ async function saveCategoryScope(roleId: number | string) {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
background: var(--el-fill-color-extra-light);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 10px;
|
||||
background: var(--el-fill-color-extra-light);
|
||||
}
|
||||
|
||||
.role-category-scope-head {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.role-category-scope-title {
|
||||
|
||||
Reference in New Issue
Block a user