2025-09-17 15:38:23 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="welcome">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<HeaderBar />
|
2025-09-17 15:38:23 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="operation-bar">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<h2 class="page-title">{{ $t("agentTemplateManagement.title") }}</h2>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
<div class="right-operations">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
:placeholder="$t('agentTemplateManagement.searchPlaceholder')"
|
|
|
|
|
|
v-model="search"
|
|
|
|
|
|
class="search-input"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
@keyup.enter.native="handleSearch"
|
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
|
/>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
<el-button class="btn-search" @click="handleSearch">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
{{ $t("agentTemplateManagement.search") }}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 主体内容 -->
|
|
|
|
|
|
<div class="main-wrapper">
|
|
|
|
|
|
<div class="content-panel">
|
|
|
|
|
|
<div class="content-area">
|
|
|
|
|
|
<el-card class="template-card" shadow="never">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
ref="templateTable"
|
|
|
|
|
|
:data="templateList"
|
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
|
v-loading="templateLoading"
|
|
|
|
|
|
:element-loading-text="$t('agentTemplateManagement.loading')"
|
|
|
|
|
|
element-loading-spinner="el-icon-loading"
|
2025-09-17 15:38:23 +08:00
|
|
|
|
element-loading-background="rgba(255, 255, 255, 0.7)"
|
2025-09-20 23:43:58 +08:00
|
|
|
|
class="transparent-table"
|
|
|
|
|
|
:header-cell-style="{ padding: '10px 20px' }"
|
|
|
|
|
|
:cell-style="{ padding: '10px 20px' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<!-- 移除@row-click="handleRowClick" -->
|
2025-09-17 15:38:23 +08:00
|
|
|
|
<!-- 自定义选择列,实现表头是"选择"文字,数据行是小方框 -->
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:label="$t('agentTemplateManagement.select')"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
min-width="100"
|
|
|
|
|
|
>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
<template slot-scope="scope">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-checkbox
|
|
|
|
|
|
v-model="scope.row.selected"
|
|
|
|
|
|
@change="handleRowSelectionChange(scope.row)"
|
|
|
|
|
|
@click.stop
|
|
|
|
|
|
></el-checkbox>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-09-19 15:34:43 +08:00
|
|
|
|
<!-- 模板名称 -->
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:label="$t('agentTemplateManagement.templateName')"
|
|
|
|
|
|
prop="agentName"
|
|
|
|
|
|
min-width="250"
|
|
|
|
|
|
show-overflow-tooltip
|
|
|
|
|
|
>
|
2025-09-19 15:34:43 +08:00
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<span>{{ scope.row.agentName }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2025-09-20 17:30:00 +08:00
|
|
|
|
<!-- 修改为序号列,并移动到此处 -->
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:label="$t('agentTemplateManagement.serialNumber')"
|
|
|
|
|
|
min-width="120"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
>
|
2025-09-19 15:34:43 +08:00
|
|
|
|
<template slot-scope="scope">
|
2025-09-20 17:30:00 +08:00
|
|
|
|
<span>{{ (currentPage - 1) * pageSize + scope.$index + 1 }}</span>
|
2025-09-19 15:34:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<!-- 操作列 -->
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:label="$t('agentTemplateManagement.action')"
|
|
|
|
|
|
min-width="250"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
>
|
2025-09-18 16:43:52 +08:00
|
|
|
|
<template slot-scope="scope">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<div style="display: flex; justify-content: center; gap: 15px">
|
|
|
|
|
|
<el-button type="text" @click="editTemplate(scope.row)">{{
|
|
|
|
|
|
$t("agentTemplateManagement.editTemplate")
|
|
|
|
|
|
}}</el-button>
|
|
|
|
|
|
<el-button type="text" @click="deleteTemplate(scope.row)">{{
|
|
|
|
|
|
$t("agentTemplateManagement.deleteTemplate")
|
|
|
|
|
|
}}</el-button>
|
2025-09-18 16:43:52 +08:00
|
|
|
|
</div>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-18 16:43:52 +08:00
|
|
|
|
<!-- 表格底部操作栏 -->
|
2025-09-17 15:38:23 +08:00
|
|
|
|
<div class="table_bottom">
|
|
|
|
|
|
<div class="ctrl_btn">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="handleSelectAll"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
class="select-all-btn"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{
|
|
|
|
|
|
isAllSelected
|
|
|
|
|
|
? $t("agentTemplateManagement.deselectAll")
|
|
|
|
|
|
: $t("agentTemplateManagement.selectAll")
|
|
|
|
|
|
}}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</el-button>
|
2025-09-21 01:51:35 +08:00
|
|
|
|
<el-button type="success" @click="showAddTemplateDialog" size="mini">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
{{ $t("agentTemplateManagement.createTemplate") }}
|
2025-09-18 16:43:52 +08:00
|
|
|
|
</el-button>
|
2025-09-20 23:43:58 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
@click="batchDeleteTemplate"
|
|
|
|
|
|
:disabled="!hasSelected"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ $t("agentTemplateManagement.batchDelete") }}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-18 16:43:52 +08:00
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
|
<div class="custom-pagination">
|
|
|
|
|
|
<el-pagination
|
|
|
|
|
|
v-model:current-page="currentPage"
|
|
|
|
|
|
v-model:page-size="pageSize"
|
|
|
|
|
|
:page-sizes="pageSizeOptions"
|
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
|
:total="total"
|
|
|
|
|
|
@size-change="handlePageSizeChange"
|
|
|
|
|
|
@current-change="handlePageChange"
|
|
|
|
|
|
/>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-09-20 23:43:58 +08:00
|
|
|
|
import HeaderBar from "@/components/HeaderBar";
|
|
|
|
|
|
import agentApi from "@/apis/module/agent";
|
2025-09-17 15:38:23 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
name: "AgentTemplateManagement",
|
2025-09-17 15:38:23 +08:00
|
|
|
|
components: {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
HeaderBar,
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
// 模板相关
|
|
|
|
|
|
templateList: [],
|
|
|
|
|
|
templateLoading: false,
|
|
|
|
|
|
selectedTemplates: [],
|
|
|
|
|
|
isAllSelected: false, // 添加全选状态
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
|
|
|
|
|
search: "",
|
2025-09-17 15:38:23 +08:00
|
|
|
|
// 分页相关数据
|
|
|
|
|
|
pageSizeOptions: [10, 20, 50, 100],
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
|
pageSize: 10,
|
2025-09-20 23:43:58 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
};
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.loadTemplateList();
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-18 16:43:52 +08:00
|
|
|
|
// 在computed部分添加hasSelected属性
|
2025-09-17 15:38:23 +08:00
|
|
|
|
computed: {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pageCount() {
|
|
|
|
|
|
return Math.ceil(this.total / this.pageSize);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
visiblePages() {
|
|
|
|
|
|
return this.getVisiblePages();
|
|
|
|
|
|
},
|
|
|
|
|
|
hasSelected() {
|
|
|
|
|
|
return this.selectedTemplates.length > 0;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-09-17 15:38:23 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
// 加载模板列表
|
|
|
|
|
|
// 改进loadTemplateList方法的错误处理逻辑
|
|
|
|
|
|
loadTemplateList() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.templateLoading = true;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
const params = {
|
|
|
|
|
|
page: this.currentPage,
|
2025-09-20 23:43:58 +08:00
|
|
|
|
limit: this.pageSize,
|
|
|
|
|
|
};
|
2025-09-17 15:38:23 +08:00
|
|
|
|
if (this.search) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
params.agentName = this.search;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
try {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
agentApi.getAgentTemplatesPage(
|
|
|
|
|
|
params,
|
|
|
|
|
|
(res) => {
|
|
|
|
|
|
// 更健壮的响应处理逻辑
|
|
|
|
|
|
if (res && typeof res === "object") {
|
|
|
|
|
|
if (res.data && res.data.code === 0) {
|
|
|
|
|
|
const responseData = res.data.data || {};
|
|
|
|
|
|
// 为每个模板添加selected属性
|
|
|
|
|
|
this.templateList = Array.isArray(responseData.list)
|
|
|
|
|
|
? responseData.list.map((item) => ({ ...item, selected: false }))
|
|
|
|
|
|
: [];
|
|
|
|
|
|
this.total =
|
|
|
|
|
|
typeof responseData.total === "number" ? responseData.total : 0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.templateList = [];
|
|
|
|
|
|
this.total = 0;
|
|
|
|
|
|
this.$message.error(
|
|
|
|
|
|
res?.data?.msg || this.$t("agentTemplateManagement.fetchTemplateFailed")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} else {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.templateList = [];
|
|
|
|
|
|
this.total = 0;
|
|
|
|
|
|
this.$message.error(
|
|
|
|
|
|
this.$t("agentTemplateManagement.fetchTemplateBackendError")
|
|
|
|
|
|
);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.templateLoading = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
(error) => {
|
|
|
|
|
|
this.templateList = [];
|
|
|
|
|
|
this.total = 0;
|
|
|
|
|
|
this.templateLoading = false;
|
|
|
|
|
|
this.$message.error(this.$t("common.networkError"));
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} catch (error) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.templateList = [];
|
|
|
|
|
|
this.total = 0;
|
|
|
|
|
|
this.templateLoading = false;
|
|
|
|
|
|
this.$message.error(this.$t("agentTemplateManagement.fetchTemplateBackendError"));
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 搜索模板
|
|
|
|
|
|
handleSearch() {
|
|
|
|
|
|
if (this.search) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
const searchValue = this.search.toLowerCase();
|
|
|
|
|
|
const filteredList = this.templateList.filter((template) =>
|
2025-09-17 15:38:23 +08:00
|
|
|
|
template.agentName.toLowerCase().includes(searchValue)
|
2025-09-20 23:43:58 +08:00
|
|
|
|
);
|
|
|
|
|
|
this.templateList = filteredList;
|
|
|
|
|
|
this.total = filteredList.length;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} else {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.loadTemplateList();
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 修改showAddTemplateDialog方法,使其跳转到与编辑页面相同的页面
|
|
|
|
|
|
// 显示新增模板弹窗
|
|
|
|
|
|
showAddTemplateDialog() {
|
|
|
|
|
|
// 跳转到模板快速配置页面,不传递templateId参数表示新增
|
|
|
|
|
|
this.$router.push({
|
2025-09-20 23:43:58 +08:00
|
|
|
|
path: "/template-quick-config",
|
|
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-18 16:43:52 +08:00
|
|
|
|
// 编辑模板
|
2025-09-17 15:38:23 +08:00
|
|
|
|
editTemplate(row) {
|
|
|
|
|
|
// 跳转到模板快速配置页面,并传递模板ID参数
|
|
|
|
|
|
this.$router.push({
|
2025-09-20 23:43:58 +08:00
|
|
|
|
path: "/template-quick-config",
|
|
|
|
|
|
query: { templateId: row.id },
|
|
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 删除模板
|
|
|
|
|
|
deleteTemplate(row) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.$confirm(
|
|
|
|
|
|
this.$t("agentTemplateManagement.confirmSingleDelete"),
|
|
|
|
|
|
this.$t("common.warning"),
|
|
|
|
|
|
{
|
|
|
|
|
|
confirmButtonText: this.$t("common.confirm"),
|
|
|
|
|
|
cancelButtonText: this.$t("common.cancel"),
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
agentApi.deleteAgentTemplate(row.id, (res) => {
|
|
|
|
|
|
if (res && typeof res === "object") {
|
|
|
|
|
|
// 检查res.data是否存在且包含code=0
|
|
|
|
|
|
if (res.data && res.data.code === 0) {
|
|
|
|
|
|
this.$message.success(this.$t("agentTemplateManagement.deleteSuccess"));
|
|
|
|
|
|
this.loadTemplateList();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(
|
|
|
|
|
|
res?.data?.msg || this.$t("agentTemplateManagement.deleteFailed")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} else {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
})
|
2025-09-20 23:43:58 +08:00
|
|
|
|
.catch(() => {
|
|
|
|
|
|
this.$message.info(this.$t("common.deleteCancelled"));
|
|
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-09-21 00:25:23 +08:00
|
|
|
|
// 批量删除模板
|
2025-09-17 15:38:23 +08:00
|
|
|
|
batchDeleteTemplate() {
|
|
|
|
|
|
if (this.selectedTemplates.length === 0) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.$message.warning(this.$t("agentTemplateManagement.selectTemplate"));
|
|
|
|
|
|
return;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.$confirm(
|
|
|
|
|
|
this.$t("agentTemplateManagement.confirmBatchDelete", {
|
|
|
|
|
|
count: this.selectedTemplates.length,
|
|
|
|
|
|
}),
|
|
|
|
|
|
this.$t("common.warning"),
|
|
|
|
|
|
{
|
|
|
|
|
|
confirmButtonText: this.$t("common.confirm"),
|
|
|
|
|
|
cancelButtonText: this.$t("common.cancel"),
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
// 确保参数格式正确 - 将id数组作为请求体
|
|
|
|
|
|
const ids = this.selectedTemplates.map((template) => template.id);
|
|
|
|
|
|
|
|
|
|
|
|
agentApi.batchDeleteAgentTemplate(ids, (res) => {
|
|
|
|
|
|
if (res && typeof res === "object") {
|
|
|
|
|
|
if (res.data && res.data.code === 0) {
|
|
|
|
|
|
this.$message.success(
|
|
|
|
|
|
this.$t("agentTemplateManagement.batchDeleteSuccess")
|
|
|
|
|
|
);
|
|
|
|
|
|
// 重新加载模板列表
|
|
|
|
|
|
this.loadTemplateList();
|
|
|
|
|
|
// 清空选中状态
|
|
|
|
|
|
this.selectedTemplates = [];
|
|
|
|
|
|
this.isAllSelected = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(
|
|
|
|
|
|
res?.data?.msg || this.$t("agentTemplateManagement.batchDeleteFailed")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} else {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
})
|
2025-09-20 23:43:58 +08:00
|
|
|
|
.catch(() => {
|
|
|
|
|
|
this.$message.info(this.$t("common.deleteCancelled"));
|
|
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-09-18 16:43:52 +08:00
|
|
|
|
// 完善分页相关方法
|
|
|
|
|
|
handlePageChange(page) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.currentPage = page;
|
|
|
|
|
|
this.loadTemplateList();
|
2025-09-18 16:43:52 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-18 16:43:52 +08:00
|
|
|
|
handlePageSizeChange(size) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.pageSize = size;
|
|
|
|
|
|
this.currentPage = 1;
|
|
|
|
|
|
this.loadTemplateList();
|
2025-09-18 16:43:52 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
goFirst() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.currentPage = 1;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
goPrev() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.currentPage--;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
goNext() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.currentPage++;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
goToPage(page) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.currentPage = page;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
getVisiblePages() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
const pages = [];
|
|
|
|
|
|
const totalPages = this.pageCount;
|
|
|
|
|
|
const currentPage = this.currentPage;
|
|
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
if (totalPages <= 7) {
|
|
|
|
|
|
for (let i = 1; i <= totalPages; i++) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(i);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (currentPage <= 4) {
|
|
|
|
|
|
for (let i = 1; i <= 5; i++) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(i);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push("...");
|
|
|
|
|
|
pages.push(totalPages);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
} else if (currentPage >= totalPages - 3) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(1);
|
|
|
|
|
|
pages.push("...");
|
2025-09-17 15:38:23 +08:00
|
|
|
|
for (let i = totalPages - 4; i <= totalPages; i++) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(i);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(1);
|
|
|
|
|
|
pages.push("...");
|
2025-09-17 15:38:23 +08:00
|
|
|
|
for (let i = currentPage - 1; i <= currentPage + 1; i++) {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push(i);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
pages.push("...");
|
|
|
|
|
|
pages.push(totalPages);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
|
|
|
|
|
return pages;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
// 修改handleSelectAll方法
|
|
|
|
|
|
handleSelectAll() {
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.isAllSelected = !this.isAllSelected;
|
|
|
|
|
|
this.templateList.forEach((row) => {
|
|
|
|
|
|
row.selected = this.isAllSelected;
|
|
|
|
|
|
});
|
2025-09-17 15:38:23 +08:00
|
|
|
|
// 更新选中的模板列表
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.selectedTemplates = this.isAllSelected ? [...this.templateList] : [];
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
// 处理行选择变化
|
|
|
|
|
|
handleRowSelectionChange(row) {
|
|
|
|
|
|
// 查找选中的模板
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.selectedTemplates = this.templateList.filter((template) => template.selected);
|
2025-09-17 15:38:23 +08:00
|
|
|
|
// 更新全选状态
|
2025-09-20 23:43:58 +08:00
|
|
|
|
this.isAllSelected =
|
|
|
|
|
|
this.templateList.length > 0 &&
|
|
|
|
|
|
this.selectedTemplates.length === this.templateList.length;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
},
|
2025-09-20 23:43:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
};
|
2025-09-17 15:38:23 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 基础背景和布局设置 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.welcome {
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
2025-09-20 23:43:58 +08:00
|
|
|
|
background-size: cover;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 操作栏样式 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.operation-bar {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 16px 24px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.page-title {
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.right-operations {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-input {
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn-search {
|
|
|
|
|
|
background: linear-gradient(135deg, #6b8cff, #a966ff);
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 主容器样式 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.main-wrapper {
|
|
|
|
|
|
margin: 5px 22px;
|
|
|
|
|
|
border-radius: 15px;
|
|
|
|
|
|
min-height: calc(100vh - 24vh);
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
max-height: 80vh;
|
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
background: rgba(237, 242, 255, 0.5);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content-panel {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
border-radius: 15px;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border: 1px solid #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content-area {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 600px;
|
|
|
|
|
|
overflow-x: auto;
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 模板卡片样式 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.template-card {
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-card__body) {
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 表格样式 - 优化整合版 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.transparent-table {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-table) {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
--table-max-height: calc(100vh - 42vh);
|
|
|
|
|
|
max-height: var(--table-max-height);
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
|
|
|
|
|
/* 表格头部样式 */
|
|
|
|
|
|
.el-table__header th {
|
|
|
|
|
|
padding: 8px 0 !important;
|
|
|
|
|
|
height: 40px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-table__header th .cell {
|
|
|
|
|
|
color: #303133 !important;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格主体样式 */
|
|
|
|
|
|
.el-table__body {
|
|
|
|
|
|
.el-table__row td {
|
|
|
|
|
|
padding: 12px 0 !important;
|
|
|
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-table__row:hover {
|
|
|
|
|
|
background-color: #f5f7fa;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 表格按钮样式 */
|
|
|
|
|
|
.el-button--text {
|
|
|
|
|
|
color: #7079aa;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-button--text:hover {
|
|
|
|
|
|
color: #5a64b5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 单元格文本样式 */
|
|
|
|
|
|
.cell {
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 表格底部操作栏 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.table_bottom {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between !important;
|
|
|
|
|
|
align-items: center;
|
2025-09-20 23:43:58 +08:00
|
|
|
|
margin-top: auto;
|
|
|
|
|
|
padding: 0 20px 15px !important;
|
2025-09-17 15:38:23 +08:00
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
box-sizing: border-box !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-20 23:43:58 +08:00
|
|
|
|
/* 控制按钮样式 */
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.ctrl_btn {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
padding-left: 0 !important;
|
|
|
|
|
|
margin-left: 0 !important;
|
2025-09-20 23:43:58 +08:00
|
|
|
|
|
2025-09-17 15:38:23 +08:00
|
|
|
|
.el-button {
|
|
|
|
|
|
min-width: 72px;
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
padding: 7px 12px 7px 10px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
line-height: 1;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
transform: translateY(-1px);
|
|
|
|
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-button--primary {
|
|
|
|
|
|
background: #5f70f3;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-button--success {
|
|
|
|
|
|
background: #5bc98c;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-button--danger {
|
|
|
|
|
|
background: #fd5b63;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-20 23:43:58 +08:00
|
|
|
|
</style>
|