2019-12-18 17:00:44 +08:00
|
|
|
|
<template>
|
2021-01-18 18:58:57 +08:00
|
|
|
|
<div class="right-box right-box-module" v-clickoutside="{obj:editModule,func:clickOutside}">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<!-- 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">
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-form class="right-box-form right-box-form-left" :model="editModule" label-position = "top" label-width="120px" :rules="rules" ref="moduleForm">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item :label='$t("project.project.project")' prop="project">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-select value-key="id" popper-class="config-dropdown" v-model="editModule.project" placeholder="" size="small" id="module-box-input-project">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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>
|
2021-02-09 17:12:42 +08:00
|
|
|
|
<el-form-item :label='$t("project.module.moduleName")' prop="name" label-width="125px">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="editModule.name" size="small" id="module-box-input-name"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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;">
|
2021-03-19 18:52:19 +08:00
|
|
|
|
<span v-for="(item, index) in editModule.walk" :key="index" class="el-tag el-tag--info el-tag--small el-tag--light">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="version">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-radio-group v-model.number="editModule.version" size="small" id="module-box-input-version">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="max_repetitions">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.number="editModule.max_repetitions" size="small" id="module-box-input-max_repetitions"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.retries')}}</div>
|
|
|
|
|
|
</el-col>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="retries">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.number="editModule.retries" size="small" id="module-box-input-retries"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
|
<div class="sub-label">{{$t('project.module.timeout')}}</div>
|
|
|
|
|
|
</el-col>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="timeout">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.number="editModule.timeout" size="small" id="module-box-input-timeout">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="community">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.trim="editModule.community" maxlength="64" show-word-limit size="small" id="module-box-input-community"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="username">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.trim="editModule.username" maxlength="64" show-word-limit size="small" id="module-box-input-username"></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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="security_level">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-radio-group size="small" v-model="editModule.security_level" id="module-box-input-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">
|
2021-01-05 11:54:33 +08:00
|
|
|
|
<div class="sub-label sub-label-required">{{$t('login.password')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="password">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.trim="editModule.password" type="password" show-password maxlength="64" show-word-limit size="small" id="module-box-input-password"></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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="auth_protocol">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-radio-group v-model="editModule.auth_protocol" size="small" id="module-box-input-auth_protocol">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="priv_protocol">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-radio-group v-model="editModule.priv_protocol" size="small" id="module-box-input-priv_protocol">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<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">
|
2021-01-05 11:54:33 +08:00
|
|
|
|
<div class="sub-label sub-label-required">{{$t('project.module.privPassword')}}</div>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-col>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="priv_password">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.trim="editModule.priv_password" type="password" show-password maxlength="64" show-word-limit size="small" id="module-box-input-priv_password"></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>
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<el-col :span="24">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item prop="context_name">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input v-model.trim="editModule.context_name" maxlength="64" show-word-limit size="small" id="module-box-input-context_name"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
2021-02-09 15:14:19 +08:00
|
|
|
|
<div class="right-box-form-tip" :style="{'margin-bottom': '15px','margin-left':editModule.type.toLowerCase()=='snmp'?'15px':'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" >
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input placeholder="" v-model.number="editModule.port" size="small" id="module-box-input-port"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item v-if="editModule.type && editModule.type.toLowerCase() == 'http'" :label='$t("project.endpoint.path")' prop="path">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input placeholder="" v-model="editModule.path" size="small" id="module-box-input-path"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2021-02-09 17:39:32 +08:00
|
|
|
|
<el-form-item :label="$t('project.endpoint.param')" class="right-box-form-param label-position" v-if="editModule.type.toLowerCase() == 'http'">
|
2020-10-15 14:27:46 +08:00
|
|
|
|
|
|
|
|
|
|
<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">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<div style="height: 100%; overflow: auto;" id="module-box-params">
|
2021-03-19 18:52:19 +08:00
|
|
|
|
<div v-for="(item, index) in editModule.paramObj" :key="index" class="param-box-row">
|
2020-07-28 19:42:25 +08:00
|
|
|
|
<el-form-item class="param-box-row-key" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}" :prop="'paramObj.' + index + '.key'">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2021-02-09 17:50:12 +08:00
|
|
|
|
<el-form-item :label="$t('project.endpoint.labels')" class="right-box-form-param label-position">
|
2020-11-10 14:11:29 +08:00
|
|
|
|
|
|
|
|
|
|
<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">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<div ref="labelBoxScrollbar" style="height: 100%; overflow: auto;" id="module-box-labels">
|
2021-03-19 18:52:19 +08:00
|
|
|
|
<div v-for="(item, index) in editModule.labelModule" :key="index" class="param-box-row">
|
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">
|
2021-02-04 11:21:00 +08:00
|
|
|
|
<el-input type="textarea" placeholder="" maxlength="1024" show-word-limit v-model="editModule.remark" size="small" id="module-box-input-project"></el-input>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</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">
|
2021-01-18 18:58:57 +08:00
|
|
|
|
<button v-cancel="{obj:editModule,func: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>
|
2021-01-21 17:29:29 +08:00
|
|
|
|
<button :class="{'nz-btn-disabled':prevent_opt.save}" :disabled="prevent_opt.save" @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="module-box-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>
|
2021-03-19 18:52:19 +08:00
|
|
|
|
import { noSpecialChar, port, nzNumber } from '../js/validate'
|
|
|
|
|
|
import selectWalk from '../popBox/selectWalk'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'moduleBox',
|
|
|
|
|
|
props: {
|
|
|
|
|
|
module: Object,
|
|
|
|
|
|
currentProject: Object
|
|
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
'select-walk': selectWalk
|
|
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
walkData: [],
|
|
|
|
|
|
expandedWalkData: [],
|
|
|
|
|
|
editModule: {},
|
|
|
|
|
|
rules: {
|
|
|
|
|
|
name: [
|
|
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
|
|
|
|
|
{ validator: noSpecialChar, trigger: 'change' }
|
|
|
|
|
|
],
|
|
|
|
|
|
project: [
|
|
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
|
|
|
|
|
],
|
|
|
|
|
|
walk: [
|
|
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
|
|
],
|
|
|
|
|
|
port: [
|
|
|
|
|
|
{ validator: port, trigger: 'blur' }
|
|
|
|
|
|
],
|
|
|
|
|
|
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' }
|
|
|
|
|
|
],
|
|
|
|
|
|
max_repetitions: [
|
|
|
|
|
|
{ validator: nzNumber, trigger: 'blur' }
|
|
|
|
|
|
],
|
|
|
|
|
|
retries: [
|
|
|
|
|
|
{ validator: nzNumber, trigger: 'blur' }
|
|
|
|
|
|
],
|
|
|
|
|
|
timeout: [
|
|
|
|
|
|
{ validator: nzNumber, trigger: 'blur' }
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
projectList: []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
selectWalk (walk) {
|
|
|
|
|
|
if (this.editModule.walk.indexOf(walk) != -1) {
|
|
|
|
|
|
this.editModule.walk.splice(this.editModule.walk.indexOf(walk), 1)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.editModule.walk.push(walk)
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-03-19 18:52:19 +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
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2020-04-04 21:10:52 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
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
|
2020-04-06 13:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return result
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
2020-04-06 13:06:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
2020-04-06 13:06:15 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!objectName) {
|
|
|
|
|
|
objectName = walk
|
|
|
|
|
|
}
|
|
|
|
|
|
objectName = "<span style='font-weight:bold'>" + objectName + '</span>'
|
|
|
|
|
|
return mibName ? mibName + ':' + objectName : objectName
|
|
|
|
|
|
},
|
2020-04-04 21:10:52 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
removeWalk (walk) {
|
|
|
|
|
|
this.editModule.walk.splice(this.editModule.walk.indexOf(walk), 1)
|
|
|
|
|
|
this.$refs.selectWalk.$refs.walkTree.setChecked(walk, false)
|
|
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
initWalk () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.$refs.selectWalk) {
|
|
|
|
|
|
this.$refs.selectWalk.show()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
getWalkData () {
|
|
|
|
|
|
this.$get('mib/tree', { pageSize: -1, pageNo: 1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
const obj = JSON.parse(response.data)
|
|
|
|
|
|
this.walkData = []
|
|
|
|
|
|
for (const item in obj) {
|
|
|
|
|
|
setAttr(obj[item], 'detailShow', false)
|
|
|
|
|
|
this.walkData.push({ name: item, detailShow: false, subTree: obj[item] })
|
2020-04-02 20:23:52 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +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-06 22:11:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-04-02 20:23:52 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
/* 关闭弹框 */
|
|
|
|
|
|
esc (refresh) {
|
|
|
|
|
|
this.$emit('close', refresh)
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
clickOutside () {
|
|
|
|
|
|
this.esc(false)
|
|
|
|
|
|
},
|
|
|
|
|
|
changeType (type) {
|
|
|
|
|
|
if (this.editModule.id) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.editModule.type = type
|
|
|
|
|
|
if (type == 'http') {
|
|
|
|
|
|
this.editModule.port = 9100
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.selectWalk.show()
|
|
|
|
|
|
})
|
|
|
|
|
|
this.editModule.port = 161
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 转化snmpParam属性
|
|
|
|
|
|
parseSnmpParam (module) {
|
|
|
|
|
|
const snmpObj = { // 下划线命名是因为业务需求
|
|
|
|
|
|
walk: module.walk,
|
|
|
|
|
|
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
|
|
|
|
|
|
auth: {
|
|
|
|
|
|
community: module.community
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +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
|
|
|
|
|
|
}
|
|
|
|
|
|
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-09-01 13:48:16 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
module.snmpParam = JSON.stringify(snmpObj)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 回显时解析snmpParam
|
|
|
|
|
|
reparseSnmpParam (module) {
|
|
|
|
|
|
if (!module.snmpParam) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const snmpObj = JSON.parse(module.snmpParam)
|
|
|
|
|
|
module.walk = snmpObj.walk
|
|
|
|
|
|
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
|
|
|
|
|
|
module.context_name = snmpObj.auth.context_name
|
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 保存 */
|
|
|
|
|
|
save () {
|
|
|
|
|
|
if (this.editModule.type.toLowerCase() == 'snmp') {
|
|
|
|
|
|
this.editModule.paramObj = []// 处理snmp可能会带有param的问题
|
|
|
|
|
|
}
|
|
|
|
|
|
this.editModule.param = this.paramToJson(this.editModule.paramObj)
|
|
|
|
|
|
this.editModule.labels = this.labelsToJson(this.editModule.labelModule)
|
|
|
|
|
|
this.$refs.moduleForm.validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.prevent_opt.save = true
|
|
|
|
|
|
if (this.editModule.type.toLowerCase() == 'snmp') {
|
|
|
|
|
|
this.parseSnmpParam(this.editModule)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (this.editModule.snmpParam) {
|
|
|
|
|
|
this.editModule.snmpParam = ''
|
|
|
|
|
|
}
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.editModule.projectId = this.editModule.project.id
|
|
|
|
|
|
if (this.editModule.id) {
|
|
|
|
|
|
this.$put('module', this.editModule).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
|
|
|
|
this.$store.commit('setReloadFacade')
|
|
|
|
|
|
this.esc(true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
|
})
|
2019-12-27 17:53:17 +08:00
|
|
|
|
} else {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.$post('module', this.editModule).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
|
|
|
|
this.$store.commit('setReloadFacade')
|
|
|
|
|
|
this.esc(true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.prevent_opt.save = false
|
|
|
|
|
|
})
|
2019-12-27 17:53:17 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 删除 */
|
|
|
|
|
|
del () {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete('module?ids=' + this.editModule.id).then(response => {
|
2019-12-18 17:00:44 +08:00
|
|
|
|
if (response.code === 200) {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
|
this.$store.commit('setReloadFacade')
|
|
|
|
|
|
this.esc(true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2019-12-18 17:00:44 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
/* 获取project列表 */
|
|
|
|
|
|
getProjectList () {
|
|
|
|
|
|
this.$get('project', { pageSize: -1, pageNo: 1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.projectList = response.data.list
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 清除param
|
|
|
|
|
|
clearAllParam () {
|
|
|
|
|
|
this.editModule.paramObj = []
|
2020-04-02 20:23:52 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 新增param
|
|
|
|
|
|
addParam () {
|
|
|
|
|
|
this.editModule.paramObj.push({ key: '', value: '' })
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 移除单个param
|
|
|
|
|
|
removeParam (index) {
|
|
|
|
|
|
this.editModule.paramObj.splice(index, 1)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 新增label
|
|
|
|
|
|
addLabel () {
|
|
|
|
|
|
this.editModule.labelModule.push({ key: '', value: '' })
|
|
|
|
|
|
},
|
|
|
|
|
|
// 移除单个Label
|
|
|
|
|
|
removeLabel (index) {
|
|
|
|
|
|
this.editModule.labelModule.splice(index, 1)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 将param转为json字符串格式
|
|
|
|
|
|
paramToJson (param) {
|
|
|
|
|
|
const tempParam = {}
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
|
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"')
|
|
|
|
|
|
}
|
|
|
|
|
|
const jsonString = JSON.stringify(tempParam)
|
|
|
|
|
|
if (jsonString == '{}') {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return jsonString
|
2020-04-06 13:06:15 +08:00
|
|
|
|
}
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 将labels转为json字符串格式
|
|
|
|
|
|
labelsToJson (param) {
|
|
|
|
|
|
const tempParam = {}
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
|
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"')
|
|
|
|
|
|
}
|
|
|
|
|
|
const jsonString = JSON.stringify(tempParam)
|
|
|
|
|
|
if (jsonString == '{}') {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return jsonString
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.getWalkData()
|
|
|
|
|
|
},
|
|
|
|
|
|
created () {
|
|
|
|
|
|
this.getProjectList()
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
mibName () {
|
|
|
|
|
|
return (value) => {
|
|
|
|
|
|
return this.getMibName(this.walkData, value)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
module: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
|
|
|
|
|
this.editModule = JSON.parse(JSON.stringify(n))
|
|
|
|
|
|
if (n.id) {
|
|
|
|
|
|
this.reparseSnmpParam(this.editModule)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (n.type && n.type.toLowerCase() == 'snmp') {
|
|
|
|
|
|
this.$refs.selectWalk.show()
|
|
|
|
|
|
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-09-01 13:48:16 +08:00
|
|
|
|
}
|
2020-08-05 20:58:24 +08:00
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +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;
|
2021-02-09 15:14:19 +08:00
|
|
|
|
text-align: left;
|
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
|
font-weight: bold;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
2021-02-09 15:14:19 +08:00
|
|
|
|
.sub-label-required::after {
|
2020-04-01 21:21:42 +08:00
|
|
|
|
content: '*';
|
|
|
|
|
|
color: #F56C6C;
|
2021-02-09 15:14:19 +08:00
|
|
|
|
margin-left: 4px;
|
2020-04-01 21:21:42 +08:00
|
|
|
|
}
|
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 {
|
2020-12-16 18:41:29 +08:00
|
|
|
|
font-size: 12px;
|
2020-04-06 22:11:25 +08:00
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</style>
|