Commit b54a9ba0 by liudx

word向后端提交

parent 558a919c
...@@ -2,4 +2,6 @@ import { get, post,put } from './request' ...@@ -2,4 +2,6 @@ import { get, post,put } from './request'
export const patents = p => get('/api/patent/patents?keyword='+p.keyword+'&page='+p.page+'&size='+p.size); export const patents = p => get('/api/patent/patents?keyword='+p.keyword+'&page='+p.page+'&size='+p.size);
export const patentselect = p => post('/api/patent/patents',p); export const patentselect = p => post('/api/patent/patents',p);
export const patentDetail = p => get('/api/patent/patentDetail/'+p.id); export const patentDetail = p => get('/api/patent/patentDetail/'+p.id);
export const exportword = p => post('/api/patent/patentDetail/125',p);
...@@ -2,7 +2,7 @@ import axios from 'axios'; ...@@ -2,7 +2,7 @@ import axios from 'axios';
import store from '../store/index' import store from '../store/index'
// 环境的切换 // 环境的切换
axios.defaults.baseURL = 'http://39.100.39.50:5089'; axios.defaults.baseURL = '/api';
// 请求超时时间 // 请求超时时间
axios.defaults.timeout = 50000; axios.defaults.timeout = 50000;
// post请求头 // post请求头
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
<a-breadcrumb-item>个人信息</a-breadcrumb-item> <a-breadcrumb-item>个人信息</a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<div class="table"> <div class="table">
<a-button type="primary" size="large">新增</a-button>&nbsp; <a-button type="primary" size="large" @click="openModal">新增</a-button
>&nbsp;
<a-button type="primary" size="large">删除</a-button> <a-button type="primary" size="large">删除</a-button>
<br /><br /> <br /><br />
<a-table <!-- <a-table
:row-selection="{ onChange: onSelectChange }" :row-selection="{ onChange: onSelectChange }"
:columns="columns" :columns="columns"
:data-source="data" :data-source="data"
...@@ -21,9 +22,34 @@ ...@@ -21,9 +22,34 @@
<a v-else>使用</a> <a v-else>使用</a>
</template> </template>
</template> </template>
</a-table> -->
<a-table
:row-selection="rowSelection"
:columns="columns"
:data-source="data"
:rowKey="row=>{return row.id}"
>
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'status'">
<a @click="change(record)" danger v-if="text">禁用</a>
<a v-else>使用</a>
<!-- <a-switch>禁用</a-switch> -->
</template>
</template>
</a-table> </a-table>
</div> </div>
</div> </div>
<a-modal
v-model:visible="visible"
title="新增账号"
@ok="add"
cancelText="取消"
okText="确定"
@onCancel="closeModal"
>
<label for="username">账号名:</label>
<a-input style="width: 60%" id="username" v-model:value="username" />
</a-modal>
</template> </template>
<script> <script>
// import { AES_Encrypt, AES_Decrypt } from "@/utils/aes_util.js"; // import { AES_Encrypt, AES_Decrypt } from "@/utils/aes_util.js";
...@@ -33,6 +59,7 @@ export default { ...@@ -33,6 +59,7 @@ export default {
name: "userInfo", name: "userInfo",
data() { data() {
return { return {
visible: false,
columns: [ columns: [
{ {
title: "序号", title: "序号",
...@@ -59,14 +86,39 @@ export default { ...@@ -59,14 +86,39 @@ export default {
dataIndex: "status", dataIndex: "status",
}, },
], ],
data:[] selectedRowKeys: [],
data: [],
}; };
}, },
created() { created() {
this.init(); this.init();
}, },
computed: {
rowSelection() {
return {
selectedRowKeys: this.selectedRowKeys, // 一定要加上这一行代码,清除才会有作用
// 这里不能加括号
onChange: this.selectedTableRows,
// 内置的禁止选中
getCheckboxProps: (record) => ({
props: {
disabled: record.isInner,
},
}),
};
},
},
mounted() {}, mounted() {},
methods: { methods: {
openModal() {
this.visible = true;
},
closeModal() {
this.visible = false;
},
add() {},
//用户列表初始化
init() { init() {
users({ users({
page: 1, page: 1,
...@@ -80,13 +132,13 @@ export default { ...@@ -80,13 +132,13 @@ export default {
} }
}); });
}, },
onSelectChange: (selectedRowKeys, selectedRows) => { // 勾选表格复选框
console.log( selectedTableRows(selectedRowKeys, selectedRows) {
`selectedRowKeys: ${selectedRowKeys}`, // 批量选中的key
"selectedRows: ", this.selectedRowKeys = selectedRowKeys;
selectedRows
);
}, },
//修改用户状态
change(record) { change(record) {
console.log(record); console.log(record);
changeStatus({ id: record.id, status: record.status }).then((res) => { changeStatus({ id: record.id, status: record.status }).then((res) => {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<div class="btn_group"> <div class="btn_group">
<span @click="daochu()"><img src="@/static/patent/icon-dc.png" alt="" />导出</span> <span @click="openModal"><img src="@/static/patent/icon-dc.png" alt="" />导出</span>
<span v-if="follow" <span v-if="follow"
><img src="@/static/patent/icon-gz.png" alt="" />关注</span ><img src="@/static/patent/icon-gz.png" alt="" />关注</span
> >
...@@ -42,6 +42,28 @@ ...@@ -42,6 +42,28 @@
<technology></technology> <technology></technology>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<a-modal
v-model:visible="visible"
title="导出"
@ok="daochu(details)"
cancelText="取消"
okText="确定"
@onCancel="closeModal"
>
<p>请选择报告格式,请稍后在历史记录里查看</p>
<p>报告格式&nbsp;&nbsp;&nbsp;<span class="PDF">PDF</span></p>
<a-form
:model="formState"
>
<a-form-item
:name="'email'"
label="发送给"
:rules="[{ type: 'email',required: true, message: '请输入正确的邮箱' }]"
>
<a-input v-model:value="formState.email" />
</a-form-item>
</a-form>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -55,6 +77,11 @@ export default { ...@@ -55,6 +77,11 @@ export default {
name: "companyDetails", name: "companyDetails",
data() { data() {
return { return {
formState:{
email:''
},
visible: false,
email: "",
value: undefined, value: undefined,
activeKey: "企业概况", activeKey: "企业概况",
count: 161, count: 161,
...@@ -115,8 +142,11 @@ export default { ...@@ -115,8 +142,11 @@ export default {
technology technology
}, },
methods: { methods: {
getCurrentAnchor() { openModal() {
return "#technicalSummary"; this.visible = true;
},
closeModal() {
this.visible = false;
}, },
//返回上一页 //返回上一页
backbtn(){ backbtn(){
......
<template> <template>
<div class="hsitory"> <div class="history">
<a-breadcrumb class="nav_bread"> <a-breadcrumb class="nav_bread">
<a-breadcrumb-item>首页</a-breadcrumb-item> <a-breadcrumb-item>首页</a-breadcrumb-item>
<a-breadcrumb-item>历史记录</a-breadcrumb-item>
<a-breadcrumb-item>浏览记录</a-breadcrumb-item> <a-breadcrumb-item>浏览记录</a-breadcrumb-item>
<a-breadcrumb-item>公司详情</a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<!-- 主体 -->
<div class="history_con">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="浏览记录">
<p style="text-align: left">系统会为您保留 30 天的浏览记录</p>
<a-table
:columns="columnshistory"
:data-source="dataHistory"
:pagination="false"
>
</a-table>
<a-pagination
@change="onChange"
:total="total"
:showSizeChanger="false"
/>
</a-tab-pane>
<a-tab-pane key="2" tab="导出记录">
<p style="text-align: left">系统会为您保留 30 天的导出记录</p>
<a-table
:columns="columnshistory"
:data-source="dataHistory"
:pagination="false"
>
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex == 'action'">
<a-button
style="
background-color: #fa7f03;
color: #fff;
margin-right: 10%;
"
>导出</a-button
>
<a-button type="primary" @click="openModal"
>发送到邮箱</a-button
>
</template>
</template>
</a-table>
<a-pagination
@change="onChange"
:total="total"
:showSizeChanger="false"
/>
</a-tab-pane>
</a-tabs>
</div>
<a-modal
v-model:visible="visible"
title="发送邮箱"
@ok="sendMail"
cancelText="取消"
okText="确定"
@onCancel="closeModal"
>
<a-form :model="formState" :validate-messages="validateMessages">
<a-form-item :name="'email'" label="发送给" :rules="[{ type: 'email' }]">
<a-input v-model:value="formState.email" />
</a-form-item>
</a-form>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "history", name: "history",
data() { data() {
return {}; return {
visible: false,
validateMessages: {
required: "请输入邮箱",
types: {
email: "请输入正确的邮箱地址",
},
},
formState: {
email: "",
},
activeKey: "1",
columnshistory: [
{
title: "序号",
dataIndex: "name",
key: "name",
},
{
title: "名称",
dataIndex: "age",
key: "age",
},
{
title: "类型",
dataIndex: "address",
key: "address 1",
},
{
title: "接受邮箱",
dataIndex: "address",
key: "address 2",
},
{
title: "时间",
dataIndex: "address",
key: "address 3",
},
{
title: "操作",
dataIndex: "action",
key: "action",
},
],
dataHistory: [
{
key: "1",
name: "John Brown",
age: 32,
address: "New York No. 1 Lake Park, New York No. 1 Lake Park",
action: 1,
},
],
};
}, },
components: {}, components: {},
methods: {}, methods: {
//发送到邮箱
sendMail() {
this.visible = false;
},
//打开弹窗
openModal() {
this.visible = true;
},
//关闭弹窗
closeModal() {
this.visible = false;
},
},
created() {}, created() {},
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.history{ .history {
padding: 0 30px; padding: 0 30px;
width: calc(100%); width: calc(100%);
background-color: #ebebeb; background-color: #ebebeb;
position: relative; position: relative;
} .nav_bread {
.nav_bread {
height: 50px; height: 50px;
padding: 20px 3px; padding: 20px 3px;
background-color: #ebebeb; background-color: #ebebeb;
} }
.history_con {
background-color: #fff;
padding: 20px;
text-align: center;
}
}
</style> </style>
...@@ -151,6 +151,7 @@ export default { ...@@ -151,6 +151,7 @@ export default {
message.success("登录成功"); message.success("登录成功");
// this.$store.commit("setTOKEN", res.data.token); // this.$store.commit("setTOKEN", res.data.token);
this.$store.commit("setname", this.formState.username); this.$store.commit("setname", this.formState.username);
this.$store.commit("setcurrent", '首页');
localStorage.setItem("token", res.data.token); localStorage.setItem("token", res.data.token);
//记住密码功能 //记住密码功能
......
...@@ -112,6 +112,8 @@ ...@@ -112,6 +112,8 @@
<br /> <br />
</div> </div>
</div> </div>
</div> </div>
<router-view></router-view> <router-view></router-view>
......
...@@ -11,13 +11,10 @@ ...@@ -11,13 +11,10 @@
<div class="patent_title">{{ title }}</div> <div class="patent_title">{{ title }}</div>
</div> </div>
<div class="btn_group"> <div class="btn_group">
<span @click="daochu(details)" <span @click="openModal"
><img ><img src="@/static/patent/icon-dc.png" alt="" />导出</span
src="@/static/patent/icon-dc.png"
alt=""
/>导出</span
> >
<span v-if="follow" <span v-if="follow"
><img src="@/static/patent/icon-gz.png" alt="" />关注</span ><img src="@/static/patent/icon-gz.png" alt="" />关注</span
> >
...@@ -273,13 +270,36 @@ ...@@ -273,13 +270,36 @@
</div> </div>
</div> </div>
</div> </div>
<a-modal
v-model:visible="visible"
title="导出"
@ok="daochu(details)"
cancelText="取消"
okText="确定"
@onCancel="closeModal"
>
<p>请选择报告格式,请稍后在历史记录里查看</p>
<p>报告格式&nbsp;&nbsp;&nbsp;<span class="PDF">PDF</span></p>
<a-form :model="formState">
<a-form-item
:name="'email'"
label="发送给"
:rules="[
{ type: 'email', required: true, message: '请输入正确的邮箱' },
]"
>
<a-input v-model:value="formState.email" />
</a-form-item>
</a-form>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from "echarts"; import * as echarts from "echarts";
import "echarts-wordcloud"; import "echarts-wordcloud";
import { DownOutlined } from "@ant-design/icons-vue"; import { DownOutlined } from "@ant-design/icons-vue";
import { patentDetail } from "../../utils/indexApi"; import { patentDetail, exportword } from "../../utils/indexApi";
import EchartsCloud from "../../components/EchartsCloud.vue"; import EchartsCloud from "../../components/EchartsCloud.vue";
import docxtemplater from "docxtemplater"; import docxtemplater from "docxtemplater";
import PizZip from "pizzip"; import PizZip from "pizzip";
...@@ -310,6 +330,11 @@ export default { ...@@ -310,6 +330,11 @@ export default {
name: "patentDetails", name: "patentDetails",
data() { data() {
return { return {
formState: {
email: "",
},
visible: false,
email: "",
value: undefined, value: undefined,
count: 161, count: 161,
zlcode: "", zlcode: "",
...@@ -376,8 +401,11 @@ export default { ...@@ -376,8 +401,11 @@ export default {
DownOutlined, DownOutlined,
}, },
methods: { methods: {
getCurrentAnchor() { openModal() {
return "#technicalSummary"; this.visible = true;
},
closeModal() {
this.visible = false;
}, },
init(id) { init(id) {
patentDetail({ id: id }).then((res) => { patentDetail({ id: id }).then((res) => {
...@@ -497,16 +525,35 @@ export default { ...@@ -497,16 +525,35 @@ export default {
throw error; throw error;
} }
// 生成一个代表docxtemplater对象的zip文件(不是一个真实的文件,而是在内存中的表示) // 生成一个代表docxtemplater对象的zip文件(不是一个真实的文件,而是在内存中的表示)
const out = doc.getZip().generate({ let out = doc.getZip().generate({
type: "blob", type: "blob",
mimeType: mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
}); });
//formData文件流
that.blobToBase64(out);
// 将目标文件对象保存为目标类型的文件,并命名 // 将目标文件对象保存为目标类型的文件,并命名
saveAs(out, `专利详情报告.docx`); // saveAs(out, `专利详情报告.word`);
}); });
}, 1000); }, 1000);
}, },
blobToBase64(blob) {
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) => {});
},300);
};
// readAsDataURL
fileReader.readAsDataURL(blob);
fileReader.onerror = () => {
reject(new Error("文件流异常"));
};
});
},
}, },
created() { created() {
this.$store.commit("setcurrent", "专利"); this.$store.commit("setcurrent", "专利");
...@@ -520,6 +567,14 @@ export default { ...@@ -520,6 +567,14 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.PDF {
display: inline-block;
width: 60px;
text-align: center;
line-height: 30px;
height: 30px;
border: 1px solid #ccc;
}
.details { .details {
padding: 0 30px; padding: 0 30px;
width: calc(100%); width: calc(100%);
......
...@@ -18,11 +18,11 @@ module.exports = { ...@@ -18,11 +18,11 @@ module.exports = {
// 配置不同的后台API地址 // 配置不同的后台API地址
proxy: { proxy: {
'/api': { '/api': {
target: 'http://39.100.39.50:5089', target: 'http://39.100.39.50:5089/',
ws: false, ws: false,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '/' '^/api': ''
} }
} }
} }
......
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