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

192 lines
5.2 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-12 11:30:57 +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('webmsg.' + 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>
<el-table-column prop="typeId" sortable="custom" :label="$t('webmsg.type')" width="140">
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, updateStatus } 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 bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
import { mapGetters } from 'vuex'
2021-07-02 19:19:38 +08:00
export default {
components: {
LayoutContent,
ComplexTable
},
data() {
return {
selectType: -1,
msgTypes: msgTypes,
data: [],
allTypes: [{ name: 'mysql', type: 'jdbc' }, { name: 'sqlServer', type: 'jdbc' }],
columns: [],
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0
2021-07-06 15:24:34 +08:00
},
orderConditions: []
2021-07-02 19:19:38 +08:00
}
},
computed: {
...mapGetters([
'permission_routes'
])
},
2021-07-02 19:19:38 +08:00
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 = {}
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 ']
2021-07-06 15:24:34 +08:00
} 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) {
2021-07-12 11:30:57 +08:00
return this.$t('webmsg.' + getTypeName(value))
2021-07-02 19:19:38 +08:00
},
typeChange(value) {
this.search()
},
toDetail(row) {
2021-07-12 11:30:57 +08:00
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
if (this.hasPermissionRoute(row.router)) {
this.$router.push({ name: row.router, params: param })
row.status || this.setReaded(row)
return
}
this.$warning(this.$t('commons.no_target_permission'))
},
hasPermissionRoute(name, permission_routes) {
permission_routes = permission_routes || this.permission_routes
for (let index = 0; index < permission_routes.length; index++) {
const route = permission_routes[index]
if (route.name && route.name === name) return true
if (route.children && this.hasPermissionRoute(name, route.children)) return true
}
return false
2021-07-02 19:19:38 +08:00
},
// 设置已读
setReaded(row) {
updateStatus(row.msgId).then(res => {
2021-07-06 15:24:34 +08:00
bus.$emit('refresh-top-notification')
2021-07-02 19:19:38 +08:00
this.search()
})
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 === 'typeId') {
prop = 'type_id'
}
2021-07-06 15:24:34 +08:00
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;
fix(frontend): 修复 css 中不再支持的样式深度选择符号 >>> 导致命令行报错的问题 (#2806) * fix: 执行 eslint 命令, 修复代码 * fix(frontend): justify-content 不支持的值 start, end 改为 flex-start, flex-end * Update format-utils.js 去掉注释 * fix(frontend): 修复 css 中不再支持的样式深度选择符号 >>> 导致命令行报错的问题, 替换为 ::v-deep * Update DateFormat.vue * Update FrameLinks.vue * Update Hyperlinks.vue * Update HyperlinksDialog.vue * Update LinkageField.vue * Update VideoLinks.vue * Update DeNumberRange.vue * Update DeSelectGrid.vue * Update index.scss * Update index.vue * Update BackgroundColorSelector.vue * Update LegendSelector.vue * Update LegendSelectorAntV.vue * Update SplitSelector.vue * Update SplitSelectorAntV.vue * Update TitleSelector.vue * Update TitleSelectorAntV.vue * Update XAxisSelector.vue * Update XAxisSelectorAntV.vue * Update YAxisExtSelector.vue * Update YAxisExtSelectorAntV.vue * Update YAxisSelector.vue * Update YAxisSelectorAntV.vue * Update QuotaFilterEditor.vue * Update ResultFilterEditor.vue * Update LabelNormal.vue * Update LabelNormalText.vue * Update AssistLine.vue * Update FunctionCfg.vue * Update ScrollCfg.vue * Update Threshold.vue * Update ColorSelector.vue * Update LabelSelector.vue * Update SizeSelector.vue * Update TooltipSelector.vue * Update TooltipSelectorAntV.vue * Update TotalCfg.vue * Update TableNormal.vue * Update ChartStyle.vue * Update AddCustom.vue * Update AddExcel.vue * Update DatasetChartDetail.vue * Update DatasetGroupSelector.vue * Update DatasetGroupSelectorTree.vue * Update CalcFieldEdit.vue * Update FieldEdit.vue * Update TabDataPreview.vue * Update UnionView.vue * Update UpdateInfo.vue * Update Group.vue * Update all.vue * Update readed.vue * Update unread.vue * Update index.vue * Update index.vue * Update index.vue * Update PanelBackgroundColorSelector.vue * Update PanelColorSelector.vue * Update ViewAttribute.vue * Update SubjectTemplateItem.vue * Update multiplexing.vue * Update filterDialog.vue * Update PanelList.vue * Update PanelMain.vue * Update PanelDetailInfo.vue * Update MapSettingLeft.vue * Update index.vue * Update DatasetTaskList.vue * Update TaskRecord.vue * Update dataset.vue * Update personPwd.vue * Update privateForm.vue Co-authored-by: 王嘉豪 <42510293+ziyujiahao@users.noreply.github.com>
2022-08-05 18:24:27 +08:00
::v-deep .el-radio-button__inner {
2021-07-02 19:19:38 +08:00
border-radius: 4px 4px 4px 4px !important;
border-left: 1px solid #dcdfe6 !important;
padding: 10px 10px;
}
fix(frontend): 修复 css 中不再支持的样式深度选择符号 >>> 导致命令行报错的问题 (#2806) * fix: 执行 eslint 命令, 修复代码 * fix(frontend): justify-content 不支持的值 start, end 改为 flex-start, flex-end * Update format-utils.js 去掉注释 * fix(frontend): 修复 css 中不再支持的样式深度选择符号 >>> 导致命令行报错的问题, 替换为 ::v-deep * Update DateFormat.vue * Update FrameLinks.vue * Update Hyperlinks.vue * Update HyperlinksDialog.vue * Update LinkageField.vue * Update VideoLinks.vue * Update DeNumberRange.vue * Update DeSelectGrid.vue * Update index.scss * Update index.vue * Update BackgroundColorSelector.vue * Update LegendSelector.vue * Update LegendSelectorAntV.vue * Update SplitSelector.vue * Update SplitSelectorAntV.vue * Update TitleSelector.vue * Update TitleSelectorAntV.vue * Update XAxisSelector.vue * Update XAxisSelectorAntV.vue * Update YAxisExtSelector.vue * Update YAxisExtSelectorAntV.vue * Update YAxisSelector.vue * Update YAxisSelectorAntV.vue * Update QuotaFilterEditor.vue * Update ResultFilterEditor.vue * Update LabelNormal.vue * Update LabelNormalText.vue * Update AssistLine.vue * Update FunctionCfg.vue * Update ScrollCfg.vue * Update Threshold.vue * Update ColorSelector.vue * Update LabelSelector.vue * Update SizeSelector.vue * Update TooltipSelector.vue * Update TooltipSelectorAntV.vue * Update TotalCfg.vue * Update TableNormal.vue * Update ChartStyle.vue * Update AddCustom.vue * Update AddExcel.vue * Update DatasetChartDetail.vue * Update DatasetGroupSelector.vue * Update DatasetGroupSelectorTree.vue * Update CalcFieldEdit.vue * Update FieldEdit.vue * Update TabDataPreview.vue * Update UnionView.vue * Update UpdateInfo.vue * Update Group.vue * Update all.vue * Update readed.vue * Update unread.vue * Update index.vue * Update index.vue * Update index.vue * Update PanelBackgroundColorSelector.vue * Update PanelColorSelector.vue * Update ViewAttribute.vue * Update SubjectTemplateItem.vue * Update multiplexing.vue * Update filterDialog.vue * Update PanelList.vue * Update PanelMain.vue * Update PanelDetailInfo.vue * Update MapSettingLeft.vue * Update index.vue * Update DatasetTaskList.vue * Update TaskRecord.vue * Update dataset.vue * Update personPwd.vue * Update privateForm.vue Co-authored-by: 王嘉豪 <42510293+ziyujiahao@users.noreply.github.com>
2022-08-05 18:24:27 +08:00
::v-deep .el-radio-button__orig-radio:checked+.el-radio-button__inner {
2021-07-02 19:19:38 +08:00
color: #fff;
2021-09-03 14:40:47 +08:00
// background-color: #0a7be0;
// border-color: #0a7be0;
2021-07-02 19:19:38 +08:00
-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>