302 lines
11 KiB
Vue
302 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.messageContent')">
|
|
<a-input :placeholder="$t('pleaseEnter') + $t('message.my.messageContent')" v-model="queryParam.msgContent"></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>
|
|
|
|
<a-col :span="8" >
|
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
<a-button type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
|
|
<a-button @click="searchReset" style="margin-left: 8px">{{ $t('reset') }}</a-button>
|
|
</span>
|
|
</a-col>
|
|
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
|
|
<div class="table-operator">
|
|
<div @click="readAll" class="operator-text" :title="$t('message.my.allLabelsRead')">
|
|
<a-icon type="eye" />
|
|
{{ $t('message.my.allLabelsRead') }}
|
|
</div>
|
|
<div @click="handleDel" class="operator-text">
|
|
<a-icon type="delete" />
|
|
{{ $t('batchDelete') }}
|
|
</div>
|
|
</div>
|
|
|
|
<a-table
|
|
:components="drag(columns,'columns')"
|
|
ref="table"
|
|
rowKey="id"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:columns="columns"
|
|
:dataSource="dataSource"
|
|
:scroll="{x: '100%'}"
|
|
:pagination="ipagination"
|
|
:expandIconAsCell="false"
|
|
:expandIconColumnIndex="5"
|
|
:expandIcon="expandIcon"
|
|
:expandRowByClick="true"
|
|
:loading="loading"
|
|
@expand="expandChange"
|
|
@change="handleTableChange">
|
|
<span slot="msgTitile" slot-scope="text,scope">
|
|
<!-- @click="msgContentClick(scope)"-->
|
|
<a :style="{'color':scope.readFlag === 0 ? 'red':'#00A0E9'}"
|
|
:title="language === 'zh-cn' && scope.msgContentCn? scope.msgContentCn : scope.msgContent">
|
|
{{ language === 'zh-cn' && scope.msgContentCn ? scope.msgContentCn : scope.msgContent }}
|
|
</a>
|
|
</span>
|
|
<span slot="msgCategory" slot-scope="text">
|
|
<!-- :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" @click="msgContentClick(scope)"-->
|
|
<span :title="msgCategoryQuery[text]">
|
|
{{ msgCategoryQuery[text] }}
|
|
</span>
|
|
</span>
|
|
<p slot="expandedRowRender" slot-scope="record" style="margin: 0;padding-left: 58px;">
|
|
<span v-html="language === 'zh-cn' && record.msgContentInfoCn? record.msgContentInfoCn : record.msgContentInfo">
|
|
</span>
|
|
</p>
|
|
</a-table>
|
|
<!-- <show-announcement ref="ShowAnnouncement"></show-announcement>-->
|
|
<!-- <dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>-->
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
// import { filterObj } from '@/utils/util'
|
|
// import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
|
|
// import DynamicNotice from '../../components/tools/DynamicNotice'
|
|
import { getAction, deleteAction } 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'
|
|
|
|
export default {
|
|
name: 'UserAnnouncementList',
|
|
mixins: [JeroListMixin, ResizeHeader, ResizeColumnProvide],
|
|
// 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.messageContent'),
|
|
align: 'left',
|
|
dataIndex: 'msgContent',
|
|
ellipsis: true,
|
|
width: 450,
|
|
scopedSlots: { customRender: 'msgTitile' }
|
|
},
|
|
{
|
|
title: this.$t('message.my.messageType'),
|
|
align: 'left',
|
|
ellipsis: true,
|
|
dataIndex: 'msgCategory',
|
|
width: 150,
|
|
scopedSlots: { customRender: 'msgCategory' }
|
|
},
|
|
{
|
|
title: this.$t('message.my.notificationTime'),
|
|
align: 'left',
|
|
ellipsis: true,
|
|
width: 180,
|
|
dataIndex: 'sendTime'
|
|
}
|
|
// {
|
|
// title: '',
|
|
// align: 'left',
|
|
// ellipsis: true,
|
|
// width: 50
|
|
// }
|
|
],
|
|
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: {
|
|
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.error('请设置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.selectedRowKeys.length > 0) {
|
|
this.$confirm({
|
|
content: this.$t('message.my.areAllLabelsRead'),
|
|
onOk: () => {
|
|
const selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
|
|
getAction(this.url.readAllMsg, { ids: selectedRowKeys.join(',') }).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('pleaseSelectData'))
|
|
}
|
|
},
|
|
onSelectChange (value) {
|
|
this.selectedRowKeys = value
|
|
},
|
|
msgContentClick (row) {
|
|
getAction(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';
|
|
</style>
|