修复已知问题

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

View File

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

View File

@@ -5,7 +5,8 @@ import {
Button,
Input,
Tag,
Space
Space,
Pagination
} from '@nutui/nutui-react-taro'
import {Search, Calendar, Truck, File, AddCircle} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
@@ -21,6 +22,10 @@ const List: React.FC = () => {
const [loading, setLoading] = useState<boolean>(false)
const [keywords, setKeywords] = useState<string>('')
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)
// 获取状态显示
const getStatusDisplay = (status?: number) => {
@@ -37,19 +42,22 @@ const List: React.FC = () => {
}
const reload = async (showLoading = true) => {
setLimit(10)
try {
if (showLoading) setLoading(true)
setRefreshing(true)
const where = {
const where: any = {
keywords: keywords.trim(),
page,
limit,
}
const roleCode = Taro.getStorageSync('RoleCode');
if(roleCode == 'kuaidi'){
if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){
if(Taro.getStorageSync('OrganizationParentId') == 0){
// @ts-ignore
where.organizationParentId = Taro.getStorageSync('OrganizationParentId');
where.organizationParentId = Taro.getStorageSync('OrganizationId');
}else {
// @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId');
@@ -58,6 +66,7 @@ const List: React.FC = () => {
const res = await pageHjmViolation(where)
setList(res?.list || [])
setTotal(res?.count || 0)
} catch (error) {
console.error('获取报险记录失败:', error)
Taro.showToast({
@@ -86,7 +95,11 @@ const List: React.FC = () => {
useEffect(() => {
reload().then()
}, [])
}, [page, limit])
const onPageChange = (current: number) => {
setPage(current)
}
return (
<>
@@ -149,9 +162,6 @@ const List: React.FC = () => {
</div>
) : list.length === 0 ? (
<Empty description="暂无报险记录">
<Button type="primary" onClick={onAddInsurance}>
</Button>
</Empty>
) : (
<div style={{padding: '0 16px'}}>
@@ -275,6 +285,23 @@ const List: React.FC = () => {
</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)
},
})
getUserInfo().then((data) => {
getUserInfo().then( async (data) => {
if (data) {
console.log(data.organizationName,'0000')
setIsLogin(true);
@@ -38,7 +38,7 @@ const Header = (props: any) => {
// 机构ID
Taro.setStorageSync('OrganizationId',data.organizationId)
// 父级机构ID
getOrganization(Number(data.organizationId)).then(res => {
await getOrganization(Number(data.organizationId)).then(res => {
Taro.setStorageSync('OrganizationParentId',res.parentId)
})
// 所属站点名称

View File

@@ -75,6 +75,22 @@ const UserCell = () => {
}}
/>
</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={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <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 {UserVerify} from "@/api/system/userVerify/model";
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 role = await listUserRole({roleId: 1701,userId: item.userId})
const userRole = role[0];
userRole.roleId = 1738;
updateUserRole(userRole).then(() => {
// 审核通过
updateUserVerify({
...item,
status: 1
}).then(() => {
if(userRole){
updateUserRole({
...userRole,
roleId: 1738
})
}
Taro.showToast({
title: '操作成功',
icon: 'success'
})
reload().then()
})
})
}
const onReject = async (item: UserVerify) => {

View File

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

View File

@@ -37,3 +37,41 @@ export function getCurrentHour() {
const hour = String(now.getHours()).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;
}