[add] 首页

This commit is contained in:
lideqin
2023-11-23 09:36:12 +08:00
parent 95f94b071e
commit 1abf8ffda4
6 changed files with 521 additions and 29 deletions
+80 -29
View File
@@ -1,46 +1,97 @@
<template>
<!--<div>敬请期待</div>-->
<div class="analysis-box">
<img class="analysis-empty-img" alt="" src="../../assets/image/stayTuned.png" />
<div class="analysis-empty-title">敬请期待</div>
<!--<a-button @click="toSearchWindow">跳转一般检索</a-button>-->
<div class="all-wrapper">
<!-- 检索和预警 -->
<search-and-warning-card class="flex-item search-warning-wrapper"></search-and-warning-card>
<!-- 友情链接 -->
<friend-link-card class="flex-item friend-link-wrapper"></friend-link-card>
<!-- 快捷入口 -->
<quick-enter-card class="flex-item quick-enter-wrapper"></quick-enter-card>
<!-- 待办任务 -->
<to-do-task-card class="flex-item to-do-task-wrapper"></to-do-task-card>
</div>
</template>
<script>
import SearchAndWarningCard from './modules/SearchAndWarningCard'
import QuickEnterCard from './modules/QuickEnterCard'
import FriendLinkCard from './modules/FriendLinkCard'
import ToDoTaskCard from './modules/ToDoTaskCard'
export default {
name: 'Analysis',
methods: {
// 点击跳转到检索页
toSearchWindow () {
const { href } = this.$router.resolve({
path: '/generalSearch'
})
window.open(href, '_blank')
components: { ToDoTaskCard, FriendLinkCard, QuickEnterCard, SearchAndWarningCard },
data () {
return {
}
},
created () {
},
methods: {
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.analysis-box {
height: @page-content-h;
background-color: #FFFFFF;
.all-wrapper {
display: flex;
flex-direction: column;
height: calc(100vh - 116px);
flex-wrap: wrap;
}
.flex-item {
margin: 10px;
}
// 检索和预警
.search-warning-wrapper {
width: calc(70% - 20px);
height: calc(80% - 20px);
}
// 快捷入口
.quick-enter-wrapper {
width: calc(30% - 20px);
height: 306px;
}
// 友情链接
.friend-link-wrapper {
width: calc(70% - 20px);
height: calc(20% - 20px);
}
// 待办任务
.to-do-task-wrapper {
//grid-area: ToDoTask;
width: calc(30% - 20px);
height: calc(100% - 346px);
}
/deep/ .top-wrapper {
display: flex;
align-items: center;
justify-content: center;
.left-p {
margin-bottom: 0;
font-size: 20px;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #1D2129;
//line-height: 28px;
.left-icon {
margin-right: 5px;
color: @primary-color;
font-size: 20px;
}
}
.right-p {
margin-bottom: 0;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #86909C;
line-height: 19px;
display: inline-block;
margin-left: auto;
cursor: pointer;
}
}
.analysis-empty-img {
width: 200px;
}
.analysis-empty-title {
font-size: 20px;
font-weight: 600;
color: #1D2129;
}
</style>
</style>
@@ -0,0 +1,79 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<div class="top-wrapper">
<span class="left-p"><i class="iconfont icon-link left-icon"></i>友情链接</span>
<span class="right-p" @click="moreLink">更多链接<i class="iconfont icon-right"></i></span>
</div>
<div class="content-wrapper">
<div class="content-div" v-for="item in dataSource" :key="item.id">
{{ item.name }}
</div>
</div>
</a-spin>
</a-card>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
name: 'FriendLinkCard',
data () {
return {
loading: true,
dataSource: [],
url: {
list: '/sys/lawsFriendlyLinks/list'
}
}
},
mounted () {
this.loadData()
},
methods: {
loadData () {
this.loading = true
getAction(this.url.list, {}).then((res) => {
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 点击更多链接
moreLink () {
this.$router.push({
path: '/isystem/friendshipLink'
})
}
}
}
</script>
<style scoped lang="less">
.content-wrapper {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
grid-gap: 20px;
margin-top: 12px;
}
.content-div {
height: 62px;
line-height: 62px;
box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: @primary-color;
text-align: center;
background-image: url('../../../assets/image/dashboardLinkBack.png');
}
</style>
@@ -0,0 +1,84 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<div class="top-wrapper">
<p class="left-p"><i class="iconfont icon-rukou left-icon"></i>快捷入口</p>
<p class="right-p" @click="menuManage"><i class="iconfont icon-settings"></i>菜单管理</p>
</div>
<div class="content-wrapper">
<div class="content-div" v-for="item in dataSource" :key="item.id">
<i class="iconfont" :class="'icon-' + item.iconName"></i>
<p>{{ item.name }}</p>
</div>
<div class="plus-div">
<a-icon type="plus" />
</div>
</div>
</a-spin>
</a-card>
</template>
<script>
export default {
name: 'QuickEnterCard',
data () {
return {
loading: false,
dataSource: [
{ iconName: 'shengchanliuchengguanli', name: '新建流程' },
{ iconName: 'a-moxingkuaisuchaifen1', name: '标准拆分' },
{ iconName: 'shoucang', name: '我的收藏' },
{ iconName: 'a-fagui1', name: '国内法规' },
{ iconName: 'a-moxingkuaisuchaifen1', name: '征求意见' },
{ iconName: 'jiaoseguanli', name: '角色管理' },
{ iconName: 'wenda1', name: '我的问答' }
]
}
}
}
</script>
<style scoped lang="less">
.content-wrapper {
//display: flex;
//flex-direction: row;
//flex-wrap: wrap;
//justify-content: space-between;
display: grid;
grid-template-columns: repeat(auto-fill, 100px);
grid-gap: 10px;
grid-auto-flow: row;
margin-top: 10px;
& > div {
width: 100px;
height: 100px;
border-radius: 8px 8px 8px 8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.content-div {
background: rgba(213,44,38,0.08);
.iconfont {
font-size: 27px;
color: @primary-color;
}
p {
margin-bottom: 0;
font-size: 16px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 28px;
}
}
.plus-div {
border: 1px dashed @primary-color;
box-sizing: border-box;
.anticon {
font-size: 28px;
}
}
}
</style>
@@ -0,0 +1,237 @@
<template>
<a-card :bordered="false">
<!-- 搜索区域 -->
<div class="search-wrapper">
<a-select class="resource-type-select" v-model="resourceType">
<a-select-option value="all">{{ $t('dashboard.generalSearch.all')}}</a-select-option>
<a-select-option v-for="item in resourceTypeOptions" :key="item.value" :value="item.value">
{{ item.title }}
</a-select-option>
</a-select>
<a-input v-model="searchValue" :placeholder="$t('pleaseEnter')"></a-input>
<a-button type="primary" @click="toSearchWindow('title')">一般检索标题</a-button>
<a-button type="primary" @click="toSearchWindow('fullText')">一般检索全文</a-button>
<a-button type="primary" ghost @click="toAdvancedSearch">高级检索</a-button>
</div>
<!-- 预警区域 -->
<div class="warning-wrapper">
<!-- tab切换 -->
<div class="tab-wrapper">
<div class="tab-div" :class="warningTab === 'newCarType' ? 'curr-tab' : ''" @click="warningTabChange('newCarType')">新车型实施预警</div>
<div class="tab-div" :class="warningTab === 'carInProduction' ? 'curr-tab' : ''" @click="warningTabChange('carInProduction')">在产车实施预警</div>
</div>
<a-table
ref="table"
size="middle"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading">
<template slot="text" slot-scope="text">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
</a-table>
</div>
</a-card>
</template>
<script>
import { ajaxGetDictItems } from '@/api/api'
import { getAction } from '../../../api/manage'
export default {
name: 'SearchAndWarningCard',
data () {
return {
resourceTypeOptions: [], // 资源类型下拉框数据
resourceType: 'all', // 资源类型
searchValue: '', // 检索内容
warningTab: 'newCarType', // 预警当前tab
loading: false,
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
width: 80,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '来源',
align: 'left',
dataIndex: 'source_dictText',
width: 100,
scopedSlots: { customRender: 'text' }
},
{
title: '标准号',
align: 'left',
dataIndex: 'standardNumber',
width: 180,
scopedSlots: { customRender: 'text' }
},
{
title: '标准名称',
align: 'left',
dataIndex: 'standardName',
scopedSlots: { customRender: 'text' }
},
{
title: '新车型实施日期',
align: 'left',
dataIndex: 'newModelImplementationDate',
width: 160,
scopedSlots: { customRender: 'text' }
}
],
dataSource: [],
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
url: {
newModelWarningList: '/laws/localTool/standardEarlyWarning/newModelImplementation',
inProductionWarningList: '/laws/localTool/standardEarlyWarning/onTheProduction'
}
}
},
mounted () {
this.initResourceTypeOptions()
this.loadData(1)
},
methods: {
// 获取资源类型下拉框数据
initResourceTypeOptions () {
ajaxGetDictItems('resource_type').then(res => {
if (res.success) {
this.resourceTypeOptions = res.result
}
})
},
// 点击跳转到一般检索页
toSearchWindow (type) {
const { href } = this.$router.resolve({
path: '/generalSearch',
query: {
type: type,
resourceType: this.resourceType,
searchValue: this.searchValue
}
})
window.open(href, '_blank')
},
// 点击跳转到高级检索页
toAdvancedSearch () {
const { href } = this.$router.resolve({
path: '/advancedSearch'
})
window.open(href, '_blank')
},
// 预警tab切换
warningTabChange (value) {
this.warningTab = value
if (value === 'newCarType') {
this.columns[4].title = '新车型实施日期'
this.columns[4].dataIndex = 'newModelImplementationDate'
} else {
this.columns[4].title = '在产车实施日期'
this.columns[4].dataIndex = 'onTheProductionDate'
}
this.loadData(1)
},
loadData (arg) {
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = {}// 查询条件
params.pageNo = this.ipagination.current
params.pageSize = this.ipagination.pageSize
params.columns = 'createTime'
params.order = 'desc'
this.loading = true
let url = ''
if (this.warningTab === 'newCarType') {
url = this.url.newModelWarningList
} else {
url = this.url.inProductionWarningList
}
getAction(url, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records || res.result
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
}
}
</script>
<style scoped lang="less">
.search-wrapper {
display: grid;
grid-gap: 10px;
grid-template-columns: 96px 200px 135px 135px 88px;
}
.resource-type-select {
width: 96px;
}
// 预警容器
.warning-wrapper {
padding: 24px 0;
}
// 预警tab切换
.tab-wrapper {
width: 360px;
display: flex;
justify-content: space-between;
align-items: center;
}
.tab-div {
width: 176px;
height: 32px;
background: rgba(245, 245, 245, 0.60);
color: #4E5969;
text-align: center;
line-height: 32px;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
}
.curr-tab {
width: 176px;
height: 44px;
line-height: 42px;
border-top: 2px solid @primary-color;
color: @primary-color;
box-sizing: border-box;
font-weight: 500;
//transition-property: width,height,border-top;
//transition-duration: 0.1s;
//transition-timing-function: ease-in;
}
</style>
@@ -0,0 +1,15 @@
<template>
<a-card :bordered="false">
待办任务
</a-card>
</template>
<script>
export default {
name: 'ToDoTaskCard'
}
</script>
<style scoped>
</style>
@@ -164,6 +164,32 @@ export default {
}
}
},
mounted () {
// 初始化检索方式
if (this.$route.query.type === 'title') {
// 标题检索
this.retrievalModeCurrent = '2'
} else if (this.$route.query.type === 'fullText') {
// 全文检索
this.retrievalModeCurrent = '1'
}
// 初始化资源类型
if (this.$route.query.resourceType) {
this.resourceTypeCurrent = this.$route.query.resourceType
}
// 初始化搜索内容
if (this.$route.query.searchValue) {
this.searchValue = this.$route.query.searchValue
}
// 资源类型不是全部,并且有搜索内容时获取筛选条件
if (this.resourceTypeCurrent !== 'all' && this.searchValue) {
this.initFilterData()
}
// 有搜索内容时,调用查询方法
if (this.searchValue) {
this.onSearch(1)
}
},
methods: {
// 获取要显示数量的筛选条件的数据
initFilterData () {