2021-03-16 17:54:05 +08:00
|
|
|
<template>
|
2021-04-13 20:33:12 +08:00
|
|
|
<div>
|
2021-05-12 11:22:23 +08:00
|
|
|
<nzDataList
|
2021-04-08 20:28:54 +08:00
|
|
|
ref="dataList"
|
2021-04-13 20:33:12 +08:00
|
|
|
:api="url"
|
2021-08-23 18:50:08 +08:00
|
|
|
:layout="['searchInput', 'elementSet', 'pagination']"
|
2021-04-08 20:28:54 +08:00
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
2021-04-25 14:58:03 +08:00
|
|
|
:from="fromRoute.chartTemp"
|
2021-04-29 22:24:38 +08:00
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
@search="search"
|
2021-07-29 16:23:15 +08:00
|
|
|
@getTableData="getTableData"
|
2021-04-29 22:24:38 +08:00
|
|
|
>
|
2021-04-22 18:04:42 +08:00
|
|
|
<template v-slot:top-tool-left>
|
|
|
|
|
<div id="module-type-1" class="nz-tab-item-box" @click="clickTab([],'exprTemp')"><!--v-has="'snmp_browser_view'"-->
|
|
|
|
|
<div class="nz-tab-item">{{$t("config.exprTemp.exprTemp")}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="module-type-2" class="nz-tab-item-box" @click="clickTab([],'chartTemp')"><!--v-has="'snmp_browser_view'"-->
|
|
|
|
|
<div class="nz-tab-item nz-tab-item-active">{{$t("config.chartTemp.chartTemp")}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2021-04-08 20:28:54 +08:00
|
|
|
<template v-slot:top-tool-right>
|
2021-05-12 16:19:43 +08:00
|
|
|
<!-- <export-excel-->
|
|
|
|
|
<!-- id="expression-template-list"-->
|
|
|
|
|
<!-- export-url="expression/tmpl/export"-->
|
|
|
|
|
<!-- import-url="expression/tmpl/import"-->
|
|
|
|
|
<!-- export-file-name="expression-template"-->
|
|
|
|
|
<!-- :params="searchLabel"-->
|
|
|
|
|
<!-- :permissions="{import: 'expressionTemplate_add', export: 'expressionTemplate_view'}"-->
|
|
|
|
|
<!-- @afterImport="getTableData"-->
|
|
|
|
|
<!-- class="top-tool-export margin-r-10"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- <template slot="optionZone">-->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </export-excel>-->
|
|
|
|
|
<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>
|
2021-07-20 10:16:28 +08:00
|
|
|
<top-tool-more-options
|
|
|
|
|
ref="export"
|
|
|
|
|
id="expression-template-list"
|
|
|
|
|
export-url="visual/panel/export"
|
|
|
|
|
import-url="visual/panel/import"
|
2021-07-20 14:31:54 +08:00
|
|
|
export-file-name="chart-temp"
|
2021-07-20 10:16:28 +08:00
|
|
|
:params="searchLabel"
|
|
|
|
|
:params2="{
|
|
|
|
|
panelId:0,
|
|
|
|
|
returnChildren: 0,
|
|
|
|
|
groupId: 0
|
|
|
|
|
}"
|
|
|
|
|
:paramsType="'template'"
|
|
|
|
|
:permissions="{import: 'expressionTemplate_add', export: 'expressionTemplate_view'}"
|
|
|
|
|
class="top-tool-export margin-r-10"
|
|
|
|
|
@afterImport="getTableData"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:before>
|
|
|
|
|
<div>
|
|
|
|
|
<el-dropdown-item>
|
|
|
|
|
<delete-button :type="'link'" :title="$t('overall.batchDel')" :delete-objs="batchDeleteObjs" @after="getTableData"
|
|
|
|
|
id="alert-msg-batch-delete" v-has="'expressionTemplate_delete'" :api="url"></delete-button>
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</top-tool-more-options>
|
|
|
|
|
</template>
|
2021-04-23 18:10:25 +08:00
|
|
|
<template v-slot="slotProps">
|
|
|
|
|
<chartTmplTable
|
2021-04-08 20:28:54 +08:00
|
|
|
ref="dataTable"
|
2021-05-18 19:18:14 +08:00
|
|
|
v-loading="tools.loading"
|
2021-10-25 14:38:43 +08:00
|
|
|
:loading="tools.loading"
|
2021-04-13 20:33:12 +08:00
|
|
|
:api="url"
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
2021-04-08 20:28:54 +08:00
|
|
|
:height="mainTableHeight"
|
2021-04-13 20:33:12 +08:00
|
|
|
:table-data="tableData"
|
|
|
|
|
@del="del"
|
|
|
|
|
@edit="edit"
|
2021-08-26 14:51:38 +08:00
|
|
|
@copy="copy"
|
2021-04-13 20:33:12 +08:00
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
@reload="getTableData"
|
2021-05-20 14:07:58 +08:00
|
|
|
@sync="chartBySync"
|
2021-04-13 20:33:12 +08:00
|
|
|
@selectionChange="selectionChange"
|
2021-04-23 18:10:25 +08:00
|
|
|
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></chartTmplTable>
|
2021-04-08 20:28:54 +08:00
|
|
|
</template>
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
|
|
|
|
</template>
|
2021-05-12 11:22:23 +08:00
|
|
|
</nzDataList>
|
2021-04-13 20:33:12 +08:00
|
|
|
<transition name="right-box">
|
2021-05-17 20:31:32 +08:00
|
|
|
<chart-box :chart="object" :show-panel="showPanel" :from="'chartTemp'" @close="closeChartBox" @delete-chart="delChart" @on-create-success="createSuccess" @on-delete-success="delChartOk" @reload="panelReload" @reloadOnlyPanel="panelReloadOnlyPanel" ref="addChartModal" v-if="rightBox.show"></chart-box>
|
2021-04-13 20:33:12 +08:00
|
|
|
</transition>
|
2021-03-16 17:54:05 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-04-08 20:28:54 +08:00
|
|
|
import bus from '@/libs/bus'
|
|
|
|
|
import exportXLSX from '@/components/common/exportXLSX'
|
2021-04-23 18:10:25 +08:00
|
|
|
import chartBox from '@/components/page/dashboard/chartBox'
|
2021-04-08 20:28:54 +08:00
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
2021-04-13 20:33:12 +08:00
|
|
|
import dataListMixin from '@/components/common/mixin/dataList'
|
2021-04-23 11:47:38 +08:00
|
|
|
import chartTmplTable from '@/components/common/table/settings/chartTmplTable'
|
2021-07-23 15:49:18 +08:00
|
|
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
2021-04-08 20:28:54 +08:00
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
export default {
|
2021-04-22 18:04:42 +08:00
|
|
|
name: 'chartTemp',
|
2021-03-19 18:52:19 +08:00
|
|
|
components: {
|
2021-04-23 11:47:38 +08:00
|
|
|
chartBox,
|
2021-03-19 18:52:19 +08:00
|
|
|
deleteButton,
|
2021-04-23 11:47:38 +08:00
|
|
|
chartTmplTable,
|
2021-07-20 10:16:28 +08:00
|
|
|
'export-excel': exportXLSX,
|
|
|
|
|
topToolMoreOptions
|
2021-03-19 18:52:19 +08:00
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
mixins: [dataListMixin],
|
2021-03-19 18:52:19 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2021-04-23 11:47:38 +08:00
|
|
|
url: 'visual/panel/chart',
|
2021-04-23 18:10:25 +08:00
|
|
|
tableId: 'chartTemp',
|
2021-03-19 18:52:19 +08:00
|
|
|
/* 搜素相关 */
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
searchLabelList: [
|
2021-03-16 17:54:05 +08:00
|
|
|
{
|
2021-05-10 15:59:39 +08:00
|
|
|
name: 'ID',
|
2021-03-19 18:52:19 +08:00
|
|
|
type: 'input',
|
2021-05-10 15:59:39 +08:00
|
|
|
label: 'ids',
|
2021-03-19 18:52:19 +08:00
|
|
|
disabled: false
|
2021-05-10 15:59:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('overall.name'),
|
2021-03-19 18:52:19 +08:00
|
|
|
type: 'input',
|
|
|
|
|
label: 'name',
|
|
|
|
|
disabled: false
|
2021-05-10 15:59:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('overall.type'),
|
|
|
|
|
type: 'selectString',
|
|
|
|
|
label: 'chartType',
|
2021-09-27 18:06:41 +08:00
|
|
|
readonly: true,
|
2021-05-10 15:59:39 +08:00
|
|
|
disabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: this.$t('dashboard.panel.chartForm.varType'),
|
|
|
|
|
type: 'select',
|
|
|
|
|
label: 'varType',
|
2021-09-27 18:06:41 +08:00
|
|
|
readonly: true,
|
2021-05-10 15:59:39 +08:00
|
|
|
disabled: false
|
2021-03-16 17:54:05 +08:00
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
// 导出相关
|
|
|
|
|
importBox: { show: false, title: this.$t('overall.exportExcel') },
|
|
|
|
|
deleteBox: { show: false, ids: '', remark: '', state: 2 },
|
|
|
|
|
// 创建修改相关
|
2021-04-08 20:28:54 +08:00
|
|
|
blankObject: {
|
2021-03-19 18:52:19 +08:00
|
|
|
id: '',
|
|
|
|
|
name: '',
|
2021-04-23 18:10:25 +08:00
|
|
|
type: 'line',
|
|
|
|
|
span: 12,
|
|
|
|
|
height: '400',
|
|
|
|
|
unit: 2,
|
|
|
|
|
param: { url: '', threshold: '' },
|
|
|
|
|
elements: [{ expression: '', legend: '', type: 'expert', id: '' }],
|
|
|
|
|
panel: '',
|
|
|
|
|
sync: '',
|
|
|
|
|
remark: '',
|
|
|
|
|
groupId: -1,
|
|
|
|
|
panelId: 0,
|
|
|
|
|
varType: 1
|
|
|
|
|
},
|
|
|
|
|
showPanel: {
|
|
|
|
|
name: 'template',
|
|
|
|
|
id: 0
|
2021-03-19 18:52:19 +08:00
|
|
|
},
|
|
|
|
|
nowTime: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
2021-04-23 11:47:38 +08:00
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2021-04-23 18:10:25 +08:00
|
|
|
add () {
|
|
|
|
|
this.object = this.newObject()
|
|
|
|
|
this.object.panelId = 0
|
|
|
|
|
this.object.panelName = 'template'
|
|
|
|
|
this.rightBox.show = true
|
|
|
|
|
},
|
2021-04-25 15:52:12 +08:00
|
|
|
edit (u) {
|
|
|
|
|
if (!u.param) {
|
|
|
|
|
u.param = { url: '', threshold: '' }
|
|
|
|
|
}
|
|
|
|
|
this.object = JSON.parse(JSON.stringify(u))
|
|
|
|
|
this.object.panelId = this.showPanel.id
|
|
|
|
|
this.object.panelName = this.showPanel.name
|
|
|
|
|
this.rightBox.show = true
|
|
|
|
|
},
|
2021-05-20 14:07:58 +08:00
|
|
|
chartBySync (row) {
|
|
|
|
|
this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => {
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
this.getTableData()
|
|
|
|
|
this.$message.success(this.$t('tip.syncSuccess'))
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2021-04-23 11:47:38 +08:00
|
|
|
getTableData (params) {
|
|
|
|
|
if (params && Object.keys(params).length > 0) {
|
|
|
|
|
for (const key in params) {
|
|
|
|
|
this.$set(this.searchLabel, key, params[key])
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
}
|
2021-10-13 18:24:09 +08:00
|
|
|
if (this.orderBy) {
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', this.orderBy)
|
|
|
|
|
}
|
2021-04-23 11:47:38 +08:00
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
this.tools.loading = true
|
2021-04-26 19:46:40 +08:00
|
|
|
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox, panelId: 0, returnChildren: 0, groupId: 0 }).then(response => {
|
2021-04-23 11:47:38 +08:00
|
|
|
this.tools.loading = false
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
|
|
|
|
response.data.list[i].status = response.data.list[i].status + ''
|
2021-04-25 14:58:03 +08:00
|
|
|
if (response.data.list[i].type === 'group') {
|
|
|
|
|
response.data.list[i].children = []
|
|
|
|
|
}
|
2021-04-23 11:47:38 +08:00
|
|
|
}
|
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
if (!this.scrollbarWrap) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
|
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
})
|
2021-03-16 17:54:05 +08:00
|
|
|
}
|
2021-04-23 11:47:38 +08:00
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
})
|
2021-04-23 18:10:25 +08:00
|
|
|
},
|
|
|
|
|
closeChartBox (refresh) {
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
if (refresh) {
|
|
|
|
|
this.getTableData()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
delChart () {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
createSuccess () {
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
this.getTableData()
|
|
|
|
|
},
|
|
|
|
|
delChartOk () {
|
|
|
|
|
this.rightBox.show = false
|
|
|
|
|
},
|
|
|
|
|
panelReload () {},
|
|
|
|
|
panelReloadOnlyPanel () {}
|
2021-03-16 17:54:05 +08:00
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
}
|
2021-03-16 17:54:05 +08:00
|
|
|
</script>
|