2019-12-18 17:00:44 +08:00
|
|
|
|
<template>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="right-box right-box-module" v-clickoutside="clickOutside">
|
|
|
|
|
|
<!-- begin--顶部按钮-->
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div class="right-box-top-btns right-box-form-delete">
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<button @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien" id="module-del" type="button" v-has="'project_module_delete'" v-if="editModule.id">
|
2020-09-10 17:00:32 +08:00
|
|
|
|
<span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-delete"></i></span>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--顶部按钮-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--标题-->
|
|
|
|
|
|
<div class="right-box-title">{{editModule.id ? $t("project.module.editModule") + " ID:" + editModule.id : $t("project.module.createModule")}}</div>
|
|
|
|
|
|
<!-- end--标题-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--表单-->
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<div class="right-box-form-box" ref="scrollbar">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form class="right-box-form right-box-form-left" :model="editModule" label-position="right" label-width="120px" :rules="rules" ref="moduleForm">
|
|
|
|
|
|
<el-form-item :label='$t("project.project.project")' prop="project">
|
|
|
|
|
|
<el-select value-key="id" popper-class="config-dropdown" v-model="editModule.project" placeholder="" size="small">
|
|
|
|
|
|
<el-option :id="'module-project-'+item.id" v-for="item in projectList" :key="item.id" :label="item.name" :value="item"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<el-form-item :label='$t("project.module.moduleName")' prop="name" label-width="180px" style="width: calc(100% - 8px);margin-left: 8px;">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="editModule.name" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div class="nz-tab module-box-type" style="margin-bottom: 15px;">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="nz-tab-item-box" @click="changeType('http')" id="module-type-1">
|
|
|
|
|
|
<div class="nz-tab-item" :class="{'nz-tab-item-active' : editModule.type.toLowerCase() == 'http', 'unclickable': editModule.id}">HTTP</div>
|
2020-04-02 14:33:46 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div @click="changeType('snmp')" class="nz-tab-item-box" id="module-type-2">
|
|
|
|
|
|
<div class="nz-tab-item" :class="{'nz-tab-item-active' : editModule.type.toLowerCase() == 'snmp', 'unclickable': editModule.id}">SNMP</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- snmp表单 -->
|
|
|
|
|
|
<span class="snmp-form" v-if="editModule.type && editModule.type == 'snmp'">
|
|
|
|
|
|
<div class="right-box-sub-title">SNMP settings</div>
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div class="right-box-line"></div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label sub-label-required">{{$t('project.module.walk')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="walk">
|
|
|
|
|
|
<select-walk ref="selectWalk" :walkData="walkData" :expandedWalk="expandedWalkData" :placement="'bottom-start'" @selectWalk="selectWalk" :currentWalk="editModule.walk">
|
|
|
|
|
|
<template v-slot:trigger>
|
|
|
|
|
|
<div class="el-cascader">
|
|
|
|
|
|
<div class="el-input">
|
|
|
|
|
|
<input type="text" readonly="readonly" autocomplete="off" class="el-input__inner" aria-expanded="false">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="el-cascader__tags">
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<div ref="walkScrollbar" style="height: 100%; overflow: auto;">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<span class="el-tag el-tag--info el-tag--small el-tag--light" v-for="item in editModule.walk">
|
|
|
|
|
|
<span v-html="mibName(item)"></span>
|
|
|
|
|
|
<div class="walk-close-box" @click.stop="removeWalk(item)">
|
2020-09-10 17:00:32 +08:00
|
|
|
|
<i class="el-tag__close nz-icon nz-icon-close walk-close"></i>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</span>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</select-walk>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.version')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="version">
|
|
|
|
|
|
<el-radio-group v-model.number="editModule.version" size="small">
|
|
|
|
|
|
<el-radio-button :label="2"></el-radio-button>
|
|
|
|
|
|
<el-radio-button :label="3"></el-radio-button>
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.maxRepetitions')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="max_repetitions">
|
|
|
|
|
|
<el-input v-model.number="editModule.max_repetitions" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.retries')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="retries">
|
|
|
|
|
|
<el-input v-model.number="editModule.retries" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.timeout')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="timeout">
|
|
|
|
|
|
<el-input v-model.number="editModule.timeout" size="small">
|
|
|
|
|
|
<template slot="append">second</template>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="right-box-sub-title">Auth</div>
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div class="right-box-line"></div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label sub-label-required">{{$t('project.module.community')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="community">
|
|
|
|
|
|
<el-input v-model.trim="editModule.community" maxlength="64" show-word-limit size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<!--SNMP V3 setting-->
|
|
|
|
|
|
<template v-if="editModule.version == 3">
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label sub-label-required">{{$t('login.username')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="username">
|
|
|
|
|
|
<el-input v-model.trim="editModule.username" maxlength="64" show-word-limit size="small"></el-input>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label">{{$t('project.module.securityLevel')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="security_level">
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<el-radio-group size="small" v-model="editModule.security_level">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-radio-button label="noAuthNoPriv"></el-radio-button>
|
|
|
|
|
|
<el-radio-button label="authNoPriv"></el-radio-button>
|
|
|
|
|
|
<el-radio-button label="authPriv"></el-radio-button>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-row v-if="editModule.security_level == 'authNoPriv' || editModule.security_level == 'authPriv'">
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label sub-label-required">{{$t('login.password')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="password">
|
2020-09-03 18:34:48 +08:00
|
|
|
|
<el-input v-model.trim="editModule.password" type="password" show-password maxlength="64" show-word-limit size="small"></el-input>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-row class="same-label-width" v-if="editModule.security_level == 'authNoPriv' || editModule.security_level == 'authPriv'">
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label">{{$t('project.module.authProtocol')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="auth_protocol">
|
|
|
|
|
|
<el-radio-group v-model="editModule.auth_protocol" size="small">
|
|
|
|
|
|
<el-radio-button label="MD5"></el-radio-button>
|
|
|
|
|
|
<el-radio-button label="SHA"></el-radio-button>
|
|
|
|
|
|
</el-radio-group>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-row class="same-label-width" v-if="editModule.security_level == 'authPriv'">
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label">{{$t('project.module.privProtocol')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="priv_protocol">
|
|
|
|
|
|
<el-radio-group v-model="editModule.priv_protocol" size="small">
|
|
|
|
|
|
<el-radio-button label="DES"></el-radio-button>
|
|
|
|
|
|
<el-radio-button label="AES"></el-radio-button>
|
|
|
|
|
|
</el-radio-group>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-row v-if="editModule.security_level == 'authPriv'">
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<el-col :span="6">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="sub-label sub-label-required">{{$t('project.module.privPassword')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="priv_password">
|
2020-09-03 18:34:48 +08:00
|
|
|
|
<el-input v-model.trim="editModule.priv_password" type="password" show-password maxlength="64" show-word-limit size="small"></el-input>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
2020-09-01 13:48:16 +08:00
|
|
|
|
<el-row v-if="editModule.version == 3">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.contextName')}}</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="18">
|
|
|
|
|
|
<el-form-item prop="context_name">
|
|
|
|
|
|
<el-input v-model.trim="editModule.context_name" maxlength="64" show-word-limit size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div class="right-box-form-tip" :style="{'margin-bottom': '15px','margin-left':editModule.type.toLowerCase()=='snmp'?'100px':'0'}">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
{{$t('project.module.tip.defaultEndpointSet')}}
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<div></div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
{{$t('project.module.tip.relation')}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.port")' prop="port" >
|
|
|
|
|
|
<el-input placeholder="" v-model.number="editModule.port" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item v-if="editModule.type && editModule.type.toLowerCase() == 'http'" :label='$t("project.endpoint.path")' prop="path">
|
|
|
|
|
|
<el-input placeholder="" v-model="editModule.path" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<el-form-item :label="$t('project.endpoint.param')" class="right-box-form-param" v-if="editModule.type.toLowerCase() == 'http'">
|
|
|
|
|
|
|
|
|
|
|
|
<div style="text-align: right;margin-bottom: 5px">
|
|
|
|
|
|
<button style="display: none;">第一个button会出现意料之外的hover样式,找不到原因,只好加个不可见的button规避问题</button>
|
|
|
|
|
|
<!--<button id="module-clear-all" type="button" @click="clearAllParam" class="nz-btn nz-btn-size-normal nz-btn-style-light">-->
|
|
|
|
|
|
<!--<span><i class="nz-icon nz-icon-delete"></i></span>-->
|
|
|
|
|
|
<!--</button>-->
|
|
|
|
|
|
<span id="module-add-param" type="button" @click="addParam" class="right-box-form-add">
|
|
|
|
|
|
<span><i style="font-size: 16px;" class="nz-icon nz-icon-create-square"></i></span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="param-box param-box-module">
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<div style="height: 100%; overflow: auto;">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<div class="param-box-row" v-for="(item, index) in editModule.paramObj">
|
|
|
|
|
|
<el-form-item class="param-box-row-key" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'paramObj.' + index + '.key'">
|
|
|
|
|
|
<el-input placeholder="key" size="mini" v-model="item.key"></el-input>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<span class="param-box-row-eq">=</span>
|
|
|
|
|
|
<el-form-item class="param-box-row-value" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'paramObj.' + index + '.value'">
|
|
|
|
|
|
<el-input placeholder="value" size="mini" v-model="item.value"></el-input>
|
|
|
|
|
|
</el-form-item>
|
2020-10-15 14:27:46 +08:00
|
|
|
|
<span class="param-box-row-symbol" :id="'moduel-remove-param-'+index" @click="removeParam(index)"><i class="nz-icon nz-icon-shanchu1" style="color:#666;"></i></span>
|
2019-12-27 17:53:17 +08:00
|
|
|
|
</div>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2020-11-10 14:11:29 +08:00
|
|
|
|
<el-form-item :label="$t('project.endpoint.labels')" class="right-box-form-param">
|
|
|
|
|
|
|
|
|
|
|
|
<div style="text-align: right;margin-bottom: 5px">
|
|
|
|
|
|
<button style="display: none;">第一个button会出现意料之外的hover样式,找不到原因,只好加个不可见的button规避问题</button>
|
|
|
|
|
|
<!--<button id="module-clear-all" type="button" @click="clearAllParam" class="nz-btn nz-btn-size-normal nz-btn-style-light">-->
|
|
|
|
|
|
<!--<span><i class="nz-icon nz-icon-delete"></i></span>-->
|
|
|
|
|
|
<!--</button>-->
|
|
|
|
|
|
<span id="module-add-label" type="button" @click="addLabel" class="right-box-form-add">
|
|
|
|
|
|
<span><i style="font-size: 16px;" class="nz-icon nz-icon-create-square"></i></span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="param-box param-box-module">
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<div ref="labelBoxScrollbar" style="height: 100%; overflow: auto;">
|
2020-11-10 14:11:29 +08:00
|
|
|
|
<div class="param-box-row" v-for="(item, index) in editModule.labelModule">
|
2020-11-10 16:33:05 +08:00
|
|
|
|
<el-form-item class="param-box-row-key" :rules="[{required: true, message: $t('validate.required'), trigger: 'blur'},{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'">
|
2020-11-10 14:11:29 +08:00
|
|
|
|
<el-input placeholder="key" size="mini" v-model="item.key"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<span class="param-box-row-eq">=</span>
|
|
|
|
|
|
<el-form-item class="param-box-row-value" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'labelModule.' + index + '.value'">
|
|
|
|
|
|
<el-input placeholder="value" size="mini" v-model="item.value"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<span class="param-box-row-symbol" :id="'moduel-remove-label-'+index" @click="removeLabel(index)"><i class="nz-icon nz-icon-shanchu1" style="color:#666;"></i></span>
|
|
|
|
|
|
</div>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-11-10 14:11:29 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item :label='$t("project.module.description")' prop="remark">
|
|
|
|
|
|
<el-input type="textarea" placeholder="" maxlength="1024" show-word-limit v-model="editModule.remark" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
|
|
|
|
|
|
<!--底部按钮-->
|
|
|
|
|
|
<div class="right-box-bottom-btns">
|
2020-10-12 16:13:55 +08:00
|
|
|
|
<button @click="esc" id="module-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<span>{{$t('overall.cancel')}}</span>
|
|
|
|
|
|
</button>
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="module-box-save" v-has="'project_module_save'">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<span>{{$t('overall.save')}}</span>
|
|
|
|
|
|
</button>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</div>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-04-02 14:33:46 +08:00
|
|
|
|
import {noSpecialChar, port, nzNumber} from "../js/validate";
|
2020-04-02 20:23:52 +08:00
|
|
|
|
import selectWalk from "../popBox/selectWalk";
|
2020-01-17 10:35:09 +08:00
|
|
|
|
|
2019-12-18 17:00:44 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "moduleBox",
|
|
|
|
|
|
props: {
|
|
|
|
|
|
module: Object,
|
|
|
|
|
|
currentProject: Object
|
|
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
'select-walk': selectWalk
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2020-04-02 20:23:52 +08:00
|
|
|
|
walkData: [],
|
2020-04-04 21:10:52 +08:00
|
|
|
|
expandedWalkData: [],
|
2020-07-28 19:42:25 +08:00
|
|
|
|
editModule: {},
|
2019-12-27 17:53:17 +08:00
|
|
|
|
rules: {
|
|
|
|
|
|
name: [
|
2020-01-17 10:35:09 +08:00
|
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'},
|
|
|
|
|
|
{validator:noSpecialChar,trigger: "change"}
|
2019-12-27 17:53:17 +08:00
|
|
|
|
],
|
|
|
|
|
|
project: [
|
2020-01-02 18:13:01 +08:00
|
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'change'}
|
2019-12-27 17:53:17 +08:00
|
|
|
|
],
|
|
|
|
|
|
port: [
|
2020-01-19 19:50:12 +08:00
|
|
|
|
{validator:port, trigger: 'blur'},
|
2019-12-27 17:53:17 +08:00
|
|
|
|
],
|
2020-04-01 21:21:42 +08:00
|
|
|
|
username: [
|
|
|
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
|
|
|
|
|
],
|
|
|
|
|
|
password: [
|
|
|
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
|
|
|
|
|
],
|
|
|
|
|
|
priv_password: [
|
|
|
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
|
|
|
|
|
],
|
2020-04-02 14:33:46 +08:00
|
|
|
|
max_repetitions: [
|
|
|
|
|
|
{validator:nzNumber, trigger: 'blur'},
|
|
|
|
|
|
],
|
|
|
|
|
|
retries: [
|
|
|
|
|
|
{validator:nzNumber, trigger: 'blur'},
|
|
|
|
|
|
],
|
|
|
|
|
|
timeout: [
|
|
|
|
|
|
{validator:nzNumber, trigger: 'blur'},
|
|
|
|
|
|
],
|
2019-12-27 17:53:17 +08:00
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
projectList: [],
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2020-04-04 21:10:52 +08:00
|
|
|
|
selectWalk(walk) {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
if (this.editModule.walk.indexOf(walk) != -1) {
|
|
|
|
|
|
this.editModule.walk.splice(this.editModule.walk.indexOf(walk), 1);
|
2020-04-04 21:10:52 +08:00
|
|
|
|
} else {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule.walk.push(walk);
|
2020-04-04 21:10:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-04-06 13:06:15 +08:00
|
|
|
|
//从mibData里取得oid对应的mib名称
|
|
|
|
|
|
getMibName(walkData, walk) {
|
|
|
|
|
|
let mibName = "";
|
|
|
|
|
|
let objectName = "";
|
|
|
|
|
|
walkData.forEach((item, index) => {
|
|
|
|
|
|
if (!mibName && item.subTree && item.subTree.length > 0) {
|
|
|
|
|
|
item.subTree.forEach((item2, index2) => {
|
|
|
|
|
|
if (!mibName && getMibName(item2, walk)) {
|
|
|
|
|
|
mibName = item.name;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
function getMibName(tree, oid) {
|
|
|
|
|
|
if (oid.indexOf(tree.objectID) > -1) {
|
|
|
|
|
|
if (tree.objectID == oid) {
|
|
|
|
|
|
objectName = tree.name;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (tree.subTree && tree.subTree.length > 0) {
|
|
|
|
|
|
let result = false;
|
|
|
|
|
|
for (let i = 0; i < tree.subTree.length; i++) {
|
|
|
|
|
|
if (getMibName(tree.subTree[i], oid)) {
|
|
|
|
|
|
result = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!objectName) {
|
|
|
|
|
|
objectName = walk;
|
|
|
|
|
|
}
|
2020-04-06 13:33:02 +08:00
|
|
|
|
objectName = "<span style='font-weight:bold'>" + objectName + "</span>";
|
|
|
|
|
|
return mibName ? mibName + ":" + objectName : objectName;
|
2020-04-06 13:06:15 +08:00
|
|
|
|
},
|
2020-04-04 21:10:52 +08:00
|
|
|
|
|
|
|
|
|
|
removeWalk(walk) {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule.walk.splice(this.editModule.walk.indexOf(walk), 1);
|
2020-04-04 21:10:52 +08:00
|
|
|
|
this.$refs.selectWalk.$refs.walkTree.setChecked(walk, false);
|
|
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
|
2020-04-04 21:10:52 +08:00
|
|
|
|
initWalk() {
|
|
|
|
|
|
this.$nextTick(() => {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
if (this.$refs.selectWalk) {
|
|
|
|
|
|
this.$refs.selectWalk.show();
|
|
|
|
|
|
}
|
2020-04-04 21:10:52 +08:00
|
|
|
|
})
|
2020-04-02 20:23:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getWalkData() {
|
2020-04-04 21:10:52 +08:00
|
|
|
|
this.$get('mib/tree', {pageSize: -1, pageNo: 1}).then(response => {
|
2020-04-02 20:23:52 +08:00
|
|
|
|
if (response.code === 200) {
|
2020-04-04 21:10:52 +08:00
|
|
|
|
let obj = JSON.parse(response.data);
|
|
|
|
|
|
this.walkData = [];
|
|
|
|
|
|
for (let item in obj) {
|
2020-04-06 22:11:25 +08:00
|
|
|
|
setAttr(obj[item], "detailShow", false);
|
|
|
|
|
|
this.walkData.push({name: item, detailShow: false, subTree: obj[item]});
|
2020-04-04 21:10:52 +08:00
|
|
|
|
}
|
2020-04-02 20:23:52 +08:00
|
|
|
|
}
|
2020-04-04 21:10:52 +08:00
|
|
|
|
});
|
2020-04-06 22:11:25 +08:00
|
|
|
|
function setAttr(tree, name, value) {
|
|
|
|
|
|
if (tree && tree.length > 0) {
|
|
|
|
|
|
for (let i = 0; i < tree.length; i++) {
|
|
|
|
|
|
tree[i][name] = value;
|
|
|
|
|
|
if (tree[i].subTree && tree[i].subTree.length > 0) {
|
|
|
|
|
|
setAttr(tree[i].subTree, name, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-04-02 20:23:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2019-12-18 17:00:44 +08:00
|
|
|
|
/*关闭弹框*/
|
2020-07-28 19:42:25 +08:00
|
|
|
|
esc(refresh) {
|
|
|
|
|
|
this.$emit("close", refresh);
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2020-07-28 19:42:25 +08:00
|
|
|
|
clickOutside() {
|
|
|
|
|
|
this.esc(false);
|
2020-02-26 18:26:55 +08:00
|
|
|
|
},
|
2020-04-02 14:33:46 +08:00
|
|
|
|
changeType(type) {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
if (this.editModule.id) {
|
2020-04-02 14:33:46 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule.type = type;
|
2020-09-01 13:48:16 +08:00
|
|
|
|
if(type == 'http'){
|
|
|
|
|
|
this.editModule.port = 9100
|
|
|
|
|
|
}else{
|
2020-09-03 18:34:48 +08:00
|
|
|
|
this.$nextTick(()=>{
|
|
|
|
|
|
this.$refs.selectWalk.show();
|
|
|
|
|
|
})
|
2020-11-10 14:11:29 +08:00
|
|
|
|
this.editModule.port= 161;
|
2020-09-01 13:48:16 +08:00
|
|
|
|
}
|
2020-04-02 14:33:46 +08:00
|
|
|
|
},
|
2020-04-01 21:21:42 +08:00
|
|
|
|
//转化snmpParam属性
|
2020-04-02 14:33:46 +08:00
|
|
|
|
parseSnmpParam(module) {
|
2020-04-01 21:21:42 +08:00
|
|
|
|
let snmpObj = { //下划线命名是因为业务需求
|
2020-04-02 20:23:52 +08:00
|
|
|
|
walk: module.walk,
|
2020-04-02 14:33:46 +08:00
|
|
|
|
version: module.version, //2/3
|
|
|
|
|
|
max_repetitions: module.max_repetitions ? module.max_repetitions : 25,
|
|
|
|
|
|
retries: module.retries ? module.retries : 3,
|
|
|
|
|
|
timeout: module.timeout ? module.timeout + "s" : "10s", //s
|
2020-04-01 21:21:42 +08:00
|
|
|
|
auth: {
|
2020-04-02 14:33:46 +08:00
|
|
|
|
community: module.community,
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2020-04-02 14:33:46 +08:00
|
|
|
|
if (module.version == 3) {
|
|
|
|
|
|
snmpObj.auth.username = module.username;
|
|
|
|
|
|
snmpObj.auth.security_level = module.security_level;
|
|
|
|
|
|
snmpObj.auth.context_name = module.context_name;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2020-04-02 14:33:46 +08:00
|
|
|
|
if (module.security_level == "authNoPriv" || module.security_level == "authPriv") {
|
|
|
|
|
|
snmpObj.auth.password = module.password;
|
|
|
|
|
|
snmpObj.auth.auth_protocol = module.auth_protocol;
|
|
|
|
|
|
if (module.security_level != "authNoPriv") {
|
|
|
|
|
|
snmpObj.auth.priv_password = module.priv_password;
|
|
|
|
|
|
snmpObj.auth.priv_protocol = module.priv_protocol;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-04-02 14:33:46 +08:00
|
|
|
|
module.snmpParam = JSON.stringify(snmpObj);
|
2020-04-01 21:21:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
//回显时解析snmpParam
|
|
|
|
|
|
reparseSnmpParam(module) {
|
2020-09-01 13:48:16 +08:00
|
|
|
|
if(!module.snmpParam){
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-04-01 21:21:42 +08:00
|
|
|
|
let snmpObj = JSON.parse(module.snmpParam);
|
2020-04-02 20:23:52 +08:00
|
|
|
|
module.walk = snmpObj.walk;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
module.version = snmpObj.version;
|
|
|
|
|
|
module.max_repetitions = snmpObj.max_repetitions;
|
|
|
|
|
|
module.retries = snmpObj.retries;
|
|
|
|
|
|
module.timeout = parseInt(snmpObj.timeout.replace("s", ""));
|
|
|
|
|
|
module.community = snmpObj.auth.community;
|
|
|
|
|
|
if (snmpObj.version == 3) {
|
|
|
|
|
|
module.username = snmpObj.auth.username;
|
|
|
|
|
|
module.security_level = snmpObj.auth.security_level;
|
2020-04-02 14:33:46 +08:00
|
|
|
|
module.context_name = snmpObj.auth.context_name;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (snmpObj.auth.security_level == "authNoPriv" || snmpObj.auth.security_level == "authPriv") {
|
|
|
|
|
|
module.password = snmpObj.auth.password;
|
|
|
|
|
|
module.auth_protocol = snmpObj.auth.auth_protocol;
|
|
|
|
|
|
if (snmpObj.auth.security_level != "authNoPriv") {
|
|
|
|
|
|
module.priv_password = snmpObj.auth.priv_password;
|
|
|
|
|
|
module.priv_protocol = snmpObj.auth.priv_protocol;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
/*保存*/
|
|
|
|
|
|
save() {
|
2020-11-10 14:11:29 +08:00
|
|
|
|
if(this.editModule.type.toLowerCase() == 'snmp'){
|
|
|
|
|
|
this.editModule.paramObj=[];//处理snmp可能会带有param的问题
|
|
|
|
|
|
}
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule.param = this.paramToJson(this.editModule.paramObj);
|
2020-11-10 14:11:29 +08:00
|
|
|
|
this.editModule.labels = this.labelsToJson(this.editModule.labelModule);
|
2019-12-27 17:53:17 +08:00
|
|
|
|
this.$refs.moduleForm.validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
if (this.editModule.type.toLowerCase() == 'snmp') {
|
|
|
|
|
|
this.parseSnmpParam(this.editModule);
|
2020-04-01 21:21:42 +08:00
|
|
|
|
} else {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
if (this.editModule.snmpParam) {
|
|
|
|
|
|
this.editModule.snmpParam = "";
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule.projectId = this.editModule.project.id;
|
|
|
|
|
|
if (this.editModule.id) {
|
|
|
|
|
|
this.$put('module', this.editModule).then(response => {
|
2019-12-27 17:53:17 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
2020-09-03 14:31:21 +08:00
|
|
|
|
this.$store.commit('setReloadFacade');
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.esc(true);
|
2019-12-27 17:53:17 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-12-18 17:00:44 +08:00
|
|
|
|
} else {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.$post('module', this.editModule).then(response => {
|
2019-12-27 17:53:17 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
2020-09-03 14:31:21 +08:00
|
|
|
|
this.$store.commit('setReloadFacade');
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.esc(true);
|
2019-12-27 17:53:17 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2019-12-27 17:53:17 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
/*删除*/
|
|
|
|
|
|
del() {
|
|
|
|
|
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.$delete("module?ids=" + this.editModule.id).then(response => {
|
2019-12-18 17:00:44 +08:00
|
|
|
|
if (response.code === 200) {
|
2019-12-19 17:22:18 +08:00
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
2020-09-03 14:31:21 +08:00
|
|
|
|
this.$store.commit('setReloadFacade');
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.esc(true);
|
2019-12-18 17:00:44 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
2019-12-19 17:22:18 +08:00
|
|
|
|
});
|
2019-12-18 17:00:44 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/*获取project列表*/
|
2020-07-28 19:42:25 +08:00
|
|
|
|
getProjectList() {
|
2020-04-02 20:23:52 +08:00
|
|
|
|
this.$get('project', {pageSize: -1, pageNo: 1}).then(response => {
|
2019-12-18 17:00:44 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.projectList = response.data.list;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 清除param
|
2020-07-28 19:42:25 +08:00
|
|
|
|
clearAllParam() {
|
|
|
|
|
|
this.editModule.paramObj = [];
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 新增param
|
2020-07-28 19:42:25 +08:00
|
|
|
|
addParam() {
|
|
|
|
|
|
this.editModule.paramObj.push({key: '', value: ''});
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 移除单个param
|
2020-07-28 19:42:25 +08:00
|
|
|
|
removeParam(index) {
|
|
|
|
|
|
this.editModule.paramObj.splice(index, 1);
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2020-11-10 14:11:29 +08:00
|
|
|
|
// 新增label
|
|
|
|
|
|
addLabel() {
|
|
|
|
|
|
this.editModule.labelModule.push({key: '', value: ''});
|
|
|
|
|
|
},
|
|
|
|
|
|
// 移除单个Label
|
|
|
|
|
|
removeLabel(index) {
|
|
|
|
|
|
this.editModule.labelModule.splice(index, 1);
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
//将param转为json字符串格式
|
2020-07-28 19:42:25 +08:00
|
|
|
|
paramToJson(param) {
|
2019-12-18 17:00:44 +08:00
|
|
|
|
let tempParam = {};
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
2019-12-27 17:53:17 +08:00
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"');
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
let jsonString = JSON.stringify(tempParam);
|
|
|
|
|
|
if (jsonString == '{}') {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return jsonString;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-11-10 14:11:29 +08:00
|
|
|
|
//将labels转为json字符串格式
|
|
|
|
|
|
labelsToJson(param) {
|
|
|
|
|
|
let tempParam = {};
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
|
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"');
|
|
|
|
|
|
}
|
|
|
|
|
|
let jsonString = JSON.stringify(tempParam);
|
|
|
|
|
|
if (jsonString == '{}') {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return jsonString;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
this.getWalkData();
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
created() {
|
|
|
|
|
|
this.getProjectList();
|
|
|
|
|
|
},
|
2019-12-31 19:02:58 +08:00
|
|
|
|
computed: {
|
2020-04-06 13:06:15 +08:00
|
|
|
|
mibName() {
|
|
|
|
|
|
return (value) => {
|
|
|
|
|
|
return this.getMibName(this.walkData, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
module: {
|
|
|
|
|
|
immediate: true,
|
2020-04-01 21:21:42 +08:00
|
|
|
|
deep: true,
|
2019-12-18 17:00:44 +08:00
|
|
|
|
handler(n, o) {
|
2020-07-28 19:42:25 +08:00
|
|
|
|
this.editModule = JSON.parse(JSON.stringify(n));
|
2020-09-01 13:48:16 +08:00
|
|
|
|
if(n.id){
|
|
|
|
|
|
this.reparseSnmpParam(this.editModule)
|
2020-08-25 17:53:01 +08:00
|
|
|
|
}else{
|
2020-09-01 13:48:16 +08:00
|
|
|
|
if(n.type&&n.type.toLowerCase() == 'snmp'){
|
2020-09-03 18:34:48 +08:00
|
|
|
|
this.$refs.selectWalk.show();
|
2020-09-01 13:48:16 +08:00
|
|
|
|
for (let i = 0; i < this.editModule.walk.length; i++) {
|
|
|
|
|
|
this.expandedWalkData.push(this.editModule.walk[i].substring(0, this.editModule.walk[i].lastIndexOf(".")));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-08-05 20:58:24 +08:00
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2020-04-02 20:23:52 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
.module-walk-box {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
border: 1px solid #DCDFE6;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
min-height: 32px;
|
|
|
|
|
|
margin-bottom: 22px;
|
|
|
|
|
|
padding: 3px 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.module-walk-box i {
|
|
|
|
|
|
color: #C0C4CC;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-box-item {
|
|
|
|
|
|
padding: 5px 15px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-box-item-txt {
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-box-item-op span:first-of-type {
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-box-item-op span {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-box-op {
|
|
|
|
|
|
width: 18px;
|
|
|
|
|
|
margin: 5px 0 5px 15px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
2020-04-04 21:10:52 +08:00
|
|
|
|
.el-cascader {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-cascader__tags {
|
|
|
|
|
|
height: calc(100% - 10px);
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-box-module .el-cascader .el-input__inner {
|
|
|
|
|
|
height: 150px;
|
|
|
|
|
|
}
|
2020-10-15 14:27:46 +08:00
|
|
|
|
.right-box-form-tip{
|
|
|
|
|
|
color: #999999;
|
|
|
|
|
|
line-height: 21px;
|
|
|
|
|
|
}
|
2020-04-02 20:23:52 +08:00
|
|
|
|
</style>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
<style>
|
|
|
|
|
|
.sub-label {
|
|
|
|
|
|
padding-right: 15px;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
text-align: right;
|
2020-04-02 20:23:52 +08:00
|
|
|
|
line-height: 30px
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
.sub-label-required::before {
|
|
|
|
|
|
content: '*';
|
|
|
|
|
|
color: #F56C6C;
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
}
|
2020-04-02 14:33:46 +08:00
|
|
|
|
.module-box-type {
|
|
|
|
|
|
margin: 25px 0 10px -15px;
|
|
|
|
|
|
}
|
2020-04-06 22:11:25 +08:00
|
|
|
|
.walk-close-box {
|
|
|
|
|
|
margin-left: 6px;
|
|
|
|
|
|
width: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.walk-close {
|
|
|
|
|
|
margin-left: -6px;
|
|
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</style>
|