lcl 11 月之前
父节点
当前提交
fe38fe04c8

+ 2 - 3
src/views/Template/ApiGroup/components/add/index.vue

@@ -14,7 +14,7 @@ import Upload from "@iconify-icons/ri/upload-2-fill";
 import Close from "@iconify-icons/ri/close-fill";
 // 获取URLLIST
 import { getGroupUrl } from "@/utils/getUrl/getUrl";
-const KxsConfigServer = await getGroupUrl(['KxsConfigServer']);
+const UrlList = await getGroupUrl(['KxsConfigServer']);
 
 const props = defineProps<{
   submit: {
@@ -42,8 +42,7 @@ let UpdateForm = ref({
 const activeId = ref('1')
 // 提交函数
 const submit = async () => {
-  const KxsConfigServer = await getGroupUrl(['KxsConfigServer']);
-  const { status, info }: any = http.request(KxsConfigServer.ApiGroupAdd.method, KxsConfigServer.ApiGroupAdd.url, UpdateForm.value);
+  const { status, info }: any = http.Request({ method: UrlList.KxsConfigServer.ApiGroupAdd.method, url: UrlList.KxsConfigServer.ApiGroupAdd.url, params: UpdateForm.value});
   if (status === "1") {
     ElMessage({
       message: "新增成功",

+ 3 - 4
src/views/Template/ApiGroup/components/edit/index.vue

@@ -13,7 +13,7 @@ import Close from "@iconify-icons/ri/close-fill"
 import { http } from "@/utils/http";
 // 获取URLLIST
 import { getGroupUrl } from "@/utils/getUrl/getUrl";
-const KxsConfigServer = await getGroupUrl(['KxsConfigServer']);
+const UrlList = await getGroupUrl(['KxsConfigServer']);
 
 const props = defineProps<{
   editVisible: {
@@ -42,8 +42,7 @@ let UpdateForm: any = ref({
 const activeId = ref('1')
 // 提交函数
 const submit = async () => {
-  const KxsConfigServer = await getGroupUrl(['KxsConfigServer']);
-  const { status, info }: any = http.request(KxsConfigServer.ApiGroupUpdate.method, KxsConfigServer.ApiGroupUpdate.url, UpdateForm.value);
+  const { status, info }: any = http.Request({ method: UrlList.KxsConfigServer.ApiGroupUpdate.method, url: UrlList.KxsConfigServer.ApiGroupUpdate.url, params: UpdateForm.value});
   if (status === "1") {
     ElMessage({
       message: "修改成功",
@@ -68,7 +67,7 @@ const closeVisible = inject('closeEditVisible');
 const openVisible = async () => {
   //通过ID获取表格数据
   const KxsConfigServer = await getGroupUrl(['KxsConfigServer']);
-  const { data }: any = http.request(KxsConfigServer.ApiGroup.Query.method, KxsConfigServer.ApiGroup.Query.url, UpdateForm.value);
+  const { data }: any = http.Request({method: UrlList.KxsConfigServer.ApiGroupQuery.method, url: UrlList.KxsConfigServer.ApiGroupQuery.url, params: UpdateForm.value});
   UpdateForm.value = data;
 };
 </script>

+ 26 - 19
src/views/Template/ApiGroup/hook.tsx

@@ -10,7 +10,8 @@ const UrlList = await getGroupUrl(['KxsConfigServer']);
 
 export function useApiGroup() {
   let form = reactive({
-    GroupName: "1"
+    GroupName: "", //名称
+
   });
   const dataList = ref([]);
   const loading = ref(false);
@@ -36,7 +37,7 @@ export function useApiGroup() {
     },
     {
       label: "名称",
-      prop: "GroupName",
+      prop: "groupName",
       minWidth: 200
     },
 
@@ -64,23 +65,29 @@ export function useApiGroup() {
   }
   // 搜索列表
   async function onSearch(type = 'search') {
-    if (type == 'search' && !Object.values(form).some(item => !!item)) {
-      return ElMessage({
-        message: "请输入查询条件",
-        type: "error"
-      });
-    };
+    if (type === 'all') {
+      form.GroupName = "";
+    }
+    // if (type == 'search' && !Object.values(form).some(item => !!item)) {
+    //   return ElMessage({
+    //     message: "请输入查询条件",
+    //     type: "error"
+    //   });
+    // };
     loading.value = true;
-    var sss = await http.Request({ method: UrlList.KxsConfigServer.ApiGrouplist.method, url: UrlList.KxsConfigServer.ApiGrouplist.url, params: { ...form, page_size: pagination.pageSize, page_num: pagination.currentPage } });
-    console.log('sss:', sss);
-    const { data, other }: any = http.Request({ method: UrlList.KxsConfigServer.ApiGrouplist.method, url: UrlList.KxsConfigServer.ApiGrouplist.url, params: { ...form, page_size: pagination.pageSize, page_num: pagination.currentPage } });
-    console.log('data:', data);
-    console.log('other:', other);
-    dataList.value = data;
-    pagination.total = other.Count;
-    setTimeout(() => {
-      loading.value = false;
-    }, 500);
+    const { status, msg, data }: any = await http.Request({ method: UrlList.KxsConfigServer.ApiGrouplist.method, url: UrlList.KxsConfigServer.ApiGrouplist.url, params: { ...form, PageSize: pagination.pageSize, PageNum: pagination.currentPage } });
+    if (status === 1) {
+      dataList.value = data.result;
+      pagination.total = data.totalNum;
+      setTimeout(() => {
+        loading.value = false;
+      }, 500);
+    } else {
+      ElMessageBox.alert(msg, "提示", {
+        confirmButtonText: "关闭",
+        type: "warning"
+      });
+    }
   }
   onMounted(() => {
     onSearch();
@@ -97,7 +104,7 @@ export function useApiGroup() {
         type: "warning"
       }
     ).then(async () => {
-      const { status, info }: any = await http.request(KxsConfigServer.ApiGroupdelete.method, KxsConfigServer.ApiGroupdelete.url, { Id: row.Id });
+      const { status, info }: any = await http.Request({ method: UrlList.KxsConfigServer.ApiGroupdelete.method, url: UrlList.KxsConfigServer.ApiGroupdelete.url, params: { Id: row.Id } });
       if (status === "1") {
         ElMessage({
           message: "删除成功",