Commit b54a9ba0 by liudx

word向后端提交

parent 558a919c
......@@ -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 patentselect = p => post('/api/patent/patents',p);
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';
import store from '../store/index'
// 环境的切换
axios.defaults.baseURL = 'http://39.100.39.50:5089';
axios.defaults.baseURL = '/api';
// 请求超时时间
axios.defaults.timeout = 50000;
// post请求头
......
......@@ -6,11 +6,12 @@
<a-breadcrumb-item>个人信息</a-breadcrumb-item>
</a-breadcrumb>
<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>
<br /><br />
<a-table
<!-- <a-table
:row-selection="{ onChange: onSelectChange }"
:columns="columns"
:data-source="data"
......@@ -21,9 +22,34 @@
<a v-else>使用</a>
</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>
</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>
<script>
// import { AES_Encrypt, AES_Decrypt } from "@/utils/aes_util.js";
......@@ -33,6 +59,7 @@ export default {
name: "userInfo",
data() {
return {
visible: false,
columns: [
{
title: "序号",
......@@ -59,14 +86,39 @@ export default {
dataIndex: "status",
},
],
data:[]
selectedRowKeys: [],
data: [],
};
},
created() {
this.init();
},
computed: {
rowSelection() {
return {
selectedRowKeys: this.selectedRowKeys, // 一定要加上这一行代码,清除才会有作用
// 这里不能加括号
onChange: this.selectedTableRows,
// 内置的禁止选中
getCheckboxProps: (record) => ({
props: {
disabled: record.isInner,
},
}),
};
},
},
mounted() {},
methods: {
openModal() {
this.visible = true;
},
closeModal() {
this.visible = false;
},
add() {},
//用户列表初始化
init() {
users({
page: 1,
......@@ -80,13 +132,13 @@ export default {
}
});
},
onSelectChange: (selectedRowKeys, selectedRows) => {
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
"selectedRows: ",
selectedRows
);
// 勾选表格复选框
selectedTableRows(selectedRowKeys, selectedRows) {
// 批量选中的key
this.selectedRowKeys = selectedRowKeys;
},
//修改用户状态
change(record) {
console.log(record);
changeStatus({ id: record.id, status: record.status }).then((res) => {
......
......@@ -20,7 +20,7 @@
</div>
</div>
<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"
><img src="@/static/patent/icon-gz.png" alt="" />关注</span
>
......@@ -42,6 +42,28 @@
<technology></technology>
</a-tab-pane>
</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>
</template>
<script>
......@@ -55,6 +77,11 @@ export default {
name: "companyDetails",
data() {
return {
formState:{
email:''
},
visible: false,
email: "",
value: undefined,
activeKey: "企业概况",
count: 161,
......@@ -115,8 +142,11 @@ export default {
technology
},
methods: {
getCurrentAnchor() {
return "#technicalSummary";
openModal() {
this.visible = true;
},
closeModal() {
this.visible = false;
},
//返回上一页
backbtn(){
......
<template>
<div class="hsitory">
<div class="history">
<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>
<!-- 主体 -->
<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>
</template>
<script>
export default {
name: "history",
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: {},
methods: {},
methods: {
//发送到邮箱
sendMail() {
this.visible = false;
},
//打开弹窗
openModal() {
this.visible = true;
},
//关闭弹窗
closeModal() {
this.visible = false;
},
},
created() {},
};
</script>
<style lang="less" scoped>
.history{
.history {
padding: 0 30px;
width: calc(100%);
background-color: #ebebeb;
position: relative;
}
.nav_bread {
.nav_bread {
height: 50px;
padding: 20px 3px;
background-color: #ebebeb;
}
.history_con {
background-color: #fff;
padding: 20px;
text-align: center;
}
}
</style>
......@@ -151,6 +151,7 @@ export default {
message.success("登录成功");
// this.$store.commit("setTOKEN", res.data.token);
this.$store.commit("setname", this.formState.username);
this.$store.commit("setcurrent", '首页');
localStorage.setItem("token", res.data.token);
//记住密码功能
......
......@@ -112,6 +112,8 @@
<br />
</div>
</div>
</div>
<router-view></router-view>
......
......@@ -11,13 +11,10 @@
<div class="patent_title">{{ title }}</div>
</div>
<div class="btn_group">
<span @click="daochu(details)"
><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"
><img src="@/static/patent/icon-gz.png" alt="" />关注</span
>
......@@ -273,13 +270,36 @@
</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>
</template>
<script>
import * as echarts from "echarts";
import "echarts-wordcloud";
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 docxtemplater from "docxtemplater";
import PizZip from "pizzip";
......@@ -310,6 +330,11 @@ export default {
name: "patentDetails",
data() {
return {
formState: {
email: "",
},
visible: false,
email: "",
value: undefined,
count: 161,
zlcode: "",
......@@ -376,8 +401,11 @@ export default {
DownOutlined,
},
methods: {
getCurrentAnchor() {
return "#technicalSummary";
openModal() {
this.visible = true;
},
closeModal() {
this.visible = false;
},
init(id) {
patentDetail({ id: id }).then((res) => {
......@@ -497,16 +525,35 @@ export default {
throw error;
}
// 生成一个代表docxtemplater对象的zip文件(不是一个真实的文件,而是在内存中的表示)
const out = doc.getZip().generate({
let out = doc.getZip().generate({
type: "blob",
mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
//formData文件流
that.blobToBase64(out);
// 将目标文件对象保存为目标类型的文件,并命名
saveAs(out, `专利详情报告.docx`);
// saveAs(out, `专利详情报告.word`);
});
}, 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() {
this.$store.commit("setcurrent", "专利");
......@@ -520,6 +567,14 @@ export default {
};
</script>
<style lang="less" scoped>
.PDF {
display: inline-block;
width: 60px;
text-align: center;
line-height: 30px;
height: 30px;
border: 1px solid #ccc;
}
.details {
padding: 0 30px;
width: calc(100%);
......
......@@ -18,11 +18,11 @@ module.exports = {
// 配置不同的后台API地址
proxy: {
'/api': {
target: 'http://39.100.39.50:5089',
target: 'http://39.100.39.50:5089/',
ws: false,
changeOrigin: true,
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