2021-03-16 17:54:05 +08:00
|
|
|
<template>
|
2021-04-13 20:33:12 +08:00
|
|
|
<div>
|
2021-04-08 20:28:54 +08:00
|
|
|
<nz-data-list
|
|
|
|
|
ref="dataList"
|
2021-04-13 20:33:12 +08:00
|
|
|
:api="url"
|
|
|
|
|
:layout="['searchInput', 'elementSet']"
|
2021-04-08 20:28:54 +08:00
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
:from="fromRoute.expressionTemplate"
|
2021-04-13 20:33:12 +08:00
|
|
|
:search-msg="searchMsg">
|
2021-04-08 20:28:54 +08:00
|
|
|
<template v-slot:top-tool-right>
|
2021-03-16 17:54:05 +08:00
|
|
|
<export-excel
|
2021-04-08 20:28:54 +08:00
|
|
|
id="expression-template-list"
|
2021-04-13 20:33:12 +08:00
|
|
|
v-has="'expressionTemplate_add'"
|
2021-03-16 17:54:05 +08:00
|
|
|
export-url="expression/tmpl/export"
|
|
|
|
|
import-url="expression/tmpl/import"
|
2021-04-08 20:28:54 +08:00
|
|
|
export-file-name="expression-template"
|
2021-03-16 17:54:05 +08:00
|
|
|
:params="searchLabel"
|
|
|
|
|
:permissions="{import: 'asset_import', export: 'asset_export'}"
|
2021-04-08 20:28:54 +08:00
|
|
|
@afterImport="getTableData"
|
2021-04-13 20:33:12 +08:00
|
|
|
class="top-tool-export margin-r-10"
|
2021-03-16 17:54:05 +08:00
|
|
|
>
|
|
|
|
|
<template slot="optionZone">
|
2021-04-13 20:33:12 +08:00
|
|
|
<button id="expr-tmpl-list-export" v-has="'expressionTemplate_add'" :title="$t('overall.createTemplate')" class="top-tool-btn"
|
2021-04-08 20:28:54 +08:00
|
|
|
type="button" @click="add">
|
2021-03-16 17:54:05 +08:00
|
|
|
<i class="nz-icon nz-icon-create-square"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</template>
|
|
|
|
|
</export-excel>
|
|
|
|
|
|
2021-04-08 20:28:54 +08:00
|
|
|
<delete-button :delete-objs="batchDeleteObjs" @after="getTableData"
|
2021-04-13 20:33:12 +08:00
|
|
|
id="alert-msg-batch-delete" v-has="'expressionTemplate_delete'" :api="url"></delete-button></template>
|
2021-04-08 20:28:54 +08:00
|
|
|
<template v-slot:default="slotProps">
|
2021-04-13 20:33:12 +08:00
|
|
|
<expr-tmpl-table
|
2021-04-08 20:28:54 +08:00
|
|
|
ref="dataTable"
|
2021-04-13 20:33:12 +08:00
|
|
|
v-loading="slotProps.loading"
|
|
|
|
|
: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"
|
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
@reload="getTableData"
|
|
|
|
|
@selectionChange="selectionChange"
|
|
|
|
|
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></expr-tmpl-table>
|
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>
|
|
|
|
|
</nz-data-list>
|
2021-04-13 20:33:12 +08:00
|
|
|
<transition name="right-box">
|
|
|
|
|
<expr-tmpl-box v-if="rightBox.show" :exprTemp="object" @close="closeRightBox"></expr-tmpl-box>
|
|
|
|
|
</transition>
|
2021-03-16 17:54:05 +08:00
|
|
|
<!--导出-->
|
|
|
|
|
<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">
|
|
|
|
|
<div class="upload-body">
|
|
|
|
|
<button @click="exportCur" class="el-button el-button--default el-button--small" id="alert-msg-exportcur">
|
|
|
|
|
<span>{{$t('overall.exportCur')}}</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button @click="exportAll" class="el-button el-button--default el-button--small" id="alert-msg-exportall">
|
|
|
|
|
<span>{{$t('overall.exportAll')}}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-04-08 20:28:54 +08:00
|
|
|
import bus from '@/libs/bus'
|
|
|
|
|
import exportXLSX from '@/components/common/exportXLSX'
|
2021-04-13 20:33:12 +08:00
|
|
|
import exprTmplBox from '@/components/common/rightBox/exprTmplBox'
|
2021-04-08 20:28:54 +08:00
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
|
|
|
|
import nzDataList from '@/components/common/table/nzDataList'
|
2021-04-13 20:33:12 +08:00
|
|
|
import dataListMixin from '@/components/common/mixin/dataList'
|
|
|
|
|
import exprTmplTable from '@/components/common/table/settings/exprTmplTable'
|
2021-04-08 20:28:54 +08:00
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'exprTemp',
|
|
|
|
|
components: {
|
|
|
|
|
deleteButton,
|
2021-04-13 20:33:12 +08:00
|
|
|
exprTmplBox,
|
2021-04-08 20:28:54 +08:00
|
|
|
nzDataList,
|
2021-04-13 20:33:12 +08:00
|
|
|
exprTmplTable,
|
2021-03-19 18:52:19 +08:00
|
|
|
'export-excel': exportXLSX
|
|
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
mixins: [dataListMixin],
|
2021-03-19 18:52:19 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2021-04-13 20:33:12 +08:00
|
|
|
url: 'expression/tmpl',
|
2021-03-19 18:52:19 +08:00
|
|
|
tableId: 'exprTemp',
|
|
|
|
|
/* 搜素相关 */
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
searchLabelList: [
|
2021-03-16 17:54:05 +08:00
|
|
|
{
|
2021-03-19 18:52:19 +08:00
|
|
|
id: 11,
|
|
|
|
|
name: 'Id',
|
|
|
|
|
type: 'input',
|
|
|
|
|
label: 'id',
|
|
|
|
|
disabled: false
|
|
|
|
|
}, {
|
|
|
|
|
id: 12,
|
|
|
|
|
name: this.$t('config.exprTemp.name'),
|
|
|
|
|
type: 'input',
|
|
|
|
|
label: 'name',
|
|
|
|
|
disabled: false
|
|
|
|
|
}, {
|
|
|
|
|
id: 13,
|
|
|
|
|
name: this.$t('config.exprTemp.gname'),
|
|
|
|
|
type: 'selectTemp',
|
|
|
|
|
label: 'gname',
|
|
|
|
|
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-03-22 14:01:40 +08:00
|
|
|
gname: '',
|
2021-03-19 18:52:19 +08:00
|
|
|
expression: '',
|
|
|
|
|
remark: ''
|
|
|
|
|
},
|
|
|
|
|
nowTime: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
this.initEvent()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initEvent () {
|
|
|
|
|
bus.$on('alert-rule-list-change', () => {
|
2021-04-08 20:28:54 +08:00
|
|
|
this.getTableData()
|
2021-03-19 18:52:19 +08:00
|
|
|
})
|
|
|
|
|
bus.$on('dc-list-change', () => {
|
2021-04-08 20:28:54 +08:00
|
|
|
this.getTableData()
|
2021-03-19 18:52:19 +08:00
|
|
|
})
|
|
|
|
|
bus.$on('alert-message-change', () => {
|
2021-04-08 20:28:54 +08:00
|
|
|
this.getTableData()
|
2021-03-19 18:52:19 +08:00
|
|
|
})
|
2021-03-16 17:54:05 +08:00
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
showExportDialog () {
|
|
|
|
|
this.importBox.show = true
|
|
|
|
|
},
|
|
|
|
|
closeDialog () {
|
|
|
|
|
this.importBox.show = false
|
|
|
|
|
this.deleteBox.show = false
|
|
|
|
|
},
|
|
|
|
|
exportCur () {
|
|
|
|
|
const searchLabel = Object.assign({}, this.searchLabel)
|
|
|
|
|
this.$set(searchLabel, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en')
|
|
|
|
|
this.exportExcel(searchLabel)
|
|
|
|
|
this.closeDialog()
|
|
|
|
|
},
|
|
|
|
|
exportAll () {
|
|
|
|
|
const temp = JSON.parse(JSON.stringify(this.searchLabel))
|
|
|
|
|
temp.pageSize = -1
|
|
|
|
|
this.$set(temp, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en')
|
|
|
|
|
this.exportExcel(temp)
|
|
|
|
|
this.closeDialog()
|
|
|
|
|
},
|
|
|
|
|
overtime (row) {
|
|
|
|
|
if (this.prevent_opt.save) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.prevent_opt.save = true
|
|
|
|
|
this.$confirm(this.$t('tip.confirmOvertime'), {
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$delete('expression/tmpl?ids=' + row.id).then(response => {
|
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.$message({ type: 'success', message: this.$t('tip.deleteSuccess') })
|
2021-04-08 20:28:54 +08:00
|
|
|
this.getTableData()
|
2021-03-19 18:52:19 +08:00
|
|
|
} else {
|
|
|
|
|
this.$message.error(response.msg)
|
2021-03-16 17:54:05 +08:00
|
|
|
}
|
|
|
|
|
})
|
2021-03-19 18:52:19 +08:00
|
|
|
}).catch(() => {
|
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
})
|
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>
|