From 1b143c0c1f005879479090a50f135ef8e9f8fd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 20 Jun 2025 19:55:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=9A=E9=BB=84=E5=AE=B6?= =?UTF-8?q?=E6=98=8E=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=BC=80=E5=8F=91=E5=B9=B6?= =?UTF-8?q?=E5=AD=98=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hjm/hjmCar/model/index.ts | 2 + src/api/hjm/hjmViolation/index.ts | 101 +++++++++ src/api/hjm/hjmViolation/model/index.ts | 43 ++++ src/app.config.ts | 8 +- src/hjm/list.tsx | 11 +- src/hjm/query.tsx | 58 ++++-- src/hjm/violation/add.config.ts | 3 + src/hjm/violation/add.tsx | 244 ++++++++++++++++++++++ src/hjm/violation/list.config.ts | 3 + src/hjm/violation/list.tsx | 260 ++++++++++++++++++++++++ src/pages/index/ExpirationTime.tsx | 6 + src/pages/index/Header.tsx | 2 + src/pages/index/index.tsx | 52 ++--- src/pages/user/components/UserCell.tsx | 127 ++++++++---- src/passport/sms-login.config.ts | 4 + src/passport/sms-login.tsx | 204 +++++++++++++++++++ src/user/userVerify/admin.config.ts | 3 + src/user/userVerify/admin.tsx | 248 ++++++++++++++++++++++ 18 files changed, 1295 insertions(+), 84 deletions(-) create mode 100644 src/api/hjm/hjmViolation/index.ts create mode 100644 src/api/hjm/hjmViolation/model/index.ts create mode 100644 src/hjm/violation/add.config.ts create mode 100644 src/hjm/violation/add.tsx create mode 100644 src/hjm/violation/list.config.ts create mode 100644 src/hjm/violation/list.tsx create mode 100644 src/passport/sms-login.config.ts create mode 100644 src/passport/sms-login.tsx create mode 100644 src/user/userVerify/admin.config.ts create mode 100644 src/user/userVerify/admin.tsx diff --git a/src/api/hjm/hjmCar/model/index.ts b/src/api/hjm/hjmCar/model/index.ts index dc0c1d2..6648a25 100644 --- a/src/api/hjm/hjmCar/model/index.ts +++ b/src/api/hjm/hjmCar/model/index.ts @@ -52,6 +52,8 @@ export interface HjmCar { address?: string, // 用户ID userId?: number; + // 认领状态 + claim?: number; // 排序(数字越小越靠前) sortNumber?: number; // 备注 diff --git a/src/api/hjm/hjmViolation/index.ts b/src/api/hjm/hjmViolation/index.ts new file mode 100644 index 0000000..bd65db9 --- /dev/null +++ b/src/api/hjm/hjmViolation/index.ts @@ -0,0 +1,101 @@ +import request from '@/utils/request'; +import type { ApiResult, PageResult } from '@/api/index'; +import type { HjmViolation, HjmViolationParam } from './model'; + +/** + * 分页查询黄家明_违章记录 + */ +export async function pageHjmViolation(params: HjmViolationParam) { + const res = await request.get>>( + '/hjm/hjm-violation/page', + params + ); + if (res.code === 0) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 查询黄家明_违章记录列表 + */ +export async function listHjmViolation(params?: HjmViolationParam) { + const res = await request.get>( + '/hjm/hjm-violation', + params + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 添加黄家明_违章记录 + */ +export async function addHjmViolation(data: HjmViolation) { + const res = await request.post>( + '/hjm/hjm-violation', + data + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 修改黄家明_违章记录 + */ +export async function updateHjmViolation(data: HjmViolation) { + const res = await request.put>( + '/hjm/hjm-violation', + data + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 删除黄家明_违章记录 + */ +export async function removeHjmViolation(id?: number) { + const res = await request.del>( + '/hjm/hjm-violation/' + id + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 批量删除黄家明_违章记录 + */ +export async function removeBatchHjmViolation(data: (number | undefined)[]) { + const res = await request.del>( + '/hjm/hjm-violation/batch', + { + data + } + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 根据id查询黄家明_违章记录 + */ +export async function getHjmViolation(id: number) { + const res = await request.get>( + '/hjm/hjm-violation/' + id + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/hjm/hjmViolation/model/index.ts b/src/api/hjm/hjmViolation/model/index.ts new file mode 100644 index 0000000..8c5cd60 --- /dev/null +++ b/src/api/hjm/hjmViolation/model/index.ts @@ -0,0 +1,43 @@ +import type { PageParam } from '@/api/index'; + +/** + * 黄家明_违章记录 + */ +export interface HjmViolation { + // 自增ID + id?: number; + // 车辆编号 + code?: string; + // 标题 + title?: string; + // 文章分类ID + categoryId?: number; + // 处罚金额 + money?: string; + // 扣分 + score?: string; + // 录入员 + adminId?: number; + // 用户ID + userId?: number; + // 排序(数字越小越靠前) + sortNumber?: number; + // 备注 + comments?: string; + // 状态, 0未处理, 1已处理 + status?: number; + // 租户id + tenantId?: number; + // 创建时间 + createTime?: string; + // 修改时间 + updateTime?: string; +} + +/** + * 黄家明_违章记录搜索条件 + */ +export interface HjmViolationParam extends PageParam { + id?: number; + keywords?: string; +} diff --git a/src/app.config.ts b/src/app.config.ts index 58b20ad..cd517af 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -15,7 +15,8 @@ export default defineAppConfig({ "register", "forget", "setting", - "agreement" + "agreement", + "sms-login" ] }, { @@ -34,7 +35,8 @@ export default defineAppConfig({ "company/company", "profile/profile", "setting/setting", - "userVerify/index" + "userVerify/index", + "userVerify/admin" ] }, { @@ -48,6 +50,8 @@ export default defineAppConfig({ "exam/exam", "bx/bx", "bx/bx-add", + "violation/add", + "violation/list", "trajectory/trajectory", "gps-log/gps-log" // "bx/bx-list", diff --git a/src/hjm/list.tsx b/src/hjm/list.tsx index 9338fc3..4f20a66 100644 --- a/src/hjm/list.tsx +++ b/src/hjm/list.tsx @@ -21,7 +21,7 @@ const List = () => { const reload = () => { // 搜索条件 - const where = {status: 1,deleted: 0, keywords} + const where = {status: 1, deleted: 0, keywords} // 判断身份 const roleCode = Taro.getStorageSync('RoleCode'); if(roleCode == 'kuaidiyuan'){ @@ -33,8 +33,13 @@ const List = () => { where.organizationId = Taro.getStorageSync('OrganizationId'); } if(roleCode == 'kuaidi'){ - // @ts-ignore - where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); + if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){ + // @ts-ignore + where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); + }else { + // @ts-ignore + where.organizationId = Taro.getStorageSync('OrganizationId'); + } } // 获取车辆列表 diff --git a/src/hjm/query.tsx b/src/hjm/query.tsx index f8bcf99..b433a50 100644 --- a/src/hjm/query.tsx +++ b/src/hjm/query.tsx @@ -115,7 +115,7 @@ const Query = () => { title: '请上传车辆图片', icon: 'error' }); - // return false + return false } if (!FormData.gpsNo) { Taro.showToast({ @@ -130,7 +130,7 @@ const Query = () => { ...FormData, status: 1 }).then(() => { - Taro.showToast({title: `绑定成功`, icon: 'success'}) + Taro.showToast({title: `安装成功`, icon: 'success'}) setTimeout(() => { return Taro.navigateBack() }, 1000) @@ -311,7 +311,7 @@ const Query = () => { const onClaimVehicle = () => { updateHjmCar({ ...FormData, - status: 2, + claim: 1, driverId: Taro.getStorageSync('UserId'), driverName: Taro.getStorageSync('RealName') }).then(() => { @@ -361,6 +361,7 @@ const Query = () => { return false } + // 4.查询角色 const role = await listUserRole({userId: Taro.getStorageSync('UserId')}) const roleCode = role[0].roleCode; @@ -394,9 +395,15 @@ const Query = () => { } } } - - // 1.符合条件则由安装人员安装车辆,否则提示无权限 - console.log(roleCode,'roleCode..') + // 1.已认领则展示车辆 + if (carInfo.status == 2) { + setClaimVehicle(false) + Taro.setNavigationBarTitle({ + title: '车辆信息' + }) + return false + } + // 2.符合条件则由安装人员安装车辆,否则提示无权限 if (carInfo.status == 0 && roleCode != 'Installer') { Taro.setNavigationBarTitle({ title: '安装设备' @@ -408,24 +415,29 @@ const Query = () => { setDisabled(true) return false } - // 2.如果已安装,则判断是否已认领车辆 + // 3.如果已安装,则判断是否已认领车辆 if (carInfo.status == 1 && roleCode == 'kuaidiyuan') { // 2.1先查询名下有多少辆车 const carCount = await pageHjmCar({driverId: Taro.getStorageSync('UserId')}) - if (carCount?.count && carCount?.count == 0) { + if (carCount?.count == 0) { // 2.2无车辆则认领 setClaimVehicle(true) Taro.setNavigationBarTitle({ title: '认领车辆' }) - } else { - // 2.3存在车辆则展示车辆信息 - setClaimVehicle(false) - Taro.setNavigationBarTitle({ - title: '车辆信息' - }) } + return false } + // if(carInfo.status == 1 && Taro.getStorageSync('UserId') != carInfo.driverId){ + // Taro.showToast({ + // title: '暂无权限', + // icon: 'error' + // }) + // setTimeout(() => { + // Taro.navigateBack() + // },2000) + // return false + // } } } @@ -448,6 +460,8 @@ const Query = () => { }) }, []) + // @ts-ignore + // @ts-ignore return ( <> {/* 未安装 */} @@ -539,10 +553,11 @@ const Query = () => { onChange={(value) => setFormData({...FormData, gpsNo: value})} />
- +
@@ -637,7 +652,6 @@ const Query = () => { )} - { - ) : ''} - - {/* 已安装 */} - {FormData?.status != 0 ? ( + ) : (
{/* 显示多张图片 */}
{ 电子围栏:{FormData.fenceName} + + 安装状态:{FormData.status == 2 ? '已绑定' : '未绑定'} + 操作员:{FormData.status == 2 ? FormData.driver : '-'} @@ -754,7 +768,7 @@ const Query = () => { }
- ) : ''} + )} ) } diff --git a/src/hjm/violation/add.config.ts b/src/hjm/violation/add.config.ts new file mode 100644 index 0000000..0663d14 --- /dev/null +++ b/src/hjm/violation/add.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '添加违章记录' +}) diff --git a/src/hjm/violation/add.tsx b/src/hjm/violation/add.tsx new file mode 100644 index 0000000..54cfe13 --- /dev/null +++ b/src/hjm/violation/add.tsx @@ -0,0 +1,244 @@ +import {useEffect, useState} from "react"; +import Taro from '@tarojs/taro' +import { + Button, + TextArea, + Cell, + Input, +} from '@nutui/nutui-react-taro' +import {addHjmViolation} from "@/api/hjm/hjmViolation"; +import {HjmViolation} from "@/api/hjm/hjmViolation/model"; + +/** + * 添加违章记录页面 + */ +function Add() { + const [loading, setLoading] = useState(false) + const [lastSubmitTime, setLastSubmitTime] = useState(0) // 最后提交时间 + const [formData, setFormData] = useState({ + code: '', + title: '', + money: '', + score: '', + comments: '' + }) + + // 初始化页面数据 + const initPageData = async () => { + try { + setLoading(false) + } catch (error) { + console.error('初始化失败:', error) + Taro.showToast({ + title: '初始化失败', + icon: 'none' + }) + } + } + + +// 提交表单 + const handleSubmit = async () => { + // 防止重复提交 - 检查loading状态 + if (loading) { + Taro.showToast({ + title: '正在提交中,请稍候...', + icon: 'loading' + }) + return + } + + // 防止快速连续点击 - 2秒内不允许重复提交 + const now = Date.now() + if (now - lastSubmitTime < 2000) { + Taro.showToast({ + title: '请勿频繁提交', + icon: 'none' + }) + return + } + setLastSubmitTime(now) + + // 表单验证 + if (!formData.code?.trim()) { + Taro.showToast({ + title: '请输入车辆编号', + icon: 'none' + }) + return + } + + if (!formData.title?.trim()) { + Taro.showToast({ + title: '请输入违章标题', + icon: 'none' + }) + return + } + + // if (!formData.money?.trim()) { + // Taro.showToast({ + // title: '请输入处罚金额', + // icon: 'none' + // }) + // return + // } + // + // if (!formData.score?.trim()) { + // Taro.showToast({ + // title: '请输入扣分', + // icon: 'none' + // }) + // return + // } + + setLoading(true) + + // 构建提交数据 + const submitData: HjmViolation = { + ...formData, + status: 0 // 0未处理, 1已处理 + } + + addHjmViolation(submitData).then((res) => { + console.log(res) + Taro.showToast({ + title: '提交成功', + icon: 'success' + }) + // 清空表单 + setFormData({ + code: '', + title: '', + money: '', + score: '', + comments: '' + }) + + setTimeout(() => { + Taro.navigateBack() + }, 2000) + }).finally(() => { + setLoading(false) + }) + + } + + useEffect(() => { + initPageData().then(r => { + console.log(r, 'rr') + }) + }, []) + + return ( +
+ {/* 页面标题 */} + {/*
*/} + {/*
*/} + {/* */} + {/* 添加违章记录*/} + {/*
*/} + {/*
*/} + + + {/* 违章信息表单 */} +
+
+ 违章信息 +
+ + + setFormData({...formData, code: value})} + style={{backgroundColor: '#ffffff', borderRadius: '8px'}} + /> + + + setFormData({...formData, title: value})} + style={{backgroundColor: '#ffffff', borderRadius: '8px'}} + /> + + +