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

This commit is contained in:
2025-06-23 21:40:59 +08:00
parent 1b143c0c1f
commit a4130940c0
25 changed files with 551 additions and 275 deletions

10
.idea/AugmentWebviewStateStore.xml generated Normal file

File diff suppressed because one or more lines are too long

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/template-10519.iml" filepath="$PROJECT_DIR$/.idea/template-10519.iml" />
</modules>
</component>
</project>

12
.idea/template-10519.iml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -24,6 +24,8 @@ export interface HjmCar {
parentOrganizationAdmin?: string;
// 车辆编号
code?: string;
// 安装人员ID
installerId?: number;
// 操作员ID
driverId?: number;
// 操作员

View File

@@ -1,7 +1,7 @@
import type { PageParam } from '@/api';
import type {CompanyParameter} from "~/api/system/companyParameter/model";
import type {CompanyUrl} from "~/api/system/companyUrl/model";
import type {CompanyGit} from "~/api/system/companyGit/model";
import type { PageParam } from '@/api/index';
import type {CompanyParameter} from "@/api/system/companyParameter/model";
import type {CompanyUrl} from "@/api/system/companyUrl/model";
import type {CompanyGit} from "@/api/system/companyGit/model";
/**
* 企业信息
@@ -101,7 +101,7 @@ export interface Company {
*/
export interface CompanyParam extends PageParam {
companyId?: number;
type?: number;
type?: any;
official?: boolean;
shortName?: string;
companyName?: string;

View File

@@ -1,7 +1,7 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api/index';
import type { CompanyGit, CompanyGitParam } from './model';
import { SERVER_API_URL } from '@/config/index';
import {SERVER_API_URL} from "@/utils/server";
/**
* 分页查询代码仓库

View File

@@ -1,7 +1,7 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api/index';
import type { CompanyParameter, CompanyParameterParam } from './model';
import {SERVER_API_URL} from '@/config/index';
import {SERVER_API_URL} from "@/utils/server";
/**
* 分页查询应用参数

View File

@@ -1,4 +1,4 @@
import type { PageParam } from '@/api';
import type { PageParam } from '@/api/index';
/**
* 应用参数

View File

@@ -9,7 +9,7 @@ import {SERVER_API_URL} from "@/utils/server";
export async function pageOrganizations(params: OrganizationParam) {
const res = await request.get<ApiResult<PageResult<Organization>>>(
SERVER_API_URL + '/system/organization/page',
{ params }
params
);
if (res.code === 0) {
return res.data;
@@ -23,7 +23,7 @@ export async function pageOrganizations(params: OrganizationParam) {
export async function listOrganizations(params?: OrganizationParam) {
const res = await request.get<ApiResult<Organization[]>>(
SERVER_API_URL + '/system/organization',
{ params }
params
);
if (res.code === 0 && res.data) {
return res.data;

View File

@@ -1,4 +1,4 @@
import { PageParam } from '@/api';
import { PageParam } from '@/api/index';
/**
* 机构
@@ -38,5 +38,7 @@ export interface Organization {
*/
export interface OrganizationParam extends PageParam {
organizationName?: string;
keywords?: string;
limit?: number;
parentId?: number;
}

View File

@@ -30,3 +30,17 @@ export async function updateUserRole(data: UserRole) {
}
return Promise.reject(new Error(res.message));
}
/**
* 添加用户角色
*/
export async function addUserRole(data: UserRole) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-role',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -26,5 +26,6 @@ export interface UserRole {
*/
export interface UserRoleParam extends PageParam {
keywords?: any;
roleId?: number;
userId?: number;
}

View File

@@ -32,6 +32,12 @@ export interface UserVerify {
zzCode?: string;
// 营业执照
zzImg?: string;
// 组织机构代码
organizationId?: number;
// 组织机构名称
organizationName?: string;
// 记录当前用户角色ID
userRoleId?: number;
// 备注
comments?: string;
// 状态, 0在线, 1离线
@@ -54,5 +60,6 @@ export interface UserVerify {
export interface UserVerifyParam extends PageParam {
id?: number;
status?: number;
organizationId?: number;
keywords?: string;
}

View File

@@ -5,7 +5,7 @@ import Taro, {useDidShow, useDidHide} from '@tarojs/taro'
import './app.scss'
import {loginByOpenId} from "@/api/layout";
import {TenantId} from "@/utils/config";
import {saveStorageByLoginUser} from "@/utils/server";
// import {saveStorageByLoginUser} from "@/utils/server";
import {mqttStart} from "@/api/hjm/hjmCar";
function App(props) {
@@ -20,7 +20,7 @@ function App(props) {
tenantId: TenantId
}).then(data => {
if (data) {
saveStorageByLoginUser(data.access_token, data.user)
// saveStorageByLoginUser(data.access_token, data.user)
}
})
}

View File

@@ -38,6 +38,11 @@ const BestSellers = (props: any) => {
</div>
)
})}
{props.data.length === 0 && (
<div className={'flex justify-center items-center'}>
<div className={'text-gray-500 text-sm'}></div>
</div>
)}
</div>
<div style={{height: '170px'}}></div>
</div>

View File

@@ -1,57 +1,127 @@
import {useEffect, useState} from "react";
import {useRouter} from '@tarojs/taro'
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
import {Map} from '@tarojs/components'
// import {Search} from '@nutui/icons-react-taro'
// import {Button, Input} from '@nutui/nutui-react-taro'
import {pageByQQMap} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import {Image,Cell} from '@nutui/nutui-react-taro'
import './location.scss'
import {HjmFence} from "@/api/hjm/hjmFence/model";
import {getHjmFence} from "@/api/hjm/hjmFence";
import {Market} from "../pages/index";
interface Where {
latitude?: number;
longitude?: number;
}
/**
* 电子围栏
* 文章终极列表
* @constructor
*/
const Fence = () => {
const {params} = useRouter();
const [keywords, setKeywords] = useState<string>()
const [item, setItem] = useState<HjmCar>()
const Location = () => {
// const [keywords, setKeywords] = useState<string>()
// const [item, setItem] = useState<HjmCar>()
const [longitude, setLongitude] = useState<any>(108.374959)
const [latitude, setLatitude] = useState<any>(22.767024)
const [scale, setScale] = useState<any>(16)
const [showCircles, setShowCircles] = useState<boolean>(false)
const [points, setPoints] = useState<any[]>([])
const [fence, setFence] = useState<HjmFence>()
const [markers, setMarkers] = useState<Market[]>([])
// 打开地图选择位置
// const chooseLocation = async () => {
// try {
// const res = await Taro.chooseLocation({
// latitude, // 默认纬度
// longitude // 默认经度
// })
// console.log('选择的位置:', res);
// } catch (err) {
// console.error('选择位置失败:', err);
// }
// const onKeywords = (keywords: string) => {
// setKeywords(keywords)
// }
const reload = () => {
const id = Number(params.id);
// 执行搜索
if (keywords) {
pageHjmCar({keywords}).then(res => {
if (res?.list && res?.list?.length > 0) {
const data = res?.list[0];
setItem(data)
setKeywords(data.code)
// 通用的坐标字符串转数组函数
const parseCoordinateString = (coordStr: string) => {
if (!coordStr) return {points: []};
try {
// 分割坐标点
const coordPairs = coordStr.split(';');
// 转为多边形点数组
const points = coordPairs.map(coord => {
const [lat, lng] = coord.split(',');
return {
latitude: parseFloat(lat),
longitude: parseFloat(lng)
}
})
return false;
}
// 获取车辆信息
if (id) {
getHjmCar(id).then(data => {
setItem(data)
setKeywords(data.code)
})
});
console.log(points,'pointspointspoints')
return {points};
} catch (error) {
console.error('解析坐标字符串失败:', error);
return {points: []};
}
}
const reload = () => {
setScale(11)
setLongitude(108.355702)
setLatitude(22.857968)
getHjmFence(4).then(data => {
setFence(data)
const coordStr = data.points || '';
// 使用通用函数解析坐标字符串
const {points} = parseCoordinateString(coordStr);
console.log('解析结果 - 多边形点:', points);
setPoints(points);
setShowCircles(true)
console.log(fence,'fencefencefence')
})
const where: Where = {}
where.latitude = latitude
where.longitude = longitude
pageByQQMap(where).then(res => {
if (res?.count == 0) {
const arr = []
// @ts-ignore
arr.push({
id: 10001,
latitude: 22.813371,
longitude: 108.323885,
title: '当前位置',
name: '当前位置'
})
setMarkers(arr)
return false
}
if (res?.list && res?.list.length > 0) {
const data = res?.list;
const arr = []
data?.map((item: HjmCar) => {
// @ts-ignore
arr.push({
id: item.id,
latitude: item.latitude,
longitude: item.longitude,
label: {
content: `${item?.code}`,
color: '#000000',
fontSize: 12,
borderRadius: 5,
bgColor: '#FFFFFF',
// @ts-ignore
padding: '5px 5px',
borderWidth: 1
},
title: `${item.organization}`,
name: item.organization
})
})
setMarkers(arr)
}
})
}
useEffect(() => {
reload()
}, [])
// 监听圈圈数据变化
useEffect(() => {
}, [showCircles])
return (
<>
@@ -82,35 +152,47 @@ const Fence = () => {
{/* </div>*/}
{/* </div>*/}
{/*</div>*/}
{item ? (
<div className={'car-info w-full bg-white'}>
<Image src={item?.image} mode={'widthFix'} width={'100%'} className={'bg-gray-50'}/>
<div className={'px-2'}>
<Cell className={'car-info-item-title'}>
{item?.code}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidi}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidiAdmin}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.driver}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.insuranceStatus}
</Cell>
<Cell className={'car-info-item-content'}>
GPS编号{item?.gpsNo}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.fenceName}
</Cell>
</div>
</div>
) : ''}
{/*{item ? (*/}
{/* <div className={'car-info fixed bottom-0 left-0 w-full z-20 bg-white p-4'}>*/}
{/* <div className={'car-info-item'}>*/}
{/* <div className={'car-info-item-content'}>*/}
{/* 操作人员:{item?.driver}*/}
{/* </div>*/}
{/* <div className={'car-info-item-content pr-6'}>*/}
{/* 电子围栏:{item?.fenceName} ({item?.inFence ? '围栏内' : '围栏外'})*/}
{/* </div>*/}
{/* <div className={'car-info-item-content pr-6'}>*/}
{/* 当前车速:{item?.speed}*/}
{/* </div>*/}
{/* <div className={'car-info-item-title'}>*/}
{/* 更新时间:{item?.updateTime}*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/*) : ''}*/}
{markers.length > 0 && (
<Map
id="map"
longitude={longitude}
latitude={latitude}
scale={scale}
// @ts-ignore
markers={markers}
polygons={points.length > 0 ? [
{
points: points,
color: '#ff0000',
strokeWidth: 3
}
] : []}
onTap={() => {
console.log('map tap')
}}
style={{width: '100%', height: '100vh'}}
/>
)}
</>
)
}
export default Fence
export default Location

View File

@@ -41,6 +41,13 @@ const List = () => {
where.organizationId = Taro.getStorageSync('OrganizationId');
}
}
if(roleCode == 'Installer'){
// @ts-ignore
where.installerId = Taro.getStorageSync('UserId')
}
if(roleCode == 'user'){
return false;
}
// 获取车辆列表
pageHjmCar(where).then(res => {

View File

@@ -128,7 +128,8 @@ const Query = () => {
// 安装车辆
updateHjmCar({
...FormData,
status: 1
status: 1,
installerId: Taro.getStorageSync('UserId')
}).then(() => {
Taro.showToast({title: `安装成功`, icon: 'success'})
setTimeout(() => {
@@ -419,6 +420,11 @@ const Query = () => {
if (carInfo.status == 1 && roleCode == 'kuaidiyuan') {
// 2.1先查询名下有多少辆车
const carCount = await pageHjmCar({driverId: Taro.getStorageSync('UserId')})
carCount?.list.map(d => {
if(d.code == code){
// 只能绑定一辆车
}
})
if (carCount?.count == 0) {
// 2.2无车辆则认领
setClaimVehicle(true)
@@ -504,7 +510,7 @@ const Query = () => {
</Form.Item>
<Form.Item
label={'管理责任人'}
name="parentOrganizationAdmin"
name="kuaidiAdmin"
rules={[{message: '管理责任人'}]}
>
<Input placeholder="管理责任人" disabled type="text"/>
@@ -705,7 +711,7 @@ const Query = () => {
{FormData?.organization}
</Cell>
<Cell className={'car-info-item-title'}>
{FormData?.parentOrganizationAdmin}
{FormData?.kuaidiAdmin}
</Cell>
<Cell className={'car-info-item-content'}>
{FormData?.insuranceStatus}
@@ -717,10 +723,10 @@ const Query = () => {
{FormData.fenceName}
</Cell>
<Cell className={'car-info-item-content'}>
{FormData.status == 2 ? '已绑定' : '未绑定'}
{FormData.status == 1 ? '已安装' : '未安装'}
</Cell>
<Cell className={'car-info-item-content'}>
{FormData.status == 2 ? FormData.driver : '-'}
{FormData.driver || '-'}
</Cell>
{
// 认领车辆

View File

@@ -4,6 +4,7 @@ import {Button} from '@nutui/nutui-react-taro'
import {Target, Scan, Truck} from '@nutui/icons-react-taro'
import {getUserInfo} from "@/api/layout";
import navTo from "@/utils/common";
import {pageHjmCar} from "@/api/hjm/hjmCar";
const ExpirationTime = () => {
const [isAdmin, setIsAdmin] = useState<boolean>(false)
@@ -45,6 +46,9 @@ const ExpirationTime = () => {
if(Taro.getStorageSync('certification') == 'yz'){
setIsAdmin(true)
}
if(Taro.getStorageSync('RoleCode') == 'Installer'){
setIsAdmin(true)
}
data.roles?.map((item, index) => {
if (index == 0) {
setRoleName(item.roleCode)
@@ -53,6 +57,12 @@ const ExpirationTime = () => {
}
})
pageHjmCar({driverId: Taro.getStorageSync('UserId')}).then(res => {
if(res?.list && res.list.length > 0){
setIsAdmin(true)
}
})
}, [])
return (

View File

@@ -33,6 +33,7 @@ const Header = (props: any) => {
if (data) {
setIsLogin(true);
Taro.setStorageSync('UserId', data.userId)
Taro.setStorageSync('Phone',data.phone)
// 机构ID
Taro.setStorageSync('OrganizationId',data.organizationId)
// 父级机构ID

View File

@@ -228,6 +228,7 @@ function Home() {
if (!Taro.getStorageSync('access_token')) {
return false;
}
pageHjmCarByMap(latitude, longitude)
if (!isAdmin) {
return false;
}
@@ -315,6 +316,9 @@ function Home() {
console.log('交警', '12312')
setIsAdmin(true)
}
if (Taro.getStorageSync('RoleCode') == 'Installer') {
setIsAdmin(true)
}
setUserInfo(data)
setIsLogin(true);
Taro.setStorageSync('UserId', data.userId)

View File

@@ -1,5 +1,5 @@
import {Button} from '@nutui/nutui-react-taro'
import {Avatar, Tag} from '@nutui/nutui-react-taro'
import {Avatar, Tag, Space} from '@nutui/nutui-react-taro'
import {getUserInfo, getWxOpenId} from '@/api/layout';
import Taro from '@tarojs/taro';
import {useEffect, useState} from "react";
@@ -163,11 +163,18 @@ function UserCard() {
<div className={'user-info flex flex-col px-2'}>
<div className={'py-1 text-black font-bold'}>{IsLogin ? userInfo?.mobile : '请点击头像登录'}</div>
{IsLogin ? (
<div className={'grade text-xs py-1'}>
<Space className={'grade text-xs py-1'}>
<Tag type="success" round>
<div className={'p-1'}>{roleName || '注册用户'}</div>
</Tag>
</div>
{/*{*/}
{/* userInfo?.organizationName && (*/}
{/* <Tag type="warning" round>*/}
{/* <div className={'p-1'}>{userInfo?.organizationName}</div>*/}
{/* </Tag>*/}
{/* )*/}
{/*}*/}
</Space>
) : ''}
</div>
</div>

View File

@@ -19,6 +19,7 @@ const UserCell = () => {
content: '确定要退出登录吗?',
success: function (res) {
if (res.confirm) {
Taro.clearStorageSync()
Taro.removeStorageSync('access_token')
Taro.removeStorageSync('TenantId')
Taro.removeStorageSync('UserId')
@@ -56,7 +57,7 @@ const UserCell = () => {
/>
</Cell.Group>
{
roleName === 'kuaidi' && (
(roleName === 'kuaidi' || roleName == 'zhandian') && (
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"

View File

@@ -7,11 +7,11 @@ import {
Tag,
Space
} from '@nutui/nutui-react-taro'
import {Search, Calendar, Truck, File, AddCircle} from '@nutui/icons-react-taro'
import {Search, Calendar, Truck, File} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {pageHjmViolation} from "@/api/hjm/hjmViolation";
import {UserVerify} from "@/api/system/userVerify/model";
import {pageUserVerify} from "@/api/system/userVerify";
import {pageUserVerify, updateUserVerify} from "@/api/system/userVerify";
import {listUserRole, updateUserRole} from "@/api/system/userRole";
/**
@@ -21,6 +21,7 @@ const List: React.FC = () => {
const [list, setList] = useState<UserVerify[]>([])
const [loading, setLoading] = useState<boolean>(false)
const [keywords, setKeywords] = useState<string>('')
// const [showTextArea, setShowTextArea] = useState<boolean>(false)
const [refreshing, setRefreshing] = useState<boolean>(false)
console.log(refreshing)
// 获取状态显示
@@ -42,9 +43,20 @@ const List: React.FC = () => {
if (showLoading) setLoading(true)
setRefreshing(true)
const res = await pageUserVerify({
const where = {
keywords: keywords.trim(),
})
}
if (Taro.getStorageSync('RoleCode') == 'zhandian') {
// @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId')
}
if (Taro.getStorageSync('RoleCode') == 'kuaidi') {
// @ts-ignore
where.OrganizationParentId = Taro.getStorageSync('OrganizationParentId')
}
const res = await pageUserVerify(where)
setList(res?.list || [])
} catch (error) {
@@ -67,12 +79,44 @@ const List: React.FC = () => {
setKeywords(value)
}
const onAddInsurance = () => {
Taro.navigateTo({
url: '/hjm/violation/add'
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(() => {
Taro.showToast({
title: '操作成功',
icon: 'success'
})
reload().then()
})
})
}
const onReject = async (item: UserVerify) => {
const role = await listUserRole({roleId: 1738,userId: item.userId})
const userRole = role[0];
if(userRole){
userRole.roleId = 1701;
updateUserRole(userRole).then(() => {
updateUserVerify({
...item,
status: 2
}).then(() => {
Taro.showToast({
title: '操作成功',
icon: 'success'
})
reload().then()
})
})
}
}
useEffect(() => {
reload().then()
}, [])
@@ -137,10 +181,7 @@ const List: React.FC = () => {
<Loading type="spinner">...</Loading>
</div>
) : list.length === 0 ? (
<Empty description="暂无报险记录">
<Button type="primary" onClick={onAddInsurance}>
</Button>
<Empty description="暂无数据">
</Empty>
) : (
<div style={{padding: '0 16px'}}>
@@ -183,6 +224,18 @@ const List: React.FC = () => {
</div>
<Space direction="vertical">
<div style={{
display: 'flex',
alignItems: 'center',
gap: '8px'
}}>
<Truck size={14} color="#8c8c8c"/>
<span style={{fontSize: '13px', color: '#8c8c8c'}}>
{item.organizationName}
</span>
</div>
<div style={{
display: 'flex',
alignItems: 'center',
@@ -235,6 +288,20 @@ const List: React.FC = () => {
}
</div>
)}
<Space className={'pt-4 flex justify-end'}>
<Button type="success" onClick={() => onPass(item)}></Button>
<Button type="warning" onClick={() => onReject(item)}></Button>
</Space>
{/*{showTextArea && (*/}
{/* <TextArea*/}
{/* placeholder={'个性签名'}*/}
{/* value={item?.comments}*/}
{/* onChange={(value) => changeComments(value)}*/}
{/* />*/}
{/*)}*/}
</div>
)
})}

View File

@@ -1,5 +1,4 @@
import {useEffect, useState} from "react";
import {Image} from '@nutui/nutui-react-taro'
import {ConfigProvider} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
@@ -8,19 +7,22 @@ import {
Button,
Input,
Radio,
Cell,
SearchBar
} from '@nutui/nutui-react-taro'
import {UserVerify} from "@/api/system/userVerify/model";
import {addUserVerify, myUserVerify, updateUserVerify} from "@/api/system/userVerify";
import {uploadFile} from "@/api/system/file";
import {pageOrganizations} from "@/api/system/organization";
function Index() {
const [isUpdate, setIsUpdate] = useState<boolean>(false)
const [submitText, setSubmitText] = useState<string>('提交')
const [siteList, setSiteList] = useState<any[]>([])
const [FormData, setFormData] = useState<UserVerify>({
userId: undefined,
type: undefined,
phone: undefined,
type: 0,
phone: Taro.getStorageSync('Phone'),
avatar: undefined,
realName: undefined,
idCard: undefined,
@@ -29,6 +31,9 @@ function Index() {
sfz2: undefined,
zzCode: undefined,
zzImg: undefined,
organizationId: undefined,
organizationName: undefined,
userRoleId: Taro.getStorageSync(''),
status: undefined,
statusText: undefined,
comments: undefined
@@ -47,43 +52,41 @@ function Index() {
})
}
})
if(Taro.getStorageSync('Phone')){
setFormData({...FormData, phone: Taro.getStorageSync('Phone')})
}
}
const submitFailed = (error: any) => {
console.log(error, 'err...')
}
const searchSiteList = (keywords: string) => {
pageOrganizations({keywords,limit: 5}).then(res => {
setSiteList(res?.list || [])
})
}
const onOrganizationChange = (item) => {
console.log(item);
setFormData({
...FormData,
organizationId: item.organizationId,
organizationName: item.organizationName
})
}
// 提交表单
const submitSucceed = (values: any) => {
console.log('提交表单', values);
console.log('提交表单...',values)
if (FormData.status != 2 && FormData.status != undefined) return false;
if (FormData.type == 0) {
if (!FormData.sfz1 || !FormData.sfz2) {
Taro.showToast({
title: '请上传身份证正反面',
icon: 'none'
});
return false;
}
if (!FormData.realName || !FormData.idCard) {
Taro.showToast({
title: '请填写真实姓名和身份证号码',
icon: 'none'
});
return false;
}
}
if (FormData.type == 1) {
if (!FormData.zzImg) {
Taro.showToast({
title: '请上传营业执照',
icon: 'none'
});
return false;
}
if (!FormData.name || !FormData.zzCode) {
Taro.showToast({
title: '请填写主体名称和营业执照号码',
icon: 'none'
});
return false;
}
if(FormData.organizationId == 0 || !FormData.organizationId){
Taro.showToast({
title: '请选择站点',
icon: 'none'
});
return false;
}
if(!FormData.realName){
Taro.showToast({
@@ -92,6 +95,7 @@ function Index() {
});
return false;
}
console.log('提交表单', FormData);
const saveOrUpdate = isUpdate ? updateUserVerify : addUserVerify;
saveOrUpdate({...FormData, status: 0}).then(() => {
Taro.showToast({title: `提交成功`, icon: 'success'})
@@ -107,40 +111,6 @@ function Index() {
reload();
})
}
const submitFailed = (error: any) => {
console.log(error, 'err...')
}
const uploadSfz1 = () => {
if (FormData.status != 2 && FormData.status != undefined) return false;
uploadFile().then(data => {
setFormData({
...FormData,
sfz1: data.url
})
});
}
const uploadSfz2 = () => {
if (FormData.status != 2 && FormData.status != undefined) return false;
uploadFile().then(data => {
setFormData({
...FormData,
sfz2: data.url
})
});
}
const uploadZzImg = () => {
if (FormData.status != 2 && FormData.status != undefined) return false;
uploadFile().then(data => {
setFormData({
...FormData,
zzImg: data.url
})
});
}
useEffect(() => {
reload()
@@ -173,27 +143,72 @@ function Index() {
)
}
>
<Form.Item
label="类型"
name="type"
initialValue={FormData.type}
required
>
<Radio.Group value={FormData?.type} direction="horizontal"
disabled={FormData.status != 2 && FormData.status != undefined}
onChange={(value) => setFormData({...FormData, type: value})}>
<Radio key={0} value={0}>
</Radio>
<Radio key={1} value={1}>
</Radio>
</Radio.Group>
</Form.Item>
{/*<Form.Item*/}
{/* label="类型"*/}
{/* name="type"*/}
{/* initialValue={FormData.type}*/}
{/* required*/}
{/*>*/}
{/* <Radio.Group value={FormData?.type} direction="horizontal"*/}
{/* disabled={FormData.status != 2 && FormData.status != undefined}*/}
{/* onChange={(value) => setFormData({...FormData, type: value})}>*/}
{/* <Radio key={0} value={0}>*/}
{/* 个人*/}
{/* </Radio>*/}
{/* <Radio key={1} value={1}>*/}
{/* 企业*/}
{/* </Radio>*/}
{/* </Radio.Group>*/}
{/*</Form.Item>*/}
{FormData.status != 1 && (
<>
<ConfigProvider
theme={{
nutuiSearchbarBackground: '#ffffff',
nutuiSearchbarContentBackground: '#eee',
nutuiSearchbarInputTextAlign: 'right',
}}
>
<SearchBar className={'mt-3'} placeholder={'搜索站点'} onChange={(val: string) => searchSiteList(val)} maxLength={10} />
</ConfigProvider>
<div className={'p-3'}
>
<Radio.Group defaultValue={FormData.organizationId} direction="horizontal">
{siteList.map((item: any,index) => (
<Cell className={'px-2'} key={item.organizationId} onClick={() => onOrganizationChange(item)}>
<Radio key={index} value={item.organizationId}>{item.organizationName}</Radio>
</Cell>
))}
</Radio.Group>
{/*{siteList.length == 0 && (*/}
{/* <div className={'text-center'}>*/}
{/* <span className={'text-gray-400 text-sm'}>没有搜索结果</span>*/}
{/* </div>*/}
{/*)}*/}
</div>
</>
)}
{
// 个人类型
FormData.type == 0 && (
<>
<Form.Item
label={'所属站点'}
name="organizationId"
required
initialValue={FormData.organizationName}
rules={[{message: '请输入所属站点'}]}
>
<Input
placeholder={'请输入所属站点'}
type="text"
disabled={FormData.status != 2 && FormData.status != undefined}
value={FormData?.organizationName}
/>
</Form.Item>
<Form.Item
label={'真实姓名'}
name="realName"
@@ -210,103 +225,118 @@ function Index() {
/>
</Form.Item>
<Form.Item
label={'身份证号码'}
name="idCard"
label={'手机号码'}
name="phone"
required
initialValue={FormData.idCard}
rules={[{message: '请输入身份证号码'}]}
initialValue={FormData.phone}
rules={[{message: '请输入手机号码'}]}
>
<Input
placeholder="请输入身份证号码"
placeholder={'请输入手机号'}
type="text"
value={FormData?.idCard}
disabled={FormData.status != 2 && FormData.status != undefined}
maxLength={18}
onChange={(value) => setFormData({...FormData, idCard: value})}
value={FormData?.phone}
onChange={(value) => setFormData({...FormData, phone: value})}
/>
</Form.Item>
<Form.Item
label={'上传证件'}
name="image"
required
rules={[{message: '请上传身份证正反面'}]}
>
<div className={'flex gap-2'}>
<div onClick={uploadSfz1}>
<Image src={FormData.sfz1}
radius="10%" width="80" height="80"/>
</div>
<div onClick={uploadSfz2}>
<Image src={FormData.sfz2} mode={'scaleToFill'}
radius="10%" width="80" height="80"/>
</div>
</div>
</Form.Item>
{/*<Form.Item*/}
{/* label={'身份证号码'}*/}
{/* name="idCard"*/}
{/* required*/}
{/* initialValue={FormData.idCard}*/}
{/* rules={[{message: '请输入身份证号码'}]}*/}
{/*>*/}
{/* <Input*/}
{/* placeholder="请输入身份证号码"*/}
{/* type="text"*/}
{/* value={FormData?.idCard}*/}
{/* disabled={FormData.status != 2 && FormData.status != undefined}*/}
{/* maxLength={18}*/}
{/* onChange={(value) => setFormData({...FormData, idCard: value})}*/}
{/* />*/}
{/*</Form.Item>*/}
{/*<Form.Item*/}
{/* label={'上传证件'}*/}
{/* name="image"*/}
{/* required*/}
{/* rules={[{message: '请上传身份证正反面'}]}*/}
{/*>*/}
{/* <div className={'flex gap-2'}>*/}
{/* <div onClick={uploadSfz1}>*/}
{/* <Image src={FormData.sfz1}*/}
{/* radius="10%" width="80" height="80"/>*/}
{/* </div>*/}
{/* <div onClick={uploadSfz2}>*/}
{/* <Image src={FormData.sfz2} mode={'scaleToFill'}*/}
{/* radius="10%" width="80" height="80"/>*/}
{/* </div>*/}
{/* </div>*/}
{/*</Form.Item>*/}
</>
)
}
{
// 企业类型
FormData.type == 1 && (
<>
<Form.Item
label={'主体名称'}
name="name"
required
initialValue={FormData.name}
rules={[{message: '请输入公司名称或单位名称'}]}
>
<Input
placeholder={'请输入主体名称'}
type="text"
value={FormData?.name}
onChange={(value) => setFormData({...FormData, name: value})}
/>
</Form.Item>
<Form.Item
label={'营业执照号码'}
name="zzCode"
required
initialValue={FormData.zzCode}
rules={[{message: '请输入营业执照号码'}]}
>
<Input
placeholder="请输入营业执照号码"
type="text"
value={FormData?.zzCode}
maxLength={18}
onChange={(value) => setFormData({...FormData, zzCode: value})}
/>
</Form.Item>
<Form.Item
label={'上传营业执照'}
name="zzImg"
required
rules={[{message: '请上传营业执照'}
]}
>
<div onClick={uploadZzImg}>
<Image src={FormData.zzImg} mode={'scaleToFill'}
radius="10%" width="80" height="80"/>
</div>
</Form.Item>
</>
)
}
<Form.Item
label={'真实姓名'}
name="realName"
required
initialValue={FormData.realName}
rules={[{message: '请输入真实姓名'}]}
>
<Input
placeholder={'请输入真实姓名'}
type="text"
value={FormData?.realName}
onChange={(value) => setFormData({...FormData, realName: value})}
/>
</Form.Item>
{/*{*/}
{/* // 企业类型*/}
{/* FormData.type == 1 && (*/}
{/* <>*/}
{/* <Form.Item*/}
{/* label={'主体名称'}*/}
{/* name="name"*/}
{/* required*/}
{/* initialValue={FormData.name}*/}
{/* rules={[{message: '请输入公司名称或单位名称'}]}*/}
{/* >*/}
{/* <Input*/}
{/* placeholder={'请输入主体名称'}*/}
{/* type="text"*/}
{/* value={FormData?.name}*/}
{/* onChange={(value) => setFormData({...FormData, name: value})}*/}
{/* />*/}
{/* </Form.Item>*/}
{/* <Form.Item*/}
{/* label={'营业执照号码'}*/}
{/* name="zzCode"*/}
{/* required*/}
{/* initialValue={FormData.zzCode}*/}
{/* rules={[{message: '请输入营业执照号码'}]}*/}
{/* >*/}
{/* <Input*/}
{/* placeholder="请输入营业执照号码"*/}
{/* type="text"*/}
{/* value={FormData?.zzCode}*/}
{/* maxLength={18}*/}
{/* onChange={(value) => setFormData({...FormData, zzCode: value})}*/}
{/* />*/}
{/* </Form.Item>*/}
{/* <Form.Item*/}
{/* label={'上传营业执照'}*/}
{/* name="zzImg"*/}
{/* required*/}
{/* rules={[{message: '请上传营业执照'}*/}
{/* ]}*/}
{/* >*/}
{/* <div onClick={uploadZzImg}>*/}
{/* <Image src={FormData.zzImg} mode={'scaleToFill'}*/}
{/* radius="10%" width="80" height="80"/>*/}
{/* </div>*/}
{/* </Form.Item>*/}
{/* </>*/}
{/* )*/}
{/*}*/}
{/*<Form.Item*/}
{/* label={'真实姓名'}*/}
{/* name="realName"*/}
{/* required*/}
{/* initialValue={FormData.realName}*/}
{/* rules={[{message: '请输入真实姓名'}]}*/}
{/*>*/}
{/* <Input*/}
{/* placeholder={'请输入真实姓名'}*/}
{/* type="text"*/}
{/* value={FormData?.realName}*/}
{/* onChange={(value) => setFormData({...FormData, realName: value})}*/}
{/* />*/}
{/*</Form.Item>*/}
{
FormData.status != undefined && (
<Form.Item