修复已知问题
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"miniprogramRoot": "dist/",
|
"miniprogramRoot": "dist/",
|
||||||
"projectname": "websoft",
|
"projectname": "websoft",
|
||||||
"description": "网宿软件",
|
"description": "网宿软件",
|
||||||
"appid": "wx541db955e7a62709",
|
"appid": "wxd2723d1afd9c4553",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": true,
|
"urlCheck": true,
|
||||||
"es6": false,
|
"es6": false,
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {useRouter} from '@tarojs/taro'
|
import Taro, {useRouter} from '@tarojs/taro'
|
||||||
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
|
import {getHjmCar, pageHjmCar, updateHjmCar} from "@/api/hjm/hjmCar";
|
||||||
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
||||||
import {Image,Cell} from '@nutui/nutui-react-taro'
|
|
||||||
import './location.scss'
|
import './location.scss'
|
||||||
import {copyText} from "@/utils/common";
|
import {copyText} from "@/utils/common";
|
||||||
|
import {View} from '@tarojs/components'
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Radio,
|
||||||
|
Cell,
|
||||||
|
Image
|
||||||
|
} from '@nutui/nutui-react-taro'
|
||||||
|
import {Scan} from '@nutui/icons-react-taro'
|
||||||
|
import {pageDictData} from "@/api/system/dict-data";
|
||||||
|
import {DictData} from "@/api/system/dict-data/model";
|
||||||
|
import {TenantId} from "@/utils/config";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章终极列表
|
* 文章终极列表
|
||||||
@@ -14,6 +26,166 @@ const Query = () => {
|
|||||||
const {params} = useRouter();
|
const {params} = useRouter();
|
||||||
const [keywords, setKeywords] = useState<string>()
|
const [keywords, setKeywords] = useState<string>()
|
||||||
const [item, setItem] = useState<HjmCar>()
|
const [item, setItem] = useState<HjmCar>()
|
||||||
|
const [dict, setDict] = useState<DictData[]>([])
|
||||||
|
|
||||||
|
const [FormData, setFormData] = useState<HjmCar>(
|
||||||
|
{
|
||||||
|
// 自增ID
|
||||||
|
id: undefined,
|
||||||
|
// 车辆名称
|
||||||
|
name: undefined,
|
||||||
|
// 车辆图片
|
||||||
|
image: undefined,
|
||||||
|
// 类型 0汽车 1其他车
|
||||||
|
type: undefined,
|
||||||
|
// 快递公司
|
||||||
|
kuaidi: undefined,
|
||||||
|
// 管理负责人
|
||||||
|
kuaidiAdmin: undefined,
|
||||||
|
organization: undefined,
|
||||||
|
organizationParentId: undefined,
|
||||||
|
parentOrganization: undefined,
|
||||||
|
parentOrganizationAdmin: undefined,
|
||||||
|
// 车辆编号
|
||||||
|
code: undefined,
|
||||||
|
// 操作员
|
||||||
|
driver: undefined,
|
||||||
|
// 保险状态
|
||||||
|
insuranceStatus: undefined,
|
||||||
|
// GPS设备编号
|
||||||
|
gpsNo: undefined,
|
||||||
|
// 电子围栏
|
||||||
|
fence: undefined,
|
||||||
|
// 位置
|
||||||
|
location: undefined,
|
||||||
|
// 经度
|
||||||
|
longitude: undefined,
|
||||||
|
// 纬度
|
||||||
|
latitude: undefined,
|
||||||
|
// 地址
|
||||||
|
address: undefined,
|
||||||
|
// 用户ID
|
||||||
|
userId: undefined,
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sortNumber: undefined,
|
||||||
|
// 备注
|
||||||
|
comments: undefined,
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status: undefined,
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted: undefined,
|
||||||
|
// 租户id
|
||||||
|
tenantId: undefined,
|
||||||
|
// 创建时间
|
||||||
|
createTime: undefined,
|
||||||
|
// 更新时间
|
||||||
|
updateTime: undefined,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
const submitSucceed = (values: any) => {
|
||||||
|
updateHjmCar({...values, ...FormData, status: 1}).then(() => {
|
||||||
|
Taro.showToast({title: `保存成功`, icon: 'success'})
|
||||||
|
setTimeout(() => {
|
||||||
|
return Taro.navigateBack()
|
||||||
|
}, 1000)
|
||||||
|
}).catch(() => {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '保存失败',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const submitFailed = (error: any) => {
|
||||||
|
console.log(error, 'err...')
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveGpsNo = () => {
|
||||||
|
Taro.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
scanType: ['barCode', 'qrCode'],
|
||||||
|
success: (res) => {
|
||||||
|
// 更新表单数据
|
||||||
|
setFormData({
|
||||||
|
...FormData,
|
||||||
|
gpsNo: res.result
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: '扫码成功' + res.result,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('扫码失败', err);
|
||||||
|
Taro.showToast({
|
||||||
|
title: '扫码失败',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拍照上传功能
|
||||||
|
const takePhoto = () => {
|
||||||
|
Taro.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sizeType: ['compressed'],
|
||||||
|
sourceType: ['camera'], // 只允许拍照
|
||||||
|
success: async (res) => {
|
||||||
|
const tempFilePath = res.tempFilePaths[0];
|
||||||
|
console.log(tempFilePath, 'tempFilePath')
|
||||||
|
// 上传图片到OSS
|
||||||
|
Taro.uploadFile({
|
||||||
|
url: 'https://server.gxwebsoft.com/api/oss/upload',
|
||||||
|
filePath: tempFilePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
TenantId
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
const data = JSON.parse(res.data);
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
console.log(data.data.url, '1url.....')
|
||||||
|
updateHjmCar({
|
||||||
|
id: FormData.id,
|
||||||
|
image: data.data.downloadUrl + '?x-oss-process=image/resize,w_750/quality,Q_90'
|
||||||
|
}).then(() => {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '上传成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
setFormData({...FormData,image: data.data.downloadUrl + '?x-oss-process=image/resize,w_750/quality,Q_90'})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('拍照失败', err);
|
||||||
|
Taro.showToast({
|
||||||
|
title: '拍照失败',
|
||||||
|
icon: 'error',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除图片
|
||||||
|
// const removeImage = (index: number) => {
|
||||||
|
// const newImages = uploadedImages.filter((_, i) => i !== index);
|
||||||
|
// setUploadedImages(newImages);
|
||||||
|
// setFormData({
|
||||||
|
// ...FormData,
|
||||||
|
// image: newImages.join(',')
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
// 打开地图选择位置
|
// 打开地图选择位置
|
||||||
// const chooseLocation = async () => {
|
// const chooseLocation = async () => {
|
||||||
@@ -29,6 +201,10 @@ const Query = () => {
|
|||||||
// }
|
// }
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
const id = Number(params.id);
|
const id = Number(params.id);
|
||||||
|
// 获取数据字典
|
||||||
|
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
|
||||||
|
setDict(res?.list || [])
|
||||||
|
})
|
||||||
// 执行搜索
|
// 执行搜索
|
||||||
if (keywords) {
|
if (keywords) {
|
||||||
pageHjmCar({keywords}).then(res => {
|
pageHjmCar({keywords}).then(res => {
|
||||||
@@ -45,6 +221,21 @@ const Query = () => {
|
|||||||
getHjmCar(id).then(data => {
|
getHjmCar(id).then(data => {
|
||||||
setItem(data)
|
setItem(data)
|
||||||
setKeywords(data.code)
|
setKeywords(data.code)
|
||||||
|
setFormData(data)
|
||||||
|
|
||||||
|
// 初始化已上传的图片
|
||||||
|
// if (data.image) {
|
||||||
|
// const images = data.image.split(',').filter(img => img.trim());
|
||||||
|
// setUploadedImages(images);
|
||||||
|
// }
|
||||||
|
|
||||||
|
console.log(data.status, '1213')
|
||||||
|
if (data.status == 0) {
|
||||||
|
Taro.setNavigationBarTitle({
|
||||||
|
title: '安装设备'
|
||||||
|
})
|
||||||
|
setFormData({...data, driver: Taro.getStorageSync('RealName')})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,62 +247,158 @@ const Query = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/*<div className={'fixed z-20 top-5 left-0 w-full'}>*/}
|
|
||||||
{/* <div className={'px-4'}>*/}
|
{/* 未安装 */}
|
||||||
{/* <div*/}
|
{item?.status == 0 ? (
|
||||||
{/* style={{*/}
|
<div className={'car-info w-full bg-white'}>
|
||||||
{/* display: 'flex',*/}
|
<div className={'px-0'}>
|
||||||
{/* alignItems: 'center',*/}
|
<Form
|
||||||
{/* background: '#fff',*/}
|
divider
|
||||||
{/* padding: '0 10px',*/}
|
initialValues={FormData}
|
||||||
{/* borderRadius: '20px'*/}
|
labelPosition="left"
|
||||||
{/* }}*/}
|
onFinish={(values) => submitSucceed(values)}
|
||||||
{/* >*/}
|
onFinishFailed={(errors) => submitFailed(errors)}
|
||||||
{/* <Search/>*/}
|
footer={
|
||||||
{/* <Input*/}
|
<div
|
||||||
{/* placeholder="车辆编号"*/}
|
style={{
|
||||||
{/* value={keywords}*/}
|
display: 'flex',
|
||||||
{/* onChange={onKeywords}*/}
|
justifyContent: 'center',
|
||||||
{/* />*/}
|
width: '100%'
|
||||||
{/* <div*/}
|
}}
|
||||||
{/* className={'flex items-center'}*/}
|
>
|
||||||
{/* >*/}
|
<Button nativeType="submit" block type="info">
|
||||||
{/* <Button type="warning" onClick={reload}>*/}
|
提交
|
||||||
{/* 查询*/}
|
</Button>
|
||||||
{/* </Button>*/}
|
</div>
|
||||||
{/* </div>*/}
|
}
|
||||||
{/* </div>*/}
|
>
|
||||||
{/* </div>*/}
|
<Form.Item
|
||||||
{/*</div>*/}
|
label={'车辆编号'}
|
||||||
{item ? (
|
name="code"
|
||||||
|
rules={[{message: '请输入车辆编号'}]}
|
||||||
|
>
|
||||||
|
<View onClick={() => copyText(`${item?.code}`)}>{item?.code}</View>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'快递公司品牌'}
|
||||||
|
name="parentOrganization"
|
||||||
|
rules={[{message: '快递公司品牌'}]}
|
||||||
|
>
|
||||||
|
<Input placeholder="快递公司品牌" disabled type="text"/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'管理责任人'}
|
||||||
|
name="parentOrganizationAdmin"
|
||||||
|
rules={[{message: '管理责任人'}]}
|
||||||
|
>
|
||||||
|
<Input placeholder="管理责任人" disabled type="text"/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'电子围栏'}
|
||||||
|
name="fence"
|
||||||
|
rules={[{message: '电子围栏'}]}
|
||||||
|
>
|
||||||
|
<Input placeholder="电子围栏" type="text"/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="保险状态"
|
||||||
|
name="insuranceStatus"
|
||||||
|
rules={[
|
||||||
|
{message: '保险状态'}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Radio.Group value={FormData.insuranceStatus} disabled direction="horizontal">
|
||||||
|
{
|
||||||
|
dict?.map((item, index) => (
|
||||||
|
<Radio key={index} value={item.dictDataCode}>
|
||||||
|
{item.dictDataName}
|
||||||
|
</Radio>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'GPS编号'}
|
||||||
|
name="gpsNo"
|
||||||
|
rules={[{message: 'GPS编号'}]}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
background: '#fff',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder="请填入GPS设备编号"
|
||||||
|
value={FormData.gpsNo}
|
||||||
|
onChange={(value) => setFormData({...FormData, gpsNo: value})}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="right"
|
||||||
|
style={{display: 'flex', alignItems: 'center'}}
|
||||||
|
>
|
||||||
|
<Scan onClick={saveGpsNo}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'拍照上传'}
|
||||||
|
name="image"
|
||||||
|
rules={[{message: '请上传照片'}]}
|
||||||
|
onClick={takePhoto}
|
||||||
|
>
|
||||||
|
<div style={{display: 'flex', flexDirection: 'column', gap: '10px'}}>
|
||||||
|
<Image src={FormData.image} mode={'scaleToFill'}
|
||||||
|
radius="10%" width="80" height="80"/>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'操作员'}
|
||||||
|
name="driver"
|
||||||
|
rules={[{message: '操作员'}]}
|
||||||
|
>
|
||||||
|
<Input placeholder="操作员" type="text"/>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : ''}
|
||||||
|
|
||||||
|
{/* 已安装 */}
|
||||||
|
{item?.status == 1 ? (
|
||||||
<div className={'car-info w-full bg-white'}>
|
<div className={'car-info w-full bg-white'}>
|
||||||
<Image src={item?.image} mode={'aspectFit'} width={'100%'} height={'300px'}/>
|
<Image src={item?.image} mode={'aspectFit'} width={'100%'} height={'300px'}/>
|
||||||
<div className={'px-2'}>
|
<div className={'px-2'}>
|
||||||
<Cell className={'car-info-item-title'} onClick={() => copyText(`${item?.code}`)}>
|
<Cell className={'car-info-item-title'} onClick={() => copyText(`${item?.code}`)}>
|
||||||
车辆编号:{item?.code}
|
车辆编号:{item?.code}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-title'}>
|
<Cell className={'car-info-item-title'}>
|
||||||
快递公司:{item?.parentOrganization}
|
快递公司品牌:{item?.parentOrganization}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-title'}>
|
<Cell className={'car-info-item-title'}>
|
||||||
管理负责人:{item?.parentOrganizationAdmin}
|
管理责任人:{item?.parentOrganizationAdmin}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
操作员:{item?.driver}
|
操作员:{item?.driver}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
保险状态:{item?.insuranceStatus}
|
保险状态:{item?.insuranceStatus}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
GPS编号:{item?.gpsNo}
|
GPS编号:{item?.gpsNo}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
电子围栏:{item?.fence}
|
电子围栏:{item?.fence}
|
||||||
</Cell>
|
</Cell>
|
||||||
|
{/*<Cell className={'car-info-item-content'}>*/}
|
||||||
|
{/* 状态:{item?.status == 1 ? '已安装' : '未安装'}*/}
|
||||||
|
{/*</Cell>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : ''}
|
) : ''}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// @ts-ignore
|
||||||
export default Query
|
export default Query
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const Index = () => {
|
|||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
// 获取车辆列表
|
// 获取车辆列表
|
||||||
pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => {
|
pageHjmCar({}).then(res => {
|
||||||
setList(res?.list || [])
|
setList(res?.list || [])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ export function saveStorageByLoginUser(token: string, user: User) {
|
|||||||
Taro.setStorageSync('access_token', token)
|
Taro.setStorageSync('access_token', token)
|
||||||
Taro.setStorageSync('UserId', user.userId)
|
Taro.setStorageSync('UserId', user.userId)
|
||||||
Taro.setStorageSync('Phone', user.phone)
|
Taro.setStorageSync('Phone', user.phone)
|
||||||
|
Taro.setStorageSync('RealName', user.realName)
|
||||||
Taro.setStorageSync('User', user)
|
Taro.setStorageSync('User', user)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user