|
@@ -1,32 +1,88 @@
|
|
|
<template>
|
|
|
<div class="page-wrap page-wrap-put-books">
|
|
|
- <tool-bar :text="['email', 'account', 'user']"
|
|
|
- :label="['邮箱', '账户ID', '用户名']" />
|
|
|
- <a-table :columns="columns"
|
|
|
- :data-source="list"></a-table>
|
|
|
+ <tool-bar
|
|
|
+ :text="['email', 'account_id', 'account_name']"
|
|
|
+ :label="['邮箱', '账户ID', '用户名']"
|
|
|
+ v-model:loading="inSearching"
|
|
|
+ @confirm="onSearch"
|
|
|
+ >
|
|
|
+ <template #exbutton>
|
|
|
+ <a-button type="primary" class="ml-10">
|
|
|
+ 授权
|
|
|
+ </a-button>
|
|
|
+ </template>
|
|
|
+ </tool-bar>
|
|
|
+ <a-table
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="list"
|
|
|
+ :pagination="tablePageOptions"
|
|
|
+ :loading="loading.value"
|
|
|
+ @change="handleTableChange"
|
|
|
+ rowKey="id"
|
|
|
+ >
|
|
|
+ </a-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, reactive, toRefs } from "vue";
|
|
|
+import { defineComponent, reactive, toRefs, ref } from "vue";
|
|
|
|
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
|
|
|
|
import { TableColumnOfPutAdAccount } from "../_pageOptions/table-put";
|
|
|
+import usePagination from "@/hooks/usePagination";
|
|
|
+import { getAdPushList } from "@/api";
|
|
|
+import { ADpushSimple, PageOptions } from "@/types/api";
|
|
|
+import useDebounceFn from "@/hooks/useDebounceFn";
|
|
|
|
|
|
const PutAdAccount = defineComponent({
|
|
|
components: {
|
|
|
ToolBar,
|
|
|
},
|
|
|
setup() {
|
|
|
- const data = reactive({
|
|
|
- list: [],
|
|
|
+ let { loading, meta, tablePageOptions } = usePagination();
|
|
|
+ const state = reactive({
|
|
|
+ list: ref<ADpushSimple[]>([]),
|
|
|
columns: TableColumnOfPutAdAccount,
|
|
|
+ inSearching: false,
|
|
|
+ loading,
|
|
|
+ tablePageOptions,
|
|
|
});
|
|
|
+ getAdPushList({ page: 1 }).then((res) => {
|
|
|
+ state.list = res.data.list;
|
|
|
+ meta = res.data.meta;
|
|
|
+ });
|
|
|
+ const onSearch = async (fields: Record<string, string>) => {
|
|
|
+ try {
|
|
|
+ const { email, account_name, account_id } = fields;
|
|
|
+ console.log(account_name, account_id);
|
|
|
+ const { data } = await getAdPushList({
|
|
|
+ email,
|
|
|
+ account_name,
|
|
|
+ account_id,
|
|
|
+ page: 1,
|
|
|
+ });
|
|
|
+ state.list = data.list;
|
|
|
+ meta = data.meta;
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ } finally {
|
|
|
+ console.log(state.inSearching);
|
|
|
+ state.inSearching = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleTableChange = (pagination: PageOptions) => {
|
|
|
+ const { current, pageSize, total } = pagination;
|
|
|
+ getAdPushList({ page: current }).then((res) => {
|
|
|
+ state.list = res.data.list;
|
|
|
+ meta = res.data.meta;
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
- return { ...toRefs(data) };
|
|
|
+ return { ...toRefs(state), onSearch, handleTableChange };
|
|
|
},
|
|
|
});
|
|
|
|
|
|
export default PutAdAccount;
|
|
|
-</script>
|
|
|
+</script>
|