|
@@ -8,24 +8,36 @@
|
|
|
<p class="label">平台</p>
|
|
|
<a-select class="full-width"
|
|
|
v-model:value="query.platform">
|
|
|
- <a-select-option value="platform1">平台1</a-select-option>
|
|
|
- <a-select-option value="platform2">平台2</a-select-option>
|
|
|
- <a-select-option value="platform3">平台3</a-select-option>
|
|
|
+ <a-select-option v-for="platform in platforms"
|
|
|
+ :key="platform.name"
|
|
|
+ :value="platform.name">{{platform.desc}}</a-select-option>
|
|
|
</a-select>
|
|
|
</div>
|
|
|
</tool-bar>
|
|
|
- <a-table :loading="loading"
|
|
|
+ <a-table rowKey="id"
|
|
|
+ :loading="loading"
|
|
|
:pagination="tablePageOptions"
|
|
|
:columns="columns"
|
|
|
- :data-source="list"></a-table>
|
|
|
+ :data-source="list"
|
|
|
+ @change="onLoadOfficials" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, onMounted, reactive, ref, toRefs } from "vue";
|
|
|
+import {
|
|
|
+ computed,
|
|
|
+ defineComponent,
|
|
|
+ inject,
|
|
|
+ onMounted,
|
|
|
+ reactive,
|
|
|
+ Ref,
|
|
|
+ ref,
|
|
|
+ toRefs,
|
|
|
+} from "vue";
|
|
|
|
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
|
|
|
|
+import useApp from "@/hooks/useApp";
|
|
|
import usePagination from "@/hooks/usePagination";
|
|
|
|
|
|
import { TableColumnOfAccount } from "@/views/_pageOptions/table-account";
|
|
@@ -38,9 +50,10 @@ const Account = defineComponent({
|
|
|
},
|
|
|
setup() {
|
|
|
let { loading, meta, tablePageOptions } = usePagination();
|
|
|
+ const { store } = useApp();
|
|
|
|
|
|
const state = reactive({
|
|
|
- platform: "platform1",
|
|
|
+ platforms: computed(() => store.getters.platforms),
|
|
|
list: ref<IOfficials[]>([]),
|
|
|
columns: TableColumnOfAccount,
|
|
|
searching: false,
|
|
@@ -57,9 +70,11 @@ const Account = defineComponent({
|
|
|
onLoadOfficials();
|
|
|
};
|
|
|
|
|
|
- const onLoadOfficials = () => {
|
|
|
+ const onLoadOfficials = (query?: { page: number }) => {
|
|
|
+ let params = state.query;
|
|
|
+ if (query) params.page = query.page;
|
|
|
loading.value = true;
|
|
|
- getOfficialAccounts(state.query).then(({ data }) => {
|
|
|
+ getOfficialAccounts(params).then(({ data }) => {
|
|
|
state.list = data.list;
|
|
|
meta = data.meta;
|
|
|
loading.value = false;
|
|
@@ -69,7 +84,13 @@ const Account = defineComponent({
|
|
|
|
|
|
onMounted(onLoadOfficials);
|
|
|
|
|
|
- return { ...toRefs(state), loading, tablePageOptions, onSearch };
|
|
|
+ return {
|
|
|
+ ...toRefs(state),
|
|
|
+ loading,
|
|
|
+ tablePageOptions,
|
|
|
+ onSearch,
|
|
|
+ onLoadOfficials,
|
|
|
+ };
|
|
|
},
|
|
|
});
|
|
|
|