diff --git a/web/client/src/sections/fillion/components/project/project.js b/web/client/src/sections/fillion/components/project/project.js new file mode 100644 index 00000000..819a001e --- /dev/null +++ b/web/client/src/sections/fillion/components/project/project.js @@ -0,0 +1,222 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Form, Spin, Table } from 'antd'; +import { DrawerForm, ProForm, ProFormText,ProFormSelect } from '@ant-design/pro-form'; +import { putProject } from "../../actions/infor" + +const data = { + "entryName": "项目名称", + "projectMileage": "工程里程", + "investment": "投资", + "buildUnit": "建设单位", + "constructionControlUnit": "监理单位", + "designUnit": "设计单位", + "constructionUnit": "施工单位", + "supervisorAndSupervisor": "监督负责人及监督人员", + "projectProgress": "项目进展情况" +} +const ProjectModal = (props) => { + const { visible, onVisibleChange, typecard, rewkeys, recortd, sitename, dispatch, setRecortd, engineering } = props + const [newlys, setNewlys] = useState() //必填数据 + const [newlysay, setNewlysay] = useState() //处理hou + const [records, setRecords] = useState()//处理 + const [recordsay, setRecordsay] = useState()//必填数据 + const [success, setSuccess] = useState() //状态 + const [flage, setFlage] = useState() //xiangmujinzhan + useEffect(() => { + const array = [] + if (rewkeys === 'road') { + _.forIn(data, function (value, key) { + array.push({ name: value, type: key }) + }); + setNewlys(array?.splice(0, 2)) + setNewlysay(array) + // console.log() + + } + if (rewkeys === 'bridge') { + _.forIn(data, function (value, key) { + array.push({ name: value, type: key }) + }); + setNewlys(array?.splice(0, 2)) + setNewlysay(array) + // console.log() + + } + }, []) + useEffect(() => { + const arr = [] + if (rewkeys === 'road') { + _.forIn(recortd, function (value, key) { + arr.push({ value: value, type: key }) + }); + setRecordsay(arr.splice(1, 2)) + + setRecords(arr) + } + if (rewkeys === 'bridge') { + _.forIn(recortd, function (value, key) { + arr.push({ value: value, type: key }) + }); + setRecordsay(arr.splice(1, 2)) + setRecords(arr) + } + }, [recortd]) + useEffect(() => { + return () => { + setRecortd() + } + }, []) + // console.log(recortd) + return ( + + {/* { + newlysay ? */} + { + if (rewkeys === 'road') { + if (typecard == '111') { + console.log(values) + const query = { ...values, type:rewkeys } + dispatch(putProject(query)).then((res) => { + setSuccess(res.success) + }) + return success + } else { + const query = { ...values, type:rewkeys } + dispatch(putProject(query)).then((res) => { + setSuccess(res.success) + }) + return success + } + } + if (rewkeys === 'bridge') { + if (typecard == '111') { + console.log(values) + const query = { ...values, type:rewkeys } + dispatch(putProject(query)).then((res) => { + setSuccess(res.success) + }) + return success + } else { + const query = { ...values, type:rewkeys } + dispatch(putProject(query)).then((res) => { + setSuccess(res.success) + }) + return success + } + } + }} + initialValues={recortd} + > + {typecard == '111' ? + + + + {newlysay?.map((item, index) => { + return + })} + + + : + + + {newlysay?.map((item, index) => { + return + })} + } + + + {/* : '' + } */} + + + ) +} +function mapStateToProps(state) { + const { depMessage } = state; + const pakData = (dep) => { + return dep.map((d) => { + return { + title: d.name, + value: d.id, + children: pakData(d.subordinate) + } + }) + } + let depData = pakData(depMessage.data || []) + return { + loading: depMessage.isRequesting, + depData, + }; +} +export default connect(mapStateToProps)(ProjectModal); \ No newline at end of file