Files
jiace-web/src/views/portrait.vue
2022-04-11 21:20:23 +08:00

349 lines
9.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="portrait_page">
<headerPage />
<div class="padding-top content min_h_241">
<div class="search">
<div class="search_input" style="display:flex">
<span v-if="type == 'policy'">企业画像检索</span>
<span v-if="type == 'policyRead'">政策解读检索</span>
<span v-if="type == 'information'">资讯快报检索</span>
<span v-if="type == 'policyNotice'">公示公告检索</span>
<el-input
v-model="queryParams.title"
placeholder="请输入搜索关键字"
@keyup.enter.native="getPortraitList"
clearable
@clear="getPortraitList"
></el-input>
<el-button type="warning" @click="getPortraitList">搜索</el-button>
</div>
</div>
<div class="header" v-if="type == 'policy'">
<span class="span">{{ val }}</span>
<el-radio
size="small"
v-model="queryParams.labelId"
v-for="item in portraitList"
:key="item.id"
:label="item.id"
border
@change="handleClick"
>{{ item.name }}</el-radio>
</div>
<div class="header" v-else-if="type == 'policyRead'">
<span class="span">{{ val }}</span>
<el-radio
size="small"
v-model="queryParams.attribute"
v-for="item in attributeOptions"
:key="item.value"
:label="item.value"
border
@change="handleClick"
>{{ item.label }}</el-radio>
</div>
<div class="header" v-else-if="type == 'policyNotice'">
<span class="span">{{ val }}</span>
<el-radio
size="small"
v-model="queryParams.labelId"
v-for="item in policyNoticeOptions"
:key="item.value"
:label="item.value"
border
@change="handleClick"
>{{ item.label }}</el-radio>
</div>
<div class="screen_l_b" v-for="item in portraitData" :key="item.id">
<div class="title pointer">
<div class="con">
<router-link
class="text_hidden_one"
target="_blank"
:to="{
path: '/result',
query: {
key: type == 'policyNotice' ? 'policy' : type,
id: item.id
}
}"
>{{ removeBr(item.title) }}</router-link>
<span class="info">
<span v-if="type != 'information'">{{ item.listDate }}</span>
<span v-else>{{ item.createTime }}</span>
</span>
</div>
</div>
<!-- <div class="info" v-if="type != 'information'">
<span>来源{{ item.source }}</span>
<span>发布{{ item.listDate }}</span>
</div>
<div class="info" style="justify-content: flex-end;" v-else>
<span>发布{{ item.createTime }}</span>
</div>-->
</div>
<div style="text-align: center;margin:30px 0" v-show="!total">
<div style="height:210px;display: inline-block;color:#999">
<img style="width:100%;height:100%;" src="@/assets/image/empty.png" alt />
暂无数据
</div>
</div>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getPortraitList"
/>
</div>
<footerPage />
</div>
</template>
<script>
import { getPolicyMatch } from '@/api/home/notice';
import { mapGetters } from 'vuex';
import { userInfo, getLabelSetting } from '@/api/home/info';
import { getPolicy, getPolicyRead2, getInformation2 } from '@/api/home/home';
import footerPage from './components/footer';
import headerPage from './components/header';
export default {
components: {
footerPage,
headerPage
},
data() {
return {
type: '',
val: '',
queryParams: {
pageNum: 1,
pageSize: 15
},
total: 0,
portraitList: [], // 企业画像
policyNoticeOptions: [
{
value: '1415156808053559296',
label: '政策法规'
},
{
value: '1415156963146338304',
label: '申报通知'
},
{
value: '1415157002090450944',
label: '政府公示'
},
{
value: '1415157026115424256',
label: '公告'
}
// {
// value: '1415157049267982336',
// label: '其他'
// }
],
// 归口选项
attributeOptions: [
{
value: '',
label: '不限'
},
{
value: 'KJJ',
label: '科技'
},
{
value: 'JXJ',
label: '经信'
},
{
value: 'FGW',
label: '发改'
},
{
value: 'OTHER',
label: '其他'
}
],
portraitData: [], // 企业画像绑定的政策列表
portraitTotal: 0
};
},
computed: {
...mapGetters(['token'])
},
methods: {
removeBr(str) {
return str && str.replaceAll('<br>', '')
},
// 获取企业画像数据列表
getPortraitList() {
if (this.type == 'policy') {
getPolicyMatch(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
} else if (this.type == 'policyRead') {
getPolicyRead2(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
} else if (this.type == 'information') {
getInformation2(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
} else if (this.type == 'policyNotice') {
getPolicy(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
}
},
handleClick() {
this.getPortraitList();
}
},
created() {
// if (this.token) {
const { key, val } = this.$route.query;
this.type = key;
this.val = val;
if (key == 'policy') {
userInfo().then(({ data }) => {
if (data.companyId) {
getLabelSetting({ companyId: data.companyId }).then(({ data }) => {
if (data.length) {
console.log(data);
// this.portraitList = data.map(item =>
// item.labelList
// ? item.labelList.filter(v => v.isHas)[0]
// ? item.labelList.filter(v => v.isHas)[0]
// : ''
// : undefined
// );
const arrs = data.map(item =>
item.labelList ? item.labelList.filter(v => v.isHas) : undefined
);
arrs.map(item => {
this.portraitList = [...this.portraitList, ...item];
});
this.queryParams.labelId = this.portraitList[0].id;
this.getPortraitList();
}
});
}
});
} else if (key == 'policyRead') {
this.queryParams.attribute = this.attributeOptions[0].value;
this.getPortraitList();
} else if (key == 'information') {
this.getPortraitList();
} else if (key == 'policyNotice') {
if (this.$route.query.labelId) {
this.queryParams.labelId = this.$route.query.labelId
} else {
this.queryParams.labelId = this.policyNoticeOptions[0].value;
}
this.getPortraitList();
} else {
this.msgError('非法进入');
}
// } else {
// this.msgError('请先登录');
// }
}
};
</script>
<style lang="scss" scoped>
.portrait_page {
.padding-top {
padding-top: 25px;
.search {
text-align: center;
margin-bottom: 25px;
.search_input {
display: flex;
justify-content: center;
align-items: center;
/deep/.el-input--medium .el-input__inner {
height: 40px;
line-height: 40px;
border-radius: 6px 0 0 6px;
border: 1px solid #ffa32c;
border-right: 0;
}
span:nth-child(1) {
color: #333;
font-size: 24px;
margin-right: 21px;
}
.el-input {
width: 304px;
}
.el-button {
border-radius: 0 6px 6px 0;
background-color: #ffa32c;
font-size: 18px;
}
}
}
.header {
display: flex;
align-items: center;
height: 50px;
padding: 0 30px;
background-color: #f5f5f5;
.el-tabs {
margin-left: 20px;
/deep/.el-tabs__nav-wrap::after {
height: 0;
}
}
/deep/.el-radio__input {
display: none;
}
/deep/.el-radio {
margin-right: 10px;
}
}
.screen_l_b {
padding: 0 20px;
height: 44px;
line-height: 44px;
// display: flex;
flex-direction: column;
justify-content: center;
border-bottom: 1px solid #e3e3e3;
.title {
height: 100%;
font-size: 18px;
color: #333;
// margin-bottom: 16px;
text-align: left;
.con {
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.info {
float: right;
flex: 0 0 150px;
font-size: 16px;
color: #999;
display: flex;
justify-content: space-between;
}
}
}
}
</style>