feat(intelligent-agent): 添加智能体可见权限功能

- 在智能体列表和详情页面添加可见权限相关功能
- 实现可见权限的 cascader 选择组件
- 添加用户选择功能,支持多选- 优化智能体创建和编辑页面,增加可见权限相关字段- 调整首页布局,移除不必要的元素
This commit is contained in:
陈昱达
2025-05-09 17:56:55 +08:00
parent 5fde533a6d
commit dd71e1c818
9 changed files with 60 additions and 50 deletions

View File

@@ -1,11 +1,11 @@
module.exports = { module.exports = {
presets: ['@vue/app'], presets: ['@vue/app'],
plugins: [ plugins: [
// [ [
// 'transform-remove-console', 'transform-remove-console',
// { {
// exclude: ['warn', 'error'] // 可选:保留 warn 和 error exclude: ['warn', 'error'] // 可选:保留 warn 和 error
// } }
// ] ]
] ]
} }

View File

@@ -8,7 +8,7 @@ import getUrl from '@/assets/js/utils/get-url'
*/ */
const agentList = (data = {}) => { const agentList = (data = {}) => {
return request({ return request({
url: getUrl('/intelligent/app/page'), url: getUrl('/intelligent/ex/list'),
method: 'post', method: 'post',
data data
}) })

View File

@@ -225,7 +225,11 @@
} }
} }
} }
.rate90 { .rate360 {
transform: rotateY(180deg); transform: rotateY(180deg);
transition: all 0.2s; transition: all 0.2s;
} }
.rate180 {
transform: rotateY(0deg);
transition: all 0.2s;
}

View File

@@ -1,13 +1,5 @@
<template> <template>
<div class="home-container pl50 pr50 pb50 pt90 text-center"> <div class="home-container pl50 pr50 pb50 pt90 text-center"></div>
<!--<p>易商阜极管理系统模版欢迎您的登入{{ uerName }}</p>-->
<!--<el-button @click="visable = true">测试文件</el-button>-->
<!--<r-view :visable.sync="visable" :title="title" :filePath="filePath"> </r-view>-->
<img class="homeImg mt60" alt="" src="../../assets/images/home.png" />
<div class="fs20 fwb mv20">
&nbsp;&nbsp;&nbsp;&nbsp;访&nbsp;&nbsp;&nbsp;&nbsp;
</div>
</div>
</template> </template>
<script> <script>
@@ -16,12 +8,9 @@ import { mapGetters, mapActions } from 'vuex'
export default { export default {
name: 'Home', name: 'Home',
data() { data() {
return { return {}
}
},
created() {
}, },
created() {},
mounted() {}, mounted() {},
methods: { methods: {
success() {} success() {}

View File

@@ -11,7 +11,7 @@
style="font-size: 20px;margin:0;cursor: pointer" style="font-size: 20px;margin:0;cursor: pointer"
@click.native="findMouseEnter" @click.native="findMouseEnter"
icon-class="hide" icon-class="hide"
:class-name="sidebar.opened ? '' : 'rate90'" :class-name="sidebar.opened ? 'rate360' : 'rate180'"
></svg-icon> ></svg-icon>
</div> </div>

View File

@@ -4,10 +4,12 @@ import { VEmojiPicker } from 'v-emoji-picker'
import cropper from '@/components/RenderCropper/components/cropper.vue' import cropper from '@/components/RenderCropper/components/cropper.vue'
import { uploadImage } from '@/api/generatedApi' import { uploadImage } from '@/api/generatedApi'
import { agentType } from '@/assets/js/utils/utilOptions' import { agentType } from '@/assets/js/utils/utilOptions'
import otherSelect from '@/views/knowledge/detail/components/otherSelect/otherIndex.vue'
export default { export default {
name: 'info', name: 'info',
inject: ['dialog', 'fetchAgentList', 'resetList'], inject: ['dialog', 'fetchAgentList', 'resetList'],
components: { components: {
otherSelect,
VEmojiPicker, VEmojiPicker,
cropper cropper
}, },
@@ -242,6 +244,9 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="可见权限" prop="visibleRange">
<otherSelect :model="dialog.agent" propKey="visibleRange"></otherSelect>
</el-form-item>
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input <el-input
size="medium" size="medium"
@@ -269,7 +274,7 @@ export default {
line-height: 50px; line-height: 50px;
font-size: 20px; font-size: 20px;
cursor: pointer; cursor: pointer;
background: #d1e9f; background: #d1e9ff;
} }
.back-content { .back-content {

View File

@@ -22,7 +22,8 @@ export default {
visible: false, visible: false,
agent: { agent: {
id: '', id: '',
thirdAppId: '' thirdAppId: '',
visibleRange: 0
} }
}, },
searchOption: { searchOption: {
@@ -65,13 +66,13 @@ export default {
resetList() { resetList() {
this.list = [] this.list = []
this.page = 0 this.page = 1
}, },
load() { load() {
if (this.total === this.list.length) { if (this.total === this.list.length) {
return false return false
} }
this.page += 1 this.page = 1
this.fetchAgentList({ this.fetchAgentList({
page: this.page, page: this.page,
pageSize: this.pageSize pageSize: this.pageSize
@@ -87,7 +88,7 @@ export default {
appNameLike: params.nameLike ? params.nameLike : '', appNameLike: params.nameLike ? params.nameLike : '',
appType: params.appType ? params.appType : '' appType: params.appType ? params.appType : ''
}) })
this.list.push(...content.content.list) this.list.push(...content.content)
this.total = content.content.total this.total = content.content.total
}, },
@@ -108,6 +109,9 @@ export default {
if (!content.content.backgroundColor) { if (!content.content.backgroundColor) {
content.content.backgroundColor = '#d1e9ff' content.content.backgroundColor = '#d1e9ff'
} }
if (!content.content.visibleRange) {
content.content.visibleRange = 0
}
this.$set(this.dialog, 'agent', content.content) this.$set(this.dialog, 'agent', content.content)
this.dialog.type = 'edit' this.dialog.type = 'edit'
this.dialog.title = '编辑智能体' this.dialog.title = '编辑智能体'
@@ -144,7 +148,9 @@ export default {
description: '', description: '',
imageType: '', imageType: '',
image: '', image: '',
backgroundColor: '#d1e9ff' backgroundColor: '#d1e9ff',
visibleRange: 0,
userIds: []
} }
this.dialog.title = '创建智能体' this.dialog.title = '创建智能体'
this.dialog.visible = true this.dialog.visible = true

View File

@@ -66,6 +66,10 @@ export default {
userIds: [] userIds: []
} }
} }
},
propKey: {
type: String,
default: 'visibleRange'
} }
}, },
computed: { computed: {
@@ -168,10 +172,10 @@ export default {
watch: { watch: {
model: { model: {
handler(newVal) { handler(newVal) {
if (newVal.visibleRange === 0) { if (newVal[this.propKey] === 0) {
this.values = [0] this.values = [0]
this.cascaderProps.multiple = false this.cascaderProps.multiple = false
} else if (newVal.visibleRange === 1) { } else if (newVal[this.propKey] === 1) {
this.values = [1] this.values = [1]
this.cascaderProps.multiple = false this.cascaderProps.multiple = false
} else { } else {
@@ -183,12 +187,13 @@ export default {
}) })
} }
} }
} },
immediate: true
}, },
values: { values: {
handler(newVal) { handler(newVal) {
if (!this.cascaderProps.multiple) { if (!this.cascaderProps.multiple) {
this.model.visibleRange = newVal[0] this.model[this.propKey] = newVal[0]
if (newVal[0] === 0) { if (newVal[0] === 0) {
this.model.userIds = [] this.model.userIds = []
} else { } else {
@@ -201,7 +206,7 @@ export default {
} }
} }
} else { } else {
this.model.visibleRange = 2 this.model[this.propKey] = 2
this.model.userIds = newVal.map(item => { this.model.userIds = newVal.map(item => {
return item[1] return item[1]
}) })

View File

@@ -692,21 +692,21 @@ export default {
}, },
'删除' '删除'
), ),
h( // h(
'el-button', // 'el-button',
{ // {
class: 'normal-button', // class: 'normal-button',
props: { // props: {
type: 'primary', // type: 'primary',
size: 'mini', // size: 'mini',
disabled: true, // disabled: true,
icon: 'el-icon-edit-outline', // icon: 'el-icon-edit-outline',
title: '编辑' // title: '编辑'
}, // },
on: {} // on: {}
}, // },
'编辑' // '编辑'
), // ),
h( h(
'el-button', 'el-button',
@@ -716,7 +716,8 @@ export default {
type: 'primary', type: 'primary',
size: 'mini', size: 'mini',
icon: 'el-icon-tickets', icon: 'el-icon-tickets',
title: '添加元数据' title: '添加元数据',
disabled: params.row.documentStatus !== 1
}, },
on: { on: {
click: () => this.handleAddMetadata(params.row) click: () => this.handleAddMetadata(params.row)