Эх сурвалжийг харах

perf(views): 优化 “网关列表”模块新增功能

wangshun 1 сар өмнө
parent
commit
6387d5d0cd

+ 2 - 2
src/types/index.ts

@@ -383,7 +383,7 @@ export interface AgreementUpdate {
   dataBit: string;
   parityBit: string;
   stopBit: string;
-  baudRate: number;
+  baudRate?: string;
   readTimeout: number;
   nextDataReadDelay: number;
   nextRoundDataReadDelay: number;
@@ -403,7 +403,7 @@ export interface AgreementData {
 }
 
 export interface AgreementForm {
-  baudRate: number;
+  baudRate?: string;
   dataBit: string;
   parityBit: string;
   stopBit: string;

+ 16 - 2
src/views/gateway-list/GatewayList.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import { onMounted, ref, useTemplateRef } from 'vue';
 
+import ModalGuidance from '@/layout/ModalGuidance.vue';
 import ConfirmModal from '@/components/ConfirmModal.vue';
 import SvgIcon from '@/components/SvgIcon.vue';
 import { useRequest } from '@/hooks/request';
@@ -14,6 +15,8 @@ import {
   orgGatewayUnregister,
 } from '@/api';
 
+import RegisterGateway from '../register-gateway/RegisterGateway.vue';
+
 import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
 import type {
   BatchUpdate,
@@ -89,7 +92,7 @@ const listPhysicalInterfaces = ref<ListPhysicalInterfaces[]>([]);
 const gatewayLinks = ref<BatchUpdate[]>([]);
 // 添加选中状态
 const selectedRowId = ref<string | null>(null);
-
+const modalGuidanceRef = useTemplateRef('modalGuidance');
 const activeKey = ref();
 const gatewayQuery = ref<GatewayQuery>({
   pageIndex: 1,
@@ -267,6 +270,14 @@ const addSave = () => {
   });
 };
 
+const addGateway = () => {
+  modalGuidanceRef.value?.showView();
+};
+
+const getProtocolData = () => {
+  getGatewayList();
+};
+
 onMounted(() => {
   addGatewayList();
 });
@@ -277,7 +288,7 @@ onMounted(() => {
     <AFlex justify="space-between">
       <div class="text-top">{{ $t('navigation.gatewayManage') }}</div>
       <div>
-        <AButton type="primary" class="icon-button">
+        <AButton type="primary" class="icon-button" @click="addGateway">
           <AFlex align="center">
             <SvgIcon name="plus" />
             <span> {{ $t('common.add') }} </span>
@@ -425,6 +436,9 @@ onMounted(() => {
         </ACol>
       </ARow>
     </div>
+    <ModalGuidance ref="modalGuidance" @finish="getProtocolData">
+      <RegisterGateway />
+    </ModalGuidance>
     <ConfirmModal
       ref="modalComponent"
       :title="$t('common.deleteConfirmation')"