Merge branch 'develop' of https://gitee.com/L-Shilin/go-fly-platform-services into feature_dzc

This commit is contained in:
duzhichao
2025-09-01 15:57:04 +08:00
146 changed files with 13315 additions and 3240 deletions
@@ -485,12 +485,17 @@ const Welcome: React.FC = () => {
{/* 新增二维码选择器 */}
<Select
placeholder="选择二维码"
style={{ width: 200 }}
style={{ width: 250 }}
allowClear
disabled={!selectedTourism}
options={getCurrentTourismQrcodes()}
value={selectedQrcode}
onChange={setSelectedQrcode}
showSearch
optionFilterProp="label"
filterOption={(input, option) =>
(String(option?.label) ?? '').toLowerCase().includes(input.toLowerCase())
}
/>
{/* 新增平台分账比例选择 */}
<span>平台分账比例:</span>
@@ -277,6 +277,9 @@ const DeviceMapDashboard: React.FC = () => {
playRtmpUrl: string;
} | null>(null);
const [currentStreamType, setCurrentStreamType] = useState<'hls' | 'flv' | 'rtmp'>('hls');
// 自定义指令输入
const [customMethod, setCustomMethod] = useState<string>('custom');
const [customPayload, setCustomPayload] = useState<string>('{}');
// 地图相关
const [mapInitialized, setMapInitialized] = useState(false);
@@ -1506,10 +1509,10 @@ const DeviceMapDashboard: React.FC = () => {
return false;
}
// 使用正确的主题格式:/device/{产品ID}/{设备SN}
// 使用正确的主题格式:/device-message-sender/D-Dock2/{设备SN}
const controlMessage = {
type: 'sub',
topic: `/device/D-Dock2/${deviceSn}`,
topic: `/device-message-sender/D-Dock2/${deviceSn}`,
parameter: {
messageType: 'WRITE_PROPERTY',
properties: {
@@ -2652,38 +2655,88 @@ const DeviceMapDashboard: React.FC = () => {
<Divider />
{/* 操作按钮 */}
<div style={{ marginBottom: '16px' }}>
<Title level={5}>设备操作</Title>
<Space wrap>
<Button
type="primary"
icon={<VideoCameraOutlined />}
onClick={() => handlePlayVideo(selectedDevice)}
loading={videoLoading}
size="small"
>
视频监控
</Button>
<Button
icon={<ToolOutlined />}
onClick={() => {
message.info('设备调试功能开发中...');
}}
size="small"
>
远程调试
</Button>
<Button
icon={<ControlOutlined />}
onClick={() => {
message.info('设备控制功能开发中...');
}}
size="small"
>
设备控制
</Button>
</Space>
</div>
<div style={{ marginBottom: '16px' }}>
<Title level={5}>设备操作</Title>
<Space wrap>
<Button
type="primary"
icon={<VideoCameraOutlined />}
onClick={() => handlePlayVideo(selectedDevice)}
loading={videoLoading}
size="small"
>
视频监控
</Button>
<Button
icon={<ToolOutlined />}
onClick={() => {
message.info('设备调试功能开发中...');
}}
size="small"
>
远程调试
</Button>
<Button
icon={<ControlOutlined />}
onClick={() => {
message.info('设备控制功能开发中...');
}}
size="small"
>
设备控制
</Button>
</Space>
{/* 自定义指令下发 */}
<div style={{ marginTop: 12, padding: 12, background: '#fafafa', borderRadius: 6, border: '1px solid #f0f0f0' }}>
<div style={{ marginBottom: 8, fontWeight: 600 }}>自定义指令下发</div>
<Space direction="vertical" style={{ width: '100%' }} size={8}>
<Input
placeholder="指令方法(method),如 camera_photo_take / return_home / 自定义"
value={customMethod}
onChange={(e) => setCustomMethod(e.target.value)}
size="small"
/>
<Input.TextArea
placeholder={'指令数据(JSON),如 {"speed":5}'}
value={customPayload}
onChange={(e) => setCustomPayload(e.target.value)}
autoSize={{ minRows: 2, maxRows: 6 }}
/>
<Button
type="primary"
size="small"
onClick={async () => {
try {
const method = (customMethod || '').trim();
if (!method) {
message.error('请输入指令方法');
return;
}
let data: any = {};
const payloadText = (customPayload || '').trim();
if (payloadText) {
try {
data = JSON.parse(payloadText);
} catch (err) {
message.error('指令数据需为合法JSON');
return;
}
}
const ok = await sendControlCommand(selectedDevice.deviceSn, method, data);
if (ok) {
message.success('指令已下发');
}
} catch (err) {
message.error('下发失败');
}
}}
>
下发自定义指令
</Button>
</Space>
</div>
</div>
{/* 无人机控制面板 */}
{selectedDevice.deviceType === 1 && (
@@ -7,7 +7,7 @@ import {
ProFormDigit,
} from '@ant-design/pro-components';
import { Form } from 'antd';
import { ENABLE_PROFIT_OPTIONS, PAYEE_TYPE_OPTIONS, ENABLE_VIDEO_EDIT_OPTIONS } from '../index';
import { ENABLE_PROFIT_OPTIONS, PAYEE_TYPE_OPTIONS, ENABLE_VIDEO_EDIT_OPTIONS, QRCODE_TYPE_OPTIONS, SHOW_VIDEO_EDIT_ONLY_OPTIONS } from '../index';
// 添加测试二维码选项常量
export const IS_TEST_OPTIONS = [
@@ -201,6 +201,24 @@ const CreateForm: React.FC<CreateFormProps> = ({
initialValue={0}
tooltip="测试二维码的数据不会计入正式统计"
/>
<ProFormSelect
width="md"
name="qrcodeType"
label="二维码类型"
options={QRCODE_TYPE_OPTIONS}
rules={[{ required: true, message: '请选择二维码类型' }]}
initialValue={1}
tooltip="用于区分该二维码是游客下单、定时巡查,还是其他用途"
/>
<ProFormSelect
width="md"
name="showVideoEditOnly"
label="是否只显示一键成片"
options={SHOW_VIDEO_EDIT_ONLY_OPTIONS}
rules={[{ required: true, message: '请选择是否只显示一键成片' }]}
initialValue={1}
tooltip="设置为是时,用户扫码后只显示一键成片功能,隐藏其他功能选项"
/>
</ProForm.Group>
<ProForm.Group>
@@ -6,7 +6,7 @@ import {
ProFormText,
ProFormDigit,
} from '@ant-design/pro-components';
import { STATUS_OPTIONS, PAYEE_TYPE_OPTIONS, ENABLE_PROFIT_OPTIONS, ENABLE_VIDEO_EDIT_OPTIONS } from '../index';
import { STATUS_OPTIONS, PAYEE_TYPE_OPTIONS, ENABLE_PROFIT_OPTIONS, ENABLE_VIDEO_EDIT_OPTIONS, QRCODE_TYPE_OPTIONS, SHOW_VIDEO_EDIT_ONLY_OPTIONS } from '../index';
import { Form, Space } from 'antd';
import styles from './index.less';
@@ -210,6 +210,22 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
rules={[{ required: true, message: '请选择是否为测试二维码' }]}
tooltip="测试二维码的数据不会计入正式统计"
/>
<ProFormSelect
width="md"
name="qrcodeType"
label="二维码类型"
options={QRCODE_TYPE_OPTIONS}
rules={[{ required: true, message: '请选择二维码类型' }]}
tooltip="用于区分该二维码是游客下单、定时巡查,还是其他用途"
/>
<ProFormSelect
width="md"
name="showVideoEditOnly"
label="是否只显示一键成片"
options={SHOW_VIDEO_EDIT_ONLY_OPTIONS}
rules={[{ required: true, message: '请选择是否只显示一键成片' }]}
tooltip="设置为是时,用户扫码后只显示一键成片功能,隐藏其他功能选项"
/>
</ProForm.Group>
<ProForm.Group>
@@ -61,6 +61,19 @@ export const IS_TEST_OPTIONS = [
{ label: '是', value: 1 },
] as const;
// 添加二维码类型选项常量
export const QRCODE_TYPE_OPTIONS = [
{ label: '游客下单', value: 1 },
{ label: '定时巡查', value: 2 },
{ label: '其他', value: 3 },
] as const;
// 添加是否只显示一键成片选项常量
export const SHOW_VIDEO_EDIT_ONLY_OPTIONS = [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
] as const;
const handleApiRequest = async (
apiCall: () => Promise<any>,
loadingMessage: string,
@@ -461,6 +474,39 @@ const TableList: React.FC = () => {
1: { text: '是' },
},
},
{
title: '二维码类型',
dataIndex: 'qrcodeType',
width: 120,
render: (_, record) => {
const typeMap = {
1: { color: 'green', text: '游客下单' },
2: { color: 'blue', text: '定时巡查' },
3: { color: 'orange', text: '其他' },
};
const { color, text } = typeMap[record.qrcodeType || 1] || typeMap[1];
return <Tag color={color}>{text}</Tag>;
},
valueEnum: {
1: { text: '游客下单' },
2: { text: '定时巡查' },
3: { text: '其他' },
},
},
{
title: '是否只显示一键成片',
dataIndex: 'showVideoEditOnly',
width: 140,
render: (_, record) => {
const status = record.showVideoEditOnly === 1 ? '是' : '否';
const color = record.showVideoEditOnly === 1 ? 'purple' : 'default';
return <Tag color={color}>{status}</Tag>;
},
valueEnum: {
0: { text: '否' },
1: { text: '是' },
},
},
{
title: '应用ID',
dataIndex: 'tenantId',
@@ -542,6 +588,18 @@ const TableList: React.FC = () => {
placeholder="请选择是否为测试二维码"
options={IS_TEST_OPTIONS}
/>
<ProFormSelect
name="qrcodeType"
label="二维码类型"
placeholder="请选择二维码类型"
options={QRCODE_TYPE_OPTIONS}
/>
<ProFormSelect
name="showVideoEditOnly"
label="是否只显示一键成片"
placeholder="请选择是否只显示一键成片"
options={SHOW_VIDEO_EDIT_ONLY_OPTIONS}
/>
<ProFormSelect
name="tenantId"
label="应用ID"
@@ -88,6 +88,18 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
rules={[{ required: true, message: '此项为必填项' }]}
placeholder="请选择状态"
/>
<ProFormSelect
name="showInHomepage"
label="首页显示"
width="md"
options={[
{ label: '显示', value: 1 },
{ label: '不显示', value: 0 },
]}
rules={[{ required: true, message: '此项为必填项' }]}
placeholder="请选择是否在首页显示"
tooltip="控制景区是否在首页附近景区列表中显示"
/>
</ProForm.Group>
<ProForm.Group>
@@ -204,6 +204,23 @@ const TableList: React.FC = () => {
'0': { text: '未启用', status: 'Error' },
},
},
{
title: '首页显示',
dataIndex: 'showInHomepage',
valueType: 'select',
valueEnum: {
'1': { text: '显示', status: 'Success' },
'0': { text: '不显示', status: 'Default' },
},
render: (_, record) => {
const showInHomepage = record.showInHomepage ?? 1; // 默认为1(显示)
return showInHomepage === 1 ? (
<Tag color="green">显示</Tag>
) : (
<Tag color="default">不显示</Tag>
);
},
},
{
title: '创建时间',
dataIndex: 'createTime',
@@ -318,6 +335,18 @@ const TableList: React.FC = () => {
rules={[formRules.required]}
initialValue="1"
/>
<ProFormSelect
name="showInHomepage"
label="首页显示"
width="md"
options={[
{ label: '显示', value: 1 },
{ label: '不显示', value: 0 },
]}
rules={[formRules.required]}
initialValue={1}
tooltip="控制景区是否在首页附近景区列表中显示"
/>
</ProForm.Group>
<ProForm.Group>
@@ -39,6 +39,7 @@ declare namespace ORDERS {
status: number;
tenantId?: string;
updateTime?: string;
showInHomepage?: number; // 是否在首页显示(0:不显示,1:显示)
}
type TourismWithDistance = Tourism & {
@@ -85,6 +86,8 @@ declare namespace ORDERS {
enableProfit?: number; // 是否开启分润(0:否,1:是)
enableVideoEdit?: number; // 是否开启一键成片(0:否,1:是)
waylineId?: string; // 航线ID
qrcodeType?: number; // 二维码类型(1:游客下单,2:定时巡查,3:其他)
showVideoEditOnly?: number; // 是否只显示一键成片(0:否,1:是)
}
type HomeCarousel = {