提交 4d76d831 authored 作者: caijian's avatar caijian

生成结论&创建超图..

上级 3df44f93
...@@ -2,10 +2,8 @@ import request from './request' ...@@ -2,10 +2,8 @@ import request from './request'
//创建超图 //创建超图
export const createGraph = async (params) => { export const createGraph = async (params) => {
let { let res = await request.post('/api/hypergraph/create', params)
data return res
} = await request.post('/api/hypergraph/create')
return data
} }
//超图列表 //超图列表
...@@ -42,9 +40,13 @@ export const insertEntityIntoHypergraph = async (params) => { ...@@ -42,9 +40,13 @@ export const insertEntityIntoHypergraph = async (params) => {
//实体列表 //实体列表
export const getEntityList = async (params) => { export const getEntityList = async (params) => {
let url = `/api/entity/search_pagination?page=${params.page}`
if (params.query) {
url += `&query=${params.query}`
}
let { let {
data data
} = await request.get('/api/entity/get_list') } = await request.get(url)
return data return data
} }
...@@ -66,9 +68,13 @@ export const createItem = async (params) => { ...@@ -66,9 +68,13 @@ export const createItem = async (params) => {
//新闻列表 //新闻列表
export const getItemList = async (params) => { export const getItemList = async (params) => {
let url = `/api/news/search_pagination?page=${params.page}`
if (params.query) {
url += `&query=${params.query}`
}
let { let {
data data
} = await request.get('/api/news/get_list') } = await request.get(url)
return data return data
} }
...@@ -253,6 +259,24 @@ export const getEventData = async (params) => { ...@@ -253,6 +259,24 @@ export const getEventData = async (params) => {
return data return data
} }
// http://8.140.26.4:10006/tech_hyper/api/analysis/conclude_chart_in_rag?hyper_id=1
export const getChartConclusion = async (params) => {
let data = await request.get('/api/analysis/conclude_chart_in_rag?hyper_id=' + params.hyper_id)
return data
}
//
// http://8.140.26.4:10006/tech_hyper/api/analysis/conclude_event_relation_in_rag?hyper_id=1
export const getEventRelationConclusion = async (params) => {
let data = await request.get('/api/analysis/conclude_event_relation_in_rag?hyper_id=' + params.hyper_id)
return data
}
// http://8.140.26.4:10006/tech_hyper/api/analysis/conclude_matrix_in_rag?hyper_id=1
export const getMatrixConclusion = async (params) => {
let data = await request.get('/api/analysis/conclude_matrix_in_rag?hyper_id=' + params.hyper_id)
return data
}
/** /**
* 上传文件,后端解析Excel文件 * 上传文件,后端解析Excel文件
* @param file 文件,表单数据 * @param file 文件,表单数据
......
...@@ -9,7 +9,7 @@ const BASE_API = "/" ...@@ -9,7 +9,7 @@ const BASE_API = "/"
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
baseURL: BASE_API, //所有的后端接口请求地址前缀部分(没有后端请求不用写) baseURL: BASE_API, //所有的后端接口请求地址前缀部分(没有后端请求不用写)
timeout: 50000 // 请求超时时间,这里15秒 timeout: 60000*5 // 请求超时时间,这里15秒
//withCredentials: true,// 异步请求携带cookie,true为携带,false为不携带 //withCredentials: true,// 异步请求携带cookie,true为携带,false为不携带
//请求头里面设置通用传参类型 //请求头里面设置通用传参类型
/*headers: { /*headers: {
......
...@@ -2,7 +2,7 @@ const state = { ...@@ -2,7 +2,7 @@ const state = {
// 专题生成--步骤数据 // 专题生成--步骤数据
create_graph_form: {}, create_graph_form: {},
activeSteps: 0, // 当前 activeSteps: 0, // 当前
stepList: ["创建专题", "数据导入", "定义关系", "专题生成"], stepList: ["创建专题", "数据导入", /*"定义关系",*/ "专题生成"],
graph_name: "", graph_name: "",
graph_id: "", graph_id: "",
maxStepsTotal: 3, // 步骤总条数 maxStepsTotal: 3, // 步骤总条数
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted, getCurrentInstance } from "vue";
import router from "@/router/index.js"; import router from "@/router/index.js";
import { getGraphList } from "@/api/graphApi"; import { getGraphList } from "@/api/graphApi";
...@@ -62,6 +62,9 @@ import logo3 from "./assets/images/icon3.svg"; ...@@ -62,6 +62,9 @@ import logo3 from "./assets/images/icon3.svg";
import logo4 from "./assets/images/icon4.svg"; import logo4 from "./assets/images/icon4.svg";
import logo5 from "./assets/images/icon5.svg"; import logo5 from "./assets/images/icon5.svg";
const { appContext } = getCurrentInstance();
const globalProxy = appContext.config.globalProperties;
const largeModelList = ref([ const largeModelList = ref([
// { // {
// logo: logo1, // logo: logo1,
...@@ -121,10 +124,11 @@ const handleDelte = (id) => { ...@@ -121,10 +124,11 @@ const handleDelte = (id) => {
// 确认删除 // 确认删除
const handleConfirm = () => { const handleConfirm = () => {
if (id == event_graph_id.value) { // 弹窗提示 暂未支持删除接口
event_graph_id.value = null; globalProxy.$message.warning("暂未支持删除接口");
event_graph_name.value = null; return
} const deleteIndex = largeModelList.value.findIndex(item => item.id == activeModelId.value);
largeModelList.value.splice(deleteIndex, 1);
// requestDeleteEntityById({ // requestDeleteEntityById({
// entity_id: id // entity_id: id
// }).then((res) => { // }).then((res) => {
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<div class="conclusions-main-right-content"> <div class="conclusions-main-right-content">
<div class="conclusions-main-right-content-title"> <div class="conclusions-main-right-content-title">
<div style="display: flex"> <div style="display: flex">
<div class="conclusions-main-right-content-title-span">{{item.title}}</div> <div class="conclusions-main-right-content-title-span" v-if="item.title">{{item.title}}</div>
</div> </div>
<div class="conclusions-main-right-content-text" :title="item.content"> <div class="conclusions-main-right-content-text" :title="item.content" v-if="item.content || item">
{{item.content}} {{item.content || item}}
</div> </div>
</div> </div>
</div> </div>
...@@ -33,7 +33,7 @@ let props = defineProps({ ...@@ -33,7 +33,7 @@ let props = defineProps({
<style lang="scss" scoped> <style lang="scss" scoped>
.conclusions-main-right-content-panel { .conclusions-main-right-content-panel {
height: 100%; height: 95%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<div class="conclusionlist-title"> <div class="conclusionlist-title">
<span>结论</span> <span>结论</span>
</div> </div>
<ConclusionList :conclusionsArr="conclusionsList" class="conclusion-list"></ConclusionList> <ConclusionList :conclusionsArr="conclusionsList" class="conclusion-list" v-loading="conclusionLoading" element-loading-background="rgba(0, 0, 0, 0.2)"></ConclusionList>
</div> </div>
<el-button type="primary" class="edit-button" @click="editDataFun()">编辑</el-button> <el-button type="primary" class="edit-button" @click="editDataFun()">编辑</el-button>
</div> </div>
...@@ -60,11 +60,12 @@ ...@@ -60,11 +60,12 @@
<DataList :list="newsListChartBubble" class="bubble-datalist"></DataList> <DataList :list="newsListChartBubble" class="bubble-datalist"></DataList>
<div class="bottom-button-group"> <div class="bottom-button-group">
<el-button type="primary" @click="bubbleDrawing()">气泡图绘制</el-button> <el-button type="primary" @click="bubbleDrawing()">气泡图绘制</el-button>
<el-button type="primary" @click="modelScaleAnalysis()">模型规模分析</el-button> <el-button type="primary" @click="generateConclusionBubble()">生成结论</el-button>
<el-button type="primary" @click="lagAnalysis()">滞后性分析</el-button> <!-- <el-button type="primary" @click="modelScaleAnalysis()">模型规模分析</el-button>
<el-button type="primary" @click="lagAnalysis()">滞后性分析</el-button> -->
</div> </div>
</div> </div>
<div class="bubble-box"> <div class="bubble-box" v-loading="graphMatrixLoading" element-loading-background="rgba(0, 0, 0, 0.2)">
<div class="bubble-item" v-for="(item,index) in targetList" :key="index"> <div class="bubble-item" v-for="(item,index) in targetList" :key="index">
<div class="info"> <div class="info">
<div style="display: flex;flex-direction: column;justify-content: center;height: 10%;"> <div style="display: flex;flex-direction: column;justify-content: center;height: 10%;">
...@@ -96,11 +97,11 @@ ...@@ -96,11 +97,11 @@
<div class="conclusionlist-title"> <div class="conclusionlist-title">
<span>模型规模分析结论</span> <span>模型规模分析结论</span>
</div> </div>
<ConclusionList :conclusionsArr="conListBubble" class="conclusion-list"></ConclusionList> <ConclusionList :conclusionsArr="conListBubble" class="conclusion-list" v-loading="conclusionBubbleLoading" element-loading-background="rgba(0, 0, 0, 0.2)"></ConclusionList>
<div class="conclusionlist-title-bottom"> <!-- <div class="conclusionlist-title-bottom">
<span>滞后性分析结论</span> <span>滞后性分析结论</span>
</div> </div>
<ConclusionList :conclusionsArr="conListBubbleBottom" class="conclusion-list-bottom"></ConclusionList> <ConclusionList :conclusionsArr="conListBubbleBottom" class="conclusion-list-bottom"></ConclusionList> -->
</div> </div>
</div> </div>
...@@ -226,7 +227,10 @@ import { ...@@ -226,7 +227,10 @@ import {
getMatrixNewsList, getMatrixNewsList,
getMatrixData, getMatrixData,
getEventNewsList, getEventNewsList,
getEventData getEventData,
getChartConclusion,
getEventRelationConclusion,
getMatrixConclusion
} from "@/api/graphApi"; } from "@/api/graphApi";
const { const {
...@@ -1082,22 +1086,48 @@ function curvatureAnalysis(){ ...@@ -1082,22 +1086,48 @@ function curvatureAnalysis(){
} }
} }
const conclusionLoading = ref(false)
function generateConclusion(){ function generateConclusion(){
conclusionsList.value = [{ conclusionLoading.value = true;
title: "结论一", getChartConclusion({
content: "2017年与2023年,国外AI的技术性能均有大幅度提升,2017年全年处于急速上升的状态,但2023年前半年提升较慢,下半年飞速提升,创建了第二次飞速发展的阶段" hyper_id: hyperId.value
},{ }).then((res) => {
title: "结论二", if (res.code === 1) {
content: "我国的AI技术,在2018年得到了很大的提升,缩短了与国外AI技术的差距,在2024年我国再一次大幅度提升AI技术,并最终非常拉近了与国外的距离" conclusionsList.value = res.data;
},{ }
title: "结论三", conclusionLoading.value = false;
content: "我国的两次AI技术提升,均晚于国外,说明AI技术提升,我国还是受国外影响较多,但近十年我国整体提升幅度相交国外更明显,处于追赶与拉近距离的地位" }).catch((err) => {
}] conclusionLoading.value = false;
})
// conclusionsList.value = [{
// title: "结论一",
// content: "2017年与2023年,国外AI的技术性能均有大幅度提升,2017年全年处于急速上升的状态,但2023年前半年提升较慢,下半年飞速提升,创建了第二次飞速发展的阶段"
// },{
// title: "结论二",
// content: "我国的AI技术,在2018年得到了很大的提升,缩短了与国外AI技术的差距,在2024年我国再一次大幅度提升AI技术,并最终非常拉近了与国外的距离"
// },{
// title: "结论三",
// content: "我国的两次AI技术提升,均晚于国外,说明AI技术提升,我国还是受国外影响较多,但近十年我国整体提升幅度相交国外更明显,处于追赶与拉近距离的地位"
// }]
} }
function bubbleDrawing(){ function bubbleDrawing(){
initMatrix(); initMatrix();
} }
const conclusionBubbleLoading = ref(false);
function generateConclusionBubble(){
conclusionBubbleLoading.value = true;
getMatrixConclusion({
hyper_id: hyperId.value
}).then((res) => {
if (res.code === 1) {
conListBubble.value = res.data;
}
conclusionBubbleLoading.value = false;
}).catch((err) => {
conclusionBubbleLoading.value = false;
})
}
function modelScaleAnalysis(){ function modelScaleAnalysis(){
conListBubble.value = [{ conListBubble.value = [{
...@@ -1134,19 +1164,31 @@ function createGraphA(){ ...@@ -1134,19 +1164,31 @@ function createGraphA(){
} }
function generateConclusionG6(){ function generateConclusionG6(){
conListG6.value = [{ conclusionLoading.value = true;
title: "结论一", getEventRelationConclusion({
content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能" hyper_id: hyperId.value
},{ }).then((res) => {
title: "结论二", if (res.code === 1) {
content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能" conListG6.value = res.data;
},{ }
title: "结论三", conclusionLoading.value = false;
content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能" }).catch((err) => {
}] conclusionLoading.value = false;
})
// conListG6.value = [{
// title: "结论一",
// content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能"
// },{
// title: "结论二",
// content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能"
// },{
// title: "结论三",
// content: "人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能人工智能"
// }]
} }
const graphMatrixLoading = ref(false);
function initMatrix() { function initMatrix() {
graphMatrixLoading.value = true;
getMatrixData({ hyper_id: hyperId.value }).then((res) => { getMatrixData({ hyper_id: hyperId.value }).then((res) => {
if (res.code === 1 && res.data && res.data.length > 0) { if (res.code === 1 && res.data && res.data.length > 0) {
// 更新数据结构,将title改为event_title以匹配模板 // 更新数据结构,将title改为event_title以匹配模板
...@@ -1155,7 +1197,9 @@ function initMatrix() { ...@@ -1155,7 +1197,9 @@ function initMatrix() {
event_title: item.title event_title: item.title
})); }));
} }
graphMatrixLoading.value = false;
}).catch((error) => { }).catch((error) => {
graphMatrixLoading.value = false;
console.error('获取矩阵数据失败:', error); console.error('获取矩阵数据失败:', error);
globalProxy.$message({ globalProxy.$message({
type: "error", type: "error",
...@@ -1234,6 +1278,17 @@ function openRagDialog(tabType) { ...@@ -1234,6 +1278,17 @@ function openRagDialog(tabType) {
function handleRagSubmit(prompt) { function handleRagSubmit(prompt) {
console.log('RAG请求提交:', prompt); console.log('RAG请求提交:', prompt);
// 这里可以添加额外的处理逻辑 // 这里可以添加额外的处理逻辑
switch(focusBotton.value) {
case "0":
getNewsList();
break;
case "1":
getMatrixNews();
break;
case "2":
getEventNews();
break;
}
} }
function superLongTextHandle(str, maxWidth, fontSize) { function superLongTextHandle(str, maxWidth, fontSize) {
...@@ -2011,7 +2066,6 @@ function addArrow(rectCenterX, rectBottomY, minY, arrowEndY, arrowWidth, labelOf ...@@ -2011,7 +2066,6 @@ function addArrow(rectCenterX, rectBottomY, minY, arrowEndY, arrowWidth, labelOf
} }
.conclusion-list { .conclusion-list {
height: calc(50% - 60px);
margin-top: 10px; margin-top: 10px;
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="handleClose">取消</el-button> <el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button> <el-button type="primary" @click="handleSubmit" :loading="loading">确定</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
...@@ -58,6 +58,7 @@ const saveUrlMap = { ...@@ -58,6 +58,7 @@ const saveUrlMap = {
} }
const emit = defineEmits(['update:modelValue', 'submit']) const emit = defineEmits(['update:modelValue', 'submit'])
const loading = ref(false)
const visible = ref(false) const visible = ref(false)
const form = ref({ const form = ref({
prompt: '' prompt: ''
...@@ -86,6 +87,7 @@ function handleClose() { ...@@ -86,6 +87,7 @@ function handleClose() {
// 获取prompt数据 // 获取prompt数据
async function fetchPromptData() { async function fetchPromptData() {
try { try {
loading.value = true
const params = { const params = {
hyper_id: props.hyperId hyper_id: props.hyperId
} }
...@@ -99,6 +101,8 @@ async function fetchPromptData() { ...@@ -99,6 +101,8 @@ async function fetchPromptData() {
message: '获取prompt数据失败', message: '获取prompt数据失败',
type: 'error' type: 'error'
}) })
} finally {
loading.value = false
} }
} }
...@@ -117,9 +121,10 @@ async function savePromptData() { ...@@ -117,9 +121,10 @@ async function savePromptData() {
} }
} }
async function handleSubmit() { async function handleSubmit() {
console.log('RAG请求参数:', form.value.prompt) console.log('RAG请求参数:', form.value.prompt)
loading.value = true
if (!form.value.prompt.trim()) { if (!form.value.prompt.trim()) {
globalProxy.$message({ globalProxy.$message({
message: '请输入prompt内容', message: '请输入prompt内容',
...@@ -129,6 +134,7 @@ async function handleSubmit() { ...@@ -129,6 +134,7 @@ async function handleSubmit() {
} }
try { try {
loading.value = true
globalProxy.$message({ globalProxy.$message({
message: '正在保存prompt...', message: '正在保存prompt...',
type: 'info' type: 'info'
...@@ -148,6 +154,8 @@ async function handleSubmit() { ...@@ -148,6 +154,8 @@ async function handleSubmit() {
message: '保存prompt失败', message: '保存prompt失败',
type: 'error' type: 'error'
}) })
} finally {
loading.value = false
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</el-table-column> </el-table-column>
<el-table-column :label="operationLabel" :width="operationMinWidth" :align="operationAlign" v-if="operationLabelShow"> <el-table-column :label="operationLabel" :width="operationMinWidth" :align="operationAlign" v-if="operationLabelShow">
<template v-slot="scope"> <template v-slot="scope">
<slot></slot> <slot :row="scope.row" :column="scope.column" :$index="scope.$index"></slot>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-tabs class="tablist" v-model="activeTabName" @tab-click="changeTabs"> <el-tabs class="tablist" v-model="activeTabName" @tab-click="changeTabs">
<el-tab-pane <el-tab-pane
v-for="tab in tabsList" v-for="tab in tabsList"
...@@ -39,10 +40,41 @@ ...@@ -39,10 +40,41 @@
:label="tab.label" :label="tab.label"
:name="tab.value" :name="tab.value"
> >
<!-- 搜索框 -->
<div class="search-box" v-if="formState.radio == 'local'">
<el-input
v-model="searchQuery"
placeholder="请输入搜索关键词"
clearable
style="width: 300px;"
@keyup.enter="handleSearch"
>
<template #append>
<el-button @click="handleSearch" type="primary">
<el-icon><Search /></el-icon>
</el-button>
</template>
</el-input>
<el-button @click="handleResetSearch" style="margin-left: 8px;">重置</el-button>
</div>
<!-- 表格数据 --> <!-- 表格数据 -->
<div class="table-box"> <div class="table-box">
<div class="table-content" v-loading="tableLoading" element-loading-text="正在加载中..."> <div class="table-content" v-loading="tableLoading" element-loading-text="正在加载中...">
<TablePaginationComp v-if="isShowTable" class="table-comp" ref="tableCompRef" :tableData="formState.tableData" :columnList="columnList" :border="true" :selection="true" :showPagination="formState.radio == 'local' ? true : false" :pagination="formState.pagination" :maxHeight="formState.radio == 'local' ? '500' : null" @handleSizeChange="handleSizeChange" @handleCurrentChange="handleCurrentChange" @handleSelectionChange="handleSelectionChange" @selectSingle="handleSelectSingle"> <TablePaginationComp
v-if="isShowTable"
class="table-comp"
ref="tableCompRef"
:tableData="formState.tableData"
:columnList="columnList"
:border="true"
:selection="true"
:showPagination="formState.radio == 'local' ? true : false"
:pagination="formState.pagination"
:maxHeight="formState.radio == 'local' ? '500' : null"
@handleSizeChange="handleSizeChange"
@handleCurrentChange="handleCurrentChange"
@handleSelectionChange="handleSelectionChange"
@selectSingle="handleSelectSingle">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="" link size="small" @click="toViewRow(scope.row)" class="info-button">查看详情</el-button> <el-button type="" link size="small" @click="toViewRow(scope.row)" class="info-button">查看详情</el-button>
</template> </template>
...@@ -111,6 +143,7 @@ import { ...@@ -111,6 +143,7 @@ import {
} from "@/api/graphApi"; } from "@/api/graphApi";
import TablePaginationComp from "../components/TablePagination.vue"; import TablePaginationComp from "../components/TablePagination.vue";
import CreateFooterBtn from "../components/CreateFooterBtn.vue"; import CreateFooterBtn from "../components/CreateFooterBtn.vue";
import { createGraph } from "@/api/graphApi";
const emit = defineEmits(['handleCancelCreate']); const emit = defineEmits(['handleCancelCreate']);
const { const {
appContext appContext
...@@ -172,47 +205,66 @@ let tabsList = ref([ ...@@ -172,47 +205,66 @@ let tabsList = ref([
label: "事件", label: "事件",
value: "items", value: "items",
}, },
{ // {
label: "关系", // label: "关系",
value: "relations", // value: "relations",
} // }
]) ])
let activeTabName = ref("entity") let activeTabName = ref("entity")
let searchQuery = ref("") // 搜索关键词
onMounted(() => { onMounted(() => {
getTableDataEntity(); getTableDataEntity();
}) })
function getTableDataEntity() { function getTableDataEntity() {
formState.value.tableData = [{ // formState.value.tableData = [{
id: 1, // id: 1,
name: "1", // name: "1",
description: "123" // description: "123"
},{ // },{
id: 2, // id: 2,
name: "2", // name: "2",
description: "1234" // description: "1234"
},{ // },{
id: 3, // id: 3,
name: "3", // name: "3",
description: "12345" // description: "12345"
},{ // },{
id: 4, // id: 4,
name: "4", // name: "4",
description: "123456" // description: "123456"
}] // }]
// getEntityList({}).then((res) => { const params = {
// if (res && res.data) { page: formState.value.pagination.page
// formState.value.tableData = res.data; };
// formState.value.pagination.total_count = res.data.length;
// } // 如果有搜索关键词,添加 query 参数
// }) if (searchQuery.value.trim()) {
params.query = searchQuery.value.trim();
}
getEntityList(params).then((res) => {
if (res && res.data) {
formState.value.tableData = res.data;
formState.value.pagination.total_count = res.total;
}
})
} }
function getTableDataItem() { function getTableDataItem() {
getItemList().then((res) => { const params = {
page: formState.value.pagination.page
};
// 如果有搜索关键词,添加 query 参数
if (searchQuery.value.trim()) {
params.query = searchQuery.value.trim();
}
getItemList(params).then((res) => {
if (res && res.data) { if (res && res.data) {
formState.value.tableData = res.data; formState.value.tableData = res.data;
formState.value.pagination.total_count = res.data.length; formState.value.pagination.total_count = res.total;
} }
}) })
} }
...@@ -220,6 +272,7 @@ function getTableDataItem() { ...@@ -220,6 +272,7 @@ function getTableDataItem() {
function changeRadio(val) { function changeRadio(val) {
formStateRef.value.resetFields(); formStateRef.value.resetFields();
resetTableSelect() resetTableSelect()
searchQuery.value = ""; // 重置搜索关键词
formState.value = { formState.value = {
radio: val, radio: val,
tableData: [], tableData: [],
...@@ -238,6 +291,9 @@ function changeRadio(val) { ...@@ -238,6 +291,9 @@ function changeRadio(val) {
} }
function changeTabs(val) { function changeTabs(val) {
if (formState.value.radio === "local"){ if (formState.value.radio === "local"){
// 切换标签页时重置分页到第一页
formState.value.pagination.page = 1;
if (val.paneName === "entity"){ if (val.paneName === "entity"){
columnList.value = [{ columnList.value = [{
prop: "name", prop: "name",
...@@ -314,6 +370,7 @@ function getTableData(postData) { ...@@ -314,6 +370,7 @@ function getTableData(postData) {
} }
// 数据详情 // 数据详情
function toViewRow(row) { function toViewRow(row) {
console.log(row,11)
rowInfo.value = { rowInfo.value = {
...row, ...row,
}; };
...@@ -333,6 +390,11 @@ function handleSizeChange(size) { ...@@ -333,6 +390,11 @@ function handleSizeChange(size) {
function handleCurrentChange(page) { function handleCurrentChange(page) {
formState.value.pagination.page = page; formState.value.pagination.page = page;
if (activeTabName.value === "entity"){
getTableDataEntity();
} else if (activeTabName.value === "items"){
getTableDataItem();
}
} }
// 选中 // 选中
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
...@@ -358,6 +420,32 @@ function resetTableSelect() { ...@@ -358,6 +420,32 @@ function resetTableSelect() {
} }
} }
// 搜索功能
function handleSearch() {
// 重置分页到第一页
formState.value.pagination.page = 1;
// 根据当前标签页获取对应数据
if (activeTabName.value === "entity") {
getTableDataEntity();
} else if (activeTabName.value === "items") {
getTableDataItem();
}
}
// 重置搜索
function handleResetSearch() {
searchQuery.value = "";
formState.value.pagination.page = 1;
// 根据当前标签页获取对应数据
if (activeTabName.value === "entity") {
getTableDataEntity();
} else if (activeTabName.value === "items") {
getTableDataItem();
}
}
function changeTableLoading(flag) { function changeTableLoading(flag) {
tableLoading.value = flag; tableLoading.value = flag;
} }
...@@ -378,30 +466,61 @@ function handlePreStep() { ...@@ -378,30 +466,61 @@ function handlePreStep() {
store.commit("graph/SET_ACTIVE_STEP", props.currentStep - 1); store.commit("graph/SET_ACTIVE_STEP", props.currentStep - 1);
} }
// 下一步 // 下一步
function handleNextStep() { async function handleNextStep() {
let isEmpty = isEmptyObject(formState.value.selectData) let isEmpty = isEmptyObject(formState.value.selectData)
if (isEmpty) { if (isEmpty) {
return globalProxy.$message.error("请选择数据"); return globalProxy.$message.error("请选择数据");
} }
// let new_select_data = {};
// const { try {
// selectData // 从 store 中获取 name 和 description
// } = formState.value; const graphFormData = store.state.graph.create_graph_form[0] || {};
// for (let key in selectData) { const name = graphFormData.graphName || "";
// if (selectData[key].length) { const description = graphFormData.description || "";
// new_select_data[key] = selectData[key];
// } // 从选中数据中提取 entity_ids 和 news_ids
// } const selectData = formState.value.selectData;
// formState.value.selectData = new_select_data; console.log("选中的数据:", selectData);
store.commit("graph/SET_SELECT_DATA", {
selectData: formState.value.selectData, const entity_ids = selectData.entity ? selectData.entity.map(item => item.id) : [];
currentStep: props.currentStep, const news_ids = selectData.items ? selectData.items.map(item => item.id) : [];
});
store.commit("graph/SET_GRAPH_DATA", { console.log("提取的entity_ids:", entity_ids);
data: formState.value, console.log("提取的news_ids:", news_ids);
currentStep: props.currentStep,
nextStep: 2, if (!name) {
}); return globalProxy.$message.error("专题名称不能为空");
}
// 调用创建接口
const params = {
name,
description,
entity_ids,
news_ids
};
const result = await createGraph(params);
console.log(result, 'create result')
if (result.code == 1) {
globalProxy.$message.success("创建成功");
// 存储选中的数据到 store
store.commit("graph/SET_SELECT_DATA", {
selectData: formState.value.selectData,
currentStep: props.currentStep,
});
// 进入下一步
store.commit("graph/SET_GRAPH_DATA", {
data: formState.value,
currentStep: props.currentStep,
nextStep: 2,
});
}
} catch (error) {
console.error("创建失败:", error);
globalProxy.$message.error("创建失败,请重试");
}
} }
</script> </script>
...@@ -530,6 +649,49 @@ function handleNextStep() { ...@@ -530,6 +649,49 @@ function handleNextStep() {
text-align: center; text-align: center;
} }
.search-box {
display: flex;
align-items: center;
margin-bottom: 16px;
padding: 0 16px;
.el-input {
:deep(.el-input__wrapper) {
background-color: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.3);
.el-input__inner {
color: #fff;
&::placeholder {
color: rgba(255, 255, 255, 0.6);
}
}
}
:deep(.el-input-group__append) {
background-color: rgba(255, 255, 255, 0.1);
border-left: 1px solid rgba(255, 255, 255, 0.3);
.el-button {
background-color: transparent;
border: none;
color: #409eff;
}
}
}
.el-button {
background-color: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
&:hover {
background-color: rgba(255, 255, 255, 0.2);
}
}
}
.table-box { .table-box {
height: 100%; height: 100%;
display: flex; display: flex;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<!-- 数据导入 --> <!-- 数据导入 -->
<ImportDataStep ref="importDataStepRef" :currentStep="activeSteps" v-if="activeSteps == 1" @handleCancelCreate="handleCancelCreate"></ImportDataStep> <ImportDataStep ref="importDataStepRef" :currentStep="activeSteps" v-if="activeSteps == 1" @handleCancelCreate="handleCancelCreate"></ImportDataStep>
<!-- 定义关系 --> <!-- 定义关系 -->
<DefineRelationsStep ref="importDataStepRef" :currentStep="activeSteps" v-if="activeSteps == 2" @handleCancelCreate="handleCancelCreate"></DefineRelationsStep> <!-- <DefineRelationsStep ref="importDataStepRef" :currentStep="activeSteps" v-if="activeSteps == 2" @handleCancelCreate="handleCancelCreate"></DefineRelationsStep> -->
<!-- 专题生成 --> <!-- 专题生成 -->
<div v-if="activeSteps == 3" class="graph-generation"> <div v-if="activeSteps == 2" class="graph-generation">
<div class="icon-success"> <div class="icon-success">
<span class="icon el-icon-success"></span> <span class="icon el-icon-success"></span>
<div class="success-tips">创建成功!</div> <div class="success-tips">创建成功!</div>
...@@ -79,7 +79,7 @@ function toViewGraph() { ...@@ -79,7 +79,7 @@ function toViewGraph() {
// 删除主题 // 删除主题
function handleCancelCreate(type) { function handleCancelCreate(type) {
// 图谱未创建完成离开删除创建的主题 // 图谱未创建完成离开删除创建的主题
if (activeSteps.value !== 3) { if (activeSteps.value !== 2) {
clearCache(); clearCache();
if (type !== "destroy") { if (type !== "destroy") {
toViewGraph(); toViewGraph();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论