mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 08:33:53 +08:00
Merge pull request #533 from xinnan-tech/web-model-AddModelDialog
完成添加模型组件
This commit is contained in:
@@ -0,0 +1,384 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="visible"
|
||||||
|
width="1000px"
|
||||||
|
center
|
||||||
|
custom-class="custom-dialog"
|
||||||
|
:show-close="false"
|
||||||
|
>
|
||||||
|
<div style="margin: 0 30px 20px; text-align: left; padding: 20px; border-radius: 10px;">
|
||||||
|
<div style="font-size: 27px; color: #3d4566; margin-bottom: 15px; text-align: center;">添加模型</div>
|
||||||
|
|
||||||
|
<!-- 模型信息部分 -->
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
|
||||||
|
<div style="font-size: 20px; font-weight: bold; color: #3d4566;">模型信息</div>
|
||||||
|
<div style="display: flex; align-items: center; gap: 20px;">
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="margin-right: 8px;">是否启用</span>
|
||||||
|
<el-switch v-model="formData.isEnabled" class="custom-switch"></el-switch>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="margin-right: 8px;">设为默认</span>
|
||||||
|
<el-switch v-model="formData.isDefault" class="custom-switch"></el-switch>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="height: 2px; background: #e9e9e9; margin-bottom: 20px;"></div>
|
||||||
|
|
||||||
|
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form">
|
||||||
|
<!-- 第一行:模型名称和模型编码 -->
|
||||||
|
<div style="display: flex; gap: 20px; margin-bottom: 15px;">
|
||||||
|
<el-form-item label="模型名称" prop="modelName" style="flex: 1; margin-bottom: 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.modelName"
|
||||||
|
placeholder="请输入模型名称"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模型编码" prop="modelCode" style="flex: 1; margin-bottom: 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.modelCode"
|
||||||
|
placeholder="请输入模型编码"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 第二行:供应器和排序号 -->
|
||||||
|
<div style="display: flex; gap: 20px; margin-bottom: 15px;">
|
||||||
|
<el-form-item label="供应器" prop="supplier" style="flex: 1; margin-bottom: 0;">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.supplier"
|
||||||
|
placeholder="请选择"
|
||||||
|
class="custom-select custom-input-bg"
|
||||||
|
style="width: 100%;"
|
||||||
|
>
|
||||||
|
<el-option label="硅基流动" value="硅基流动"></el-option>
|
||||||
|
<el-option label="智脑科技" value="智脑科技"></el-option>
|
||||||
|
<el-option label="云智科技" value="云智科技"></el-option>
|
||||||
|
<el-option label="其他" value="其他"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序号" prop="sortOrder" style="flex: 1; margin-bottom: 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.sort"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 文档地址 -->
|
||||||
|
<el-form-item label="文档地址" prop="docLink" style="margin-bottom: 15px;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.docLink"
|
||||||
|
placeholder="请输入文档地址"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 备注 -->
|
||||||
|
<el-form-item label="备注" prop="remark" style="margin-bottom: 15px;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.remark"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入模型备注"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 调用信息部分 -->
|
||||||
|
<div style="font-size: 20px; font-weight: bold; color: #3d4566; margin-bottom: 15px;">调用信息</div>
|
||||||
|
<div style="height: 2px; background: #e9e9e9; margin-bottom: 20px;"></div>
|
||||||
|
|
||||||
|
<el-form :model="formData" label-width="100px" label-position="left" class="custom-form">
|
||||||
|
<!-- 第一行:模型名称和接口地址 -->
|
||||||
|
<div style="display: flex; gap: 20px; margin-bottom: 15px;">
|
||||||
|
<el-form-item label="模型名称" prop="param1" style="flex: 0.5; margin-bottom: 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.configJson.param1"
|
||||||
|
placeholder="请输入model_name"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="接口地址" prop="param2" style="flex: 1; margin-bottom: 0;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.configJson.param2"
|
||||||
|
placeholder="请输入base_url"
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 秘钥信息 -->
|
||||||
|
<el-form-item label="秘钥信息" prop="apiKey" style="margin-bottom: 15px;">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.configJson.apiKey"
|
||||||
|
placeholder="请输入api_key"
|
||||||
|
show-password
|
||||||
|
class="custom-input-bg"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 保存按钮 -->
|
||||||
|
<div style="display: flex; margin: 20px 0; justify-content: center;">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="confirm"
|
||||||
|
class="save-btn"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 关闭按钮 -->
|
||||||
|
<!-- 修改关闭按钮 -->
|
||||||
|
<button class="custom-close-btn" @click="handleClose">
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'AddModelDialog',
|
||||||
|
props: {
|
||||||
|
visible: {type: Boolean, required: true},
|
||||||
|
modelType: {type: String, required: true}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formData: {
|
||||||
|
modelName: '',
|
||||||
|
modelCode: '',
|
||||||
|
supplier: '',
|
||||||
|
sort: 1,
|
||||||
|
docLink: '',
|
||||||
|
remark: '',
|
||||||
|
isEnabled: true,
|
||||||
|
isDefault: true,
|
||||||
|
configJson: {
|
||||||
|
param1: '',
|
||||||
|
param2: '',
|
||||||
|
apiKey: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
confirm() {
|
||||||
|
if (!this.formData.modelName || !this.formData.modelCode || !this.formData.supplier ||
|
||||||
|
!this.formData.configJson.param1 || !this.formData.configJson.param2 || !this.formData.configJson.apiKey) {
|
||||||
|
this.$message.error('请填写所有必填字段');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$emit('confirm', {
|
||||||
|
...this.formData,
|
||||||
|
provideType: this.formData.supplier
|
||||||
|
});
|
||||||
|
this.$emit('update:visible', false);
|
||||||
|
this.resetForm();
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.formData = {
|
||||||
|
modelName: '',
|
||||||
|
modelCode: '',
|
||||||
|
supplier: '',
|
||||||
|
sort: 1,
|
||||||
|
docLink: '',
|
||||||
|
remark: '',
|
||||||
|
isEnabled: true,
|
||||||
|
isDefault: true,
|
||||||
|
configJson: {
|
||||||
|
param1: '',
|
||||||
|
param2: '',
|
||||||
|
apiKey: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.resetForm();
|
||||||
|
this.$emit('update:visible', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.custom-dialog {
|
||||||
|
position: relative;
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dialog .el-dialog__header {
|
||||||
|
padding: 0;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-close-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid #cfcfcf;
|
||||||
|
background: none;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: lighter;
|
||||||
|
color: #cfcfcf;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 1;
|
||||||
|
padding: 0;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-close-btn:hover {
|
||||||
|
color: #409EFF;
|
||||||
|
border-color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-input__inner {
|
||||||
|
padding-right: 30px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-input__suffix {
|
||||||
|
background: #e6e8ea;
|
||||||
|
right: 7px;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
top: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-input__suffix-inner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-icon-arrow-up:before {
|
||||||
|
content: "";
|
||||||
|
display: inline-block;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 6px solid transparent;
|
||||||
|
border-right: 6px solid transparent;
|
||||||
|
border-top: 8px solid #c0c4cc;
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-select .el-input .el-select__caret {
|
||||||
|
color: #c0c4cc;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: transform .3s;
|
||||||
|
transform: rotateZ(0deg);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-select .el-select .el-input.is-focus .el-icon-arrow-up:before {
|
||||||
|
transform: rotateZ(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单样式调整 */
|
||||||
|
.custom-form .el-form-item {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-form .el-form-item__label {
|
||||||
|
color: #3d4566;
|
||||||
|
font-weight: normal;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改placeholder颜色 */
|
||||||
|
.custom-input-bg .el-input__inner::-webkit-input-placeholder,
|
||||||
|
.custom-input-bg .el-textarea__inner::-webkit-input-placeholder {
|
||||||
|
color: #9c9f9e ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框背景色 */
|
||||||
|
.custom-input-bg .el-input__inner,
|
||||||
|
.custom-input-bg .el-textarea__inner {
|
||||||
|
background-color: #f6f8fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-form .el-input__inner,
|
||||||
|
.custom-form .el-textarea__inner {
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #DCDFE6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-form .el-input__inner:focus,
|
||||||
|
.custom-form .el-textarea__inner:focus {
|
||||||
|
border-color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-btn {
|
||||||
|
background: #e6f0fd;
|
||||||
|
color: #237ff4;
|
||||||
|
border: 1px solid #b3d1ff;
|
||||||
|
width: 150px;
|
||||||
|
height: 40px;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-btn:hover {
|
||||||
|
background: linear-gradient(to right, #237ff4, #9c40d5);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修复select宽度问题 */
|
||||||
|
.el-select {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改开关样式 */
|
||||||
|
.custom-switch .el-switch__core {
|
||||||
|
border-radius: 20px;
|
||||||
|
height: 23px;
|
||||||
|
background-color: #c0ccda;
|
||||||
|
width: 35px;
|
||||||
|
padding: 0 20px; /* 调整左右内边距 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-switch .el-switch__core:after {
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
background-color: white;
|
||||||
|
top: 3px;
|
||||||
|
left: 4px;
|
||||||
|
transition: all .3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-switch.is-checked .el-switch__core {
|
||||||
|
border-color: #b5bcf0;
|
||||||
|
background-color: #cfd7fa;
|
||||||
|
padding: 0 20px; /* 确保启用状态也有相同的间隔 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-switch.is-checked .el-switch__core:after {
|
||||||
|
left: 100%;
|
||||||
|
margin-left: -18px;
|
||||||
|
background-color: #1b47ee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,268 +1,285 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
<div class="model-container">
|
<div class="model-container">
|
||||||
<el-menu :default-active="activeTab" class="el-menu-vertical-demo" @select="handleMenuSelect">
|
<el-menu :default-active="activeTab" class="el-menu-vertical-demo" @select="handleMenuSelect">
|
||||||
<el-menu-item index="vad">语音活动检测</el-menu-item>
|
<el-menu-item index="vad">语音活动检测</el-menu-item>
|
||||||
<el-menu-item index="asr">语音识别</el-menu-item>
|
<el-menu-item index="asr">语音识别</el-menu-item>
|
||||||
<el-menu-item index="llm">大语言模型</el-menu-item>
|
<el-menu-item index="llm">大语言模型</el-menu-item>
|
||||||
<el-menu-item index="intent">意图识别</el-menu-item>
|
<el-menu-item index="intent">意图识别</el-menu-item>
|
||||||
<el-menu-item index="tts">语音合成</el-menu-item>
|
<el-menu-item index="tts">语音合成</el-menu-item>
|
||||||
<el-menu-item index="memory">记忆</el-menu-item>
|
<el-menu-item index="memory">记忆</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="import-export-btn">
|
<div class="import-export-btn">
|
||||||
<el-button v-if="activeTab === 'tts'" type="primary" @click="ttsDialogVisible = true" style="margin-right: 10px;">
|
<el-button v-if="activeTab === 'tts'" type="primary" @click="ttsDialogVisible = true" style="margin-right: 10px;">
|
||||||
模型设置
|
模型设置
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" @click="handleImportExport">导入导出配置</el-button>
|
<el-button size="small" @click="handleImportExport">导入导出配置</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-main style="padding: 20px; display: flex; flex-direction: column;">
|
<el-main style="padding: 20px; display: flex; flex-direction: column;">
|
||||||
<el-card class="model-card" shadow="always">
|
<el-card class="model-card" shadow="always">
|
||||||
<div class="model-header">
|
<div class="model-header">
|
||||||
<h2>大语言模型 (LLM)</h2>
|
<h2>大语言模型 (LLM)</h2>
|
||||||
<el-button type="primary" @click="addModel" class="add-btn">添加</el-button>
|
<el-button type="primary" @click="addModel" class="add-btn">添加</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-search-operate" style="margin-bottom: 20px;">
|
<div class="model-search-operate" style="margin-bottom: 20px;">
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="请输入模型名称查询"
|
placeholder="请输入模型名称查询"
|
||||||
v-model="search"
|
v-model="search"
|
||||||
style="width: 300px; margin-right: 10px"
|
style="width: 300px; margin-right: 10px"
|
||||||
|
/>
|
||||||
|
<el-button @click="handleSearch">查询</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="modelList"
|
||||||
|
style="width: 100%;"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
header-cell-class-name="header-cell"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
|
<el-table-column label="模型名称" prop="candidateName"></el-table-column>
|
||||||
|
<el-table-column label="模型编码" prop="code"></el-table-column>
|
||||||
|
<el-table-column label="提供商" prop="supplier"></el-table-column>
|
||||||
|
<el-table-column label="是否启用">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch v-model="scope.row.isApplied" active-color="#409EFF" inactive-color="#C0CCDA"></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="editModel(scope.row)"
|
||||||
|
style="margin-right: 5px;"
|
||||||
|
type="text"
|
||||||
|
class="action-btn"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="danger"
|
||||||
|
@click="deleteModel(scope.row)"
|
||||||
|
class="action-btn"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="table-footer">
|
||||||
|
<el-button @click="selectAll" class="footer-btn">全选</el-button>
|
||||||
|
<el-button type="danger" @click="batchDelete" class="footer-btn">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[5, 10, 15]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="total"
|
||||||
/>
|
/>
|
||||||
<el-button @click="handleSearch">查询</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<div class="copyright">
|
||||||
:data="modelList"
|
©2025 xiaozhi-esp32-server
|
||||||
style="width: 100%;"
|
|
||||||
border
|
|
||||||
stripe
|
|
||||||
header-cell-class-name="header-cell"
|
|
||||||
>
|
|
||||||
<el-table-column type="selection" width="55"></el-table-column>
|
|
||||||
<el-table-column label="模型名称" prop="candidateName"></el-table-column>
|
|
||||||
<el-table-column label="模型编码" prop="code"></el-table-column>
|
|
||||||
<el-table-column label="提供商" prop="supplier"></el-table-column>
|
|
||||||
<el-table-column label="是否启用">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-switch v-model="scope.row.isApplied" active-color="#409EFF" inactive-color="#C0CCDA"></el-switch>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
@click="editModel(scope.row)"
|
|
||||||
style="margin-right: 5px;"
|
|
||||||
type="text"
|
|
||||||
class="action-btn"
|
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="danger"
|
|
||||||
@click="deleteModel(scope.row)"
|
|
||||||
class="action-btn"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<div class="table-footer">
|
|
||||||
<el-button @click="selectAll" class="footer-btn">全选</el-button>
|
|
||||||
<el-button type="danger" @click="batchDelete" class="footer-btn">删除</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
<ModelEditDialog :visible.sync="editDialogVisible" :modelData="editModelData" @save="handleModelSave"/>
|
||||||
<div class="pagination-container">
|
<TtsModel :visible.sync="ttsDialogVisible" />
|
||||||
<el-pagination
|
<AddModelDialog :visible.sync="addDialogVisible" :modelType="activeTab" @confirm="handleAddConfirm"/>
|
||||||
@current-change="handleCurrentChange"
|
</el-main>
|
||||||
:current-page="currentPage"
|
</div>
|
||||||
:page-sizes="[5, 10, 15]"
|
|
||||||
:page-size="pageSize"
|
|
||||||
layout="prev, pager, next"
|
|
||||||
:total="total"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="copyright">
|
|
||||||
©2025 xiaozhi-esp32-server
|
|
||||||
</div>
|
|
||||||
<ModelEditDialog :visible.sync="editDialogVisible" :modelData="editModelData" @save="handleModelSave"/>
|
|
||||||
<TtsModel :visible.sync="ttsDialogVisible" />
|
|
||||||
</el-main>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HeaderBar from "@/components/HeaderBar.vue";
|
import HeaderBar from "@/components/HeaderBar.vue";
|
||||||
import ModelEditDialog from "@/components/ModelEditDialog.vue";
|
import ModelEditDialog from "@/components/ModelEditDialog.vue";
|
||||||
import TtsModel from "@/components/TtsModel.vue";
|
import TtsModel from "@/components/TtsModel.vue";
|
||||||
|
import AddModelDialog from "@/components/AddModelDialog.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HeaderBar, ModelEditDialog, TtsModel },
|
components: { HeaderBar, ModelEditDialog, TtsModel, AddModelDialog},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeTab: 'llm',
|
activeTab: 'llm',
|
||||||
search: '',
|
search: '',
|
||||||
editDialogVisible: false,
|
editDialogVisible: false,
|
||||||
editModelData: {},
|
editModelData: {},
|
||||||
ttsDialogVisible: false,
|
ttsDialogVisible: false,
|
||||||
modelList: [
|
addDialogVisible: false, // 新增弹窗显示状态
|
||||||
{ code: 'DeepSeek', candidateName: '深度求索', isApplied: true, supplier: '硅基流动' },
|
modelList: [
|
||||||
{ code: 'SmartAssist', candidateName: '智能助手', isApplied: false, supplier: '智脑科技' },
|
{ code: 'DeepSeek', candidateName: '深度求索', isApplied: true, supplier: '硅基流动' },
|
||||||
{ code: 'CogEngine', candidateName: '认知引擎', isApplied: true, supplier: '云智科技' },
|
{ code: 'SmartAssist', candidateName: '智能助手', isApplied: false, supplier: '智脑科技' },
|
||||||
],
|
{ code: 'CogEngine', candidateName: '认知引擎', isApplied: true, supplier: '云智科技' },
|
||||||
currentPage: 1,
|
],
|
||||||
pageSize: 4,
|
currentPage: 1,
|
||||||
total: 20
|
pageSize: 4,
|
||||||
};
|
total: 20
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleMenuSelect(index) {
|
|
||||||
this.activeTab = index;
|
|
||||||
},
|
|
||||||
handleSearch() {
|
|
||||||
console.log('查询:', this.search);
|
|
||||||
},
|
|
||||||
batchDelete() {
|
|
||||||
console.log('批量删除');
|
|
||||||
},
|
|
||||||
addModel() {
|
|
||||||
console.log('增加模型');
|
|
||||||
},
|
|
||||||
editModel(model) {
|
|
||||||
this.editModelData = {
|
|
||||||
code: model.code,
|
|
||||||
name: model.candidateName,
|
|
||||||
supplier: model.supplier,
|
|
||||||
};
|
};
|
||||||
this.editDialogVisible = true;
|
|
||||||
},
|
},
|
||||||
deleteModel(model) {
|
methods: {
|
||||||
console.log('删除:', model);
|
handleMenuSelect(index) {
|
||||||
},
|
this.activeTab = index;
|
||||||
handleCurrentChange(page) {
|
},
|
||||||
this.currentPage = page;
|
handleSearch() {
|
||||||
console.log('当前页码:', page);
|
console.log('查询:', this.search);
|
||||||
},
|
},
|
||||||
handleImportExport() {
|
batchDelete() {
|
||||||
console.log('导入导出');
|
console.log('批量删除');
|
||||||
},
|
},
|
||||||
handleModelSave(formData) {
|
// 修改addModel方法
|
||||||
console.log('保存的模型数据:', formData);
|
addModel() {
|
||||||
},
|
this.addDialogVisible = true;
|
||||||
selectAll() {
|
},
|
||||||
console.log('全选');
|
// 新增处理方法
|
||||||
|
handleAddConfirm(formData) {
|
||||||
|
// 这里处理添加模型的逻辑
|
||||||
|
console.log('新增模型数据:', formData);
|
||||||
|
// 模拟添加到列表
|
||||||
|
this.modelList.unshift({
|
||||||
|
code: formData.modelCode,
|
||||||
|
candidateName: formData.modelName,
|
||||||
|
supplier: formData.supplier,
|
||||||
|
isApplied: formData.isEnabled
|
||||||
|
});
|
||||||
|
this.$message.success('模型添加成功');
|
||||||
|
},
|
||||||
|
editModel(model) {
|
||||||
|
this.editModelData = {
|
||||||
|
code: model.code,
|
||||||
|
name: model.candidateName,
|
||||||
|
supplier: model.supplier,
|
||||||
|
};
|
||||||
|
this.editDialogVisible = true;
|
||||||
|
},
|
||||||
|
deleteModel(model) {
|
||||||
|
console.log('删除:', model);
|
||||||
|
},
|
||||||
|
handleCurrentChange(page) {
|
||||||
|
this.currentPage = page;
|
||||||
|
console.log('当前页码:', page);
|
||||||
|
},
|
||||||
|
handleImportExport() {
|
||||||
|
console.log('导入导出');
|
||||||
|
},
|
||||||
|
handleModelSave(formData) {
|
||||||
|
console.log('保存的模型数据:', formData);
|
||||||
|
},
|
||||||
|
selectAll() {
|
||||||
|
console.log('全选');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.welcome {
|
||||||
|
min-width: 900px;
|
||||||
|
min-height: 506px;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-image: url("@/assets/home/background.png");
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
-webkit-background-size: cover;
|
||||||
|
-o-background-size: cover;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
.model-container {
|
||||||
.welcome {
|
display: flex;
|
||||||
min-width: 900px;
|
margin-top: 25px;
|
||||||
min-height: 506px;
|
}
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background-image: url("@/assets/home/background.png");
|
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
-webkit-background-size: cover;
|
|
||||||
-o-background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-container {
|
.el-menu-vertical-demo {
|
||||||
display: flex;
|
width: 250px;
|
||||||
margin-top: 25px;
|
margin-right: 20px;
|
||||||
}
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
.el-menu-vertical-demo {
|
.content-container {
|
||||||
width: 250px;
|
flex: 1;
|
||||||
margin-right: 20px;
|
display: flex;
|
||||||
background-color: #f8f9fa;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-container {
|
.model-header {
|
||||||
flex: 1;
|
display: flex;
|
||||||
display: flex;
|
justify-content: space-between;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
}
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.model-header {
|
.model-search-operate {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
align-items: center;
|
||||||
align-items: center;
|
}
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-search-operate {
|
.model-search-operate > * {
|
||||||
display: flex;
|
margin-right: 10px;
|
||||||
align-items: center;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.model-search-operate > * {
|
.el-table__header th {
|
||||||
margin-right: 10px;
|
background-color: #f5f7fa;
|
||||||
}
|
color: #606266;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
.el-table__header th {
|
.model-card {
|
||||||
background-color: #f5f7fa;
|
background: #fff;
|
||||||
color: #606266;
|
border-radius: 12px;
|
||||||
font-weight: 500;
|
padding: 20px;
|
||||||
}
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.model-card {
|
.import-export-btn {
|
||||||
background: #fff;
|
margin-bottom: 20px;
|
||||||
border-radius: 12px;
|
display: flex;
|
||||||
padding: 20px;
|
justify-content: flex-end;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
margin-right: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-export-btn {
|
.pagination-container {
|
||||||
margin-bottom: 20px;
|
margin-top: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-right: 40px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.pagination-container {
|
.table-footer {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-footer {
|
.footer-btn {
|
||||||
margin-top: 20px;
|
margin-right: 10px;
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-btn {
|
.copyright {
|
||||||
margin-right: 10px;
|
font-size: 12px;
|
||||||
}
|
font-weight: 400;
|
||||||
|
color: #979db1;
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.copyright {
|
.action-btn {
|
||||||
font-size: 12px;
|
padding: 0 8px;
|
||||||
font-weight: 400;
|
}
|
||||||
color: #979db1;
|
|
||||||
margin-top: auto;
|
|
||||||
padding-top: 30px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-btn {
|
.header-cell {
|
||||||
padding: 0 8px;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-cell {
|
.add-btn {
|
||||||
font-weight: 500;
|
margin-right: 830px;
|
||||||
}
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
.add-btn {
|
background-color: #409eff;
|
||||||
margin-right: 830px;
|
color: white;
|
||||||
padding: 8px 16px;
|
border: none;
|
||||||
border-radius: 4px;
|
cursor: pointer;
|
||||||
background-color: #409eff;
|
}
|
||||||
color: white;
|
</style>
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user