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) =>
/\.(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("");
return (
@ -13,6 +13,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
name={name}
label={label}
extra={extra}
style={style}
valuePropName="fileList"
rules={rules}
getValueProps={(value) => {
@ -90,7 +91,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
</button>
</Upload>
</Form.Item>
<Image
{previewImage && <Image
style={{ display: "none" }}
preview={{
visible: !!previewImage,
@ -99,7 +100,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
if (!visible) setPreviewImage("");
},
}}
/>
/>}
</>
);
}

View File

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

View File

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

View File

@ -21,6 +21,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions";
import { tools } from "@cqsjjb/jjb-common-lib";
import AttachmentUpload from "~/components/AttachmentUpload";
const { router } = tools;
const { TextArea } = Input;
@ -64,6 +65,7 @@ const RiskAnalysisContent = (props) => {
if (res?.success !== false && res?.data) {
form.setFieldsValue({
...res.data,
riskFileUrl: res.data.riskFileUrl? JSON.parse(res.data.riskFileUrl) :undefined,
analysisDate: res.data.analysisDate
? dayjs(res.data.analysisDate)
: undefined,
@ -96,6 +98,7 @@ const RiskAnalysisContent = (props) => {
...rest,
projectId,
statusCode,
riskFileUrl: rest.riskFileUrl? JSON.stringify(rest.riskFileUrl) :undefined,
analysisDate: analysisDate
? analysisDate.format("YYYY-MM-DD")
: undefined,
@ -325,7 +328,7 @@ const RiskAnalysisContent = (props) => {
</div>
</Card>
<Card type="inner" size="small" title="参与风险分析人员签字">
<Card type="inner" size="small" title="参与风险分析人员签字" className="pf-section">
<Form.List name="participants">
{(fields, { add, remove }) => {
addParticipantRef.current = add;
@ -463,55 +466,14 @@ const RiskAnalysisContent = (props) => {
</Form.List>
</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>
<AttachmentUpload
name="riskFileUrl"
style={{ marginBottom: 0 }}
label="风险分析表附件"
accept=".pdf,.docx,.jpg,.png"
maxCount={10}
extra="支持 PDF、Word、JPG、PNG 格式。上传后可替换修改,系统保留当前归档文件信息"
/>
</Form>
</Card>
@ -558,6 +520,56 @@ const RiskAnalysisContent = (props) => {
</div>
</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}>
<Button
onClick={() => handleSave(1)}
@ -565,7 +577,7 @@ const RiskAnalysisContent = (props) => {
>
暂存
</Button>
<Button>打印记录表</Button>
<Button
type="primary"
onClick={() => handleSave(2)}