fix: Model permission while setting knowledge or application

This commit is contained in:
zhangzhanwei 2025-07-10 13:42:29 +08:00 committed by zhanweizhang7
parent ed5cc3a0fa
commit f1e8ba6e2d
2 changed files with 22 additions and 3 deletions

View File

@ -53,7 +53,9 @@
<template #footer v-if="showFooter">
<slot name="footer">
<div class="w-full text-left cursor" @click="openCreateModel(undefined, props.modelType)">
<el-button type="primary" link>
<el-button type="primary" link
v-if="permissionPrecise.create()"
>
<el-icon class="mr-4">
<Plus />
</el-icon>
@ -86,6 +88,7 @@ import SelectProviderDialog from '@/views/model/component/SelectProviderDialog.v
import { t } from '@/locales'
import useStore from '@/stores'
import permissionMap from '@/permission'
defineOptions({ name: 'ModelSelect' })
const props = defineProps<{
@ -95,6 +98,10 @@ const props = defineProps<{
modelType?: ''
}>()
const permissionPrecise = computed(() => {
return permissionMap['model']['workspace']
})
const emit = defineEmits(['update:modelValue', 'change', 'submitModel'])
const modelValue = computed({
set: (item) => {

View File

@ -24,7 +24,9 @@
<el-button @click.prevent="dialogVisible = false">
{{ $t('common.cancel') }}
</el-button>
<el-button type="primary" @click="submit" :loading="loading">
<el-button type="primary" @click="submit" :loading="loading"
v-if="permissionPrecise.paramSetting(modelID)"
>
{{ $t('common.confirm') }}
</el-button>
</span>
@ -33,11 +35,13 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { computed, ref } from 'vue'
import type { FormField } from '@/components/dynamics-form/type'
import modelAPi from '@/api/model/model'
import applicationApi from '@/api/application/application'
import DynamicsForm from '@/components/dynamics-form/index.vue'
import permissionMap from '@/permission'
const model_form_field = ref<Array<FormField>>([])
const emit = defineEmits(['refresh'])
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
@ -47,7 +51,15 @@ const loading = ref(false)
const getApi = (model_id: string, application_id?: string) => {
return modelAPi.getModelParamsForm(model_id, loading)
}
const modelID = ref('')
const permissionPrecise = computed(() => {
return permissionMap['model']['workspace']
})
const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
modelID.value = model_id
form_data.value = {}
const api = getApi(model_id, application_id)
api.then((ok) => {