瀏覽代碼

修改

master
风继续吹 1 年之前
父節點
當前提交
8a9530d813
共有 3 個文件被更改,包括 62 次插入27 次删除
  1. +1
    -2
      src/views/Statistics/Insightintothedetails.vue
  2. +12
    -7
      src/views/Statistics/ai/createReport.vue
  3. +49
    -18
      src/views/Statistics/ai/reportDetail.vue

+ 1
- 2
src/views/Statistics/Insightintothedetails.vue 查看文件

@@ -167,8 +167,7 @@ export default {
let minTime = this.pickerMinDate - day1;
return (
time.getTime() >= maxTime ||
time.getTime() <= minTime ||
time.getTime() >= Date.now() - 1 * 24 * 3600 * 1000
time.getTime() <= minTime
);
} else {
return time.getTime() > Date.now() - 1 * 24 * 3600 * 1000;


+ 12
- 7
src/views/Statistics/ai/createReport.vue 查看文件

@@ -46,7 +46,7 @@
"
:on-remove="
(file, fileList) => {
handleChange(file, fileList, 'system');
handleChanges(file, fileList, 'system');
}
"
:file-list="system"
@@ -75,7 +75,7 @@
"
:on-remove="
(file, fileList) => {
handleChange(file, fileList, 'user');
handleChanges(file, fileList, 'user');
}
"
:accept="acceptList"
@@ -104,7 +104,7 @@
"
:on-remove="
(file, fileList) => {
handleChange(file, fileList, 'assistant');
handleChanges(file, fileList, 'assistant');
}
"
:accept="acceptList"
@@ -590,6 +590,11 @@ export default {
},

methods: {
// 文件上传成功
handleChanges(file, filelist, name) {
console.log(file, filelist, name);
this[name] = filelist;
},
// 文件上传成功
handleChange(file, filelist, name) {
console.log(file, filelist, name);
@@ -749,10 +754,10 @@ export default {

// 生成报告规则
creatMonthRule() {
if (this.assistant.length == 0) {
this.$message.error("请上传期望的回应");
return;
}
// if (this.assistant.length == 0) {
// this.$message.error("请上传期望的回应");
// return;
// }
let obj = {
system: this.system,
user: this.user,


+ 49
- 18
src/views/Statistics/ai/reportDetail.vue 查看文件

@@ -11,6 +11,12 @@
<span class="left-label"> 生成时间: </span>
<span>{{ objPagesData.createTime }}</span>
</div>

<div style="display: flex; justify-content: flex-end">
<el-button type="primary" style="width: 300px" @click="exportData"
>导出</el-button
>
</div>
</div>

<div class="boxs">
@@ -25,6 +31,7 @@
import html2canvas from "html2canvas";
import jsPDF from "jspdf";
import * as echarts from "echarts";

export default {
data() {
return {
@@ -162,26 +169,50 @@ export default {
methods: {
// 导出
exportData() {
html2canvas(document.getElementById("pdfHtml"), {
allowTaint: true,
scale: 1,
dpi: 300,
//加上白色背景
backgroundColor: "#FFF",
}).then((canvas) => {
let contentWidth = canvas.width;
let contentHeight = canvas.height;
let pdfX = ((contentWidth + 10) / 1) * 0.75;
let pdfY = ((contentHeight + 300) / 1) * 0.75; // 500为底部留白
let imgWidth = pdfX;
let imgHeight = (contentHeight / 1) * 0.75;
let pageData = canvas.toDataURL("image/jpeg", 1.0);
let PDF = new jsPDF("", "pt", [pdfX, pdfY]);
PDF.addImage(pageData, "JPEG", 0, 0, imgWidth, imgHeight);

PDF.save(this.objPagesData.name + ".pdf");
this.exportMethodPost("autoSR/openApiData/wordText", "AI报告详情", {
id: this.id,
});
},

// 导出.Excel公用方法
exportMethodPost(url, name, data = {}) {
axios({
method: "get",
url: url,
params: data,
responseType: "blob",
})
.then((res) => {
if (!res) {
this.$message.error("获取数据失败,请稍候再试");
return;
}
let blob = new Blob([res], { type: "application/vnd.ms-excel" });
let date = new Date();
let time = date.toLocaleDateString();
// console.log(time, "时间");
if ("download" in document.createElement("a")) {
const link = document.createElement("a");
link.style.display = "none";
link.href = URL.createObjectURL(blob);
// link.download = res.headers['content-disposition'] //下载后文件名
link.download = (name || "导出文件") + time + ".docx"; //下载的文件名
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
// console.log("--------------------jingla")
let fileName = (name || "导出文件") + time + ".docx"; //下载的文件名
navigator.msSaveBlob(blob, fileName);
}
})
.catch((error) => {
// Message.error({
// message: '网络连接错误'
// })
console.log(error);
});
},
// 获取该公司下的项目
getProjectList() {
this.$api.http


Loading…
取消
儲存