Files
laws_weilai/jero-web/src/views/system/UserAnnouncementList.vue
T
2022-07-11 11:06:55 +08:00

305 lines
9.4 KiB
Java

<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 :md="6" :sm="8" style="line-height: 48px">
<div class="box-title-text">
<div class="title-text" :title="$t('MessageTitle')">
<span>{{this.$t('MessageTitle')}}</span>
</div>
<a-input class="box-input"
:placeholder="$t('pleaseEnter')+$t('MessageTitle')"
v-model="queryParam.titile">
</a-input>
</div>
</a-col>
<a-col :md="6" :sm="8" style="line-height: 48px">
<div class="box-title-text">
<div class="title-text" :title="$t('MessageType')">
<span>{{this.$t('MessageType')}}</span>
</div>
<a-select class="box-input"
:placeholder="$t('pleaseSelect')+$t('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>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator">
<div @click="readAll" class="operator-text" :title="$t('AllLabelsRead')">
<a-icon type="eye"/>
{{$t('AllLabelsRead')}}
</div>
<div @click="handleDel" class="operator-text">
<a-icon type="delete"/>
{{$t('BatchDelete')}}
</div>
</div>
<a-table
ref="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
:dataSource="dataSource"
:scroll="{x: '100%'}"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<span slot="msgTitile" slot-scope="text,scope">
<a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" :title="text" @click="msgContentClick(scope)">
{{text}}
</a>
</span>
<span slot="msgCategory" slot-scope="text,scope">
<a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" @click="msgContentClick(scope)">
{{msgCategoryQuery[text]}}
</a>
</span>
</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 { getAction, putAction, deleteAction } from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DynamicNotice from '../../components/tools/DynamicNotice'
export default {
name: 'UserAnnouncementList',
mixins: [JeroListMixin],
components: {
DynamicNotice,
ShowAnnouncement
},
data() {
return {
description: '系统通告表管理页面',
queryParam: {},
selectedRowKeys: [],
msgCategoryQuery: {
'1': this.$t('SubscriptionNotification'),
'2': this.$t('warningInformation'),
'3': this.$t('ForwardPush'),
'4': this.$t('authenticationMessage'),
'5': this.$t('taskRegulationComplianceTask'),
'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'),
},
columns: [
{
title: this.$t('MessageTitle'),
align: 'center',
dataIndex: 'titile',
ellipsis: true,
scopedSlots: { customRender: 'msgTitile' }
},
{
title: this.$t('Sponsor'),
align: 'center',
dataIndex: 'initiator',
width: 200,
},
{
title: this.$t('MessageType'),
align: 'center',
dataIndex: 'msgCategory',
width: 200,
scopedSlots: { customRender: 'msgCategory' }
},
{
title: this.$t('NotificationTime'),
align: 'center',
width: 200,
dataIndex: 'sendTime'
}
],
url: {
list: '/sys/sysAnnouncementSend/getMyAnnouncementSend',
editCementSend: 'sys/sysAnnouncementSend/editByAnntIdAndUserId',
readAllMsg: 'sys/sysAnnouncementSend/read',
deleteUrl: 'sys/sysAnnouncementSend/deleteBatch'
},
loading: false,
openPath: '',
formData: ''
}
},
methods: {
showAnnouncement(record) {
putAction(this.url.editCementSend, { anntId: record.anntId }).then((res) => {
if (res.success) {
this.loadData()
this.syncHeadNotic(record.anntId)
}
})
if (record.openType === 'component') {
this.openPath = record.openPage
this.formData = { id: record.busId }
this.$refs.showDynamNotice.detail()
} else {
this.$refs.ShowAnnouncement.detail(record)
}
},
readAll() {
var that = this
if (this.selectedRowKeys.length > 0) {
that.$confirm({
content: that.$t('AreAllLabelsRead'),
onOk: function() {
let selectedRowKeys = JSON.parse(JSON.stringify(that.selectedRowKeys))
getAction(that.url.readAllMsg, { ids: selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
that.selectedRowKeys = []
that.$message.success(that.$t('OperationSuccessful'))
that.loadData()
} else {
that.$message.success(that.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('PleaseSelectData'))
}
},
onSelectChange(value) {
this.selectedRowKeys = value
},
msgContentClick(row) {
getAction(this.url.readAllMsg, { ids: row.id }).then((res) => {
})
this.$router.push({
path: '/system/MessageDetails',
query: row
})
},
handleDel() {
var that = this
if (this.selectedRowKeys.length > 0) {
that.$confirm({
content: that.$t('ConfirmBatchDeletion'),
onOk: function() {
let selectedRowKeys = JSON.parse(JSON.stringify(that.selectedRowKeys))
deleteAction(that.url.deleteUrl, { ids: selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
that.selectedRowKeys = []
that.$message.success(that.$t('OperationSuccessful'))
that.loadData()
} else {
that.$message.warning(that.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('PleaseSelectData'))
}
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.ant-card-body .table-operator {
margin-bottom: 18px;
}
.anty-row-operator button {
margin: 0 5px
}
.ant-btn-danger {
background-color: #ffffff
}
.ant-modal-cust-warp {
height: 100%
}
.ant-modal-cust-warp .ant-modal-body {
height: calc(100% - 110px) !important;
overflow-y: auto
}
.ant-modal-cust-warp .ant-modal-content {
height: 90% !important;
overflow-y: hidden
}
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 20%;
min-width: 90px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
</style>
<style>
.box-input .ant-select-selection {
height: 38px;
line-height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
}
</style>