tsg-web/src/views/sz/szzf/clyj/content.js

68 lines
2.7 KiB
JavaScript

import styles from './content.module.less'
import { Button } from 'antd'
import ModalForm from './form';
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
import React, { Fragment, useRef, useMemo, useEffect, useState } from 'react';
import { httpget } from '../../../../utils/request';
import apiurl from '../../../../service/apiurl';
const Page = ({ treeSelect }) => {
const refModal = useRef();
const [data,setData] = useState({})
/**
* @description 处理成功的回调
*/
const successCallback = () => {
getInfo()
// setIsFetch(!isFetch)
}
const dataPahe = {
title: '侵占、毁坏水工程及堤防、护岸等有关设施',
zhunag: '1'
}
const edit = () => {
refModal.current.showEdit({...data});
}
const getInfo=()=>{
httpget(apiurl.szzf.clyj.detail+treeSelect?.key).then(res=>{
setData({...res.data,name:treeSelect.name})
})
}
useEffect(()=>{
if(treeSelect){
getInfo()
}
},[treeSelect])
return (
<>
<div className={styles.list} style={{ padding: '0 10px', marginBottom: 5 }}>{treeSelect?.name}<Button type="primary" onClick={edit}>编辑</Button></div>
<div className={styles.listborder} style={{ padding: '0 10px', }}>状态</div>
<div className={styles.listborder} style={{ padding: '0 10px', marginBottom: 5 }}>{data?.status?'启用':'禁用'}</div>
<div className={styles.contentBor} style={{ padding: '0 10px', marginBottom: 5, height: '35%' }}>
<div className={styles.listborder} style={{ padding: '0 10px', height: '30%' }}>法律依据</div>
{data?.legalName ?? '无内容请添加'}
</div>
<div style={{ display: 'flex', height: '33%' }}>
<div className={styles.contentBor} style={{ flex: 1, marginRight: 5 }}>
<div className={styles.listborder} style={{ height: '30%', padding: '0 10px', }}>违法行为描述</div>
<div style={{ padding: '0 10px' }}>{data?.violationDesc ?? '无内容请添加'}</div>
</div>
<div className={styles.contentBor} style={{ flex: 1 }}>
<div className={styles.listborder} style={{ height: '30%', padding: '0 10px', }}>处罚措施</div>
<div style={{ padding: '0 10px' }}>{data?.penalties ?? '无内容请添加'}</div>
</div>
</div>
<BasicCrudModal
width={800}
ref={refModal}
title=""
component={ModalForm}
onCrudSuccess={successCallback}
/>
</>
)
}
export default Page