修改 隐患考评 选择不符合时 未显示不符合原因的问题

master
853931625@qq.com 2026-05-29 15:57:06 +08:00
parent 9d6bd9d550
commit 21aacb8634
2 changed files with 9 additions and 5 deletions

View File

@ -45,7 +45,7 @@ const ViewEvaluationModal = (props) => {
label: "是否符合", label: "是否符合",
children: getLabelName({ list: EVALUATION_IS_COMPLIANT_ENUM, status: item.isCompliant }) || "未考评", children: getLabelName({ list: EVALUATION_IS_COMPLIANT_ENUM, status: item.isCompliant }) || "未考评",
}, },
...(item.isCompliant === 0 ? [{ label: "不符合原因", children: item.nonCompliantReason, span: 2 }] : []), ...(String(item.isCompliant) === "0" ? [{ label: "不符合原因", children: item.nonCompliantReason, span: 2 }] : []),
])), ])),
]} ]}
/> />

View File

@ -162,6 +162,7 @@ function HiddenList(props) {
const EvaluationModalComponent = (props) => { const EvaluationModalComponent = (props) => {
const { getUserInfo } = useGetUserInfo(); const { getUserInfo } = useGetUserInfo();
const [form] = FormBuilder.useForm(); const [form] = FormBuilder.useForm();
const [showNonCompliantReason, setShowNonCompliantReason] = useState(false);
const [list, setList] = useState([]); const [list, setList] = useState([]);
const getData = async () => { const getData = async () => {
const { data } = await props["hiddenEvaluationHiddenEvaluationView"]({ const { data } = await props["hiddenEvaluationHiddenEvaluationView"]({
@ -195,7 +196,6 @@ const EvaluationModalComponent = (props) => {
props.getData(); props.getData();
} }
}; };
return ( return (
<Modal <Modal
title="考评" title="考评"
@ -218,7 +218,7 @@ const EvaluationModalComponent = (props) => {
label: "是否符合", label: "是否符合",
children: getLabelName({ list: EVALUATION_IS_COMPLIANT_ENUM, status: item.isCompliant }) || "未考评", children: getLabelName({ list: EVALUATION_IS_COMPLIANT_ENUM, status: item.isCompliant }) || "未考评",
}, },
...(item.isCompliant === 0 ? [{ label: "不符合原因", children: item.nonCompliantReason, span: 2 }] : []), ...(String(item.isCompliant) === "0" ? [{ label: "不符合原因", children: item.nonCompliantReason, span: 2 }] : []),
])), ])),
]} ]}
/> />
@ -228,6 +228,11 @@ const EvaluationModalComponent = (props) => {
showActionButtons={false} showActionButtons={false}
span={24} span={24}
onFinish={onSubmit} onFinish={onSubmit}
onValuesChange={(changedValues, allValues) => {
if (Object.prototype.hasOwnProperty.call(changedValues, "isCompliant")) {
setShowNonCompliantReason(String(allValues.isCompliant) === "0");
}
}}
labelCol={{ span: 6 }} labelCol={{ span: 6 }}
values={{ values={{
isCompliant: "1", isCompliant: "1",
@ -248,8 +253,7 @@ const EvaluationModalComponent = (props) => {
name: "nonCompliantReason", name: "nonCompliantReason",
label: "不符合原因", label: "不符合原因",
render: FORM_ITEM_RENDER_ENUM.TEXTAREA, render: FORM_ITEM_RENDER_ENUM.TEXTAREA,
dependencies: ["isCompliant"], hidden: !showNonCompliantReason,
hidden: formValues => !(formValues.isCompliant === "0"),
}, },
]} ]}
/> />