diff --git a/neutrino-proxy-admin/src/api/portPool.js b/neutrino-proxy-admin/src/api/portPool.js
index 310c8933..4a8ee331 100644
--- a/neutrino-proxy-admin/src/api/portPool.js
+++ b/neutrino-proxy-admin/src/api/portPool.js
@@ -14,13 +14,11 @@ export function portPoolList() {
method: 'get'
})
}
-export function availablePortList(licenseId) {
+export function availablePortList(query) {
return request({
url: '/port-pool/get-available-port-list',
method: 'get',
- params: {
- licenseId: licenseId
- }
+ params: query
})
}
diff --git a/neutrino-proxy-admin/src/components/Select/SelectLoadMore.vue b/neutrino-proxy-admin/src/components/Select/SelectLoadMore.vue
new file mode 100644
index 00000000..82a27536
--- /dev/null
+++ b/neutrino-proxy-admin/src/components/Select/SelectLoadMore.vue
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/neutrino-proxy-admin/src/views/proxy/portMapping.vue b/neutrino-proxy-admin/src/views/proxy/portMapping.vue
index 725ac591..ec5f643a 100644
--- a/neutrino-proxy-admin/src/views/proxy/portMapping.vue
+++ b/neutrino-proxy-admin/src/views/proxy/portMapping.vue
@@ -142,11 +142,22 @@
-
+
+
+
@@ -196,6 +207,8 @@ import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import ButtonPopover from '../../components/Button/buttonPopover'
import DropdownTable from '../../components/Dropdown/DropdownTable'
+// 下拉选择加载组件
+import loadSelect from "@/components/Select/SelectLoadMore";
const calendarTypeOptions = [
{ key: 'CN', display_name: 'China' },
@@ -217,7 +230,8 @@ export default {
},
components: {
DropdownTable,
- ButtonPopover
+ ButtonPopover,
+ loadSelect
},
data() {
return {
@@ -282,7 +296,13 @@ export default {
countryColumns: [
{ prop: 'userName', label: '用户名', align: 'center' },
{ prop: 'name', label: 'License', align: 'center' }
- ]
+ ],
+ loadServerPortQuery:{ //下拉框加载数据请求参数
+ page:1,
+ size:50,
+ licenseId:null,
+ },
+ more: true,
}
},
filters: {
@@ -343,15 +363,9 @@ export default {
this.domainName = response.data.data
})
},
- getPortPoolList() {
- portPoolList().then(response => {
- this.serverPortList = response.data.data
- })
- },
getAvailablePortList(licenseId) {
- availablePortList(licenseId).then(response => {
- this.serverPortList = response.data.data
- })
+ this.loadServerPortQuery.licenseId = licenseId;
+ this.serverPortList = []; //清掉数据
},
getAllUserList() {
userList().then(response => {
@@ -408,6 +422,8 @@ export default {
userId: undefined
}
this.serverPortList = []
+ this.loadServerPortQuery.licenseId = null;
+ this.more = true;
},
handleCreate() {
this.resetTemp()
@@ -526,7 +542,37 @@ export default {
return v[j]
}
}))
- }
+ },
+ // 传入给load-select组件的函数
+ loadServerPort({page = 1, more = false, keyword = ""} = {}) {
+ if(this.loadServerPortQuery.licenseId==null || this.loadServerPortQuery.licenseId==''){
+ this.more = false;
+ this.$message({
+ message: '请先选择License',
+ type: 'warning'
+ })
+ return ;
+ }
+ return new Promise(resolve => {
+ this.loadServerPortQuery.page = page;
+ this.loadServerPortQuery.keyword = keyword;
+ // 访问后端接口API
+ availablePortList(this.loadServerPortQuery).then(res => {
+ let result = res.data;
+ if (more) {
+ this.serverPortList = [...this.serverPortList, ...result.data.records];
+ } else {
+ this.serverPortList = result.data.records;
+ }
+
+ // this.loadServerPortQuery.page = result.data.current;
+ let {total, current, size} = result.data;
+ this.more = page * size < total;
+ this.loadServerPortQuery.page = current;
+ resolve();
+ });
+ });
+ },
}
}
diff --git a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/PortPoolController.java b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/PortPoolController.java
index 86743108..76ac35fe 100644
--- a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/PortPoolController.java
+++ b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/PortPoolController.java
@@ -102,7 +102,7 @@ public class PortPoolController {
@Get
@Mapping("/get-available-port-list")
- public List getAvailablePortList(AvailablePortListReq req) {
+ public PageInfo getAvailablePortList(AvailablePortListReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
return portPoolService.getAvailablePortList(req);
diff --git a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/AvailablePortListReq.java b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/AvailablePortListReq.java
index 81526756..448700b9 100644
--- a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/AvailablePortListReq.java
+++ b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/AvailablePortListReq.java
@@ -12,4 +12,18 @@ public class AvailablePortListReq {
* licenseId
*/
private Integer licenseId;
+
+ /**
+ * 当前页
+ */
+ private int page = 1;
+ /**
+ * 分页大小
+ */
+ private int size = 10;
+
+ /**
+ * 搜索关键字
+ */
+ private String keyword;
}
diff --git a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/dal/PortPoolMapper.java b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/dal/PortPoolMapper.java
index 7c045a98..29776db2 100644
--- a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/dal/PortPoolMapper.java
+++ b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/dal/PortPoolMapper.java
@@ -67,5 +67,5 @@ public interface PortPoolMapper extends BaseMapper {
List selectResList(@Param("req") PortPoolListReq req);
- List getAvailablePortList(@Param("licenseId") Integer licenseId,@Param("userId") Integer userId);
+ List getAvailablePortList(@Param("licenseId") Integer licenseId,@Param("userId") Integer userId, @Param("keyword") String keyword);
}
diff --git a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/service/PortPoolService.java b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/service/PortPoolService.java
index b3f03491..a8e42f00 100644
--- a/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/service/PortPoolService.java
+++ b/neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/service/PortPoolService.java
@@ -175,9 +175,17 @@ public class PortPoolService {
* 游客:全局端口 + 当前选择用户独占端口 + 当前选择license独占端口
* 非管理员身份时:下拉选择license,只能选当前用户下的LICENSE
*/
- public List getAvailablePortList(AvailablePortListReq req) {
+ public PageInfo getAvailablePortList(AvailablePortListReq req) {
+
LicenseDO licenseDO = licenseMapper.queryById(req.getLicenseId());
- return portPoolMapper.getAvailablePortList(req.getLicenseId(), licenseDO.getUserId());
+ if(StringUtils.isNotEmpty(req.getKeyword())){
+ req.setKeyword(req.getKeyword()+"%");
+ }
+
+ Page result = PageHelper.startPage(req.getPage(), req.getSize());
+ List portList = portPoolMapper.getAvailablePortList(req.getLicenseId(), licenseDO.getUserId(), req.getKeyword());
+
+ return PageInfo.of(portList, result.getTotal(), req.getPage(), req.getSize());
}
public void deleteBatch(List ids) {
diff --git a/neutrino-proxy-server/src/main/resources/mapper/PortPoolMapper.xml b/neutrino-proxy-server/src/main/resources/mapper/PortPoolMapper.xml
index 6cbb1935..e2c22c2c 100644
--- a/neutrino-proxy-server/src/main/resources/mapper/PortPoolMapper.xml
+++ b/neutrino-proxy-server/src/main/resources/mapper/PortPoolMapper.xml
@@ -32,6 +32,9 @@
possessor_type = 0
OR ( possessor_type = 1 AND possessor_id = #{userId,jdbcType=INTEGER} )
OR ( possessor_type = 2 AND possessor_id = #{licenseId,jdbcType=INTEGER} )
- )
+ )
+
+ AND `port` LIKE #{keyword}
+