|
@@ -11,7 +11,7 @@ import { format } from 'date-fns';
|
|
|
import { createRouteSchema, updateRouteSchema, VehicleType } from '@/server/modules/routes/route.schema';
|
|
import { createRouteSchema, updateRouteSchema, VehicleType } from '@/server/modules/routes/route.schema';
|
|
|
import type { CreateRouteInput, UpdateRouteInput } from '@/server/modules/routes/route.schema';
|
|
import type { CreateRouteInput, UpdateRouteInput } from '@/server/modules/routes/route.schema';
|
|
|
import { ActivitySelect } from './ActivitySelect';
|
|
import { ActivitySelect } from './ActivitySelect';
|
|
|
-import { DisabledStatus } from '@/share/types';
|
|
|
|
|
|
|
+import { LocationSelect } from './LocationSelect';
|
|
|
|
|
|
|
|
// 将Date对象格式化为 datetime-local 输入框需要的格式
|
|
// 将Date对象格式化为 datetime-local 输入框需要的格式
|
|
|
const formatDateTimeForInput = (date: Date): string => {
|
|
const formatDateTimeForInput = (date: Date): string => {
|
|
@@ -188,20 +188,17 @@ export const RouteForm: React.FC<RouteFormProps> = ({
|
|
|
{/* 出发地 */}
|
|
{/* 出发地 */}
|
|
|
<FormField
|
|
<FormField
|
|
|
control={form.control}
|
|
control={form.control}
|
|
|
- name="startPoint"
|
|
|
|
|
|
|
+ name="startLocationId"
|
|
|
render={({ field }) => (
|
|
render={({ field }) => (
|
|
|
<FormItem>
|
|
<FormItem>
|
|
|
<FormLabel>出发地 *</FormLabel>
|
|
<FormLabel>出发地 *</FormLabel>
|
|
|
<FormControl>
|
|
<FormControl>
|
|
|
- <div className="relative">
|
|
|
|
|
- <MapPin className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
|
|
|
- <Input
|
|
|
|
|
- placeholder="请输入出发地"
|
|
|
|
|
- className="pl-8"
|
|
|
|
|
- data-testid="start-point-input"
|
|
|
|
|
- {...field}
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <LocationSelect
|
|
|
|
|
+ placeholder="请选择出发地"
|
|
|
|
|
+ value={field.value}
|
|
|
|
|
+ onValueChange={field.onChange}
|
|
|
|
|
+ data-testid="start-location-select"
|
|
|
|
|
+ />
|
|
|
</FormControl>
|
|
</FormControl>
|
|
|
<FormDescription>
|
|
<FormDescription>
|
|
|
路线的出发地点
|
|
路线的出发地点
|
|
@@ -214,20 +211,17 @@ export const RouteForm: React.FC<RouteFormProps> = ({
|
|
|
{/* 目的地 */}
|
|
{/* 目的地 */}
|
|
|
<FormField
|
|
<FormField
|
|
|
control={form.control}
|
|
control={form.control}
|
|
|
- name="endPoint"
|
|
|
|
|
|
|
+ name="endLocationId"
|
|
|
render={({ field }) => (
|
|
render={({ field }) => (
|
|
|
<FormItem>
|
|
<FormItem>
|
|
|
<FormLabel>目的地 *</FormLabel>
|
|
<FormLabel>目的地 *</FormLabel>
|
|
|
<FormControl>
|
|
<FormControl>
|
|
|
- <div className="relative">
|
|
|
|
|
- <MapPin className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
|
|
|
- <Input
|
|
|
|
|
- placeholder="请输入目的地"
|
|
|
|
|
- className="pl-8"
|
|
|
|
|
- data-testid="end-point-input"
|
|
|
|
|
- {...field}
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <LocationSelect
|
|
|
|
|
+ placeholder="请选择目的地"
|
|
|
|
|
+ value={field.value}
|
|
|
|
|
+ onValueChange={field.onChange}
|
|
|
|
|
+ data-testid="end-location-select"
|
|
|
|
|
+ />
|
|
|
</FormControl>
|
|
</FormControl>
|
|
|
<FormDescription>
|
|
<FormDescription>
|
|
|
路线的目的地
|
|
路线的目的地
|