From 7aa0e6a32fb4a63a178a37f4c424537d321f8566 Mon Sep 17 00:00:00 2001 From: duzhichao <1098974448@qq.com> Date: Thu, 23 Oct 2025 18:02:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201=EF=BC=9A=E4=BC=98=E5=8C=96token?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=A1=B5=202=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=203=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=99=AF=E5=8C=BA=E4=B8=8E=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/TourismMapper.xml | 3 + .../Tourism/components/QrcodeListModal.tsx | 132 ++++++++++++++++-- .../src/pages/orders/Tourism/index.tsx | 26 +++- zlt-web/react-web-next/src/services/orders.ts | 3 +- 4 files changed, 148 insertions(+), 16 deletions(-) diff --git a/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml b/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml index 651499a2..1df4b60a 100644 --- a/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml +++ b/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml @@ -16,6 +16,9 @@ AND t.tenant_id = #{p.tenantId} + + AND t.tourism_name LIKE CONCAT('%', #{p.tourismName}, '%') + ORDER BY t.id DESC diff --git a/zlt-web/react-web-next/src/pages/orders/Tourism/components/QrcodeListModal.tsx b/zlt-web/react-web-next/src/pages/orders/Tourism/components/QrcodeListModal.tsx index 4a7b57f1..351a52bc 100644 --- a/zlt-web/react-web-next/src/pages/orders/Tourism/components/QrcodeListModal.tsx +++ b/zlt-web/react-web-next/src/pages/orders/Tourism/components/QrcodeListModal.tsx @@ -1,8 +1,8 @@ import React, { useMemo, useRef, useState } from 'react'; -import { Modal, Popconfirm, Space, Tag, message } from 'antd'; +import { Modal, Popconfirm, Space, Tag, message, Button } from 'antd'; import { ProTable, type ActionType } from '@ant-design/pro-components'; import { GradientButton } from '@/components/ui'; -import { PlusOutlined } from '@ant-design/icons'; +import { PlusOutlined, CopyOutlined } from '@ant-design/icons'; import { ordersApi } from '@/services/orders'; import QrcodeForm, { QrcodeItem } from '../../Qrcode/components/QrcodeForm'; @@ -18,6 +18,8 @@ const QrcodeListModal: React.FC = ({ open, onOpenChange, t const [createOpen, setCreateOpen] = useState(false); const [editOpen, setEditOpen] = useState(false); const [current, setCurrent] = useState(undefined); + const [previewOpen, setPreviewOpen] = useState(false); + const [previewImage, setPreviewImage] = useState(''); const title = useMemo( () => `打卡点二维码列表${tourismName ? `(${tourismName})` : ''}`, @@ -25,21 +27,113 @@ const QrcodeListModal: React.FC = ({ open, onOpenChange, t ); const columns: any[] = [ - { dataIndex: 'index', valueType: 'indexBorder', width: 56 }, - { title: '名称', dataIndex: 'name' }, - { title: '链接', dataIndex: 'url', ellipsis: true }, - { title: '类型', dataIndex: 'type' }, + { dataIndex: 'index', valueType: 'indexBorder', width: 48 }, + { title: 'ID', dataIndex: 'id', width: 80 }, + { title: '名称', dataIndex: 'name', width: 120 }, + { + title: 'Code', + dataIndex: 'codeId', + width: 200, + render: (codeId: string) => { + if (!codeId) return '-'; + return ( +
+ + {codeId} + +
+ ); + }, + }, + { + title: '航线ID', + dataIndex: 'waylineId', + width: 200, + render: (waylineId: string) => { + if (!waylineId) return '-'; + return ( +
+ + {waylineId} + +
+ ); + }, + }, + { + title: '二维码', + dataIndex: 'viewUrl', + width: 100, + render: (url: string) => { + if (!url) return '-'; + return ( + 二维码 { + setPreviewImage(url); + setPreviewOpen(true); + }} + /> + ); + }, + }, + { title: '设备SN', dataIndex: 'deviceSn', width: 150 }, + { + title: '价格', + dataIndex: 'price', + width: 100, + render: (price: string | number) => { + if (!price) return '-'; + const priceNum = typeof price === 'string' ? parseFloat(price) : price; + return `¥${(priceNum / 100).toFixed(2)}`; + }, + }, { title: '状态', dataIndex: 'status', + width: 80, render: (v: number) => ( - {v === 1 ? '启用' : '禁用'} + + {v === 1 ? '开启' : '关闭'} + ), }, + { title: '创建时间', dataIndex: 'createTime', valueType: 'dateTime', width: 160 }, { title: '操作', key: 'action', - width: 160, + width: 140, + fixed: 'right', render: (_: any, record: QrcodeItem) => ( = ({ open, onOpenChange, t open={open} onCancel={() => onOpenChange(false)} footer={null} - width={1000} + width={1400} destroyOnClose >
@@ -101,6 +195,7 @@ const QrcodeListModal: React.FC = ({ open, onOpenChange, t search={false} pagination={{ showSizeChanger: true, showQuickJumper: true }} toolBarRender={false} + scroll={{ x: 1200 }} /> @@ -146,6 +241,25 @@ const QrcodeListModal: React.FC = ({ open, onOpenChange, t } }} /> + + {/* 二维码预览 */} + setPreviewOpen(false)} + footer={null} + width={600} + centered + destroyOnClose + > +
+ 二维码预览 +
+
); }; diff --git a/zlt-web/react-web-next/src/pages/orders/Tourism/index.tsx b/zlt-web/react-web-next/src/pages/orders/Tourism/index.tsx index c99cb701..fe613861 100644 --- a/zlt-web/react-web-next/src/pages/orders/Tourism/index.tsx +++ b/zlt-web/react-web-next/src/pages/orders/Tourism/index.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useState } from 'react'; -import { PageContainer, ProFormText, ProTable } from '@ant-design/pro-components'; +import React, { useEffect, useRef, useState } from 'react'; +import { PageContainer, ProFormText, ProTable, type ActionType } from '@ant-design/pro-components'; import { Popconfirm, Space, Tag, message } from 'antd'; import { ActionBar, GlassCard, GradientButton, SearchBarPlus } from '@/components/ui'; import { PlusOutlined } from '@ant-design/icons'; @@ -15,6 +15,7 @@ const TourismPage: React.FC = () => { const [params, setParams] = useState>({}); const [qrcodeOpen, setQrcodeOpen] = useState(false); const [qrcodeTourism, setQrcodeTourism] = useState(undefined); + const actionRef = useRef(); // 首次进入时,默认按“当前租户 + 包含下级租户”查询,避免全量数据 useEffect(() => { @@ -36,7 +37,7 @@ const TourismPage: React.FC = () => { const columns: any[] = [ { dataIndex: 'index', valueType: 'indexBorder', width: 48 }, - { title: '旅游项目', dataIndex: 'tourismName' }, + { title: '景区名称', dataIndex: 'tourismName' }, { title: '地址', dataIndex: 'tourismAddress' }, { title: '经度', dataIndex: 'longitude' }, { title: '纬度', dataIndex: 'latitude' }, @@ -57,7 +58,7 @@ const TourismPage: React.FC = () => { key: 'action', render: (_: any, record: TourismItem) => ( -
{ setQrcodeTourism(record); setQrcodeOpen(true); }}>打卡点 + { setQrcodeTourism(record); setQrcodeOpen(true); }}>二维码 { setCurrent(record); setEditOpen(true); }}>编辑 { try { await ordersApi.deleteTourism(record.id!); message.success('删除成功'); + actionRef.current?.reload(); } catch { message.error('删除失败'); } finally { hide(); } @@ -79,15 +81,22 @@ const TourismPage: React.FC = () => { ]; return ( - + { setParams((prev) => ({ ...(prev || {}), tenantId, includeChildren })); + // 强制刷新表格 + actionRef.current?.reload(); + }} + onFinish={async (values) => { + setParams((prev) => ({ ...(prev || {}), ...values })); + // 即使查询条件未变化也再次请求 + actionRef.current?.reload(); }} - onFinish={async (values) => setParams((prev) => ({ ...(prev || {}), ...values }))} > @@ -104,6 +113,7 @@ const TourismPage: React.FC = () => { {params?.tenantId ? ( rowKey="id" + actionRef={actionRef} params={params} request={(p) => ordersApi.tourism({ ...(p as any), ...params })} columns={columns} @@ -123,6 +133,8 @@ const TourismPage: React.FC = () => { try { await ordersApi.saveOrUpdateTourism(values); message.success('新增成功'); + // 新增成功后刷新表格 + actionRef.current?.reload(); return true; } catch { message.error('新增失败'); @@ -141,6 +153,7 @@ const TourismPage: React.FC = () => { try { await ordersApi.saveOrUpdateTourism({ ...(current as any), ...values }); message.success('修改成功'); + actionRef.current?.reload(); return true; } catch { message.error('修改失败'); @@ -162,3 +175,4 @@ const TourismPage: React.FC = () => { }; export default TourismPage; + diff --git a/zlt-web/react-web-next/src/services/orders.ts b/zlt-web/react-web-next/src/services/orders.ts index 0124ecf4..be502b0c 100644 --- a/zlt-web/react-web-next/src/services/orders.ts +++ b/zlt-web/react-web-next/src/services/orders.ts @@ -67,7 +67,8 @@ export const ordersApi = { return (res as any).data || res; }, deleteTourism: async (id: number) => { - const res = await request(`/api-order/tourism/${id}`, { method: 'DELETE' }); + // 后端删除接口为 DELETE /tourism(从请求体读取 id),不支持 path 变量 + const res = await request('/api-order/tourism', { method: 'DELETE', data: { id } }); return (res as any).data || res; },