Files
laws_chery_client/src/views/system/UserAnnouncementList.vue
T
2024-07-26 15:35:45 +08:00

335 lines
11 KiB
Vue

<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item :label="$t('message.my.title')">
<a-input :placeholder="$t('pleaseEnter') + $t('message.my.title')" v-model="queryParam.titile"></a-input>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item :label="$t('message.my.publisher')">
<a-input :placeholder="$t('pleaseEnter') + $t('message.my.publisher')" v-model="queryParam.sender"></a-input>
</a-form-item>
</a-col>
<!--<a-col :span="6">-->
<!-- <a-form-item :label="$t('message.my.messageType')">-->
<!-- <a-select class="box-input"-->
<!-- :placeholder="$t('pleaseSelect')+$t('message.my.messageType')"-->
<!-- v-model="queryParam.msgCategory">-->
<!-- <a-select-option :value="undefined">{{ $t('pleaseSelect') }}</a-select-option>-->
<!-- <a-select-option v-for="(item, key) in Object.keys(msgCategoryQuery)"-->
<!-- :key="key" :value="item">-->
<!-- <span style="display: inline-block;width: 100%" :title="msgCategoryQuery[item]">-->
<!-- {{ msgCategoryQuery[item] }}-->
<!-- </span>-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<!-- </a-form-item>-->
<!--</a-col>-->
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a-button v-if="'system:userAnnouncementList:search'" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
<a-button @click="searchReset" style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!-- 标记已读 -->
<a-button type="primary" ghost @click="readAll" v-has="'system:userAnnouncementList:allLabelsRead'">
<a-icon type="eye" />
{{ $t('message.my.allLabelsRead') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%', y: yScrollHeight}"
ref="table"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowClassName="rowClassName"
@change="handleTableChange">
<!--已读、未读状态-->
<template v-slot:readFlag="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text}}</template>
<div class="table-text" :class="{'agree-color': record.readFlag + '' === '1', 'reject-color': record.readFlag + '' === '0'}">
{{ text }}
</div>
</a-tooltip>
</template>
<!-- 操作 -->
<template v-slot:action="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<a class="table-del" @click="handleGoDetail(record)" v-has="'system:userAnnouncementList:detail'">{{$t('view')}}</a>
</a-tooltip>
</template>
</j-table>
</div>
</a-card>
</template>
<script>
// import { filterObj } from '@/utils/util'
// import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
// import DynamicNotice from '../../components/tools/DynamicNotice'
import { getAction, deleteAction, postAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
// import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import JTable from '@comp/jero/JTable'
import { ReadFlag } from '@/enums/commonEnums'
import { getMsgDetail } from '@api/personCenter'
export default {
name: 'UserAnnouncementList',
components: { JTable },
mixins: [JeroListMixin],
// components: {
// DynamicNotice,
// ShowAnnouncement
// },
data () {
return {
description: '系统通告表管理页面',
queryParam: {},
selectedRowKeys: [],
msgCategoryQuery: {
1: this.$t('message.my.subscriptionNotification'),
2: this.$t('message.my.warningInformation'),
3: this.$t('message.my.forwardPush')
// '4': this.$t('CollectinguthenticationParameters'),
// '6':this.$t('RegulationListConfirmationTask'),
// '7':this.$t('RegulationListConfirmationNotification'),
// '8':this.$t('RegulationTaskConfirmation'),
// '9':this.$t('DesignComplianceTask'),
// '10':this.$t('PreHomoTask'),
// '11':this.$t('ValidationTask'),
// '12':this.$t('DesignComplianceNotification'),
// '13':this.$t('PreHomoNotification'),
// '14':this.$t('ValidationComplianceNotification'),
// '15':this.$t('RegulationTaskConfirmationNotification'),
// '17':this.$t('listConfirmation'),
// '18':this.$t('taskAffirm'),
// '19':this.$t('complianceConfirmation'),
// '20':this.$t('collectionLegislativeComments'),
// '21':this.$t('regulatoryAndTechnicalAssessment'),
},
columns: [
{
title: this.$t('message.my.title'),
align: 'center',
dataIndex: 'titile',
width: 150,
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('message.my.messageType'),
align: 'center',
dataIndex: 'msgCategory_dictText',
width: 150,
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('message.my.publisher'),
align: 'center',
dataIndex: 'sender',
width: 150,
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('message.my.notificationTime'),
align: 'center',
width: 120,
dataIndex: 'sendTime',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('message.my.readingStatus'),
align: 'center',
width: 120,
dataIndex: 'readFlag_dictText',
scopedSlots: { customRender: 'readFlag' }
},
{
// 操作
// fixed: 'right',
title: this.$t('operation'),
dataIndex: 'action',
align: 'center',
width: 100,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/sysAnnouncementSend/getMyAnnouncementSend',
editCementSend: 'sys/sysAnnouncementSend/editByAnntIdAndUserId',
readAllMsg: 'sys/sysAnnouncementSend/readAll',
deleteUrl: 'sys/sysAnnouncementSend/deleteBatch'
},
loading: false,
openPath: '',
formData: '',
language: ''
}
},
mounted () {
this.language = localStorage.getItem('language') || ''
},
methods: {
// 未读的高亮
rowClassName (record) {
return record.readFlag === ReadFlag.UNREAD.value ? 'row-unread' : ''
},
// 跳转详情
handleGoDetail (record) {
this.$router.push({
path: '/isps/userAnnouncementDetail',
query: {
id: record.id
}
})
},
expandIcon (props) {
if (props.expanded) {
return <a-icon type = 'down' onClick = { e => {
props.onExpand(props.record, e)
}
}
/>
} else {
return <a-icon type="right" onClick={e => {
props.onExpand(props.record, e)
}
}
/>
}
},
loadData (arg) {
if (!this.url.list) {
this.$message.warning('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()// 查询条件
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
// update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
if (res.result.current > 1 && res.result.records.length === 0) {
this.loadData(1)
return
}
this.dataSource = res.result.records || res.result
if (this.dataSource && this.dataSource.length > 0) {
this.dataSource.forEach(val => {
if (val.msgContentInfoCn && val.msgContentInfoCn.includes('/common/downLoadFile')) {
const index = val.msgContentInfoCn.indexOf('target')
val.msgContentInfoCn = val.msgContentInfoCn.slice(0, index - 2) + '&token=' + Vue.ls.get(ACCESS_TOKEN) + '\' ' +
val.msgContentInfoCn.slice(index)
}
if (val.msgContentInfo && val.msgContentInfo.includes('/common/downLoadFile')) {
const index = val.msgContentInfo.indexOf('target')
val.msgContentInfo = val.msgContentInfo.slice(0, index - 2) + '&token=' + Vue.ls.get(ACCESS_TOKEN) + '\' ' +
val.msgContentInfo.slice(index)
}
})
}
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
// update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}
if (res.code === 510) {
this.$message.warning(res.message)
}
this.loading = false
})
},
expandChange (isTrue, val) {
if (isTrue) {
if (val.readFlag === '0') {
this.msgContentClick(val)
}
}
},
readAll () {
if (this.dataSource.length > 0) {
this.$confirm({
content: this.$t('message.my.areAllLabelsRead'),
onOk: () => {
postAction(this.url.readAllMsg, {}).then((res) => {
if (res.success) {
this.selectedRowKeys = []
this.$message.success(this.$t('operationSuccessful'))
this.loadData()
} else {
this.$message.success(this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('personalCenter.myMessage.noCanRemarkData'))
}
},
onSelectChange (value) {
this.selectedRowKeys = value
},
msgContentClick (row) {
postAction(this.url.readAllMsg, { ids: row.id })
},
handleDel () {
if (this.selectedRowKeys.length > 0) {
this.$confirm({
content: this.$t('confirmBatchDeletion'),
onOk: () => {
const selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
deleteAction(this.url.deleteUrl, { ids: selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
this.selectedRowKeys = []
this.$message.success(this.$t('operationSuccessful'))
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('pleaseSelectData'))
}
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .row-unread > td {
background-color: #F9F9F9;
}
// 未读
.reject-color {
color: @primary-color;
}
</style>