huangbin 4 vuotta sitten
vanhempi
commit
e4c75ae654
1 muutettua tiedostoa jossa 7 lisäystä ja 22 poistoa
  1. 7 22
      src/views/information/custom/list/setup.ts

+ 7 - 22
src/views/information/custom/list/setup.ts

@@ -1,34 +1,19 @@
+import { queryTableList as query } from '@/common/setup/table/list';
 import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
 import { QueryCustomInfoEnum } from '@/services/go/ermcp/customInfo/type';
-import { message } from 'ant-design-vue';
-import { ref } from 'vue';
 
 /**
  * 获取表格列表数据
- * @param type 
- * @returns 
+ * @param type
+ * @returns
  */
 export function queryTableList(type: QueryCustomInfoEnum) {
-    // 加载状态
-    const loading = ref<boolean>(false);
-    // 表格数据
-    const tableList = ref<QueryCustomInfoType[]>([]);
-    function queryTable() {
-        QueryCustomInfo(type)
-            .then((res) => {
-                tableList.value = res.map((e, i) => {
-                    return { ...e, key: String(i) };
-                });
-                loading.value = false;
-                console.log('查询列表', tableList);
-            })
-            .catch((err) => {
-                message.error(err);
-                loading.value = false;
-            });
+    const { loading, tableList, queryTable: temp } = query<QueryCustomInfoType>()
+    const fn = () => {
+        temp(QueryCustomInfo, type)
     }
-    return { loading, tableList, queryTable }
+    return { loading, tableList, queryTable: fn }
 }