NEZ-2209 feat:chart template&expression template批量导入页面开发

This commit is contained in:
zyh
2022-09-21 11:20:34 +08:00
parent b2c6d53423
commit aadb618c80
4 changed files with 22 additions and 25 deletions

View File

@@ -23,10 +23,10 @@
<slot name="after"></slot>
</el-dropdown-menu>
<el-dialog :close-on-click-modal="importBox.type!=3" destroy-on-close :show-close="true" :title="importBox.title" :visible.sync="importBox.show" :width="importBox.width" append-to-body class="nz-dialog" @close="closeDialog">
<el-dialog :close-on-click-modal="importBox.type!=3" destroy-on-close :show-close="true" :title="importBox.title" :visible.sync="importBox.show" width="580px" append-to-body class="nz-dialog" @close="closeDialog">
<!-- 新版导入 -->
<div v-if="importBox.type == 1&&importType">
<div v-if="importBox.type == 1&&importNew">
<div class="upload-body">
<el-upload :id="id+'-xlsx-input-file'" ref="uploadExcel" :auto-upload="false" :file-list="importFileList" :on-change="importChange" accept=".xlsx,.xls,.csv,.json" action="" class="import-upload" drag>
<i class="el-icon-upload"></i>
@@ -239,8 +239,8 @@ export default {
computed: {
language () { return this.$store.getters.getLanguage },
// 显示新版导入
importType () {
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp
importNew () {
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp panel expression
const arr = [
'/asset/asset/import',
'/monitor/module/import',
@@ -250,13 +250,15 @@ export default {
'/asset/model/import',
'/alert/rule/import',
'/ipam/subnet/import',
'/ipam/ip/import'
'/ipam/ip/import',
'/visual/panel/import',
'/expression/tmpl/import'
]
return arr.some(item => item === this.importUrl)
},
// 已存在的内容处理方式
showEexisted () {
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp panel expression
const arr = [
'/asset/asset/import',
'/monitor/module/import',
@@ -266,13 +268,15 @@ export default {
'/asset/model/import',
'/alert/rule/import',
'/ipam/subnet/import',
'/ipam/ip/import'
'/ipam/ip/import',
'/visual/panel/import',
'/expression/tmpl/import'
]
return arr.some(item => item === this.importUrl)
},
// 遇到错误是否继续导入
showIgnoreError () {
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp
// asset module endpoint dc cabinet model alertRule ipamSubnet ipamIp panel expression
const arr = [
'/asset/asset/import',
'/monitor/module/import',
@@ -282,7 +286,9 @@ export default {
'/asset/model/import',
'/alert/rule/import',
'/ipam/subnet/import',
'/ipam/ip/import'
'/ipam/ip/import',
'/visual/panel/import',
'/expression/tmpl/import'
]
return arr.some(item => item === this.importUrl)
},
@@ -395,7 +401,7 @@ export default {
if (this.importFile && this.importFile.raw) {
this.prevent_opt.import = true
const form = new FormData()
if (this.importType) {
if (this.importNew) {
form.append('file', this.importFile.raw)
} else {
form.append('excelFile', this.importFile.raw)
@@ -428,7 +434,6 @@ export default {
const linkId = this.link ? this.link.id : ''
this.$emit('afterImport', linkId)
this.importBox.type = 3
this.importBox.width = '600px'
this.importBox.title = this.$t('overall.importResult')
} else {
this.$message.error(response.msg)
@@ -688,10 +693,8 @@ export default {
}
if (type == 1) { // import
this.importBox.title = this.$t('overall.importExcel')
this.importBox.width = '600px'
} else if (type == 2) { // export
this.importBox.title = this.$t('overall.exportExcel')
this.importBox.width = '580px'
// if (this.exportBoxShow) {
// this.formatArr = [
// { name: 'XLSX', value: 1 },

View File

@@ -19,8 +19,7 @@
<i class="nz-icon nz-icon-funnel"></i>
</button>
<pick-time v-model="searchTime" sign="message" :default-pick="10" :refresh-data-func="getTableData" :show-empty="true" :use-chart-unit="false" :use-refresh="false"></pick-time>
<button id="roles-add" v-has="'alertMessage_view'" :title="$t('overall.exportExcel')" class="top-tool-btn margin-r-10"
type="button" @click="showExportDialog">
<button id="roles-add" v-has="'alertMessage_view'" :title="$t('overall.exportExcel')" class="top-tool-btn margin-r-10" type="button" @click="showExportDialog">
<i class="nz-icon-download1 nz-icon"></i>
</button>
<top-tool-more-options
@@ -92,7 +91,7 @@
</nz-data-list>
<!--导出-->
<div class="export-xlsx">
<el-dialog :modal-append-to-body='false' :show-close="true" :title="importBox.title" :visible.sync="importBox.show" class="nz-dialog" width="600px" @close="closeDialog">
<el-dialog :modal-append-to-body='false' :show-close="true" :title="importBox.title" :visible.sync="importBox.show" class="nz-dialog" width="580px" @close="closeDialog">
<div class="upload-body" style="height: 170px">
<div class="export-box">
<span class="export-title">Records</span>
@@ -160,9 +159,7 @@
></alertMessageInfo>
</el-dialog>
<!--全屏-->
<el-dialog class="nz-dialog table-chart-dialog" :title="$t('alert.config.trbShot')"
:visible.sync="dialogShowText"
width="96%" @close="dialogShowText = false" :modal-append-to-body="false">
<el-dialog class="nz-dialog table-chart-dialog" :title="$t('alert.config.trbShot')" :visible.sync="dialogShowText" width="96%" @close="dialogShowText = false" :modal-append-to-body="false">
<div slot="title">
<span class="nz-dialog-title">{{$t('alert.config.trbShot')}}</span>
</div>

View File

@@ -11,8 +11,7 @@
@getTableData="getTableData"
>
<template v-slot:top-tool-right>
<button id="expr-tmpl-list-export" v-has="'expressionTemplate_add'" :title="$t('overall.createTemplate')" class="top-tool-btn margin-r-10"
type="button" @click="add">
<button id="expr-tmpl-list-export" v-has="'expressionTemplate_add'" :title="$t('overall.createTemplate')" class="top-tool-btn margin-r-10" type="button" @click="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options

View File

@@ -10,8 +10,7 @@
@search="search"
>
<template v-slot:top-tool-right>
<button id="expr-tmpl-list-export" v-has="'expressionTemplate_add'" :title="$t('overall.createTemplate')" class="top-tool-btn"
type="button" @click="add">
<button id="expr-tmpl-list-export" v-has="'expressionTemplate_add'" :title="$t('overall.createTemplate')" class="top-tool-btn" type="button" @click="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
@@ -74,8 +73,7 @@
</transition>
<!--导出-->
<div class="export-xlsx">
<el-dialog :visible.sync="importBox.show" :title="importBox.title" :modal-append-to-body='false'
:show-close="true" width="300px" @close="closeDialog" class="nz-dialog">
<el-dialog :visible.sync="importBox.show" :title="importBox.title" :modal-append-to-body='false' :show-close="true" width="300px" @close="closeDialog" class="nz-dialog">
<div class="upload-body">
<button @click="exportCur" class="el-button el-button--default el-button--small" id="alert-msg-exportcur">
<span>{{$t('overall.current')}}</span>