修复已知问题

This commit is contained in:
2025-06-27 18:58:07 +08:00
parent ea506483a1
commit 78bc420fb8
9 changed files with 124 additions and 69 deletions

File diff suppressed because one or more lines are too long

View File

@@ -26,6 +26,8 @@ export interface HjmCar {
code?: string; code?: string;
// 安装人员ID // 安装人员ID
installerId?: number; installerId?: number;
// 安装时间
installTime?: string;
// 操作员ID // 操作员ID
driverId?: number; driverId?: number;
// 操作员 // 操作员
@@ -56,6 +58,8 @@ export interface HjmCar {
userId?: number; userId?: number;
// 认领状态 // 认领状态
claim?: number; claim?: number;
// 认领时间
claimTime?: string;
// 排序(数字越小越靠前) // 排序(数字越小越靠前)
sortNumber?: number; sortNumber?: number;
// 备注 // 备注

View File

@@ -21,6 +21,7 @@ import {DictData} from "@/api/system/dict-data/model";
import {myUserVerify} from "@/api/system/userVerify"; import {myUserVerify} from "@/api/system/userVerify";
import {listUserRole} from "@/api/system/userRole"; import {listUserRole} from "@/api/system/userRole";
import {TenantId} from "@/utils/config"; import {TenantId} from "@/utils/config";
import {getCurrentDate} from "@/utils/time";
// 图片数据接口 // 图片数据接口
interface UploadedImageData { interface UploadedImageData {
@@ -129,7 +130,8 @@ const Query = () => {
updateHjmCar({ updateHjmCar({
...FormData, ...FormData,
status: 1, status: 1,
installerId: Taro.getStorageSync('UserId') installerId: Taro.getStorageSync('UserId'),
installTime: getCurrentDate(),
}).then(() => { }).then(() => {
Taro.showToast({title: `安装成功`, icon: 'success'}) Taro.showToast({title: `安装成功`, icon: 'success'})
setTimeout(() => { setTimeout(() => {
@@ -324,6 +326,7 @@ const Query = () => {
updateHjmCar({ updateHjmCar({
...FormData, ...FormData,
claim: 1, claim: 1,
claimTime: getCurrentDate(),
driverId: Taro.getStorageSync('UserId'), driverId: Taro.getStorageSync('UserId'),
driverName: Taro.getStorageSync('RealName') driverName: Taro.getStorageSync('RealName')
}).then(() => { }).then(() => {
@@ -383,6 +386,11 @@ const Query = () => {
if (code) { if (code) {
const carInfo = await getHjmCarByCode(code); const carInfo = await getHjmCarByCode(code);
if (carInfo) { if (carInfo) {
// updateHjmCar({
// ...carInfo,
// claimTime: getCurrentDate(),
// installTime: getCurrentDate()
// })
// 赋值车辆信息 // 赋值车辆信息
setFormData(carInfo) setFormData(carInfo)
setKeywords(carInfo.code) setKeywords(carInfo.code)

View File

@@ -5,7 +5,8 @@ import {
Button, Button,
Input, Input,
Tag, Tag,
Space Space,
Pagination
} from '@nutui/nutui-react-taro' } from '@nutui/nutui-react-taro'
import {Search, Calendar, Truck, File, AddCircle} from '@nutui/icons-react-taro' import {Search, Calendar, Truck, File, AddCircle} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
@@ -21,6 +22,10 @@ const List: React.FC = () => {
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const [keywords, setKeywords] = useState<string>('') const [keywords, setKeywords] = useState<string>('')
const [refreshing, setRefreshing] = useState<boolean>(false) const [refreshing, setRefreshing] = useState<boolean>(false)
const [page, setPage] = useState<number>(1)
const [limit, setLimit] = useState<number>(10)
const [total, setTotal] = useState<number>(0)
console.log(refreshing) console.log(refreshing)
// 获取状态显示 // 获取状态显示
const getStatusDisplay = (status?: number) => { const getStatusDisplay = (status?: number) => {
@@ -37,19 +42,22 @@ const List: React.FC = () => {
} }
const reload = async (showLoading = true) => { const reload = async (showLoading = true) => {
setLimit(10)
try { try {
if (showLoading) setLoading(true) if (showLoading) setLoading(true)
setRefreshing(true) setRefreshing(true)
const where = { const where: any = {
keywords: keywords.trim(), keywords: keywords.trim(),
page,
limit,
} }
const roleCode = Taro.getStorageSync('RoleCode'); const roleCode = Taro.getStorageSync('RoleCode');
if(roleCode == 'kuaidi'){ if(roleCode == 'kuaidi'){
if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){ if(Taro.getStorageSync('OrganizationParentId') == 0){
// @ts-ignore // @ts-ignore
where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); where.organizationParentId = Taro.getStorageSync('OrganizationId');
}else { }else {
// @ts-ignore // @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId'); where.organizationId = Taro.getStorageSync('OrganizationId');
@@ -58,6 +66,7 @@ const List: React.FC = () => {
const res = await pageHjmViolation(where) const res = await pageHjmViolation(where)
setList(res?.list || []) setList(res?.list || [])
setTotal(res?.count || 0)
} catch (error) { } catch (error) {
console.error('获取报险记录失败:', error) console.error('获取报险记录失败:', error)
Taro.showToast({ Taro.showToast({
@@ -86,7 +95,11 @@ const List: React.FC = () => {
useEffect(() => { useEffect(() => {
reload().then() reload().then()
}, []) }, [page, limit])
const onPageChange = (current: number) => {
setPage(current)
}
return ( return (
<> <>
@@ -149,9 +162,6 @@ const List: React.FC = () => {
</div> </div>
) : list.length === 0 ? ( ) : list.length === 0 ? (
<Empty description="暂无报险记录"> <Empty description="暂无报险记录">
<Button type="primary" onClick={onAddInsurance}>
</Button>
</Empty> </Empty>
) : ( ) : (
<div style={{padding: '0 16px'}}> <div style={{padding: '0 16px'}}>
@@ -275,6 +285,23 @@ const List: React.FC = () => {
</div> </div>
) )
} }
{/* 分页 */}
{list.length > 0 && (
<div style={{
display: 'flex',
justifyContent: 'center',
padding: '20px 0',
backgroundColor: '#f5f5f5'
}}>
<Pagination
value={page}
total={total}
pageSize={limit}
onChange={onPageChange}
/>
</div>
)}
</> </>
) )
} }

View File

@@ -29,7 +29,7 @@ const Header = (props: any) => {
setStatusBarHeight(res.statusBarHeight) setStatusBarHeight(res.statusBarHeight)
}, },
}) })
getUserInfo().then((data) => { getUserInfo().then( async (data) => {
if (data) { if (data) {
console.log(data.organizationName,'0000') console.log(data.organizationName,'0000')
setIsLogin(true); setIsLogin(true);
@@ -38,7 +38,7 @@ const Header = (props: any) => {
// 机构ID // 机构ID
Taro.setStorageSync('OrganizationId',data.organizationId) Taro.setStorageSync('OrganizationId',data.organizationId)
// 父级机构ID // 父级机构ID
getOrganization(Number(data.organizationId)).then(res => { await getOrganization(Number(data.organizationId)).then(res => {
Taro.setStorageSync('OrganizationParentId',res.parentId) Taro.setStorageSync('OrganizationParentId',res.parentId)
}) })
// 所属站点名称 // 所属站点名称

View File

@@ -75,6 +75,22 @@ const UserCell = () => {
}} }}
/> />
</Cell.Group> </Cell.Group>
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Truck size={16}/>
<span className={'pl-3 text-sm'}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/hjm/violation/list', true)
}}
/>
</Cell.Group>
</> </>
) )
} }
@@ -137,48 +153,6 @@ const UserCell = () => {
) )
} }
{
roleName === 'youzheng' && (
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Truck size={16}/>
<span className={'pl-3 text-sm'}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/hjm/violation/list', true)
}}
/>
</Cell.Group>
)
}
{
roleName === 'kuaidi' && (
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Truck size={16}/>
<span className={'pl-3 text-sm'}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/hjm/violation/list', true)
}}
/>
</Cell.Group>
)
}
{/*<Cell.Group divider={true} description={*/} {/*<Cell.Group divider={true} description={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/} {/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <span style={{marginTop: '12px'}}>管理</span>*/} {/* <span style={{marginTop: '12px'}}>管理</span>*/}

View File

@@ -11,7 +11,7 @@ import {Search, Calendar, Truck, File} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import {UserVerify} from "@/api/system/userVerify/model"; import {UserVerify} from "@/api/system/userVerify/model";
import {pageUserVerify, updateUserVerify} from "@/api/system/userVerify"; import {pageUserVerify, updateUserVerify} from "@/api/system/userVerify";
import {listUserRole, updateUserRole} from "@/api/system/userRole"; import {addUserRole, listUserRole, updateUserRole} from "@/api/system/userRole";
/** /**
@@ -82,19 +82,23 @@ const List: React.FC = () => {
const onPass = async (item: UserVerify) => { const onPass = async (item: UserVerify) => {
const role = await listUserRole({roleId: 1701,userId: item.userId}) const role = await listUserRole({roleId: 1701,userId: item.userId})
const userRole = role[0]; const userRole = role[0];
userRole.roleId = 1738; // 审核通过
updateUserRole(userRole).then(() => {
updateUserVerify({ updateUserVerify({
...item, ...item,
status: 1 status: 1
}).then(() => { }).then(() => {
if(userRole){
updateUserRole({
...userRole,
roleId: 1738
})
}
Taro.showToast({ Taro.showToast({
title: '操作成功', title: '操作成功',
icon: 'success' icon: 'success'
}) })
reload().then() reload().then()
}) })
})
} }
const onReject = async (item: UserVerify) => { const onReject = async (item: UserVerify) => {

View File

@@ -4,7 +4,7 @@ import {BaseUrl, TenantId} from "@/utils/config";
let baseUrl = BaseUrl let baseUrl = BaseUrl
if(process.env.NODE_ENV === 'development'){ if(process.env.NODE_ENV === 'development'){
baseUrl = 'http://localhost:9000/api' // baseUrl = 'http://localhost:9000/api'
} }
export function request<T>(options:any) { export function request<T>(options:any) {
const token = Taro.getStorageSync('access_token'); const token = Taro.getStorageSync('access_token');

View File

@@ -16,7 +16,7 @@ export function formatCurrentDate() {
/** /**
* 获取当前时分秒 * 获取当前时分秒
*/ */
export function formatHhmmss(){ export function formatHhmmss() {
// 创建一个Date对象表示当前日期和时间 // 创建一个Date对象表示当前日期和时间
const now = new Date(); const now = new Date();
// 获取当前的小时 // 获取当前的小时
@@ -37,3 +37,41 @@ export function getCurrentHour() {
const hour = String(now.getHours()).padStart(2, '0'); const hour = String(now.getHours()).padStart(2, '0');
return `${String(Number(hour) - 8).padStart(2, '0')}`; return `${String(Number(hour) - 8).padStart(2, '0')}`;
} }
/**
* 获取当前日期 格式为 yyyy-mm-dd HH:mm:ss
*/
export function getCurrentDate() {
// 创建一个Date对象自动设置为当前日期和时间
const currentDate = new Date();
// 获取年份
const year = currentDate.getFullYear();
// 获取月份注意月份是从0开始计数的
let month = currentDate.getMonth() + 1;
// 获取日期
let day = currentDate.getDate();
// 添加前导零(如果月份或日期是一位数,则添加前导零)
// @ts-ignore
month = (month < 10 ? '0' : '') + month;
// @ts-ignore
day = (day < 10 ? '0' : '') + day;
// 获取当前小时
const hour = currentDate.getHours();
// 获取当前分钟
const minute = currentDate.getMinutes();
// 获取当前秒数
const second = currentDate.getSeconds();
// 构建日期字符串
var formattedDate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
// 输出格式化的日期
console.log(formattedDate);
return formattedDate;
}