端口池管理增加编辑功能,支持修改端口池所属分组
This commit is contained in:
@@ -43,6 +43,14 @@ export function createPortPool(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePortPool(data) {
|
||||
return request({
|
||||
url: '/port-pool/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePortPool(id) {
|
||||
return request({
|
||||
url: '/port-pool/delete',
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
|
||||
<!-- <el-button v-if="scope.row.status!='deleted'" size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
@@ -56,12 +57,11 @@
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
|
||||
<el-form-item :label="$t('table.port')" prop="port">
|
||||
<el-input v-model="temp.port"></el-input>
|
||||
<el-input v-model="temp.port" :disabled="dialogStatus=='update'"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.group')" prop="group">
|
||||
<el-select style="width: 330px" class="filter-item" v-model="temp.groupId"
|
||||
:disabled="dialogStatus=='update'">
|
||||
<el-select style="width: 330px" class="filter-item" v-model="temp.groupId">
|
||||
<el-option v-for="item in portGroupList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -71,6 +71,7 @@
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -88,7 +89,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, updateEnableStatus, createPortPool, deletePortPool } from '@/api/portPool'
|
||||
import { fetchList, updateEnableStatus, createPortPool, deletePortPool, updatePortPool } from '@/api/portPool'
|
||||
import { portGroupList } from '@/api/portGroup'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
@@ -268,6 +269,25 @@
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
updatePortPool(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deletePortPool(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
|
||||
+9
@@ -51,6 +51,15 @@ public class PortPoolController {
|
||||
return portPoolService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/update")
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getGroupId(), "groupId");
|
||||
return portPoolService.update(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/list")
|
||||
public List<PortPoolListRes> list(PortPoolListReq req) {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateReq {
|
||||
private Integer id;
|
||||
|
||||
private Integer groupId;
|
||||
}
|
||||
+1
-1
@@ -62,5 +62,5 @@ public class PortPoolListRes {
|
||||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private String groupId;
|
||||
private Integer groupId;
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateRes {
|
||||
}
|
||||
+10
-22
@@ -1,34 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
* <p>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* <p>
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* <p>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
@@ -94,6 +73,15 @@ public class PortPoolService {
|
||||
return list.stream().filter(item -> !serverPorts.contains(item.getPort())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
portPoolMapper.update(null, new LambdaUpdateWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getId, req.getId())
|
||||
.set(PortPoolDO::getGroupId, req.getGroupId())
|
||||
.set(PortPoolDO::getUpdateTime, new Date())
|
||||
);
|
||||
|
||||
return new PortPoolUpdateRes();
|
||||
}
|
||||
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
PortPoolDO oldPortPoolDO = portPoolMapper.findByPort(req.getPort());
|
||||
|
||||
Reference in New Issue
Block a user