Files
ebiz-ai-knowledge-manage/src/views/knowledge/index.vue
陈昱达 43e4a221f9 style(knowledge): 优化知识库相关页面样式
- 调整知识库列表、详情、编辑等页面的样式布局
-优化文本显示效果,增加省略号处理
- 统一按钮样式和间距
- 调整滚动条和粘性元素的样式
2025-05-21 17:11:06 +08:00

413 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div id="index-container" class="container index-container">
<el-row>
<el-col :span="8">
<el-input
placeholder="输入知识库名称"
clearable
v-model="nameLike"
size="medium"
class="underBorder"
@keydown.enter.native="getList"
>
<template slot="prepend">
<el-button
slot="append"
icon="el-icon-search"
@click="getList"
></el-button>
</template>
</el-input>
</el-col>
<el-col :span="16" class="text-right">
<el-button
class="render-button line-button pv8 ph10"
icon="el-icon-plus"
@click="createdKnowLedge()"
>创建知识库</el-button
>
</el-col>
</el-row>
<div slot="header" class="clearfix mt30 flex">
<div>
<h3>知识库列表</h3>
<p class="mt20 fs14 theme-primary-desc-text" style="line-height: 15px">
易商数智知识库平台旨在为用户提供更便捷更灵敏更全面的知识存储和操作平台用户可以通过创建不同的知识库完成对系统内知识的细分和储备
</p>
<p class="mt10 fs14 theme-primary-desc-text" style="line-height: 15px">
同时也可以通过修改和删除操作对系统内知识体系进行修正和优化
</p>
<!-- <el-button-->
<!-- type="primary"-->
<!-- class="mt20 render-button pv8 ph10"-->
<!-- plain-->
<!-- icon="el-icon-document-remove"-->
<!-- >操作文档</el-button-->
<!-- >-->
</div>
</div>
<div class="card-body">
<div class="ledge-list mt10 ">
<el-card
v-for="(item, index) in datasetList"
class="item datasetList"
shadow="hover"
:key="index"
@click.native.stop="knowLedgeDetail(item)"
>
<div class="dataset-header mb10">
<div class="folder-content">
<img
:src="item.image ? item.image : getKnowledgeImage(index)"
alt=""
class="folder"
/>
</div>
<div class="dataset-body" style="flex:1">
<h4 class="dataset-title">{{ item.name }}</h4>
<p class="dataset-desc">{{ item.description }}</p>
</div>
</div>
<div class="flex align-items-c justify-content-b mh20 mv5">
<div class="theme-primary-desc-text-drank fs12">
{{ item.segmentedMode | filterSegmentedMode }}
</div>
<div class="opacity-button">
<el-button
class="default "
size="medium"
icon="el-icon-delete"
@click.stop="deleteKnowLedge(item)"
>删除</el-button
>
<el-button
class="line-button"
size="medium"
icon="el-icon-edit"
@click.stop="createdKnowLedge(item)"
type="primary"
>修改</el-button
>
</div>
</div>
<!-- <el-button type="text" @click="knowLedgeDetail(item)">查看详情</el-button>-->
</el-card>
</div>
</div>
<knowledgeForm
:visible.sync="drawer"
:datasetId="datasetId"
@update:visible="getList"
></knowledgeForm>
</div>
</template>
<script>
import { docManageDataset, datasetDelete } from '@/api/generatedApi/index.js'
import knowledgeForm from '@/views/knowledge/detail/components/knowledgeForm.vue'
import knowledgePng_1 from '@/assets/images/konwledge/knowledge-1.png'
import knowledgePng_2 from '@/assets/images/konwledge/knowledge-2.png'
import knowledgePng_3 from '@/assets/images/konwledge/knowledge-3.png'
import knowledgePng_4 from '@/assets/images/konwledge/knowledge-4.png'
import knowledgePng_5 from '@/assets/images/konwledge/knowledge-5.png'
import knowledgePng_6 from '@/assets/images/konwledge/knowledge-6.png'
import knowledgePng_7 from '@/assets/images/konwledge/knowledge-7.png'
export default {
name: 'index',
data() {
return {
datasetId: '',
knowledgePng_1,
knowledgePng_2,
knowledgePng_3,
knowledgePng_4,
knowledgePng_5,
knowledgePng_6,
knowledgePng_7,
datasetList: [],
nameLike: '',
drawer: false,
direction: 'ltr',
size: '50%',
withHeader: false,
drawerTitle: '创建知识库',
knowledgeId: '',
knowledgeForm: {
name: 'knowledgeForm',
component: knowledgeForm
}
}
},
props: {},
watch: {
nameLike(newVal) {
if (!newVal) {
this.getList()
}
}
},
components: {
knowledgeForm
},
methods: {
getList() {
docManageDataset({ nameLike: this.nameLike }).then(res => {
this.datasetList = res.content.content
})
},
createdKnowLedge(item) {
this.datasetId = item ? item.id : ''
this.drawer = true
// this.$router.push({
// path: '/knowledge/knowledge-create',
// query: {
// datasetId: item ? item.id : null
// }
// })
},
knowLedgeDetail(item) {
this.$router.push({
path: '/knowledge/detail',
query: {
datasetId: item.id
}
})
},
deleteKnowLedge(item) {
this.$messageBox(
() => {
datasetDelete({ id: item.id }).then(res => {
if (res.content.result === '0') {
this.$message({
type: 'success',
message: '删除成功!'
})
this.getList()
}
})
},
'此操作将永久删除该知识库, 是否继续?',
'warning',
'提示'
)
// this.$confirm(, {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
//
// })
},
getKnowledgeImage(index) {
const images = [
knowledgePng_1,
knowledgePng_2,
knowledgePng_3,
knowledgePng_4,
knowledgePng_5,
knowledgePng_6,
knowledgePng_7
]
return images[index % images.length]
}
},
filters: {
filterSegmentedMode(val) {
switch (val) {
case 0:
return '传统分段模式'
case 1:
return ' Q&A分段模式'
default:
return '未知模式'
}
}
},
created() {},
mounted() {
this.getList()
},
computed: {}
}
</script>
<style scoped lang="scss">
#index-container {
background-image: url('../../assets/images/backimage.png');
background-size: 600px 300px;
background-position-x: right;
background-position-y: top;
background-repeat: no-repeat;
}
.ledge-list {
display: flex;
flex-wrap: wrap;
//justify-content: space-between;
//margin-left: 2.5%;
& .item {
border-radius: 8px;
width: calc(33.33% - 10px); // 每个项目占 33.33%,并预留间隙
margin-bottom: 10px;
margin-left: 0; // 移除左右内边距
margin-right: 15px;
/deep/ .el-card__body {
padding: 0;
& .item-body {
padding: 0 20px;
display: flex;
height: 119px;
margin-top: 20px;
}
& .item-bottom {
//padding:0 20px;
display: flex;
justify-content: space-between;
background: #f7f9fa;
border-top: 1px solid #eff0f1;
}
}
}
& .item:nth-child(3n) {
margin-right: 0;
}
& .dashed {
border: 1px dashed #dedede;
cursor: pointer;
text-align: center;
line-height: 200px;
color: #6666;
&:hover {
color: #409eff;
border: 1px dashed #409eff;
}
}
& .folder-content {
//background-color: rgba(245, 248, 255, 1);
text-align: center;
border-radius: 8px;
//padding: 10px;
& .folder {
width: 50px;
//background: #409eff;
text-align: center;
line-height: 50px;
border-radius: 8px;
height: 50px;
font-size: 18px;
overflow: hidden;
font-weight: 600;
color: #fff;
}
}
}
.opacity-button {
opacity: 0;
}
.datasetList {
position: relative;
transition: all 0.3s ease;
overflow: hidden;
cursor: pointer;
&:hover {
//transform: translateY(-3px);
background: linear-gradient(211deg, #eef4fd 0%, #ffffff 100%);
box-shadow: 0px 4px 7px 2px #dbe3f2;
border-radius: 7px;
border: 1px solid #635cff;
.opacity-button {
transition: all 0.5s ease;
opacity: 1;
}
}
/deep/ .el-card__body {
padding: 0;
height: 100%;
display: flex;
flex-direction: column;
}
.dataset-header {
padding: 20px 20px 0;
display: flex;
justify-content: space-between;
align-items: flex-start;
//align-items: center;
.folder-content {
//width: 50px;
//height: 50px;
//background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
}
.dataset-type {
font-size: 12px;
border-radius: 4px;
}
}
.dataset-body {
flex: 1;
max-width: 90%;
padding: 0 10px;
.dataset-title {
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 16px;
color: #000000;
line-height: 22px;
text-align: left;
font-style: normal;
margin: 0 0 5px;
white-space: nowrap; // 确保单行显示
overflow: hidden; // 隐藏超出部分
text-overflow: ellipsis; // 显示省略号
max-width: 100%; // 限制宽度
}
.dataset-desc {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 13px;
color: #666666;
line-height: 18px;
text-align: left;
font-style: normal;
height: 18px;
margin: 0;
display: -webkit-box; // 支持多行省略
-webkit-line-clamp: 1; // 限制为两行
-webkit-box-orient: vertical; // 垂直方向排列
overflow: hidden; // 隐藏超出部分
text-overflow: ellipsis; // 显示省略号
max-width: 100%; // 限制宽度
}
}
.dataset-footer {
margin-top: auto;
display: flex;
border-top: 1px solid #f0f2f5;
background: linear-gradient(to bottom, #fafbfc, #f5f7fa);
}
}
</style>