修改 上传功能
parent
2f3b0dd596
commit
0430110926
|
|
@ -42,3 +42,4 @@ export const corpUserMiddlePage = declareRequest(
|
|||
"enterpriseLoading",
|
||||
"Post > @/basic-info/corpInfo/corpUserMiddlePage",
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,38 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
|||
import { Button, Descriptions, Divider } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import { NS_ENTERPRISE } from "~/enumerate/namespace";
|
||||
|
||||
function Info(props) {
|
||||
const [info, setInfo] = useState({});
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const getCorpTypeNamePath = (item) => {
|
||||
const names = [
|
||||
item.corpTypeName,
|
||||
item.corpType2Name,
|
||||
item.corpType3Name,
|
||||
item.corpType4Name,
|
||||
].filter(name => name != null && name !== "");
|
||||
|
||||
return names.join("/");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const res = await props.corpInfoRemoveDetails({ id: "1985906265017954306" });
|
||||
|
||||
const licenseFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: res.data.corpinfoId });
|
||||
const imgArr = [];
|
||||
|
||||
licenseFile.forEach((item) => {
|
||||
imgArr.push(item.url);
|
||||
});
|
||||
|
||||
res.data.licenseFile = imgArr;
|
||||
setInfo(res.data);
|
||||
console.log(res.data);
|
||||
// 不要在这里 log info,它还是旧的
|
||||
};
|
||||
fetchData();
|
||||
|
|
@ -21,10 +45,11 @@ function Info(props) {
|
|||
labelStyle={{ width: 200 }}
|
||||
column={2}
|
||||
bordered
|
||||
loading={getFileLoading}
|
||||
items={[
|
||||
{ label: "企业名称", children: info.corpName && info.corpName },
|
||||
{ label: "统一社会信用代码", children: info.code },
|
||||
{ label: "所属区域", children: info.companyArea },
|
||||
{ label: "所属区域", children: info.cityName },
|
||||
{ label: "邮政编码", children: info.postalCode },
|
||||
{ label: "成立时间", children: info.createDate },
|
||||
{ label: "规模", children: info.scaleName },
|
||||
|
|
@ -35,17 +60,17 @@ function Info(props) {
|
|||
{ label: "资产总额(万元)", children: info.totalAssets },
|
||||
{ label: "注册资金(万元)", children: info.regcapital },
|
||||
{ label: "经济类型", children: info.ecoTypeName },
|
||||
{ label: "所属行业", children: info.regcapital },
|
||||
{ label: "所属行业", children: <div>{getCorpTypeNamePath(info)}</div> },
|
||||
{ label: "法定代表人", children: info.lrName },
|
||||
{ label: "法人手机号", children: info.lrMobile },
|
||||
{ label: "主要负责人", children: info.contacts },
|
||||
{ label: "主要负责人手机号", children: info.contactsPhone },
|
||||
{ label: "安全负责人", children: info.safetyName },
|
||||
{ label: "安全负责人手机号", children: info.safetyPhone },
|
||||
{ label: "是否规模以上", children: <span>{info.scaleType === 1 ? "是" : info.scaleType === 0 ? "否" : ""}</span> },
|
||||
{ label: "是否规模以上", children: <div>{info.scaleType === 1 ? "是" : info.scaleType === 0 ? "否" : ""}</div> },
|
||||
{ label: "企事业单位经营地址", children: info.addressBusiness },
|
||||
{ label: "企业状态", children: info.corpStateName },
|
||||
{ label: "营业执照", children: "Zhou", render: <TooltipPreviewImg files={{ file: "" }} /> },
|
||||
{ label: "营业执照", children: <TooltipPreviewImg files={info.licenseFile} /> },
|
||||
{ label: "营业执照有效期", children: `${info.licenseStart} 至 ${info.licenseEnd}` },
|
||||
]}
|
||||
/>
|
||||
|
|
@ -75,7 +100,7 @@ function Info(props) {
|
|||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
props.history.push("./update");
|
||||
props.history.push(`./update?id=${info.id}`);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@ import { useEffect, useState } from "react";
|
|||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||
import Map from "zy-react-library/components/Map";
|
||||
import Area from "zy-react-library/components/SelectTree/Area";
|
||||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { PHONE, POSTAL_CODE, UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_ENTERPRISE } from "~/enumerate/namespace";
|
||||
|
|
@ -31,13 +35,44 @@ const WHETHER_ENUM = [
|
|||
|
||||
function Update(props) {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const queryParams = useGetUrlQuery();
|
||||
const [scaleData, setScaleData] = useState([]);
|
||||
const [ecoTypeData, setEcoTypeData] = useState([]);
|
||||
const [cityData, setCityData] = useState([]);
|
||||
const [industryData, setIndustryData] = useState([]);
|
||||
const [keyId, setKeyId] = useState("");
|
||||
|
||||
const [deleteLicenseImageFiles, setDeleteLicenseImageFiles] = useState([]);
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const onSubmit = async (values) => {
|
||||
values.id = "1985906265017954306";
|
||||
await deleteFile({ single: false, files: deleteLicenseImageFiles });
|
||||
values.id = queryParams["id"];
|
||||
values.ecoTypeName = getLabelName({ status: values.ecoType, list: ecoTypeData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.scaleName = getLabelName({ status: values.scale, list: scaleData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.corpStateName = getLabelName({ status: values.corpState, list: ENTERPRISE_STATUS, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.cityName = getLabelName({ status: values.city, list: cityData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
|
||||
if (industryData.length > 0) {
|
||||
values.corpType = industryData[0].dictValue;
|
||||
values.corpTypeName = industryData[0].dictLabel;
|
||||
values.corpType2 = industryData[1] && industryData[1].dictValue;
|
||||
values.corpType2Name = industryData[1] && industryData[1].dictLabel;
|
||||
values.corpType3 = industryData[2] && industryData[2].dictValue;
|
||||
values.corpType3Name = industryData[2] && industryData[2].dictLabel;
|
||||
values.corpType4 = industryData[3] && industryData[3].dictValue;
|
||||
values.corpType4Name = industryData[3] && industryData[3].dictLabel;
|
||||
}
|
||||
|
||||
await uploadFile({
|
||||
single: false,
|
||||
files: values.licenseFile,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: keyId },
|
||||
});
|
||||
|
||||
values.licenseStart = values.license[0];
|
||||
values.licenseEnd = values.license[1];
|
||||
delete values.license;
|
||||
|
|
@ -46,11 +81,44 @@ function Update(props) {
|
|||
window.history.back();
|
||||
});
|
||||
};
|
||||
function getLastValidCorpTypeName(item) {
|
||||
// 按层级顺序排列
|
||||
const names = [
|
||||
item.corpType,
|
||||
item.corpType2,
|
||||
item.corpType3,
|
||||
item.corpType4,
|
||||
];
|
||||
|
||||
// 从后往前找第一个非空值
|
||||
for (let i = names.length - 1; i >= 0; i--) {
|
||||
if (names[i] != null && names[i] !== "") {
|
||||
return names[i];
|
||||
}
|
||||
}
|
||||
|
||||
// 全为空则返回空字符串或默认值
|
||||
return "";
|
||||
}
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const res = await props["corpInfoRemoveDetails"]({ id: "1985906265017954306" });
|
||||
res.data.scaleType = res.data.scaleType ?? 0;
|
||||
const { data } = await props["corpInfoRemoveDetails"]({ id: queryParams["id"] });
|
||||
setKeyId(data.corpinfoId);
|
||||
const licenseFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: keyId });
|
||||
|
||||
data.INDUSTRYALL = getLastValidCorpTypeName(data);
|
||||
data.license = [data.licenseStart, data.licenseEnd];
|
||||
data.scaleType = data.scaleType ?? 0;
|
||||
const values = {
|
||||
licenseFile,
|
||||
|
||||
...data,
|
||||
};
|
||||
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
|
||||
});
|
||||
// res.data.whetherHygieneFlag = res.data.whetherHygieneFlag ?? 0;
|
||||
// res.data.whetherHazardsFlag = res.data.whetherHazardsFlag ?? 0;
|
||||
// res.data.whetherScarceFlag = res.data.whetherScarceFlag ?? 0;
|
||||
|
|
@ -65,9 +133,7 @@ function Update(props) {
|
|||
// res.data.whetherActinogenFlag = res.data.whetherActinogenFlag ?? 0;
|
||||
// res.data.whetherLiquidammoniaFlag = res.data.whetherLiquidammoniaFlag ?? 0;
|
||||
// res.data.whetherPipeline = res.data.whetherPipeline ?? 0;
|
||||
res.data.license = [res.data.licenseStart, res.data.licenseEnd];
|
||||
|
||||
form.setFieldsValue(res.data);
|
||||
// 不要在这里 log info,它还是旧的
|
||||
};
|
||||
fetchData();
|
||||
|
|
@ -77,7 +143,7 @@ function Update(props) {
|
|||
<HeaderBack title="编辑" />
|
||||
<div style={{ paddingBottom: 10 }}>
|
||||
<FormBuilder
|
||||
loading={props.enterprise.enterpriseLoading}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.enterprise.enterpriseLoading}
|
||||
values={{
|
||||
scaleType: 0,
|
||||
whetherHygieneFlag: 0,
|
||||
|
|
@ -106,7 +172,13 @@ function Update(props) {
|
|||
name: "code",
|
||||
rules: [{ pattern: UNIFIED_SOCIAL_CREDIT_CODE, message: "请输入正确的社会统一信用代码" }],
|
||||
},
|
||||
{ label: "所属区域", required: false, name: "POSSESSION", render: <Area /> },
|
||||
{ label: "所属区域", required: false, name: "city", render: (
|
||||
<DictionarySelect
|
||||
dictValue="res_region_enum"
|
||||
onGetData={(data) => { setCityData(data); }}
|
||||
/>
|
||||
|
||||
) },
|
||||
{
|
||||
label: "邮政编码",
|
||||
name: "postalCode",
|
||||
|
|
@ -149,9 +221,14 @@ function Update(props) {
|
|||
{
|
||||
label: "所属行业",
|
||||
name: "INDUSTRYALL",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ bianma: "1-10人", name: "1-10人" }],
|
||||
render: (
|
||||
<DictionarySelect
|
||||
dictValue="config_industry_enum"
|
||||
onGetNodePaths={(node) => {
|
||||
setIndustryData(node);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ label: "法定代表人", name: "lrName", required: false },
|
||||
{
|
||||
|
|
@ -179,9 +256,13 @@ function Update(props) {
|
|||
{ label: "企事业单位经营地址", name: "addressBusiness" },
|
||||
{
|
||||
label: "营业执照",
|
||||
name: "BUS_IMAGES",
|
||||
required: false,
|
||||
render: <Upload fileType="image" />,
|
||||
name: "licenseFile",
|
||||
render: (
|
||||
<Upload onGetRemoveFile={(file) => {
|
||||
setDeleteLicenseImageFiles([...deleteLicenseImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "营业执照有效期",
|
||||
|
|
|
|||
|
|
@ -165,8 +165,6 @@ function AddModalComponent(props) {
|
|||
};
|
||||
const onSubmit = async (values) => {
|
||||
values.levelName = getLabelName({ status: values.level, list: levelData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.level = 1;
|
||||
values.levelName = "11";
|
||||
values.parentId = props.parentId;
|
||||
|
||||
if (props.currentId) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import HeaderBack from "zy-react-library/components/HeaderBack";
|
|||
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import nation from "zy-react-library/json/nation.json";
|
||||
import { ID_NUMBER, PHONE } from "zy-react-library/regular";
|
||||
import { getLabelName, idCardGetDateAndGender } from "zy-react-library/utils";
|
||||
|
|
@ -29,13 +31,39 @@ function Add(props) {
|
|||
const [userTypeData, setUserTypeData] = useState([]);
|
||||
const [userID, setUserID] = useState(null);
|
||||
const queryParams = useGetUrlQuery();
|
||||
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
|
||||
useEffect(() => {
|
||||
if (queryParams["id"]) {
|
||||
const fetchData = async () => {
|
||||
const res = await props["userDetails"]({ id: queryParams["id"] });
|
||||
console.log(res.data);
|
||||
setUserID(res.data.userId);
|
||||
form.setFieldsValue(res.data);
|
||||
const { data } = await props["userDetails"]({ id: queryParams["id"] });
|
||||
// const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["13"], eqForeignKey: queryParams["id"] });
|
||||
const filepath = data.filepath
|
||||
? [
|
||||
{
|
||||
name: data.name,
|
||||
url: data.filepath,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
const values = {
|
||||
filepath,
|
||||
|
||||
...data,
|
||||
};
|
||||
values.faceFile = [
|
||||
{
|
||||
name: data.name,
|
||||
url: data.filepath,
|
||||
},
|
||||
];
|
||||
setUserID(data.userId);
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
|
||||
});
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
|
|
@ -60,8 +88,12 @@ function Add(props) {
|
|||
values.personnelTypeName = getLabelName({ status: values.personnelType, list: userTypeData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
// values.rank_level_name = getLabelName({ status: values.rank_level, list: rankData, idKey: "dictValue", nameKey: "labelKey" });
|
||||
idCardGetDateAndGender(values.userIdCard);
|
||||
|
||||
console.log(idCardGetDateAndGender(values.userIdCard));
|
||||
const { filePath } = await uploadFile({
|
||||
single: true,
|
||||
files: values.faceFile,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["13"], foreignKey: userID },
|
||||
});
|
||||
values.userAvatarUrl = filePath;
|
||||
values.mainCorpFlag = 0;
|
||||
values.userType = 2;
|
||||
if (queryParams["id"]) {
|
||||
|
|
@ -106,7 +138,7 @@ function Add(props) {
|
|||
form={form}
|
||||
onFinish={onSubmit}
|
||||
labelCol={{ span: 6 }}
|
||||
loading={props.user.userLoading}
|
||||
loading={uploadFileLoading || props.user.userLoading}
|
||||
options={[
|
||||
{ name: "roleId", label: "用户角色", required: false, render: FORM_ITEM_RENDER_ENUM.SELECT, items: rolesData, itemsField: { labelKey: "roleName", valueKey: "id" } },
|
||||
{ name: "departmentId", label: "所属部门", render: <DepartmentSelectTree onGetNodePaths={fnChoiceDepartment} /> },
|
||||
|
|
@ -158,6 +190,7 @@ function Add(props) {
|
|||
render: (
|
||||
<Upload
|
||||
size={4}
|
||||
maxCount={1}
|
||||
fileType="image"
|
||||
tipContent={(
|
||||
<div style={{ lineHeight: 1.6, color: "red", fontSize: 12 }}>
|
||||
|
|
@ -168,6 +201,10 @@ function Add(props) {
|
|||
<div>* 人脸需双眼睁开、表情自然、露额,头发不要遮挡</div>
|
||||
</div>
|
||||
)}
|
||||
onRemove={() => {
|
||||
form.setFieldValue("faceFile");
|
||||
return false;
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import ImportFile from "zy-react-library/components/ImportFile";
|
|||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob";
|
||||
import useImportFile from "zy-react-library/hooks/useImportFile";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { NS_USER } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -17,6 +19,9 @@ function List(props) {
|
|||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
const { downloadBlob } = useDownloadBlob();
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||
const { importFile } = useImportFile();
|
||||
const { tableProps, getData } = useTable(props["userList"], {
|
||||
form,
|
||||
transform: (formData) => {
|
||||
|
|
@ -44,13 +49,14 @@ function List(props) {
|
|||
title: "提示",
|
||||
content: "确定要导出到excel吗?",
|
||||
onOk: () => {
|
||||
|
||||
downloadBlob(`/basic-info/user/exportUserTable?ids=${selectedRowKeys.length !== 0 ? selectedRowKeys.join(",") : ""}`, { name: "用户" });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const onImportFileConfirm = (values) => {
|
||||
console.log(values);
|
||||
importFile("/basic-info/user/importUserTable", { files: values.file });
|
||||
message.success("导入成功");
|
||||
};
|
||||
const onTreeChange = (selectedKeys) => {
|
||||
|
|
@ -73,6 +79,10 @@ function List(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
rowSelection={{
|
||||
selectedRowKeys,
|
||||
onChange: selectedRowKeys => setSelectedRowKeys(selectedRowKeys),
|
||||
}}
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
|
|
@ -190,7 +200,7 @@ function AddModalComponent(props) {
|
|||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否部门负责人", children: <div>{info.departmentLeaderFlag === 1 ? "是" : "否"}</div> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "姓名", children: info.name },
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import Map from "zy-react-library/components/Map";
|
|||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { PHONE, POSTAL_CODE, UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_ENTERPRISE } from "~/enumerate/namespace";
|
||||
|
|
@ -32,21 +36,81 @@ const WHETHER_ENUM = [
|
|||
function CorpInfo(props) {
|
||||
const [corpInfoQrCodeOpen, setCorpInfoQrCodeOpen] = useState(false);
|
||||
const [form] = Form.useForm();
|
||||
const [deleteHiddenImageFiles, setDeleteHiddenImageFiles] = useState([]);
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const [keyId, setKeyId] = useState("");
|
||||
const [scaleData, setScaleData] = useState([]);
|
||||
const [ecoTypeData, setEcoTypeData] = useState([]);
|
||||
const [industryData, setIndustryData] = useState([]);
|
||||
const [cityData, setCityData] = useState([]);
|
||||
|
||||
function getLastValidCorpTypeName(item) {
|
||||
// 按层级顺序排列
|
||||
const names = [
|
||||
item.corpType,
|
||||
item.corpType2,
|
||||
item.corpType3,
|
||||
item.corpType4,
|
||||
];
|
||||
|
||||
// 从后往前找第一个非空值
|
||||
for (let i = names.length - 1; i >= 0; i--) {
|
||||
if (names[i] != null && names[i] !== "") {
|
||||
return names[i];
|
||||
}
|
||||
}
|
||||
|
||||
// 全为空则返回空字符串或默认值
|
||||
return "";
|
||||
}
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const res = await props.corpInfoRemoveDetails({ id: "1985906265017954306" });
|
||||
res.data.license = [res.data.licenseStart, res.data.licenseEnd];
|
||||
form.setFieldsValue(res.data);
|
||||
// const res = await props.corpInfoRemoveDetails({ id: "1985906265017954306" });
|
||||
const { data } = await props["corpInfoRemoveDetails"]({ id: "1985906265017954306" });
|
||||
setKeyId(data.corpinfoId);
|
||||
const licenseFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: keyId });
|
||||
|
||||
data.INDUSTRYALL = getLastValidCorpTypeName(data);
|
||||
data.license = [data.licenseStart, data.licenseEnd];
|
||||
data.scaleType = data.scaleType ?? 0;
|
||||
const values = {
|
||||
licenseFile,
|
||||
|
||||
...data,
|
||||
};
|
||||
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
|
||||
});
|
||||
};
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
const onSubmit = async (values) => {
|
||||
await deleteFile({ single: false, files: deleteHiddenImageFiles });
|
||||
values.ecoTypeName = getLabelName({ status: values.ecoType, list: ecoTypeData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.scaleName = getLabelName({ status: values.scale, list: scaleData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.corpStateName = getLabelName({ status: values.corpState, list: ENTERPRISE_STATUS, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.cityName = getLabelName({ status: values.city, list: cityData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
if (industryData.length > 0) {
|
||||
values.corpType = industryData[0].dictValue;
|
||||
values.corpTypeName = industryData[0].dictLabel;
|
||||
values.corpType2 = industryData[1] && industryData[1].dictValue;
|
||||
values.corpType2Name = industryData[1] && industryData[1].dictLabel;
|
||||
values.corpType3 = industryData[2] && industryData[2].dictValue;
|
||||
values.corpType3Name = industryData[2] && industryData[2].dictLabel;
|
||||
values.corpType4 = industryData[3] && industryData[3].dictValue;
|
||||
values.corpType4Name = industryData[3] && industryData[3].dictLabel;
|
||||
}
|
||||
await uploadFile({
|
||||
single: false,
|
||||
files: values.licenseFile,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: keyId },
|
||||
});
|
||||
values.corpinfoId = keyId
|
||||
values.licenseStart = values.license[0];
|
||||
values.licenseEnd = values.license[1];
|
||||
delete values.license;
|
||||
|
|
@ -59,6 +123,7 @@ function CorpInfo(props) {
|
|||
<div style={{ paddingBottom: 10 }}>
|
||||
<FormBuilder
|
||||
onFinish={onSubmit}
|
||||
loading={props.enterprise.enterpriseLoading}
|
||||
form={form}
|
||||
options={[
|
||||
{ label: "基本信息", render: FORM_ITEM_RENDER_ENUM.DIVIDER },
|
||||
|
|
@ -68,7 +133,13 @@ function CorpInfo(props) {
|
|||
name: "code",
|
||||
rules: [{ pattern: UNIFIED_SOCIAL_CREDIT_CODE, message: "请输入正确的社会统一信用代码" }],
|
||||
},
|
||||
{ label: "所属区域", required: false, name: "POSSESSION", componentProps: { disabled: true } },
|
||||
{ label: "所属区域", required: false, name: "city", render: (
|
||||
<DictionarySelect
|
||||
dictValue="res_region_enum"
|
||||
onGetData={(data) => { setCityData(data); }}
|
||||
/>
|
||||
|
||||
) },
|
||||
{
|
||||
label: "邮政编码",
|
||||
name: "postalCode",
|
||||
|
|
@ -92,6 +163,7 @@ function CorpInfo(props) {
|
|||
name: "corpState",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: ENTERPRISE_STATUS,
|
||||
componentProps: { disabled: true },
|
||||
},
|
||||
{ name: "map", customizeRender: true, render: <Map required={false} />, span: 24 },
|
||||
{ label: "职工人数", name: "employees", render: FORM_ITEM_RENDER_ENUM.NUMBER },
|
||||
|
|
@ -111,9 +183,15 @@ function CorpInfo(props) {
|
|||
{
|
||||
label: "所属行业",
|
||||
name: "INDUSTRYALL",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ bianma: "1-10人", name: "1-10人" }],
|
||||
render: (
|
||||
<DictionarySelect
|
||||
dictValue="config_industry_enum"
|
||||
onGetNodePaths={(node) => {
|
||||
setIndustryData(node);
|
||||
console.log(node);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ label: "法定代表人", name: "lrName", required: false },
|
||||
{
|
||||
|
|
@ -141,9 +219,13 @@ function CorpInfo(props) {
|
|||
{ label: "企事业单位经营地址", name: "addressBusiness" },
|
||||
{
|
||||
label: "营业执照",
|
||||
name: "BUS_IMAGES",
|
||||
required: false,
|
||||
render: <Upload fileType="image" />,
|
||||
name: "licenseFile",
|
||||
render: (
|
||||
<Upload onGetRemoveFile={(file) => {
|
||||
setDeleteHiddenImageFiles([...deleteHiddenImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "营业执照有效期",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { Form } from "antd";
|
||||
|
||||
import { useState } from "react";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -20,6 +23,42 @@ function Department(props) {
|
|||
};
|
||||
},
|
||||
});
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
|
|
@ -35,14 +74,30 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
columns={[
|
||||
{ title: "姓名", dataIndex: "qualificationName" },
|
||||
{ title: "证书作业类别", dataIndex: "qualificationinfoCategoryName" },
|
||||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
|
||||
]}
|
||||
{...tableProps}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { Form } from "antd";
|
||||
|
||||
import { useState } from "react";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -21,6 +24,44 @@ function Department(props) {
|
|||
},
|
||||
});
|
||||
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
|
|
@ -35,7 +76,7 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
columns={[
|
||||
{ title: "姓名", dataIndex: "qualificationName" },
|
||||
{ title: "证书作业类别", dataIndex: "qualificationinfoCategoryName" },
|
||||
|
|
@ -43,7 +84,23 @@ function Department(props) {
|
|||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
|
||||
]}
|
||||
{...tableProps}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ import DepartmentSelectTree from "zy-react-library/components/SelectTree/Departm
|
|||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import nation from "zy-react-library/json/nation.json";
|
||||
import { ID_NUMBER } from "zy-react-library/regular";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
|
|
@ -33,26 +37,58 @@ function Add(props) {
|
|||
const [culturalLevelData, setCulturalLevelData] = useState([]);
|
||||
const [politicalAffiliationData, setPoliticalAffiliationData] = useState([]);
|
||||
|
||||
const [deleteUserImageFiles, setDeleteUserImageFiles] = useState([]);
|
||||
const [deleteCardImageFiles, setDeleteCardImageFiles] = useState([]);
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
useEffect(() => {
|
||||
console.log(queryParams["id"]);
|
||||
|
||||
if (queryParams["id"]) {
|
||||
const fetchData = async () => {
|
||||
const res = await props["userDetails"]({ id: queryParams["id"] });
|
||||
setUserID(res.data.userId);
|
||||
form.setFieldsValue(res.data);
|
||||
const { data } = await props["userDetails"]({ id: queryParams["id"] });
|
||||
setUserID(data.userId);
|
||||
|
||||
const userImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["13"], eqForeignKey: data.userId });
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["14"], eqForeignKey: data.userId });
|
||||
const values = {
|
||||
userImg,
|
||||
cardImg,
|
||||
...data,
|
||||
};
|
||||
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
|
||||
});
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
}, [queryParams["id"]]);
|
||||
|
||||
const onSubmit = (values) => {
|
||||
const onSubmit = async (values) => {
|
||||
await deleteFile({ single: false, files: deleteUserImageFiles });
|
||||
await deleteFile({ single: false, files: deleteCardImageFiles });
|
||||
values.mainCorpFlag = 0;
|
||||
values.userType = 1;
|
||||
values.nationName = getLabelName({ status: values.nation, list: nation });
|
||||
values.politicalAffiliationName = getLabelName({ status: values.politicalAffiliation, list: politicalAffiliationData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.culturalLevelName = getLabelName({ status: values.culturalLevel, list: culturalLevelData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.maritalStatusName = getLabelName({ status: values.maritalStatus, list: MARITAL_STATUS_ENUM });
|
||||
|
||||
await uploadFile({
|
||||
single: false,
|
||||
files: values.userImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["13"], foreignKey: userID },
|
||||
});
|
||||
await uploadFile({
|
||||
single: false,
|
||||
files: values.cardImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["14"], foreignKey: userID },
|
||||
});
|
||||
|
||||
if (queryParams["id"]) {
|
||||
values.id = queryParams["id"];
|
||||
values.userId = userID;
|
||||
|
|
@ -80,14 +116,14 @@ function Add(props) {
|
|||
<FormBuilder
|
||||
form={form}
|
||||
values={{ sex: "0" }}
|
||||
loading={props.user.userLoading}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.user.userLoading}
|
||||
onFinish={onSubmit}
|
||||
options={[
|
||||
{
|
||||
label: "用户照片",
|
||||
name: "userImg",
|
||||
span: 24,
|
||||
required: false,
|
||||
|
||||
render: (
|
||||
<Upload
|
||||
size={4}
|
||||
|
|
@ -101,6 +137,9 @@ function Add(props) {
|
|||
<div>* 人脸需双眼睁开、表情自然、露额,头发不要遮挡</div>
|
||||
</div>
|
||||
)}
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteUserImageFiles([...deleteUserImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
|
@ -110,9 +149,9 @@ function Add(props) {
|
|||
{ name: "departmentId", label: "所属部门", render: <DepartmentSelectTree /> },
|
||||
{ name: "userIdCard", label: "身份证号", rules: [{ pattern: ID_NUMBER, message: "请输入正确的身份证号" }] },
|
||||
{
|
||||
name: "userCardFile",
|
||||
name: "cardImg",
|
||||
label: "身份证照片",
|
||||
required: false,
|
||||
|
||||
render: (
|
||||
<Upload
|
||||
maxCount={2}
|
||||
|
|
@ -122,6 +161,9 @@ function Add(props) {
|
|||
<div>温馨提示:用户要上传身份证正反面(身份证照片数量是2张), 才能进行人员培训</div>
|
||||
</div>
|
||||
)}
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteCardImageFiles([...deleteCardImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
|||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { NS_USER } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -151,10 +154,17 @@ function List(props) {
|
|||
function AddModalComponent(props) {
|
||||
const [form] = Form.useForm();
|
||||
const [info, setInfo] = useState({});
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
const fetchData = async () => {
|
||||
const res = await props.requestDetails({ id: props.currentId });
|
||||
|
||||
const userImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["13"], eqForeignKey: res.data.userId });
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["14"], eqForeignKey: res.data.userId });
|
||||
|
||||
res.data.userImg = userImg;
|
||||
res.data.cardImg = cardImg;
|
||||
console.log(res.data);
|
||||
setInfo(res.data);
|
||||
};
|
||||
|
|
@ -184,20 +194,21 @@ function AddModalComponent(props) {
|
|||
column={2}
|
||||
bordered
|
||||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "人脸照片", children: <TooltipPreviewImg files={info.userImg} /> },
|
||||
{ label: "身份证照片", children: <TooltipPreviewImg files={info.cardImg} /> },
|
||||
{ label: "姓名", children: info.name },
|
||||
{ label: "性别", children: info.sex },
|
||||
{ label: "出生年月", children: info.dateOfBirth },
|
||||
{ label: "出生年月", children: info.age },
|
||||
{ label: "手机号", children: info.phone },
|
||||
{ label: "人员类型", children: info.personnelTypeName },
|
||||
{ label: "身份证号", children: info.userIdCard },
|
||||
{ label: "民族", children: info.nationName },
|
||||
{ label: "性别", children: info.sex },
|
||||
{ label: "户口所在地", children: info.locationAddress },
|
||||
{ label: "现住址", children: info.currentAddress },
|
||||
{ label: "文化程度", children: info.culturalLevelName },
|
||||
{ label: "婚姻状况", children: info.maritalStatusName },
|
||||
{ label: "政治面貌", children: info.politicalAffiliationName },
|
||||
|
||||
{ label: "人脸照片", children: info.nationName },
|
||||
{ label: "部门排序", children: info.sort },
|
||||
{ label: "邮箱", children: info.email },
|
||||
{ label: "备注", children: info.remarks },
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
|||
import { Button, Form, Modal, Space } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
|
|
@ -11,9 +9,13 @@ import Table from "zy-react-library/components/Table";
|
|||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -21,6 +23,7 @@ function Department(props) {
|
|||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userQualificationInfoList"], {
|
||||
|
|
@ -46,11 +49,46 @@ function Department(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
console.log(res);
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
<HeaderBack title="证书列表" />
|
||||
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
|
||||
|
|
@ -64,7 +102,7 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
|
|
@ -83,8 +121,24 @@ function Department(props) {
|
|||
{ title: "姓名", dataIndex: "qualificationName" },
|
||||
{ title: "证书名称", dataIndex: "qualificationName" },
|
||||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <div>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</div> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
|
|
@ -132,12 +186,23 @@ function AddModalComponent(props) {
|
|||
const queryParams = useGetUrlQuery();
|
||||
const [userQualificationinfoId, setUserQualificationinfoId] = useState("");
|
||||
const [qualificationinfoData, setQualificationinfoData] = useState([]);
|
||||
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [deleteCardImageFiles, setDeleteCardImageFiles] = useState([]);
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
props.requestDetails({ id: props.currentId }).then((res) => {
|
||||
form.setFieldsValue(res.data);
|
||||
setUserQualificationinfoId(res.data.userQualificationinfoId);
|
||||
});
|
||||
const fetchData = async () => {
|
||||
const { data } = await props.requestDetails({ id: props.currentId });
|
||||
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: data.userQualificationinfoId });
|
||||
data.cardImg = cardImg;
|
||||
form.setFieldsValue(data);
|
||||
setUserQualificationinfoId(data.userQualificationinfoId);
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
|
|
@ -145,17 +210,25 @@ function AddModalComponent(props) {
|
|||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
await deleteFile({ single: false, files: deleteCardImageFiles });
|
||||
values.corpinfoId = queryParams["corpinfoId"];
|
||||
values.userId = queryParams["id"];
|
||||
values.qualificationinfoCategoryName = getLabelName({ status: values.qualificationinfoCategory, list: qualificationinfoData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.qualificationinfoType = 2;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
|
||||
const { id } = await uploadFile({
|
||||
single: false,
|
||||
files: values.cardImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: userQualificationinfoId },
|
||||
});
|
||||
|
||||
if (props.currentId) {
|
||||
values.id = props.currentId;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
await props.requestEdit(values);
|
||||
}
|
||||
else {
|
||||
values.userQualificationinfoId = id;
|
||||
await props.requestAdd(values);
|
||||
}
|
||||
|
||||
|
|
@ -169,12 +242,13 @@ function AddModalComponent(props) {
|
|||
onOk={form.submit}
|
||||
title={props.currentId ? "编辑" : "新增"}
|
||||
width={800}
|
||||
loading={props.loding}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.loding}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
securityFlag: 0,
|
||||
}}
|
||||
|
||||
form={form}
|
||||
span={24}
|
||||
labelCol={{ span: 10 }}
|
||||
|
|
@ -191,10 +265,16 @@ function AddModalComponent(props) {
|
|||
|
||||
{ name: "certificateNo", label: "证书编号" },
|
||||
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
{ name: "name", required: false, label: "证书图片", render: <Upload size={10} fileType="image" /> },
|
||||
{ name: "cardImg", required: false, label: "证书图片", render: (
|
||||
<Upload
|
||||
size={10}
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteCardImageFiles([...deleteCardImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
) },
|
||||
|
||||
]}
|
||||
s
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@ import Table from "zy-react-library/components/Table";
|
|||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -20,6 +24,9 @@ function Department(props) {
|
|||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userQualificationInfoList"], {
|
||||
|
|
@ -45,6 +52,40 @@ function Department(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
console.log(res);
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<HeaderBack title="证书列表" />
|
||||
|
|
@ -62,7 +103,7 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
|
|
@ -84,7 +125,23 @@ function Department(props) {
|
|||
{ title: "操作项目", dataIndex: "operatingProjectName" },
|
||||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
|
|
@ -134,12 +191,23 @@ function AddModalComponent(props) {
|
|||
const [userQualificationinfoId, setUserQualificationinfoId] = useState("");
|
||||
const [qualificationinfoData, setQualificationinfoData] = useState([]);
|
||||
const [OperatingPrData, setOperatingPrData] = useState([]);
|
||||
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const [deleteCardImageFiles, setDeleteCardImageFiles] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
props.requestDetails({ id: props.currentId }).then((res) => {
|
||||
form.setFieldsValue(res.data);
|
||||
setUserQualificationinfoId(res.data.userQualificationinfoId);
|
||||
});
|
||||
const fetchData = async () => {
|
||||
const { data } = await props.requestDetails({ id: props.currentId });
|
||||
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: data.userQualificationinfoId });
|
||||
data.cardImg = cardImg;
|
||||
form.setFieldsValue(data);
|
||||
setUserQualificationinfoId(data.userQualificationinfoId);
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
|
|
@ -147,17 +215,27 @@ function AddModalComponent(props) {
|
|||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
await deleteFile({ single: false, files: deleteCardImageFiles });
|
||||
values.corpinfoId = queryParams["corpinfoId"];
|
||||
values.userId = queryParams["id"];
|
||||
values.qualificationinfoType = 1;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
values.qualificationinfoCategoryName = getLabelName({ status: values.qualificationinfoCategory, list: qualificationinfoData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.operatingProjectName = getLabelName({ status: values.operatingProject, list: OperatingPrData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
|
||||
const { id } = await uploadFile({
|
||||
single: false,
|
||||
files: values.cardImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: userQualificationinfoId },
|
||||
});
|
||||
|
||||
if (props.currentId) {
|
||||
values.id = props.currentId;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
await props.requestEdit(values);
|
||||
}
|
||||
else {
|
||||
values.userQualificationinfoId = id;
|
||||
await props.requestAdd(values);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +249,7 @@ function AddModalComponent(props) {
|
|||
onOk={form.submit}
|
||||
title={props.currentId ? "编辑" : "新增"}
|
||||
width={800}
|
||||
loading={props.loding}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.loding}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
|
|
@ -200,7 +278,15 @@ function AddModalComponent(props) {
|
|||
|
||||
{ name: "certificateNo", label: "证书编号" },
|
||||
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
{ name: "name", required: false, label: "证书图片", render: <Upload size={10} fileType="image" /> },
|
||||
{ name: "cardImg", required: false, label: "证书图片", render: (
|
||||
<Upload
|
||||
size={10}
|
||||
fileType="image"
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteCardImageFiles([...deleteCardImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
) },
|
||||
|
||||
]}
|
||||
s
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ function List(props) {
|
|||
) },
|
||||
{ title: "经济类型", dataIndex: "ecoTypeName" },
|
||||
{ title: "分公司状态", dataIndex: "corpStateName" },
|
||||
{ title: "状态", dataIndex: "corpStateName", render: (_, record) => (<span>{record.useFlag === 0 ? "停用" : record.useFlag === 1 ? "启用" : ""}</span>) },
|
||||
{ title: "状态", dataIndex: "corpStateName", render: (_, record) => (<div>{record.useFlag === 0 ? "停用" : record.useFlag === 1 ? "启用" : ""}</div>) },
|
||||
{ title: "操作", width: 550, render: (_, record) => (
|
||||
<Space>
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ function View(props) {
|
|||
{ label: "分公司名称", children: info.corpName && info.corpName },
|
||||
{ label: "社会统一信用代码", children: info.code, width: 200 },
|
||||
{ label: "企业类型", children: (
|
||||
<span>
|
||||
<div>
|
||||
|
||||
{getLabelName({ status: info.type, list: ENTERPRISE_TYPE })}
|
||||
</span>
|
||||
</div>
|
||||
) },
|
||||
{ label: "经济类型", children: info.ecoTypeName },
|
||||
{ label: "分公司状态", children: info.corpStateName },
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ function AddModalComponent(props) {
|
|||
{ label: "上级部门", children: info.parentName },
|
||||
{ label: "部门名称", children: info.parentName },
|
||||
{ label: "部门级别", children: info.levelName },
|
||||
{ label: "是否安全部门", children: <span>{info.securityFlag === 1 ? "是" : info.securityFlag === 0 ? "否" : ""}</span> },
|
||||
{ label: "是否安全部门", children: <div>{info.securityFlag === 1 ? "是" : info.securityFlag === 0 ? "否" : ""}</div> },
|
||||
{ label: "备注", children: info.remarks },
|
||||
{ label: "排序", children: info.depOrder },
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Button, Form, message, Space } from "antd";
|
|||
import { useState } from "react";
|
||||
import MapSelector from "zy-react-library/components/Map/MapSelector";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
|
|
@ -65,18 +66,37 @@ function List(props) {
|
|||
options={[
|
||||
{ name: "likecorpName", label: "分公司名称" },
|
||||
{ name: "likeCorpAccount", label: "登录账号" },
|
||||
{ name: "province", label: "属地", render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ name: "111", id: "1" }] },
|
||||
{ label: "所属区域", required: false, name: "city", render: (
|
||||
<DictionarySelect
|
||||
dictValue="res_region_enum"
|
||||
/>
|
||||
|
||||
) },
|
||||
{ name: "eqAddressBusiness", label: "企业经营地址" },
|
||||
{ name: "eqAddressOffice", label: "企业办公地址" },
|
||||
{ name: "eqCode", label: "社会统一信用代码" },
|
||||
{ name: "eqCorpState", label: "分公司状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_STATUS },
|
||||
{ name: "eqEcoType", label: "经济状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ECONOMY_TYPE },
|
||||
{ name: "eqEcoType", label: "经济类型", render: (
|
||||
<DictionarySelect
|
||||
|
||||
dictValue="ECO_TYPE"
|
||||
onGetLabel={(label) => {
|
||||
form.setFieldValue("ecoTypeName", label);
|
||||
}}
|
||||
/>
|
||||
) },
|
||||
{ name: "eqCreateDate", label: "成立时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||
{ name: "eqRegcapital", label: "注册资金" },
|
||||
{ name: "eqTotalAssets", label: "固定资产" },
|
||||
|
||||
{ name: "enterpriseType", label: "企业类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE },
|
||||
{ name: "eqScale", label: "企业规模", render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ name: "111", id: "1" }] },
|
||||
{ name: "eqScale", label: "企业规模", render: (
|
||||
<DictionarySelect
|
||||
dictValue="scale"
|
||||
|
||||
/>
|
||||
) },
|
||||
|
||||
{ label: "法定代表人信息", render: FORM_ITEM_RENDER_ENUM.DIVIDER },
|
||||
{ name: "eqLrName", label: "法人姓名" },
|
||||
{ name: "eqLrMobile", label: "手机号" },
|
||||
|
|
@ -100,10 +120,10 @@ function List(props) {
|
|||
{ title: "主要负责人电话", dataIndex: "contactsPhone" },
|
||||
{ title: "公司状态", dataIndex: "corpStateName" },
|
||||
{ title: "状态", dataIndex: "useFlag", render: (_, record) => (
|
||||
<span>{record.useFlag === 0 ? "停用" : record.useFlag === 1 ? "启用" : ""}</span>
|
||||
<div>{record.useFlag === 0 ? "停用" : record.useFlag === 1 ? "启用" : ""}</div>
|
||||
) },
|
||||
{ title: "定位状态", dataIndex: "name", render: (_, record) => (
|
||||
<span>{record.longitude ? "已定位" : "未定位" }</span>
|
||||
<div>{record.longitude ? "已定位" : "未定位" }</div>
|
||||
) },
|
||||
{ title: "操作", width: 200, render: (_, record) => (
|
||||
<Space>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,16 @@ import { NS_ENTERPRISE } from "~/enumerate/namespace";
|
|||
function View(props) {
|
||||
const [info, setInfo] = useState({});
|
||||
const queryParams = useGetUrlQuery();
|
||||
const getCorpTypeNamePath = (item) => {
|
||||
const names = [
|
||||
item.corpTypeName,
|
||||
item.corpType2Name,
|
||||
item.corpType3Name,
|
||||
item.corpType4Name,
|
||||
].filter(name => name != null && name !== "");
|
||||
|
||||
return names.join("/");
|
||||
};
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const res = await props.corpInfoRemoveDetails({ id: queryParams["id"] });
|
||||
|
|
@ -32,7 +41,7 @@ function View(props) {
|
|||
items={[
|
||||
{ label: "企业名称", children: info.corpName && info.corpName },
|
||||
{ label: "统一社会信用代码", children: info.code },
|
||||
{ label: "所属区域", children: info.companyArea },
|
||||
{ label: "所属区域", children: info.cityName },
|
||||
{ label: "邮政编码", children: info.postalCode },
|
||||
{ label: "成立时间", children: info.createDate },
|
||||
{ label: "规模", children: info.scaleName },
|
||||
|
|
@ -43,14 +52,14 @@ function View(props) {
|
|||
{ label: "资产总额(万元)", children: info.totalAssets },
|
||||
{ label: "注册资金(万元)", children: info.regcapital },
|
||||
{ label: "经济类型", children: info.ecoTypeName },
|
||||
{ label: "所属行业", children: info.regcapital },
|
||||
{ label: "所属行业", children: <div>{getCorpTypeNamePath(info)}</div> },
|
||||
{ label: "法定代表人", children: info.lrName },
|
||||
{ label: "法人手机号", children: info.lrMobile },
|
||||
{ label: "主要负责人", children: info.contacts },
|
||||
{ label: "主要负责人手机号", children: info.contactsPhone },
|
||||
{ label: "安全负责人", children: info.safetyName },
|
||||
{ label: "安全负责人手机号", children: info.safetyPhone },
|
||||
{ label: "是否规模以上", children: <span>{info.scaleType === 1 ? "是" : info.scaleType === 0 ? "否" : ""}</span> },
|
||||
{ label: "是否规模以上", children: <div>{info.scaleType === 1 ? "是" : info.scaleType === 0 ? "否" : ""}</div> },
|
||||
{ label: "企事业单位经营地址", children: info.addressBusiness },
|
||||
{ label: "企业状态", children: info.corpStateName },
|
||||
{ label: "营业执照", children: "Zhou" },
|
||||
|
|
@ -94,29 +103,29 @@ function View(props) {
|
|||
|
||||
]}
|
||||
/>
|
||||
<Divider orientation="left">企业相关属性</Divider>
|
||||
<Descriptions
|
||||
labelStyle={{ width: 200 }}
|
||||
column={2}
|
||||
bordered
|
||||
items={[
|
||||
{/* <Divider orientation="left">企业相关属性</Divider> */}
|
||||
{/* <Descriptions */}
|
||||
{/* labelStyle={{ width: 200 }} */}
|
||||
{/* column={2} */}
|
||||
{/* bordered */}
|
||||
{/* items={[ */}
|
||||
|
||||
{ label: "有无职业卫生信息", children: <span>{info.whetherHygieneFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "有无重大危险源", children: <span>{info.whetherHazardsFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否有稀缺大型应急物资和设施", children: <span>{info.whetherScarceFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "有无涉及危化品", children: <span>{info.whetherChemicalsFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "有无特种设备", children: <span>{info.whetherSpecialequipmentFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "有无特种工作人员", children: <span>{info.whetherSpecialpeopleFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否涉及煤气", children: <span>{info.whetherCoalgasFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否属于消防重点单位", children: <span>{info.whetherFireFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否在有限空间作业", children: <span>{info.whetherConfinedFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否存在涉爆粉尘作业", children: <span>{info.whetherPowderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否涉及防雷防静电", children: <span>{info.whetherLightningFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否持有放射源", children: <span>{info.whetherActinogenFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否涉及液氨制冷", children: <span>{info.whetherLiquidammoniaFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否涉及危险品管道", children: <span>{info.whetherPipelineFlag === 1 ? "是" : "否"}</span> },
|
||||
]}
|
||||
/>
|
||||
{/* { label: "有无职业卫生信息", children: <span>{info.whetherHygieneFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "有无重大危险源", children: <span>{info.whetherHazardsFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否有稀缺大型应急物资和设施", children: <span>{info.whetherScarceFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "有无涉及危化品", children: <span>{info.whetherChemicalsFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "有无特种设备", children: <span>{info.whetherSpecialequipmentFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "有无特种工作人员", children: <span>{info.whetherSpecialpeopleFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否涉及煤气", children: <span>{info.whetherCoalgasFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否属于消防重点单位", children: <span>{info.whetherFireFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否在有限空间作业", children: <span>{info.whetherConfinedFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否存在涉爆粉尘作业", children: <span>{info.whetherPowderFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否涉及防雷防静电", children: <span>{info.whetherLightningFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否持有放射源", children: <span>{info.whetherActinogenFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否涉及液氨制冷", children: <span>{info.whetherLiquidammoniaFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* { label: "是否涉及危险品管道", children: <span>{info.whetherPipelineFlag === 1 ? "是" : "否"}</span> }, */}
|
||||
{/* ]} */}
|
||||
{/* /> */}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ function AddModalComponent(props) {
|
|||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否部门负责人", children: <div>{info.departmentLeaderFlag === 1 ? "是" : "否"}</div> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "姓名", children: info.name },
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ function AddModalComponent(props) {
|
|||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否部门负责人", children: <div>{info.departmentLeaderFlag === 1 ? "是" : "否"}</div> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "姓名", children: info.name },
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function List(props) {
|
|||
|
||||
options={[
|
||||
{ name: "corpName", label: "分公司名称" },
|
||||
{ name: "corpName", label: "属地" },
|
||||
{ name: "cityName", label: "属地" },
|
||||
{ name: "eqtype", label: "相关方企业类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTERPRISE_TYPE },
|
||||
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function View(props) {
|
|||
{ label: "企业状态", children: info.corpStateName },
|
||||
{ label: "开户人", children: info.createName },
|
||||
{ label: "统一社会信用代码", children: info.code },
|
||||
{ label: "属地", children: info.companyArea },
|
||||
{ label: "属地", children: info.cityName },
|
||||
{ label: "所属行业", children: info.companyArea },
|
||||
{ label: "企业规模", children: info.scaleName },
|
||||
{ label: "经度", children: info.longitude },
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { Button, Form, Modal, Space } from "antd";
|
|||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
|
|
@ -11,15 +10,21 @@ import Table from "zy-react-library/components/Table";
|
|||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
import {getLabelName} from "zy-react-library/utils";
|
||||
|
||||
function Department(props) {
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userQualificationInfoList"], {
|
||||
|
|
@ -27,8 +32,8 @@ function Department(props) {
|
|||
transform: (formData) => {
|
||||
return {
|
||||
...formData,
|
||||
eqQualificationinfoType: 2,
|
||||
eqCorpinfoId: queryParams["id"],
|
||||
eqQualificationinfoType: 1,
|
||||
eqUserId: queryParams["id"],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
@ -44,11 +49,46 @@ function Department(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
console.log(res);
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
<HeaderBack title="证书列表" />
|
||||
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
|
||||
|
|
@ -62,7 +102,7 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
|
|
@ -81,8 +121,24 @@ function Department(props) {
|
|||
{ title: "姓名", dataIndex: "qualificationName" },
|
||||
{ title: "证书名称", dataIndex: "qualificationName" },
|
||||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <div>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</div> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
|
|
@ -106,21 +162,20 @@ function Department(props) {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
<AddModal
|
||||
currentId={currentId}
|
||||
requestAdd={props["userQualificationInfoAdd"]}
|
||||
requestEdit={props["userQualificationInfoEdit"]}
|
||||
requestDetails={props["userQualificationInfoDetails"]}
|
||||
loding={props.personnelCertificate.userQualificationLoading}
|
||||
open={addModalOpen}
|
||||
onCancel={() => {
|
||||
setAddModalOpen(false);
|
||||
setCurrentId("");
|
||||
}}
|
||||
getData={getData}
|
||||
/>
|
||||
</div>
|
||||
<AddModal
|
||||
currentId={currentId}
|
||||
requestAdd={props["userQualificationInfoAdd"]}
|
||||
requestEdit={props["userQualificationInfoEdit"]}
|
||||
requestDetails={props["userQualificationInfoDetails"]}
|
||||
loding={props.personnelCertificate.userQualificationLoading}
|
||||
dictData={props["dictData"]}
|
||||
open={addModalOpen}
|
||||
onCancel={() => {
|
||||
setAddModalOpen(false);
|
||||
setCurrentId("");
|
||||
}}
|
||||
getData={getData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -131,17 +186,23 @@ function AddModalComponent(props) {
|
|||
const queryParams = useGetUrlQuery();
|
||||
const [userQualificationinfoId, setUserQualificationinfoId] = useState("");
|
||||
const [qualificationinfoData, setQualificationinfoData] = useState([]);
|
||||
useEffect(() => {
|
||||
// 证书作业类别
|
||||
// props.dictData({ appKey: "0bb989ecada5470c87635018ece9f327", dictValue: "zylb" }).then((res) => {
|
||||
// setQualificationinfo(res.data);
|
||||
// });
|
||||
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [deleteCardImageFiles, setDeleteCardImageFiles] = useState([]);
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
props.requestDetails({ id: props.currentId }).then((res) => {
|
||||
form.setFieldsValue(res.data);
|
||||
setUserQualificationinfoId(res.data.userQualificationinfoId);
|
||||
});
|
||||
const fetchData = async () => {
|
||||
const { data } = await props.requestDetails({ id: props.currentId });
|
||||
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: data.userQualificationinfoId });
|
||||
data.cardImg = cardImg;
|
||||
form.setFieldsValue(data);
|
||||
setUserQualificationinfoId(data.userQualificationinfoId);
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
|
|
@ -149,16 +210,25 @@ function AddModalComponent(props) {
|
|||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
await deleteFile({ single: false, files: deleteCardImageFiles });
|
||||
values.corpinfoId = queryParams["corpinfoId"];
|
||||
values.userId = queryParams["id"];
|
||||
values.qualificationinfoCategoryName = getLabelName({ status: values.qualificationinfoCategory, list: qualificationinfoData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.qualificationinfoType = 2;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
|
||||
const { id } = await uploadFile({
|
||||
single: false,
|
||||
files: values.cardImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: userQualificationinfoId },
|
||||
});
|
||||
|
||||
if (props.currentId) {
|
||||
values.id = props.currentId;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
await props.requestEdit(values);
|
||||
}
|
||||
else {
|
||||
values.userQualificationinfoId = id;
|
||||
await props.requestAdd(values);
|
||||
}
|
||||
|
||||
|
|
@ -172,12 +242,13 @@ function AddModalComponent(props) {
|
|||
onOk={form.submit}
|
||||
title={props.currentId ? "编辑" : "新增"}
|
||||
width={800}
|
||||
loading={props.loding}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.loding}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
securityFlag: 0,
|
||||
}}
|
||||
|
||||
form={form}
|
||||
span={24}
|
||||
labelCol={{ span: 10 }}
|
||||
|
|
@ -194,10 +265,16 @@ function AddModalComponent(props) {
|
|||
|
||||
{ name: "certificateNo", label: "证书编号" },
|
||||
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
{ name: "name", required: false, label: "证书图片", render: <Upload size={10} fileType="image" /> },
|
||||
{ name: "cardImg", required: false, label: "证书图片", render: (
|
||||
<Upload
|
||||
size={10}
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteCardImageFiles([...deleteCardImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
) },
|
||||
|
||||
]}
|
||||
s
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@ import Table from "zy-react-library/components/Table";
|
|||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { NS_PERSNONEL_CERTFICATE } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -20,6 +24,9 @@ function Department(props) {
|
|||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const [fileCache, setFileCache] = useState({}); // key: userQualificationinfoId, value: files array
|
||||
const [loadingKeys, setLoadingKeys] = useState(new Set()); // 正在加载的 ID 集合
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userQualificationInfoList"], {
|
||||
|
|
@ -28,7 +35,7 @@ function Department(props) {
|
|||
return {
|
||||
...formData,
|
||||
eqQualificationinfoType: 1,
|
||||
eqCorpinfoId: queryParams["id"],
|
||||
eqUserId: queryParams["id"],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
@ -44,6 +51,40 @@ function Department(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
|
||||
const loadFileForRecord = async (userQualificationinfoId) => {
|
||||
if (!userQualificationinfoId)
|
||||
return;
|
||||
if (fileCache[userQualificationinfoId])
|
||||
return;
|
||||
if (loadingKeys.has(userQualificationinfoId))
|
||||
return;
|
||||
|
||||
setLoadingKeys(prev => new Set([...prev, userQualificationinfoId]));
|
||||
|
||||
try {
|
||||
const res = await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["6"],
|
||||
eqForeignKey: userQualificationinfoId,
|
||||
});
|
||||
console.log(res);
|
||||
setFileCache(prev => ({
|
||||
...prev,
|
||||
[userQualificationinfoId]: res || [],
|
||||
}));
|
||||
}
|
||||
catch (err) {
|
||||
console.error("图片加载失败:", err);
|
||||
// 可选:message.error('图片加载失败');
|
||||
}
|
||||
finally {
|
||||
setLoadingKeys((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(userQualificationinfoId);
|
||||
return newSet;
|
||||
});
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<HeaderBack title="证书列表" />
|
||||
|
|
@ -61,7 +102,7 @@ function Department(props) {
|
|||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
|
||||
loading={getFileLoading}
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
|
|
@ -83,7 +124,23 @@ function Department(props) {
|
|||
{ title: "操作项目", dataIndex: "operatingProjectName" },
|
||||
{ title: "证书编号", dataIndex: "certificateNo" },
|
||||
{ title: "就职状态", dataIndex: "certificateNo", render: (_, record) => <sapn>{record.employmentFlag === 1 ? "就职" : record.employmentFlag === 0 ? "离职" : ""}</sapn> },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => (<TooltipPreviewImg files={[]} />) },
|
||||
{ title: "图片", dataIndex: "name", render: (_, record) => {
|
||||
const id = record.userQualificationinfoId;
|
||||
const files = fileCache[id] || [];
|
||||
const isLoading = loadingKeys.has(id);
|
||||
|
||||
// 首次进入或切换数据时触发加载
|
||||
if (!fileCache[id] && !isLoading && id) {
|
||||
loadFileForRecord(id);
|
||||
}
|
||||
|
||||
if (isLoading)
|
||||
return <span>加载中...</span>;
|
||||
if (!files.length)
|
||||
return <span>无</span>;
|
||||
|
||||
return <TooltipPreviewImg files={files} />;
|
||||
} },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
|
|
@ -133,12 +190,23 @@ function AddModalComponent(props) {
|
|||
const [userQualificationinfoId, setUserQualificationinfoId] = useState("");
|
||||
const [qualificationinfoData, setQualificationinfoData] = useState([]);
|
||||
const [OperatingPrData, setOperatingPrData] = useState([]);
|
||||
|
||||
const { loading: deleteFileLoading, deleteFile } = useDeleteFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const [deleteCardImageFiles, setDeleteCardImageFiles] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
props.requestDetails({ id: props.currentId }).then((res) => {
|
||||
form.setFieldsValue(res.data);
|
||||
setUserQualificationinfoId(res.data.userQualificationinfoId);
|
||||
});
|
||||
const fetchData = async () => {
|
||||
const { data } = await props.requestDetails({ id: props.currentId });
|
||||
|
||||
const cardImg = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["6"], eqForeignKey: data.userQualificationinfoId });
|
||||
data.cardImg = cardImg;
|
||||
form.setFieldsValue(data);
|
||||
setUserQualificationinfoId(data.userQualificationinfoId);
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
|
|
@ -146,18 +214,27 @@ function AddModalComponent(props) {
|
|||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
values.qualificationinfoCategoryName = getLabelName({ status: values.qualificationinfoCategory, list: qualificationinfoData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.operatingProjectName = getLabelName({ status: values.operatingProject, list: OperatingPrData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
await deleteFile({ single: false, files: deleteCardImageFiles });
|
||||
values.corpinfoId = queryParams["corpinfoId"];
|
||||
values.userId = queryParams["id"];
|
||||
values.qualificationinfoType = 1;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
values.qualificationinfoCategoryName = getLabelName({ status: values.qualificationinfoCategory, list: qualificationinfoData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.operatingProjectName = getLabelName({ status: values.operatingProject, list: OperatingPrData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
|
||||
const { id } = await uploadFile({
|
||||
single: false,
|
||||
files: values.cardImg,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["6"], foreignKey: userQualificationinfoId },
|
||||
});
|
||||
|
||||
if (props.currentId) {
|
||||
values.id = props.currentId;
|
||||
values.userQualificationinfoId = userQualificationinfoId;
|
||||
await props.requestEdit(values);
|
||||
}
|
||||
else {
|
||||
values.userQualificationinfoId = id;
|
||||
await props.requestAdd(values);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +248,7 @@ function AddModalComponent(props) {
|
|||
onOk={form.submit}
|
||||
title={props.currentId ? "编辑" : "新增"}
|
||||
width={800}
|
||||
loading={props.loding}
|
||||
loading={deleteFileLoading || uploadFileLoading || getFileLoading || props.loding}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
|
|
@ -188,6 +265,7 @@ function AddModalComponent(props) {
|
|||
<DictionarySelect
|
||||
dictValue="zylb"
|
||||
onGetData={(data) => { setQualificationinfoData(data); }}
|
||||
|
||||
/>
|
||||
) },
|
||||
{ name: "operatingProject", required: false, label: "操作项目", render: (
|
||||
|
|
@ -196,9 +274,18 @@ function AddModalComponent(props) {
|
|||
onGetData={(data) => { setOperatingPrData(data); }}
|
||||
/>
|
||||
) },
|
||||
|
||||
{ name: "certificateNo", label: "证书编号" },
|
||||
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
{ name: "name", required: false, label: "证书图片", render: <Upload size={10} fileType="image" /> },
|
||||
{ name: "cardImg", required: false, label: "证书图片", render: (
|
||||
<Upload
|
||||
size={10}
|
||||
fileType="image"
|
||||
onGetRemoveFile={(file) => {
|
||||
setDeleteCardImageFiles([...deleteCardImageFiles, file]);
|
||||
}}
|
||||
/>
|
||||
) },
|
||||
|
||||
]}
|
||||
s
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function List(props) {
|
|||
columns={[
|
||||
{ title: "相关方单位名称", dataIndex: "corpName" },
|
||||
{ title: "企业人数", dataIndex: "userCount", render: (_, record) => (
|
||||
<span>{record.userCount ? record.userCount : "0"}</span>
|
||||
<div>{record.userCount ? record.userCount : "0"}</div>
|
||||
) },
|
||||
{ title: "安全人员信息数", dataIndex: "safetyUserCount" },
|
||||
{ title: "特种作业人数", dataIndex: "specialUserCount" },
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ function AddModalComponent(props) {
|
|||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否部门负责人", children: <div>{info.departmentLeaderFlag === 1 ? "是" : "否"}</div> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "姓名", children: info.name },
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ function View(props) {
|
|||
{ label: "集团单位", children: info.phonecorpTypIds },
|
||||
{ label: "开户人", children: info.cardIdholderName },
|
||||
{ label: "统一社会信用代码", children: info.code, span: 3 },
|
||||
{ label: "属地", children: info.companyAreas },
|
||||
{ label: "属地", children: info.cityName },
|
||||
{ label: "所属行业", children: info.industryNames },
|
||||
{ label: "经济类型", children: info.ecoType },
|
||||
{ label: "经度", children: info.longitude },
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ import DepartmentSelectTree from "zy-react-library/components/SelectTree/Departm
|
|||
import DictionarySelect from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
// import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||
import nation from "zy-react-library/json/nation.json";
|
||||
import { ID_NUMBER, PHONE } from "zy-react-library/regular";
|
||||
import { getLabelName, idCardGetDateAndGender } from "zy-react-library/utils";
|
||||
|
|
@ -31,13 +34,39 @@ function Add(props) {
|
|||
const [userID, setUserID] = useState(null);
|
||||
const queryParams = useGetUrlQuery();
|
||||
|
||||
// const { loading: getFileLoading, getFile } = useGetFile();
|
||||
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
|
||||
|
||||
useEffect(() => {
|
||||
if (queryParams["id"]) {
|
||||
const fetchData = async () => {
|
||||
const res = await props["userDetails"]({ id: queryParams["id"] });
|
||||
console.log(res.data);
|
||||
setUserID(res.data.userId);
|
||||
form.setFieldsValue(res.data);
|
||||
const { data } = await props["userDetails"]({ id: queryParams["id"] });
|
||||
// const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["13"], eqForeignKey: queryParams["id"] });
|
||||
const filepath = data.filepath
|
||||
? [
|
||||
{
|
||||
name: data.name,
|
||||
url: data.filepath,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
const values = {
|
||||
filepath,
|
||||
|
||||
...data,
|
||||
};
|
||||
values.faceFile = [
|
||||
{
|
||||
name: data.name,
|
||||
url: data.filepath,
|
||||
},
|
||||
];
|
||||
setUserID(data.userId);
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
|
||||
});
|
||||
};
|
||||
fetchData();
|
||||
}
|
||||
|
|
@ -51,9 +80,15 @@ function Add(props) {
|
|||
values.personnelTypeName = getLabelName({ status: values.personnelType, list: userTypeData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
values.rank_level_name = getLabelName({ status: values.rank_level, list: rankData, idKey: "dictValue", nameKey: "dictLabel" });
|
||||
idCardGetDateAndGender(values.userIdCard);
|
||||
|
||||
const { filePath } = await uploadFile({
|
||||
single: true,
|
||||
files: values.faceFile,
|
||||
params: { type: UPLOAD_FILE_TYPE_ENUM["13"], foreignKey: userID },
|
||||
});
|
||||
values.userAvatarUrl = filePath;
|
||||
values.mainCorpFlag = 0;
|
||||
values.userType = 1;
|
||||
|
||||
if (queryParams["id"]) {
|
||||
values.id = queryParams["id"];
|
||||
values.userId = userID;
|
||||
|
|
@ -89,7 +124,7 @@ function Add(props) {
|
|||
<HeaderBack title={queryParams["id"] ? "编辑" : "新增"} />
|
||||
<div style={{ paddingBottom: 10 }}>
|
||||
<FormBuilder
|
||||
loading={props.user.userLoading}
|
||||
loading={uploadFileLoading || props.user.userLoading}
|
||||
values={{
|
||||
departmentLeaderFlag: "0",
|
||||
|
||||
|
|
@ -153,6 +188,7 @@ function Add(props) {
|
|||
render: (
|
||||
<Upload
|
||||
size={4}
|
||||
maxCount={1}
|
||||
fileType="image"
|
||||
tipContent={(
|
||||
<div style={{ lineHeight: 1.6, color: "red", fontSize: 12 }}>
|
||||
|
|
@ -162,7 +198,13 @@ function Add(props) {
|
|||
<div>* 人脸无遮挡(如戴帽子、口罩、眼镜等)、无修图</div>
|
||||
<div>* 人脸需双眼睁开、表情自然、露额,头发不要遮挡</div>
|
||||
</div>
|
||||
|
||||
)}
|
||||
onRemove={() => {
|
||||
form.setFieldValue("faceFile");
|
||||
return false;
|
||||
}}
|
||||
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index"
|
|||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob";
|
||||
import useImportFile from "zy-react-library/hooks/useImportFile";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { NS_USER } from "~/enumerate/namespace";
|
||||
|
||||
|
|
@ -20,7 +22,10 @@ function List(props) {
|
|||
const [currentId, setCurrentId] = useState("");
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||
const [postData, setPostData] = useState([]);
|
||||
const { downloadBlob } = useDownloadBlob();
|
||||
const { importFile } = useImportFile();
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const { tableProps, getData } = useTable(props["userList"], {
|
||||
form,
|
||||
transform: (formData) => {
|
||||
|
|
@ -63,8 +68,8 @@ function List(props) {
|
|||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要导出到excel吗?",
|
||||
onOk: () => {
|
||||
|
||||
onOk: async () => {
|
||||
downloadBlob(`/basic-info/user/exportUserTable?ids=${selectedRowKeys.length !== 0 ? selectedRowKeys.join(",") : ""}`, { name: "用户" });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -79,8 +84,8 @@ function List(props) {
|
|||
};
|
||||
|
||||
const onImportFileConfirm = (values) => {
|
||||
console.log(values);
|
||||
message.success("导入成功");
|
||||
importFile("/basic-info/user/importUserTable", { files: values.file });
|
||||
// message.success("导入成功");
|
||||
};
|
||||
const onTreeChange = (selectedKeys) => {
|
||||
const key = selectedKeys[0] || null;
|
||||
|
|
@ -252,7 +257,7 @@ function AddModalComponent(props) {
|
|||
items={[
|
||||
{ label: "用户角色", children: info.username },
|
||||
{ label: "所属部门", children: info.departmentName },
|
||||
{ label: "是否部门负责人", children: <span>{info.departmentLeaderFlag === 1 ? "是" : "否"}</span> },
|
||||
{ label: "是否部门负责人", children: <div>{info.departmentLeaderFlag === 1 ? "是" : "否"}</div> },
|
||||
{ label: "所属岗位", children: info.postName },
|
||||
{ label: "用户名", children: info.username },
|
||||
{ label: "姓名", children: info.name },
|
||||
|
|
|
|||
Loading…
Reference in New Issue