feat(src/views/node-exporter|rds|redis/self.vue): 新增模板下载

新增模板下载,便于导入操作
pull/84/head
uliian 2023-08-08 14:52:01 +08:00
parent 6fdb143f7d
commit 0c163ebbcd
3 changed files with 18 additions and 9 deletions

View File

@ -19,9 +19,12 @@
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate"> <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
新增 新增
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload"> <el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload(false)">
导出 导出
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="info" icon="el-icon-notebook-2" @click="handleDownload(true)">
模板下载
</el-button>
<el-upload <el-upload
style="margin-right: 9px;" style="margin-right: 9px;"
class="upload-demo" class="upload-demo"
@ -523,12 +526,12 @@ export default {
}) })
}) })
}, },
handleDownload() { handleDownload(templateOnly) {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '系统(linux/windows)'] const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '系统(linux/windows)']
const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os'] const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os']
const data = this.formatJson(filterVal) const data = templateOnly ? [] : this.formatJson(filterVal)
excel.export_json_to_excel({ excel.export_json_to_excel({
header: tHeader, header: tHeader,
data, data,

View File

@ -19,9 +19,12 @@
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate"> <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
新增 新增
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload"> <el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload(false)">
导出 导出
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="info" icon="el-icon-notebook-2" @click="handleDownload(true)">
模板下载
</el-button>
<el-upload <el-upload
style="margin-right: 9px;" style="margin-right: 9px;"
class="upload-demo" class="upload-demo"
@ -523,12 +526,12 @@ export default {
}) })
}) })
}, },
handleDownload() { handleDownload(templateOnly) {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '主机系统(linux/windows)'] const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '主机系统(linux/windows)']
const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os'] const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os']
const data = this.formatJson(filterVal) const data = templateOnly ? [] : this.formatJson(filterVal)
excel.export_json_to_excel({ excel.export_json_to_excel({
header: tHeader, header: tHeader,
data, data,

View File

@ -19,9 +19,12 @@
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate"> <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
新增 新增
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload"> <el-button v-waves :loading="downloadLoading" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload(false)">
导出 导出
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="info" icon="el-icon-notebook-2" @click="handleDownload(true)">
模板下载
</el-button>
<el-upload <el-upload
style="margin-right: 9px;" style="margin-right: 9px;"
class="upload-demo" class="upload-demo"
@ -523,12 +526,12 @@ export default {
}) })
}) })
}, },
handleDownload() { handleDownload(templateOnly) {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '主机系统(linux/windows)'] const tHeader = ['机房/公司', '租户/部门', '区域/项目', '分组/环境', '名称', '实例(IP:端口)', '主机系统(linux/windows)']
const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os'] const filterVal = ['vendor', 'account', 'region', 'group', 'name', 'instance', 'os']
const data = this.formatJson(filterVal) const data = templateOnly ? [] : this.formatJson(filterVal)
excel.export_json_to_excel({ excel.export_json_to_excel({
header: tHeader, header: tHeader,
data, data,