zhaobing 12 months ago
parent
commit
d23dbdad01
  1. 30
      api/app/lib/models/report_automatic.js
  2. 22
      script/4.4/schema/1.update_report_automatic.sql
  3. 20
      web/client/src/sections/analysis/containers/network.jsx
  4. 410
      web/client/src/sections/service/components/automatic-Modal.jsx
  5. 10
      web/client/src/sections/service/containers/automaticReport.jsx

30
api/app/lib/models/report_automatic.js

@ -17,7 +17,7 @@ module.exports = dc => {
}, },
reportName: { reportName: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "", comment: "",
primaryKey: false, primaryKey: false,
@ -87,8 +87,17 @@ module.exports = dc => {
field: "ratifier", field: "ratifier",
autoIncrement: false autoIncrement: false
}, },
coverTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: "",
primaryKey: false,
field: "cover_time",
autoIncrement: false
},
structId: { structId: {
type: DataTypes.INTEGER, type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "", comment: "",
@ -96,9 +105,18 @@ module.exports = dc => {
field: "struct_id", field: "struct_id",
autoIncrement: false autoIncrement: false
}, },
structList: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null,
comment: "",
primaryKey: false,
field: "struct_list",
autoIncrement: false
},
projectOverview: { projectOverview: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "", comment: "",
primaryKey: false, primaryKey: false,
@ -107,7 +125,7 @@ module.exports = dc => {
}, },
reportStartTime: { reportStartTime: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "开始时间", comment: "开始时间",
primaryKey: false, primaryKey: false,
@ -116,7 +134,7 @@ module.exports = dc => {
}, },
reportEndTime: { reportEndTime: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "开始时间", comment: "开始时间",
primaryKey: false, primaryKey: false,
@ -134,7 +152,7 @@ module.exports = dc => {
}, },
factors: { factors: {
type: DataTypes.JSON, type: DataTypes.JSON,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "", comment: "",
primaryKey: false, primaryKey: false,

22
script/4.4/schema/1.update_report_automatic.sql

@ -0,0 +1,22 @@
alter table report_automatic alter column report_name drop not null;
alter table report_automatic alter column report_start_time drop not null;
alter table report_automatic alter column report_end_time drop not null;
alter table report_automatic alter column factors drop not null;
alter table report_automatic alter column project_overview drop not null;
alter table report_automatic
add cover_time timestamp;
alter table report_automatic
add struct_list json;
alter table report_automatic drop column struct_id;
alter table report_automatic
add struct_id integer[] not null;

20
web/client/src/sections/analysis/containers/network.jsx

@ -92,7 +92,7 @@ const Network = ({
> >
<Form.Select <Form.Select
filter filter
showClear // showClear
label='项目选择' label='项目选择'
field="projectId" field="projectId"
labelPosition="left" labelPosition="left"
@ -101,9 +101,11 @@ const Network = ({
// value={projectValue} // value={projectValue}
optionList={projectList || []} optionList={projectList || []}
onSelect={v => { onSelect={v => {
setProjectValue(v) if (projectValue != v) {
setSpinning(true) setProjectValue(v)
form.current.setValue('projectId', v) setSpinning(true)
form.current.setValue('projectId', v)
}
}} }}
/> />
<Form.Select <Form.Select
@ -113,12 +115,14 @@ const Network = ({
style={{ width: 200, }} style={{ width: 200, }}
placeholder="请选择结构物选择" placeholder="请选择结构物选择"
filter filter
showClear // showClear
optionList={organizationsStruc?.map(d => ({ value: d.thingId, label: d.strucName })) || []} optionList={organizationsStruc?.map(d => ({ value: d.thingId, label: d.strucName })) || []}
onSelect={v => { onSelect={v => {
setSpinning(true) if (thingId != v) {
setThingId(v) setSpinning(true)
form.current.setValue('thingId', v) setThingId(v)
form.current.setValue('thingId', v)
}
}} }}
/> />
</Form> </Form>

410
web/client/src/sections/service/components/automatic-Modal.jsx

@ -12,10 +12,11 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
const [strucData, setStrucData] = useState([]) // const [strucData, setStrucData] = useState([]) //
const [projectId, setProjectId] = useState(); //id const [projectId, setProjectId] = useState(); //id
const [structId, setStructId] = useState(); //id const [structId, setStructId] = useState([]); //id
const [factorId, setFactorId] = useState([]); //id const [factorId, setFactorId] = useState([]); //id
const [factorList, setFactorList] = useState([]); // const [factorList, setFactorList] = useState([]); //
const [factorChech, setFactorChech] = useState([]); // const [structChech, setStructChech] = useState([]); //
const [factorChech, setFactorChech] = useState({}); //
const [activeKey, setActiveKey] = useState([]); // const [activeKey, setActiveKey] = useState([]); //
const [correlationId, setCorrelationId] = useState([]); // const [correlationId, setCorrelationId] = useState([]); //
@ -23,13 +24,18 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
useEffect(async () => { useEffect(async () => {
if (eidtData?.id) { if (eidtData?.id) {
setProjectId(eidtData?.projectId) setProjectId(eidtData?.projectId)
setStructId(eidtData?.structId) setStructId(eidtData?.structId || [])
setFactorId(eidtData?.factors?.map(s => s.codeName) || []) setFactorId(eidtData?.factors?.map(s => s.codeName) || [])
let data = await getData(eidtData?.projectId) let data = await getData(eidtData?.projectId)
let Factor = data?.find(s => s.strucId == eidtData?.structId)?.factor || [] let struc = data?.filter(s => eidtData?.structId?.includes(s.strucId)) || []
setFactorList(Factor)
setFactorChech(Factor?.filter(s => eidtData?.factors?.map(s => s.codeName)?.includes(s.proto))) 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.id))
})
setFactorChech(Factor)
// setActiveKey(eidtData?.factors?.map(s => s.codeName) || []) // setActiveKey(eidtData?.factors?.map(s => s.codeName) || [])
} }
}, []) }, [])
@ -48,76 +54,110 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
return ( return (
<> <>
<Modal <Modal
title={eidtData.id ? "编辑生成规制" : '新增生成规制'} title={eidtData.id ? "编辑报表生成规则" : '新增报表生成规则'}
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
visible={visible} visible={visible}
onOk={() => { onOk={() => {
form.current.validate().then((v) => { form.current.validate().then((v) => {
// console.log(11, v);
let data = { let data = {
id: eidtData?.id, id: eidtData?.id,
reportName: v.reportName, reportName: v.reportName, //
projectId: v.projectId, projectId: v.projectId, //
projectName: v.projectName, projectName: v.projectName, //
reportType: v.reportType, reportType: v.reportType, //
reportPicPath: v.reportPicPath[0]?.response?.url, reportPicPath: v.reportPicPath && v.reportPicPath[0] && v.reportPicPath[0]?.response?.url || eidtData.reportPicPath, //
overview: v.overview[0]?.response?.url, framer: v.framer, //
framer: v.framer, auditor: v.auditor, //
auditor: v.auditor, ratifier: v.ratifier, //
ratifier: v.ratifier, coverTime: v.coverTime && moment(v.coverTime),
structId: v.structId, structId: v.structId, //id
projectOverview: v.projectOverview, structList: []
reportStartTime: moment(v.reportTime[0]).format('YYYY-MM-DD HH:mm:ss'),
reportEndTime: moment(v.reportTime[1]).format('YYYY-MM-DD HH:mm:ss'),
time: eidtData?.time && moment(eidtData?.time).format('YYYY-MM-DD HH:mm:ss') || null,
factors: []
} }
v.factorId?.forEach(d => { v.structId?.forEach(p => {
let index = d.length let structFind = eidtData?.structList?.find(d => d.structId == p) || {}
let factorData = {} let structData = { structId: p }
let structNameIndex = p.toString().length || 0
for (let key in v) { for (let key in v) {
factorData.codeName = d if (key?.indexOf(p) != -1) {
factorData.tempName = factorData.tempName || [] //
if (key?.indexOf(d) != -1) { if (key?.slice(structNameIndex) == 'overview') structData.overview = v[key] && v[key][0]?.response?.url || structFind.overview
if (key?.slice(index) == 'pointDescrip') factorData.pointDescrip = v[key] //
if (key?.slice(index) == 'pointPicPath') factorData.pointPicPath = v[key] && v[key][0]?.response?.url if (key?.slice(structNameIndex) == 'projectOverview') structData.projectOverview = v[key]
if (key?.slice(index) == 'factorDescrip') factorData.factorDescrip = v[key] //
if (key?.slice(index) == 'sensorNames') factorData.sensorNames = factorChech?.find(p => p.proto == d)?.sensor?.filter(f => v[key]?.includes(f.id))?.map(c => ({ id: c.id, name: c.name })) || [] if (key?.slice(structNameIndex) == 'conclusion') structData.conclusion = v[key]
if (key?.slice(index) == 'startEndTime') { //
factorData.startTime = v[key] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') if (key?.slice(structNameIndex) == 'reportTime') {
factorData.endTime = v[key] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') structData.reportStartTime = v[key] && v[key][0] && moment(v[key][0])
} structData.reportEndTime = v[key] && v[key][1] && moment(v[key][1])
if (key?.slice(index) == 'tempName1') {
factorData.tempName?.push({
index: 1,
id: v[key],
name: factorChech?.find(p => p.proto == d)?.sensor?.find(f => v[key] == f.id)?.name
})
}
if (key?.slice(index) == 'tempName2') {
factorData.tempName?.push({
index: 2,
id: v[key],
name: factorChech?.find(p => p.proto == 1004)?.sensor?.find(f => v[key] == f.id)?.name
})
}
if (key?.slice(index) == 'factorDescrip') factorData.factorDescrip = v[key]
// if (key?.slice(index) == 'glStaName') factorData.glStaName = v[key]
// if (key?.slice(index) == 'tempStaName') factorData.tempStaName = v[key]
if (key?.slice(index) == 'initialTime') factorData.initialTime = v[key] && moment(v[key]).format('YYYY-MM-DD HH:mm:ss')
if (key?.slice(index) == 'releTime') {
factorData.releStartTime = v[key] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss')
factorData.releEndTime = v[key] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss')
} }
//
structData.factors = []
} }
} }
factorData.glStaName = factorData?.tempName?.find(s => s.index == 1)?.name
factorData.tempStaName = factorData?.tempName?.find(s => s.index == 2)?.name || factorData?.tempName?.find(s => s.index == 1)?.name // debugger
data.factors?.push(factorData)
v[p + 'factorId']?.forEach(d => {
let factorFind = structFind?.factors?.find(c => c.codeName == d) || {}
let index = d.toString().length + structNameIndex + 5
let factorData = {}
for (let key in v) {
factorData.codeName = d
factorData.tempName = factorData.tempName || []
if (key?.indexOf(p + 'struc') != -1 && key?.indexOf('struc' + d) != -1) {
//
if (key?.slice(index) == 'pointDescrip') factorData.pointDescrip = v[key]
//
if (key?.slice(index) == 'pointPicPath') factorData.pointPicPath = v[key] && v[key][0]?.response?.url ||
factorFind.pointPicPath
//
if (key?.slice(index) == 'factorDescrip') factorData.factorDescrip = v[key]
//
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])
factorData.endTime = v[key] && v[key][1] && moment(v[key][1])
}
//
if (key?.slice(index) == 'tempName1') {
factorData.tempName?.push({
index: 1,
id: v[key],
name: factorChech[p]?.find(p => p.id == d)?.sensor?.find(f => v[key] == f.id)?.name
})
}
//
if (key?.slice(index) == 'tempName2') {
factorData.tempName?.push({
index: 2,
id: v[key],
name: factorChech[p]?.find(p => p.proto == 1004)?.sensor?.find(f => v[key] == f.id)?.name
})
}
//
if (key?.slice(index) == 'initialTime') factorData.initialTime = v[key] && moment(v[key])
//
if (key?.slice(index) == 'releTime') {
factorData.releStartTime = v[key] && v[key][0] && moment(v[key][0])
factorData.releEndTime = v[key] && v[key][1] && moment(v[key][1])
}
}
}
factorData.glStaName = factorData?.tempName?.find(s => s.index == 1)?.name
factorData.tempStaName = factorData?.tempName?.find(s => s.index == 2)?.name || factorData?.tempName?.find(s => s.index == 1)?.name
structData.factors?.push(factorData)
})
data.structList.push(structData)
}) })
// console.log(222, data);
dispatch(service.postAutomaticReport(data)).then((res) => { dispatch(service.postAutomaticReport(data)).then((res) => {
if (res.success) { if (res.success) {
close() close()
@ -127,7 +167,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
}) })
}} }}
width={700} width={770}
onCancel={() => close()} onCancel={() => close()}
> >
<Form <Form
@ -139,7 +179,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
> >
<Form.Input field="reportName" label='报表名称' style={{ width: 300 }} placeholder="请输入报表名称" showClear <Form.Input field="reportName" label='报表名称' style={{ width: 300 }} placeholder="请输入报表名称" showClear
initValue={eidtData?.reportName || ""} initValue={eidtData?.reportName || ""}
// rules={[{ required: true, message: ",15", max: 15 }]} // rules={[{ required: true, message: ",15", max: 15 }]}
/> />
<Form.Select label="所属项目" field="projectId" placeholder="请选择项目" showClear style={{ width: 300 }} filter <Form.Select label="所属项目" field="projectId" placeholder="请选择项目" showClear style={{ width: 300 }} filter
initValue={eidtData?.projectId || ""} initValue={eidtData?.projectId || ""}
@ -147,20 +187,20 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
onChange={v => { onChange={v => {
setProjectId(v) setProjectId(v)
getData(v) getData(v)
form.current.setValue('structId', null) form.current.setValue('structId', [])
setStructId("") setStructId([])
setFactorList([]) // setFactorList([])
form.current.setValue('factorId', []) // form.current.setValue('factorId', [])
setFactorChech([]) setStructChech([])
}} > }} >
{projectList?.map((item) => { {projectList?.map((item) => {
return <Form.Select.Option value={item.id} label={item.name || item.pepProjectName}></Form.Select.Option> return <Form.Select.Option value={item.id} key={item.id} label={item.name || item.pepProjectName}></Form.Select.Option>
})} })}
</Form.Select> </Form.Select>
<Form.Input field="projectName" label='项目名称' style={{ width: 300 }} placeholder="请输入项目名称" showClear <Form.Input field="projectName" label='项目名称' style={{ width: 300 }} placeholder="请输入项目名称" showClear
initValue={eidtData?.projectName || ""} initValue={eidtData?.projectName || ""}
rules={[{ required: true, message: "请输入项目名称"}]} rules={[{ required: true, message: "请输入项目名称" }]}
/> />
<Form.Select label="报表类型" field="reportType" placeholder="请选择报表类型" showClear style={{ width: 300 }} <Form.Select label="报表类型" field="reportType" placeholder="请选择报表类型" showClear style={{ width: 300 }}
rules={[{ required: true, message: "请选择报表类型" }]} rules={[{ required: true, message: "请选择报表类型" }]}
@ -178,16 +218,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
文件上传 文件上传
</Button> </Button>
</Form.Upload> </Form.Upload>
<Form.Upload label="项目概况" field="overview" style={{ display: 'inline-block', }}
initValue={eidtData?.overview && [{ url: `/_file-server/${eidtData?.overview?.slice(qiniuUrl.length + 1)}`, name: eidtData.overview?.split('/')?.pop(), status: 'success', preview: ['png', 'jpg', 'jpeg'].includes(eidtData.reportPicPath?.split('.')?.pop()?.replace('.', '')) }] || null}
action={`${apiRoot}/attachments/p`}
accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'}
limit={1} maxSize={5120}
>
<Button icon={<IconUpload />} theme="light">
文件上传
</Button>
</Form.Upload>
<Form.Input field="framer" label='制定者' style={{ width: 300 }} placeholder="请输入制定者" showClear <Form.Input field="framer" label='制定者' style={{ width: 300 }} placeholder="请输入制定者" showClear
initValue={eidtData?.framer || ""} initValue={eidtData?.framer || ""}
rules={[{ required: true, message: "请输入制定者" }]} rules={[{ required: true, message: "请输入制定者" }]}
@ -200,44 +231,27 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
initValue={eidtData?.ratifier || ""} initValue={eidtData?.ratifier || ""}
rules={[{ required: true, message: "请输入批准者" }]} rules={[{ required: true, message: "请输入批准者" }]}
/> />
<Form.DatePicker label="封面时间" field="coverTime" showClear style={{ width: 300 }}
initValue={eidtData?.coverTime && moment(eidtData?.coverTime).format('YYYY-MM-DD') || ""}
/>
<Form.Select label="结构物" field="structId" placeholder="请选择结构物" showClear style={{ width: 300 }} filter <Form.Select label="结构物" field="structId" placeholder="请选择结构物" showClear style={{ width: 300 }} filter
rules={[{ required: true, message: "请选择结构物" }]} disabled={projectId ? false : true} rules={[{ required: true, message: "请选择结构物" }]} disabled={projectId ? false : true}
initValue={eidtData?.structId || ""} initValue={eidtData?.structId || ""} multiple={true}
onChange={v => { onChange={v => {
setFactorList(strucData?.find(s => s.strucId == v)?.factor || []) // setFactorList(strucData?.find(s => v.includes(s.stdrucId)) || [])
setStructId(v) setStructId(v)
form.current.setValue('factorId', []) // form.current.setValue('factorId', [])
setFactorChech([]) setStructChech(strucData?.filter(s => v.includes(s.strucId)) || [])
}} > }} >
{strucData?.map((item) => { {strucData?.map((item) => {
return <Form.Select.Option value={item.strucId} label={item.strucName}></Form.Select.Option> return <Form.Select.Option value={item.strucId} key={item.strucId} label={item.strucName}></Form.Select.Option>
})}
</Form.Select>
<Form.TextArea field="projectOverview" label='报表描述' style={{ width: 420 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入报表描述" showClear
initValue={eidtData?.projectOverview || ""}
rules={[{ required: true, message: "请输入报表描述" }]}
/>
<Form.DatePicker field='reportTime' label='开始结束时间' type='dateTimeRange' showClear
initValue={eidtData?.reportStartTime && [moment(eidtData?.reportStartTime).format('YYYY-MM-DD HH:mm:ss'), moment(eidtData?.reportEndTime).format('YYYY-MM-DD HH:mm:ss')] || null}
rules={[{ required: true, message: "请选择开始结束时间" }]}
/>
<Form.Select label="包含的监测因素" field="factorId" placeholder="请选择监测因素" showClear style={{ width: 300 }} filter multiple={true}
initValue={eidtData?.factors?.map(s => s.codeName) || []}
rules={[{ required: true, message: "请选择监测因素" }]} disabled={structId ? false : true}
onChange={v => {
setFactorChech(factorList?.filter(s => v.includes(s.proto)))
// setActiveKey(v)
}} >
{factorList?.map((item) => {
return <Form.Select.Option value={item.proto} label={item.name}></Form.Select.Option>
})} })}
</Form.Select> </Form.Select>
{factorChech?.length > 0 ? <Collapse style={{ margin: '20px 0 20px 30px', width: '90%', background: '#b7c9e624' }} {/*所选结构物 */}
{structChech?.length > 0 ? <Collapse style={{ margin: '20px 0 20px 30px', width: '90%', background: '#b7c9e624' }}
// activeKey={activeKey} // activeKey={activeKey}
keepDOM={true} keepDOM={true}
onChange={v => { onChange={v => {
@ -245,86 +259,131 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
}} }}
> >
{ {
factorChech?.map(s => { structChech?.map(s => {
return <Collapse.Panel header={ s.name} itemKey={s.proto} key={s.proto}> let structFind = eidtData?.structList?.find(d => d.structId == s.strucId) || {}
return <Collapse.Panel header={s.strucName} itemKey={`'${s.strucId}'`} key={s.strucId}>
<div style={{ background: "#FFF" }}> <div style={{ background: "#FFF" }}>
<Form.TextArea field={s.proto + "pointDescrip"} label='布点描述' style={{ width: 400 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear <Form.Upload label="结构物概况图片" field={s.strucId + "overview"} style={{ display: 'inline-block', }}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.pointDescrip || ""} initValue={structFind?.overview && [{ url: `/_file-server/${structFind?.overview?.slice(qiniuUrl.length + 1)}`, name: structFind.overview?.split('/')?.pop(), status: 'success', preview: ['png', 'jpg', 'jpeg'].includes(structFind.overview?.split('.')?.pop()?.replace('.', '')) }] || null}
rules={[{ required: true, message: "请输入布点描述" }]}
/>
<Form.Upload label="布点图片" field={s.proto + "pointPicPath"} style={{ display: 'inline-block', }}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.pointPicPath && [{ url: `/_file-server/${eidtData?.factors?.find(c => c.codeName == s.proto)?.pointPicPath?.slice(qiniuUrl.length + 1)}`, name: eidtData?.factors?.find(c => c.codeName == s.proto)?.pointPicPath?.split('/')?.pop(), status: 'success', preview: ['png', 'jpg', 'jpeg'].includes(eidtData?.factors?.find(c => c.codeName == s.proto)?.pointPicPath?.split('.')?.pop()?.replace('.', '')) }] || null}
rules={[{ required: true, message: "请上传布点图片" }]}
action={`${apiRoot}/attachments/p`} action={`${apiRoot}/attachments/p`}
accept={'.png, .jpg, .jpeg'} accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'}
limit={1} maxSize={5120} limit={1} maxSize={5120}
> >
<Button icon={<IconUpload />} theme="light"> <Button icon={<IconUpload />} theme="light">
文件上传 文件上传
</Button> </Button>
</Form.Upload> </Form.Upload>
<Form.TextArea field={s.strucId + "projectOverview"} label='结构物描述' style={{ width: 390 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入结构物描述" showClear
{s.proto == 2001 && initValue={structFind?.projectOverview || ""}
<Form.TextArea field={s.proto + "factorDescrip"} label='索力监测描述' style={{ width: 400 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入布点描述" showClear rules={[{ required: true, message: "请输入结构物描述" }]}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.factorDescrip || ""}
/>
}
<Form.Select label="测点选择" field={s.proto + "sensorNames"} multiple={true} placeholder="请选择测点选择" style={{ width: 300 }} showClear filter
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.sensorNames?.map(a => a.id) || []}
rules={[{ required: true, message: "请选择测点选择" }]}
>
{s.sensor?.map((item) => {
return <Form.Select.Option value={item.id} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<Form.DatePicker field={s.proto + 'startEndTime'} label='开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.startTime && [moment(eidtData?.factors?.find(c => c.codeName == s.proto)?.startTime).format('YYYY-MM-DD HH:mm:ss'), moment(eidtData?.factors?.find(c => c.codeName == s.proto)?.endTime).format('YYYY-MM-DD HH:mm:ss')] || null}
rules={[{ required: true, message: "请选择开始结束时间" }]}
/> />
{ <Form.TextArea field={s.strucId + "conclusion"} label='结论' style={{ width: 390 }} autosize={{ minRows: 2, maxRows: 10 }} placeholder="请输入结论" showClear
['2001', '4004', '4007', '4008'].includes(s.proto) && initValue={eidtData?.structList?.find(d => d.structId == s.strucId)?.conclusion || ""}
<Form.DatePicker field={s.proto + 'initialTime'} label='数据初始时间' type='dateTime' showClear // rules={[{ required: true, message: "" }]}
rules={[{ required: true, message: "请选择数据初始时间" }]}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.initialTime && moment(eidtData?.factors?.find(c => c.codeName == s.proto)?.initialTime).format('YYYY-MM-DD HH:mm:ss')}
/>
}
{
['4009', '3001', '4004', '4001', '4007'].includes(s.proto) && <>
<Form.Select label="关联温度的测点" field={s.proto + "tempName1"} showClear placeholder="请选择关联的温度测点" style={{ width: 300 }} filter
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.tempName?.find(c => c.index == 1)?.id || ""}
onChange={v => {
}}
>
{s.sensor?.map((item) => {
return <Form.Select.Option value={item.id} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<Form.Select label="温度测点" field={s.proto + "tempName2"} placeholder="请选择温度测点" style={{ width: 300 }} filter showClear
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.tempName?.find(c => c.index == 2)?.id || ""}
>
{factorList?.find(d => d.proto == 1004 || d.proto == 1002)?.sensor?.map((item) => {
return <Form.Select.Option value={item.name} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<Form.DatePicker field={s.proto + 'releTime'} label='关联开始结束时间' type='dateTimeRange' showClear style={{ width: 360 }}
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.releStartTime && [moment(eidtData?.factors?.find(c => c.codeName == s.proto)?.releStartTime).format('YYYY-MM-DD HH:mm:ss'), moment(eidtData?.factors?.find(c => c.codeName == s.proto)?.releEndTime).format('YYYY-MM-DD HH:mm:ss')] || null}
/>
</>
}
{/* <Form.Input field={s.proto + "glStaName"} label='' style={{ width: 300 }} placeholder="" showClear
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.glStaName || ""}
/> />
<Form.Input field={s.proto + "tempStaName"} label='关联温度名称' style={{ width: 300 }} placeholder="请输入关联温度名称" showClear <Form.DatePicker field={s.strucId + 'reportTime'} label='开始结束时间' type='dateTimeRange' showClear
initValue={eidtData?.factors?.find(c => c.codeName == s.proto)?.tempStaName || ""} initValue={structFind?.reportStartTime && [moment(structFind?.reportStartTime).format('YYYY-MM-DD HH:mm:ss'), moment(structFind?.reportEndTime).format('YYYY-MM-DD HH:mm:ss')] || null} style={{ width: 390 }}
/> */} rules={[{ required: true, message: "请选择开始结束时间" }]}
/>
<Form.Select label="包含的监测因素" field={s.strucId + "factorId"} placeholder="请选择监测因素" showClear style={{ width: 300 }} filter multiple={true}
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.id)) || [] })
// setActiveKey(v)
}} >
{s.factor?.map((item) => {
return <Form.Select.Option value={item.id} key={item.id} label={item.name}></Form.Select.Option>
})}
</Form.Select>
{factorChech[s.strucId] ? <Collapse style={{ margin: '20px 0 20px 30px', width: '90%', background: '#b7c9e624' }}
// activeKey={activeKey}
keepDOM={true}
onChange={v => {
// setActiveKey(v)
}}
>
{
factorChech[s.strucId]?.map(p => {
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.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.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`}
accept={'.png, .jpg, .jpeg'}
limit={1} maxSize={5120}
>
<Button icon={<IconUpload />} theme="light">
文件上传
</Button>
</Form.Upload>
{s.proto == 2001 &&
<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.id + "sensorNames"} multiple={true} placeholder="请选择测点选择" style={{ width: 300 }} showClear filter
initValue={factorFind?.sensorNames?.map(a => a.id) || []}
rules={[{ required: true, message: "请选择测点选择" }]}
>
{p.sensor?.map((item) => {
return <Form.Select.Option value={item.id} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<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.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.id + "tempName1"} showClear placeholder="请选择关联的温度测点" style={{ width: 300 }} filter
initValue={factorFind?.tempName?.find(c => c.index == 1)?.id || ""}
onChange={v => {
}}
>
{p.sensor?.map((item) => {
return <Form.Select.Option value={item.id} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<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) => {
return <Form.Select.Option value={item.name} label={item.name}></Form.Select.Option>
})}
</Form.Select>
<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}
/>
</>
}
</div>
</Collapse.Panel>
})
}
</Collapse> : ""}
</div> </div>
</Collapse.Panel> </Collapse.Panel>
}) })
@ -333,6 +392,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
</Collapse> : ""} </Collapse> : ""}
</Form> </Form>
</Modal > </Modal >
</> </>

10
web/client/src/sections/service/containers/automaticReport.jsx

@ -134,11 +134,11 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener
4007: 'QDQXJC', 4007: 'QDQXJC',
1004: 'JGWDJC' 1004: 'JGWDJC'
} }
row?.factors?.forEach(d => { // row?.factors?.forEach(d => {
d.codeName = dataList[d.codeName] // d.codeName = dataList[d.codeName]
}) // })
// console.log(1212, row);
dispatch(service.postGenerateReport(row)).then((res) => { dispatch(service.postGenerateReport({ ...row, structId: "" })).then((res) => {
if (res.success) { if (res.success) {
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
getData({ limit: 10, page: 0, keyword: keyword }) getData({ limit: 10, page: 0, keyword: keyword })

Loading…
Cancel
Save