fix(): 修复考核模版

qzc-dev-demo
李神峰 2025-04-10 15:29:01 +08:00
parent 582a6cf4cd
commit 9192da11cf
4 changed files with 39 additions and 6 deletions

View File

@ -103,6 +103,7 @@ const ToolBar = ({ setSearchVal, onSave, storeData,role }) => {
<Form.Item label="监测时间" name="tm">
<RangePicker
allowClear
showTime
style={{ width: "350px" }}
format="YYYY-MM-DD HH:mm:ss"
onChange={(v)=>{

View File

@ -103,6 +103,7 @@ const ToolBar = ({ setSearchVal, onSave, storeData,role }) => {
<Form.Item label="监测时间" name="tm">
<RangePicker
allowClear
showTime
style={{ width: "350px" }}
format="YYYY-MM-DD HH:mm:ss"
onChange={(v)=>{

View File

@ -433,7 +433,13 @@ const EditableRow = ({ index, ...props }) => {
// assessScore
// }
// })
setTableData(handleData(checkList, "name"))
const res = checkList.map(item => {
if (item.rowSpan == 0 || item.rowSpan) {
item.rowSpan = undefined
}
return item
})
setTableData(handleData(res, "name"))
} else {
setCheckList(tableData)
const newData = tabs == 2 ? tableData.filter(item => item.standardScore > item.indicatorScore) :
@ -441,7 +447,7 @@ const EditableRow = ({ index, ...props }) => {
newData.forEach(item => {
if (item.rowSpan) delete item.rowSpan;
})
const res = handleData(newData, "name")
const res = handleData(newData, "name")
setTableData(res);
}
}
@ -671,7 +677,7 @@ const EditableRow = ({ index, ...props }) => {
<Row gutter={[16]}>
{
loading ? <span>文件正在上传中请等待</span> :
// loading ? <span>文件正在上传中,请等待</span> :
imgfileList.length > 0 && imgfileList.map(file => {
return (
<Col span={12}>

View File

@ -21,7 +21,7 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
const [searchValue, setSearchValue] = useState('');
//
@ -161,7 +161,28 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
}, [type, formJsonData, isModalOpen])
const disableParentNodes =(treeData) => {
const handleTreeData = (treeData, searchValue = '') => {
const loop = (data) => {
return data.map((item) => {
const strTitle = item.title?.toString() || '';
const matchValue = strTitle.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
const children = item.children ? loop(item.children) : [];
const hasChildren = children && children.length > 0;
return {
...item,
disabled: hasChildren, // 有子节点的设为禁用
children: hasChildren ? children : undefined
};
});
};
return loop(treeData);
};
const disableParentNodes = (treeData) => {
debugger
return treeData.map(node => {
const newNode = { ...node };
if (node.children && node.children.length > 0) {
@ -267,10 +288,14 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
allowClear
onSearch={setSearchValue}
fieldNames={item.fieldNames}
treeData={disableParentNodes(item.treeData)}
treeData={handleTreeData(item.treeData,searchValue)}
treeCheckable={item.multiple}
disabled={type == 'view'}
filterTreeNode={(inputValue, treeNode) => {
return treeNode.legalName.toLowerCase().includes(inputValue.toLowerCase());
}}
/>
</Form.Item>}