相关方需求修改

master
853931625@qq.com 2026-04-13 09:28:27 +08:00
parent 583e255167
commit 8844bb25ee
15 changed files with 583 additions and 466 deletions

View File

@ -28,8 +28,8 @@ module.exports = {
// 应用Key // 应用Key
appKey: "", appKey: "",
// fileUrl: "http://192.168.20.240:9787/mnt/", // fileUrl: "http://192.168.20.240:9787/mnt/",
fileUrl: "https://jpfz.qhdsafety.com/gbsFileTest/", // fileUrl: "https://jpfz.qhdsafety.com/gbsFileTest/",
// fileUrl: "https://skqhdg.porthebei.com:9004/file/uploadFiles2/", fileUrl: "https://skqhdg.porthebei.com:9004/file/uploadFiles2/",
}, },
// public/index.html注入全局变量 // public/index.html注入全局变量
windowInject: { windowInject: {

View File

@ -8,14 +8,14 @@ import AddIcon from "zy-react-library/components/Icon/AddIcon";
import Page from "zy-react-library/components/Page"; import Page from "zy-react-library/components/Page";
import Search from "zy-react-library/components/Search"; import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary"; import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import AreaSelect from "zy-react-library/components/SelectTree/Area"; // import AreaSelect from "zy-react-library/components/SelectTree/Area";
import Table from "zy-react-library/components/Table"; import Table from "zy-react-library/components/Table";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import useTable from "zy-react-library/hooks/useTable"; import useTable from "zy-react-library/hooks/useTable";
import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular";
import { getLabelName } from "zy-react-library/utils"; import { getLabelName } from "zy-react-library/utils";
import { NS_ENTERPRISE } from "~/enumerate/namespace"; import { NS_ENTERPRISE } from "~/enumerate/namespace";
import { getAreaNamePath, useDebounce } from "~/utils"; import { useDebounce } from "~/utils";
const ENTERPRISE_TYPE = [ const ENTERPRISE_TYPE = [
{ {
@ -43,11 +43,11 @@ function List(props) {
enterpriseType: 3, enterpriseType: 3,
geCreateTime: formData.CreateTime?.[0], geCreateTime: formData.CreateTime?.[0],
leCreateTime: formData.CreateTime?.[1], leCreateTime: formData.CreateTime?.[1],
eqProvince: formData.cityRecord?.[0], // eqProvince: formData.cityRecord?.[0],
eqCity: formData.cityRecord?.[1], // eqCity: formData.cityRecord?.[1],
eqCountry: formData.cityRecord?.[2], // eqCountry: formData.cityRecord?.[2],
eqStreet: formData.cityRecord?.[3], // eqStreet: formData.cityRecord?.[3],
eqVillage: formData.cityRecord?.[4], // eqVillage: formData.cityRecord?.[4],
}; };
}, },
@ -57,7 +57,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "是否重置密码为Aa@12345678", content: "是否重置密码为Cc@12345678",
onOk: () => { onOk: () => {
props["corpInfoChangePassword"]({ props["corpInfoChangePassword"]({
id, id,
@ -87,44 +87,44 @@ function List(props) {
}, },
}); });
}; };
const onFinish = async () => { // const onFinish = async () => {
// 处理属地查询 // // 处理属地查询
const arr = []; // const arr = [];
cityData.forEach((item) => { // cityData.forEach((item) => {
arr.push(item.value); // arr.push(item.value);
}); // });
form.setFieldValue("cityRecord", arr); // form.setFieldValue("cityRecord", arr);
getData(); // getData();
}; // };
const onReset = () => { // const onReset = () => {
setCityData([]); // setCityData([]);
//
form.setFieldValue("cityRecord", []); // form.setFieldValue("cityRecord", []);
}; // };
return ( return (
<div> <div>
<Page isShowAllAction={false}> <Page isShowAllAction={false}>
<Search <Search
form={form} form={form}
onFinish={() => onFinish()} onFinish={getData}
onReset={onReset} // onReset={onReset}
options={[ options={[
{ {
name: "likecorpName", name: "likecorpName",
label: "企业名称", label: "企业名称",
}, },
{ // {
name: "cityData", // name: "cityData",
label: "属地", // label: "属地",
render: ( // render: (
<AreaSelect // <AreaSelect
onGetNodePaths={nodes => // onGetNodePaths={nodes =>
setCityData(nodes)} // setCityData(nodes)}
/> // />
), // ),
}, // },
{ {
name: "CreateTime", name: "CreateTime",
label: "开户时间", label: "开户时间",
@ -136,12 +136,12 @@ function List(props) {
render: FORM_ITEM_RENDER_ENUM.SELECT, render: FORM_ITEM_RENDER_ENUM.SELECT,
items: ENTERPRISE_TYPE, items: ENTERPRISE_TYPE,
}, },
{ // {
name: "cityRecord", // name: "cityRecord",
label: "属地", // label: "属地",
render: FORM_ITEM_RENDER_ENUM.SELECT, // render: FORM_ITEM_RENDER_ENUM.SELECT,
onlyForLabel: true, // onlyForLabel: true,
}, // },
]} ]}
@ -171,14 +171,14 @@ function List(props) {
title: "企业名称", title: "企业名称",
dataIndex: "corpName", dataIndex: "corpName",
}, },
{ // {
title: "属地", // title: "属地",
dataIndex: "cityName", // dataIndex: "cityName",
width: 300, // width: 300,
render: (_, record) => ( // render: (_, record) => (
<div>{getAreaNamePath(record)}</div> // <div>{getAreaNamePath(record)}</div>
), // ),
}, // },
{ {
title: "创建单位", title: "创建单位",
dataIndex: "tenantName", dataIndex: "tenantName",
@ -447,6 +447,7 @@ function AddModalComponent(props) {
{ {
name: "code", name: "code",
label: "统一社会信用代码", label: "统一社会信用代码",
required: false,
rules: [ rules: [
{ {
pattern: UNIFIED_SOCIAL_CREDIT_CODE, pattern: UNIFIED_SOCIAL_CREDIT_CODE,
@ -454,23 +455,23 @@ function AddModalComponent(props) {
}, },
], ],
}, },
{ // {
name: "ecoType", // name: "ecoType",
label: "经济类型", // label: "经济类型",
render: ( // render: (
<DictionarySelect // <DictionarySelect
dictValue="ECO_TYPE" // dictValue="ECO_TYPE"
onGetLabel={(label) => { // onGetLabel={(label) => {
form.setFieldValue("ecoTypeName", label); // form.setFieldValue("ecoTypeName", label);
}} // }}
/> // />
), // ),
}, // },
{ // {
name: "ecoTypeName", // name: "ecoTypeName",
label: "经济类型名称", // label: "经济类型名称",
onlyForLabel: true, // onlyForLabel: true,
}, // },
{ {
name: "type", name: "type",
label: "相关方类型", label: "相关方类型",

View File

@ -10,7 +10,7 @@ import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import { getLabelName } from "zy-react-library/utils"; import { getLabelName } from "zy-react-library/utils";
import { NS_ENTERPRISE } from "~/enumerate/namespace"; import { NS_ENTERPRISE } from "~/enumerate/namespace";
import { getAreaNamePath, getCorpTypeNamePath } from "~/utils"; import { getCorpTypeNamePath } from "~/utils";
const ENTERPRISE_TYPE = [ const ENTERPRISE_TYPE = [
{ {
@ -103,33 +103,33 @@ function View(props) {
children: info.code, children: info.code,
}, },
{ // {
label: "属地", // label: "属地",
children: <div>{getAreaNamePath(info)}</div>, // children: <div>{getAreaNamePath(info)}</div>,
}, // },
{ // {
label: "所属行业", // label: "所属行业",
children: <div>{getCorpTypeNamePath(info)}</div>, // children: <div>{getCorpTypeNamePath(info)}</div>,
}, // },
{ // {
label: "经济类型", // label: "经济类型",
children: info.ecoTypeName, // children: info.ecoTypeName,
}, // },
{ // {
label: "经度/纬度", // label: "经度/纬度",
children: info.longitude && `${info.longitude}/${info.latitude}`, // children: info.longitude && `${info.longitude}/${info.latitude}`,
}, // },
{ {
label: "单位经营地址", label: "单位经营地址",
children: info.addressBusiness, children: info.addressBusiness,
}, },
{ // {
label: "企业规模", // label: "企业规模",
children: info.scaleName, // children: info.scaleName,
}, // },
{ {
label: "法定代表人", label: "法定代表人",
@ -189,10 +189,10 @@ function View(props) {
</div> </div>
), ),
}, },
{ // {
label: "成立日期", // label: "成立日期",
children: info.createDate, // children: info.createDate,
}, // },
{ {
label: "职工人数(人)", label: "职工人数(人)",
children: info.employees, children: info.employees,
@ -202,14 +202,14 @@ function View(props) {
// children: info.areaCovered, // children: info.areaCovered,
// }, // },
{ // {
label: "注册资金(万元)", // label: "注册资金(万元)",
children: info.regcapital, // children: info.regcapital,
}, // },
{ // {
label: "资产总额(万元)", // label: "资产总额(万元)",
children: info.totalAssets, // children: info.totalAssets,
}, // },
{ {
label: "企业二维码", label: "企业二维码",

View File

@ -37,58 +37,58 @@ function List(props) {
return { return {
...formData, ...formData,
enterpriseType: 3, enterpriseType: 3,
eqProvince: formData.cityRecord?.[0], // eqProvince: formData.cityRecord?.[0],
eqCity: formData.cityRecord?.[1], // eqCity: formData.cityRecord?.[1],
eqCountry: formData.cityRecord?.[2], // eqCountry: formData.cityRecord?.[2],
eqStreet: formData.cityRecord?.[3], // eqStreet: formData.cityRecord?.[3],
eqVillage: formData.cityRecord?.[4], // eqVillage: formData.cityRecord?.[4],
}; };
}, },
}); });
const onFinish = async () => { // const onFinish = async () => {
// 处理属地查询 // // 处理属地查询
const arr = []; // const arr = [];
cityData.forEach((item) => { // cityData.forEach((item) => {
arr.push(item.value); // arr.push(item.value);
}); // });
form.setFieldValue("cityRecord", arr); // form.setFieldValue("cityRecord", arr);
getData(); // getData();
}; // };
const onReset = () => { // const onReset = () => {
setCityData([]); // setCityData([]);
//
form.setFieldValue("cityRecord", []); // form.setFieldValue("cityRecord", []);
}; // };
return ( return (
<div> <div>
<Page isShowAllAction={false}> <Page isShowAllAction={false}>
<Search <Search
form={form} form={form}
onFinish={() => onFinish()} onFinish={getData}
onReset={onReset} // onReset={onReset}
options={[ options={[
{ {
name: "likeCorpName", name: "likeCorpName",
label: "企业名称", label: "企业名称",
}, },
{ // {
name: "cityData", // name: "cityData",
label: "属地", // label: "属地",
render: ( // render: (
<AreaSelect // <AreaSelect
onGetNodePaths={nodes => // onGetNodePaths={nodes =>
setCityData(nodes)} // setCityData(nodes)}
/> // />
), // ),
}, // },
{ name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE }, { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE },
{ // {
name: "cityRecord", // name: "cityRecord",
label: "属地", // label: "属地",
render: FORM_ITEM_RENDER_ENUM.SELECT, // render: FORM_ITEM_RENDER_ENUM.SELECT,
onlyForLabel: true, // onlyForLabel: true,
}, // },
]} ]}
/> />
<Table <Table
@ -109,13 +109,13 @@ function List(props) {
), ),
width: 120, width: 120,
}, },
{ // {
title: "属地", // title: "属地",
dataIndex: "cityName", // dataIndex: "cityName",
render: (_, record) => ( // render: (_, record) => (
<div>{getAreaNamePath(record)}</div> // <div>{getAreaNamePath(record)}</div>
), // ),
}, // },
{ {
title: "创建单位", title: "创建单位",
dataIndex: "tenantName", dataIndex: "tenantName",

View File

@ -47,7 +47,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "确定要重置密码为Aa@12345678吗", content: "确定要重置密码为Cc@12345678吗",
onOk: () => { onOk: () => {
props["userChangePassword"]({ props["userChangePassword"]({
id, id,
@ -357,22 +357,22 @@ function AddModalComponent(props) {
label: "民族", label: "民族",
children: info.nationName, children: info.nationName,
}, },
{ // {
label: "婚姻状况", // label: "婚姻状况",
children: info.maritalStatusName, // children: info.maritalStatusName,
}, // },
{ {
label: "政治面貌", label: "政治面貌",
children: info.politicalAffiliationName, children: info.politicalAffiliationName,
}, },
{ // {
label: "户口所在地", // label: "户口所在地",
children: info.locationAddress, // children: info.locationAddress,
}, // },
{ // {
label: "现住址", // label: "现住址",
children: info.currentAddress, // children: info.currentAddress,
}, // },
{ {
label: "文化程度", label: "文化程度",
children: info.culturalLevelName, children: info.culturalLevelName,

View File

@ -85,7 +85,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "确定要重置密码为Aa@12345678吗", content: "确定要重置密码为Bb@12345678吗",
onOk: () => { onOk: () => {
props["userChangePassword"]({ props["userChangePassword"]({
id, id,

View File

@ -3,12 +3,8 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Form, message, Modal, QRCode } from "antd"; import { Button, Form, message, Modal, QRCode } from "antd";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import FormBuilder from "zy-react-library/components/FormBuilder"; import FormBuilder from "zy-react-library/components/FormBuilder";
import Map from "zy-react-library/components/Map";
import Page from "zy-react-library/components/Page"; import Page from "zy-react-library/components/Page";
import AreaSelect from "zy-react-library/components/SelectTree/Area";
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
import IndustrySelect from "zy-react-library/components/SelectTree/Industry";
import Upload from "zy-react-library/components/Upload"; import Upload from "zy-react-library/components/Upload";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
@ -27,20 +23,20 @@ import { useDebounce } from "~/utils";
const REQUIRED_FIELDS = [ const REQUIRED_FIELDS = [
"corpName", "corpName",
"code", "code",
"province", // "province",
"ecoType", // "ecoType",
"addressBusiness", "addressBusiness",
"scale", // "scale",
"lrName", "lrName",
"lrMobile", "lrMobile",
"contacts", "contacts",
"contactsPhone", "contactsPhone",
"createDate", // "createDate",
"employees", "employees",
"regcapital", // "regcapital",
"totalAssets", // "totalAssets",
"licenseStart", // "licenseStart",
"licenseEnd", // "licenseEnd",
]; ];
const ENTERPRISE_STATUS = [ const ENTERPRISE_STATUS = [
{ {
@ -128,9 +124,9 @@ function CorpInfo(props) {
// data.lrMobile = data.lrMobile && data.lrMobile.label; // data.lrMobile = data.lrMobile && data.lrMobile.label;
// data.contactsPhone = data.contactsPhone && data.contactsPhone.label; // data.contactsPhone = data.contactsPhone && data.contactsPhone.label;
data.region = data.village || data.street || data.country || data.city || data.province; // data.region = data.village || data.street || data.country || data.city || data.province;
setInfoData(data); setInfoData(data);
setCorpInfoId(res.data.corpinfoId) setCorpInfoId(res.data.corpinfoId);
setKeyId({ setKeyId({
id: res.data.corpinfoId, id: res.data.corpinfoId,
corpinfoId: res.data.userId, corpinfoId: res.data.userId,
@ -140,7 +136,7 @@ function CorpInfo(props) {
eqForeignKey: res.data.userId ? res.data.userId : "", eqForeignKey: res.data.userId ? res.data.userId : "",
}); });
data.INDUSTRYALL = getLastValidCorpTypeName(data); data.INDUSTRYALL = getLastValidCorpTypeName(data);
data.license = [data.licenseStart, data.licenseEnd]; // data.license = [data.licenseStart, data.licenseEnd];
data.scaleType = data.scaleType ?? 0; data.scaleType = data.scaleType ?? 0;
const hasLicenseFile = Array.isArray(licenseFile) && licenseFile.length > 0; const hasLicenseFile = Array.isArray(licenseFile) && licenseFile.length > 0;
@ -162,7 +158,6 @@ function CorpInfo(props) {
}); });
}; };
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
}, []); }, []);
const onSubmit = async (values) => { const onSubmit = async (values) => {
@ -220,22 +215,20 @@ function CorpInfo(props) {
}); });
values.corpinfoId = keyId.corpinfoId; values.corpinfoId = keyId.corpinfoId;
values.id = keyId.id; values.id = keyId.id;
values.licenseStart = values.license[0]; // values.licenseStart = values.license[0];
values.licenseEnd = values.license[1]; // values.licenseEnd = values.license[1];
delete values.license; delete values.license;
props["corpInfoEdit"](values).then((res) => { props["corpInfoEdit"](values).then((res) => {
if (res.success) { if (res.success) {
message.success("操作成功!"); message.success("操作成功!");
props["corpInfoDetails"]({ props["corpInfoDetails"]({
id: corpinfoId, id: corpinfoId,
}).then(res =>{ }).then((res) => {
res.data.region = res.data.village || res.data.street || res.data.country || res.data.city || res.data.province; // res.data.region = res.data.village || res.data.street || res.data.country || res.data.city || res.data.province;
setInfoData(res.data); setInfoData(res.data);
}); });
// data.lrMobile = data.lrMobile && data.lrMobile.label; // data.lrMobile = data.lrMobile && data.lrMobile.label;
// data.contactsPhone = data.contactsPhone && data.contactsPhone.label; // data.contactsPhone = data.contactsPhone && data.contactsPhone.label;
} }
}); });
}; };
@ -340,32 +333,30 @@ function CorpInfo(props) {
message: "请输入正确的统一社会信用代码", message: "请输入正确的统一社会信用代码",
}, },
], ],
componentProps: {
disabled: true,
},
},
{
label: "属地",
name: "region",
render: (
<AreaSelect
onGetNodePaths={nodes =>
setCityData(nodes)}
/>
),
},
{
label: "所属行业",
name: "INDUSTRYALL",
required: false,
render: (
<IndustrySelect
onGetNodePaths={(data) => {
setIndustryData(data);
}}
/>
),
}, },
// {
// label: "属地",
// name: "region",
// render: (
// <AreaSelect
// onGetNodePaths={nodes =>
// setCityData(nodes)}
// />
// ),
// },
// {
// label: "所属行业",
// name: "INDUSTRYALL",
// required: false,
// render: (
// <IndustrySelect
// onGetNodePaths={(data) => {
// setIndustryData(data);
// }}
// />
// ),
// },
// { // {
// label: "企业状态", // label: "企业状态",
@ -377,42 +368,42 @@ function CorpInfo(props) {
// disabled: true, // disabled: true,
// }, // },
// }, // },
{ // {
label: "经济类型", // label: "经济类型",
name: "ecoType", // name: "ecoType",
required: false, // required: false,
render: ( // render: (
<DictionarySelect // <DictionarySelect
dictValue="ECO_TYPE" // dictValue="ECO_TYPE"
onGetData={(data) => { // onGetData={(data) => {
setEcoTypeData(data); // setEcoTypeData(data);
}} // }}
/> // />
), // ),
}, // },
{ // {
name: "map", // name: "map",
customizeRender: true, // customizeRender: true,
render: <Map required={false} />, // render: <Map required={false} />,
span: 24, // span: 24,
}, // },
{ {
label: "企事业单位经营地址", label: "企事业单位经营地址",
name: "addressBusiness", name: "addressBusiness",
}, },
{ // {
label: "企业规模", // label: "企业规模",
name: "scale", // name: "scale",
//
render: ( // render: (
<DictionarySelect // <DictionarySelect
dictValue="scale" // dictValue="scale"
onGetData={(data) => { // onGetData={(data) => {
setScaleData(data); // setScaleData(data);
}} // }}
/> // />
), // ),
}, // },
{ {
label: "法定代表人", label: "法定代表人",
name: "lrName", name: "lrName",
@ -443,12 +434,12 @@ function CorpInfo(props) {
}, },
], ],
}, },
{ // {
label: "成立日期", // label: "成立日期",
name: "createDate", // name: "createDate",
//
render: FORM_ITEM_RENDER_ENUM.DATE, // render: FORM_ITEM_RENDER_ENUM.DATE,
}, // },
{ {
label: "职工人数(人)", label: "职工人数(人)",
@ -456,16 +447,16 @@ function CorpInfo(props) {
render: FORM_ITEM_RENDER_ENUM.NUMBER, render: FORM_ITEM_RENDER_ENUM.NUMBER,
}, },
{ // {
label: "注册资金(万元)", // label: "注册资金(万元)",
name: "regcapital", // name: "regcapital",
render: FORM_ITEM_RENDER_ENUM.NUMBER, // render: FORM_ITEM_RENDER_ENUM.NUMBER,
}, // },
{ // {
label: "资产总额(万元)", // label: "资产总额(万元)",
name: "totalAssets", // name: "totalAssets",
render: FORM_ITEM_RENDER_ENUM.NUMBER, // render: FORM_ITEM_RENDER_ENUM.NUMBER,
}, // },
{ {
label: "营业执照", label: "营业执照",
@ -481,11 +472,11 @@ function CorpInfo(props) {
/> />
), ),
}, },
{ // {
label: "营业执照有效期", // label: "营业执照有效期",
name: "license", // name: "license",
render: FORM_ITEM_RENDER_ENUM.DATE_RANGE, // render: FORM_ITEM_RENDER_ENUM.DATE_RANGE,
}, // },
{ {
name: "qrCode", name: "qrCode",
label: "企业二维码", label: "企业二维码",

View File

@ -14,11 +14,18 @@ import useGetFile from "zy-react-library/hooks/useGetFile";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import useUploadFile from "zy-react-library/hooks/useUploadFile"; import useUploadFile from "zy-react-library/hooks/useUploadFile";
import nation from "zy-react-library/json/nation.json"; import nation from "zy-react-library/json/nation.json";
import { ID_NUMBER, PHONE } from "zy-react-library/regular"; import { PHONE } from "zy-react-library/regular";
import { getLabelName, idCardGetDateAndGender } from "zy-react-library/utils"; import { getLabelName, idCardGetDateAndGender } from "zy-react-library/utils";
import { NS_USER } from "~/enumerate/namespace"; import { NS_USER } from "~/enumerate/namespace";
import { getAgeByIdCard, getBirthDateFromIdCard, useDebounce, UseDecodeIdCard } from "~/utils"; import {
getAgeByIdCard,
getBirthDateFromIdCard,
getChineseIdCardFullErrorMessage,
isValidChineseIdCard,
useDebounce,
UseDecodeIdCard,
} from "~/utils";
export const WHETHER_ENUM = [ export const WHETHER_ENUM = [
{ {
@ -189,6 +196,9 @@ function Add(props) {
]); ]);
return; return;
} }
if (!isValidChineseIdCard(debouncedUserIdCard)) {
return;
}
props["verifyUser"]({ props["verifyUser"]({
userIdCard: btoa(debouncedUserIdCard), userIdCard: btoa(debouncedUserIdCard),
id: queryParams["id"] ?? "", id: queryParams["id"] ?? "",
@ -259,11 +269,22 @@ function Add(props) {
if ("userIdCard" in changedValues) { if ("userIdCard" in changedValues) {
const newIdCard = changedValues.userIdCard; const newIdCard = changedValues.userIdCard;
setUserIdCardValue(newIdCard ?? ""); setUserIdCardValue(newIdCard ?? "");
if (newIdCard) { form.setFields([
{
name: "userIdCard",
errors: [],
},
]);
if (newIdCard && isValidChineseIdCard(newIdCard)) {
form.setFieldValue("sex", idCardGetDateAndGender(newIdCard).sex); form.setFieldValue("sex", idCardGetDateAndGender(newIdCard).sex);
form.setFieldValue("age", getAgeByIdCard(newIdCard)); form.setFieldValue("age", getAgeByIdCard(newIdCard));
form.setFieldValue("birthday", getBirthDateFromIdCard(newIdCard)); form.setFieldValue("birthday", getBirthDateFromIdCard(newIdCard));
} }
else {
form.setFieldValue("sex", undefined);
form.setFieldValue("age", undefined);
form.setFieldValue("birthday", undefined);
}
} }
if ("username" in changedValues) { if ("username" in changedValues) {
setUsernameValue(changedValues.username ?? ""); setUsernameValue(changedValues.username ?? "");
@ -369,10 +390,17 @@ function Add(props) {
{ {
name: "userIdCard", name: "userIdCard",
label: "身份证号", label: "身份证号",
validateTrigger: "onChange",
rules: [ rules: [
{ {
pattern: ID_NUMBER, validateTrigger: "onChange",
message: "请输入正确的身份证号", validator: (_, value) => {
const errorMessage = getChineseIdCardFullErrorMessage(value);
if (!errorMessage) {
return Promise.resolve();
}
return Promise.reject(new Error(errorMessage));
},
}, },
], ],
}, },
@ -417,14 +445,14 @@ function Add(props) {
disabled: true, disabled: true,
}, },
}, },
{ // {
name: "locationAddress", // name: "locationAddress",
label: "户口所在地", // label: "户口所在地",
}, // },
{ // {
name: "currentAddress", // name: "currentAddress",
label: "现住址", // label: "现住址",
}, // },
{ {
name: "culturalLevel", name: "culturalLevel",
label: "文化程度", label: "文化程度",
@ -437,12 +465,12 @@ function Add(props) {
/> />
), ),
}, },
{ // {
name: "maritalStatus", // name: "maritalStatus",
label: "婚姻状况", // label: "婚姻状况",
render: FORM_ITEM_RENDER_ENUM.RADIO, // render: FORM_ITEM_RENDER_ENUM.RADIO,
items: MARITAL_STATUS_ENUM, // items: MARITAL_STATUS_ENUM,
}, // },
{ {
name: "politicalAffiliation", name: "politicalAffiliation",
label: "政治面貌", label: "政治面貌",
@ -458,7 +486,6 @@ function Add(props) {
{ {
name: "postName", name: "postName",
label: "岗位(工种)", label: "岗位(工种)",
required: false,
}, },
{ {
name: "flowFlag", name: "flowFlag",

View File

@ -50,7 +50,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "确定要重置密码为Aa@12345678吗", content: "确定要重置密码为Cc@12345678吗",
onOk: () => { onOk: () => {
props["userChangePassword"]({ props["userChangePassword"]({
id, id,
@ -516,22 +516,22 @@ function AddModalComponent(props) {
label: "民族", label: "民族",
children: info.nationName, children: info.nationName,
}, },
{ // {
label: "婚姻状况", // label: "婚姻状况",
children: info.maritalStatusName, // children: info.maritalStatusName,
}, // },
{ {
label: "政治面貌", label: "政治面貌",
children: info.politicalAffiliationName, children: info.politicalAffiliationName,
}, },
{ // {
label: "户口所在地", // label: "户口所在地",
children: info.locationAddress, // children: info.locationAddress,
}, // },
{ // {
label: "现住址", // label: "现住址",
children: info.currentAddress, // children: info.currentAddress,
}, // },
{ {
label: "文化程度", label: "文化程度",
children: info.culturalLevelName, children: info.culturalLevelName,

View File

@ -80,7 +80,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "是否重置密码为Aa@12345678", content: "是否重置密码为Bb@12345678",
onOk: () => { onOk: () => {
props["corpInfoChangePassword"]({ props["corpInfoChangePassword"]({
id, id,

View File

@ -6,8 +6,6 @@ import FormBuilder from "zy-react-library/components/FormBuilder";
import AddIcon from "zy-react-library/components/Icon/AddIcon"; import AddIcon from "zy-react-library/components/Icon/AddIcon";
import Search from "zy-react-library/components/Search"; import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import AreaSelect from "zy-react-library/components/SelectTree/Area";
import Table from "zy-react-library/components/Table"; import Table from "zy-react-library/components/Table";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import useTable from "zy-react-library/hooks/useTable"; import useTable from "zy-react-library/hooks/useTable";
@ -33,7 +31,7 @@ const ENTERPRISE_TYPE = [
]; ];
function List(props) { function List(props) {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [cityData, setCityData] = useState([]); // const [cityData, setCityData] = useState([]);
const { tableProps, getData } = useTable(props["corpInfoList"], { const { tableProps, getData } = useTable(props["corpInfoList"], {
form, form,
transform: (formData) => { transform: (formData) => {
@ -42,11 +40,11 @@ function List(props) {
enterpriseType: 3, enterpriseType: 3,
geCreateTime: formData.CreateTime?.[0], geCreateTime: formData.CreateTime?.[0],
leCreateTime: formData.CreateTime?.[1], leCreateTime: formData.CreateTime?.[1],
eqProvince: formData.cityRecord?.[0], // eqProvince: formData.cityRecord?.[0],
eqCity: formData.cityRecord?.[1], // eqCity: formData.cityRecord?.[1],
eqCountry: formData.cityRecord?.[2], // eqCountry: formData.cityRecord?.[2],
eqStreet: formData.cityRecord?.[3], // eqStreet: formData.cityRecord?.[3],
eqVillage: formData.cityRecord?.[4], // eqVillage: formData.cityRecord?.[4],
}; };
}, },
@ -56,7 +54,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "是否重置密码为Aa@12345678", content: "是否重置密码为Cc@12345678",
onOk: () => { onOk: () => {
props["corpInfoChangePassword"]({ props["corpInfoChangePassword"]({
id, id,
@ -93,21 +91,21 @@ function List(props) {
}, },
}); });
}; };
const onFinish = async () => { // const onFinish = async () => {
// 处理属地查询 // // 处理属地查询
const arr = []; // const arr = [];
cityData.forEach((item) => { // cityData.forEach((item) => {
arr.push(item.value); // arr.push(item.value);
}); // });
form.setFieldValue("cityRecord", arr); // form.setFieldValue("cityRecord", arr);
getData(); // getData();
}; // };
const onReset = () => { // const onReset = () => {
setCityData([]); // setCityData([]);
//
form.setFieldValue("cityRecord", []); // form.setFieldValue("cityRecord", []);
}; // };
return ( return (
<div <div
style={{ style={{
@ -117,23 +115,23 @@ function List(props) {
<Search <Search
form={form} form={form}
onFinish={() => onFinish()} onFinish={getData}
onReset={onReset} // onReset={onReset}
options={[ options={[
{ {
name: "likecorpName", name: "likecorpName",
label: "企业名称", label: "企业名称",
}, },
{ // {
name: "cityData", // name: "cityData",
label: "属地", // label: "属地",
render: ( // render: (
<AreaSelect // <AreaSelect
onGetNodePaths={nodes => // onGetNodePaths={nodes =>
setCityData(nodes)} // setCityData(nodes)}
/> // />
), // ),
}, // },
{ {
name: "CreateTime", name: "CreateTime",
label: "开户时间", label: "开户时间",
@ -145,12 +143,12 @@ function List(props) {
render: FORM_ITEM_RENDER_ENUM.SELECT, render: FORM_ITEM_RENDER_ENUM.SELECT,
items: ENTERPRISE_TYPE, items: ENTERPRISE_TYPE,
}, },
{ // {
name: "cityRecord", // name: "cityRecord",
label: "属地", // label: "属地",
render: FORM_ITEM_RENDER_ENUM.SELECT, // render: FORM_ITEM_RENDER_ENUM.SELECT,
onlyForLabel: true, // onlyForLabel: true,
}, // },
]} ]}
@ -180,14 +178,14 @@ function List(props) {
title: "企业名称", title: "企业名称",
dataIndex: "corpName", dataIndex: "corpName",
}, },
{ // {
title: "属地", // title: "属地",
dataIndex: "cityName", // dataIndex: "cityName",
width: 300, // width: 300,
render: (_, record) => ( // render: (_, record) => (
<div>{getAreaNamePath(record)}</div> // <div>{getAreaNamePath(record)}</div>
), // ),
}, // },
{ {
title: "创建单位", title: "创建单位",
dataIndex: "tenantName", dataIndex: "tenantName",
@ -453,6 +451,7 @@ function AddModalComponent(props) {
{ {
name: "code", name: "code",
label: "统一社会信用代码", label: "统一社会信用代码",
required: false,
rules: [ rules: [
{ {
pattern: UNIFIED_SOCIAL_CREDIT_CODE, pattern: UNIFIED_SOCIAL_CREDIT_CODE,
@ -460,23 +459,24 @@ function AddModalComponent(props) {
}, },
], ],
}, },
{ // {
name: "ecoType", // name: "ecoType",
label: "经济类型", // label: "经济类型",
render: ( // required: false,
<DictionarySelect // render: (
dictValue="ECO_TYPE" // <DictionarySelect
onGetLabel={(label) => { // dictValue="ECO_TYPE"
form.setFieldValue("ecoTypeName", label); // onGetLabel={(label) => {
}} // form.setFieldValue("ecoTypeName", label);
/> // }}
), // />
}, // ),
{ // },
name: "ecoTypeName", // {
label: "经济类型名称", // name: "ecoTypeName",
onlyForLabel: true, // label: "经济类型名称",
}, // onlyForLabel: true,
// },
{ {
name: "type", name: "type",
label: "相关方类型", label: "相关方类型",

View File

@ -10,7 +10,7 @@ import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import { getLabelName } from "zy-react-library/utils"; import { getLabelName } from "zy-react-library/utils";
import { NS_ENTERPRISE } from "~/enumerate/namespace"; import { NS_ENTERPRISE } from "~/enumerate/namespace";
import { getAreaNamePath, getCorpTypeNamePath } from "~/utils"; // import { getAreaNamePath, getCorpTypeNamePath } from "~/utils";
const ENTERPRISE_TYPE = [ const ENTERPRISE_TYPE = [
{ {
@ -103,33 +103,33 @@ function View(props) {
children: info.code, children: info.code,
}, },
{ // {
label: "属地", // label: "属地",
children: <div>{getAreaNamePath(info)}</div>, // children: <div>{getAreaNamePath(info)}</div>,
}, // },
//
{ // {
label: "所属行业", // label: "所属行业",
children: <div>{getCorpTypeNamePath(info)}</div>, // children: <div>{getCorpTypeNamePath(info)}</div>,
}, // },
//
{ // {
label: "经济类型", // label: "经济类型",
children: info.ecoTypeName, // children: info.ecoTypeName,
}, // },
{ // {
label: "经度/纬度", // label: "经度/纬度",
children: info.longitude && `${info.longitude}/${info.latitude}`, // children: info.longitude && `${info.longitude}/${info.latitude}`,
}, // },
{ {
label: "单位经营地址", label: "单位经营地址",
children: info.addressBusiness, children: info.addressBusiness,
}, },
{ // {
label: "企业规模", // label: "企业规模",
children: info.scaleName, // children: info.scaleName,
}, // },
{ {
label: "法定代表人", label: "法定代表人",
@ -189,10 +189,10 @@ function View(props) {
</div> </div>
), ),
}, },
{ // {
label: "成立日期", // label: "成立日期",
children: info.createDate, // children: info.createDate,
}, // },
{ {
label: "职工人数(人)", label: "职工人数(人)",
children: info.employees, children: info.employees,
@ -202,14 +202,14 @@ function View(props) {
// children: info.areaCovered, // children: info.areaCovered,
// }, // },
{ // {
label: "注册资金(万元)", // label: "注册资金(万元)",
children: info.regcapital, // children: info.regcapital,
}, // },
{ // {
label: "资产总额(万元)", // label: "资产总额(万元)",
children: info.totalAssets, // children: info.totalAssets,
}, // },
{ {
label: "企业二维码", label: "企业二维码",

View File

@ -30,36 +30,36 @@ const ENTERPRISE_TYPE = [
function List(props) { function List(props) {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [cityData, setCityData] = useState([]); // const [cityData, setCityData] = useState([]);
const { tableProps, getData } = useTable(props["corpUserMiddlePage"], { const { tableProps, getData } = useTable(props["corpUserMiddlePage"], {
form, form,
transform: (formData) => { transform: (formData) => {
return { return {
...formData, ...formData,
enterpriseType: 3, enterpriseType: 3,
eqProvince: formData.cityRecord?.[0], // eqProvince: formData.cityRecord?.[0],
eqCity: formData.cityRecord?.[1], // eqCity: formData.cityRecord?.[1],
eqCountry: formData.cityRecord?.[2], // eqCountry: formData.cityRecord?.[2],
eqStreet: formData.cityRecord?.[3], // eqStreet: formData.cityRecord?.[3],
eqVillage: formData.cityRecord?.[4], // eqVillage: formData.cityRecord?.[4],
}; };
}, },
}); });
const onFinish = async () => { // const onFinish = async () => {
// 处理属地查询 // // 处理属地查询
const arr = []; // const arr = [];
cityData.forEach((item) => { // cityData.forEach((item) => {
arr.push(item.value); // arr.push(item.value);
}); // });
form.setFieldValue("cityRecord", arr); // form.setFieldValue("cityRecord", arr);
getData(); // getData();
}; // };
const onReset = () => { // const onReset = () => {
setCityData([]); // setCityData([]);
//
form.setFieldValue("cityRecord", []); // form.setFieldValue("cityRecord", []);
}; // };
return ( return (
<div <div
style={{ style={{
@ -68,30 +68,30 @@ function List(props) {
> >
<Search <Search
form={form} form={form}
onFinish={() => onFinish()} onFinish={getData}
onReset={onReset} // onReset={onReset}
options={[ options={[
{ {
name: "likeCorpName", name: "likeCorpName",
label: "企业名称", label: "企业名称",
}, },
{ // {
name: "cityData", // name: "cityData",
label: "属地", // label: "属地",
render: ( // render: (
<AreaSelect // <AreaSelect
onGetNodePaths={nodes => // onGetNodePaths={nodes =>
setCityData(nodes)} // setCityData(nodes)}
/> // />
), // ),
}, // },
{ name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE }, { name: "eqType", label: "相关方类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE },
{ // {
name: "cityRecord", // name: "cityRecord",
label: "属地", // label: "属地",
render: FORM_ITEM_RENDER_ENUM.SELECT, // render: FORM_ITEM_RENDER_ENUM.SELECT,
onlyForLabel: true, // onlyForLabel: true,
}, // },
]} ]}
/> />
<Table <Table
@ -112,13 +112,13 @@ function List(props) {
), ),
width: 120, width: 120,
}, },
{ // {
title: "属地", // title: "属地",
dataIndex: "cityName", // dataIndex: "cityName",
render: (_, record) => ( // render: (_, record) => (
<div>{getAreaNamePath(record)}</div> // <div>{getAreaNamePath(record)}</div>
), // ),
}, // },
{ {
title: "创建单位", title: "创建单位",
dataIndex: "tenantName", dataIndex: "tenantName",

View File

@ -49,7 +49,7 @@ function List(props) {
const onResetPassword = (id) => { const onResetPassword = (id) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: "提示",
content: "确定要重置密码为Aa@12345678吗", content: "确定要重置密码为Cc@12345678吗",
onOk: () => { onOk: () => {
props["userChangePassword"]({ props["userChangePassword"]({
id, id,
@ -362,22 +362,22 @@ function AddModalComponent(props) {
label: "民族", label: "民族",
children: info.nationName, children: info.nationName,
}, },
{ // {
label: "婚姻状况", // label: "婚姻状况",
children: info.maritalStatusName, // children: info.maritalStatusName,
}, // },
{ {
label: "政治面貌", label: "政治面貌",
children: info.politicalAffiliationName, children: info.politicalAffiliationName,
}, },
{ // {
label: "户口所在地", // label: "户口所在地",
children: info.locationAddress, // children: info.locationAddress,
}, // },
{ // {
label: "现住址", // label: "现住址",
children: info.currentAddress, // children: info.currentAddress,
}, // },
{ {
label: "文化程度", label: "文化程度",
children: info.culturalLevelName, children: info.culturalLevelName,

View File

@ -1,5 +1,103 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
/**
* 校验中国大陆18位身份证号
* 包含地址码年份(18/19/20开头)月份日期顺序码和校验位
* @param {string} idCard
* @returns {boolean}
*/
export function isValidChineseIdCard(idCard) {
if (!idCard || typeof idCard !== "string") {
return false;
}
const value = idCard.trim();
if (!isValidChineseIdCardFormat(value)) {
return false;
}
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const checkCodeMap = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
const sum = value
.substring(0, 17)
.split("")
.reduce((total, num, index) => total + Number(num) * weights[index], 0);
return checkCodeMap[sum % 11] === value[17].toUpperCase();
}
export function isValidChineseIdCardFormat(idCard) {
if (!idCard || typeof idCard !== "string") {
return false;
}
const value = idCard.trim();
const pattern = /^[1-9][0-9]{5}(18|19|20)[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])[0-9]{3}[0-9Xx]$/;
if (!pattern.test(value)) {
return false;
}
const year = Number.parseInt(value.substring(6, 10), 10);
const month = Number.parseInt(value.substring(10, 12), 10);
const day = Number.parseInt(value.substring(12, 14), 10);
const date = new Date(year, month - 1, day);
return (
date.getFullYear() === year
&& date.getMonth() === month - 1
&& date.getDate() === day
);
}
export function getChineseIdCardInputErrorMessage(idCard) {
if (!idCard || typeof idCard !== "string") {
return "";
}
const value = idCard.trim();
if (!/^[0-9Xx]*$/.test(value)) {
return "身份证号只能输入数字或X";
}
if (value.length > 18) {
return "身份证号长度不能超过18位";
}
if (value.length < 18) {
return "";
}
if (!isValidChineseIdCardFormat(value)) {
return "请输入正确的18位身份证号";
}
return "";
}
export function getChineseIdCardFullErrorMessage(idCard) {
const inputErrorMessage = getChineseIdCardInputErrorMessage(idCard);
if (inputErrorMessage) {
return inputErrorMessage;
}
if (!idCard || typeof idCard !== "string") {
return "";
}
const value = idCard.trim();
if (value.length < 18) {
return "";
}
if (!isValidChineseIdCard(value)) {
return "身份证校验位不正确";
}
return "";
}
/** /**
* 根据身份证号计算年龄 * 根据身份证号计算年龄
* @param {string} idCard - 18位身份证号码 * @param {string} idCard - 18位身份证号码