提交 19aa49d0 authored 作者: 钟是志's avatar 钟是志

2073 开发需求1229

上级 3e485400
......@@ -4,20 +4,19 @@ import styles from './index.less';
import { fetchTemplateByCode, fetchTableItem } from '@/webPublic/Services';
import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import SelectPerson from '@/webPublic/FormInsertDiy/ExportComponent/SelectPerson/Index';
import Detail from '@/webPublic/FormInsertDiy/AffairPage/Detail';
export default function RenderForm({
get = 'web',
isCg = 'yes',
style,
...rest
}) {
export default function RenderForm({ get = 'web', isCg = 'yes', style, ...rest }) {
let content = rest?.postData?.unifiedServicePatternModel?.content;
if (isJSON(content)) {
content = JSON.parse(content);
}
const tableRoot = useRef();
const [showPageType, setShowPageType] = useState(0);
const [pageProps, setPageProps] = useState({});
useEffect(() => {
const timerId = setTimeout(() => {
// 修改样式
const div = tableRoot.current && tableRoot.current.root;
if (div) {
div.style.overflow = 'unset';
......@@ -28,6 +27,24 @@ export default function RenderForm({
}`;
document.body.appendChild(new_element);
}, 0);
window.keepAliveCheckRecord = {
showList: (props) => {
setShowPageType(0);
setPageProps({});
document.getElementById('listZdyTable').style.display = 'block';
},
showDetail: (p) => {
setPageProps({
...p,
history: {...p},
});
setShowPageType(1);
console.log(p);
document.getElementById('listZdyTable').style.display = 'none';
},
};
return () => {
clearTimeout(timerId);
};
......@@ -36,9 +53,13 @@ export default function RenderForm({
return null;
}
console.log(showPageType);
return (
<div className={styles.zyd_onestop_style_class} style={style}>
<ZdyTable ref={tableRoot}
<>
<div className={styles.zyd_onestop_style_class} style={style} id={'listZdyTable'}>
<ZdyTable
ref={tableRoot}
get={get}
{...rest}
isQuery={true}
......@@ -47,6 +68,8 @@ export default function RenderForm({
/>
<SelectPerson />
</div>
{showPageType === 1 && <Detail {...pageProps} />}
</>
);
}
......@@ -55,18 +78,11 @@ export default function RenderForm({
* @param {Object} content 表单内容,传入对象
* @param {String} templateCode 表单模板
*/
export function RenderFormByContent({
content,
templateCode,
form,
get,
isCg
}) {
export function RenderFormByContent({ content, templateCode, form, get, isCg }) {
const [formTemplate, setFormTemplate] = useState();
useEffect(
() => {
fetchTemplateByCode(templateCode)
.then((res) => {
fetchTemplateByCode(templateCode).then((res) => {
if (res) {
setFormTemplate(res);
}
......@@ -104,16 +120,15 @@ export function RenderFormByObjId({
form,
get,
isCg,
}) {
}) {
const [content, setContent] = useState({});
useEffect(
() => {
fetchTableItem({
dataObjId: objId,
key: dataTypeKey,
value: dataTypeValue
})
.then((res) => {
value: dataTypeValue,
}).then((res) => {
setContent(res || {});
if (onLoad) {
onLoad(res);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论