perf: style
This commit is contained in:
parent
ff48a75830
commit
aa43967c08
@ -1,14 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="flex-between mb-16">
|
<div class="flex-between mb-16">
|
||||||
<div class="flex align-center"
|
<div
|
||||||
v-if="hasPermission([EditionConst.IS_EE,EditionConst.IS_PE], 'OR')">
|
class="flex align-center"
|
||||||
|
v-if="hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')"
|
||||||
|
>
|
||||||
<!-- 企业版: 选优先级-->
|
<!-- 企业版: 选优先级-->
|
||||||
<span class="lighter mr-16">{{ $t('views.system.resourceAuthorization.priority.label') }}</span>
|
<span class="lighter mr-16">{{
|
||||||
|
$t('views.system.resourceAuthorization.priority.label')
|
||||||
|
}}</span>
|
||||||
<el-radio-group v-model="radioRole">
|
<el-radio-group v-model="radioRole">
|
||||||
<el-radio :value="true" size="large">{{
|
<el-radio :value="true" size="large"
|
||||||
$t('views.system.resourceAuthorization.priority.role')
|
>{{ $t('views.system.resourceAuthorization.priority.role') }}
|
||||||
}}
|
|
||||||
</el-radio>
|
</el-radio>
|
||||||
<el-radio :value="false" size="large">{{ $t('common.custom') }}</el-radio>
|
<el-radio :value="false" size="large">{{ $t('common.custom') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@ -18,7 +21,7 @@
|
|||||||
:placeholder="$t('common.search')"
|
:placeholder="$t('common.search')"
|
||||||
prefix-icon="Search"
|
prefix-icon="Search"
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
:class="hasPermission([EditionConst.IS_EE,EditionConst.IS_PE], 'OR') ? 'w-240' : ''"
|
:class="hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR') ? 'w-240' : ''"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -27,7 +30,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
:data="filterData"
|
:data="filterData"
|
||||||
:max-height="tableHeight"
|
:max-height="tableHeight"
|
||||||
:expand-row-keys="['default']"
|
:expand-row-keys="defaultExpandKeys"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-table-column class-name="folder-flex" prop="name" :label="$t('common.name')">
|
<el-table-column class-name="folder-flex" prop="name" :label="$t('common.name')">
|
||||||
@ -48,7 +51,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<!-- 知识库 icon -->
|
<!-- 知识库 icon -->
|
||||||
<KnowledgeIcon class="mr-12" :size="20" v-else-if="isKnowledge" :type="row.icon"/>
|
<KnowledgeIcon class="mr-12" :size="20" v-else-if="isKnowledge" :type="row.icon" />
|
||||||
<!-- 应用/工具 自定义 icon -->
|
<!-- 应用/工具 自定义 icon -->
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-else-if="isAppIcon(row?.icon) && !isModel"
|
v-else-if="isAppIcon(row?.icon) && !isModel"
|
||||||
@ -57,13 +60,13 @@
|
|||||||
shape="square"
|
shape="square"
|
||||||
:size="20"
|
:size="20"
|
||||||
>
|
>
|
||||||
<img :src="resetUrl(row?.icon)" alt=""/>
|
<img :src="resetUrl(row?.icon)" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<!-- 应用 icon -->
|
<!-- 应用 icon -->
|
||||||
<LogoIcon v-else-if="isApplication" height="20px" class="mr-12"/>
|
<LogoIcon v-else-if="isApplication" height="20px" class="mr-12" />
|
||||||
<!-- 工具 icon -->
|
<!-- 工具 icon -->
|
||||||
<el-avatar v-else-if="isTool" class="avatar-green mr-12" shape="square" :size="20">
|
<el-avatar v-else-if="isTool" class="avatar-green mr-12" shape="square" :size="20">
|
||||||
<img src="@/assets/workflow/icon_tool.svg" style="width: 58%" alt=""/>
|
<img src="@/assets/workflow/icon_tool.svg" style="width: 58%" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<!-- 模型 icon -->
|
<!-- 模型 icon -->
|
||||||
<span
|
<span
|
||||||
@ -172,18 +175,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted, watch, computed} from 'vue'
|
import { ref, onMounted, watch, computed } from 'vue'
|
||||||
import type {Provider} from '@/api/type/model'
|
import type { Provider } from '@/api/type/model'
|
||||||
import {AuthorizationEnum} from '@/enums/system'
|
import { AuthorizationEnum } from '@/enums/system'
|
||||||
import {isAppIcon, resetUrl} from '@/utils/common'
|
import { isAppIcon, resetUrl } from '@/utils/common'
|
||||||
import {EditionConst} from '@/utils/permission/data'
|
import { EditionConst } from '@/utils/permission/data'
|
||||||
import {hasPermission} from '@/utils/permission/index'
|
import { hasPermission } from '@/utils/permission/index'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
|
||||||
const {model} = useStore()
|
const { model } = useStore()
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array<any>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
id: String,
|
id: String,
|
||||||
@ -203,6 +206,7 @@ const isKnowledge = computed(() => props.type === AuthorizationEnum.KNOWLEDGE)
|
|||||||
const isApplication = computed(() => props.type === AuthorizationEnum.APPLICATION)
|
const isApplication = computed(() => props.type === AuthorizationEnum.APPLICATION)
|
||||||
const isTool = computed(() => props.type === AuthorizationEnum.TOOL)
|
const isTool = computed(() => props.type === AuthorizationEnum.TOOL)
|
||||||
const isModel = computed(() => props.type === AuthorizationEnum.MODEL)
|
const isModel = computed(() => props.type === AuthorizationEnum.MODEL)
|
||||||
|
const defaultExpandKeys = computed(() => (props.data?.length > 0 ? [props.data[0]?.id] : []))
|
||||||
const dfsPermission = (arr: any = [], Name: string | number, e: boolean, idArr: any[]) => {
|
const dfsPermission = (arr: any = [], Name: string | number, e: boolean, idArr: any[]) => {
|
||||||
arr.map((item: any) => {
|
arr.map((item: any) => {
|
||||||
if (idArr.includes(item.id)) {
|
if (idArr.includes(item.id)) {
|
||||||
@ -230,7 +234,7 @@ const filterText = ref('')
|
|||||||
const filterData = computed(() => {
|
const filterData = computed(() => {
|
||||||
function filterTree(data: any[]): any[] {
|
function filterTree(data: any[]): any[] {
|
||||||
return data
|
return data
|
||||||
.map(item => {
|
.map((item) => {
|
||||||
// 递归过滤 children
|
// 递归过滤 children
|
||||||
const children = item.children ? filterTree(item.children) : []
|
const children = item.children ? filterTree(item.children) : []
|
||||||
// 判断当前节点或其子节点是否匹配
|
// 判断当前节点或其子节点是否匹配
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user