|
@@ -1,26 +1,41 @@
|
|
<template>
|
|
<template>
|
|
<div class="data-list" v-loading="loading" element-loading-text="加载中...">
|
|
<div class="data-list" v-loading="loading" element-loading-text="加载中...">
|
|
|
|
+ <div class="batch-actions" style="margin: 10px 0">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="batchAnalysis"
|
|
|
|
+ :disabled="!selectedRows.length"
|
|
|
|
+ >批量解析</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
<el-table
|
|
<el-table
|
|
|
|
+ ref="dataTable"
|
|
:data="dataList"
|
|
:data="dataList"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
header-row-class-name="headerBg"
|
|
header-row-class-name="headerBg"
|
|
empty-text="没有模板信息"
|
|
empty-text="没有模板信息"
|
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
|
+ @sort-change="handleSortChange"
|
|
>
|
|
>
|
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column prop="id" label="ID" align="center" width="80" />
|
|
<el-table-column prop="id" label="ID" align="center" width="80" />
|
|
- <el-table-column prop="name" label="文件名称" align="center">
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="name"
|
|
|
|
+ label="文件名称"
|
|
|
|
+ align="center"
|
|
|
|
+ sortable="custom"
|
|
|
|
+ >
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span @click="getName(scope.row)">{{ scope.row.name }}</span>
|
|
|
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="chunk_num" label="分块数" align="center" />
|
|
<el-table-column prop="chunk_num" label="分块数" align="center" />
|
|
- <el-table-column prop="create_time" label="上传时间" align="center" />
|
|
|
|
- <!-- <el-table-column prop="" label="解析方法" align="center" /> -->
|
|
|
|
- <el-table-column prop="createTime" label="启用" align="center"
|
|
|
|
- ><template #default="scope">
|
|
|
|
- <div v-if="scope.row.status == 5">启用</div>
|
|
|
|
- <div v-if="scope.row.status == 6">停用</div>
|
|
|
|
- </template></el-table-column
|
|
|
|
- >
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="create_time"
|
|
|
|
+ label="上传时间"
|
|
|
|
+ align="center"
|
|
|
|
+ sortable="custom"
|
|
|
|
+ />
|
|
<el-table-column prop="run" label="解析状态" align="center">
|
|
<el-table-column prop="run" label="解析状态" align="center">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<div v-if="scope.row.run == 0">未解析</div>
|
|
<div v-if="scope.row.run == 0">未解析</div>
|
|
@@ -30,49 +45,112 @@
|
|
<div v-if="scope.row.run == 5">待处理</div>
|
|
<div v-if="scope.row.run == 5">待处理</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="操作" align="center" width="500"
|
|
|
|
- ><!-- editWidth() -->
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" width="330">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<div class="btns">
|
|
<div class="btns">
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- v-if="allowEdit"
|
|
|
|
- @click="analysis(scope.row)"
|
|
|
|
- :loading="scope.row.analyzing"
|
|
|
|
- :disabled="scope.row.run === 1"
|
|
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ content="预览"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
- {{ scope.row.run === 1 ? "解析中" : "解析" }}</el-button
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ icon="el-icon-view"
|
|
|
|
+ v-if="allowEdit"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ @click="getName(scope.row)"
|
|
|
|
+ ></el-button
|
|
|
|
+ ></el-tooltip>
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ :content="scope.row.run === 1 ? '解析中' : '解析'"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- v-if="allowEdit"
|
|
|
|
- @click="Analytical(scope.row)"
|
|
|
|
- >解析方法</el-button
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ :icon="
|
|
|
|
+ scope.row.run === 1
|
|
|
|
+ ? 'el-icon-loading'
|
|
|
|
+ : 'el-icon-caret-right'
|
|
|
|
+ "
|
|
|
|
+ circle
|
|
|
|
+ v-if="allowEdit"
|
|
|
|
+ @click="analysis(scope.row)"
|
|
|
|
+ :loading="scope.row.analyzing"
|
|
|
|
+ :disabled="scope.row.run === 1"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ >
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ content="解析方法"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- v-if="allowEdit"
|
|
|
|
- @click="btnEdit(scope.row)"
|
|
|
|
- ><svg-icon icon-class="edit" />修改文件名</el-button
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ icon="el-icon-tickets"
|
|
|
|
+ v-if="allowEdit"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ @click="Analytical(scope.row)"
|
|
|
|
+ ></el-button
|
|
|
|
+ ></el-tooltip>
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ content="修改文件名"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- v-if="allowEdit"
|
|
|
|
- @click="btnDown(scope.row)"
|
|
|
|
- :loading="scope.row.downloading"
|
|
|
|
- ><svg-icon icon-class="edit" />下载</el-button
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ icon="el-icon-edit"
|
|
|
|
+ v-if="allowEdit"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ @click="btnEdit(scope.row)"
|
|
|
|
+ ></el-button
|
|
|
|
+ ></el-tooltip>
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ content="下载"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
- <el-button
|
|
|
|
- type="danger"
|
|
|
|
- size="small"
|
|
|
|
- v-if="allowDelete"
|
|
|
|
- @click="btnDelete(scope.row.id)"
|
|
|
|
- ><svg-icon icon-class="delete" />删除</el-button
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
+ v-if="allowEdit"
|
|
|
|
+ @click="btnDown(scope.row)"
|
|
|
|
+ :loading="scope.row.downloading"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ ></el-button
|
|
|
|
+ ></el-tooltip>
|
|
|
|
+ <el-tooltip
|
|
|
|
+ class="item"
|
|
|
|
+ effect="dark"
|
|
|
|
+ content="删除"
|
|
|
|
+ placement="top"
|
|
>
|
|
>
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ v-if="allowDelete"
|
|
|
|
+ @click="btnDelete(scope.row.id)"
|
|
|
|
+ style="font-size: 20px"
|
|
|
|
+ ></el-button
|
|
|
|
+ ></el-tooltip>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -158,6 +236,7 @@ import {
|
|
nameGetUrl,
|
|
nameGetUrl,
|
|
renameFile,
|
|
renameFile,
|
|
analysis,
|
|
analysis,
|
|
|
|
+ batchAnalysis,
|
|
} from "@/api/knowledge";
|
|
} from "@/api/knowledge";
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
@@ -229,12 +308,95 @@ export default {
|
|
token_num: 0,
|
|
token_num: 0,
|
|
},
|
|
},
|
|
analRules: {},
|
|
analRules: {},
|
|
|
|
+ selectedRows: [],
|
|
|
|
+ sortColumn: "",
|
|
|
|
+ sortOrder: "",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.search();
|
|
this.search();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ /* 排序 */
|
|
|
|
+ handleSortChange({ prop, order }) {
|
|
|
|
+ this.sortColumn = prop;
|
|
|
|
+ this.sortOrder = order;
|
|
|
|
+ this.sortData();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ sortData() {
|
|
|
|
+ const { sortColumn, sortOrder } = this;
|
|
|
|
+ if (!sortColumn || !sortOrder) {
|
|
|
|
+ this.search(); // Reset to original order
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.dataList.sort((a, b) => {
|
|
|
|
+ let comparison = 0;
|
|
|
|
+ if (sortColumn === "name") {
|
|
|
|
+ comparison = a.name.localeCompare(b.name, "zh-CN");
|
|
|
|
+ } else if (sortColumn === "create_time") {
|
|
|
|
+ comparison = new Date(a.create_time) - new Date(b.create_time);
|
|
|
|
+ }
|
|
|
|
+ return sortOrder === "ascending" ? comparison : -comparison;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /* 批量解析 */
|
|
|
|
+ handleSelectionChange(val) {
|
|
|
|
+ this.selectedRows = val;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ batchAnalysis() {
|
|
|
|
+ const selectedIds = this.selectedRows.map((row) => row.id);
|
|
|
|
+ if (selectedIds.length === 0) {
|
|
|
|
+ this.$message.warning("请选择要解析的文件");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.$confirm("确定要批量解析选中的文件吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ batchAnalysis({ ids: JSON.stringify(selectedIds) })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
+ this.$message.success("批量解析任务已提交");
|
|
|
|
+ this.updateAnalysisStatus(selectedIds);
|
|
|
|
+ this.clearSelection();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("批量解析请求失败");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.error("批量解析错误:", error);
|
|
|
|
+ this.$message.error("批量解析过程中出现错误");
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ // 取消操作
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ updateAnalysisStatus(ids) {
|
|
|
|
+ this.dataList.forEach((row) => {
|
|
|
|
+ if (ids.includes(row.id)) {
|
|
|
|
+ row.run = 1; // 设置状态为"解析中"
|
|
|
|
+ this.checkAnalysisStatus(row);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ clearSelection() {
|
|
|
|
+ this.$refs.dataTable.clearSelection();
|
|
|
|
+ this.selectedRows = [];
|
|
|
|
+ },
|
|
|
|
+
|
|
/* 跳转页面 */
|
|
/* 跳转页面 */
|
|
getName(e) {
|
|
getName(e) {
|
|
this.$router.push({
|
|
this.$router.push({
|
|
@@ -444,6 +606,7 @@ export default {
|
|
end_page: _this.analForm.end_page,
|
|
end_page: _this.analForm.end_page,
|
|
}));
|
|
}));
|
|
_this.pageTotal = res.data.pagination.total_count;
|
|
_this.pageTotal = res.data.pagination.total_count;
|
|
|
|
+ _this.recordCount = res.data.pagination.total_count;
|
|
_this.loading = false;
|
|
_this.loading = false;
|
|
|
|
|
|
// Initialize the analysis status for each row
|
|
// Initialize the analysis status for each row
|