|
@@ -1,41 +1,75 @@
|
|
<template>
|
|
<template>
|
|
<div class="page-wrap page-wrap-account">
|
|
<div class="page-wrap page-wrap-account">
|
|
<tool-bar :text="['name']"
|
|
<tool-bar :text="['name']"
|
|
- :label="['公众号名称']">
|
|
|
|
|
|
+ :label="['公众号名称']"
|
|
|
|
+ v-model:loading="searching"
|
|
|
|
+ @confirm="onSearch">
|
|
<div class="tool-bar-item">
|
|
<div class="tool-bar-item">
|
|
<p class="label">平台</p>
|
|
<p class="label">平台</p>
|
|
<a-select class="full-width"
|
|
<a-select class="full-width"
|
|
- v-model:value="platform">
|
|
|
|
|
|
+ v-model:value="query.platform">
|
|
<a-select-option value="platform1">平台1</a-select-option>
|
|
<a-select-option value="platform1">平台1</a-select-option>
|
|
<a-select-option value="platform2">平台2</a-select-option>
|
|
<a-select-option value="platform2">平台2</a-select-option>
|
|
<a-select-option value="platform3">平台3</a-select-option>
|
|
<a-select-option value="platform3">平台3</a-select-option>
|
|
</a-select>
|
|
</a-select>
|
|
</div>
|
|
</div>
|
|
</tool-bar>
|
|
</tool-bar>
|
|
- <a-table :columns="columns"
|
|
|
|
|
|
+ <a-table :loading="loading"
|
|
|
|
+ :pagination="tablePageOptions"
|
|
|
|
+ :columns="columns"
|
|
:data-source="list"></a-table>
|
|
:data-source="list"></a-table>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
-import { defineComponent, reactive, toRefs } from "vue";
|
|
|
|
|
|
+import { defineComponent, onMounted, reactive, ref, toRefs } from "vue";
|
|
|
|
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
|
|
|
|
|
|
+import usePagination from "@/hooks/usePagination";
|
|
|
|
+
|
|
import { TableColumnOfAccount } from "@/views/_pageOptions/table-account";
|
|
import { TableColumnOfAccount } from "@/views/_pageOptions/table-account";
|
|
|
|
+import { getOfficialAccounts } from "@/api";
|
|
|
|
+import { IOfficials } from "@/types/api";
|
|
|
|
|
|
const Account = defineComponent({
|
|
const Account = defineComponent({
|
|
components: {
|
|
components: {
|
|
ToolBar,
|
|
ToolBar,
|
|
},
|
|
},
|
|
setup() {
|
|
setup() {
|
|
- const data = reactive({
|
|
|
|
|
|
+ let { loading, meta, tablePageOptions } = usePagination();
|
|
|
|
+
|
|
|
|
+ const state = reactive({
|
|
platform: "platform1",
|
|
platform: "platform1",
|
|
- list: [],
|
|
|
|
|
|
+ list: ref<IOfficials[]>([]),
|
|
columns: TableColumnOfAccount,
|
|
columns: TableColumnOfAccount,
|
|
|
|
+ searching: false,
|
|
|
|
+ query: {
|
|
|
|
+ official_name: "",
|
|
|
|
+ platform: "",
|
|
|
|
+ page: 1,
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
- return { ...toRefs(data) };
|
|
|
|
|
|
+ const onSearch = (fields: Record<string, string>) => {
|
|
|
|
+ const { name } = fields;
|
|
|
|
+ state.query.official_name = name;
|
|
|
|
+ onLoadOfficials();
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const onLoadOfficials = () => {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ getOfficialAccounts(state.query).then(({ data }) => {
|
|
|
|
+ state.list = data.list;
|
|
|
|
+ meta = data.meta;
|
|
|
|
+ loading.value = false;
|
|
|
|
+ state.searching = false;
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ onMounted(onLoadOfficials);
|
|
|
|
+
|
|
|
|
+ return { ...toRefs(state), loading, tablePageOptions, onSearch };
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|