完成:黄家明项目的开发并存档

This commit is contained in:
2025-06-17 23:01:02 +08:00
parent d37e9509c1
commit 26db77ee12
10 changed files with 203 additions and 18 deletions

View File

@@ -43,6 +43,7 @@ const Query = () => {
const [dict, setDict] = useState<DictData[]>([])
const [adminId, setAdminId] = useState<number>()
const [showPreview, setShowPreview] = useState(false)
const [disabled, setDisabled] = useState<boolean>(false)
const [userRole, setUserRole] = useState<UserRole>()
const [fileList, setFileList] = useState<UploadedImageData[]>([]) // 图片文件列表
const [FormData, setFormData] = useState<HjmCar>(
@@ -106,6 +107,10 @@ const Query = () => {
// 提交表单
const submitSucceed = (values: any) => {
// 禁用按钮
if(disabled){
return false;
}
console.log(values)
if(FormData.image == '[]' || !FormData.image){
Taro.showToast({
@@ -129,14 +134,18 @@ const Query = () => {
driverId: adminId,
driverName: Taro.getStorageSync('RealName')
}).then(() => {
userRole.roleId = 1738;
updateUserRole(userRole).then(() => {
Taro.showToast({title: `绑定成功`, icon: 'success'})
})
updateUser({
userId: Taro.getStorageSync('UserId'),
organizationId: FormData.organizationId
}).then(() => {})
Taro.showToast({title: `绑定成功`, icon: 'success'})
// 变更角色
if (Taro.getStorageSync('OrganizationParentId') > 0) {
userRole.roleId = 1738;
updateUserRole(userRole).then(() => {
Taro.showToast({title: `绑定成功`, icon: 'success'})
})
updateUser({
userId: Taro.getStorageSync('UserId'),
organizationId: FormData.organizationId
}).then(() => {})
}
setTimeout(() => {
reload();
return Taro.navigateBack()
@@ -214,7 +223,7 @@ const Query = () => {
}
// 上传单张图片
const uploadSingleImage = (filePath: string, index: number) => {
const uploadSingleImage = (filePath: any, index: number) => {
const TenantId = Taro.getStorageSync('TenantId')
Taro.uploadFile({
@@ -322,6 +331,13 @@ const Query = () => {
// }
// }
const reload = () => {
if (!Taro.getStorageSync('UserId')) {
Taro.showToast({
title: '请先登录',
icon: 'error'
})
return false
}
const code = params.id;
// 获取数据字典
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
@@ -349,6 +365,7 @@ const Query = () => {
}
if(data){
setAdminId(data.userId);
setFormData( {...FormData, driverName: Taro.getStorageSync('RealName')})
}
})
// 获取车辆信息
@@ -384,7 +401,21 @@ const Query = () => {
Taro.setNavigationBarTitle({
title: '安装设备'
})
setFormData({...data, driver: Taro.getStorageSync('RealName')})
setFormData({...data})
}
// 查询名下的车辆数
if(data?.status == 0 && Taro.getStorageSync('OrganizationParentId') != 0){
pageHjmCar({driverId: Taro.getStorageSync('UserId')}).then(res => {
if(res?.count && res?.count > 0){
setDisabled(true)
Taro.showToast({
title: '可绑定数量已达上限',
icon: 'none'
})
return false;
}
})
}
}
})
@@ -427,7 +458,7 @@ const Query = () => {
width: '100%'
}}
>
<Button nativeType="submit" block type="info">
<Button nativeType="submit" block type="info" disabled={disabled}>
</Button>
</div>
@@ -598,7 +629,7 @@ const Query = () => {
<Form.Item
label={'操作员'}
name="driver"
name="driverName"
rules={[{message: '操作员'}]}
>
<Input placeholder="操作员" type="text"/>
@@ -685,6 +716,15 @@ const Query = () => {
}>
</Button>
<Button nativeType="submit" type="default" onClick={
() => {
Taro.navigateTo({
url: `/hjm/gps-log/gps-log?id=${FormData?.gpsNo}`
})
}
}>
</Button>
</div>
</div>
</div>