413 lines
12 KiB
Java
413 lines
12 KiB
Java
<template>
|
|
<a-card :bordered="false">
|
|
<div class="table-page-search-wrapper">
|
|
<search ref="searchRef"
|
|
:searchQueryList="searchQueryList"
|
|
:flag="'1'"
|
|
:isDefault="true"
|
|
:url="url"/>
|
|
</div>
|
|
<div class="table-operator">
|
|
<div @click="handleCompare" v-has="'regulatoryEarlyWarning:push'"
|
|
class="operator-text">
|
|
<a-icon type="rocket" :rotate="45"/>
|
|
{{$t('Push')}}
|
|
</div>
|
|
<div @click="handleExport"
|
|
v-has="'regulatoryEarlyWarning:export'"
|
|
class="operator-text">
|
|
<a-icon type="export" :rotate="-90"/>
|
|
{{$t('export')}}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<a-tabs :model="activeTab" @change="callback">
|
|
<a-tab-pane :key="$t('ImplementationDate')" :tab="$t('ImplementationDate')">
|
|
</a-tab-pane>
|
|
<a-tab-pane :key="$t('vehicleInProductionDate')" :tab="$t('vehicleInProductionDate')">
|
|
</a-tab-pane>
|
|
</a-tabs>
|
|
<a-table
|
|
ref="table"
|
|
size="middle"
|
|
:loading="loading"
|
|
:pagination="false"
|
|
:scroll="{x: '100%',y:'calc(100vh - 180px)'}"
|
|
rowKey="id"
|
|
:data-source="dataSource"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:columns="columns"
|
|
>
|
|
<span slot="serial_number" slot-scope="text,result">
|
|
<a @click="standClick(result)" :title="text">{{text}}</a>
|
|
</span>
|
|
<span slot="vehicleInProductionDate" slot-scope="text,result">
|
|
<span v-if="result.xin1_che1_xing2_shi2_shi1_ri4_qi1 == 'yellow'">
|
|
{{text}}
|
|
</span>
|
|
<span v-else-if="result.xin1_che1_xing2_shi2_shi1_ri4_qi1 == 'red'">
|
|
{{text}}
|
|
</span>
|
|
<span v-else>
|
|
{{text}}
|
|
</span>
|
|
</span>
|
|
<span slot="ImplementationDate" slot-scope="text,result">
|
|
<span v-if="result.new_colour == 'yellow'" style="color: #fdd835">
|
|
{{text}}
|
|
</span>
|
|
<span v-else-if="result.new_colour == 'red'" style="color: red">
|
|
{{text}}
|
|
</span>
|
|
<span v-else>
|
|
{{text}}
|
|
</span>
|
|
</span>
|
|
<span slot="vehicleInProductionDate" slot-scope="text,result">
|
|
<span v-if="result.implement_colour == 'yellow'" style="color: #fdd835">
|
|
{{text}}
|
|
</span>
|
|
<span v-else-if="result.implement_colour == 'red'" style="color: red">
|
|
{{text}}
|
|
</span>
|
|
<span v-else>
|
|
{{text}}
|
|
</span>
|
|
</span>
|
|
</a-table>
|
|
<div class="page" v-if="dataSource && dataSource.length > 0">
|
|
<a-pagination
|
|
:show-total="total => $t('total')+` ${total} `+$t('strip')"
|
|
show-quick-jumper
|
|
show-size-changer
|
|
:page-size.sync="pageSize"
|
|
:total="total"
|
|
:current="pageNo"
|
|
@change="pageOnChange"
|
|
@showSizeChange="SizeChange"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<libraryPush
|
|
:url="url"
|
|
ref="libraryPushRef"
|
|
@clearSelected="clearSelected"
|
|
/>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import search from '@/components/search/index'
|
|
import libraryPush from '@/components/libraryPush/index'
|
|
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
|
import moment from 'moment'
|
|
import eventBUs from '../../common/event'
|
|
|
|
export default {
|
|
name: 'index',
|
|
components: {
|
|
search,
|
|
libraryPush
|
|
},
|
|
data() {
|
|
return {
|
|
//url传参严格按照当前命名
|
|
url: {
|
|
seachList: 'document/bussDocumentLibraryEO/queryCondition', //搜索字段
|
|
list: '/LawsWarn/queryPageInfo',
|
|
exportData: 'LawsWarn/exportExcel',
|
|
pullMessage: '/LawsWarn/warnPullMessage'
|
|
},
|
|
activeTab: this.$t('ImplementationDate'),
|
|
loading: false,
|
|
dataSource: [],
|
|
selectedRowKeys: [],
|
|
total: 0,
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
searchParmes: {},
|
|
searchQueryList: [
|
|
{
|
|
field_show_type: 12,
|
|
db_field_txt: this.$t('warningTime'),
|
|
db_field_name: 'WarnTimeText',
|
|
option: [
|
|
{
|
|
value: '1',
|
|
name:this.$t('inRecentMonths3')
|
|
},
|
|
{
|
|
value: '2',
|
|
name: this.$t('inRecentMonths6')
|
|
},
|
|
{
|
|
value: '3',
|
|
name: this.$t('inRecentYear1')
|
|
},
|
|
{
|
|
value: '4',
|
|
name: this.$t('inRecentYear2')
|
|
}
|
|
]
|
|
}
|
|
],
|
|
|
|
columnsAll: [
|
|
{
|
|
title: this.$t('standard'),
|
|
align: 'center',
|
|
dataIndex: 'serial_number',
|
|
ellipsis: true,
|
|
width: 170,
|
|
scopedSlots: { customRender: 'serial_number' }
|
|
},
|
|
{
|
|
title: this.$t('title'),
|
|
align: 'center',
|
|
dataIndex: 'title',
|
|
ellipsis: true,
|
|
width: 170,
|
|
scopedSlots: { customRender: 'serial_number' }
|
|
},
|
|
{
|
|
title: this.$t('status'),
|
|
align: 'center',
|
|
width: 140,
|
|
ellipsis: true,
|
|
dataIndex: 'state'
|
|
},
|
|
{
|
|
title: this.$t('zoneOfApplication'),
|
|
align: 'center',
|
|
width: 170,
|
|
ellipsis: true,
|
|
dataIndex: 'region'
|
|
},
|
|
{
|
|
title: this.$t('technicalField'),
|
|
align: 'center',
|
|
ellipsis: true,
|
|
width: 170,
|
|
dataIndex: 'technology_territory'
|
|
},
|
|
{
|
|
title: this.$t('vehicleInProductionDate'),
|
|
align: 'center',
|
|
ellipsis: true,
|
|
width: 210,
|
|
dataIndex: 'implement_time',
|
|
scopedSlots: { customRender: 'vehicleInProductionDate' }
|
|
},
|
|
{
|
|
title: this.$t('ImplementationDate'),
|
|
align: 'center',
|
|
ellipsis: true,
|
|
width: 210,
|
|
dataIndex: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
|
|
scopedSlots: { customRender: 'ImplementationDate' }
|
|
}
|
|
]
|
|
}
|
|
},
|
|
computed: {
|
|
columns() {
|
|
let columnsAll = JSON.parse(JSON.stringify(this.columnsAll))
|
|
if (this.activeTab == this.$t('ImplementationDate')) {
|
|
for (let i = 0; i < columnsAll.length; i++) {
|
|
if (columnsAll[i].dataIndex == 'implement_time') {
|
|
columnsAll.splice(i, 1)
|
|
i--
|
|
}
|
|
}
|
|
} else if (this.activeTab == this.$t('vehicleInProductionDate')) {
|
|
for (let i = 0; i < columnsAll.length; i++) {
|
|
if (columnsAll[i].dataIndex == 'xin1_che1_xing2_shi2_shi1_ri4_qi1') {
|
|
columnsAll.splice(i, 1)
|
|
i--
|
|
}
|
|
}
|
|
}
|
|
return columnsAll
|
|
}
|
|
},
|
|
mounted() {
|
|
// this.getList()
|
|
eventBUs.$on('searchQuery', search => {
|
|
Object.keys(search).forEach(res => {
|
|
if (search[res] instanceof Array) {
|
|
search[res] = search[res].join(',')
|
|
}
|
|
})
|
|
this.pageNo = 1
|
|
this.searchParmes = search
|
|
this.getList()
|
|
})
|
|
},
|
|
beforeDestroy() {
|
|
eventBUs.$off('searchQuery')
|
|
},
|
|
methods: {
|
|
standClick(val){
|
|
let newUrl = this.$router.resolve({
|
|
path: '/docManage/library/detail',
|
|
query: {
|
|
id: val.id
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
callback(tab) {
|
|
this.selectedRowKeys = []
|
|
this.activeTab = tab
|
|
this.getList()
|
|
},
|
|
onSelectChange(value) {
|
|
this.selectedRowKeys = value
|
|
},
|
|
handleCompare() {
|
|
if (this.selectedRowKeys.length > 0) {
|
|
this.$nextTick(() => {
|
|
let flag = ''
|
|
if (this.activeTab == this.$t('ImplementationDate')) {
|
|
flag = 1
|
|
} else {
|
|
flag = 2
|
|
}
|
|
this.$refs.libraryPushRef.getPush(JSON.parse(JSON.stringify(this.selectedRowKeys)), flag)
|
|
})
|
|
} else {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
}
|
|
},
|
|
handleExport() {
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
|
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
|
|
let text = ''
|
|
let flag
|
|
if (this.activeTab == this.$t('ImplementationDate')) {
|
|
flag = 0
|
|
text = this.$t('ImplementationDate')
|
|
} else {
|
|
text = this.$t('vehicleInProductionDate')
|
|
flag = 1
|
|
}
|
|
let query = {
|
|
id: selectedRowKeys.join(','),
|
|
...this.searchParmes,
|
|
flag: flag
|
|
}
|
|
downloadFile(this.url.exportData, text + '.xls', query, this.Deselect)
|
|
} else {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
}
|
|
},
|
|
Deselect() {
|
|
this.selectedRowKeys = []
|
|
},
|
|
clearSelected() {
|
|
if (!this.searchParmes['WarnTimeText']) {
|
|
this.searchParmes['WarnTimeText'] = '2'
|
|
}
|
|
let startTime = moment(new Date()).format('YYYY-MM-DD')
|
|
let endTime = this.getNowdate()
|
|
this.searchParmes['WarnTime'] = [startTime, endTime]
|
|
this.searchParmes = { ...this.searchParmes }
|
|
this.pageNo = 1
|
|
this.getList()
|
|
},
|
|
getNowdate() {
|
|
let monthData
|
|
let yearData
|
|
if (this.searchParmes['WarnTimeText'] == '1') {
|
|
monthData = 4
|
|
yearData = 1
|
|
} else if (this.searchParmes['WarnTimeText'] == '2') {
|
|
monthData = 7
|
|
yearData = 1
|
|
} else if (this.searchParmes['WarnTimeText'] == '3') {
|
|
monthData = 13
|
|
yearData = 1
|
|
} else if (this.searchParmes['WarnTimeText'] == '4') {
|
|
monthData = 25
|
|
yearData = 2
|
|
}
|
|
var date_now = new Date()//获取当前时间
|
|
var year = date_now.getFullYear()//获取当前时间的年份
|
|
var month = date_now.getMonth()//获取当前时间的月份
|
|
var day = date_now.getDate()//获取当前时间的日
|
|
var days = new Date(year, month, 0)//将获取到的年月赋值给days
|
|
days = days.getDate()//获取当前年月的日
|
|
var year2 = year
|
|
var month2 = parseInt(month + monthData)//获取当前月份的1一个月以后的月份
|
|
if (month2 > 12) {
|
|
year2 = parseInt(year2) + yearData
|
|
month2 = parseInt(month2) % 12
|
|
}//考虑到12月要是获取一个月以后,就是一月,年份需要加一 ,一年没有13月,所以%12,取得来年1月
|
|
var day2 = day
|
|
var days2 = new Date(year2, month2, 0)
|
|
days2 = days2.getDate()
|
|
if (day2 > days2) {
|
|
day2 = days2
|
|
}//获取了当前年份的日和6个月以后的日,为的就是判断如果前一个月是有31号,后一个月没有,就将一个月以后的日期取到,赋值给day2
|
|
if (month2 < 10) {
|
|
month2 = '0' + month2
|
|
}
|
|
var time = year2 + '-' + month2 + '-' + day2
|
|
return time
|
|
},
|
|
pageOnChange(page) {
|
|
this.pageNo = page
|
|
this.getList()
|
|
},
|
|
SizeChange(page, pageSize) {
|
|
this.pageNo = 1
|
|
this.pageSize = pageSize
|
|
this.getList()
|
|
},
|
|
getList() {
|
|
let flag
|
|
if (this.activeTab == this.$t('ImplementationDate')) {
|
|
flag = 0
|
|
} else {
|
|
flag = 1
|
|
}
|
|
let params = {
|
|
...this.searchParmes,
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
flag: flag
|
|
}
|
|
this.loading = true
|
|
postAction(this.url.list, params).then((res) => {
|
|
if (res.success) {
|
|
this.dataSource = res.result.records
|
|
this.total = res.result.total
|
|
this.loading = false
|
|
} else {
|
|
this.loading = false
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
|
|
.page {
|
|
text-align: right;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
::v-deep .ant-table-row:first-child {
|
|
background: #fff !important;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
::v-deep .ant-table-body {
|
|
background: transparent !important;
|
|
}
|
|
</style> |