初始化代码
This commit is contained in:
@@ -45,6 +45,7 @@ import request from '@/utils/request' // 实现 form generator 使用自己定
|
||||
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels, flexWidth } from '@/utils/nladmin'
|
||||
|
||||
import { getValueByCode } from '@/api/system/param'
|
||||
import VueBus from 'vue-bus'
|
||||
|
||||
LogicFlow.use(Menu)
|
||||
|
||||
@@ -67,6 +68,7 @@ Vue.use(VueHighlightJS)
|
||||
Vue.use(mavonEditor)
|
||||
Vue.use(permission)
|
||||
Vue.use(dict)
|
||||
Vue.use(VueBus)
|
||||
// 全局设置控件样式https://codeantenna.com/a/0IN5FMJk5h
|
||||
Element.Table.props.border = { type: Boolean, default: true }
|
||||
Element.TableColumn.props.align = { type: String, default: 'center' }
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<template>
|
||||
<el-popover
|
||||
v-model="visible"
|
||||
placement="top-end"
|
||||
width="900"
|
||||
width="450"
|
||||
trigger="manual"
|
||||
v-model="visible">
|
||||
点击信息标识已读
|
||||
<div style="margin: 5px" v-loading="loading">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick" >
|
||||
<el-tab-pane :label="d.label" :name="d.value" v-for="d in dict.notice_type" :key="d.id" >
|
||||
<el-empty v-if="notReadMsgList && notReadMsgList[d.value-1] && notReadMsgList[d.value-1].length === 0" description="暂无信息" ></el-empty>
|
||||
>
|
||||
<div v-loading="loading" style="margin: 5px">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane v-for="d in dict.notice_type" :key="d.id" :label="d.label" :name="d.value">
|
||||
<el-empty v-if="notReadMsgList && notReadMsgList[d.value-1] && notReadMsgList[d.value-1].length === 0" description="暂无信息" />
|
||||
<div v-for="o in notReadMsgList[d.value-1]" :key="o.notice_id">
|
||||
<a href="javascript:" @click="showMessage(o)">
|
||||
<el-row @click="showMessage">
|
||||
<el-col :span="2">
|
||||
<el-col :span="6">
|
||||
<el-tag type="danger">{{ dict.label.notice_type[o.notice_type] }}</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="15" style="font-weight: bolder">{{o.notice_title}}</el-col>
|
||||
<el-col :span="7" style="color: #cccccc">{{o.create_time}}</el-col>
|
||||
<el-col :span="9" style="font-weight: bolder">{{ o.notice_title }}</el-col>
|
||||
<el-col :span="9" style="color: #cccccc">{{ o.create_time }}</el-col>
|
||||
</el-row>
|
||||
<el-divider ></el-divider>
|
||||
<el-divider />
|
||||
</a>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div style="text-align: right">
|
||||
<el-button type="text" @click="visible = !visible">取消</el-button>
|
||||
<el-button type="text" @click="toSiteMessage" >查看更多>></el-button>
|
||||
<el-button type="text" @click="toSiteMessage">查看更多>></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="reference" @click="fetchNotice">
|
||||
<el-badge :value="notReadMsgCount" :hidden="notReadMsgCount==0">
|
||||
<el-icon class="el-icon-bell" style="font-size: 22px;"></el-icon>
|
||||
<el-icon class="el-icon-bell" style="font-size: 22px;" />
|
||||
</el-badge>
|
||||
</span>
|
||||
</el-popover>
|
||||
@@ -39,7 +39,6 @@
|
||||
<script>
|
||||
import crudNotice from './sysNotice'
|
||||
import { NOTICE_MESSAGE_UPDATE, NOTICE_SHOW_MESSAGE } from './VueBaseCode'
|
||||
import crudStage from '@/api/logicflow/stage'
|
||||
export default {
|
||||
dicts: ['deal_status', 'have_read_type', 'notice_type'],
|
||||
name: 'NoticeIcon',
|
||||
@@ -47,7 +46,7 @@ export default {
|
||||
return {
|
||||
loading: false,
|
||||
visible: false,
|
||||
activeName: '2',
|
||||
activeName: '1',
|
||||
// 未读消息数量
|
||||
notReadMsgCount: 0,
|
||||
// 消息内容
|
||||
@@ -57,6 +56,14 @@ export default {
|
||||
beforeMount() {
|
||||
this.getMessage()
|
||||
},
|
||||
mounted() {
|
||||
this.getMessage()
|
||||
this.receivedCount()
|
||||
this.$bus.on(NOTICE_MESSAGE_UPDATE, this.receivedCount) // 监听事件
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_MESSAGE_UPDATE)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 打开列表页
|
||||
@@ -87,19 +94,6 @@ export default {
|
||||
this.notReadMsgCount = res
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
// js提供的clearInterval方法用来清除定时器
|
||||
console.log('定时器销毁')
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
// 定时获取消息数量
|
||||
initStageData() {
|
||||
// todo: 定时器
|
||||
this.timer = setInterval(() => {
|
||||
console.log('定时器启动')
|
||||
this.receivedCount()
|
||||
}, 50000)
|
||||
},
|
||||
/**
|
||||
* 查看消息
|
||||
*/
|
||||
@@ -107,7 +101,6 @@ export default {
|
||||
// 标记已读
|
||||
crudNotice.read(message.notice_id).then(() => {
|
||||
this.receivedCount()
|
||||
this.getMessage()
|
||||
})
|
||||
this.$bus.emit(NOTICE_SHOW_MESSAGE, message)
|
||||
this.visible = false
|
||||
@@ -125,15 +118,6 @@ export default {
|
||||
// console.log(this.dict.notice_type)
|
||||
// console.log(tab, event)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getMessage()
|
||||
this.receivedCount()
|
||||
this.initStageData()
|
||||
this.$bus.on(NOTICE_MESSAGE_UPDATE, this.receivedCount) // 监听事件
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_MESSAGE_UPDATE)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -4,19 +4,20 @@
|
||||
:visible.sync="visible"
|
||||
:modal-append-to-body="false"
|
||||
:append-to-body="true"
|
||||
width="60%">
|
||||
width="40%"
|
||||
>
|
||||
<div style="margin-top: 5px">
|
||||
<el-descriptions class="margin-top" :column="3" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-user"></i>
|
||||
<i class="el-icon-user" />
|
||||
标题
|
||||
</template>
|
||||
{{message.notice_title}}
|
||||
{{ message.notice_title }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-mobile-phone"></i>
|
||||
<i class="el-icon-mobile-phone" />
|
||||
信息类型
|
||||
</template>
|
||||
<el-tag size="small" type="danger">
|
||||
@@ -25,14 +26,14 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-location-outline"></i>
|
||||
<i class="el-icon-location-outline" />
|
||||
创建时间
|
||||
</template>
|
||||
{{ message.create_time }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-tickets"></i>
|
||||
<i class="el-icon-tickets" />
|
||||
处理情况
|
||||
</template>
|
||||
<el-tag size="small" type="warning">
|
||||
@@ -41,10 +42,10 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-office-building"></i>
|
||||
<i class="el-icon-office-building" />
|
||||
内容
|
||||
</template>
|
||||
{{message.notice_content}}
|
||||
{{ message.notice_content }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
@@ -86,6 +87,13 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 绑定查看站内信消息事件
|
||||
this.$bus.on(NOTICE_SHOW_MESSAGE, this.show)
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_SHOW_MESSAGE)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 显示消息内容
|
||||
@@ -106,13 +114,6 @@ export default {
|
||||
handleCancel() {
|
||||
this.visible = false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 绑定查看站内信消息事件
|
||||
this.$bus.on(NOTICE_SHOW_MESSAGE, this.show)
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_SHOW_MESSAGE)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -108,25 +108,25 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="fault_code" label="故障编码" show-overflow-tooltip />
|
||||
<el-table-column prop="fault_info" label="故障信息 " show-overflow-tooltip width="150px" />
|
||||
<el-table-column prop="fault_type" label="异常类型 " show-overflow-tooltip width="100px" :formatter="formatType" />
|
||||
<el-table-column prop="solve_mode" label="解决方式" show-overflow-tooltip width="300px" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150" />
|
||||
<el-table-column prop="update_name" label="修改者" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||
<el-table-column prop="fault_code" label="故障编码" :min-width="flexWidth('fault_code',crud.data,'故障编码')" />
|
||||
<el-table-column prop="fault_info" label="故障信息" :min-width="flexWidth('fault_info',crud.data,'故障信息')" />
|
||||
<el-table-column prop="fault_type" label="异常类型" :min-width="flexWidth('fault_type',crud.data,'异常类型')" :formatter="formatType" />
|
||||
<el-table-column prop="solve_mode" label="解决方式" :min-width="flexWidth('solve_mode',crud.data,'解决方式')" />
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改者" :min-width="flexWidth('update_name',crud.data,'修改者')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column
|
||||
v-permission="['admin','customerbase:edit','customerbase:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
width="90px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-dle="true"
|
||||
:is-visiable-del="false"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -178,7 +178,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
permission: {
|
||||
edit: ['admin', 'customerbase:edit'],
|
||||
del: ['admin', 'customerbase:del']
|
||||
},
|
||||
syncLoading: false,
|
||||
rules: {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user