feat: asset二级endpoint增加导入导出按钮等

1.asset二级endpoint增加导入导出按钮
2.asset/alertRule二级alertMessage页面初始参数
This commit is contained in:
陈劲松
2020-03-31 17:22:15 +08:00
parent 7f9bac0f94
commit e3809a11dc
10 changed files with 99 additions and 19 deletions

View File

@@ -12,7 +12,7 @@
</div>
<div class="top-tool-right">
<div class="top-tool-search">
<search-input :searchMsg="searchMsg" @search="search"></search-input>
<search-input :default-item="'alertMessageState'" :default-value="defaultSearchValue" :searchMsg="searchMsg" @search="search"></search-input>
</div>
</div>
</div>
@@ -117,6 +117,7 @@
},
data() {
return {
defaultSearchValue: this.obj.alertNum ? 1 : 0,
showElementSet: false,
tableId: 'alertListTable', //需要分页的table的id用于记录每页数量
showTopBtn: false, //top按钮是否显示
@@ -196,6 +197,12 @@
type: 'asset',
label: 'asset',
disabled: true
}, {
id: 12,
name: this.$t('alert.list.state'),
type: 'select',
label: 'alertMessageState',
disabled: false
}],
},
searchLabel: { //搜索参数
@@ -366,6 +373,9 @@
this.searchLabel.type = 3;
this.searchLabel.linkId = n.id;
}
if (n.alertNum) {
this.defaultSearchValue = 1;
}
this.getAlertList();
}
}

View File

@@ -11,10 +11,18 @@
<div class="top-tool-search">
<search-input :searchMsg="searchMsg" @search="search"></search-input>
</div>
<!--<button type="button" @click="toAddCabinet" :title="$t('overall.createCabinet')"
class="nz-btn nz-btn-size-normal nz-btn-style-light float-right margin-l-20" id="cab-add">
<i class="nz-icon-create-square nz-icon"></i>
</button>-->
<export-excel
export-file-name="endpoint"
export-url="/endpoint/export"
:params="searchLabel"
@afterImport="getTableData"
class="margin-l-20"
style="width: 59px;"
>
<template slot="optionZone">
<i class="nz-icon nz-icon-create-square" @click.stop="toAdd" :title="$t('overall.createProject')" ></i>
</template>
</export-excel>
</div>
</div>
<el-table
@@ -82,21 +90,24 @@
:path="'/assetEndpoint'"
ref="elementset"
></element-set>
<add-endpoint-box :currentProject="currentProject" :module="currentModule" @reload="getTableData" ref="addEndpointBox"></add-endpoint-box>
<edit-endpoint-box @close="closeEditEndpoint" v-if="editBoxShow" :currentProject="endpoint.project" :currentModule="endpoint.module" :endpoint="endpoint" @reload="getTableData" ref="editEndpointBox"></edit-endpoint-box>
</span>
</template>
<script>
import exportXLSX from "../../exportXLSX";
export default {
name: "endpointTab",
components: {
'export-excel': exportXLSX
},
props: {
obj: Object, //关联的实体对象
},
data() {
return {
showAddBox: false,
editBoxShow: false,
endpoint: {}, //用来查看详情和编辑的对象
endpointDetail: {}, //用来查看详情的对象
@@ -155,6 +166,8 @@
],
tablelable: [],
dropCol: [],
currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project
currentModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //endpoint弹框用来回显module
searchMsg: { //给搜索框子组件传递的信息
zheze_none: true,
searchLabelList: [{
@@ -185,6 +198,7 @@
this.$get('/endpoint?assetId=' + this.asset.id + 'pageSize=-1').then(response => {
if (response.code === 200) {
this.tableData = response.data.list;
this.$emit("reload");
}
});
},
@@ -207,7 +221,10 @@
this.$refs.editEndpointBox.show(true);
this.$refs.editEndpointBox.toEdit(true, this.endpoint.id);
});
},
toAdd() {
this.$refs.addEndpointBox.show(true);
this.$refs.addEndpointBox.clearEndpoints();
},
search: function (searchObj) {
/*this.searchLabel = {idcId: this.currentDc.id, pageNo: 1, pageSize: -1};

View File

@@ -631,9 +631,11 @@
currentModule: {
immediate: true,
handler(n, o) {
if(n) {
this.endpointForm.moduleId = n.id;
this.currentModuleCopy = JSON.parse(JSON.stringify(n));
}
}
},
projectListReloadWatch(n, o) {
this.getProjectList();

View File

@@ -185,6 +185,37 @@
}
},
watch: {
defaultValue: {
immediate: true,
handler(n) {
if (n) {
this.$nextTick(() => {
if (this.defaultItem) {
if (this.defaultItem == 'alertMessageState' && this.defaultValue) {
this.searchLabelList.forEach((item, index) => {
if (item.id == 12) {
this.searchLabelList.splice(index, 1);
}
});
this.select_list.push({
name: this.$t('alert.list.state'),
type: 'select',
label: 'state',
disabled: false,
val: this.$t('alert.list.pending'),
valnum: 1
});
this.input_sreach = '';
this.sreach_num = this.select_list.length;
this.change_sreach_show = false;
this.input_list = true;
this.select();
}
}
});
}
}
},
inTransform: {
immediate: true,
handler(n) {
@@ -274,7 +305,7 @@
}
}
},
alertListAssetId: {
/*alertListAssetId: {
immediate: true,
handler(newData, oldData) {
if (newData && this.$route.path == '/alertList') {
@@ -367,7 +398,7 @@
this.$store.commit('assetForAlertListChange', '');
}
}
}
}*/
},
props:['searchMsg','defaultItem','defaultValue','inTransform'],
methods: {
@@ -1222,8 +1253,8 @@
},
},
mounted() {
this.defaultItem ? this.select_list.push({name:this.defaultItem,label:this.defaultItem}) : '';
this.defaultValue != '' ? this.no_condition=this.defaultValue:'';
/*this.defaultItem ? this.select_list.push({name:this.defaultItem,label:this.defaultItem}) : '';
this.defaultValue != '' ? this.no_condition=this.defaultValue:'';*/
this.restructure_historyDate()
if(this.$route.path=='/Objects_Objects'){
this.schelistget()
@@ -1257,7 +1288,6 @@
if(e.keyCode==27){
_this.close_search(e)
}
}
}
}

View File

@@ -57,6 +57,16 @@
value: '1',
label:i18n.t('asset.pingActive')
}
],
alertMessageState: [
{
value: '1',
label:i18n.t('alert.list.pending')
},
{
value: '2',
label:i18n.t('alert.list.expired')
}
]
};
export default searchSelectInfo;

View File

@@ -73,7 +73,7 @@
<span v-else>-</span>
</template>
<template v-else-if="item.prop == 'alertNum'">
<span class="link" @click="queryMessage(scope.row)">{{scope.row.alertNum}}<template v-if="scope.row.alertNum && scope.row.alertNum > 0">{{' ' + $t('overall.active')}}</template></span>
<span class="link" @click="queryMessage(scope.row)">{{scope.row.alertNum + ' ' + $t('overall.active')}}</span>
</template>
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<template v-else>-</template>

View File

@@ -8,7 +8,8 @@
<div class="content-left">
<div class="sidebar-title">{{$t('alert.alert')}}</div>
<div class="sidebar-info">
<div class="sidebar-info-item sidebar-info-top sidebar-info-item-active">{{$t('alert.alertList')}}</div>
<div class="sidebar-info-item sidebar-info-top sidebar-info-item-
">{{$t('alert.alertList')}}</div>
<div class="sidebar-info-item" @click="jumpTo('alertConfig')" id="alert-jump-config">
{{$t('alert.alertConfig')}}
</div>
@@ -195,6 +196,12 @@
type: 'asset',
label: 'asset',
disabled: true
}, {
id: 12,
name: this.$t('alert.list.state'),
type: 'select',
label: 'alertMessageState',
disabled: false
}],
},
searchLabel: { //搜索参数

View File

@@ -119,7 +119,7 @@
<span v-else class="unclickable">{{scope.row.endpointNum}}</span>-->
</template>
<template v-if="item.prop=='Alert'">
<span :id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row)" class="link">{{scope.row.alertNum}}<template v-if="scope.row.alertNum && scope.row.alertNum > 0">{{' ' + $t('overall.active')}}</template></span>
<span :id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row)" class="link">{{scope.row.alertNum + ' ' + $t('overall.active')}}</span>
</template>
<div v-if="item.prop=='dataCenter'">
<!-- <idc-config-box :post-idc="JSON.parse(JSON.stringify(scope.row.idc))" ref="idcConfigBox" :is-edit="false" placement="left" @after="getAssetData(null, true)" :button-class="'checkbox-edit'" :user-data="idcUserData">-->
@@ -187,6 +187,7 @@
<button class="to-top" v-show="showTopBtn" @click="$toTop"><i class="nz-icon nz-icon-top"></i></button>
</div>
<bottom-box v-if="showSubList" :show-sub-list="showSubList" :subResizeShow="subResizeShow" :obj="alertMsgAsset" :isFullScreen="isFullScreen" :from="'asset'" :targetTab="targetTab" :detail="assetDetail"
@reload="getAssetData"
@closeSubList="showSubList = false"
@fullScreen="fullScreen"
@exitFullScreen="exitFullScreen"
@@ -554,6 +555,9 @@
this.targetTab = 'alertMessage';
this.alertMsgAsset = JSON.parse(JSON.stringify(asset));
this.showSubList = true;
/*this.$nextTick(() => {
this.$store.commit("assetForAlertListChange", this.$store.state.assetForAlertList+1);
});*/
},
getAssetData(data, flushRightBoxDc) {
this.searchLabel = Object.assign(this.searchLabel, this.pageObj);

View File

@@ -647,7 +647,7 @@
this.currentModule = module;
this.endpointSearchLabel = {moduleId: ''};
this.$refs.projectSearch.clearSearch();
this.showSubList=1;
this.showSubList = false;
this.selectedEndpoints=[];
},

View File

@@ -10,7 +10,7 @@ const store = new Vuex.Store({
type: -1 //0: asset 1: header
},
assetDcList: 0, //监听此值改变则刷新dc列表
assetForAlertList: '', //asset页跳转alertList时传递的assetId
assetForAlertList: 0, //asset页跳转alertList时传递的assetId
currentProject: {
id: '',
name: '',