|
|
@@ -1,13 +1,14 @@
|
|
|
<script setup lang="tsx">
|
|
|
-import { ref, useTemplateRef } from 'vue';
|
|
|
+import { nextTick, ref, useTemplateRef } from 'vue';
|
|
|
import {
|
|
|
fetchGetFailPointsList,
|
|
|
fetchGetPointsList,
|
|
|
fetchGetPointsOutList,
|
|
|
fetchImportPoints
|
|
|
} from '@/service/api/government/points';
|
|
|
-import { fetchGetAllChannelList } from '@/service/api/goods/store-goods';
|
|
|
+import { fetchGetLoginUserList } from '@/service/api/common';
|
|
|
import { useAuth } from '@/hooks/business/auth';
|
|
|
+import { commonExport } from '@/utils/common';
|
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
import { useModal } from '@/components/zt/Modal/hooks/useModal';
|
|
|
import type { FormSchema } from '@/components/zt/Form/types/form';
|
|
|
@@ -69,13 +70,23 @@ const outColumns: NaiveUI.TableColumn<Api.government.PointsRechargeVO>[] = [
|
|
|
];
|
|
|
const searchSchemas: FormSchema[] = [
|
|
|
{
|
|
|
- field: 'channelId',
|
|
|
+ field: 'channelIdList',
|
|
|
label: '所属企业',
|
|
|
component: 'ApiSelect',
|
|
|
componentProps: {
|
|
|
- api: fetchGetAllChannelList,
|
|
|
+ api: fetchGetLoginUserList,
|
|
|
labelFeild: 'channelName',
|
|
|
- valueFeild: 'id'
|
|
|
+ valueFeild: 'id',
|
|
|
+ multiple: true,
|
|
|
+ onUpdateValue: () => {
|
|
|
+ nextTick(() => {
|
|
|
+ handleSearch();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getOptions: async (options: any) => {
|
|
|
+ await setSearchForm({ channelIdList: [options[0].id] });
|
|
|
+ handleSearch();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -154,7 +165,19 @@ const failColumns: NaiveUI.TableColumn<Api.government.PointsFailureRecordVO>[] =
|
|
|
const failData = ref<Api.government.PointsFailureRecordVO[]>([]);
|
|
|
const [registerTable, { refresh }] = useTable({
|
|
|
searchFormConfig: {
|
|
|
- schemas: searchSchemas.slice(0, 1),
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'channelIdList',
|
|
|
+ label: '所属企业',
|
|
|
+ component: 'ApiSelect',
|
|
|
+ componentProps: {
|
|
|
+ api: fetchGetLoginUserList,
|
|
|
+ labelFeild: 'channelName',
|
|
|
+ valueFeild: 'id',
|
|
|
+ multiple: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
inline: false,
|
|
|
size: 'small',
|
|
|
labelPlacement: 'left',
|
|
|
@@ -166,7 +189,7 @@ const [registerTable, { refresh }] = useTable({
|
|
|
showAddButton: false
|
|
|
}
|
|
|
});
|
|
|
-const [registerModalTable, { refresh: refreshModal }] = useTable({
|
|
|
+const [registerModalTable, { refresh: refreshModal, setFieldsValue, getSeachForm }] = useTable({
|
|
|
searchFormConfig: {
|
|
|
schemas: searchSchemas,
|
|
|
inline: false,
|
|
|
@@ -178,7 +201,8 @@ const [registerModalTable, { refresh: refreshModal }] = useTable({
|
|
|
keyField: 'id',
|
|
|
title: '积分列表',
|
|
|
showAddButton: false,
|
|
|
- minHeight: 400
|
|
|
+ minHeight: 400,
|
|
|
+ defaultParamsNotReset: 'channelIdList'
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -211,7 +235,13 @@ async function openImportModal() {
|
|
|
failData.value = data as Api.government.PointsFailureRecordVO[];
|
|
|
}
|
|
|
function hanleExportFailure(code: string) {
|
|
|
- window.open(`${import.meta.env.VITE_SERVICE_BASE_URL}/platform/pointsFailureRecord/export?code=${code}`, '_blank');
|
|
|
+ commonExport('/platform/pointsFailureRecord/export', { code });
|
|
|
+}
|
|
|
+function handleSearch() {
|
|
|
+ refreshModal();
|
|
|
+}
|
|
|
+async function setSearchForm(value: Recordable) {
|
|
|
+ await setFieldsValue(value);
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
@@ -225,12 +255,20 @@ function hanleExportFailure(code: string) {
|
|
|
<BasicModal @register="registerModal" @after-leave="refresh">
|
|
|
<LayoutTable>
|
|
|
<ZTable
|
|
|
+ :immediate="false"
|
|
|
:show-table-action="false"
|
|
|
:columns="ModalColumns"
|
|
|
:api="fetchGetPointsList"
|
|
|
@register="registerModalTable"
|
|
|
>
|
|
|
<template #prefix>
|
|
|
+ <NButton
|
|
|
+ v-if="useAuth().hasAuth('points:user:export')"
|
|
|
+ size="small"
|
|
|
+ @click="commonExport('/platform/pointsRecharge/export', getSeachForm())"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </NButton>
|
|
|
<NButton v-if="useAuth().hasAuth('points:user:import')" size="small" @click="handleOpenPoints">
|
|
|
导入积分
|
|
|
</NButton>
|