Sfoglia il codice sorgente

列表下拉框显示正常

lcl 8 mesi fa
parent
commit
69f3460d66

+ 2 - 2
src/views/menuitem/ApiInfo/components/add/index.vue

@@ -41,7 +41,7 @@ let UpdateForm = ref({
 
 });
 // 分组选项数据
-let groupIdOptionList = []
+const groupIdOptionList = ref([])
 
 // 选项卡参数(默认值为列表某项的id)
 const activeId = ref('1')
@@ -78,7 +78,7 @@ const apiInfoquery = async () => {
   const UrlList = await getGroupUrl(['kxsConfigServer']);
   const { status, data }: any = await http.Request({ method: UrlList.kxsConfigServer.apiGroupselectList.method, url: UrlList.kxsConfigServer.apiGroupselectList.url, params: {} });
   if (status === 1) {
-    groupIdOptionList = data.records;
+    groupIdOptionList.value = data.records;
   }
 };
 apiInfoquery();

+ 23 - 8
src/views/menuitem/ApiInfo/hook.tsx

@@ -10,8 +10,8 @@ const UrlList = await getGroupUrl(['kxsConfigServer']);
 
 export function useApiInfo() {
   let form = reactive({
-      groupId:0, //分组
-      apiName:"", //接口名称
+    groupId: 0, //分组
+    apiName: "", //接口名称
 
   });
   const dataList = ref([]);
@@ -82,8 +82,8 @@ export function useApiInfo() {
   // 搜索列表
   async function onSearch(type = 'search') {
     if (type === 'all') {
-         form.groupId = 0;
-   form.apiName = "";
+      form.groupId = 0;
+      form.apiName = "";
 
     }
     // if (type == 'search' && !Object.values(form).some(item => !!item)) {
@@ -93,7 +93,7 @@ export function useApiInfo() {
     //   });
     // };
     loading.value = true;
-    const { status, msg, data }: any = await http.Request({ method: UrlList.kxsConfigServer.apiInfolist.method, url: UrlList.kxsConfigServer.apiInfolist.url, params: { ...form, pageSize: pagination.pageSize, pageNum: pagination.currentPage }});
+    const { status, msg, data }: any = await http.Request({ method: UrlList.kxsConfigServer.apiInfolist.method, url: UrlList.kxsConfigServer.apiInfolist.url, params: { ...form, pageSize: pagination.pageSize, pageNum: pagination.currentPage } });
     if (status === 1) {
       dataList.value = data.records;
       pagination.total = data.total;
@@ -109,6 +109,7 @@ export function useApiInfo() {
   }
   onMounted(() => {
     onSearch();
+    apiInfoquery();
   });
 
   // 删除
@@ -131,9 +132,9 @@ export function useApiInfo() {
         onSearch();
       } else {
         ElMessageBox.alert(msg, "提示", {
-        confirmButtonText: "关闭",
-        type: "warning"
-      });
+          confirmButtonText: "关闭",
+          type: "warning"
+        });
       };
     })
   }
@@ -153,6 +154,19 @@ export function useApiInfo() {
     editUpdateFormData.value = row;
   };
 
+  // 分组选项数据
+  const groupIdOptionList = ref([])
+
+  //获取分组数据
+  async function apiInfoquery() {
+    //通过ID获取表格数据
+    const UrlList = await getGroupUrl(['kxsConfigServer']);
+    const { status, data }: any = await http.Request({ method: UrlList.kxsConfigServer.apiGroupselectList.method, url: UrlList.kxsConfigServer.apiGroupselectList.url, params: {} });
+    if (status === 1) {
+      groupIdOptionList.value = data.records;
+    }
+  };
+
   return {
     form,
     loading,
@@ -169,6 +183,7 @@ export function useApiInfo() {
     editUpdateVisible,
     editUpdateFormData,
     handleDelete,
+    groupIdOptionList
 
   };
 }

+ 1 - 13
src/views/menuitem/ApiInfo/index.vue

@@ -36,6 +36,7 @@ const {
   editUpdateVisible,
   editUpdateFormData,
   handleDelete,
+  groupIdOptionList,
 
 } = useApiInfo();
 
@@ -51,19 +52,6 @@ const closeEditUpdateVisible = () => {
 provide('closeEditUpdateVisible', closeEditUpdateVisible)
 
 
-// 分组选项数据
-let groupIdOptionList = []
-
-//获取分组数据
-async function apiInfoquery() {
-  //通过ID获取表格数据
-  const UrlList = await getGroupUrl(['kxsConfigServer']);
-  const { status, data }: any = await http.Request({ method: UrlList.kxsConfigServer.apiGroupselectList.method, url: UrlList.kxsConfigServer.apiGroupselectList.url, params: {} });
-  if (status === 1) {
-    groupIdOptionList = data.records;
-  }
-};
-apiInfoquery();
 </script>
 
 <template lang="pug">