NEZ-1137 fix; 导出样式调整

This commit is contained in:
zhangyu
2021-11-02 15:47:17 +08:00
parent e38bdd4e19
commit f6ac483d33
14 changed files with 155 additions and 33 deletions

View File

@@ -34,7 +34,8 @@
<button id="asset-create-asset" v-has="'dc_add'" class="top-tool-btn margin-r-10 margin-l-10" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'panel_chart_add'" :title="$t('overall.createChart')" class="top-tool-btn margin-r-10" @click.stop="addChart">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
id="asset-list"
:params="filter"
:params-type="paramsType"
@@ -53,7 +54,8 @@
<button id="endpoint-create-chart" v-has="'panel_chart_add'" :title="$t('overall.createChart')" class="top-tool-btn margin-r-10" @click.stop="addChart">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
id="asset-list"
:link="obj"
:params="filter"

View File

@@ -172,7 +172,12 @@ const cn = {
clearAllSelect: '清除选择的内容',
disabled: '已禁用',
enabled: '启用',
close: '关闭'
close: '关闭',
records: '导出形式',
fileFormat: '文件格式',
allData: '全部数据',
selectRecords: '选中的数据',
current: '当前页'
},
setup: {
step0: '欢迎',

View File

@@ -177,7 +177,12 @@ const en = {
clearAllSelect: 'Clear the selection',
disabled: 'Disabled',
enabled: 'Enabled',
close: 'Close'
close: 'Close',
records: 'Records',
fileFormat: 'File format',
allData: 'All data',
selectRecords: 'Select records',
current: 'Current page'
},
pageSize: '/page',
setup: {

View File

@@ -43,15 +43,29 @@
</div>
</div>
<div v-if="importBox.type == 2">
<div class="upload-body">
<button :id="id+'-xlsx-export-current'" class="el-button el-button--default el-button--small" @click="exportCur">
<span>{{$t('overall.exportCur')}}</span>
</button>
<button :id="id+'-xlsx-export-all'" class="el-button el-button--default el-button--small" @click="exportAll">
<span>{{$t('overall.exportAll')}}</span>
</button>
<div class="upload-body" style="height: 200px">
<div class="export-box">
<span class="export-title">Records</span>
<el-radio-group v-model="importBox.record" size="small">
<el-radio-button :label="item.value" v-for="(item,index) in recordArr" :key="index" :disabled="item.value==='records'&&!deleteObjs.length">{{item.name}}</el-radio-button>
</el-radio-group>
</div>
<div class="export-box">
<span class="export-title">File format</span>
<el-radio-group v-model="importBox.format" size="small">
<el-radio-button :label="item.value" v-for="(item,index) in formatArr" :key="index" :disabled="item.value!==1">{{item.name}}</el-radio-button>
</el-radio-group>
</div>
</div>
<div slot="footer" class="footer">
<div class="el-message-box__btns">
<button :id="id+'-xlsx-import-export'" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" @click="exportData">
<span style="text-transform:Capitalize">{{$t('config.operationlog.operations.export')}}</span>
</button>
<button :id="id+'-xlsx-import-close'" class="nz-btn el-button el-button--default el-button--small" @click="closeDialog">
<span>{{$t('overall.close')}}</span>
</button>
</div>
</div>
</div>
<div v-if="importBox.type==3">
@@ -138,17 +152,29 @@ export default {
paramsType: {
type: String,
default: ''
}
},
deleteObjs: Array
},
data () {
return {
importBox: { show: false, title: this.$t('overall.importExcel'), type: 1 },
importBox: { show: false, title: this.$t('overall.importExcel'), type: 1, record: 'all', format: 1 },
importFile: null,
importFileList: [],
importResult: null,
exportShow: false,
panelLock: true,
language: localStorage.getItem('nz-language')
language: localStorage.getItem('nz-language'),
recordArr: [
{ name: this.$t('overall.allData'), value: 'all' },
{ name: this.$t('overall.selectRecords'), value: 'records' },
{ name: this.$t('overall.current'), value: 'current' }
],
formatArr: [
{ name: 'XLSX', value: 1 },
{ name: 'CSV', value: 2 },
{ name: 'JSON', value: 3 }
]
}
},
mounted () {
@@ -244,6 +270,8 @@ export default {
this.importResult = null
this.importFileList = []
this.importFile = null
this.importBox.value = 1
this.importBox.record = 'all'
})
},
downloadTemplate () {
@@ -309,6 +337,7 @@ export default {
delete params.searchName
}
params.language = localStorage.getItem('nz-language') || 'en'
params.format = this.importBox.format
this.exportExcel(this.exportUrl, params, this.exportFileName + '-' + this.getTimeString() + '.xlsx')
this.closeDialog()
},
@@ -341,10 +370,53 @@ export default {
// delete params.moduleId
// }
params.language = localStorage.getItem('nz-language') || 'en'
params.format = this.importBox.format
this.exportExcel(this.exportUrl, params, this.exportFileName + '-' + this.getTimeString() + '.xlsx')
this.closeDialog()
},
exportRecords() {
const params = JSON.parse(JSON.stringify(this.params))
if (this.params2) {
Object.keys(this.params2).forEach(key => {
if (params[key]) {
if (params[key].prototype.toString.call(val) === '[object Object]') {
Object.assign(params[key], this.params2[key])
} else if (params[key].prototype.toString.call(val) === '[object Array]') {
params[key].concat(this.params2[key])
}
} else {
params[key] = this.params2[key]
}
})
}
params.pageSize = -1
if (this.exportUrl.indexOf('panel') > -1) {
delete params.start_time
delete params.end_time
delete params.id
delete params.searchName
}
if (this.importUrl.indexOf('panel') > -1) {
delete params.panelId
}
// if (this.importUrl.indexOf('endpoint') > -1){
// delete params.moduleId
// }
params.language = localStorage.getItem('nz-language') || 'en'
params.format = this.importBox.format
params.ids = this.deleteObjs.map(item => item.id).join(',')
this.exportExcel(this.exportUrl, params, this.exportFileName + '-' + this.getTimeString() + '.xlsx')
this.closeDialog()
},
exportData () {
if (this.importBox.record === 'all') {
this.exportAll()
} else if (this.importBox.record === 'current') {
this.exportCur()
} else if (this.importBox.record === 'records') {
this.exportRecords()
}
},
exportExcel (url, params, fileName) {
if (this.paramsType) {
params.type = this.paramsType
@@ -395,7 +467,7 @@ export default {
this.importBox.width = '600px'
} else if (type == 2) { // export
this.importBox.title = this.$t('overall.exportExcel')
this.importBox.width = '300px'
this.importBox.width = '580px'
}
},
getTimeString () {
@@ -434,5 +506,27 @@ export default {
</script>
<style scoped lang="scss">
.export-box{
display: flex;
margin-top: 30px;
align-items: center;
.export-title {
display: inline-block;
width: 100px;
text-align: left;
font-size: 14px;
color: #666666;
letter-spacing: 0;
font-weight: 600;
}
/deep/ .el-radio-group{
flex: 1;
.el-radio-button--small {
width: 142px;
.el-radio-button__inner{
width: 100%;
}
}
}
}
</style>

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"
@@ -87,7 +88,8 @@
@click="add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="alert-rule"
:params="searchLabel"

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"
@@ -92,7 +93,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"
@@ -87,7 +88,8 @@
type="button" @click="add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"

View File

@@ -14,7 +14,8 @@
type="button" @click="add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"

View File

@@ -37,7 +37,8 @@
type="button" @click="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="expression-template-list"
export-url="visual/panel/export"

View File

@@ -22,7 +22,8 @@
type="button" @click="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="expression-template-list"
export-url="expression/tmpl/export"

View File

@@ -47,7 +47,8 @@
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
id="panel"
:params="filter"
:permissions="{
@@ -213,7 +214,8 @@ export default {
panelId: 0,
filterPanel: '',
// ---图表相关参数--end
scrollbarWrap: null
scrollbarWrap: null,
batchDeleteObjs: []
}
},
components: {

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"
@@ -92,7 +93,8 @@
type="button" @click="add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="endpoint-template-list"
:params="searchLabel"

View File

@@ -21,7 +21,8 @@
<button id="asset-create-asset" v-has="'asset_add'" :title="$t('overall.createAsset')" class="top-tool-btn" @click.stop="add">
<i class="nz-icon nz-icon-create-square"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="model"
:params="searchLabel"
@@ -88,7 +89,8 @@
type="button" @click="add">
<i class="nz-icon-create-square nz-icon"></i>
</button>
<top-tool-more-options
<top-tool-more-options
:delete-objs="batchDeleteObjs"
ref="export"
id="endpoint-template-list"
:params="searchLabel"