fix: Model permission while setting knowledge or application
This commit is contained in:
parent
ed5cc3a0fa
commit
f1e8ba6e2d
@ -53,7 +53,9 @@
|
|||||||
<template #footer v-if="showFooter">
|
<template #footer v-if="showFooter">
|
||||||
<slot name="footer">
|
<slot name="footer">
|
||||||
<div class="w-full text-left cursor" @click="openCreateModel(undefined, props.modelType)">
|
<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">
|
<el-icon class="mr-4">
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -86,6 +88,7 @@ import SelectProviderDialog from '@/views/model/component/SelectProviderDialog.v
|
|||||||
|
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
import permissionMap from '@/permission'
|
||||||
|
|
||||||
defineOptions({ name: 'ModelSelect' })
|
defineOptions({ name: 'ModelSelect' })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@ -95,6 +98,10 @@ const props = defineProps<{
|
|||||||
modelType?: ''
|
modelType?: ''
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const permissionPrecise = computed(() => {
|
||||||
|
return permissionMap['model']['workspace']
|
||||||
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'change', 'submitModel'])
|
const emit = defineEmits(['update:modelValue', 'change', 'submitModel'])
|
||||||
const modelValue = computed({
|
const modelValue = computed({
|
||||||
set: (item) => {
|
set: (item) => {
|
||||||
|
|||||||
@ -24,7 +24,9 @@
|
|||||||
<el-button @click.prevent="dialogVisible = false">
|
<el-button @click.prevent="dialogVisible = false">
|
||||||
{{ $t('common.cancel') }}
|
{{ $t('common.cancel') }}
|
||||||
</el-button>
|
</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') }}
|
{{ $t('common.confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -33,11 +35,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import type { FormField } from '@/components/dynamics-form/type'
|
import type { FormField } from '@/components/dynamics-form/type'
|
||||||
import modelAPi from '@/api/model/model'
|
import modelAPi from '@/api/model/model'
|
||||||
import applicationApi from '@/api/application/application'
|
import applicationApi from '@/api/application/application'
|
||||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||||
|
import permissionMap from '@/permission'
|
||||||
|
|
||||||
const model_form_field = ref<Array<FormField>>([])
|
const model_form_field = ref<Array<FormField>>([])
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
|
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
|
||||||
@ -47,7 +51,15 @@ const loading = ref(false)
|
|||||||
const getApi = (model_id: string, application_id?: string) => {
|
const getApi = (model_id: string, application_id?: string) => {
|
||||||
return modelAPi.getModelParamsForm(model_id, loading)
|
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) => {
|
const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
|
||||||
|
modelID.value = model_id
|
||||||
form_data.value = {}
|
form_data.value = {}
|
||||||
const api = getApi(model_id, application_id)
|
const api = getApi(model_id, application_id)
|
||||||
api.then((ok) => {
|
api.then((ok) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user