优化MapSelector、PersonnelSelect、HiddenInfo

master
LiuJiaNan 2025-12-10 16:11:10 +08:00
parent 75c3bea0e9
commit 81a01ba476
4 changed files with 30 additions and 14 deletions

View File

@ -63,19 +63,18 @@ function HiddenInfo(props) {
setHiddenVideoFiles(hiddenVideoFiles); setHiddenVideoFiles(hiddenVideoFiles);
if (info.hiddenRectifyUserCO && info.hiddenRectifyUserCO.length > 0) { if (info.hiddenRectifyUserCO && info.hiddenRectifyUserCO.length > 0) {
for (let i = 0; i < info.hiddenRectifyUserCO.length; i++) {
const afterRectificationImageFiles = await getFile({ const afterRectificationImageFiles = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM["4"], eqType: UPLOAD_FILE_TYPE_ENUM["4"],
eqForeignKey: hiddenId || query[hiddenIdKey], eqForeignKey: info.hiddenRectifyUserCO[i].hiddenUserId,
}); });
setAfterRectificationImageFiles(afterRectificationImageFiles); setAfterRectificationImageFiles(prevState => [...prevState, afterRectificationImageFiles]);
if (info.hiddenRectifyUserCO[i].isRectificationScheme === 1 && info.hiddenRectifyUserCO[i].hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO[i].hiddenSchemeCO).length > 0) {
for (let i = 0; i < info.hiddenRectifyUserCO.length; i++) {
if ((info.hiddenRectifyUserCO[i].isRectificationScheme === 1 && info.hiddenRectifyUserCO[i].hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO[i].hiddenSchemeCO).length > 0)) {
const rectificationPlanImageFiles = await getFile({ const rectificationPlanImageFiles = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM["8"], eqType: UPLOAD_FILE_TYPE_ENUM["8"],
eqForeignKey: hiddenId || query[hiddenIdKey], eqForeignKey: info.hiddenRectifyUserCO[i].hiddenSchemeId,
}); });
setRectificationPlanImageFiles(prevState => [...prevState, ...rectificationPlanImageFiles]); setRectificationPlanImageFiles(prevState => [...prevState, rectificationPlanImageFiles]);
} }
} }
} }
@ -86,7 +85,7 @@ function HiddenInfo(props) {
eqType: UPLOAD_FILE_TYPE_ENUM["5"], eqType: UPLOAD_FILE_TYPE_ENUM["5"],
eqForeignKey: hiddenId || query[hiddenIdKey], eqForeignKey: hiddenId || query[hiddenIdKey],
}); });
setAcceptImageFiles(prevState => [...prevState, ...acceptImageFiles]); setAcceptImageFiles(prevState => [...prevState, acceptImageFiles]);
} }
} }
@ -392,7 +391,7 @@ function HiddenInfo(props) {
{ label: "整改描述", children: item.descr }, { label: "整改描述", children: item.descr },
{ label: "投入资金", children: item.investmentFunds }, { label: "投入资金", children: item.investmentFunds },
{ label: "临时安全措施", children: info.tempSafeMeasure }, { label: "临时安全措施", children: info.tempSafeMeasure },
{ label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> }, { label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles[index]} /> },
{ label: "整改方案", children: item.isRectificationScheme === 0 ? "无" : "有" }, { label: "整改方案", children: item.isRectificationScheme === 0 ? "无" : "有" },
...((item.isRectificationScheme === 1 && item.hiddenSchemeCO && Object.keys(item.hiddenSchemeCO).length > 0) ...((item.isRectificationScheme === 1 && item.hiddenSchemeCO && Object.keys(item.hiddenSchemeCO).length > 0)
? [ ? [

View File

@ -93,6 +93,17 @@ const MapSelector = (props) => {
} }
}; };
// 清空
const handleLocalClear = () => {
setLocalSearch("");
if (mapInstanceRef.current) {
const local = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
renderOptions: { map: mapInstanceRef.current },
});
local.search("");
}
};
// 关闭弹窗 // 关闭弹窗
const handleClose = () => { const handleClose = () => {
setLocalSearch(""); setLocalSearch("");
@ -191,10 +202,13 @@ const MapSelector = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item label=" " colon={false}> <Form.Item label=" " colon={false} style={{ textAlign: "right" }}>
<Button type="primary" onClick={handleLocalSearch}> <Button type="primary" onClick={handleLocalSearch}>
搜索 搜索
</Button> </Button>
<Button onClick={handleLocalClear}>
重置
</Button>
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>

View File

@ -27,6 +27,8 @@ export interface PersonnelSelectProps extends Omit<BasicSelectProps, "data" | "p
isNeedPostId?: boolean; isNeedPostId?: boolean;
/** 是否需要部门id默认 true */ /** 是否需要部门id默认 true */
isNeedDepartmentId?: boolean; isNeedDepartmentId?: boolean;
/** 返回值是否存在主账号 */
noMain?: 1 | "";
} }
/** /**

View File

@ -12,6 +12,7 @@ function PersonnelSelect(props) {
isNeedCorpInfoId = false, isNeedCorpInfoId = false,
isNeedDepartmentId = true, isNeedDepartmentId = true,
isNeedPostId = false, isNeedPostId = false,
noMain = "",
...restProps ...restProps
} = props; } = props;
@ -27,13 +28,13 @@ function PersonnelSelect(props) {
if (isNeedPostId && !params.postId) if (isNeedPostId && !params.postId)
return; return;
const { data } = await request("/basicInfo/user/listAll", "get", params); const { data } = await request("/basicInfo/user/listAll", "get", { ...params, noMain });
setData(data); setData(data);
}; };
useEffect(() => { useEffect(() => {
getData(); getData();
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId]); }, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId, noMain]);
return ( return (
<BasicSelect data={data} placeholder={placeholder} {...restProps} /> <BasicSelect data={data} placeholder={placeholder} {...restProps} />