dev_1.2
tangjie 2026-07-28 11:17:10 +08:00
parent 7955cc1595
commit 7aa52f77fe
4 changed files with 73 additions and 58 deletions

View File

@ -4,7 +4,7 @@ import { PlusOutlined } from "@ant-design/icons";
const isImage = (url) => const isImage = (url) =>
/\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || ""); /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || "");
export default function AttachmentUpload({ name, label, disabled = false, maxCount, accept, extra ,rules }) { export default function AttachmentUpload({ name, label, disabled = false, maxCount, accept, extra ,rules, style }) {
const [previewImage, setPreviewImage] = useState(""); const [previewImage, setPreviewImage] = useState("");
return ( return (
@ -13,6 +13,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
name={name} name={name}
label={label} label={label}
extra={extra} extra={extra}
style={style}
valuePropName="fileList" valuePropName="fileList"
rules={rules} rules={rules}
getValueProps={(value) => { getValueProps={(value) => {
@ -90,7 +91,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
</button> </button>
</Upload> </Upload>
</Form.Item> </Form.Item>
<Image {previewImage && <Image
style={{ display: "none" }} style={{ display: "none" }}
preview={{ preview={{
visible: !!previewImage, visible: !!previewImage,
@ -99,7 +100,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
if (!visible) setPreviewImage(""); if (!visible) setPreviewImage("");
}, },
}} }}
/> />}
</> </>
); );
} }

View File

@ -103,7 +103,7 @@ const EvalProjectCreate = (props) => {
name: item.userName, name: item.userName,
deptName: item.deptName, deptName: item.deptName,
posName: item.postName, posName: item.postName,
capacity: '龟派气功波', capacity: '',
})), })),
}; };
if (isView) { if (isView) {

View File

@ -501,10 +501,12 @@ const ContractContent = (props) => {
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item label="职工人数" name="staffCount"> <Form.Item label="职工人数" name="staffCount">
<Input <InputNumber
style={{ width: "100%" }}
placeholder="请输入职工人数" placeholder="请输入职工人数"
maxLength={10} min={0}
allowClear precision={0}
max={99999}
/> />
</Form.Item> </Form.Item>
</Col> </Col>

View File

@ -21,6 +21,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions"; import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions";
import { tools } from "@cqsjjb/jjb-common-lib"; import { tools } from "@cqsjjb/jjb-common-lib";
import AttachmentUpload from "~/components/AttachmentUpload";
const { router } = tools; const { router } = tools;
const { TextArea } = Input; const { TextArea } = Input;
@ -64,6 +65,7 @@ const RiskAnalysisContent = (props) => {
if (res?.success !== false && res?.data) { if (res?.success !== false && res?.data) {
form.setFieldsValue({ form.setFieldsValue({
...res.data, ...res.data,
riskFileUrl: res.data.riskFileUrl? JSON.parse(res.data.riskFileUrl) :undefined,
analysisDate: res.data.analysisDate analysisDate: res.data.analysisDate
? dayjs(res.data.analysisDate) ? dayjs(res.data.analysisDate)
: undefined, : undefined,
@ -96,6 +98,7 @@ const RiskAnalysisContent = (props) => {
...rest, ...rest,
projectId, projectId,
statusCode, statusCode,
riskFileUrl: rest.riskFileUrl? JSON.stringify(rest.riskFileUrl) :undefined,
analysisDate: analysisDate analysisDate: analysisDate
? analysisDate.format("YYYY-MM-DD") ? analysisDate.format("YYYY-MM-DD")
: undefined, : undefined,
@ -325,7 +328,7 @@ const RiskAnalysisContent = (props) => {
</div> </div>
</Card> </Card>
<Card type="inner" size="small" title="参与风险分析人员签字"> <Card type="inner" size="small" title="参与风险分析人员签字" className="pf-section">
<Form.List name="participants"> <Form.List name="participants">
{(fields, { add, remove }) => { {(fields, { add, remove }) => {
addParticipantRef.current = add; addParticipantRef.current = add;
@ -463,55 +466,14 @@ const RiskAnalysisContent = (props) => {
</Form.List> </Form.List>
</Card> </Card>
<Modal <AttachmentUpload
title="选择参与人员" name="riskFileUrl"
open={participantModalOpen} style={{ marginBottom: 0 }}
onCancel={() => setParticipantModalOpen(false)} label="风险分析表附件"
onOk={() => { accept=".pdf,.docx,.jpg,.png"
const selected = ( maxCount={10}
evalProjectDetailData?.participants || [] extra="支持 PDF、Word、JPG、PNG 格式。上传后可替换修改,系统保留当前归档文件信息"
).filter((p) => selectedParticipantIds.includes(p.id)); />
selected.forEach((p) => {
addParticipantRef.current?.({
personnelId: p.id,
personnelName: p.name,
deptName: p.deptName,
opinion: "",
projectId,
});
});
setParticipantModalOpen(false);
}}
>
<Table
dataSource={(() => {
const existing = (
form.getFieldValue("participants") || []
).map((p) => p.personnelName);
return (evalProjectDetailData?.participants || []).filter(
(p) => !existing.includes(p.name),
);
})()}
rowKey="id"
rowSelection={{
type: "checkbox",
selectedRowKeys: selectedParticipantIds,
onChange: (keys) => setSelectedParticipantIds(keys),
getCheckboxProps: (record) => ({
disabled: false,
}),
}}
columns={[
{ title: "姓名", dataIndex: "name", width: 100 },
{ title: "部门", dataIndex: "deptName", width: 120 },
{ title: "岗位", dataIndex: "posName", width: 120 },
{ title: "能力", dataIndex: "capacity", width: 120 },
]}
pagination={false}
size="small"
locale={{ emptyText: "所有人员均已添加" }}
/>
</Modal>
</Form> </Form>
</Card> </Card>
@ -558,6 +520,56 @@ const RiskAnalysisContent = (props) => {
</div> </div>
</Card> </Card>
<Modal
title="选择参与人员"
open={participantModalOpen}
onCancel={() => setParticipantModalOpen(false)}
onOk={() => {
const selected = (evalProjectDetailData?.participants || []).filter(
(p) => selectedParticipantIds.includes(p.id),
);
selected.forEach((p) => {
addParticipantRef.current?.({
personnelId: p.id,
personnelName: p.name,
deptName: p.deptName,
opinion: "",
projectId,
});
});
setParticipantModalOpen(false);
}}
>
<Table
dataSource={(() => {
const existing = (form.getFieldValue("participants") || []).map(
(p) => p.personnelName,
);
return (evalProjectDetailData?.participants || []).filter(
(p) => !existing.includes(p.name),
);
})()}
rowKey="id"
rowSelection={{
type: "checkbox",
selectedRowKeys: selectedParticipantIds,
onChange: (keys) => setSelectedParticipantIds(keys),
getCheckboxProps: (record) => ({
disabled: false,
}),
}}
columns={[
{ title: "姓名", dataIndex: "name", width: 100 },
{ title: "部门", dataIndex: "deptName", width: 120 },
{ title: "岗位", dataIndex: "posName", width: 120 },
{ title: "能力", dataIndex: "capacity", width: 120 },
]}
pagination={false}
size="small"
locale={{ emptyText: "所有人员均已添加" }}
/>
</Modal>
<Flex justify="flex-end" gap={8}> <Flex justify="flex-end" gap={8}>
<Button <Button
onClick={() => handleSave(1)} onClick={() => handleSave(1)}
@ -565,7 +577,7 @@ const RiskAnalysisContent = (props) => {
> >
暂存 暂存
</Button> </Button>
<Button>打印记录表</Button>
<Button <Button
type="primary" type="primary"
onClick={() => handleSave(2)} onClick={() => handleSave(2)}