mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
页面布局调整
This commit is contained in:
+16
-2
@@ -209,10 +209,24 @@ public class AgentTemplateController {
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/batch-delete")
|
||||
// 删除原有的批量删除方法
|
||||
// @PostMapping("/batch-delete")
|
||||
// @Operation(summary = "批量删除模板")
|
||||
// @RequiresPermissions("sys:role:normal")
|
||||
// public Result<String> batchDeleteAgentTemplates(@RequestBody List<String> ids) {
|
||||
// boolean deleted = agentTemplateService.removeByIds(ids);
|
||||
// if (deleted) {
|
||||
// return ResultUtils.success("批量删除成功");
|
||||
// } else {
|
||||
// return ResultUtils.error("批量删除模板失败");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 添加新的批量删除方法,使用不同的URL
|
||||
@PostMapping("/batch-remove")
|
||||
@Operation(summary = "批量删除模板")
|
||||
@RequiresPermissions("sys:role:normal")
|
||||
public Result<String> batchDeleteAgentTemplates(@RequestBody List<String> ids) {
|
||||
public Result<String> batchRemoveAgentTemplates(@RequestBody List<String> ids) {
|
||||
boolean deleted = agentTemplateService.removeByIds(ids);
|
||||
if (deleted) {
|
||||
return ResultUtils.success("批量删除成功");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getServiceUrl } from '../api';
|
||||
import RequestService from '../httpRequest';
|
||||
import { getServiceUrl } from '../api';
|
||||
|
||||
|
||||
export default {
|
||||
@@ -337,9 +337,9 @@ export default {
|
||||
// 批量删除智能体模板
|
||||
batchDeleteAgentTemplate(ids, callback) {
|
||||
RequestService.sendRequest()
|
||||
.url(`${getServiceUrl()}/agent/template/batch-delete`)
|
||||
.method('DELETE')
|
||||
.data(ids)
|
||||
.url(`${getServiceUrl()}/agent/template/batch-remove`) // 修改为新的URL
|
||||
.method('POST')
|
||||
.data(Array.isArray(ids) ? ids : [ids]) // 确保是数组格式
|
||||
.success((res) => {
|
||||
RequestService.clearRequestTime();
|
||||
callback(res);
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
<el-table ref="templateTable" :data="templateList" style="width: 100%" v-loading="templateLoading"
|
||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
||||
element-loading-background="rgba(255, 255, 255, 0.7)"
|
||||
class="transparent-table" @row-click="handleRowClick">
|
||||
class="transparent-table"> <!-- 移除@row-click="handleRowClick" -->
|
||||
<!-- 自定义选择列,实现表头是"选择"文字,数据行是小方框 -->
|
||||
<el-table-column label="选择" align="center" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.selected" @change="handleRowSelectionChange(scope.row)"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.selected" @change="handleRowSelectionChange(scope.row)" @click.stop></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板名称" prop="agentName" align="center"></el-table-column>
|
||||
@@ -298,6 +298,7 @@ export default {
|
||||
},
|
||||
|
||||
// 修改batchDeleteTemplate方法,使用selectedTemplates
|
||||
// 批量删除模板 - 完全重写这个方法
|
||||
batchDeleteTemplate() {
|
||||
if (this.selectedTemplates.length === 0) {
|
||||
this.$message.warning('请选择要删除的模板')
|
||||
@@ -309,12 +310,19 @@ export default {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 确保参数格式正确 - 将id数组作为请求体
|
||||
const ids = this.selectedTemplates.map(template => template.id)
|
||||
console.log('批量删除的模板ID:', ids)
|
||||
|
||||
agentApi.batchDeleteAgentTemplate(ids, (res) => {
|
||||
// 添加更健壮的响应处理
|
||||
console.log('批量删除响应:', res)
|
||||
if (res && typeof res === 'object') {
|
||||
if (res.data && res.data.code === 0) {
|
||||
this.$message.success('模板批量删除成功')
|
||||
// 重新加载模板列表
|
||||
this.loadTemplateList()
|
||||
// 清空选中状态
|
||||
this.selectedTemplates = []
|
||||
this.isAllSelected = false
|
||||
} else {
|
||||
@@ -322,7 +330,7 @@ export default {
|
||||
}
|
||||
} else {
|
||||
console.error('无效的响应对象:', res)
|
||||
this.$message.error('删除失败')
|
||||
this.$message.error('删除失败,请检查后端服务是否正常')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
@@ -402,14 +410,10 @@ export default {
|
||||
this.isAllSelected = this.templateList.length > 0 && this.selectedTemplates.length === this.templateList.length;
|
||||
},
|
||||
|
||||
// 修改handleRowClick方法,实现点击行选中/取消选中
|
||||
// 修改handleRowClick方法,移除选中状态切换逻辑
|
||||
handleRowClick(row, event, column) {
|
||||
// 如果点击的是选择框所在的列,则不触发行选择
|
||||
if (column && column.label === '选择') {
|
||||
return;
|
||||
}
|
||||
row.selected = !row.selected;
|
||||
this.handleRowSelectionChange(row);
|
||||
// 完全移除选中状态切换的逻辑,只允许通过复选框点击来选择
|
||||
// 保留方法以避免可能的事件处理问题
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
@@ -521,9 +521,9 @@ export default {
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
margin: 0 22px 22px 22px; /* 保留左右和底部边距 */
|
||||
margin: 1vh 22px; /* 借鉴角色配置页面,使用1vh的上下边距,使上下边框更加均衡 */
|
||||
border-radius: 15px;
|
||||
height: calc(100vh - 14vh); /* 调整高度计算 */
|
||||
height: calc(100vh - 24vh); /* 借鉴角色配置页面的高度计算方式 */
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
@@ -534,16 +534,21 @@ export default {
|
||||
|
||||
.content-panel {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 !important; /* 确保没有内边距 */
|
||||
margin: 0 !important; /* 确保没有外边距 */
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff; /* 借鉴角色配置页面,添加白色边框 */
|
||||
}
|
||||
|
||||
.content-area {
|
||||
width: 100% !important;
|
||||
max-width: none !important;
|
||||
margin: 0 !important;
|
||||
height: 100% !important;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 调整config-card样式 */
|
||||
|
||||
Reference in New Issue
Block a user