|
@@ -1,7 +1,8 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { onMounted, ref, watch } from 'vue';
|
|
|
|
|
|
+import { onMounted, ref, useTemplateRef, watch } from 'vue';
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
|
|
|
+import ConfirmModal from '@/components/ConfirmModal.vue';
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
import { useRequest } from '@/hooks/request';
|
|
import { useRequest } from '@/hooks/request';
|
|
import { t } from '@/i18n';
|
|
import { t } from '@/i18n';
|
|
@@ -24,10 +25,12 @@ import type {
|
|
} from '@/types';
|
|
} from '@/types';
|
|
|
|
|
|
const props = defineProps<UseGuideStepItemProps<RegisterGatewayForm>>();
|
|
const props = defineProps<UseGuideStepItemProps<RegisterGatewayForm>>();
|
|
-
|
|
|
|
|
|
+const modalComponentRef = useTemplateRef('modalComponent');
|
|
const currentStep = props.steps[props.stepIndex];
|
|
const currentStep = props.steps[props.stepIndex];
|
|
-
|
|
|
|
|
|
+const interfaceId = ref<number>();
|
|
const interfaceList = ref<ListInterfaces[]>([]);
|
|
const interfaceList = ref<ListInterfaces[]>([]);
|
|
|
|
+const protocolName = ref<string>('');
|
|
|
|
+const linkName = ref<string>('');
|
|
|
|
|
|
const listPhysicalInterfaces = ref<ListPhysicalInterfaces[]>([]);
|
|
const listPhysicalInterfaces = ref<ListPhysicalInterfaces[]>([]);
|
|
|
|
|
|
@@ -82,36 +85,44 @@ const addInterface = () => {
|
|
}
|
|
}
|
|
|
|
|
|
interfaceList.value.forEach((item) => {
|
|
interfaceList.value.forEach((item) => {
|
|
- if (item.id === props.form.protocolId) {
|
|
|
|
- props.form.linkName = item.name;
|
|
|
|
|
|
+ if (item.id === props.form.interfaceId) {
|
|
|
|
+ linkName.value = item.name;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
listPhysicalInterfaces.value.forEach((item) => {
|
|
listPhysicalInterfaces.value.forEach((item) => {
|
|
- if (item.id === props.form.interfaceId) {
|
|
|
|
- props.form.protocolName = item.protocolName;
|
|
|
|
|
|
+ if (item.id === props.form.protocolId) {
|
|
|
|
+ protocolName.value = item.protocolName;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
handleRequest(async () => {
|
|
handleRequest(async () => {
|
|
await gatewayLinkAdd({
|
|
await gatewayLinkAdd({
|
|
interfaceId: props.form.interfaceId,
|
|
interfaceId: props.form.interfaceId,
|
|
- linkName: props.form.linkName,
|
|
|
|
|
|
+ linkName: linkName.value,
|
|
gatewayId: props.form.id,
|
|
gatewayId: props.form.id,
|
|
- protocolType: props.form.protocolName,
|
|
|
|
|
|
+ protocolType: protocolName.value,
|
|
});
|
|
});
|
|
postGetList();
|
|
postGetList();
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-// 删除接口
|
|
|
|
-const addDelete = (value: number) => {
|
|
|
|
|
|
+const confirm = () => {
|
|
handleRequest(async () => {
|
|
handleRequest(async () => {
|
|
- await gatewayLinkDelete(value);
|
|
|
|
- postGetList();
|
|
|
|
|
|
+ if (interfaceId.value) {
|
|
|
|
+ await gatewayLinkDelete(interfaceId.value);
|
|
|
|
+ modalComponentRef.value?.hideView();
|
|
|
|
+ postGetList();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// 删除接口
|
|
|
|
+const addDelete = (value: number) => {
|
|
|
|
+ interfaceId.value = value;
|
|
|
|
+ modalComponentRef.value?.showView();
|
|
|
|
+};
|
|
|
|
+
|
|
const getListPhysicalInterfaces = (value: number) => {
|
|
const getListPhysicalInterfaces = (value: number) => {
|
|
handleRequest(async () => {
|
|
handleRequest(async () => {
|
|
listPhysicalInterfaces.value = await obtainListPhysicalInterfaces(value);
|
|
listPhysicalInterfaces.value = await obtainListPhysicalInterfaces(value);
|
|
@@ -168,7 +179,7 @@ onMounted(() => {
|
|
/>
|
|
/>
|
|
</AFormItem>
|
|
</AFormItem>
|
|
|
|
|
|
- <AFormItem :label="$t('registerGateway.selectProtocolParameters')" name="protocolId">
|
|
|
|
|
|
+ <AFormItem :label="$t('setupProtocol.selectProtocolType')" name="protocolId">
|
|
<ASelect
|
|
<ASelect
|
|
ref="select"
|
|
ref="select"
|
|
v-model:value="form.protocolId"
|
|
v-model:value="form.protocolId"
|
|
@@ -186,7 +197,13 @@ onMounted(() => {
|
|
<AButton class="dev-but" type="primary" @click="addInterface">{{ $t('common.add') }}</AButton>
|
|
<AButton class="dev-but" type="primary" @click="addInterface">{{ $t('common.add') }}</AButton>
|
|
|
|
|
|
<div class="use-guide-title">{{ $t('registerGateway.interfaceList') }}</div>
|
|
<div class="use-guide-title">{{ $t('registerGateway.interfaceList') }}</div>
|
|
- <AFlex wrap="wrap">
|
|
|
|
|
|
+ <AFlex v-if="interfaceData.length === 0" justify="center" align="center" class="empty-data">
|
|
|
|
+ <div>
|
|
|
|
+ <img src="@/assets/img/no-data.png" alt="" />
|
|
|
|
+ <div class="empty-text">{{ $t('common.noData') }}</div>
|
|
|
|
+ </div>
|
|
|
|
+ </AFlex>
|
|
|
|
+ <AFlex v-else wrap="wrap">
|
|
<AFlex v-for="item in interfaceData" :key="item.id" class="interface-list" align="center">
|
|
<AFlex v-for="item in interfaceData" :key="item.id" class="interface-list" align="center">
|
|
<AFlex class="interface-div" justify="space-between" align="center">
|
|
<AFlex class="interface-div" justify="space-between" align="center">
|
|
<AFlex align="center">
|
|
<AFlex align="center">
|
|
@@ -208,10 +225,33 @@ onMounted(() => {
|
|
</div>
|
|
</div>
|
|
</AFlex>
|
|
</AFlex>
|
|
</AFlex>
|
|
</AFlex>
|
|
|
|
+ <ConfirmModal
|
|
|
|
+ ref="modalComponent"
|
|
|
|
+ :title="$t('common.deleteConfirmation')"
|
|
|
|
+ :description-text="$t('common.confirmDeletion')"
|
|
|
|
+ :icon="{ name: 'delete' }"
|
|
|
|
+ :icon-bg-color="'#F56C6C'"
|
|
|
|
+ @confirm="confirm"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.empty-text {
|
|
|
|
+ margin-top: 16px;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ font-style: normal;
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ line-height: 22px;
|
|
|
|
+ color: #ccc;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.empty-data {
|
|
|
|
+ width: 814px;
|
|
|
|
+ height: 40vh;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+
|
|
.interface-width {
|
|
.interface-width {
|
|
width: 364px;
|
|
width: 364px;
|
|
}
|
|
}
|