feat(glt): 水票功能模块重构优化

- 将水票模板表单的标题从"编辑水票"改为"规则设置"
- 统一表单数据绑定方式,移除computed计算属性直接使用form绑定
- 调整includeBuyQty字段类型从string改为boolean并更新相关逻辑
- 添加normalizeBoolean函数处理布尔值转换
- 更新商品列表API调用参数从pageSize改为limit
- 优化水票模板表格列配置,调整列标题和对齐方式
- 隐藏部分不必要的表格列如备注、排序、状态等
- 移除水票编辑表单中的多余字段如用户ID、状态等
- 重构搜索组件,使用关键词搜索替换按钮添加功能
- 在表格中新增用户信息展示列,包含头像、昵称、ID和手机号
- 调整水票记录和释放记录的表格列布局和标题
- 移除表格中的操作列和修改时间列
- 修复布尔值在表单提交时的类型转换问题
- 添加表单验证前的数据类型标准化处理
This commit is contained in:
2026-02-04 02:45:24 +08:00
parent a95fa6d95d
commit 1d8da2c5be
11 changed files with 330 additions and 409 deletions

View File

@@ -21,7 +21,7 @@ export interface GltTicketTemplate {
// 买赠买1送4 => gift_multiplier=4 // 买赠买1送4 => gift_multiplier=4
giftMultiplier?: number; giftMultiplier?: number;
// 是否把购买量也计入套票总量(默认仅计入赠送量) // 是否把购买量也计入套票总量(默认仅计入赠送量)
includeBuyQty?: string; includeBuyQty?: boolean;
// 每期释放数量默认每月释放10 // 每期释放数量默认每月释放10
monthlyReleaseQty?: number; monthlyReleaseQty?: number;
// 总共释放多少期(若配置>0则按期数平均分摊 // 总共释放多少期(若配置>0则按期数平均分摊

View File

@@ -33,5 +33,6 @@ export interface GltUserTicketRelease {
*/ */
export interface GltUserTicketReleaseParam extends PageParam { export interface GltUserTicketReleaseParam extends PageParam {
id?: number; id?: number;
userId?: number;
keywords?: string; keywords?: string;
} }

View File

@@ -6,7 +6,7 @@
:maskClosable="false" :maskClosable="false"
:maxable="maxable" :maxable="maxable"
:confirm-loading="loading" :confirm-loading="loading"
:title="isUpdate ? '编辑水票' : '添加水票'" :title="isUpdate ? '规则设置' : '添加水票'"
:body-style="{ paddingBottom: '28px' }" :body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible" @update:visible="updateVisible"
@ok="save" @ok="save"
@@ -72,7 +72,7 @@
<a-col :span="12"> <a-col :span="12">
<a-form-item label="启用" name="enabled"> <a-form-item label="启用" name="enabled">
<a-switch <a-switch
v-model:checked="enabledChecked" v-model:checked="form.enabled"
checked-children="启用" checked-children="启用"
un-checked-children="停用" un-checked-children="停用"
/> />
@@ -147,7 +147,7 @@
<a-col :span="12"> <a-col :span="12">
<a-form-item label="计入购买量" name="includeBuyQty"> <a-form-item label="计入购买量" name="includeBuyQty">
<a-switch <a-switch
v-model:checked="includeBuyQtyChecked" v-model:checked="form.includeBuyQty"
checked-children="" checked-children=""
un-checked-children="" un-checked-children=""
/> />
@@ -216,7 +216,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, reactive, watch } from 'vue'; import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue'; import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro'; import { assignObject } from 'ele-admin-pro';
import { import {
@@ -255,19 +255,19 @@
const maxable = ref(true); const maxable = ref(true);
const formRef = ref<FormInstance | null>(null); const formRef = ref<FormInstance | null>(null);
const defaultForm: GltTicketTemplate = { const defaultForm: GltTicketTemplate = {
id: undefined, id: undefined,
goodsId: undefined, goodsId: undefined,
name: '', name: '',
enabled: undefined, enabled: true,
unitName: '', unitName: '',
minBuyQty: 1, minBuyQty: 1,
startSendQty: 0, startSendQty: 0,
giftMultiplier: 0, giftMultiplier: 0,
includeBuyQty: '0', includeBuyQty: false,
monthlyReleaseQty: 10, monthlyReleaseQty: 10,
releasePeriods: 0, releasePeriods: 0,
firstReleaseMode: 0, firstReleaseMode: 0,
userId: undefined, userId: undefined,
sortNumber: 100, sortNumber: 100,
comments: '', comments: '',
@@ -300,46 +300,34 @@
] ]
}); });
const enabledChecked = computed<boolean>({ const { resetFields } = useForm(form, rules);
get() {
return form.enabled === '1' || form.enabled === 1 || form.enabled === true;
},
set(v) {
form.enabled = v ? '1' : '0';
}
});
const includeBuyQtyChecked = computed<boolean>({ const normalizeBoolean = (v: any, fallback = false): boolean => {
get() { if (v === true || v === false) return v;
return ( // Spring/Jackson Boolean only accepts true/false; never send "1"/"0".
form.includeBuyQty === '1' || if (v === 1 || v === '1' || v === 'true') return true;
form.includeBuyQty === 1 || if (v === 0 || v === '0' || v === 'false') return false;
form.includeBuyQty === true return fallback;
); };
},
set(v) {
form.includeBuyQty = v ? '1' : '0';
}
});
const { resetFields } = useForm(form, rules); const normalizeNumber = (v: any): number | undefined => {
if (v === undefined || v === null || v === '') return undefined;
const n = Number(v);
return Number.isFinite(n) ? n : undefined;
};
const normalizeNumber = (v: any): number | undefined => { const normalizeFormTypes = () => {
if (v === undefined || v === null || v === '') return undefined; form.goodsId = normalizeNumber(form.goodsId);
const n = Number(v); form.enabled = normalizeBoolean(form.enabled, true);
return Number.isFinite(n) ? n : undefined; form.includeBuyQty = normalizeBoolean(form.includeBuyQty, false);
}; form.minBuyQty = normalizeNumber(form.minBuyQty) ?? 1;
form.startSendQty = normalizeNumber(form.startSendQty) ?? 0;
const normalizeFormTypes = () => { form.giftMultiplier = normalizeNumber(form.giftMultiplier) ?? 0;
form.goodsId = normalizeNumber(form.goodsId); form.monthlyReleaseQty = normalizeNumber(form.monthlyReleaseQty) ?? 10;
form.minBuyQty = normalizeNumber(form.minBuyQty) ?? 1; form.releasePeriods = normalizeNumber(form.releasePeriods) ?? 0;
form.startSendQty = normalizeNumber(form.startSendQty) ?? 0; form.firstReleaseMode = normalizeNumber(form.firstReleaseMode) ?? 0;
form.giftMultiplier = normalizeNumber(form.giftMultiplier) ?? 0; form.sortNumber = normalizeNumber(form.sortNumber) ?? 100;
form.monthlyReleaseQty = normalizeNumber(form.monthlyReleaseQty) ?? 10; };
form.releasePeriods = normalizeNumber(form.releasePeriods) ?? 0;
form.firstReleaseMode = normalizeNumber(form.firstReleaseMode) ?? 0;
form.sortNumber = normalizeNumber(form.sortNumber) ?? 100;
};
const ensureSelectedGoodsLoaded = async (goodsId?: number) => { const ensureSelectedGoodsLoaded = async (goodsId?: number) => {
if (!goodsId) { if (!goodsId) {
@@ -366,7 +354,7 @@
if (goodsLoading.value) return; if (goodsLoading.value) return;
goodsLoading.value = true; goodsLoading.value = true;
try { try {
const res = await listShopGoods({ pageSize: 50 }); const res = await listShopGoods({ limit: 50 });
goodsList.value = res || []; goodsList.value = res || [];
} catch { } catch {
goodsList.value = []; goodsList.value = [];
@@ -382,7 +370,7 @@
goodsLoading.value = true; goodsLoading.value = true;
try { try {
const res = await listShopGoods({ keywords, pageSize: 50 }); const res = await listShopGoods({ keywords, limit: 50 });
goodsList.value = res || []; goodsList.value = res || [];
} catch { } catch {
goodsList.value = []; goodsList.value = [];
@@ -414,6 +402,7 @@
formRef.value formRef.value
.validate() .validate()
.then(() => { .then(() => {
normalizeFormTypes();
loading.value = true; loading.value = true;
const formData: GltTicketTemplate = { ...form }; const formData: GltTicketTemplate = { ...form };
const saveOrUpdate = isUpdate.value const saveOrUpdate = isUpdate.value

View File

@@ -105,34 +105,34 @@
key: 'goodsId' key: 'goodsId'
}, },
{ {
title: '名称', title: '模板',
dataIndex: 'name', dataIndex: 'name',
key: 'name' key: 'name',
}, align: 'center'
{
title: '启用',
dataIndex: 'enabled',
key: 'enabled'
}, },
{ {
title: '单位名称', title: '单位名称',
dataIndex: 'unitName', dataIndex: 'unitName',
key: 'unitName' key: 'unitName',
align: 'center'
}, },
{ {
title: '最小购买数', title: '最小购买数',
dataIndex: 'minBuyQty', dataIndex: 'minBuyQty',
key: 'minBuyQty' key: 'minBuyQty',
align: 'center'
}, },
{ {
title: '起始发送数', title: '起始发送数',
dataIndex: 'startSendQty', dataIndex: 'startSendQty',
key: 'startSendQty' key: 'startSendQty',
align: 'center'
}, },
{ {
title: '买赠', title: '买赠',
dataIndex: 'giftMultiplier', dataIndex: 'giftMultiplier',
key: 'giftMultiplier' key: 'giftMultiplier',
align: 'center'
}, },
// { // {
// title: '是否把购买量也计入套票总量', // title: '是否把购买量也计入套票总量',
@@ -143,30 +143,36 @@
{ {
title: '每期释放量', title: '每期释放量',
dataIndex: 'monthlyReleaseQty', dataIndex: 'monthlyReleaseQty',
key: 'monthlyReleaseQty' key: 'monthlyReleaseQty',
align: 'center'
}, },
{ {
title: '总释期数', title: '总释期数',
dataIndex: 'releasePeriods', dataIndex: 'releasePeriods',
key: 'releasePeriods' key: 'releasePeriods',
align: 'center'
}, },
// {
// title: '首期释放',
// dataIndex: 'firstReleaseMode',
// key: 'firstReleaseMode',
// align: 'center'
// },
{ {
title: '首期释放', title: '状态',
dataIndex: 'firstReleaseMode', dataIndex: 'enabled',
key: 'firstReleaseMode' key: 'enabled',
}, width: 100,
{ align: 'center',
title: '排序', customRender: ({ text }) => (text === 1 ? '禁用' : '启用')
dataIndex: 'sortNumber',
key: 'sortNumber'
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
ellipsis: true
}, },
// { // {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// ellipsis: true
// },
// {
// title: '创建时间', // title: '创建时间',
// dataIndex: 'createTime', // dataIndex: 'createTime',
// key: 'createTime', // key: 'createTime',

View File

@@ -89,22 +89,6 @@
v-model:value="form.releasedQty" v-model:value="form.releasedQty"
/> />
</a-form-item> </a-form-item>
<a-form-item label="用户ID" name="userId">
<a-input
allow-clear
placeholder="请输入用户ID"
v-model:value="form.userId"
/>
</a-form-item>
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
<a-input-number
:min="0"
:max="9999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
/>
</a-form-item>
<a-form-item label="备注" name="comments"> <a-form-item label="备注" name="comments">
<a-textarea <a-textarea
:rows="4" :rows="4"
@@ -113,26 +97,12 @@
v-model:value="form.comments" v-model:value="form.comments"
/> />
</a-form-item> </a-form-item>
<a-form-item label="状态, 0正常, 1冻结" name="status"> <!-- <a-form-item label="状态" name="status">-->
<a-radio-group v-model:value="form.status"> <!-- <a-radio-group v-model:value="form.status">-->
<a-radio :value="0">显示</a-radio> <!-- <a-radio :value="0">显示</a-radio>-->
<a-radio :value="1">隐藏</a-radio> <!-- <a-radio :value="1">隐藏</a-radio>-->
</a-radio-group> <!-- </a-radio-group>-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="是否删除, 0否, 1是" name="deleted">
<a-input
allow-clear
placeholder="请输入是否删除, 0否, 1是"
v-model:value="form.deleted"
/>
</a-form-item>
<a-form-item label="修改时间" name="updateTime">
<a-input
allow-clear
placeholder="请输入修改时间"
v-model:value="form.updateTime"
/>
</a-form-item>
</a-form> </a-form>
</ele-modal> </ele-modal>
</template> </template>

View File

@@ -1,19 +1,20 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<template> <template>
<a-space :size="10" style="flex-wrap: wrap"> <a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" disabled @click="add"> <a-input-search
<template #icon> allow-clear
<PlusOutlined /> placeholder="用户ID|订单编号"
</template> style="width: 240px"
<span>添加</span> v-model:value="where.keywords"
</a-button> @search="reload"
/>
</a-space> </a-space>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue'; import { watch } from 'vue';
import useSearch from "@/utils/use-search";
import {GltUserTicketParam} from "@/api/glt/gltUserTicket/model";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@@ -24,17 +25,24 @@
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'search', where?: GradeParam): void; (e: 'search', where?: GltUserTicketParam): void;
(e: 'add'): void; (e: 'add'): void;
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
}>(); }>();
// 新增 // 表单数据
const add = () => { const { where } = useSearch<GltUserTicketParam>({
emit('add'); keywords: '',
userId: undefined
});
const reload = () => {
emit('search', where);
}; };
watch( watch(
() => props.selection, () => props.selection,
() => {} () => {}

View File

@@ -6,7 +6,6 @@
row-key="id" row-key="id"
:columns="columns" :columns="columns"
:datasource="datasource" :datasource="datasource"
:customRow="customRow"
tool-class="ele-toolbar-form" tool-class="ele-toolbar-form"
class="sys-org-table" class="sys-org-table"
> >
@@ -20,6 +19,18 @@
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'nickname'">
<a-space>
<a-avatar :src="record.avatar" />
<div class="flex flex-col">
<div>
<span>{{ record.nickname }}</span>
<span class="text-gray-400">ID{{ record.userId }}</span>
</div>
<div><span class="text-gray-400">{{ record.phone }}</span></div>
</div>
</a-space>
</template>
<template v-if="column.key === 'image'"> <template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" /> <a-image :src="record.image" :width="50" />
</template> </template>
@@ -49,7 +60,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref, computed } from 'vue'; import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
@@ -100,101 +111,77 @@
// 完整的列配置(包含所有字段) // 完整的列配置(包含所有字段)
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: '', title: '票号',
dataIndex: 'id', dataIndex: 'id',
key: 'id', key: 'id',
width: 90, width: 90
}, },
{ {
title: '模板ID', title: '用户信息',
dataIndex: 'templateId', dataIndex: 'nickname',
key: 'templateId', key: 'nickname',
width: 120 width: 280
}, },
{ {
title: '商品ID', title: '名称',
dataIndex: 'goodsId', dataIndex: 'templateName',
key: 'goodsId', key: 'templateName',
width: 120 align: 'center'
}, },
{ {
title: '订单ID', title: '金额',
dataIndex: 'orderId', dataIndex: 'payPrice',
key: 'orderId', key: 'payPrice',
width: 120 align: 'center',
customRender: ({ text }) => `${text.toFixed(2)}`
}, },
// {
// title: '商品ID',
// dataIndex: 'goodsId',
// key: 'goodsId',
// align: 'center'
// },
{ {
title: '订单编号', title: '赠送数量(桶)',
dataIndex: 'orderNo',
key: 'orderNo',
ellipsis: true
},
{
title: '订单商品ID',
dataIndex: 'orderGoodsId',
key: 'orderGoodsId',
width: 120
},
{
title: '总数量',
dataIndex: 'totalQty', dataIndex: 'totalQty',
key: 'totalQty', key: 'totalQty',
width: 120 align: 'center'
}, },
{ {
title: '可用数量', title: '可用(桶)',
dataIndex: 'availableQty', dataIndex: 'availableQty',
key: 'availableQty', key: 'availableQty',
width: 120 align: 'center'
}, },
{ {
title: '冻结数量', title: '冻结(桶)',
dataIndex: 'frozenQty', dataIndex: 'frozenQty',
key: 'frozenQty', key: 'frozenQty',
width: 120 align: 'center'
}, },
{ {
title: '已使用数量', title: '已使用(桶)',
dataIndex: 'usedQty', dataIndex: 'usedQty',
key: 'usedQty', key: 'usedQty',
width: 120 align: 'center'
}, },
{ {
title: '已释放数量', title: '已释放(桶)',
dataIndex: 'releasedQty', dataIndex: 'releasedQty',
key: 'releasedQty', key: 'releasedQty',
width: 120 align: 'center'
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
width: 120
},
{
title: '排序(数字越小越靠前)',
dataIndex: 'sortNumber',
key: 'sortNumber',
width: 120
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
ellipsis: true
},
{
title: '状态, 0正常, 1冻结',
dataIndex: 'status',
key: 'status',
width: 120
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
width: 120
}, },
// {
// title: '排序',
// dataIndex: 'sortNumber',
// key: 'sortNumber',
// },
// {
// title: '状态',
// dataIndex: 'status',
// key: 'status',
// align: 'center'
// },
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
@@ -205,24 +192,14 @@
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ // {
title: '修改时间', // title: '操作',
dataIndex: 'updateTime', // key: 'action',
key: 'updateTime', // width: 180,
width: 200, // fixed: 'right',
align: 'center', // align: 'center',
sorter: true, // hideInSetting: true
ellipsis: true, // }
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]); ]);
/* 搜索 */ /* 搜索 */
@@ -290,18 +267,18 @@
}; };
/* 自定义行属性 */ /* 自定义行属性 */
const customRow = (record: GltUserTicket) => { // const customRow = (record: GltUserTicket) => {
return { // return {
// 行点击事件 // // 行点击事件
onClick: () => { // onClick: () => {
// console.log(record); // // console.log(record);
}, // },
// 行双击事件 // // 行双击事件
onDblclick: () => { // onDblclick: () => {
openEdit(record); // openEdit(record);
} // }
}; // };
}; // };
query(); query();
</script> </script>

View File

@@ -1,19 +1,20 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<template> <template>
<a-space :size="10" style="flex-wrap: wrap"> <a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add"> <a-input-search
<template #icon> allow-clear
<PlusOutlined /> placeholder="用户ID|订单编号"
</template> style="width: 240px"
<span>添加</span> v-model:value="where.keywords"
</a-button> @search="reload"
/>
</a-space> </a-space>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue'; import { watch } from 'vue';
import useSearch from "@/utils/use-search";
import {GltUserTicketLogParam} from "@/api/glt/gltUserTicketLog/model";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@@ -24,15 +25,20 @@
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'search', where?: GradeParam): void; (e: 'search', where?: GltUserTicketLogParam): void;
(e: 'add'): void; (e: 'add'): void;
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
}>(); }>();
// 新增 // 表单数据
const add = () => { const { where } = useSearch<GltUserTicketLogParam>({
emit('add'); keywords: '',
userId: undefined
});
const reload = () => {
emit('search', where);
}; };
watch( watch(

View File

@@ -20,6 +20,18 @@
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'nickname'">
<a-space>
<a-avatar :src="record.avatar" />
<div class="flex flex-col">
<div>
<span>{{ record.nickname }}</span>
<span class="text-gray-400">ID{{ record.userId }}</span>
</div>
<div><span class="text-gray-400">{{ record.phone }}</span></div>
</div>
</a-space>
</template>
<template v-if="column.key === 'image'"> <template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" /> <a-image :src="record.image" :width="50" />
</template> </template>
@@ -49,7 +61,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref, computed } from 'vue'; import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
@@ -100,103 +112,67 @@
// 完整的列配置(包含所有字段) // 完整的列配置(包含所有字段)
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: '', title: '票号',
dataIndex: 'id',
key: 'id',
width: 90,
},
{
title: '用户水票ID',
dataIndex: 'userTicketId', dataIndex: 'userTicketId',
key: 'userTicketId', key: 'userTicketId',
width: 120 width: 90
},
{
title: '用户信息',
dataIndex: 'nickname',
key: 'nickname',
width: 280
},
{
title: '名称',
dataIndex: 'templateName',
key: 'templateName',
align: 'center'
}, },
{ {
title: '变更类型', title: '变更类型',
dataIndex: 'changeType', dataIndex: 'changeType',
key: 'changeType', key: 'changeType',
width: 120 align: 'center'
}, },
// {
// title: '可更改',
// dataIndex: 'changeAvailable',
// key: 'changeAvailable',
// width: 120
// },
// {
// title: '更改冻结状态',
// dataIndex: 'changeFrozen',
// key: 'changeFrozen',
// width: 120
// },
// {
// title: '已使用更改',
// dataIndex: 'changeUsed',
// key: 'changeUsed',
// width: 120
// },
// {
// title: '可用后',
// dataIndex: 'availableAfter',
// key: 'availableAfter',
// width: 120
// },
// {
// title: '冻结后',
// dataIndex: 'frozenAfter',
// key: 'frozenAfter',
// width: 120
// },
// {
// title: '使用后',
// dataIndex: 'usedAfter',
// key: 'usedAfter',
// width: 120
// },
{ {
title: '可更改', title: '核销时间',
dataIndex: 'changeAvailable',
key: 'changeAvailable',
width: 120
},
{
title: '更改冻结状态',
dataIndex: 'changeFrozen',
key: 'changeFrozen',
width: 120
},
{
title: '已使用更改',
dataIndex: 'changeUsed',
key: 'changeUsed',
width: 120
},
{
title: '可用后',
dataIndex: 'availableAfter',
key: 'availableAfter',
width: 120
},
{
title: '冻结后',
dataIndex: 'frozenAfter',
key: 'frozenAfter',
width: 120
},
{
title: '使用后',
dataIndex: 'usedAfter',
key: 'usedAfter',
width: 120
},
{
title: '订单ID',
dataIndex: 'orderId',
key: 'orderId',
width: 120
},
{
title: '订单编号',
dataIndex: 'orderNo',
key: 'orderNo',
ellipsis: true
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
width: 120
},
{
title: '排序(数字越小越靠前)',
dataIndex: 'sortNumber',
key: 'sortNumber',
width: 120
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
ellipsis: true
},
{
title: '状态, 0正常, 1冻结',
dataIndex: 'status',
key: 'status',
width: 120
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
width: 120
},
{
title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
width: 200, width: 200,
@@ -205,24 +181,14 @@
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ // {
title: '修改时间', // title: '操作',
dataIndex: 'updateTime', // key: 'action',
key: 'updateTime', // width: 180,
width: 200, // fixed: 'right',
align: 'center', // align: 'center',
sorter: true, // hideInSetting: true
ellipsis: true, // }
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]); ]);
/* 搜索 */ /* 搜索 */

View File

@@ -1,19 +1,20 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<template> <template>
<a-space :size="10" style="flex-wrap: wrap"> <a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add"> <a-input-search
<template #icon> allow-clear
<PlusOutlined /> placeholder="用户ID|订单编号"
</template> style="width: 240px"
<span>添加</span> v-model:value="where.keywords"
</a-button> @search="reload"
/>
</a-space> </a-space>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue'; import { watch } from 'vue';
import useSearch from "@/utils/use-search";
import {GltUserTicketReleaseParam} from "@/api/glt/gltUserTicketRelease/model";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@@ -24,15 +25,21 @@
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'search', where?: GradeParam): void; (e: 'search', where?: GltUserTicketReleaseParam): void;
(e: 'add'): void; (e: 'add'): void;
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
}>(); }>();
// 新增
const add = () => { // 表单数据
emit('add'); const { where } = useSearch<GltUserTicketReleaseParam>({
keywords: '',
userId: undefined
});
const reload = () => {
emit('search', where);
}; };
watch( watch(

View File

@@ -20,6 +20,18 @@
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'nickname'">
<a-space>
<a-avatar :src="record.avatar" />
<div class="flex flex-col">
<div>
<span>{{ record.nickname }}</span>
<span class="text-gray-400">ID{{ record.userId }}</span>
</div>
<div><span class="text-gray-400">{{ record.phone }}</span></div>
</div>
</a-space>
</template>
<template v-if="column.key === 'image'"> <template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" /> <a-image :src="record.image" :width="50" />
</template> </template>
@@ -100,31 +112,26 @@
// 完整的列配置(包含所有字段) // 完整的列配置(包含所有字段)
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: '', title: '票号',
dataIndex: 'id',
key: 'id',
width: 90,
},
{
title: '水票ID',
dataIndex: 'userTicketId', dataIndex: 'userTicketId',
key: 'userTicketId', key: 'userTicketId',
width: 120 width: 90
},
{
title: '用户信息',
dataIndex: 'nickname',
key: 'nickname',
width: 280
}, },
{ {
title: '用户ID', title: '周期',
dataIndex: 'userId',
key: 'userId',
width: 120
},
{
title: '周期编号',
dataIndex: 'periodNo', dataIndex: 'periodNo',
key: 'periodNo', key: 'periodNo',
width: 120 width: 120
}, },
{ {
title: '释放数量', title: '释放数量(桶)',
dataIndex: 'releaseQty', dataIndex: 'releaseQty',
key: 'releaseQty', key: 'releaseQty',
width: 120 width: 120
@@ -135,20 +142,14 @@
key: 'releaseTime', key: 'releaseTime',
width: 120 width: 120
}, },
// {
// title: '状态',
// dataIndex: 'status',
// key: 'status',
// width: 120
// },
{ {
title: '状态', title: '释放时间',
dataIndex: 'status',
key: 'status',
width: 120
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
width: 120
},
{
title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
width: 200, width: 200,
@@ -157,24 +158,14 @@
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ // {
title: '修改时间', // title: '操作',
dataIndex: 'updateTime', // key: 'action',
key: 'updateTime', // width: 180,
width: 200, // fixed: 'right',
align: 'center', // align: 'center',
sorter: true, // hideInSetting: true
ellipsis: true, // }
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]); ]);
/* 搜索 */ /* 搜索 */