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">
|
2021-04-14 18:46:58 +08:00
|
|
|
|
<button v-if="editModule.id" id="module-del" v-has="'module_delete'" class="nz-btn nz-btn-size-normal nz-btn-size-alien" type="button" @click="del">
|
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">
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--name-->
|
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>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--project-->
|
|
|
|
|
|
<el-form-item :label='$t("project.project.project")' prop="projectId">
|
|
|
|
|
|
<el-select value-key="id" popper-class="config-dropdown" v-model="editModule.projectId" placeholder="" size="small" id="module-box-input-project">
|
|
|
|
|
|
<el-option :id="'module-project-'+item.id" v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--remark-->
|
|
|
|
|
|
<el-form-item :label='$t("project.module.description")' prop="remark">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
placeholder=""
|
|
|
|
|
|
maxlength="1024"
|
|
|
|
|
|
v-model="editModule.remark"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
:autosize="{ minRows: 1, maxRows: 6}"
|
|
|
|
|
|
class="not-fixed-height no-resize"
|
|
|
|
|
|
id="module-box-input-remark"></el-input>
|
|
|
|
|
|
</el-form-item>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--type-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.type")' prop="type">
|
|
|
|
|
|
<el-select value-key="id" popper-class="config-dropdown" v-model="editModule.type" placeholder="" size="small" id="module-box-input-type" :disabled="!!editModule.id" @change="changeAuthType">
|
|
|
|
|
|
<el-option :id="'module-type-'+item.id" v-for="item in typetList" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- snmp表单 -->
|
|
|
|
|
|
<span class="snmp-form" v-if="editModule.type && editModule.type == 'snmp'">
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<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>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--credentials-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.credentials")' prop="credentials">
|
|
|
|
|
|
<el-select value-key="id" popper-class="config-dropdown" v-model="editModule.configs.snmpCredentialsId" placeholder="" size="small" id="module-box-input-credentials">
|
|
|
|
|
|
<el-option :id="'module-type-'+item.id" v-for="item in credentialList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</span>
|
|
|
|
|
|
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--Enpoint template-->
|
|
|
|
|
|
<div class="right-box-sub-title">Enpoint template
|
|
|
|
|
|
<el-tooltip placement="top" effect="light">
|
|
|
|
|
|
<div slot="content">
|
|
|
|
|
|
{{$t('project.module.tip.defaultEndpointSet')}}
|
|
|
|
|
|
<div></div>
|
|
|
|
|
|
{{$t('project.module.tip.relation')}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<i class="nz-icon nz-icon-info-normal"></i>
|
|
|
|
|
|
</el-tooltip>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</div>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<div class="right-box-line"></div>
|
|
|
|
|
|
|
|
|
|
|
|
<el-tabs v-model="activeName">
|
|
|
|
|
|
<el-tab-pane label="Basic" name="Basic">
|
|
|
|
|
|
<!--path-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.path")' prop="configs.metrics_path" class="half-form-item">
|
|
|
|
|
|
<el-input placeholder="" v-model="editModule.configs.metrics_path" size="small" id="module-box-input-path"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--port-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.port")' prop="port" class="half-form-item">
|
|
|
|
|
|
<el-input placeholder="" v-model.number="editModule.port" size="small" id="module-box-input-port"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--host-->
|
2021-04-14 15:38:37 +08:00
|
|
|
|
<el-form-item :label='$t("project.endpoint.host")' prop="host">
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<el-input placeholder="" v-model.number="editModule.configs.host" size="small" id="module-box-input-host"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<transition name="el-zoom-in-top">
|
|
|
|
|
|
<div v-show="showAllBasicOption" >
|
2021-04-14 15:38:37 +08:00
|
|
|
|
<!--name pattern-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.pattern")' prop="pattern" class="half-form-item">
|
|
|
|
|
|
<!-- <el-input placeholder="" v-model=""></el-input>-->
|
|
|
|
|
|
<el-autocomplete
|
|
|
|
|
|
class="inline-input"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
id="module-box-input-pattern"
|
|
|
|
|
|
v-model="editModule.endpointNameTmpl"
|
|
|
|
|
|
:fetch-suggestions="querySearch"
|
|
|
|
|
|
placeholder="请输入内容"
|
|
|
|
|
|
></el-autocomplete>
|
|
|
|
|
|
</el-form-item>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--scrape_interval-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.scrape_interval")' prop="scrape_interval" class="half-form-item">
|
2021-04-15 11:47:44 +08:00
|
|
|
|
<el-input :placeholder='$t("project.endpoint.scrape_interval_placeholder")' v-model.number="editModule.configs.scrape_interval" size="small" id="module-box-input-scrape_interval">
|
|
|
|
|
|
<template slot="append">s</template>
|
|
|
|
|
|
</el-input>
|
2020-04-01 21:21:42 +08:00
|
|
|
|
</el-form-item>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<!--scrape_timeout-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.scrape_timeout")' prop="scrape_timeout" class="half-form-item">
|
|
|
|
|
|
<el-input :placeholder='$t("project.endpoint.scrape_timeout_placeholder")' v-model.number="editModule.configs.scrape_timeout" size="small" id="module-box-input-scrape_timeout"></el-input>
|
2021-04-15 11:47:44 +08:00
|
|
|
|
<template slot="append">s</template>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</el-form-item>
|
2019-12-27 17:53:17 +08:00
|
|
|
|
</div>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
|
|
<div style="text-align: center"><i class="nz-icon nz-icon-drop-down need-rotate" :class="showAllBasicOption?'is-active':''" @click="showAllBasicOption=!showAllBasicOption"></i></div>
|
|
|
|
|
|
</el-tab-pane>
|
2021-04-14 15:38:37 +08:00
|
|
|
|
<el-tab-pane label="Parameter" name="Parameter">
|
|
|
|
|
|
<div ref="labelBoxScrollbar" style="height: 100%; overflow: auto;" id="module-box-params">
|
|
|
|
|
|
<div v-for="(item, index) in editModule.paramObj" :key="index" class="param-box-row">
|
|
|
|
|
|
<el-form-item class="param-box-row-key" :prop="'paramObj.' + index + '.key'">
|
|
|
|
|
|
<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" :prop="'paramObj.' + index + '.value'">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="item.value"
|
|
|
|
|
|
multiple
|
|
|
|
|
|
filterable
|
|
|
|
|
|
allow-create
|
|
|
|
|
|
:ref="'select'+ index"
|
|
|
|
|
|
placeholder="value" size="mini"
|
|
|
|
|
|
default-first-option
|
|
|
|
|
|
popper-class="config-dropdown hide-element"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span slot="empty" class=""></span>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<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>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="text-align: center">
|
|
|
|
|
|
<span id="module-add-param" type="button" @click="addParam" class="right-box-form-add module-add-label">
|
2021-04-13 19:06:34 +08:00
|
|
|
|
<span><i style="font-size: 16px;" class="nz-icon nz-icon-create-square"></i></span>
|
|
|
|
|
|
</span>
|
2021-04-14 15:38:37 +08:00
|
|
|
|
</div>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
</el-tab-pane>
|
2021-04-14 15:38:37 +08:00
|
|
|
|
<el-tab-pane label="Labels" name="Labels">
|
|
|
|
|
|
<div ref="labelBoxScrollbar" style="height: 100%; overflow: auto;" id="module-box-labels">
|
|
|
|
|
|
<div v-for="(item, index) in editModule.labelModule" :key="index" class="param-box-row">
|
|
|
|
|
|
<el-form-item class="param-box-row-key" :rules="[{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'">
|
|
|
|
|
|
<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" :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>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="text-align: center">
|
|
|
|
|
|
<span id="module-add-label" type="button" @click="addLabel" class="right-box-form-add module-add-label">
|
2020-11-10 14:11:29 +08:00
|
|
|
|
<span><i style="font-size: 16px;" class="nz-icon nz-icon-create-square"></i></span>
|
|
|
|
|
|
</span>
|
2021-04-14 15:38:37 +08:00
|
|
|
|
</div>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="Auth" name="Auth" v-if="editModule.type !== 'snmp'">
|
|
|
|
|
|
<!--authtype-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.type")' prop="authtype">
|
|
|
|
|
|
<el-select @change="changeAuthType" value-key="id" popper-class="config-dropdown" v-model="authType" placeholder="" size="small" id="module-box-input-auth-type">
|
|
|
|
|
|
<el-option :id="'module-type-'+item.id" v-for="item in authTypeList" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<!--authtype 1-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.username")' prop="authtype" v-if="authType === 1" class="half-form-item">
|
|
|
|
|
|
<el-input placeholder='' v-model.number="editModule.configs.basic_auth.username" size="small" id="module-box-input-uername"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.password")' prop="authtype" v-if="authType === 1" class="half-form-item">
|
|
|
|
|
|
<el-input placeholder='' v-model.number="editModule.configs.basic_auth.password" size="small" id="module-box-input-password"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<!--authtype 2-->
|
|
|
|
|
|
<el-form-item :label='$t("project.endpoint.bearer_token")' prop="authtype" v-if="authType === 2">
|
|
|
|
|
|
<el-input placeholder='' v-model.number="editModule.configs.bearer_token" size="small" id="module-box-input-bearer_token"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
2021-04-15 11:47:44 +08:00
|
|
|
|
<div class="configs-copy-value">
|
|
|
|
|
|
<span class="copy-value-content"> <i class="nz-icon nz-icon-override" @click="copyValue"></i></span>
|
|
|
|
|
|
<pre style="overflow-y: auto;height:100%">{{configsCopyValue}}</pre>
|
2021-04-13 19:06:34 +08:00
|
|
|
|
</div>
|
2020-07-28 19:42:25 +08:00
|
|
|
|
</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: [],
|
2021-04-13 19:06:34 +08:00
|
|
|
|
activeName: 'Basic',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
expandedWalkData: [],
|
2021-04-13 19:06:34 +08:00
|
|
|
|
radio: 'password',
|
2021-03-19 18:52:19 +08:00
|
|
|
|
editModule: {},
|
2021-04-13 19:06:34 +08:00
|
|
|
|
restaurants: [
|
|
|
|
|
|
{ value: '{{module.name}}-{{asset.name}}' },
|
|
|
|
|
|
{ value: '{{module.name}}-{{asset.manageIp}}' }
|
|
|
|
|
|
],
|
|
|
|
|
|
showAllBasicOption: false,
|
2021-03-19 18:52:19 +08:00
|
|
|
|
rules: {
|
|
|
|
|
|
name: [
|
|
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
|
|
|
|
|
{ validator: noSpecialChar, trigger: 'change' }
|
|
|
|
|
|
],
|
2021-04-13 19:06:34 +08:00
|
|
|
|
projectId: [
|
2021-03-19 18:52:19 +08:00
|
|
|
|
{ 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' }
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
2021-04-13 19:06:34 +08:00
|
|
|
|
projectList: [],
|
|
|
|
|
|
credentialList: [],
|
|
|
|
|
|
typetList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'http',
|
|
|
|
|
|
name: 'HTTP'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'snmp',
|
|
|
|
|
|
name: 'SNMP'
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
authType: 0,
|
|
|
|
|
|
authTypeList: [
|
|
|
|
|
|
{ name: this.$t('project.endpoint.authTypeNull'), value: 0 },
|
|
|
|
|
|
{ name: this.$t('project.endpoint.authTypeWord'), value: 1 },
|
|
|
|
|
|
{ name: this.$t('project.endpoint.authTypeToken'), value: 2 }
|
2021-04-14 15:38:37 +08:00
|
|
|
|
],
|
|
|
|
|
|
configsCopyValue: ''
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2021-04-15 11:47:44 +08:00
|
|
|
|
change () {
|
|
|
|
|
|
console.log(this.$refs['select' + 0])
|
2021-04-14 15:38:37 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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)
|
2021-04-13 19:06:34 +08:00
|
|
|
|
console.log(obj)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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-04-13 19:06:34 +08:00
|
|
|
|
console.log(this.walkData)
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 保存 */
|
|
|
|
|
|
save () {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
this.editModule.configs.param = this.paramToJson(this.editModule.paramObj)
|
|
|
|
|
|
console.log(this.editModule.paramObj, this.editModule.configs.param)
|
|
|
|
|
|
this.editModule.configs.labels = this.labelsToJson(this.editModule.labelModule)
|
2021-04-13 19:06:34 +08:00
|
|
|
|
const params = { ...this.editModule }
|
|
|
|
|
|
params.configs.walk = params.walk
|
2021-04-14 15:38:37 +08:00
|
|
|
|
params.configs.port = params.port
|
2021-04-13 19:06:34 +08:00
|
|
|
|
params.configs = JSON.stringify(params.configs)
|
|
|
|
|
|
if (this.authType === 2 && !this.editModule.configs.bearer_token) {
|
|
|
|
|
|
this.$message.error("'token' is required")
|
|
|
|
|
|
} else if (this.authType === 1 && !(this.editModule.configs.basic_auth.username && this.editModule.configs.basic_auth.password)) {
|
|
|
|
|
|
this.$message.error("'username' and 'password' is required")
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.authType = 0
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.$refs.moduleForm.validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.prevent_opt.save = true
|
|
|
|
|
|
if (this.editModule.id) {
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.$put('monitor/module', params).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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-04-13 19:06:34 +08:00
|
|
|
|
this.$post('monitor/module', params).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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(() => {
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.$delete('monitor/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 () {
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.$get('monitor/project', { pageSize: -1, pageNo: 1 }).then(response => {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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-04-13 19:06:34 +08:00
|
|
|
|
// get snmp
|
|
|
|
|
|
getCredential () {
|
|
|
|
|
|
this.$get('/snmp/credential', { pageSize: -1, pageNo: 1 }).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.credentialList = response.data.list
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 清除param
|
|
|
|
|
|
clearAllParam () {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
this.editModule.paramObj = []
|
2020-04-02 20:23:52 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 新增param
|
|
|
|
|
|
addParam () {
|
2021-04-15 11:47:44 +08:00
|
|
|
|
this.editModule.paramObj.push({ key: '', value: [], showList: false })
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
// 移除单个param
|
|
|
|
|
|
removeParam (index) {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
this.editModule.paramObj.splice(index, 1)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 新增label
|
|
|
|
|
|
addLabel () {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
this.editModule.labelModule.push({ key: '', value: '' })
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 移除单个Label
|
|
|
|
|
|
removeLabel (index) {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
if (this.editModule.labelModule.length === 1) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.editModule.labelModule.splice(index, 1)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 将param转为json字符串格式
|
|
|
|
|
|
paramToJson (param) {
|
|
|
|
|
|
const tempParam = {}
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
if (!param[i].key || !param[i].value.length) {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
tempParam[param[i].key] = param[i].value
|
2020-04-06 13:06:15 +08:00
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
return tempParam
|
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++) {
|
2021-04-14 15:38:37 +08:00
|
|
|
|
if (!param[i].key || !param[i].value) {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"')
|
|
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
return tempParam
|
2021-04-13 19:06:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 输入建议
|
|
|
|
|
|
querySearch (queryString, cb) {
|
|
|
|
|
|
const restaurants = this.restaurants
|
|
|
|
|
|
const results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
|
|
|
|
|
|
// 调用 callback 返回建议列表的数据
|
|
|
|
|
|
cb(results)
|
|
|
|
|
|
},
|
|
|
|
|
|
createFilter (queryString) {
|
|
|
|
|
|
return (restaurant) => {
|
|
|
|
|
|
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
changeAuthType () {
|
|
|
|
|
|
this.editModule.configs.bearer_token = ''
|
|
|
|
|
|
this.editModule.configs.basic_auth = {
|
|
|
|
|
|
username: '',
|
|
|
|
|
|
password: ''
|
|
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
copyValue () {
|
|
|
|
|
|
const domUrl = document.createElement('input')
|
|
|
|
|
|
domUrl.value = this.configsCopyValue
|
|
|
|
|
|
domUrl.id = 'creatDom'
|
|
|
|
|
|
document.body.appendChild(domUrl)
|
|
|
|
|
|
domUrl.select() // 选择对象
|
|
|
|
|
|
document.execCommand('Copy') // 执行浏览器复制命令
|
|
|
|
|
|
const creatDom = document.getElementById('creatDom')
|
|
|
|
|
|
creatDom.parentNode.removeChild(creatDom)
|
|
|
|
|
|
this.$message(this.$t('overall.copySuccess'))
|
|
|
|
|
|
},
|
|
|
|
|
|
syntaxHighlight (json) {
|
|
|
|
|
|
if (typeof json != 'string') {
|
|
|
|
|
|
json = JSON.stringify(json, undefined, 2)
|
|
|
|
|
|
}
|
|
|
|
|
|
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
|
|
|
|
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
|
|
|
|
|
|
function (match) {
|
|
|
|
|
|
let cls = 'number'
|
|
|
|
|
|
if (/^"/.test(match)) {
|
|
|
|
|
|
if (/:$/.test(match)) {
|
|
|
|
|
|
cls = 'key'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
cls = 'string'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (/true|false/.test(match)) {
|
|
|
|
|
|
cls = 'boolean'
|
|
|
|
|
|
} else if (/null/.test(match)) {
|
|
|
|
|
|
cls = 'null'
|
|
|
|
|
|
}
|
|
|
|
|
|
return '<span class="' + cls + '">' + match + '</span>'
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.getWalkData()
|
|
|
|
|
|
},
|
|
|
|
|
|
created () {
|
|
|
|
|
|
this.getProjectList()
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.getCredential()
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
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))
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.activeName = 'Basic'
|
|
|
|
|
|
|
|
|
|
|
|
if (this.editModule.configs.bearer_token) {
|
|
|
|
|
|
this.authType = 2
|
|
|
|
|
|
} else if (this.editModule.configs.basic_auth.username) {
|
|
|
|
|
|
this.authType = 1
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else {
|
2021-04-13 19:06:34 +08:00
|
|
|
|
this.authType = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
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.configs.walk[i].substring(0, this.editModule.configs.walk[i].lastIndexOf('.')))
|
2020-08-05 20:58:24 +08:00
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2021-04-13 19:06:34 +08:00
|
|
|
|
// if (n.id) {
|
|
|
|
|
|
// } 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('.')))
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
editModule: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
console.log(n)
|
|
|
|
|
|
if (n && n.configs) {
|
|
|
|
|
|
const params = Object.assign({}, n.configs)
|
|
|
|
|
|
params.param = this.paramToJson(this.editModule.paramObj)
|
|
|
|
|
|
params.labels = this.labelsToJson(this.editModule.labelModule)
|
|
|
|
|
|
params.walk = n.walk
|
|
|
|
|
|
params.port = n.port
|
|
|
|
|
|
Object.keys(params).forEach(key => {
|
|
|
|
|
|
console.log(key, !params[key] || !params[key].length)
|
|
|
|
|
|
if (!params[key]) {
|
|
|
|
|
|
delete params[key]
|
|
|
|
|
|
}
|
|
|
|
|
|
if (Array.isArray(params[key]) && !params[key].length) {
|
|
|
|
|
|
delete params[key]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
if (params.basic_auth && !params.basic_auth.username) {
|
|
|
|
|
|
delete params.basic_auth
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.basic_auth && !params.basic_auth.password) {
|
|
|
|
|
|
delete params.basic_auth
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!Object.keys(params.param).length) {
|
|
|
|
|
|
delete params.param
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!Object.keys(params.labels).length) {
|
|
|
|
|
|
delete params.labels
|
|
|
|
|
|
}
|
|
|
|
|
|
this.configsCopyValue = JSON.stringify(params, null, 2)
|
2021-04-15 11:47:44 +08:00
|
|
|
|
console.log(this.configsCopyValue)
|
2021-04-14 15:38:37 +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;
|
|
|
|
|
|
}
|
2021-04-13 19:06:34 +08:00
|
|
|
|
.half-form-item {
|
|
|
|
|
|
width: calc(50% - 30px);
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
padding: 0 18px 0 8px;
|
|
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
.half-form-item:nth-child(even){
|
|
|
|
|
|
padding-left: 0;
|
|
|
|
|
|
}
|
2021-04-13 19:06:34 +08:00
|
|
|
|
/deep/ .el-tabs__item{
|
|
|
|
|
|
width: 90px;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .el-tabs__item.is-active{
|
|
|
|
|
|
color: #FA901C
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .el-tabs__active-bar{
|
|
|
|
|
|
background-color: #FA901C
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .el-radio-group{
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .el-radio{
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .el-autocomplete{
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
/deep/ .el-tabs__content{
|
|
|
|
|
|
padding-left: 18px;
|
|
|
|
|
|
}
|
2021-04-13 19:06:34 +08:00
|
|
|
|
.need-rotate.nz-icon-drop-down{
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
transition: transform .3s;
|
|
|
|
|
|
}
|
|
|
|
|
|
.need-rotate.nz-icon-drop-down.is-active{
|
|
|
|
|
|
transform: rotate(
|
|
|
|
|
|
-180deg
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
.module-add-label{
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 300px;
|
|
|
|
|
|
height: 18px;
|
|
|
|
|
|
background: #FFFCF9;
|
|
|
|
|
|
border: 1px solid #FFE0BD;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
|
margin-right: 80px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.configs-copy-value{
|
|
|
|
|
|
opacity: 0.9;
|
|
|
|
|
|
background: #F6F8FA;
|
|
|
|
|
|
border: 1px solid #E7EAED;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
height: 140px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
margin-top: 10px;
|
2021-04-15 11:47:44 +08:00
|
|
|
|
padding: 10px 0px 10px 15px;
|
2021-04-14 15:38:37 +08:00
|
|
|
|
width: calc(100% - 40px);
|
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.configs-copy-value .copy-value-content{
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 20px;
|
|
|
|
|
|
top: 14px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
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
|
|
|
|
}
|
2021-04-14 15:38:37 +08:00
|
|
|
|
.config-dropdown.hide-element{
|
|
|
|
|
|
border: none!important;
|
|
|
|
|
|
}
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</style>
|