|
|
@@ -1,25 +1,53 @@
|
|
|
<script setup lang="tsx">
|
|
|
import { ref } from 'vue';
|
|
|
-import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
|
|
import { fetchGetPointsList, fetchImportPoints } from '@/service/api/government/points';
|
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
import { useModal } from '@/components/zt/Modal/hooks/useModal';
|
|
|
import type { ModalMethods } from '@/components/zt/Modal/types';
|
|
|
import type { FormSchema } from '@/components/zt/Form/types/form';
|
|
|
const importTemplateRef = ref<ModalMethods>();
|
|
|
-const columns: NaiveUI.TableColumn<InternalRowData>[] = [
|
|
|
+const ModalColumns: NaiveUI.TableColumn<Api.government.PointsRecharge>[] = [
|
|
|
{
|
|
|
- key: 'name',
|
|
|
- title: '标签名称',
|
|
|
- align: 'center',
|
|
|
- minWidth: 100
|
|
|
+ key: 'channelName',
|
|
|
+ title: '所属企业',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'userName',
|
|
|
+ title: '员工姓名',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'userPhone',
|
|
|
+ title: '员工手机号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'points',
|
|
|
+ title: '充值积分',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'expiryDate',
|
|
|
+ title: '过期日期',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'createTime',
|
|
|
+ title: '创建时间',
|
|
|
+ align: 'center'
|
|
|
}
|
|
|
];
|
|
|
const searchSchemas: FormSchema[] = [
|
|
|
{
|
|
|
- field: 'name',
|
|
|
+ field: 'channelName',
|
|
|
label: '企业名称',
|
|
|
component: 'NInput'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'userPhone',
|
|
|
+ label: '员工手机号',
|
|
|
+ component: 'NInput'
|
|
|
}
|
|
|
];
|
|
|
|
|
|
@@ -33,11 +61,11 @@ const [registerTable] = useTable({
|
|
|
},
|
|
|
tableConfig: {
|
|
|
keyField: 'id',
|
|
|
- title: '标签列表',
|
|
|
+ title: '充值积分',
|
|
|
showAddButton: false
|
|
|
}
|
|
|
});
|
|
|
-const [registerModalTable] = useTable({
|
|
|
+const [registerModalTable, { refresh: refreshModal }] = useTable({
|
|
|
searchFormConfig: {
|
|
|
schemas: searchSchemas,
|
|
|
inline: false,
|
|
|
@@ -47,20 +75,23 @@ const [registerModalTable] = useTable({
|
|
|
},
|
|
|
tableConfig: {
|
|
|
keyField: 'id',
|
|
|
- title: '标签列表',
|
|
|
- showAddButton: false
|
|
|
+ title: '积分列表',
|
|
|
+ showAddButton: false,
|
|
|
+ minHeight: 400
|
|
|
}
|
|
|
});
|
|
|
|
|
|
const [registerModal, { openModal }] = useModal({
|
|
|
title: '充值积分',
|
|
|
height: 800,
|
|
|
- showFooter: false
|
|
|
+ showFooter: false,
|
|
|
+ width: 1200
|
|
|
});
|
|
|
async function handleSubmitImport(file: File) {
|
|
|
const { error } = await fetchImportPoints(file);
|
|
|
if (!error) {
|
|
|
importTemplateRef.value?.closeModal();
|
|
|
+ refreshModal();
|
|
|
} else {
|
|
|
importTemplateRef.value?.setSubLoading(false);
|
|
|
}
|
|
|
@@ -72,19 +103,27 @@ function handleOpenPoints() {
|
|
|
|
|
|
<template>
|
|
|
<LayoutTable>
|
|
|
- <ZTable :show-table-action="false" :columns="columns" :api="fetchGetPointsList" @register="registerTable">
|
|
|
+ <ZTable :show-table-action="false" :columns="ModalColumns" :api="fetchGetPointsList" @register="registerTable">
|
|
|
<template #prefix>
|
|
|
<NButton size="small" @click="openModal">充值积分</NButton>
|
|
|
</template>
|
|
|
</ZTable>
|
|
|
<BasicModal @register="registerModal">
|
|
|
- <ZTable :show-table-action="false" :columns="columns" :api="fetchGetPointsList" @register="registerModalTable">
|
|
|
- <template #prefix>
|
|
|
- <NButton size="small" @click="handleOpenPoints">导入积分</NButton>
|
|
|
- <NButton size="small">导入记录</NButton>
|
|
|
- </template>
|
|
|
- </ZTable>
|
|
|
+ <LayoutTable>
|
|
|
+ <ZTable
|
|
|
+ :show-table-action="false"
|
|
|
+ :columns="ModalColumns"
|
|
|
+ :api="fetchGetPointsList"
|
|
|
+ @register="registerModalTable"
|
|
|
+ >
|
|
|
+ <template #prefix>
|
|
|
+ <NButton size="small" @click="handleOpenPoints">导入积分</NButton>
|
|
|
+ <NButton size="small">导入记录</NButton>
|
|
|
+ </template>
|
|
|
+ </ZTable>
|
|
|
+ </LayoutTable>
|
|
|
</BasicModal>
|
|
|
+
|
|
|
<ZImportTemplate
|
|
|
ref="importTemplateRef"
|
|
|
url="/platform/pointsRecharge/exportTemplate"
|