Merge branch 'master' of http://10.0.41.100:3000/lishenfeng/tsg-web
commit
5c7622aa52
|
|
@ -4,7 +4,7 @@ import zd from '../../../assets/img/wait.png'
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<div style={{display:'flex',justifyContent:'center',alignItems:'center',backgroundColor:'#fff',height:'100%',padding:'20px'}}>
|
<div style={{display:'flex',justifyContent:'center',alignItems:'center',backgroundColor:'#fff',height:'100%',padding:'20px'}}>
|
||||||
<Image src={zd} style={{margin:'auto',margin:'20px',height:'530px'}} preview={false}/>
|
<Image src={zd} style={{margin:'auto',margin:'20px',height:'130px'}} preview={false}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ const ToolBar = ({ setSearchVal, onSave, storeData, role }) => {
|
||||||
<Form.Item label="施行日期" name="implementationDate">
|
<Form.Item label="施行日期" name="implementationDate">
|
||||||
<RangePicker allowClear />
|
<RangePicker allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="上传时间" name="uploadTime">
|
{/* <Form.Item label="上传时间" name="uploadTime">
|
||||||
<RangePicker allowClear />
|
<RangePicker allowClear />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
</div>}
|
</div>}
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const Page = ({ mode, onCrudSuccess,record,submit }) => {
|
||||||
if (mode == 'save') {
|
if (mode == 'save') {
|
||||||
addBasic(params)
|
addBasic(params)
|
||||||
} else if (mode == 'edit') {
|
} else if (mode == 'edit') {
|
||||||
editBasic({...params})
|
editBasic({...params,caseDate:record.caseDate ? dayjs(record.caseDate).format('YYYY-MM-DD HH:mm:ss'):''})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const addBasic = (params) => {
|
const addBasic = (params) => {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const { RangePicker } = DatePicker;
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
const baseUrl = "http://223.75.53.141:9100/gs-tsg"
|
const baseUrl = "http://223.75.53.141:9100/gs-tsg"
|
||||||
|
let dataList = [];
|
||||||
const FormZdy = ({ fileKey, typeName = "ddForm", formJson, getFormInfo, type, formJsonData, typeUpload = 'dispatch', isModalOpen, fileType, footer = true, uploadUrl, TableZdyProps, downloadUrl,
|
const FormZdy = ({ fileKey, typeName = "ddForm", formJson, getFormInfo, type, formJsonData, typeUpload = 'dispatch', isModalOpen, fileType, footer = true, uploadUrl, TableZdyProps, downloadUrl,
|
||||||
onSave }) => {
|
onSave }) => {
|
||||||
const [fileList, setFileList] = useState([])
|
const [fileList, setFileList] = useState([])
|
||||||
|
|
@ -23,6 +23,7 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
|
const treeRef = useRef();
|
||||||
|
|
||||||
//
|
//
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
@ -162,27 +163,48 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
|
||||||
}, [type, formJsonData, isModalOpen])
|
}, [type, formJsonData, isModalOpen])
|
||||||
|
|
||||||
const handleTreeData = (treeData, searchValue = '') => {
|
const handleTreeData = (treeData, searchValue = '') => {
|
||||||
const loop = (data) => {
|
const loop = (treeData) =>
|
||||||
return data.map((item) => {
|
treeData.map((item) => {
|
||||||
const strTitle = item.title?.toString() || '';
|
const strTitle = item.legalName;
|
||||||
const matchValue = strTitle.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
|
const index = strTitle?.indexOf(searchValue);
|
||||||
|
const beforeStr = strTitle.substring(0, index);
|
||||||
|
const afterStr = strTitle.slice(index + searchValue?.length);
|
||||||
|
const title =
|
||||||
|
index > -1 ? (
|
||||||
|
<span key={item.id}>
|
||||||
|
{beforeStr}
|
||||||
|
<span className="site-tree-search-value" style={{ color: 'red' }}>{searchValue}</span>
|
||||||
|
{afterStr}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span key={item.id}>{strTitle}</span>
|
||||||
|
);
|
||||||
|
if (item.children) {
|
||||||
|
return { title: title, key: item.id, children: loop(item.children), name: strTitle };
|
||||||
|
}
|
||||||
|
if (index > -1) {
|
||||||
|
|
||||||
const children = item.children ? loop(item.children) : [];
|
console.log(index, strTitle, searchValue);
|
||||||
const hasChildren = children && children.length > 0;
|
|
||||||
|
|
||||||
|
dataList.push(item.id)
|
||||||
|
// setExpandedKeys(dataList);
|
||||||
|
if (dataList.length < 2) {
|
||||||
|
treeRef.current.scrollTo({ key: dataList[0].id });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...item,
|
title: title,
|
||||||
disabled: hasChildren, // 有子节点的设为禁用
|
key: item.id,
|
||||||
children: hasChildren ? children : undefined
|
name: strTitle
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
return loop(treeData);
|
return loop(treeData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const disableParentNodes = (treeData) => {
|
const disableParentNodes = (treeData) => {
|
||||||
debugger
|
|
||||||
return treeData.map(node => {
|
return treeData.map(node => {
|
||||||
const newNode = { ...node };
|
const newNode = { ...node };
|
||||||
if (node.children && node.children.length > 0) {
|
if (node.children && node.children.length > 0) {
|
||||||
|
|
@ -285,14 +307,16 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
|
||||||
>
|
>
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
showSearch
|
showSearch
|
||||||
|
ref={treeRef}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||||
allowClear
|
allowClear
|
||||||
onSearch={setSearchValue}
|
onSearch={setSearchValue}
|
||||||
fieldNames={item.fieldNames}
|
fieldNames={item.fieldNames}
|
||||||
treeData={handleTreeData(item.treeData,searchValue)}
|
treeData={disableParentNodes(item.treeData)}
|
||||||
treeCheckable={item.multiple}
|
treeCheckable={item.multiple}
|
||||||
disabled={type == 'view'}
|
disabled={type == 'view'}
|
||||||
|
// treeNodeFilterProp='legalName'
|
||||||
filterTreeNode={(inputValue, treeNode) => {
|
filterTreeNode={(inputValue, treeNode) => {
|
||||||
return treeNode.legalName.toLowerCase().includes(inputValue.toLowerCase());
|
return treeNode.legalName.toLowerCase().includes(inputValue.toLowerCase());
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue