Files
jiace-web/src/views/portrait.vue

278 lines
7.4 KiB
Vue
Raw Normal View History

<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>
<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
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
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="screen_l_b" v-for="item in portraitData" :key="item.id">
<div class="title text_hidden_one pointer">
<router-link
target="_blank"
:to="{
path: '/result',
query: { key: type, id: item.id }
}"
>
{{ item.title }}
</router-link>
</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 { 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: 10
},
total: 0,
portraitList: [], // 企业画像
// 归口选项
attributeOptions: [
{
value: 'KJJ',
label: '科技'
},
{
value: 'JXJ',
label: '经信'
},
{
value: 'FGW',
label: '发改'
},
{
value: 'OTHER',
label: '其他'
}
],
portraitData: [], // 企业画像绑定的政策列表
portraitTotal: 0
};
},
computed: {
...mapGetters(['token'])
},
methods: {
// 获取企业画像数据列表
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;
});
}
},
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 {
this.msgError('非法进入');
}
// } else {
// this.msgError('请先登录');
// }
}
};
</script>
<style lang="scss" scoped>
.portrait_page {
.padding-top {
padding-top: 70px;
.search {
text-align: center;
margin-bottom: 26px;
.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: 90px;
padding: 30px;
background-color: #f5f5f5;
.el-tabs {
margin-left: 20px;
/deep/.el-tabs__nav-wrap::after {
height: 0;
}
}
/deep/.el-radio__input {
display: none;
}
}
.screen_l_b {
padding: 0 20px;
height: 110px;
display: flex;
flex-direction: column;
justify-content: center;
border-bottom: 1px solid #e3e3e3;
.title {
font-size: 18px;
color: #333;
margin-bottom: 16px;
text-align: left;
}
.info {
font-size: 16px;
color: #999;
display: flex;
justify-content: space-between;
}
}
}
}
</style>