After Width: | Height: | Size: 205 KiB |
After Width: | Height: | Size: 183 KiB |
After Width: | Height: | Size: 242 KiB |
After Width: | Height: | Size: 858 KiB |
After Width: | Height: | Size: 808 KiB |
After Width: | Height: | Size: 234 KiB |
After Width: | Height: | Size: 895 KiB |
After Width: | Height: | Size: 220 KiB |
After Width: | Height: | Size: 987 KiB |
After Width: | Height: | Size: 260 KiB |
After Width: | Height: | Size: 970 KiB |
After Width: | Height: | Size: 759 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 216 KiB |
After Width: | Height: | Size: 762 KiB |
After Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 710 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 557 KiB |
After Width: | Height: | Size: 252 KiB |
After Width: | Height: | Size: 622 KiB |
After Width: | Height: | Size: 744 KiB |
After Width: | Height: | Size: 232 KiB |
After Width: | Height: | Size: 408 KiB |
After Width: | Height: | Size: 416 KiB |
After Width: | Height: | Size: 248 KiB |
After Width: | Height: | Size: 893 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 924 KiB |
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 932 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 932 KiB |
After Width: | Height: | Size: 269 KiB |
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 899 KiB |
After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 219 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 797 KiB |
After Width: | Height: | Size: 258 KiB |
After Width: | Height: | Size: 874 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 1008 KiB |
@ -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 ( |
|||
<Spin spinning={false}> |
|||
{/* { |
|||
newlysay ? */} |
|||
<DrawerForm |
|||
width={'90rem'} |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={(values) => { |
|||
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' ? |
|||
<ProForm.Group |
|||
> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
tooltip="最长为 24 位" |
|||
placeholder="请输入名称" |
|||
value={recordsay?.[0]?.value} |
|||
rules={[{ required: true, message: "必填" }]} |
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
tooltip="最长为 24 位" |
|||
placeholder="请输入名称" |
|||
value={recordsay?.[1]?.value} |
|||
rules={[{ required: true, message: "必填" }]} |
|||
/> |
|||
<ProFormSelect |
|||
options={[ |
|||
{ |
|||
value: 'true', |
|||
label: '是', |
|||
},{ |
|||
value: 'false', |
|||
label: '否', |
|||
}, |
|||
]} |
|||
width="xs" |
|||
name='done' |
|||
label='是否已完成' |
|||
/> |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" |
|||
key={index} |
|||
/> |
|||
})} |
|||
|
|||
</ProForm.Group> |
|||
: <ProForm.Group> |
|||
<ProFormText |
|||
name={newlys?.[0]?.type} |
|||
width="md" |
|||
label={newlys?.[0]?.name} |
|||
tooltip="最长为 24 位" |
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[0]?.value}
|
|||
rules={[{ required: true, message: "必填" }]} |
|||
/><ProFormText |
|||
name={newlys?.[1]?.type} |
|||
width="md" |
|||
label={newlys?.[1]?.name} |
|||
tooltip="最长为 24 位" |
|||
placeholder="请输入名称" |
|||
// value={recordssy?.[1]?.value}
|
|||
rules={[{ required: true, message: "必填" }]} |
|||
/> |
|||
<ProFormSelect |
|||
options={[ |
|||
{ |
|||
value: 'true', |
|||
label: '是', |
|||
},{ |
|||
value: 'false', |
|||
label: '否', |
|||
}, |
|||
]} |
|||
width="xs" |
|||
name='done' |
|||
label='是否已完成' |
|||
/> |
|||
{newlysay?.map((item, index) => { |
|||
return <ProFormText width="md" |
|||
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" key={index} |
|||
tooltip="最长为 24 位" |
|||
|
|||
/> |
|||
})} |
|||
</ProForm.Group>} |
|||
|
|||
</DrawerForm> |
|||
{/* : '' |
|||
} */} |
|||
|
|||
</Spin> |
|||
) |
|||
} |
|||
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); |