dataease/frontend/src/views/msg/readed.vue

176 lines
4.8 KiB
Vue
Raw Normal View History

2021-07-02 19:19:38 +08:00
<template>
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
2021-07-09 18:37:07 +08:00
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t(item.typeName) }}</el-radio-button>
2021-07-02 19:19:38 +08:00
</el-radio-group>
<complex-table
:data="data"
:columns="columns"
:pagination-config="paginationConfig"
@select="select"
@search="search"
2021-07-06 15:24:34 +08:00
@sort-change="sortChange"
2021-07-02 19:19:38 +08:00
>
2021-07-06 15:24:34 +08:00
<el-table-column prop="content" :label="$t('webmsg.content')">
<template slot-scope="scope">
2021-07-02 19:19:38 +08:00
<span style="display: flex;flex: 1;">
<span>
<svg-icon v-if="!scope.row.status" icon-class="unread-msg" style="color: red;" />
<svg-icon v-else icon-class="readed-msg" />
</span>
<span style="margin-left: 6px;" class="de-msg-a" @click="toDetail(scope.row)">
{{ scope.row.content }}
</span>
</span>
</template>
</el-table-column>
2021-07-06 15:24:34 +08:00
<el-table-column prop="createTime" sortable="custom" :label="$t('webmsg.sned_time')" width="180">
<template slot-scope="scope">
2021-07-02 19:19:38 +08:00
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
2021-07-06 15:24:34 +08:00
<el-table-column prop="readTime" sortable="custom" :label="$t('webmsg.read_time')" width="180">
<template slot-scope="scope">
<span>{{ scope.row.readTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
2021-07-02 19:19:38 +08:00
<template slot-scope="scope">
2021-07-09 18:37:07 +08:00
<span>{{ getTypeName(scope.row.typeId) }}</span>
2021-07-02 19:19:38 +08:00
</template>
</el-table-column>
</complex-table>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query } from '@/api/system/msg'
2021-07-09 18:37:07 +08:00
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
2021-07-06 15:24:34 +08:00
import { addOrder, formatOrders } from '@/utils/index'
2021-07-02 19:19:38 +08:00
export default {
components: {
LayoutContent,
ComplexTable
},
data() {
return {
selectType: -1,
// msgTypes: [
// { value: -1, label: '全部类型' },
// { value: 0, label: '仪表板分享' },
// { value: 1, label: '数据集同步' }
// ],
msgTypes: msgTypes,
data: [],
allTypes: [{ name: 'mysql', type: 'jdbc' }, { name: 'sqlServer', type: 'jdbc' }],
columns: [],
2021-07-06 15:24:34 +08:00
orderConditions: [],
2021-07-02 19:19:38 +08:00
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0
}
}
},
mounted() {
this.search()
},
2021-07-09 18:37:07 +08:00
created() {
// 先加载消息类型
loadMsgTypes()
},
2021-07-02 19:19:38 +08:00
methods: {
select(selection) {
},
search() {
const param = {}
param.status = true
2021-07-02 19:19:38 +08:00
if (this.selectType >= 0) {
param.type = this.selectType
}
2021-07-06 15:24:34 +08:00
if (this.orderConditions.length === 0) {
param.orders = [' create_time desc ']
} else {
param.orders = formatOrders(this.orderConditions)
}
2021-07-02 19:19:38 +08:00
const { currentPage, pageSize } = this.paginationConfig
query(currentPage, pageSize, param).then(response => {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
})
},
getTypeName(value) {
return getTypeName(value)
},
typeChange(value) {
this.search()
},
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
2021-07-06 15:24:34 +08:00
},
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {
this.search()
return
}
if (prop === 'createTime') {
prop = 'create_time'
}
if (prop === 'readTime') {
prop = 'read_time'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
2021-07-02 19:19:38 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.de-msg-radio-class {
padding: 0 5px;
>>>.el-radio-button__inner {
border-radius: 4px 4px 4px 4px !important;
border-left: 1px solid #dcdfe6 !important;
padding: 10px 10px;
}
>>>.el-radio-button__orig-radio:checked+.el-radio-button__inner {
color: #fff;
background-color: #0a7be0;
border-color: #0a7be0;
-webkit-box-shadow: 0px 0 0 0 #0a7be0;
box-shadow: 0px 0 0 0 #0a7be0;
}
}
.de-msg-a:hover {
text-decoration: underline !important;
color: #0a7be0 !important;
cursor: pointer !important;
}
</style>