Commit b0dfe3cc by liudx

联调导出接口

parent a776e5f0
No preview for this file type
......@@ -6,7 +6,7 @@ export const patentselect = p => post('/api/patent/patents',p);
//专利详情页面
export const patentDetail = p => get('/api/patent/patentDetail/'+p.id);
//导出word给后端传递base64
export const exportword = p => post('/api/patent/patentDetail/125',p);
export const exportword = p => post('/api/users/enterprisePatentExport',p);
//专利智能推荐
export const Recommend = p => post('/api/patent/intelligentRecommendation/'+p.id,p);
// 企业搜索接口
......
......@@ -74,12 +74,13 @@
@onCancel="closeModal"
>
<p>报告格式&nbsp;&nbsp;&nbsp;<span class="PDF">PDF</span></p>
<a-form :model="formState">
<a-form :model="formState" ref="form">
<a-form-item
:name="'email'"
label="发送给"
:rules="[
{ type: 'email', required: true, message: '请输入正确的邮箱' },
{ required: true, message: '请输入邮箱' },
{ type: 'email', message: '邮箱不合法' },
]"
>
<a-input
......@@ -112,6 +113,8 @@
></EchartsCloud>
<EchartsCon :option="option7" :id="'apply'"></EchartsCon>
<EchartsCon :option="option8" :id="'purchase'"></EchartsCon>
<EchartsCon :option="option9" :id="'radar'"></EchartsCon>
<EchartsCon :option="option10" :id="'yibiao'"></EchartsCon>
</div>
</div>
</template>
......@@ -131,7 +134,7 @@ import {
} from "../../utils/indexApi.js";
import overview from "./overview.vue";
import { message } from "ant-design-vue";
import { userFollow,cancelFollow } from "../../utils/userAPI";
import { userFollow, cancelFollow } from "../../utils/userAPI";
import cooperation from "./cooperation.vue";
import technology from "./technology.vue";
import docxtemplater from "docxtemplater";
......@@ -847,9 +850,141 @@ export default {
},
],
};
this.option9 = {
tooltip: {
trigger: "item",
// formatter: function (params) {
// console.log(params);
// },
},
radar: [
{
indicator: [
{ name: "公司竞争力", max: 30 },
{ name: "技术质量", max: 30 },
{ name: "技术体量", max: 40 },
],
center: ["50%", "50%"],
radius: 120,
triggerEvent: true,
},
{
indicator: [
{ name: "公司竞争力", max: 30 },
{ name: "技术质量", max: 30 },
{ name: "技术体量", max: 40 },
],
center: ["50%", "50%"],
radius: 120,
},
],
series: [
{
type: "radar",
radarIndex: 0,
symbol: "none",
data: [
{
value: [20, 10, 25],
name: "均值",
areaStyle: {
color: "#F7B46A",
},
lineStyle: {
color: "#F7B46A",
},
itemStyle: {
color: "#F7B46A",
},
},
],
},
{
type: "radar",
radarIndex: 0,
symbol: "none",
data: [
{
value: [10, 20, 10],
name: "科创能力分值",
areaStyle: {
color: "#5A95F7",
},
lineStyle: {
color: "#5A95F7",
},
itemStyle: {
color: "#5A95F7",
},
},
],
},
],
};
var data = [
{
name: "技术体量",
value: 30,
},
{
name: "技术质量",
value: 30,
},
{
name: "公司竞争力",
value: 30,
},
]; //已排序好的数组
var ydata = [];
for (var i = 0; i < data.length; i++) {
ydata.push(data[i].name);
}
var datalength = [];
for (var i = 0; i < data.length; i++) {
datalength.push(0);
}
this.option10 = {
tooltip: {
formatter: "{a} <br/>{b} : {c}",
},
series: [
{
name: "总分",
startAngle: 180,
endAngle: 0,
min: 0,
max: 100,
radius: "160",
center: ["50%", "60%"],
type: "gauge",
progress: {
show: true,
},
detail: {
valueAnimation: true,
formatter: "{value}",
},
data: [
{
value: 50,
name: "科创能力总分值",
},
],
},
],
};
},
//导出.overview
daochu() {
this.$refs.form
.validate("email")
.then(() => {
this.visible = false;
var that = this;
let share_holders = that.baseinfo.share_holders;
......@@ -880,6 +1015,8 @@ export default {
var chartDom6 = document.getElementById("TechnicalField1");
var chartDom7 = document.getElementById("apply");
var chartDom8 = document.getElementById("purchase");
var chartDom9 = document.getElementById("radar");
var chartDom10 = document.getElementById("yibiao");
let myChart1 = null;
let myChart2 = null;
let myChart3 = null;
......@@ -888,6 +1025,8 @@ export default {
let myChart6 = null;
let myChart7 = null;
let myChart8 = null;
let myChart9 = null;
let myChart10 = null;
myChart1 = echarts.init(chartDom1);
myChart2 = echarts.init(chartDom2);
myChart3 = echarts.init(chartDom3);
......@@ -896,6 +1035,8 @@ export default {
myChart6 = echarts.init(chartDom6);
myChart7 = echarts.init(chartDom7);
myChart8 = echarts.init(chartDom8);
myChart9 = echarts.init(chartDom9);
myChart10 = echarts.init(chartDom10);
// myChart2 = echarts.init(chartDom2);
// // 第一个echrts
......@@ -906,6 +1047,8 @@ export default {
myChart5.setOption(this.option5);
myChart7.setOption(this.option7);
myChart8.setOption(this.option8);
myChart9.setOption(this.option9);
myChart10.setOption(this.option10);
//技术领域云图
myChart6.setOption({
......@@ -944,7 +1087,9 @@ export default {
setTimeout(() => {
// 加setTimeout是为了让echarts渲染完成后生成图片
JSZipUtils.getBinaryContent("company.docx", function (error, content) {
JSZipUtils.getBinaryContent(
"company.docx",
function (error, content) {
// 抛出异常
if (error) {
throw error;
......@@ -1040,6 +1185,18 @@ export default {
excludeComponents: ["toolbox"], //忽略组件的列表
type: "png", //图片类型支持png和jpeg
}),
image9: myChart9.getDataURL({
pixelRatio: 5, //导出的图片分辨率比率,默认是1
backgroundColor: "#fff", //图表背景色
excludeComponents: ["toolbox"], //忽略组件的列表
type: "png", //图片类型支持png和jpeg
}),
image10: myChart10.getDataURL({
pixelRatio: 5, //导出的图片分辨率比率,默认是1
backgroundColor: "#fff", //图表背景色
excludeComponents: ["toolbox"], //忽略组件的列表
type: "png", //图片类型支持png和jpeg
}),
});
try {
// 用模板变量的值替换所有模板变量
......@@ -1055,18 +1212,34 @@ export default {
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
//formData文件流
// that.blobToBase64(out);
that.blobToBase64(out,that.formState.email);
// 将目标文件对象保存为目标类型的文件,并命名
saveAs(out, `企业科创能力报告.docx`);
});
// saveAs(out, `企业科创能力报告.docx`);
}
);
}, 1000);
})
.catch((err) => {
console.log(err);
// return false;
// 处理验证失败的情况
});
},
blobToBase64(blob) {
blobToBase64(blob,email) {
return new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = (e) => {
setTimeout(function () {
exportword({ file: e.target.result }).then((res) => {});
exportword({
report_data: e.target.result,
email: email,
}).then((res) => {
if (res.code == 0) {
message.success(res.msg);
} else {
message.error(res.msg);
}
});
}, 300);
};
// readAsDataURL
......
......@@ -119,6 +119,7 @@ export default {
{
type: "radar",
radarIndex: 0,
symbol: 'none',
data: [
{
value: [20, 10, 25],
......@@ -139,6 +140,7 @@ export default {
{
type: "radar",
radarIndex: 0,
symbol: 'none',
data: [
{
value: [10, 20, 10],
......@@ -159,37 +161,6 @@ export default {
],
};
chart.setOption(option1);
//在name上移动
// let that = this;
// chart.on("mousemove", function (params) {
// that.hover = true;
// if (params.name == "技术质量") {
// that.$nextTick(() => {
// that.$refs.hover.style.left = params.event.offsetX + "px";
// that.$refs.hover.style.top = params.event.offsetY + "px";
// });
// that.con =
// "从有效专利占专利申请总量比例、有效发明专利占有效专利比例和风险专利占全部申请专利的比例分析";
// } else if (params.name == "公司竞争力") {
// that.$nextTick(() => {
// that.$refs.hover.style.left = params.event.offsetX + "px";
// that.$refs.hover.style.top = params.event.offsetY + "px";
// });
// that.con = "从公司资质类别、公司规模、对外投资和公司融资分析";
// } else if (params.name == "技术体量") {
// that.$nextTick(() => {
// that.$refs.hover.style.left = params.event.offsetX + "px";
// that.$refs.hover.style.top = params.event.offsetY + "px";
// });
// that.con = "从专利申请总量、有效专利总量和近3年专利申请增速分析";
// } else {
// that.hover = false;
// }
// });
// chart.on("mouseout", function (params) {
// that.hover = false;
// });
},
getOption2() {
var data = [
......@@ -218,11 +189,11 @@ export default {
this.option2 = {
tooltip: {
formatter: "{a} <br/>{b} : {c}%",
formatter: "{a} <br/>{b} : {c}",
},
series: [
{
name: "Pressure",
name: "总分",
startAngle: 180,
endAngle: 0,
min: 0,
......@@ -240,7 +211,7 @@ export default {
data: [
{
value: 50,
name: "总分",
name: "科创能力总分值",
},
],
},
......@@ -254,6 +225,7 @@ export default {
<style lang="less" scoped>
.company_con {
clear: both;
// min-height: 900px;
position: relative;
display: flex;
justify-content: flex-start;
......
......@@ -35,15 +35,6 @@
:rules="formRules"
>
<a-form-item name="phone">
<!-- :rules="[
{ required: true, message: '请输入手机号!' },
{
pattern:
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
message: '手机号格式不正确!',
validateTrigger: 'onBlur',
},
]" -->
<a-input v-model:value="formState.phone" placeholder="请输入手机号">
<template #prefix>
<img src="../../static/login/icon-user.png" alt="" />
......
......@@ -11,8 +11,8 @@
</a-breadcrumb>
<div class="back_btn" @click="backbtn">返回</div>
<div class="details_title">
<div class="patent_num">{{ zlcode?zlcode:details.gkh }}</div>
<div class="patent_title">{{ title?title:details.title }}</div>
<div class="patent_num">{{ zlcode ? zlcode : details.gkh }}</div>
<div class="patent_title">{{ title ? title : details.title }}</div>
</div>
<div class="btn_group">
<span style="cursor: pointer" @click="openModal"
......@@ -227,7 +227,6 @@
回到顶部
</div>
</a-back-top>
</div>
</div>
<div class="patent_con_right">
......@@ -336,12 +335,13 @@
@onCancel="closeModal"
>
<p>报告格式&nbsp;&nbsp;&nbsp;PDF</p>
<a-form :model="formState">
<a-form :model="formState" ref="form">
<a-form-item
:name="'email'"
label="发送给"
:rules="[
{ type: 'email', required: true, message: '请输入正确的邮箱' },
{ required: true, message: '请输入邮箱' },
{ type: 'email', message: '邮箱不合法' },
]"
>
<a-input v-model:value="formState.email" />
......@@ -355,7 +355,7 @@ import * as echarts from "echarts";
import "echarts-wordcloud";
import { DownOutlined } from "@ant-design/icons-vue";
import { patentDetail, exportword, Recommend } from "../../utils/indexApi";
import { userFollow,cancelFollow } from "../../utils/userAPI";
import { userFollow, cancelFollow } from "../../utils/userAPI";
import EchartsCloud from "../../components/EchartsCloud.vue";
import docxtemplater from "docxtemplater";
import PizZip from "pizzip";
......@@ -418,16 +418,16 @@ export default {
},
methods: {
//取消关注
async cancelFun(){
async cancelFun() {
let cancelRes = await cancelFollow({
f_type:"patent",
ent_or_pat_id:this.id
})
if(cancelRes.code == 0){
this.$router.go(0)
message.success(cancelRes.msg)
}else{
message.error(cancelRes.msg)
f_type: "patent",
ent_or_pat_id: this.id,
});
if (cancelRes.code == 0) {
this.$router.go(0);
message.success(cancelRes.msg);
} else {
message.error(cancelRes.msg);
}
},
//关注接口
......@@ -437,11 +437,11 @@ export default {
ent_or_pat_id: this.id,
name: this.details.gkh,
});
if(Follow.code == 0){
this.$router.go(0)
message.success(Follow.msg)
}else{
message.error(Follow.msg)
if (Follow.code == 0) {
this.$router.go(0);
message.success(Follow.msg);
} else {
message.error(Follow.msg);
}
},
......@@ -513,6 +513,10 @@ export default {
},
//导出word
daochu(details) {
this.$refs.form
.validate("email")
.then(() => {
// 邮箱号码格式正确,可以发送
var that = this;
let date = new Date();
var year = date.getFullYear();
......@@ -563,7 +567,9 @@ export default {
setTimeout(() => {
// 加setTimeout是为了让echarts渲染完成后生成图片
JSZipUtils.getBinaryContent("patent.docx", function (error, content) {
JSZipUtils.getBinaryContent(
"patent.docx",
function (error, content) {
// 抛出异常
if (error) {
throw error;
......@@ -642,21 +648,35 @@ export default {
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
//formData文件流
// that.blobToBase64(out);
that.blobToBase64(out,that.formState.email);
// 将目标文件对象保存为目标类型的文件,并命名
saveAs(out, `专利成果转移转化智能推荐报告.docx`);
// saveAs(out, `专利成果转移转化智能推荐报告.docx`);
that.visible = false;
});
}
);
}, 1000);
})
.catch((err) => {
console.log(err);
// return false;
// 处理验证失败的情况
});
},
blobToBase64(blob) {
blobToBase64(blob,email) {
return new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = (e) => {
console.log(e.target.result);
// resolve(e.target.result);
setTimeout(function () {
exportword({ file: e.target.result }).then((res) => {});
exportword({
report_data: e.target.result,
email: email,
}).then((res) => {
if (res.code == 0) {
message.success(res.msg);
} else {
message.error(res.msg);
}
});
}, 300);
};
// readAsDataURL
......@@ -828,7 +848,6 @@ export default {
line-height: 60px;
border-radius: 8px;
}
}
.patent_con_right {
......
......@@ -195,18 +195,16 @@ export default {
file.type === "image/gif" ||
file.type === "image/jpg";
if (!isJpgOrPng) {
return this.$message.error("请上传正确的图片格式!");
return message.error("请上传正确的图片格式!");
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
return this.$message.error("图片大小必须小于2MB!");
return message.error("图片大小必须小于2MB!");
}
},
imageUpload(file) {
console.log(file);
let data = new FormData();
data.append("head_img", file.file);
console.log(data);
uploadFile(data).then((res) => {
if (res.code == 0) {
message.success(res.msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment