|
@@ -4,7 +4,7 @@
|
|
|
<home-header sub-title="自然资源大模型工具" />
|
|
|
</div>
|
|
|
<div class="content-box">
|
|
|
- <div class="top">
|
|
|
+ <div class="top" v-if="false">
|
|
|
<div
|
|
|
v-for="(item, index) in fileList"
|
|
|
:key="item"
|
|
@@ -27,7 +27,7 @@
|
|
|
<a-upload
|
|
|
v-if="fileList1.length === 0"
|
|
|
class="upload"
|
|
|
- action="https://zjugpt.com/knowledge/policy/file/upload"
|
|
|
+ action="/aisKnowledge/infra/file/upload"
|
|
|
@change="(info)=>handleChange(info, 1)"
|
|
|
:showUploadList="false"
|
|
|
:data="{ type: 'temp' }"
|
|
@@ -38,8 +38,8 @@
|
|
|
</a-upload>
|
|
|
<div v-else class="preview">
|
|
|
<span class="icon"><img src="../../assets/images/pdf_icon.png" /></span>
|
|
|
- <div>
|
|
|
- <span class="title">{{ fileList1[0]['name'] }}</span>
|
|
|
+ <div @click="switchPdfSource(1)">
|
|
|
+ <span class="title">{{ fileList1[0]['fileName'] }}</span>
|
|
|
<span class="size">{{ (fileList1[0]['size'] / 1024).toFixed(2) }}KB</span>
|
|
|
</div>
|
|
|
<span class="close" @click="deleteFileHandle(1)">x</span>
|
|
@@ -50,7 +50,7 @@
|
|
|
<a-upload
|
|
|
v-if="fileList2.length === 0"
|
|
|
class="upload"
|
|
|
- action="https://zjugpt.com/knowledge/policy/file/upload"
|
|
|
+ action="/aisKnowledge/infra/file/upload"
|
|
|
@change="(info)=>handleChange(info, 2)"
|
|
|
:showUploadList="false"
|
|
|
:data="{ type: 'temp' }"
|
|
@@ -61,8 +61,8 @@
|
|
|
</a-upload>
|
|
|
<div v-else class="preview">
|
|
|
<span class="icon"><img src="../../assets/images/pdf_icon.png" /></span>
|
|
|
- <div>
|
|
|
- <span class="title">{{ fileList2[0]['name'] }}</span>
|
|
|
+ <div @click="switchPdfSource(2)">
|
|
|
+ <span class="title">{{ fileList2[0]['fileName'] }}</span>
|
|
|
<span class="size">{{ (fileList2[0]['size'] / 1024).toFixed(2) }}KB</span>
|
|
|
</div>
|
|
|
<span class="close" @click="deleteFileHandle(2)">x</span>
|
|
@@ -92,11 +92,7 @@ import { message } from 'ant-design-vue';
|
|
|
import { CloseCircleOutlined } from '@ant-design/icons-vue';
|
|
|
import PDFViewer from '@/components/pdf/PDFViewerSearch.vue';
|
|
|
import AiAssistant from './components/aiAssistant.vue';
|
|
|
-const fileList = ref([
|
|
|
- '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见',
|
|
|
- '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见',
|
|
|
- '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见'
|
|
|
-]);
|
|
|
+const fileList = ref([]);
|
|
|
import api from '@/utils/policy-api';
|
|
|
import { useUserStore } from '@/stores/user/user';
|
|
|
import PubsubService from '@/utils/PubsubService';
|
|
@@ -125,30 +121,23 @@ onMounted(() => {
|
|
|
zoomFlag.value = t.value;
|
|
|
});
|
|
|
index.value=-1;
|
|
|
- fileList.value = user.files;
|
|
|
- if (fileList.value && fileList.value.length > 0) {
|
|
|
- current.value = fileList.value[0];
|
|
|
- current.value.url = '';
|
|
|
- queryFilesName();
|
|
|
- }
|
|
|
});
|
|
|
const fileList1 = ref([])
|
|
|
const fileList2 = ref([])
|
|
|
const handleChange = (info, type) => {
|
|
|
var name = info.file.name.split('.')[0];
|
|
|
var fileName = info.file.name;
|
|
|
- var url = '/knowledge/file/temp/' + fileName;
|
|
|
const status = info.file.status;
|
|
|
- if (status !== 'uploading') {
|
|
|
- console.log(info.file, info.fileList);
|
|
|
- }
|
|
|
if (status === 'done') {
|
|
|
message.success(`${info.file.name} 文件上传成功.`);
|
|
|
const id = 'title-' + new Date().getTime();
|
|
|
+ const url = 'https://ai.zrzyt.zj.gov.cn/aisKnowledge' + info.file.response.data;
|
|
|
var item = {
|
|
|
id: id,
|
|
|
f_title: name,
|
|
|
f_type: 'temp',
|
|
|
+ size: info.file.size,
|
|
|
+ fileName: fileName,
|
|
|
url: url
|
|
|
};
|
|
|
if (type === 1) {
|
|
@@ -157,17 +146,43 @@ const handleChange = (info, type) => {
|
|
|
if (type === 2) {
|
|
|
fileList2.value = [item]
|
|
|
}
|
|
|
+ fileList.value.push(item)
|
|
|
+ if (fileList.value.length > 1) {
|
|
|
+ current.value = fileList.value[0];
|
|
|
+ queryFilesName();
|
|
|
+ }
|
|
|
} else if (status === 'error') {
|
|
|
message.error(`${info.file.name} file upload failed.`);
|
|
|
}
|
|
|
};
|
|
|
+const switchPdfSource = (type) => {
|
|
|
+ if (type === 1) {
|
|
|
+ current.value = fileList1.value[0];
|
|
|
+ }else if (type === 2) {
|
|
|
+ current.value = fileList2.value[0];
|
|
|
+ }
|
|
|
+}
|
|
|
const deleteFileHandle = (type) => {
|
|
|
- if (type === 1) {
|
|
|
- fileList1.value = []
|
|
|
- }
|
|
|
- if (type === 2) {
|
|
|
- fileList2.value = []
|
|
|
+ let file = null;
|
|
|
+ if (type === 1) {
|
|
|
+ file = fileList1.value[0]
|
|
|
+ fileList1.value = []
|
|
|
+ }
|
|
|
+ if (type === 2) {
|
|
|
+ file = fileList2.value[0]
|
|
|
+ fileList2.value = []
|
|
|
+ }
|
|
|
+ for (let i = 0; i < fileList.value.length; i++){
|
|
|
+ if(fileList.value[i]['id'] === file['id']) {
|
|
|
+ fileList.value.splice(i, 1);
|
|
|
+ break;
|
|
|
}
|
|
|
+ }
|
|
|
+ if (fileList.value.length > 0) {
|
|
|
+ current.value = fileList.value[0]
|
|
|
+ } else if (fileList.value.length === 0) {
|
|
|
+ current.value = {}
|
|
|
+ }
|
|
|
}
|
|
|
const queryFilesName = () => {
|
|
|
if (index.value < fileList.value.length) {
|
|
@@ -177,23 +192,8 @@ const queryFilesName = () => {
|
|
|
};
|
|
|
const getFileName = () => {
|
|
|
var item = fileList.value[index.value];
|
|
|
- var url = '/knowledge/file/name';
|
|
|
- var p = { id: item.pid };
|
|
|
- api.get(url, p, this, false).then(async (res) => {
|
|
|
- var citem = res.data.data;
|
|
|
- item.fileName = citem.fileName.indexOf('pdf') == -1 ? citem.fileName + '.pdf' : citem.fileName;
|
|
|
- var url = '/knowledge/file/' + item.fileName;
|
|
|
- if(citem.filePath&&citem.filePath.startsWith('http')){
|
|
|
- url =citem.filePath;
|
|
|
- url = url.replaceAll(window.AppGlobalConfig.fileServer,window.AppGlobalConfig.onlineFileServer);
|
|
|
- }
|
|
|
- item.url = url;
|
|
|
- if (index.value == 0) {
|
|
|
- current.value.url = url;
|
|
|
- }
|
|
|
- initFileByUrl(item);
|
|
|
- queryFilesName();
|
|
|
- });
|
|
|
+ initFileByUrl(item);
|
|
|
+ queryFilesName();
|
|
|
};
|
|
|
const initFileByUrl = async (item) => {
|
|
|
var fileName = item.fileName;
|
|
@@ -257,14 +257,6 @@ const fetchPdfFileStream = (pdfUrl, name) => {
|
|
|
const handleMouseLeave = () => {
|
|
|
hoveredIndex.value = null;
|
|
|
};
|
|
|
-
|
|
|
-// 返回全部政策页面
|
|
|
-const returnHome = () => {
|
|
|
- window.open(`/#/final/compare`, '_blank');
|
|
|
-};
|
|
|
-const toggleFile = (item) => {
|
|
|
- current.value = item;
|
|
|
-};
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.smart-comparison {
|
|
@@ -328,6 +320,7 @@ const toggleFile = (item) => {
|
|
|
width: 1280px;
|
|
|
height: auto;
|
|
|
display: flex;
|
|
|
+ margin-top: 20px;
|
|
|
margin-bottom: 20px;
|
|
|
.left {
|
|
|
flex: 1;
|
|
@@ -335,6 +328,7 @@ const toggleFile = (item) => {
|
|
|
background: #ffffff;
|
|
|
box-shadow: 0px 1px 8px 0px #e4e4e4;
|
|
|
border-radius: 10px;
|
|
|
+ max-width: 940px;
|
|
|
>.upload-box {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
@@ -358,6 +352,7 @@ const toggleFile = (item) => {
|
|
|
flex: 1;
|
|
|
text-align: center;
|
|
|
height: 82px;
|
|
|
+ width: calc(50% - 50px);
|
|
|
>.upload {
|
|
|
cursor: pointer;
|
|
|
}
|
|
@@ -365,6 +360,7 @@ const toggleFile = (item) => {
|
|
|
text-align: left;
|
|
|
padding: 15px;
|
|
|
position: relative;
|
|
|
+ cursor: pointer;
|
|
|
>.icon {
|
|
|
width: 50px;
|
|
|
height: 50px;
|