2021-04-13 20:33:12 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
id="mibTable"
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
:height="height"
|
|
|
|
|
|
border
|
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="55">
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index) in customTableTitle"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
|
:resizable="true"
|
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
2021-05-07 19:10:28 +08:00
|
|
|
|
:sortable="item.sortable"
|
2021-04-13 20:33:12 +08:00
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
|
class="data-column"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot="header">
|
2021-05-25 17:58:38 +08:00
|
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<template v-if="item.prop == 'updateUser'" >{{scope.row[item.prop].name}}</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'fileName' && scope.row[item.prop]" >
|
|
|
|
|
|
<span class="link" @click="downloadMib(scope.row)">{{scope.row[item.prop]}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop === 'modelsDetail' && scope.row['modelsDetail'] && scope.row['modelsDetail'].length >0" >
|
|
|
|
|
|
<div style="height: 100%">
|
|
|
|
|
|
<div style="height: 100%; overflow: auto;">
|
|
|
|
|
|
<div v-for="(n,i) in scope.row['modelsDetail']" :key="n.name+'-'+n.id+'-'+i" class="detail-item-content">
|
2021-10-25 17:16:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="click" >
|
2021-04-13 20:33:12 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span>{{$t('overall.name')}}:</span>
|
|
|
|
|
|
<span>{{n.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span>{{$t('config.mib.vendor')}}:</span>
|
|
|
|
|
|
<span>{{n.vendor}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span>{{$t('config.mib.type')}}:</span>
|
|
|
|
|
|
<span>{{n.type}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template slot="reference">
|
|
|
|
|
|
<div v-if="i < scope.row['modelsDetail'].length-1" class="detail-item-content">{{n.name}},</div>
|
|
|
|
|
|
<div v-else class="detail-item-content">{{n.name}}</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<span v-else-if="item.prop === 'updateAt'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
|
|
|
|
|
|
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
|
fixed="right">
|
|
|
|
|
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
|
<div slot-scope="scope" class="table-operation-items">
|
|
|
|
|
|
<button class="table-operation-item" title="Download" @click="downloadMib(scope.row)"><i class="nz-icon nz-icon-download"></i></button>
|
2021-10-25 17:16:40 +08:00
|
|
|
|
<el-dropdown size="medium" v-has="['snmp_mibFile_edit','snmp_mibFile_delete']" trigger="click" @command="tableOperation">
|
2021-04-13 20:33:12 +08:00
|
|
|
|
<div class="table-operation-item table-operation-item--more">
|
2021-05-27 13:53:42 +08:00
|
|
|
|
<i class="nz-icon nz-icon-more3"></i>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</div>
|
2021-09-26 18:14:47 +08:00
|
|
|
|
<el-dropdown-menu slot="dropdown" class="right-public-box-select-top right-public-box-dropdown-top">
|
2021-05-19 14:26:09 +08:00
|
|
|
|
<el-dropdown-item v-has="'snmp_mibFile_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
2021-05-19 14:04:16 +08:00
|
|
|
|
<el-dropdown-item v-has="'snmp_mibFile_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-table-column>
|
2021-10-22 19:39:49 +08:00
|
|
|
|
<template slot="empty">
|
2021-10-25 14:45:28 +08:00
|
|
|
|
<div v-if="!loading" class="table-no-data">
|
2021-10-22 17:47:42 +08:00
|
|
|
|
<svg class="icon" aria-hidden="true">
|
|
|
|
|
|
<use xlink:href="#nz-icon-no-data-list"></use>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
<div style="font-size: 16px;color: #333333;font-weight: 400;">No results found</div>
|
|
|
|
|
|
</div>
|
2021-10-22 19:39:49 +08:00
|
|
|
|
<div v-else> </div>
|
2021-10-22 17:47:42 +08:00
|
|
|
|
</template>
|
2021-04-13 20:33:12 +08:00
|
|
|
|
</el-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import table from '@/components/common/mixin/table'
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
export default {
|
2021-05-12 14:46:03 +08:00
|
|
|
|
name: 'mibTable',
|
2021-04-13 20:33:12 +08:00
|
|
|
|
mixins: [table],
|
2021-10-22 17:47:42 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
loading: Boolean
|
|
|
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
2021-05-07 19:10:28 +08:00
|
|
|
|
width: 80,
|
2021-05-18 20:45:46 +08:00
|
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.name'),
|
|
|
|
|
|
prop: 'name',
|
2021-05-07 19:10:28 +08:00
|
|
|
|
show: true,
|
2021-08-02 15:41:43 +08:00
|
|
|
|
sortable: 'custom',
|
|
|
|
|
|
minWidth: 200
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.mib.fileName'),
|
|
|
|
|
|
prop: 'fileName',
|
2021-08-02 15:41:43 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 100
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.mib.models'),
|
|
|
|
|
|
prop: 'modelsDetail',
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}, {
|
2021-06-07 18:28:07 +08:00
|
|
|
|
label: this.$t('overall.remark'),
|
2021-04-13 20:33:12 +08:00
|
|
|
|
prop: 'remark',
|
2021-08-02 15:41:43 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 100
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.mib.updateUser'),
|
|
|
|
|
|
prop: 'updateUser',
|
2021-08-02 15:41:43 +08:00
|
|
|
|
show: false,
|
|
|
|
|
|
minWidth: 120
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.mib.updateAt'),
|
|
|
|
|
|
prop: 'updateAt',
|
2021-08-02 15:41:43 +08:00
|
|
|
|
show: false,
|
|
|
|
|
|
minWidth: 150
|
2021-04-13 20:33:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
downloadMib (mib) {
|
|
|
|
|
|
axios.get('/mib/download?id=' + mib.id, { responseType: 'blob' }).then(data => {
|
|
|
|
|
|
let fileName = new Date().getTime() + '.txt'
|
|
|
|
|
|
const disposition = data.headers['content-disposition']
|
|
|
|
|
|
if (disposition) {
|
|
|
|
|
|
fileName = disposition.split(';')[1].split('filename=')[1]
|
|
|
|
|
|
}
|
|
|
|
|
|
// 由于ie不支持download属性,故需要做兼容判断
|
|
|
|
|
|
if (navigator.appVersion.toString().indexOf('.NET') > 0) {
|
|
|
|
|
|
// ie独有的msSaveBlob属性,data.data为Blob文件流
|
|
|
|
|
|
window.navigator.msSaveBlob(data.data, fileName)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 以下流程即为文章开始的下载流程
|
|
|
|
|
|
const url = window.URL.createObjectURL(data.data)
|
|
|
|
|
|
const link = document.createElement('a')
|
|
|
|
|
|
link.style.display = 'none'
|
|
|
|
|
|
link.href = url
|
|
|
|
|
|
link.download = fileName
|
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
|
link.click()
|
|
|
|
|
|
window.URL.revokeObjectURL(link.href)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|