2019-12-18 17:00:44 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<transition name="right-box">
|
2019-12-20 17:18:30 +08:00
|
|
|
|
<div class="right-box right-box-edit-endpoint" v-if="rightBox.show">
|
2019-12-18 17:00:44 +08:00
|
|
|
|
<!-- begin--顶部按钮-->
|
|
|
|
|
|
<div class="right-box-top-btns">
|
2020-01-17 09:54:01 +08:00
|
|
|
|
<button id="edit-ep-del" type="button" v-if="rightBox.isEdit && endpoint.id != ''" @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light nz-btn-min-width-82">
|
|
|
|
|
|
<span class="right-box-top-btn-icon"><i class="el-icon-delete"></i></span>
|
|
|
|
|
|
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
|
2019-12-27 17:53:17 +08:00
|
|
|
|
</button>
|
2020-01-17 09:54:01 +08:00
|
|
|
|
<button id="edit-ep-edit" v-if="!rightBox.isEdit" type="button" @click="toEdit(true)" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light nz-btn-min-width-82">
|
|
|
|
|
|
<span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-edit"></i></span>
|
|
|
|
|
|
<span class="right-box-top-btn-txt">{{$t('overall.edit')}}</span>
|
2019-12-27 17:53:17 +08:00
|
|
|
|
</button>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--顶部按钮-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--标题-->
|
|
|
|
|
|
<div class="right-box-title">{{rightBox.title}}</div>
|
|
|
|
|
|
<!-- end--标题-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--表单-->
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<el-scrollbar class="right-box-form-box">
|
|
|
|
|
|
<el-form class="right-box-form" :model="endpoint" label-position="top" :rules="rules" ref="endPointForm">
|
|
|
|
|
|
<!--project-->
|
|
|
|
|
|
<el-form-item :label="$t('project.project.project')" prop="project.id">
|
2019-12-20 17:18:30 +08:00
|
|
|
|
<el-select @change="((val) => {changeProject(val);})" value-key="id" popper-class="config-dropdown" v-model="currentProject" placeholder="" v-if="rightBox.isEdit" size="small">
|
2020-01-13 18:48:25 +08:00
|
|
|
|
<el-option :id="'edit-project-'+item.id" v-for="item in projectList" :key="item.id" :label="item.name" :value="item"></el-option>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.project.name}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--module-->
|
|
|
|
|
|
<el-form-item :label="$t('project.module.module')" prop="module.id">
|
2019-12-20 17:18:30 +08:00
|
|
|
|
<el-select @change="((val) => {changeModule(val);})" value-key="id" popper-class="config-dropdown" v-model="currentModule" placeholder="" v-if="rightBox.isEdit" size="small">
|
2020-01-13 18:48:25 +08:00
|
|
|
|
<el-option :id="'edit-module-'+item.id" v-for="item in moduleList" :key="item.id" :label="item.name" :value="item"></el-option>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.module.name}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</el-form-item>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<!--asset-->
|
|
|
|
|
|
<el-form-item :label="$t('asset.asset')" prop="assetId">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<div class="right-box-form-content">
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<el-input class="right-box-row-with-btn" readonly v-if="rightBox.isEdit && endpoint.asset" placeholder="" :value="endpoint.asset.host" size="small"></el-input>
|
|
|
|
|
|
<el-input class="right-box-row-with-btn" readonly v-if="rightBox.isEdit && !endpoint.asset" placeholder="" value="" size="small"></el-input>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<el-popover placement="left"width="400" v-model="subBox.show">
|
|
|
|
|
|
<div class="pop-window-assetType-content">
|
|
|
|
|
|
<!-- begin--顶部按钮-->
|
|
|
|
|
|
<div class="pop-top-btns">
|
2020-01-13 18:48:25 +08:00
|
|
|
|
<button type="button" id="edit-ep-subesc" @click="subEsc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-style-square">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<span class="top-tool-btn-txt"><i class="el-icon-close"></i></span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--顶部按钮-->
|
|
|
|
|
|
<!--begin--标题-->
|
|
|
|
|
|
<div class="pop-title">{{subBox.title}}</div>
|
|
|
|
|
|
<!--end--标题-->
|
|
|
|
|
|
<!---->
|
|
|
|
|
|
<div class="pop-item-wider " >
|
|
|
|
|
|
<!-- begin--搜索框-->
|
|
|
|
|
|
<div class="endpoint-asset-search">
|
|
|
|
|
|
<button type="button" class="nz-btn nz-btn-size-small nz-btn-style-light nz-btn-style-square nz-input-group-prepend" @click="assetSearch.dropdownShow = !assetSearch.dropdownShow">
|
|
|
|
|
|
<span class="endpoint-asset-label-txt">{{assetSearch.label}}</span>
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<i v-if="assetSearch.dropdownShow" class="el-icon-caret-top"></i>
|
|
|
|
|
|
<i v-if="!assetSearch.dropdownShow" class="el-icon-caret-bottom"></i>
|
|
|
|
|
|
</span>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
</button><div class="endpoint-asset-search-input">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<el-input class="input-x-mini nz-input-group-middle" placeholder="" v-model="assetSearch.text"></el-input>
|
2020-01-13 18:48:25 +08:00
|
|
|
|
</div><button type="button" class="nz-btn nz-btn-size-small nz-btn-style-light nz-btn-style-square nz-input-group-append" >
|
|
|
|
|
|
<i @click="searchAsset" class="el-icon-search" id="edit-ep-search-asset"></i>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="endpoint-asset-search-dropdown" v-if="assetSearch.dropdownShow">
|
2020-01-13 18:48:25 +08:00
|
|
|
|
<div @click="dropdownSelect('IP')" class="endpoint-asset-search-dropdown-item" id="edit-ep-search-ip">IP</div>
|
|
|
|
|
|
<div @click="dropdownSelect('SN')" class="endpoint-asset-search-dropdown-item" id="edit-ep-search-sn">SN</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--搜索框-->
|
|
|
|
|
|
<!-- begin--table-->
|
|
|
|
|
|
<div class="endpoint-sub-table">
|
|
|
|
|
|
<div class="endpoint-sub-table-head">
|
|
|
|
|
|
<div class="endpoint-sub-table-col">IP</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">SN</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="line-100"></div>
|
|
|
|
|
|
<div class="endpoint-sub-table-body">
|
|
|
|
|
|
<div v-if="selectedAsset.id != ''" :data="selectedAsset.id" class="endpoint-sub-table-row endpoint-sub-table-row-selected">
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{selectedAsset.host}}</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{selectedAsset.sn}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else class="endpoint-sub-table-row"></div>
|
2020-01-13 18:48:25 +08:00
|
|
|
|
<div id="edit-select-asset" @click="selectAsset(item)" :data="item.id" v-for="item in assetList" class="endpoint-sub-table-row" :class="{'endpoint-sub-table-row-active': item.id == selectedAsset.id}">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<div class="endpoint-sub-table-col">{{item.host}}</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{item.sn}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-paginate">
|
|
|
|
|
|
<div class="endpoint-sub-table-paginate-all">All: {{assetPageObj.total}}</div>
|
|
|
|
|
|
<el-pagination background :pager-count="5" layout="prev, pager, next" @current-change="(currentPage) => {getAssetList(currentPage)}" :total="assetPageObj.total"></el-pagination>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--table-->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div slot="reference" @click.prevent="" class="right-box-row-btn" v-if="rightBox.isEdit">
|
|
|
|
|
|
<span class="el-icon-more"></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.host}}</div>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</el-form-item>
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<!--host-->
|
|
|
|
|
|
<el-form-item :label="$t('project.endpoint.host')" prop="host">
|
|
|
|
|
|
<el-input v-if="rightBox.isEdit" placeholder="" v-model="endpoint.host" size="small"></el-input>
|
|
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.host}}</div>
|
|
|
|
|
|
</el-form-item>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!--port-->
|
|
|
|
|
|
<el-form-item :label="$t('project.endpoint.port')" prop="port">
|
|
|
|
|
|
<el-input v-if="rightBox.isEdit" placeholder="" v-model="endpoint.port" size="small"></el-input>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.port}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--path-->
|
|
|
|
|
|
<el-form-item :label="$t('project.endpoint.port')" prop="path">
|
|
|
|
|
|
<el-input v-if="rightBox.isEdit" placeholder="" v-model="endpoint.path" size="small"></el-input>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{endpoint.path}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<!--param-->
|
|
|
|
|
|
<el-form-item class="right-box-form-param">
|
|
|
|
|
|
<template slot="label">
|
|
|
|
|
|
<span>{{$t('project.endpoint.param')}}</span>
|
|
|
|
|
|
<div class="right-box-form-btns" v-if="rightBox.isEdit">
|
|
|
|
|
|
<button style="display: none;">第一个button会出现意料之外的hover样式,找不到原因,只好加个不可见的button规避问题</button>
|
2020-01-16 18:11:15 +08:00
|
|
|
|
<button type="button" id="edit-clear-all" @click="clearAllParam" class="nz-btn nz-btn-size-normal nz-btn-style-light">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.clearAll')}}</span>
|
|
|
|
|
|
</button>
|
2020-01-16 18:11:15 +08:00
|
|
|
|
<button type="button" id="edit-add-param" @click="addParam" class="nz-btn nz-btn-size-normal nz-btn-style-normal">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div class="param-box param-box-module">
|
|
|
|
|
|
<div class="param-box-row" v-for="(item, index) in endpoint.paramObj" v-if="rightBox.isEdit">
|
|
|
|
|
|
<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>
|
|
|
|
|
|
</el-form-item>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
<span class="param-box-row-eq">=</span>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<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-01-08 22:19:46 +08:00
|
|
|
|
<span class="param-box-row-symbol" @click="removeParam(index)"><i class="nz-icon nz-icon-minus-square"></i></span>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="param-box-row" v-for="(item, index) in endpoint.paramObj" v-if="!rightBox.isEdit">
|
|
|
|
|
|
<div class="right-box-form-content-txt">{{item.key}}={{item.value}}</div>
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</el-scrollbar>
|
2020-01-15 20:55:24 +08:00
|
|
|
|
|
2019-12-18 17:00:44 +08:00
|
|
|
|
<!-- end--表单-->
|
|
|
|
|
|
|
2020-01-16 18:11:15 +08:00
|
|
|
|
<!--底部按钮-->
|
|
|
|
|
|
<div class="right-box-bottom-btns">
|
|
|
|
|
|
<button @click="esc" id="ep-edit-esc" class="nz-btn nz-btn-size-large nz-btn-style-light nz-btn-min-width-120">
|
|
|
|
|
|
<span>{{$t('overall.cancel')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button v-if="rightBox.isEdit" @click="save" id="ep-edit-save" class="nz-btn nz-btn-size-large nz-btn-style-normal nz-btn-min-width-120">
|
|
|
|
|
|
<span>{{$t('overall.save')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<!-- begin--子弹框-->
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!--<transition name="right-sub-box">
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<div class="right-sub-box" @click.stop v-if="subBox.show">
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– begin--标题–>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<div class="right-box-title">{{subBox.title}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– end--标题–>
|
2019-12-20 17:18:30 +08:00
|
|
|
|
<div class="right-box-top-btn right-box-top-btn-full" @click="subEsc">
|
|
|
|
|
|
<div class="right-box-btn-icon">
|
|
|
|
|
|
<i class="el-icon-close"></i>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
</div>
|
2019-12-20 17:18:30 +08:00
|
|
|
|
<span>{{$t('overall.esc')}}</span>
|
|
|
|
|
|
</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– begin--搜索框–>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<el-input placeholder="" v-model="assetSearch.text">
|
|
|
|
|
|
<template slot="prepend">
|
|
|
|
|
|
<div class="endpoint-asset-prepend">
|
|
|
|
|
|
<div class="endpoint-asset-label">
|
|
|
|
|
|
<span class="endpoint-asset-label-txt">{{assetSearch.label}}</span>
|
|
|
|
|
|
<span @click="assetSearch.dropdownShow = !assetSearch.dropdownShow">
|
|
|
|
|
|
<i v-if="assetSearch.dropdownShow" class="el-icon-arrow-up"></i>
|
|
|
|
|
|
<i v-if="!assetSearch.dropdownShow" class="el-icon-arrow-down"></i>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="endpoint-asset-dropdown" v-if="assetSearch.dropdownShow">
|
|
|
|
|
|
<div @click="dropdownSelect('IP')" class="endpoint-asset-dropdown-item">IP</div>
|
|
|
|
|
|
<div @click="dropdownSelect('SN')" class="endpoint-asset-dropdown-item">SN</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="append"><i @click="searchAsset" class="el-icon-search"></i></template>
|
|
|
|
|
|
</el-input>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– end--搜索框–>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– begin--table–>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<div class="endpoint-sub-table">
|
|
|
|
|
|
<div class="endpoint-sub-table-head">
|
|
|
|
|
|
<div class="endpoint-sub-table-col">IP</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">SN</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="line-100"></div>
|
|
|
|
|
|
<div class="endpoint-sub-table-body">
|
|
|
|
|
|
<div v-if="selectedAsset.id != ''" :data="selectedAsset.id" class="endpoint-sub-table-row endpoint-sub-table-row-selected">
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{selectedAsset.host}}</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{selectedAsset.sn}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else class="endpoint-sub-table-row"></div>
|
|
|
|
|
|
<div @click="selectAsset(item)" :data="item.id" v-for="item in assetList" class="endpoint-sub-table-row" :class="{'endpoint-sub-table-row-active': item.id == selectedAsset.id}">
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{item.host}}</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-col">{{item.sn}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="endpoint-sub-table-paginate">
|
|
|
|
|
|
<div class="endpoint-sub-table-paginate-all">All: {{assetPageObj.total}}</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<el-pagination background :pager-count="5" layout="prev, pager, next" @current-change="(currentPage) => {getAssetList(currentPage)}" :total="assetPageObj.total"></el-pagination>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
<!– end--table–>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
</div>
|
2020-01-07 17:41:46 +08:00
|
|
|
|
</transition>-->
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<!-- end--子弹框-->
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "endpointBox",
|
|
|
|
|
|
props: {
|
|
|
|
|
|
endpoint: Object,
|
|
|
|
|
|
currentProject: Object,
|
|
|
|
|
|
currentModule: Object
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2019-12-19 17:22:18 +08:00
|
|
|
|
rightBox: {show: false, title: '',isEdit: false},
|
|
|
|
|
|
subBox: {show: false, title: this.$t("overall.asset")}, //asset子弹框
|
|
|
|
|
|
assetSearch: {host: '', sn: '', text: '', label: 'IP', dropdownShow: false}, //侧滑框中asset的搜索相关
|
|
|
|
|
|
assetPageObj: {pageNo: 1, pageSize: 11, total: 0},
|
|
|
|
|
|
selectedAsset: {id: '', host: '', sn: ''}, //endpoint侧滑框中选中的asset
|
|
|
|
|
|
projectList: [],
|
|
|
|
|
|
moduleList: [],
|
2020-01-07 17:41:46 +08:00
|
|
|
|
assetList: [],
|
|
|
|
|
|
rules:{
|
|
|
|
|
|
'project.id':[
|
|
|
|
|
|
{required:true,message:this.$t('validate.required'),trigger:'change'}
|
|
|
|
|
|
],
|
|
|
|
|
|
'module.id':[
|
|
|
|
|
|
{required:true,message:this.$t('validate.required'),trigger:'change'}
|
|
|
|
|
|
],
|
2020-01-08 22:19:46 +08:00
|
|
|
|
assetId: [
|
|
|
|
|
|
{required:true,message:this.$t('validate.required'),trigger:'blur'}
|
|
|
|
|
|
],
|
2020-01-07 17:41:46 +08:00
|
|
|
|
port:[
|
|
|
|
|
|
{required:true,message:this.$t('validate.required'),trigger:'blur'}
|
|
|
|
|
|
],
|
|
|
|
|
|
path:[
|
|
|
|
|
|
{required:true,message:this.$t('validate.required'),trigger:'blur'}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
2019-12-19 17:22:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
show(show) {
|
|
|
|
|
|
this.rightBox.show = show;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
toEdit(show) {
|
|
|
|
|
|
this.rightBox.isEdit = show;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//endpoint弹框中asset子弹框控制
|
|
|
|
|
|
showSubBox(show) {
|
|
|
|
|
|
this.subBox.show = show;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/*关闭弹框*/
|
|
|
|
|
|
esc() {
|
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
|
this.subBox.show = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/*关闭子弹框*/
|
|
|
|
|
|
subEsc() {
|
|
|
|
|
|
this.subBox.show = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 清除param
|
|
|
|
|
|
clearAllParam() {
|
|
|
|
|
|
this.endpoint.paramObj = [];
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 新增param
|
|
|
|
|
|
addParam() {
|
|
|
|
|
|
this.endpoint.paramObj.push({key: '', value: ''});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 移除单个param
|
|
|
|
|
|
removeParam(index) {
|
|
|
|
|
|
this.endpoint.paramObj.splice(index, 1);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//将param转为json字符串格式
|
|
|
|
|
|
paramToJson(param) {
|
|
|
|
|
|
let tempParam = {};
|
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
2019-12-24 17:31:51 +08:00
|
|
|
|
eval('tempParam["' + param[i].key + '"]="' + param[i].value + '"');
|
2019-12-19 17:22:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
let jsonString = JSON.stringify(tempParam);
|
|
|
|
|
|
if (jsonString == '{}') {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return jsonString;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/*获取project列表*/
|
|
|
|
|
|
getProjectList() {
|
|
|
|
|
|
this.$get('project', {pageSize: 999, pageNo: 1}).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.projectList = response.data.list;
|
2019-12-20 17:18:30 +08:00
|
|
|
|
if ((!this.currentProject || !this.currentProject.id) && this.projectList.length > 0) {
|
|
|
|
|
|
this.currentProject = this.projectList[0];
|
|
|
|
|
|
}
|
2019-12-19 17:22:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2019-12-20 17:18:30 +08:00
|
|
|
|
//project下拉框点击事件
|
|
|
|
|
|
changeProject(project) {
|
|
|
|
|
|
this.currentModule = {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []};
|
|
|
|
|
|
this.getModuleList(project.id);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//project下拉框点击事件
|
|
|
|
|
|
changeModule(module) {
|
|
|
|
|
|
this.currentModule = module;
|
|
|
|
|
|
this.endpoint.port = module.port;
|
|
|
|
|
|
this.endpoint.path = module.path;
|
|
|
|
|
|
this.endpoint.paramObj = module.paramObj;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2019-12-19 17:22:18 +08:00
|
|
|
|
// 获取endpoint弹框中的asset子弹框里asset列表数据
|
|
|
|
|
|
getAssetList(currentPage) {
|
|
|
|
|
|
if (currentPage) {
|
|
|
|
|
|
this.assetPageObj.pageNo = currentPage;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.assetPageObj.pageNo = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$get('asset', this.assetPageObj).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.assetList = response.data.list;
|
|
|
|
|
|
this.assetPageObj.total = response.data.total;
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2019-12-19 17:22:18 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//endpoint弹框中的asset子弹框搜索
|
|
|
|
|
|
searchAsset() {
|
|
|
|
|
|
if (this.assetSearch.label == 'IP') {
|
|
|
|
|
|
this.assetSearch.host = this.assetSearch.text;
|
|
|
|
|
|
this.assetSearch.sn = '';
|
|
|
|
|
|
} else if (this.assetSearch.label == 'SN') {
|
|
|
|
|
|
this.assetSearch.sn = this.assetSearch.text;
|
|
|
|
|
|
this.assetSearch.host = '';
|
|
|
|
|
|
}
|
|
|
|
|
|
this.assetPageObj = Object.assign({}, this.assetPageObj, this.assetSearch);
|
|
|
|
|
|
this.getAssetList(false);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// endpoint弹框中的asset子弹框里asset选择事件
|
|
|
|
|
|
selectAsset(obj) {
|
|
|
|
|
|
this.selectedAsset = obj;
|
|
|
|
|
|
this.endpoint.host = obj.host;
|
|
|
|
|
|
this.endpoint.assetId = obj.id;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 获取endpoint弹框中module下拉框数据
|
|
|
|
|
|
getModuleList(projectId) {
|
|
|
|
|
|
this.$get('module', {projectId: projectId}).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let tempObj = JSON.parse(response.data.list[i].param);
|
|
|
|
|
|
response.data.list[i].paramObj = [];
|
|
|
|
|
|
for (let k in tempObj) {
|
|
|
|
|
|
response.data.list[i].paramObj.push({key: k, value: tempObj[k]})
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch(err) {
|
|
|
|
|
|
console.info(response.data.list[i], err);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.moduleList = response.data.list;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//保存endpoint
|
|
|
|
|
|
save() {
|
2020-01-07 17:41:46 +08:00
|
|
|
|
this.$refs.endPointForm.validate((valide=>{
|
|
|
|
|
|
if(valide){
|
|
|
|
|
|
this.endpoint.moduleId = this.currentModule.id;
|
|
|
|
|
|
this.endpoint.projectId = this.currentProject.id;
|
|
|
|
|
|
this.endpoint.param = this.paramToJson(this.endpoint.paramObj);
|
|
|
|
|
|
let requestData = [];
|
|
|
|
|
|
requestData.push(this.endpoint);
|
|
|
|
|
|
this.$put('endpoint', requestData).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
|
|
|
|
|
this.esc();
|
|
|
|
|
|
this.$emit("reload");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return false;
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2020-01-07 17:41:46 +08:00
|
|
|
|
}))
|
|
|
|
|
|
|
2019-12-19 17:22:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//删除endpoint
|
|
|
|
|
|
del() {
|
|
|
|
|
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete("endpoint?ids=" + this.endpoint.id).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
|
this.$emit('reload');
|
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
// endpoint弹框的asset子弹框顶部搜索条件选中事件
|
|
|
|
|
|
dropdownSelect(label) {
|
|
|
|
|
|
this.assetSearch.label = label;
|
|
|
|
|
|
this.assetSearch.dropdownShow = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
this.getProjectList();
|
|
|
|
|
|
this.getAssetList();
|
|
|
|
|
|
},
|
2019-12-31 19:02:58 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
projectListReloadWatch() {
|
|
|
|
|
|
return this.$store.state.projectListChange;
|
|
|
|
|
|
},
|
|
|
|
|
|
moduleListReloadWatch() {
|
|
|
|
|
|
return this.$store.state.moduleListChange;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2019-12-19 17:22:18 +08:00
|
|
|
|
mounted() {
|
2019-12-20 17:18:30 +08:00
|
|
|
|
setTimeout(()=>{this.getModuleList(this.currentProject.id);}, 100);
|
2019-12-19 17:22:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
endpoint(n, o) {
|
|
|
|
|
|
if (n && n.id) {
|
|
|
|
|
|
this.rightBox.title = this.$t("project.endpoint.editEndpoint") + " ID:" + n.id;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.rightBox.title = this.$t("project.endpoint.createEndpoint");
|
|
|
|
|
|
}
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
projectListReloadWatch(n, o) {
|
|
|
|
|
|
this.getProjectList();
|
|
|
|
|
|
},
|
|
|
|
|
|
moduleListReloadWatch(n, o) {
|
|
|
|
|
|
this.getModuleList(this.currentProject.id);
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2020-01-15 20:55:24 +08:00
|
|
|
|
.nz-btn-edit-ok{
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
right:0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.nz-btn-edit-esc{
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
left:0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-12-18 17:00:44 +08:00
|
|
|
|
</style>
|