From c28ce07a6db05e120781ded9c7406cf283a2e0a0 Mon Sep 17 00:00:00 2001 From: suxiang <2585546823@qq.com> Date: Thu, 8 Aug 2024 20:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=AB=AF=E5=8F=A3=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=EF=BC=9A=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E5=9F=9F=E5=90=8D=E6=B7=BB=E5=8A=A0=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- neutrino-proxy-admin/src/api/domain.js | 10 +++ .../src/views/proxy/portMapping.vue | 71 ++++++++++++++----- 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/neutrino-proxy-admin/src/api/domain.js b/neutrino-proxy-admin/src/api/domain.js index ca9100cd..04984177 100644 --- a/neutrino-proxy-admin/src/api/domain.js +++ b/neutrino-proxy-admin/src/api/domain.js @@ -15,6 +15,14 @@ export function fetchList(query) { }) } +export function fetchAvailableDomainList(query) { + return request({ + url: '/domain/all', + method: 'get', + params: query + }) +} + export function updateEnableStatus(id, enable) { return request({ url: '/domain/update/enable-status', @@ -62,3 +70,5 @@ export function updateDefaultStatus(id, isDefault) { } }) } + + diff --git a/neutrino-proxy-admin/src/views/proxy/portMapping.vue b/neutrino-proxy-admin/src/views/proxy/portMapping.vue index 06852884..7e373adb 100644 --- a/neutrino-proxy-admin/src/views/proxy/portMapping.vue +++ b/neutrino-proxy-admin/src/views/proxy/portMapping.vue @@ -167,10 +167,18 @@ - - - - + +
+ + + +
+ 添加域名
@@ -225,13 +233,13 @@ import { availablePortList, portAvailable } from '@/api/portPool' import { licenseList, licenseAuthList } from '@/api/license' import { protocalList } from '@/api/protocal' import { userList } from '@/api/user' -import { domainNameBindInfo } from '@/api/domain' 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"; +import {fetchAvailableDomainList} from "../../api/domain"; const calendarTypeOptions = [ { key: 'CN', display_name: 'China' }, @@ -297,7 +305,7 @@ export default { protocalList: [], licenseAuthList: [], serverPortList: [], - domainName: '', + domainList: [{ 'name': 'link.com', 'id': '1' }], showReviewer: false, temp: { id: undefined, @@ -308,7 +316,8 @@ export default { clientPort: undefined, protocal: undefined, proxyResponses: undefined, - proxyTimeoutMs: undefined + proxyTimeoutMs: undefined, + domainMappings: [] }, selectObj: { statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }], @@ -323,6 +332,21 @@ export default { dialogPvVisible: false, pvData: [], rules: { + domainMappings: [ + { + validator: (rule, value, callback) => { + if (value && value.length > 0) { + for (let i = 0; i < value.length; i++) { + if (!value[i].subdomain || !value[i].domain) { + return callback(new Error(`子域名和主域名都不能为空`)); + } + } + } + callback(); // 验证通过 + }, + trigger: '' + } + ], licenseId: [{ required: true, message: '请选择License', trigger: 'blur,change' }], serverPort: [{ required: true, message: '请输入服务端端口', trigger: 'blur' }, // { validator: isPortAvailable, trigger: 'change' } @@ -372,14 +396,26 @@ export default { } }, created() { - this.getDomainNameBindInfo() this.getDataList() this.getLicenseList() this.getLicenseAuthList() this.getProtocalList() this.fetchSecurityGroupList() + this.getAvailableDomainList() }, methods: { + // 添加新的域名映射 + addDomainMapping() { + this.temp.domainMappings.push({ + subdomain: '', + domain: '' + }); + // console.log(this.temp) + }, + // 删除指定的域名映射 + removeDomainMapping(index) { + this.temp.domainMappings.splice(index, 1); + }, getList() { this.listLoading = true fetchList(this.listQuery).then(response => { @@ -406,15 +442,15 @@ export default { } }) }, - getDomainNameBindInfo() { - domainNameBindInfo().then(response => { - this.domainName = response.data.data - }) - }, getAvailablePortList(licenseId) { this.loadServerPortQuery.licenseId = licenseId; this.serverPortList = []; //清掉数据 }, + getAvailableDomainList() { + fetchAvailableDomainList({enable:1}).then(response => { + this.domainList = response.data.data + }) + }, getAllUserList() { userList().then(response => { this.userList = response.data.data @@ -469,9 +505,10 @@ export default { clientPort: undefined, userId: undefined, proxyResponses: undefined, - proxyTimeoutMs: undefined - } - this.serverPortList = [] + proxyTimeoutMs: undefined, + domainMappings: [] + }; + this.serverPortList = []; this.loadServerPortQuery.licenseId = null; this.more = true; }, @@ -486,6 +523,7 @@ export default { createData() { this.$refs['dataForm'].validate((valid) => { if (valid) { + console.log(this.temp) createUserPortMapping(this.temp).then(response => { if (response.data.code === 0) { this.dialogFormVisible = false @@ -509,6 +547,7 @@ export default { open(url) }, handleUpdate(row) { + console.log(row) this.temp = Object.assign({}, row) // copy obj if (row.securityGroupId === 0) { this.temp.securityGroupId = null