mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
@@ -26,3 +26,44 @@ export function batchRead(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function treeList() {
|
||||
return request({
|
||||
url: '/api/sys_msg/treeNodes',
|
||||
method: 'post',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function channelList() {
|
||||
return request({
|
||||
url: '/api/sys_msg/channelList',
|
||||
method: 'post',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function settingList() {
|
||||
return request({
|
||||
url: '/api/sys_msg/settingList',
|
||||
method: 'post',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function updateSetting(data) {
|
||||
return request({
|
||||
url: '/api/sys_msg/updateSetting',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function allTypes(data) {
|
||||
return request({
|
||||
url: '/api/sys_msg/types',
|
||||
method: 'post',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="start-item">
|
||||
<div class="filter-db-row star-item-content" @click="showDetail(scope.row)">
|
||||
<!-- <svg-icon icon-class="panel" class="ds-icon-scene" /> -->
|
||||
<div class="title-div"><span>【{{ $t(getTypeName(scope.row.type)) }}】 {{ scope.row.content }}</span></div>
|
||||
<div class="title-div"><span>【{{ getTypeName(scope.row.typeId) }}】 {{ scope.row.content }}</span></div>
|
||||
<div class="title-div"><span>{{ scope.row.createTime | timestampFormatDate }}</span></div>
|
||||
</div>
|
||||
<!-- <div class="star-item-close">
|
||||
@@ -61,13 +61,12 @@
|
||||
|
||||
<script>
|
||||
import { query, updateStatus } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName } from '@/utils/webMsg'
|
||||
import { getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import { mapGetters } from 'vuex'
|
||||
import bus from '@/utils/bus'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
msgTypes: msgTypes,
|
||||
showSetting: false,
|
||||
data: [],
|
||||
visible: false,
|
||||
@@ -85,6 +84,8 @@ export default {
|
||||
])
|
||||
},
|
||||
created() {
|
||||
// 先加载消息类型
|
||||
loadMsgTypes()
|
||||
this.search()
|
||||
// 每30s定时刷新拉取消息
|
||||
this.timer = setInterval(() => {
|
||||
@@ -107,12 +108,18 @@ export default {
|
||||
// console.log(lang)
|
||||
// },
|
||||
showDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
this.visible = false
|
||||
if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
|
||||
bus.$emit('to-msg-share', param)
|
||||
} else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
|
||||
bus.$emit('to-msg-dataset', param)
|
||||
// if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
|
||||
// bus.$emit('to-msg-share', param)
|
||||
// } else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
|
||||
// bus.$emit('to-msg-dataset', param)
|
||||
// } else {
|
||||
// this.$router.push({ name: row.router, params: param })
|
||||
// }
|
||||
if (this.$route && this.$route.name && this.$route.name === row.router) {
|
||||
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
|
||||
row.callback && bus.$emit(row.callback, param)
|
||||
} else {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
}
|
||||
@@ -155,7 +162,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getTypeName(value) {
|
||||
return getTypeName(value)
|
||||
return this.$t('webmsg.' + getTypeName(value))
|
||||
},
|
||||
open() {
|
||||
this.visible = true
|
||||
|
||||
1
frontend/src/icons/svg/msg-setting.svg
Normal file
1
frontend/src/icons/svg/msg-setting.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1625803255741" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2522" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M692.8 557.8c-49.3 0-89.4 40-89.4 89.1s40.1 89.1 89.4 89.1c49.3 0 89.4-40 89.4-89.1 0-49.2-40-89.1-89.4-89.1zM693 681c-18.2-0.8-32.6-15.9-32.6-34.1 0-18.3 14.4-33.3 32.6-34.1 18.5 0.5 33.2 15.6 33.2 34.1S711.5 680.5 693 681z" p-id="2523"></path><path d="M955.1 593.9c-2.9-15.2-12.1-24.9-23.3-24.7h-2.3c-38.5 0-69.9-31-69.9-69.1 0-12.5 6-26.3 6.1-26.4 5.9-13.6 1.4-29.3-10.7-37.8l-0.7-0.5-67.3-36.8-0.7-0.3c-13-5.3-28-2.3-38.1 7.5-8.2 8.4-34 30.1-54.9 30.1-21.1 0-47.2-22.1-55.4-30.7-10-9.9-24.9-13-38.1-7.8l-0.7 0.3-69.6 37.8-0.7 0.5c-12.1 8.4-16.6 24.2-10.7 37.8 0.1 0.1 6.1 13.9 6.1 26.4 0 38.1-31.3 69.1-69.9 69.1H452c-11.2-0.2-20.4 9.5-23.3 24.7-0.2 1.1-5.6 29.6-5.6 52.1 0 22.4 5.4 50.8 5.6 52.1 2.8 15 11.9 24.7 22.9 24.7l0.4-0.1h2.3c38.5 0 69.9 31 69.9 69.1 0 12.5-6 26.3-6.1 26.4-5.9 13.6-1.4 29.3 10.6 37.8l0.6 0.5 66 36.4 0.7 0.3c13.1 5.4 28.3 2.3 38.2-7.9 7.8-8.4 34.6-32.1 56.2-32.1 21.7 0 48.2 23.5 56.6 32.6 6.6 6.9 15.8 10.8 25.4 10.7 4.3 0.1 8.7-0.8 12.7-2.5l0.7-0.3 68.4-37.4 0.7-0.5c12-8.5 16.5-24.3 10.7-37.8-0.1-0.1-6.1-13.9-6.1-26.4 0-38.1 31.3-69.1 69.9-69.1h2.3c11.2 0.3 20.4-9.5 23.3-24.6 0.2-1.1 5.6-29.6 5.6-52.1 0.1-22.3-5.2-50.4-5.5-52z m-62.2 92.2c-46.1 2.3-82.9 40-82.9 86 0 15.4 6.1 30.1 7.4 33.1l-55 29.9h-0.1c-0.6 0-1.3-0.2-1.8-0.5-1-1.1-9-9.4-20.5-17.9-17.1-12.6-33.4-18.9-48.4-18.9-14.8 0-31 6.2-48 18.5-11.4 8.2-19.3 16.5-20.3 17.6-0.5 0.3-1.1 0.4-1.7 0.4h-0.1l-53-29.2c1.3-3 7.4-17.8 7.4-33.2 0-45.9-36.8-83.6-82.9-86-0.7-3.6-4.3-23.8-4.3-39.1 0-15.2 3.6-35.5 4.3-39.1 46.1-2.4 82.9-40 82.9-86 0-15.3-6-30.1-7.4-33.1l56.1-30.3h0.2c0.7 0 1.4 0.2 2.1 0.5 6.2 6.2 12.9 11.8 20.1 16.9 16.8 11.8 32.7 17.7 47.3 17.7 14.4 0 30.2-5.9 46.8-17.4 7.2-5 13.9-10.5 20-16.6 0.6-0.4 1.3-0.5 2.1-0.5h0.2l54.1 29.6c-1.3 3.1-7.4 17.8-7.4 33.2 0 45.9 36.8 83.6 82.9 86 0.7 3.6 4.3 23.9 4.3 39.1s-3.8 35.7-4.4 39.3z" p-id="2524"></path><path d="M426 831.2H198.1c-30.8 0-67.3-35.9-67.3-66V348.6l248.4 168.9v-80.1L130.8 268.5v-30c0-30 14.3-43.9 44.9-43.9h672.5c30.6 0 44.6 13.9 44.6 43.9v9.5h0.2v111.5c0 18.4 15.1 33.5 33.5 33.5s33.5-15.1 33.5-33.5V248v-2.5-7.1c0-66.6-43.7-109.7-111.8-109.7H175.7c-68.1 0-112.1 43-112.1 109.7v526.8c0 66.5 66.6 131.8 134.5 131.8H426c18.1 0 32.9-14.8 32.9-32.9 0-18.1-14.8-32.9-32.9-32.9z" p-id="2525"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1242,9 +1242,17 @@ export default {
|
||||
content: 'Content',
|
||||
sned_time: 'Send Time',
|
||||
read_time: 'Read Time',
|
||||
type: 'Type',
|
||||
type: 'Message Type',
|
||||
mark_readed: 'Mark As Read',
|
||||
please_select: 'Please select at least one message',
|
||||
mark_success: 'Mark read successfully'
|
||||
mark_success: 'Mark read successfully',
|
||||
receive_manage: 'Receive Manage',
|
||||
i18n_msg_type_panel_share: 'Dashboard sharing',
|
||||
i18n_msg_type_panel_share_cacnel: 'Dashboard unshared',
|
||||
i18n_msg_type_dataset_sync: 'Data set synchronization',
|
||||
i18n_msg_type_dataset_sync_success: 'Dataset synchronization successful',
|
||||
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
|
||||
i18n_msg_type_all: 'All type',
|
||||
channel_inner_msg: 'On site news'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,9 +1242,17 @@ export default {
|
||||
content: '消息內容',
|
||||
sned_time: '提交時間',
|
||||
read_time: '查看時間',
|
||||
type: '類型',
|
||||
type: '消息類型',
|
||||
mark_readed: '標記已讀',
|
||||
please_select: '請至少選擇一條消息',
|
||||
mark_success: '標記已讀成功'
|
||||
mark_success: '標記已讀成功',
|
||||
receive_manage: '接收管理',
|
||||
i18n_msg_type_panel_share: '儀表板分享',
|
||||
i18n_msg_type_panel_share_cacnel: '儀表板取消分享',
|
||||
i18n_msg_type_dataset_sync: '數據集同步',
|
||||
i18n_msg_type_dataset_sync_success: '數據集同步成功',
|
||||
i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
|
||||
i18n_msg_type_all: '全部類型',
|
||||
channel_inner_msg: '站內消息'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1244,9 +1244,17 @@ export default {
|
||||
content: '消息内容',
|
||||
sned_time: '提交时间',
|
||||
read_time: '查看时间',
|
||||
type: '类型',
|
||||
type: '消息类型',
|
||||
mark_readed: '标记已读',
|
||||
please_select: '请至少选择一条消息',
|
||||
mark_success: '标记已读成功'
|
||||
mark_success: '标记已读成功',
|
||||
receive_manage: '接收管理',
|
||||
i18n_msg_type_panel_share: '仪表板分享',
|
||||
i18n_msg_type_panel_share_cacnel: '仪表板取消分享',
|
||||
i18n_msg_type_dataset_sync: '数据集同步',
|
||||
i18n_msg_type_dataset_sync_success: '数据集同步成功',
|
||||
i18n_msg_type_dataset_sync_faild: '数据集同步失败',
|
||||
i18n_msg_type_all: '全部类型',
|
||||
channel_inner_msg: '站内消息'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ const getters = {
|
||||
validate: state => state.lic.validate,
|
||||
licMsg: state => state.lic.licMsg,
|
||||
uiInfo: state => state.user.uiInfo,
|
||||
conditions: state => state.conditions.conditions
|
||||
conditions: state => state.conditions.conditions,
|
||||
msgTypes: state => state.msg.msgTypes
|
||||
}
|
||||
export default getters
|
||||
|
||||
@@ -11,6 +11,7 @@ import request from './modules/request'
|
||||
import panel from './modules/panel'
|
||||
import application from './modules/application'
|
||||
import lic from './modules/lic'
|
||||
import msg from './modules/msg'
|
||||
import animation from '@/components/canvas/store/animation'
|
||||
import compose from '@/components/canvas/store/compose'
|
||||
import contextmenu from '@/components/canvas/store/contextmenu'
|
||||
@@ -182,7 +183,8 @@ const data = {
|
||||
request,
|
||||
panel,
|
||||
application,
|
||||
lic
|
||||
lic,
|
||||
msg
|
||||
},
|
||||
getters
|
||||
}
|
||||
|
||||
25
frontend/src/store/modules/msg.js
Normal file
25
frontend/src/store/modules/msg.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const state = {
|
||||
msgTypes: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
|
||||
SET_MSG_TYPES: (state, value) => {
|
||||
state.msgTypes = value
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const actions = {
|
||||
setMsgTypes({ commit }, data) {
|
||||
commit('SET_MSG_TYPES', data)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
export const msgTypes = [
|
||||
{ value: -1, label: 'webmsg.all_type' },
|
||||
{ value: 0, label: 'webmsg.panel_type' },
|
||||
{ value: 1, label: 'webmsg.dataset_type' }
|
||||
]
|
||||
|
||||
import { allTypes } from '@/api/system/msg'
|
||||
import store from '@/store'
|
||||
export const loadMsgTypes = value => {
|
||||
let msgTypes = store.getters.msgTypes
|
||||
if (!msgTypes || Object.keys(msgTypes).length === 0) {
|
||||
allTypes().then(res => {
|
||||
msgTypes = res.data
|
||||
const defaultType = { msgTypeId: -1, pid: 0, typeName: 'i18n_msg_type_all' }
|
||||
msgTypes.splice(0, 0, defaultType)
|
||||
store.dispatch('msg/setMsgTypes', msgTypes)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const getTypeName = value => {
|
||||
const msgTypes = store.getters.msgTypes
|
||||
for (let index = 0; index < msgTypes.length; index++) {
|
||||
const element = msgTypes[index]
|
||||
if (element.value === value) {
|
||||
return element.label
|
||||
if (element.msgTypeId === value) {
|
||||
return element.typeName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,15 +99,16 @@ export default {
|
||||
|
||||
toMsgShare(routerParam) {
|
||||
if (routerParam !== null && routerParam.msgNotification) {
|
||||
// 说明是从消息通知跳转过来的
|
||||
if (routerParam.msgType === 1) { // 是数据集同步
|
||||
const panelShareTypeIds = [4, 5, 6]
|
||||
// 说明是从消息通知跳转过来的
|
||||
if (panelShareTypeIds.includes(routerParam.msgType)) { // 是数据集同步
|
||||
if (routerParam.sourceParam) {
|
||||
try {
|
||||
const msgParam = JSON.parse(routerParam.sourceParam)
|
||||
this.param = msgParam.tableId
|
||||
this.component = ViewTable
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
|
||||
this.$refs.dynamic_component && this.$refs.dynamic_component.msg2Current && this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
|
||||
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
|
||||
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
|
||||
<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>
|
||||
|
||||
</el-radio-group>
|
||||
<complex-table
|
||||
@@ -36,9 +36,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
|
||||
<span>{{ getTypeName(scope.row.typeId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import ComplexTable from '@/components/business/complex-table'
|
||||
import { query, updateStatus } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName } from '@/utils/webMsg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
export default {
|
||||
@@ -85,6 +85,10 @@ export default {
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
created() {
|
||||
// 先加载消息类型
|
||||
loadMsgTypes()
|
||||
},
|
||||
methods: {
|
||||
select(selection) {
|
||||
},
|
||||
@@ -109,13 +113,13 @@ export default {
|
||||
})
|
||||
},
|
||||
getTypeName(value) {
|
||||
return getTypeName(value)
|
||||
return this.$t('webmsg.' + getTypeName(value))
|
||||
},
|
||||
typeChange(value) {
|
||||
this.search()
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
row.status || this.setReaded(row)
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
|
||||
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
|
||||
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
|
||||
<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>
|
||||
|
||||
</el-radio-group>
|
||||
<complex-table
|
||||
@@ -42,9 +42,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
|
||||
<span>{{ getTypeName(scope.row.typeId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import ComplexTable from '@/components/business/complex-table'
|
||||
import { query } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName } from '@/utils/webMsg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
export default {
|
||||
components: {
|
||||
@@ -90,6 +90,10 @@ export default {
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
created() {
|
||||
// 先加载消息类型
|
||||
loadMsgTypes()
|
||||
},
|
||||
methods: {
|
||||
select(selection) {
|
||||
},
|
||||
@@ -114,13 +118,13 @@ export default {
|
||||
})
|
||||
},
|
||||
getTypeName(value) {
|
||||
return getTypeName(value)
|
||||
return this.$t('webmsg.' + getTypeName(value))
|
||||
},
|
||||
typeChange(value) {
|
||||
this.search()
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
},
|
||||
sortChange({ column, prop, order }) {
|
||||
|
||||
161
frontend/src/views/msg/setting.vue
Normal file
161
frontend/src/views/msg/setting.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template xmlns:el-col="http://www.w3.org/1999/html">
|
||||
<layout-content :header="$t('webmsg.receive_manage')">
|
||||
<el-col>
|
||||
<el-row class="tree-head">
|
||||
<span style="float: left;padding-left: 10px">{{ $t('webmsg.type') }}</span>
|
||||
<span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span">
|
||||
{{ $t(channel.channelName) }}
|
||||
</span>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 5px">
|
||||
<el-tree
|
||||
:props="defaultProps"
|
||||
:data="treeData"
|
||||
default-expand-all
|
||||
:node-key="defaultProps.id"
|
||||
:highlight-current="highlightCurrent"
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node">
|
||||
<span>
|
||||
<span style="margin-left: 6px">{{ $t('webmsg.' + data.name) }}</span>
|
||||
</span>
|
||||
<span @click.stop>
|
||||
<!-- <div v-if="setting_data[data.id]">
|
||||
<span v-for="channel in setting_data[data.id]" :key="channel.channelId" class="auth-span">
|
||||
<a href="javascript:;" @click="clickAuth(data.id,channel)">
|
||||
<svg-icon style="width: 25px;height: 25px" :icon-class="channel.enable ? 'lock_open' : 'lock_closed'" />
|
||||
</a>
|
||||
</span>
|
||||
</div> -->
|
||||
<div>
|
||||
<span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span">
|
||||
<a href="javascript:;" @click="clickAuth(node,channel)">
|
||||
<svg-icon style="width: 25px;height: 25px" :icon-class="checkBoxStatus(node, channel)?'lock_open':'lock_closed'" />
|
||||
</a>
|
||||
</span>
|
||||
</div></span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</layout-content>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import { treeList, channelList, settingList, updateSetting } from '@/api/system/msg'
|
||||
export default {
|
||||
name: 'LazyTree',
|
||||
components: { LayoutContent },
|
||||
|
||||
data() {
|
||||
return {
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
id: 'id'
|
||||
},
|
||||
highlightCurrent: true,
|
||||
|
||||
msg_channels: [],
|
||||
setting_data: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
created() {
|
||||
this.loadChannelData()
|
||||
this.loadSettingData(this.loadTreeData)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 加载树节点数据
|
||||
loadTreeData() {
|
||||
treeList().then(res => {
|
||||
this.treeData = res.data
|
||||
})
|
||||
},
|
||||
// 加载消息渠道
|
||||
loadChannelData() {
|
||||
channelList().then(res => {
|
||||
this.msg_channels = res.data
|
||||
})
|
||||
},
|
||||
// 加载用户设置信息
|
||||
loadSettingData(callBack) {
|
||||
// this.setting_data = {}
|
||||
const temp_setting_data = {}
|
||||
settingList().then(res => {
|
||||
const lists = res.data
|
||||
lists.forEach(item => {
|
||||
const key = item.typeId
|
||||
if (!Object.keys(temp_setting_data).includes(key)) {
|
||||
temp_setting_data[key] = []
|
||||
}
|
||||
temp_setting_data[key].push(item)
|
||||
})
|
||||
this.setting_data = temp_setting_data
|
||||
callBack && callBack()
|
||||
})
|
||||
},
|
||||
checkBoxStatus(node, channel) {
|
||||
const nodeId = node.data.id
|
||||
return this.setting_data[nodeId] && this.setting_data[nodeId].some(item => item.channelId === channel.msgChannelId && item.enable)
|
||||
},
|
||||
clickAuth(node, channel) {
|
||||
// const status = this.checkBoxStatus(nodeId, channel)
|
||||
const param = {
|
||||
typeId: node.data.id,
|
||||
channelId: channel.msgChannelId
|
||||
}
|
||||
updateSetting(param).then(res => {
|
||||
this.loadSettingData()
|
||||
// node.checked = true
|
||||
})
|
||||
},
|
||||
nodeClick(data, node) {
|
||||
console.log(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.tree-main{
|
||||
height: calc(100vh - 210px);
|
||||
border: 1px solid #e6e6e6;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.tree-head{
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
background-color: #f7f8fa;
|
||||
font-size: 12px;
|
||||
color: #3d4d66 ;
|
||||
}
|
||||
|
||||
.auth-span{
|
||||
float: right;
|
||||
width:50px;
|
||||
margin-right: 30px
|
||||
}
|
||||
.highlights-text {
|
||||
color: #faaa39 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
|
||||
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
|
||||
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
|
||||
<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>
|
||||
|
||||
</el-radio-group>
|
||||
<complex-table
|
||||
@@ -45,9 +45,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
|
||||
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
|
||||
<span>{{ getTypeName(scope.row.typeId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import ComplexTable from '@/components/business/complex-table'
|
||||
import { query, updateStatus, batchRead } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName } from '@/utils/webMsg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
|
||||
@@ -100,6 +100,10 @@ export default {
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
created() {
|
||||
// 先加载消息类型
|
||||
loadMsgTypes()
|
||||
},
|
||||
methods: {
|
||||
select(selection) {
|
||||
},
|
||||
@@ -124,13 +128,13 @@ export default {
|
||||
})
|
||||
},
|
||||
getTypeName(value) {
|
||||
return getTypeName(value)
|
||||
return this.$t('webmsg.' + getTypeName(value))
|
||||
},
|
||||
typeChange(value) {
|
||||
this.search()
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
this.setReaded(row)
|
||||
},
|
||||
|
||||
@@ -75,11 +75,12 @@ export default {
|
||||
methods: {
|
||||
toMsgShare(routerParam) {
|
||||
if (routerParam !== null && routerParam.msgNotification) {
|
||||
// 说明是从消息通知跳转过来的
|
||||
if (routerParam.msgType === 0) { // 是仪表板分享
|
||||
const panelShareTypeIds = [1, 2, 3]
|
||||
// 说明是从消息通知跳转过来的
|
||||
if (panelShareTypeIds.includes(routerParam.msgType)) { // 是仪表板分享
|
||||
this.componentName = 'PanelMain'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.panel_main.msg2Current(routerParam.sourceParam)
|
||||
this.$refs.panel_main && this.$refs.panel_main.msg2Current && this.$refs.panel_main.msg2Current(routerParam.sourceParam)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user