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 @@
-
-
- .{{ domainName }}
-
+
+
+
+
+
+
+
+ 删除
+
+
+
+ 添加域名
@@ -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