提交 9504e90b 作者: 翁进城

Merge remote-tracking branch 'origin/caoyun'

...@@ -23,7 +23,7 @@ export default function CategoryItem(props: Props) { ...@@ -23,7 +23,7 @@ export default function CategoryItem(props: Props) {
}) })
} }
const showCount = 14; //展示数量 const showCount = 12 //展示数量
return ( return (
<div className={styles.filterItem}> <div className={styles.filterItem}>
...@@ -37,7 +37,7 @@ export default function CategoryItem(props: Props) { ...@@ -37,7 +37,7 @@ export default function CategoryItem(props: Props) {
ghost ghost
collapsible="icon" collapsible="icon"
expandIconPosition="end" expandIconPosition="end"
style={{ width: "100%" }} style={{ width: '100%' }}
> >
<Collapse.Panel <Collapse.Panel
header={ header={
...@@ -51,7 +51,7 @@ export default function CategoryItem(props: Props) { ...@@ -51,7 +51,7 @@ export default function CategoryItem(props: Props) {
> >
{item.name} {item.name}
</Button> </Button>
); )
})} })}
</Space> </Space>
} }
...@@ -67,12 +67,12 @@ export default function CategoryItem(props: Props) { ...@@ -67,12 +67,12 @@ export default function CategoryItem(props: Props) {
> >
{item.name} {item.name}
</Button> </Button>
); )
})} })}
</Space> </Space>
</Collapse.Panel> </Collapse.Panel>
</Collapse> </Collapse>
</div> </div>
</div> </div>
); )
} }
...@@ -47,25 +47,25 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -47,25 +47,25 @@ export default function OrderForGoods(props: PropsBox) {
if (detailData && shopDetail && list && wareSkuList) { if (detailData && shopDetail && list && wareSkuList) {
const pushList = { const pushList = {
actualPay: actualPay:
discount?.specPrice[0].price! * shopDetail?.num! * days! || 0, discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0,
deposit: 0, deposit: 0,
endDate: moment(new Date(shopDetail.dateDetail[1])).format( endDate: moment(new Date(shopDetail.dateDetail[1])).format(
'YYYY-MM-DD' 'YYYY-MM-DD'
), ),
orderReceipt: { orderReceipt: {
detailAddress: list[value].takeAddress, detailAddress: list[value]?.takeAddress,
receiptMethod: 0, receiptMethod: 0,
region: list[value].takeRegion, region: list[value].takeRegion,
takeName: list[value].takeName, takeName: list[value].takeName,
takePhone: Number(list[value].takePhone), takePhone: Number(list[value].takePhone),
}, },
rentPrice: rentPrice:
discount?.specPrice[0].price! * shopDetail?.num! * days! || 0, discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0,
returnDate: moment( returnDate: moment(
new Date(shopDetail.dateDetail[1]).getTime() + 864e5 new Date(shopDetail.dateDetail[1]).getTime() + 864e5
).format('YYYY-MM-DD'), ).format('YYYY-MM-DD'),
shouldPay: shouldPay:
discount?.specPrice[0].price! * shopDetail?.num! * days! || 0, discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0,
specsId: wareSkuList[0].productSpec, specsId: wareSkuList[0].productSpec,
startDate: moment(new Date(shopDetail.dateDetail[0]!)).format( startDate: moment(new Date(shopDetail.dateDetail[0]!)).format(
'YYYY-MM-DD' 'YYYY-MM-DD'
...@@ -228,7 +228,7 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -228,7 +228,7 @@ export default function OrderForGoods(props: PropsBox) {
</div> </div>
</div> </div>
<div className="body-item" style={{ width: 130 }}> <div className="body-item" style={{ width: 130 }}>
{discount?.specPrice[0].price || 0} {discount?.specPrice[0]?.price || 0}
</div> </div>
<div className="body-item" style={{ width: 130 }}> <div className="body-item" style={{ width: 130 }}>
{shopDetail?.num || 1} {shopDetail?.num || 1}
...@@ -243,7 +243,7 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -243,7 +243,7 @@ export default function OrderForGoods(props: PropsBox) {
)} )}
</div> </div>
<div className="body-item total-price" style={{ width: 135 }}> <div className="body-item total-price" style={{ width: 135 }}>
{discount?.specPrice[0].price! * shopDetail?.num! * days! || 0} {discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0}
</div> </div>
</div> </div>
</div> </div>
...@@ -282,13 +282,14 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -282,13 +282,14 @@ export default function OrderForGoods(props: PropsBox) {
<div className="top"> <div className="top">
<div className="label">实付款</div> <div className="label">实付款</div>
<div className="price"> <div className="price">
¥{discount?.specPrice[0].price! * shopDetail?.num! * days! || 0} ¥
{discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0}
</div> </div>
</div> </div>
<div className="bottom"> <div className="bottom">
<div className="value">寄送至</div> <div className="value">寄送至</div>
{list ? ( {list ? (
<div className="value-content">{list![value].takeAddress}</div> <div className="value-content">{list![value]?.takeAddress}</div>
) : null} ) : null}
</div> </div>
</div> </div>
...@@ -321,7 +322,7 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -321,7 +322,7 @@ export default function OrderForGoods(props: PropsBox) {
]} ]}
> >
<div className="title"> <div className="title">
{discount?.specPrice[0].price! * shopDetail?.num! * days! || 0} {discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0}
</div> </div>
<div>云享飞账号: {userInfo?.uid}</div> <div>云享飞账号: {userInfo?.uid}</div>
<div>付款方式: 可用(¥{paymentDetail?.balance})</div> <div>付款方式: 可用(¥{paymentDetail?.balance})</div>
......
...@@ -92,7 +92,7 @@ export default function MapComponent() { ...@@ -92,7 +92,7 @@ export default function MapComponent() {
const markerList: any = [] const markerList: any = []
if (list?.length) { if (list?.length) {
list?.map((item) => { list?.map((item) => {
const EntiyValue = addEntiy(item.lon, item.lat, item.address) const EntiyValue = addEntiy(item.lon, item.lat, item.name)
markerList.push(EntiyValue) markerList.push(EntiyValue)
}) })
if (markerList.length) MAP?.add(markerList) if (markerList.length) MAP?.add(markerList)
......
...@@ -94,7 +94,7 @@ export default function MoreServicePoints() { ...@@ -94,7 +94,7 @@ export default function MoreServicePoints() {
const markerList: any = [] const markerList: any = []
if (list?.length) { if (list?.length) {
list?.map((item) => { list?.map((item) => {
const EntiyValue = addEntiy(item.lon, item.lat, item.address) const EntiyValue = addEntiy(item.lon, item.lat, item.name)
markerList.push(EntiyValue) markerList.push(EntiyValue)
}) })
setServicePoints(list) setServicePoints(list)
...@@ -144,7 +144,7 @@ export default function MoreServicePoints() { ...@@ -144,7 +144,7 @@ export default function MoreServicePoints() {
const markerList: any = [] const markerList: any = []
if (list?.length) { if (list?.length) {
list?.map((item) => { list?.map((item) => {
const EntiyValue = addEntiy(item.lon, item.lat, item.address) const EntiyValue = addEntiy(item.lon, item.lat, item.name)
markerList.push(EntiyValue) markerList.push(EntiyValue)
}) })
setServicePoints(list) setServicePoints(list)
...@@ -215,12 +215,12 @@ export default function MoreServicePoints() { ...@@ -215,12 +215,12 @@ export default function MoreServicePoints() {
var infoWindow = new Amap.InfoWindow({ var infoWindow = new Amap.InfoWindow({
position: p, position: p,
offset: new Amap.Pixel(20, -10), offset: new Amap.Pixel(20, -10),
content: item.dizhi || item.flyerName || item.uavName || item.address, content: item.dizhi || item.flyerName || item.uavName || item.name,
}) })
infoWindow.open(MAP) infoWindow.open(MAP)
if (item.dizhi) { if (item.dizhi) {
return MAP?.setCenter([item.jd, item.wd]) return MAP?.setCenter([item.jd, item.wd])
} else if (item.flyerName || item.uavName || item.address) { } else if (item.flyerName || item.uavName || item.name) {
return MAP?.setCenter([item.lon, item.lat]) return MAP?.setCenter([item.lon, item.lat])
} }
return message.warning('暂无位置信息') return message.warning('暂无位置信息')
...@@ -259,7 +259,7 @@ export default function MoreServicePoints() { ...@@ -259,7 +259,7 @@ export default function MoreServicePoints() {
onClick={() => mapEntiy(3)} onClick={() => mapEntiy(3)}
className={`item ${mapItem === 3 ? 'active' : ''}`} className={`item ${mapItem === 3 ? 'active' : ''}`}
> >
机构网点 维修网点
</div> </div>
</div> </div>
<div className="content"> <div className="content">
...@@ -267,7 +267,7 @@ export default function MoreServicePoints() { ...@@ -267,7 +267,7 @@ export default function MoreServicePoints() {
{mapItem === 0 && <div className="left-title">服务网点</div>} {mapItem === 0 && <div className="left-title">服务网点</div>}
{mapItem === 1 && <div className="left-title">培训网点</div>} {mapItem === 1 && <div className="left-title">培训网点</div>}
{mapItem === 2 && <div className="left-title">租赁网点</div>} {mapItem === 2 && <div className="left-title">租赁网点</div>}
{mapItem === 3 && <div className="left-title">机构网点</div>} {mapItem === 3 && <div className="left-title">维修网点</div>}
<div className="left-content"> <div className="left-content">
{servicePoints.map((item: any, index: number) => ( {servicePoints.map((item: any, index: number) => (
<div <div
...@@ -275,10 +275,10 @@ export default function MoreServicePoints() { ...@@ -275,10 +275,10 @@ export default function MoreServicePoints() {
onClick={() => moveTo(item, index)} onClick={() => moveTo(item, index)}
className="left-content-item" className="left-content-item"
title={ title={
item.dizhi || item.flyerName || item.uavName || item.address item.dizhi || item.flyerName || item.uavName || item.name
} }
> >
{item.dizhi || item.flyerName || item.uavName || item.address} {item.dizhi || item.flyerName || item.uavName || item.name}
</div> </div>
))} ))}
</div> </div>
......
import styled from "styled-components"; import styled from 'styled-components'
export default function Style() { export default function Style() {
return <></>; return <></>
} }
export const Box = styled.div` export const Box = styled.div`
...@@ -12,7 +12,7 @@ export const Box = styled.div` ...@@ -12,7 +12,7 @@ export const Box = styled.div`
position: relative; position: relative;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
width: 384px; width: 100%;
height: 220px; height: 220px;
} }
...@@ -46,9 +46,4 @@ export const Box = styled.div` ...@@ -46,9 +46,4 @@ export const Box = styled.div`
color: #ff552d; color: #ff552d;
} }
} }
#container { `
padding: 0px;
margin: 0px;
width: 100%;
}
`;
...@@ -102,28 +102,28 @@ export default function WaterfallFlowBody() { ...@@ -102,28 +102,28 @@ export default function WaterfallFlowBody() {
const [rightTopDomList, setRightTopDomList] = useState<JSX.Element>() const [rightTopDomList, setRightTopDomList] = useState<JSX.Element>()
const [rightBottomDomList, setRightBottomDomList] = useState<JSX.Element>() const [rightBottomDomList, setRightBottomDomList] = useState<JSX.Element>()
const { deviceBrand, deviceModel } = equipmentLeasingApi // const { deviceBrand, deviceModel } = equipmentLeasingApi
const eqApiTypeList = ['brandId', 'categoryId', 'modelId'] // const eqApiTypeList = ['brandId', 'categoryId', 'modelId']
const { // const {
listAllModel, // listAllModel,
listAllBrand, // listAllBrand,
listAllCategory, // listAllCategory,
listAllParts, // listAllParts,
listAllQuality, // listAllQuality,
} = mallApi // } = mallApi
const mallApiTypeList = [ // const mallApiTypeList = [
'brandId', // 'brandId',
'productCategoryId', // 'productCategoryId',
'partsId', // 'partsId',
'modelId', // 'modelId',
'qualityId', // 'qualityId',
] // ]
const { IndustryFlightSkills, InDronePilotLicense } = flightSkillsApi // const { IndustryFlightSkills, InDronePilotLicense } = flightSkillsApi
const flightApiTypeList = ['licenseId', 'flightSkillsId'] // const flightApiTypeList = ['licenseId', 'flightSkillsId']
const { listAllIndustry, listAllAppType } = jobServicesApi // const { listAllIndustry, listAllAppType } = jobServicesApi
const jobApiTypeList = ['industryId', 'appTypeId'] // const jobApiTypeList = ['industryId', 'appTypeId']
const onMoreChange = ( const onMoreChange = (
value: { value: string; label: number }, value: { value: string; label: number },
...@@ -228,35 +228,35 @@ export default function WaterfallFlowBody() { ...@@ -228,35 +228,35 @@ export default function WaterfallFlowBody() {
useEffect(() => { useEffect(() => {
;(async () => { ;(async () => {
const res1 = await api.HomeCategories({ type: 1 }) //无人机出租
const res4 = await api.HomeCategories({ type: 4 }) //无人机销售
const res2 = await api.HomeCategories({ type: 2 }) //无人机培训 const res2 = await api.HomeCategories({ type: 2 }) //无人机培训
const res4 = await api.HomeCategories({ type: 4 }) //无人机销售
const res1 = await api.HomeCategories({ type: 1 }) //无人机出租
const res3 = await api.HomeCategories({ type: 3 }) //无人机服务 const res3 = await api.HomeCategories({ type: 3 }) //无人机服务
console.log(res1, res2, res3, res4) console.log(res1, res2, res3, res4)
const listOption = JSON.parse(JSON.stringify(list)).map( const listOption = JSON.parse(JSON.stringify(list)).map(
(item: string, index: number) => { (item: string, index: number) => {
return { id: index, name: item, value: index } return { id: index, categoryName: item, value: index }
} }
) )
const list2Option = JSON.parse(JSON.stringify(list2)).map( const list2Option = JSON.parse(JSON.stringify(list2)).map(
(item: string, index: number) => { (item: string, index: number) => {
return { id: index, name: item, value: index } return { id: index, categoryName: item, value: index }
} }
) )
const optionList = [ const optionList = [
res1.result, res2.result,
res4.result, res4.result,
listOption, listOption,
res3.result, res3.result,
res2.result, res1.result,
list2Option, list2Option,
] ]
const listValue: any = [ const listValue: any = [
res1.result, res2.result,
res4.result, res4.result,
[], [],
res3.result, res3.result,
res2.result, res1.result,
[], [],
] ]
setLeftDomList( setLeftDomList(
......
import request, { Response } from '~/api/request'; import request, { Response } from '~/api/request'
export interface ListPageJobInfoParams { export interface ListPageJobInfoParams {
pageNo:number, pageNo: number
pageSize:number, pageSize: number
appTypeId?:number, appTypeId?: number
industryId?:number, industryId?: number
inspectionName?:string, inspectionName?: string
string?:number, string?: number
regionId?:number, regionId?: number
} }
export interface Job { export interface Job {
id:number, id: number
serviceName:string, serviceName: string
teamName:string, teamName: string
price:number, price: number
} }
export interface ListPageJobInfoResp { export interface ListPageJobInfoResp {
pageNo: 1, pageNo: 1
pageSize: 10, pageSize: 10
list: Array<Job>, list: Array<Job>
totalCount: 0, totalCount: 0
totalPage: 0 totalPage: 0
} }
export default { export default {
//web-作业服务-分页 //web-作业服务-分页
listPageJobServicesInfo: (params: ListPageJobInfoParams,option:{}): Promise<Response<ListPageJobInfoResp>> => { listPageJobServicesInfo: (
return request('/release/work/queryTaskServiceList', 'post', params,option) params: ListPageJobInfoParams,
option: {}
): Promise<Response<ListPageJobInfoResp>> => {
return request(
'/pms/backstage/work/queryWorkServiceList',
'post',
params,
option
)
}, },
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import { ...@@ -11,6 +11,7 @@ import {
DatePicker, DatePicker,
Image as AImage, Image as AImage,
Input, Input,
Cascader,
} from 'antd' } from 'antd'
import { RangePickerProps } from 'antd/es/date-picker' import { RangePickerProps } from 'antd/es/date-picker'
import type { TabsProps } from 'antd' import type { TabsProps } from 'antd'
...@@ -18,6 +19,8 @@ import Evaluate from './components/evaluate' ...@@ -18,6 +19,8 @@ import Evaluate from './components/evaluate'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import api, { ListPageJobInfoResp } from './api' import api, { ListPageJobInfoResp } from './api'
import Image from 'next/image' import Image from 'next/image'
import { RegionResp } from '~/components/filter/api'
import AddressMap from './components/map'
const { RangePicker } = DatePicker const { RangePicker } = DatePicker
const { TextArea } = Input const { TextArea } = Input
export default function JobServicesDetail() { export default function JobServicesDetail() {
...@@ -38,18 +41,19 @@ export default function JobServicesDetail() { ...@@ -38,18 +41,19 @@ export default function JobServicesDetail() {
children: ( children: (
<div className="teamIntroduction"> <div className="teamIntroduction">
{/* <Image width={1100} height={800} src={detail?.teamPoster ? detail?.teamPoster : ''} alt='error'/> */} {/* <Image width={1100} height={800} src={detail?.teamPoster ? detail?.teamPoster : ''} alt='error'/> */}
<img {/* <img
style={{ width: '100%' }} style={{ width: '100%' }}
src={detail?.teamPoster ? detail?.teamPoster : ''} src={detail?.teamPoster ? detail?.teamPoster : ''}
alt="error" alt="error"
/> /> */}
{detail?.serviceIntroduction}
</div> </div>
), ),
}, },
{ {
key: '2', key: '2',
label: `团队评价`, label: `团队评价`,
children: <Evaluate evaluateInfo={detail?.evaluateInfo || []} />, children: <Evaluate evaluateInfo={detail?.inspComtList || []} />,
}, },
] ]
...@@ -75,34 +79,60 @@ export default function JobServicesDetail() { ...@@ -75,34 +79,60 @@ export default function JobServicesDetail() {
const [isModalOpen, setIsModalOpen] = useState(false) const [isModalOpen, setIsModalOpen] = useState(false)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [areaValue, setAreaValue] = useState<string>() const [areaValue, setAreaValue] = useState<string>()
const [provinceList, setProvinceList] = useState<RegionResp[]>([])
const [isAddressMapShow, setIsAddressMapShow] = useState(false)
const [addressContent, setAddressContent] = useState<any>()
useEffect(() => {
api.region().then((res) => {
console.log(res)
console.log(res?.result?.map((item) => item.childInfo).flat())
setProvinceList(res?.result || [])
})
}, [])
const disabledDate: RangePickerProps['disabledDate'] = (current) => { const disabledDate: RangePickerProps['disabledDate'] = (current) => {
return current && current < moment().endOf('day') return current && current < moment().endOf('day')
} }
useEffect(() => {
//选择地点后重新验证
formDate.setFieldValue('latitudeAndLongitude', addressContent)
formDate.validateFields()
}, [addressContent])
const handleOk = () => { const handleOk = () => {
setLoading(true) setLoading(true)
formDate formDate
.validateFields() .validateFields()
.then(async (values) => { .then(async (values) => {
console.log(values) console.log(values)
if (!addressContent) {
return message.warning('请选择地点')
}
const res = await api.insertOrderTask({ const res = await api.insertOrderTask({
address: '西丽街道', address: values.address,
city: '深圳', city: addressContent.city,
inspectionId: 1, inspectionId: detail?.id || 1,
lat: 30, lat: addressContent.lat,
lon: 120, lon: addressContent.lon,
province: '广东', province: addressContent.province,
startTime: moment(new Date(values.dateDetail[0])).format( startTime: moment(new Date(values.dateDetail[0])).format(
'YYYY-MM-DD HH-MM-SS' 'YYYY-MM-DD HH:MM:SS'
), ),
endTime: moment(new Date(values.dateDetail[1])).format( endTime: moment(new Date(values.dateDetail[1])).format(
'YYYY-MM-DD HH-MM-SS' 'YYYY-MM-DD HH:MM:SS'
), ),
}) })
console.log(res) console.log(res)
// formDate.resetFields() if (res.code === '200') {
// setLoading(false) message.success('提交成功')
// setIsModalOpen(false) formDate.resetFields()
setAddressContent(undefined)
setLoading(false)
setIsModalOpen(false)
} else {
message.error(res.message)
setLoading(false)
}
}) })
.catch((err) => { .catch((err) => {
message message
...@@ -117,15 +147,6 @@ export default function JobServicesDetail() { ...@@ -117,15 +147,6 @@ export default function JobServicesDetail() {
setIsModalOpen(false) setIsModalOpen(false)
formDate.resetFields() formDate.resetFields()
} }
const onchanges = (values: any) => {
if (values) {
const day = new Date(values[1]).getTime() - new Date(values[0]).getTime()
const totalDays = Math.floor(day / (1000 * 3600 * 24))
// setDays(totalDays)
} else {
// setDays(undefined)
}
}
return ( return (
<Layout> <Layout>
...@@ -134,7 +155,7 @@ export default function JobServicesDetail() { ...@@ -134,7 +155,7 @@ export default function JobServicesDetail() {
<div className="top-image"> <div className="top-image">
<Image <Image
fill fill
src={detail?.pictureUrl ? detail?.pictureUrl : ''} src={detail?.coverPlan ? detail?.coverPlan : ''}
alt="error" alt="error"
/> />
</div> </div>
...@@ -199,7 +220,7 @@ export default function JobServicesDetail() { ...@@ -199,7 +220,7 @@ export default function JobServicesDetail() {
<div className="left"> <div className="left">
<AImage <AImage
preview={{ visible: false }} preview={{ visible: false }}
src={detail?.pictureUrl ? detail?.pictureUrl : ''} src={detail?.coverPlan ? detail?.coverPlan : ''}
onClick={() => setVisible(true)} onClick={() => setVisible(true)}
style={{ width: 58, height: 58 }} style={{ width: 58, height: 58 }}
/> />
...@@ -210,7 +231,7 @@ export default function JobServicesDetail() { ...@@ -210,7 +231,7 @@ export default function JobServicesDetail() {
onVisibleChange: (vis) => setVisible(vis), onVisibleChange: (vis) => setVisible(vis),
}} }}
> >
<AImage src={detail?.pictureUrl ? detail?.pictureUrl : ''} /> <AImage src={detail?.coverPlan ? detail?.coverPlan : ''} />
</AImage.PreviewGroup> </AImage.PreviewGroup>
</div> </div>
</div> </div>
...@@ -224,6 +245,7 @@ export default function JobServicesDetail() { ...@@ -224,6 +245,7 @@ export default function JobServicesDetail() {
className="form-data" className="form-data"
> >
<Form.Item <Form.Item
label="选择日期"
style={{ flex: 1, marginRight: 16 }} style={{ flex: 1, marginRight: 16 }}
name="dateDetail" name="dateDetail"
rules={[{ required: true, message: '请选择日期' }]} rules={[{ required: true, message: '请选择日期' }]}
...@@ -231,10 +253,75 @@ export default function JobServicesDetail() { ...@@ -231,10 +253,75 @@ export default function JobServicesDetail() {
<RangePicker <RangePicker
style={{ width: 376, marginTop: 10 }} style={{ width: 376, marginTop: 10 }}
disabledDate={disabledDate} disabledDate={disabledDate}
onChange={onchanges}
showTime showTime
/> />
</Form.Item> </Form.Item>
{/* <Form.Item
label="经度"
style={{ flex: 1, marginRight: 16 }}
name="lon"
rules={[{ required: true, message: '请输入经度' }]}
>
<Input placeholder="请输入经度" />
</Form.Item>
<Form.Item
label="纬度"
style={{ flex: 1, marginRight: 16 }}
name="lat"
rules={[{ required: true, message: '请输入纬度' }]}
>
<Input placeholder="请输入纬度" />
</Form.Item>
<Form.Item
label="选择省市"
style={{ flex: 1, marginRight: 16 }}
name="province"
rules={[{ required: true, message: '请选择省市' }]}
>
<Cascader
allowClear
placeholder="选择省市"
className="selectItem"
size="large"
fieldNames={{
label: 'name',
value: 'name',
children: 'childInfo',
}}
options={provinceList}
changeOnSelect
/>
</Form.Item> */}
<Form.Item
label="选择地点"
style={{ flex: 1, marginRight: 16 }}
name="latitudeAndLongitude"
rules={[{ required: true, message: '请选择地点' }]}
>
{addressContent ? (
<div>
已选择:{addressContent.province + addressContent.city}
</div>
) : (
<Button onClick={() => setIsAddressMapShow(true)} type="text">
点击从地图选择地点
</Button>
)}
</Form.Item>
<Form.Item
label="详细地址"
style={{ flex: 1, marginRight: 16 }}
name="address"
rules={[{ required: true, message: '请输入详情地址' }]}
>
<TextArea
value={areaValue}
onChange={(e) => setAreaValue(e.target.value)}
placeholder="请输入详情地址"
autoSize={{ minRows: 3, maxRows: 5 }}
style={{ width: 385, height: 72 }}
/>
</Form.Item>
<div> <div>
任务描述(选填) 项目号、 业务负责人、 任务描述(选填) 项目号、 业务负责人、
客户名称、演示设备(注明飞机、挂载、地面站)、现场联系人及电话 客户名称、演示设备(注明飞机、挂载、地面站)、现场联系人及电话
...@@ -253,6 +340,26 @@ export default function JobServicesDetail() { ...@@ -253,6 +340,26 @@ export default function JobServicesDetail() {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
{isAddressMapShow ? (
<Modal
wrapClassName="reservation"
open={isAddressMapShow}
onCancel={() => setIsAddressMapShow(false)}
getContainer={false}
maskClosable={false}
width={850}
footer={false}
>
<div style={{ textAlign: 'center', fontWeight: '700' }}>
选择地点
</div>
<AddressMap
setAddressContent={setAddressContent}
setIsAddressMapShow={setIsAddressMapShow}
/>
</Modal>
) : null}
</Box> </Box>
</Layout> </Layout>
) )
......
import request, { Response } from '~/api/request' import request, { Response } from '~/api/request'
import { RegionResp } from '~/components/filter/api'
export interface ListPageJobInfoParams { export interface ListPageJobInfoParams {
pageNo: number pageNo: number
pageSize: number pageSize: number
...@@ -30,6 +30,9 @@ export interface ListPageJobInfoResp { ...@@ -30,6 +30,9 @@ export interface ListPageJobInfoResp {
teamPoster: string teamPoster: string
evaluateInfo: Array<JobDetail> evaluateInfo: Array<JobDetail>
item: number item: number
coverPlan: string
serviceIntroduction: string
inspComtList: []
} }
export interface GetJobServicesDetailParams { export interface GetJobServicesDetailParams {
...@@ -53,10 +56,14 @@ export default { ...@@ -53,10 +56,14 @@ export default {
listDetailJobServicesInfo: ( listDetailJobServicesInfo: (
params: GetJobServicesDetailParams params: GetJobServicesDetailParams
): Promise<Response<ListPageJobInfoResp>> => { ): Promise<Response<ListPageJobInfoResp>> => {
return request('/release/work/selectInspection', 'get', params) return request('/pms/backstage/work/queryWorkService', 'get', params)
}, },
//web-作业服务-详情-立即预约 //web-作业服务-详情-立即预约
insertOrderTask: (params: GetOrderTaskParams): Promise<Response<null>> => { insertOrderTask: (params: GetOrderTaskParams): Promise<Response<null>> => {
return request('/oms/serviceOrderTask/insertOrderTask', 'post', params) return request('/oms/serviceOrderTask/insertOrderTask', 'post', params)
}, },
//区域
region: (): Promise<Response<Array<RegionResp>>> => {
return request('/pms/webDevice/getSecondDistrictInfo')
},
} }
import React, {
Component,
Dispatch,
SetStateAction,
useEffect,
useState,
} from 'react'
import { message } from 'antd'
import { Box } from './styled'
import { useRouter } from 'next/router'
let MAP: any
let Amap: any
interface UserInfoType {
lat: number
lon: number
pageNo?: number
pageSize?: number
}
interface BoxProps {
setAddressContent: Dispatch<SetStateAction<any>>
setIsAddressMapShow: Dispatch<SetStateAction<boolean>>
}
export default function MapComponent(props: BoxProps) {
const { setAddressContent, setIsAddressMapShow } = props
const router = useRouter()
const [mapItem, setMapItem] = useState(0)
const [userPositioning, setUserPositioning] = useState<UserInfoType>()
const [markerCol, setMarkerCol] = useState<any>([])
//初始化地图
const init = async () => {
try {
const AMapLoader = await import(
/* webpackChunkName: "amap" */ '@amap/amap-jsapi-loader'
)
await AMapLoader.load({
key: '87b424e68754efc3ba9d11ae07475091', // 申请好的Web端开发者Key,首次调用 load 时必填
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: [''], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
})
.then(async (AMap) => {
Amap = AMap
MAP = new AMap.Map('container', {
// 设置地图容器id
viewMode: '3D', // 是否为3D地图模式
zoom: 9, // 初始化地图级别
center: [113.93029, 22.53291], // 初始化地图中心点位置
})
//用户定位
AMap.plugin('AMap.Geolocation', function () {
const geolocation = new AMap.Geolocation({
enableHighAccuracy: true, //是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:5s
position: 'RB', //定位按钮的停靠位置
offset: [10, 20], //定位按钮与设置的停靠位置的偏移量,默认:[10, 20]
zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点
})
MAP.addControl(geolocation)
geolocation.getCurrentPosition(function (
status: string,
result: any
) {
if (status == 'complete') {
onComplete(result)
} else {
onError(result)
}
})
})
//解析定位结果
async function onComplete(data: any) {
console.log('定位成功')
setUserPositioning(data.position)
// return await mapEntiy(0,data.position);
}
//解析定位错误信息
async function onError(data: any) {
// message.error(`定位失败
// 失败原因排查信息:${data.message}
// 浏览器返回信息:${data.originMessage}
// `)
}
await mapEntiy(0)
})
.catch((e) => {
console.log(e)
})
} catch (error) {
console.log(error)
}
}
//选择点位
const mapEntiy = async (index: number, data?: UserInfoType) => {
MAP.on('click', mapGet)
setMapItem(index)
}
const mapGet = (e: any) => {
console.log(e)
// 在这里获取点位信息
const lnglat = e.lnglat
console.log(lnglat)
const geocoder = new Amap.Geocoder({
radius: 1000,
extensions: 'all',
})
geocoder.getAddress(lnglat, function (status: any, result: any) {
if (status === 'complete' && result.regeocode) {
const address = result.regeocode.addressComponent
console.log(address.province)
console.log(address.city)
setAddressContent({
province: address.province,
city: address.city,
lon: lnglat.lng,
lat: lnglat.lat,
})
setIsAddressMapShow(false)
// console.log(address.province + address.city + address.district) // 打印省市区信息
}
})
// MAP.off('click', mapGet); // 移除click事件
}
const addEntiy = (lon: any, lat: any, name: string) => {
if (!Amap) return
const icons = new Amap.Icon({
size: new Amap.Size(60, 60), // 图标尺寸
imageSize: new Amap.Size(60, 60), // 根据所设置的大小拉伸或压缩图片
})
const marker = new Amap.Marker({
position: new Amap.LngLat(lon, lat),
offset: new Amap.Pixel(-10, -10),
icon: icons, // 添加 Icon 实例
title: name,
zoom: 13,
})
return marker
}
useEffect(() => {
;(async () => {
await init()
})()
return MAP && MAP.destroy()
}, [])
return (
<Box className="right-box-item">
<div id="container" className="map"></div>
</Box>
)
}
import styled from 'styled-components'
export default function Style() {
return <></>
}
export const Box = styled.div`
box-sizing: border-box;
width: 800px;
height: 800px;
#container {
position: relative;
padding: 0px;
margin: 0px;
width: 100%;
height: 800px;
}
.amap-logo {
//去除高德地图水印
display: none !important;
visibility: hidden !important;
}
.amap-copyright {
//去除高德地图水印
display: none !important;
visibility: hidden !important;
}
`
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论