|
|
@ -33,7 +33,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
setStructChech(struc) |
|
|
|
let Factor = {} |
|
|
|
struc?.forEach(d => { |
|
|
|
Factor[d.strucId] = d.factor?.filter(w => eidtData?.structList?.find(h => h.structId == d.strucId)?.factors?.map(g => g.codeName)?.includes(w.proto)) |
|
|
|
Factor[d.strucId] = d.factor?.filter(w => eidtData?.structList?.find(h => h.structId == d.strucId)?.factors?.map(g => g.codeName)?.includes(w.id)) |
|
|
|
}) |
|
|
|
setFactorChech(Factor) |
|
|
|
// setActiveKey(eidtData?.factors?.map(s => s.codeName) || []) |
|
|
@ -61,7 +61,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
onOk={() => { |
|
|
|
|
|
|
|
form.current.validate().then((v) => { |
|
|
|
console.log(11, v); |
|
|
|
// console.log(11, v); |
|
|
|
let data = { |
|
|
|
id: eidtData?.id, |
|
|
|
reportName: v.reportName, //报表名称 |
|
|
@ -104,7 +104,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
|
|
|
|
v[p + 'factorId']?.forEach(d => { |
|
|
|
let factorFind = structFind?.factors?.find(c => c.codeName == d) || {} |
|
|
|
let index = d.length + structNameIndex + 5 |
|
|
|
let index = d.toString().length + structNameIndex + 5 |
|
|
|
let factorData = {} |
|
|
|
for (let key in v) { |
|
|
|
factorData.codeName = d |
|
|
@ -118,7 +118,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
//索力监测描述 |
|
|
|
if (key?.slice(index) == 'factorDescrip') factorData.factorDescrip = v[key] |
|
|
|
//测点选择 |
|
|
|
if (key?.slice(index) == 'sensorNames') factorData.sensorNames = factorChech[p]?.find(p => p.proto == d)?.sensor?.filter(f => v[key]?.includes(f.id))?.map(c => ({ id: c.id, name: c.name })) || [] |
|
|
|
if (key?.slice(index) == 'sensorNames') factorData.sensorNames = factorChech[p]?.find(p => p.id == d)?.sensor?.filter(f => v[key]?.includes(f.id))?.map(c => ({ id: c.id, name: c.name })) || [] |
|
|
|
//开始结束时间 |
|
|
|
if (key?.slice(index) == 'startEndTime') { |
|
|
|
factorData.startTime = v[key] && v[key][0] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') |
|
|
@ -129,7 +129,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
factorData.tempName?.push({ |
|
|
|
index: 1, |
|
|
|
id: v[key], |
|
|
|
name: factorChech[p]?.find(p => p.proto == d)?.sensor?.find(f => v[key] == f.id)?.name |
|
|
|
name: factorChech[p]?.find(p => p.id == d)?.sensor?.find(f => v[key] == f.id)?.name |
|
|
|
}) |
|
|
|
} |
|
|
|
//温度测点 |
|
|
@ -157,6 +157,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
data.structList.push(structData) |
|
|
|
}) |
|
|
|
|
|
|
|
// console.log(222, data); |
|
|
|
dispatch(service.postAutomaticReport(data)).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
close() |
|
|
@ -288,11 +289,11 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
initValue={structFind?.factors?.map(s => s.codeName) || []} |
|
|
|
rules={[{ required: true, message: "请选择监测因素" }]} disabled={structId ? false : true} |
|
|
|
onChange={v => { |
|
|
|
setFactorChech({ ...factorChech, [s.strucId]: s.factor?.filter(d => v.includes(d.proto)) || [] }) |
|
|
|
setFactorChech({ ...factorChech, [s.strucId]: s.factor?.filter(d => v.includes(d.id)) || [] }) |
|
|
|
// setActiveKey(v) |
|
|
|
}} > |
|
|
|
{s.factor?.map((item) => { |
|
|
|
return <Form.Select.Option value={item.proto} key={item.proto} label={item.name}></Form.Select.Option> |
|
|
|
return <Form.Select.Option value={item.id} key={item.id} label={item.name}></Form.Select.Option> |
|
|
|
})} |
|
|
|
|
|
|
|
</Form.Select> |
|
|
@ -305,14 +306,14 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
> |
|
|
|
{ |
|
|
|
factorChech[s.strucId]?.map(p => { |
|
|
|
let factorFind = structFind?.factors?.find(c => c.codeName == p.proto) || {} |
|
|
|
return <Collapse.Panel header={p.name} itemKey={p.proto} key={p.proto}> |
|
|
|
let factorFind = structFind?.factors?.find(c => c.codeName == p.id) || {} |
|
|
|
return <Collapse.Panel header={p.name} itemKey={p.id} key={p.id}> |
|
|
|
<div style={{ background: "#FFF" }}> |
|
|
|
<Form.TextArea field={s.strucId + 'struc' + p.proto + "pointDescrip"} label='布点描述' style={{ width: 400 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear |
|
|
|
<Form.TextArea field={s.strucId + 'struc' + p.id + "pointDescrip"} label='布点描述' style={{ width: 340 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear |
|
|
|
initValue={factorFind?.pointDescrip || ""} |
|
|
|
rules={[{ required: true, message: "请输入布点描述" }]} |
|
|
|
/> |
|
|
|
<Form.Upload label="布点图片" field={s.strucId + 'struc' + p.proto + "pointPicPath"} style={{ display: 'inline-block', }} |
|
|
|
<Form.Upload label="布点图片" field={s.strucId + 'struc' + p.id + "pointPicPath"} style={{ display: 'inline-block', }} |
|
|
|
initValue={factorFind?.pointPicPath && [{ url: `/_file-server/${factorFind?.pointPicPath?.slice(qiniuUrl.length + 1)}`, name: factorFind?.pointPicPath?.split('/')?.pop(), status: 'success', preview: ['png', 'jpg', 'jpeg'].includes(factorFind?.pointPicPath?.split('.')?.pop()?.replace('.', '')) }] || null} |
|
|
|
rules={[{ required: true, message: "请上传布点图片" }]} |
|
|
|
action={`${apiRoot}/attachments/p`} |
|
|
@ -325,12 +326,12 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
</Form.Upload> |
|
|
|
|
|
|
|
{s.proto == 2001 && |
|
|
|
<Form.TextArea field={s.strucId + 'struc' + p.proto + "factorDescrip"} label='索力监测描述' style={{ width: 400 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear |
|
|
|
<Form.TextArea field={s.strucId + 'struc' + p.id + "factorDescrip"} label='索力监测描述' style={{ width: 400 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear |
|
|
|
initValue={factorFind?.factorDescrip || ""} |
|
|
|
/> |
|
|
|
} |
|
|
|
|
|
|
|
<Form.Select label="测点选择" field={s.strucId + 'struc' + p.proto + "sensorNames"} multiple={true} placeholder="请选择测点选择" style={{ width: 300 }} showClear filter |
|
|
|
<Form.Select label="测点选择" field={s.strucId + 'struc' + p.id + "sensorNames"} multiple={true} placeholder="请选择测点选择" style={{ width: 300 }} showClear filter |
|
|
|
initValue={factorFind?.sensorNames?.map(a => a.id) || []} |
|
|
|
rules={[{ required: true, message: "请选择测点选择" }]} |
|
|
|
> |
|
|
@ -338,20 +339,20 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
return <Form.Select.Option value={item.id} label={item.name}></Form.Select.Option> |
|
|
|
})} |
|
|
|
</Form.Select> |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.proto + 'startEndTime'} label='开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }} |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.id + 'startEndTime'} label='开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }} |
|
|
|
initValue={factorFind?.startTime && [moment(factorFind?.startTime).format('YYYY-MM-DD HH:mm:ss'), moment(factorFind?.endTime).format('YYYY-MM-DD HH:mm:ss')] || null} |
|
|
|
rules={[{ required: true, message: "请选择开始结束时间" }]} |
|
|
|
/> |
|
|
|
{ |
|
|
|
['2001', '4004', '4007', '4008'].includes(p.proto) && |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.proto + 'initialTime'} label='数据初始时间' type='dateTime' showClear |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.id + 'initialTime'} label='数据初始时间' type='dateTime' showClear |
|
|
|
rules={[{ required: true, message: "请选择数据初始时间" }]} |
|
|
|
initValue={factorFind?.initialTime && moment(factorFind?.initialTime).format('YYYY-MM-DD HH:mm:ss')} |
|
|
|
/> |
|
|
|
} |
|
|
|
{ |
|
|
|
['4009', '3001', '4004', '4001', '4007'].includes(s.proto) && <> |
|
|
|
<Form.Select label="关联温度的测点" field={s.strucId + 'struc' + p.proto + "tempName1"} showClear placeholder="请选择关联的温度测点" style={{ width: 300 }} filter |
|
|
|
<Form.Select label="关联温度的测点" field={s.strucId + 'struc' + p.id + "tempName1"} showClear placeholder="请选择关联的温度测点" style={{ width: 300 }} filter |
|
|
|
initValue={factorFind?.tempName?.find(c => c.index == 1)?.id || ""} |
|
|
|
onChange={v => { |
|
|
|
|
|
|
@ -363,7 +364,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
|
|
|
|
})} |
|
|
|
</Form.Select> |
|
|
|
<Form.Select label="温度测点" field={s.strucId + 'struc' + p.proto + "tempName2"} placeholder="请选择温度测点" style={{ width: 300 }} filter showClear |
|
|
|
<Form.Select label="温度测点" field={s.strucId + 'struc' + p.id + "tempName2"} placeholder="请选择温度测点" style={{ width: 300 }} filter showClear |
|
|
|
initValue={factorFind?.tempName?.find(c => c.index == 2)?.id || ""} |
|
|
|
> |
|
|
|
{s.factors?.find(d => d.proto == 1004 || d.proto == 1002)?.sensor?.map((item) => { |
|
|
@ -371,7 +372,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat |
|
|
|
|
|
|
|
})} |
|
|
|
</Form.Select> |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.proto + 'releTime'} label='关联开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }} |
|
|
|
<Form.DatePicker field={s.strucId + 'struc' + p.id + 'releTime'} label='关联开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }} |
|
|
|
initValue={factorFind?.releStartTime && [moment(factorFind?.releStartTime).format('YYYY-MM-DD HH:mm:ss'), moment(factorFind?.releEndTime).format('YYYY-MM-DD HH:mm:ss')] || null} |
|
|
|
/> |
|
|
|
</> |
|
|
|