|
@@ -191,7 +191,7 @@
|
|
|
<template #bodyCell="{column, record, index}" >
|
|
<template #bodyCell="{column, record, index}" >
|
|
|
<template v-if="column.key === 'action'" >
|
|
<template v-if="column.key === 'action'" >
|
|
|
<a-space>
|
|
<a-space>
|
|
|
- <!-- <a @click="updateForwardRuleTargets(record, index)">编辑</a> -->
|
|
|
|
|
|
|
+ <a @click="updateForwardRuleTargets(record, index)">编辑</a>
|
|
|
<a @click="forwardRuleTargets.splice(index, 1)">删除</a>
|
|
<a @click="forwardRuleTargets.splice(index, 1)">删除</a>
|
|
|
</a-space>
|
|
</a-space>
|
|
|
</template>
|
|
</template>
|
|
@@ -209,7 +209,7 @@
|
|
|
label="转发目标"
|
|
label="转发目标"
|
|
|
:open="state.targetVisible"
|
|
:open="state.targetVisible"
|
|
|
:ok-text=" state.stepCount === 0 ? '下一步' : '确定'"
|
|
:ok-text=" state.stepCount === 0 ? '下一步' : '确定'"
|
|
|
- @cancel="state.targetVisible = false"
|
|
|
|
|
|
|
+ @cancel="closeModal"
|
|
|
@ok="ok('targetVisible')"
|
|
@ok="ok('targetVisible')"
|
|
|
>
|
|
>
|
|
|
<a-form :label-col="{span: 4 }" :wrapper-col="{ span: 14 }" style="height: 400px; overflow-y: auto;">
|
|
<a-form :label-col="{span: 4 }" :wrapper-col="{ span: 14 }" style="height: 400px; overflow-y: auto;">
|
|
@@ -355,7 +355,7 @@
|
|
|
<a-input allowClear v-model:value="forwardState.host" placeholder="请填写域名" />
|
|
<a-input allowClear v-model:value="forwardState.host" placeholder="请填写域名" />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
<a-form-item label="端口" v-bind="validateInfos.port">
|
|
<a-form-item label="端口" v-bind="validateInfos.port">
|
|
|
- <a-input allowClear v-model:value="forwardState.port" placeholder="请填写端口" />
|
|
|
|
|
|
|
+ <a-input allowClear v-model:value="forwardState.port" placeholder="请填写端口" />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
<a-form-item label="虚拟主机" v-bind="validateInfos.virtualHost">
|
|
<a-form-item label="虚拟主机" v-bind="validateInfos.virtualHost">
|
|
|
<a-input allowClear v-model:value="forwardState.virtualHost" placeholder="请填写虚拟主机" />
|
|
<a-input allowClear v-model:value="forwardState.virtualHost" placeholder="请填写虚拟主机" />
|
|
@@ -682,7 +682,8 @@ const state = reactive({
|
|
|
opraState: 'add',
|
|
opraState: 'add',
|
|
|
forwardId: '',
|
|
forwardId: '',
|
|
|
testVisble: false,
|
|
testVisble: false,
|
|
|
- forwardCount: []
|
|
|
|
|
|
|
+ forwardCount: [],
|
|
|
|
|
+ updateIndex: '' // 对规则的编辑时的下标
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const requestHeader = { key: '', value: '' }
|
|
const requestHeader = { key: '', value: '' }
|
|
@@ -731,7 +732,7 @@ const initForwardState = {
|
|
|
|
|
|
|
|
const forwardR1Ref = ref()
|
|
const forwardR1Ref = ref()
|
|
|
|
|
|
|
|
-let forwardState = reactive(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
|
|
|
|
+const forwardState = reactive(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
|
|
|
|
|
const forwardRStateStep1 = reactive({
|
|
const forwardRStateStep1 = reactive({
|
|
|
ruleLabel: '',
|
|
ruleLabel: '',
|
|
@@ -793,9 +794,7 @@ const { resetFields: resetFieldsStep1, validate: validateStep1, validateInfos: v
|
|
|
|
|
|
|
|
const updateForwardRuleTargets = (record, index) => {
|
|
const updateForwardRuleTargets = (record, index) => {
|
|
|
state.targetVisible = true
|
|
state.targetVisible = true
|
|
|
- forwardState.targetType = record.targetType
|
|
|
|
|
- // forwardState.id = useId()
|
|
|
|
|
- console.log('forwardState:', forwardState)
|
|
|
|
|
|
|
+ state.updateIndex = index
|
|
|
resetFields({ ...record })
|
|
resetFields({ ...record })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -818,6 +817,15 @@ const openModalDebug = (id: string) => {
|
|
|
|
|
|
|
|
const closeModal = () => {
|
|
const closeModal = () => {
|
|
|
state.stepCount = 1
|
|
state.stepCount = 1
|
|
|
|
|
+ state.targetVisible = false
|
|
|
|
|
+ resetFields(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
|
|
+ resetFieldsStep1({
|
|
|
|
|
+ ruleLabel: '',
|
|
|
|
|
+ subjectResource: '',
|
|
|
|
|
+ subjectEvent: '',
|
|
|
|
|
+ ruleDescription: ''
|
|
|
|
|
+ })
|
|
|
|
|
+ forwardRuleTargets = []
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const openModal = async (opraState: 'add' | 'update', record) => {
|
|
const openModal = async (opraState: 'add' | 'update', record) => {
|
|
@@ -871,13 +879,14 @@ const openModal = async (opraState: 'add' | 'update', record) => {
|
|
|
const addRequestHeaders = (key: 'requestHeaders' | 'otherProperties') => forwardState[key].push({ ...requestHeader })
|
|
const addRequestHeaders = (key: 'requestHeaders' | 'otherProperties') => forwardState[key].push({ ...requestHeader })
|
|
|
|
|
|
|
|
const search = (record) => {
|
|
const search = (record) => {
|
|
|
- console.log('search', record)
|
|
|
|
|
queryParams = { ...queryParams, ...record }
|
|
queryParams = { ...queryParams, ...record }
|
|
|
getForwardList()
|
|
getForwardList()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const addForwardState = () => {
|
|
const addForwardState = () => {
|
|
|
state.targetVisible = true
|
|
state.targetVisible = true
|
|
|
|
|
+ state.updateIndex = ''
|
|
|
|
|
+ resetFields(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const changeStatus = async (record) => RuleController.updateForwardStatus({ id: record.id, status: record.status })
|
|
const changeStatus = async (record) => RuleController.updateForwardStatus({ id: record.id, status: record.status })
|
|
@@ -899,19 +908,15 @@ const ok = async (visibleKey: string) => {
|
|
|
if (state.stepCount === 1) {
|
|
if (state.stepCount === 1) {
|
|
|
if (state.targetVisible) {
|
|
if (state.targetVisible) {
|
|
|
validate().then(() => {
|
|
validate().then(() => {
|
|
|
- console.log('触发这里11111')
|
|
|
|
|
- const index = forwardRuleTargets.findIndex(item => item.id === forwardState.id)
|
|
|
|
|
- if (index >= 0) {
|
|
|
|
|
- forwardRuleTargets.splice(index, 1, forwardState)
|
|
|
|
|
|
|
+ if (typeof state.updateIndex === 'number') {
|
|
|
|
|
+ forwardRuleTargets.splice(state.updateIndex, 1, { ...forwardState })
|
|
|
} else {
|
|
} else {
|
|
|
- forwardRuleTargets.push({ ...forwardState, id: useId() })
|
|
|
|
|
- forwardState = reactive(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
|
|
|
|
+ forwardRuleTargets.push({ ...forwardState })
|
|
|
|
|
+ resetFields(JSON.parse(JSON.stringify(initForwardState)))
|
|
|
}
|
|
}
|
|
|
state.targetVisible = false
|
|
state.targetVisible = false
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- console.log('触发这里222')
|
|
|
|
|
-
|
|
|
|
|
const _otherProperties: Record<string, string> = {}
|
|
const _otherProperties: Record<string, string> = {}
|
|
|
|
|
|
|
|
forwardRuleTargets.forEach(item => {
|
|
forwardRuleTargets.forEach(item => {
|
|
@@ -929,8 +934,6 @@ const ok = async (visibleKey: string) => {
|
|
|
item.otherProperties = _otherProperties
|
|
item.otherProperties = _otherProperties
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- console.log('forwardState:', forwardState)
|
|
|
|
|
-
|
|
|
|
|
forwardState.otherProperties.forEach(item => {
|
|
forwardState.otherProperties.forEach(item => {
|
|
|
_otherProperties[item.key] = item.value
|
|
_otherProperties[item.key] = item.value
|
|
|
})
|
|
})
|
|
@@ -941,6 +944,7 @@ const ok = async (visibleKey: string) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
state.visible = false
|
|
state.visible = false
|
|
|
|
|
+ closeModal()
|
|
|
getForwardList()
|
|
getForwardList()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|