| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <template>
- <div class="history-table">
- <div class="my-box">
- <i-Table stripe :columns="columns1" :data="historyTableData" size="large" @on-sort-change="onSortChange"></i-Table>
- <div style="margin: 10px;overflow: hidden" v-if="historyTableData.length>0">
- <div style="float: right;margin-right:100px;">
- <Page :total="total" :current="current" :pageSize='pageSize' @on-page-size-change="_nowPageSize"
- @on-change="changePage">
- </Page>
- </div>
- </div>
- </div>
- <div class="mask-bg"></div>
- <div id="messageBox" v-if="itemsData">
- <pomp-box :itemsData="itemsData" :detailData='detailData' :emailName='emailName' :messageName='messageName' @onClose="close"></pomp-box>
- </div>
- </div>
- </template>
- <script>
- import pompBox from './PompBox'
- // import { formatTime, toHourMinute} from '../../tools/formatTime.js'
- import axios from 'axios'
- export default {
- components: {
- pompBox
- },
- mixins: [],
- props: ['historyTableData', 'total', 'current', 'pageSize'],
- data () {
- return {
- itemsData: {},
- emailName: [],
- messageName: [],
- detailData: {},
- columns1: [
- {
- title: "重要级别",
- key: "level",
- sortable: 'custom',
- render: (h, params) => {
- const text = params.row.level + '级'
- if (params.row.level == 'S') {
- return h('div', [
- h('img', {
- attrs: {
- src: '/static/img/ernomal.png'
- },
- style: {
- marginRight: '5px',
- verticalAlign: 'middle',
- marginTop: '-3px'
- }
- }),
- h('span', {
- style: {
- color: '#F08378'
- }
- }, '' + text)
- ])
- } else if (params.row.level == 'A') {
- return h('div', [
- h('span', {
- style: {
- color: '#F08378',
- marginLeft: '10px'
- }
- }, '' + text)
- ])
- } else if (params.row.level == 'B') {
- return h('div', [
- h('span', {
- style: {
- color: '#F3B767',
- marginLeft: '10px'
- }
- }, '' + text)
- ])
- } else {
- return h('div', [
- h('span', {
- style: {
- marginLeft: '10px'
- }
- }, '' + text)
- ])
- }
- }
- },
- {
- title: "报警类型",
- key: "type"
- },
- {
- title: "报警内容",
- key: "content",
- width: 400,
- className: "description-td",
- render: (h, params) => {
- const content = params.row.content ? params.row.content : ""
- if (content) {
- const text1 = content.split("/")[0]
- const text2 = content.split("/")[1]
- return h('div', [
- h('span', {
- style: {
- marginRight: '18px'
- }
- }, text1),
- h('span', {
- style: {
- color: "#A6ADB5"
- }
- }, text2)
- ])
- }
- }
- },
- {
- title: "报警开始时间",
- key: "cTime",
- sortable: 'custom'
- },
- {
- title: "报警持续时间",
- key: "durationT",
- sortable: 'custom',
- align: 'right'
- },
- {
- title: "报警状态",
- key: "status",
- align: 'center',
- render: (h, params) => {
- const status = params.row.status
- if (status == 'alarm') {
- return h('div', [
- h('Button', {
- props: {
- type: 'text',
- size: 'small'
- },
- style: {
- color: '#F08378'
- }
- }, '未恢复')
- ])
- } else {
- return h('div', [
- h('Button', {
- props: {
- type: 'text',
- size: 'small'
- },
- style: {
- color: '#3BC6A1'
- }
- }, '已恢复')
- ])
- }
- }
- },
- {
- title: "处理情况",
- key: "deal",
- align: 'center',
- render: (h, params) => {
- const deal = params.row.deal
- const status = params.row.event ? params.row.event.status : ""
- const id = params.row.event ? params.row.event.id : ""
- if (deal == 0) {
- return h('div', [
- h('Button', {
- props: {
- size: 'small'
- },
- style: {
- marginRight: '5px',
- color: '#728DEE',
- border: '1px solid #728DEE'
- },
- on: {
- click: () => {
- this.handleClick(params.row)
- }
- }
- }, '需手动处理')
- ])
- }
- if (deal == 1) {
- const text = '工单状态:' + status + '工单编号:' + id
- return h('div', [
- h('img', {
- attrs: {
- src: '/static/img/bill.png'
- },
- style: {
- marginRight: '5px',
- verticalAlign: 'middle'
- }
- }),
- h('span', {
- style: {
- marginRight: '5px',
- color: '#6D747C',
- cursor: 'pointer'
- },
- on: {
- click: () => {
- this.handleClick(params.row)
- }
- }
- }, text)
- ])
- }
- if (deal == 2) {
- const text = '事件状态:' + status + '事件编号:' + id
- return h('div', [
- h('img', {
- attrs: {
- src: '/static/img/event.png'
- },
- style: {
- marginRight: '5px',
- verticalAlign: 'middle'
- }
- }),
- h('span', {
- style: {
- marginRight: '5px',
- color: '#6D747C',
- cursor: 'pointer'
- },
- on: {
- click: () => {
- this.handleClick(params.row)
- }
- }
- }, text)
- ])
- }
- if (deal == 3) {
- const text = '上级线路已断,此条自动隐藏'
- return h('div', [
- h('span', {
- style: {
- marginRight: '5px',
- color: '#6D747C',
- cursor: 'pointer'
- },
- on: {
- click: () => {
- this.handleClick(params.row)
- }
- }
- }, text)
- ])
- }
- }
- }
- ]
- }
- },
- computed: {
- },
- mounted () {
- },
- methods: {
- // iview的排序
- onSortChange (col) {
- this.$emit('setSort', col)
- },
- // 每页显示的数据条数
- _nowPageSize (index) {
- // 实时获取当前需要显示的条数
- this.pageSize = index
- },
- changePage (index) {
- this.$emit('changeCurrentPage', index)
- },
- handleClick (row) {
- document.querySelector('.mask-bg').style.display = 'block'
- document.querySelector('#messageBox').style.display = 'block'
- this.itemsData = row
- this.getEamilInfo(row)
- },
- getEamilInfo (row) {
- let params = {
- id: row.id
- }
- axios.post(`/alarm-system/alarm-system/alarm/detail/query?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
- let data = res.data
- if (data.Result == 'success') {
- this.detailData = data.Content
- if (data.Content && data.Content.notification) {
- let emailName = data.Content.notification.mail ? data.Content.notification.mail : []
- let messageName = data.Content.notification.message ? data.Content.notification.message : []
- this.emailName = []
- if (emailName.length > 0) {
- emailName.forEach(el => {
- this.emailName.push(el.name)
- })
- }
- this.messageName = []
- if (messageName.length > 0) {
- messageName.forEach(el => {
- this.messageName.push(el.name)
- })
- } else {
- this.messageName = []
- this.emailName = []
- }
- }
- }
- })
- },
- close () {
- document.querySelector('.mask-bg').style.display = 'none'
- document.querySelector('#messageBox').style.display = 'none'
- }
- }
- }
- </script>
- <style scoped lang="less" >
- .history-table {
- .my-box{
- padding: 0 20px 20px 24px;
- background: #fff;
- }
- .mask-bg {
- position: fixed;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: 99;
- background:rgba(0, 0, 0, .6);
- display: none;
- }
- #messageBox{
- width: 747px;
- height: 630px;
- background: #fff;
- box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12);
- border-radius: 4px;
- z-index: 999;
- position: fixed;
- top: 70px;
- left: 50%;
- margin-left: -360px;
- display: none;
- }
- }
- </style>
- <style lang="less">
- .history-table{
- .ivu-table-wrapper {
- border: none;
- }
- .ivu-table td,
- .ivu-table th {
- border: none;
- }
- .ivu-table:before{
- height: 0;
- }
- .ivu-table:after{
- width:0;
- }
- .ivu-table-row .description-td>.ivu-table-cell>span{
- // overflow: hidden;
- // text-overflow: ellipsis;
- // white-space: nowrap;
- max-height: 100px;
- display: inline-block;
- }
- }
- </style>
|