From e3fe6bac6f1e4e2bb91f1d93768b4faaf2af3698 Mon Sep 17 00:00:00 2001 From: wenlele Date: Fri, 12 Jan 2024 16:50:11 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/models/report_automatic.js | 30 +- .../4.4/schema/1.update_report_automatic.sql | 22 + .../service/components/automatic-Modal.jsx | 407 ++++++++++-------- 3 files changed, 279 insertions(+), 180 deletions(-) create mode 100644 script/4.4/schema/1.update_report_automatic.sql diff --git a/api/app/lib/models/report_automatic.js b/api/app/lib/models/report_automatic.js index 88b8029..e0dfeb1 100644 --- a/api/app/lib/models/report_automatic.js +++ b/api/app/lib/models/report_automatic.js @@ -17,7 +17,7 @@ module.exports = dc => { }, reportName: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, defaultValue: null, comment: "", primaryKey: false, @@ -87,8 +87,17 @@ module.exports = dc => { field: "ratifier", autoIncrement: false }, + coverTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "", + primaryKey: false, + field: "cover_time", + autoIncrement: false + }, structId: { - type: DataTypes.INTEGER, + type: DataTypes.ARRAY(DataTypes.INTEGER), allowNull: false, defaultValue: null, comment: "", @@ -96,9 +105,18 @@ module.exports = dc => { field: "struct_id", autoIncrement: false }, + structList: { + type: DataTypes.JSON, + allowNull: true, + defaultValue: null, + comment: "", + primaryKey: false, + field: "struct_list", + autoIncrement: false + }, projectOverview: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, defaultValue: null, comment: "", primaryKey: false, @@ -107,7 +125,7 @@ module.exports = dc => { }, reportStartTime: { type: DataTypes.DATE, - allowNull: false, + allowNull: true, defaultValue: null, comment: "开始时间", primaryKey: false, @@ -116,7 +134,7 @@ module.exports = dc => { }, reportEndTime: { type: DataTypes.DATE, - allowNull: false, + allowNull: true, defaultValue: null, comment: "开始时间", primaryKey: false, @@ -134,7 +152,7 @@ module.exports = dc => { }, factors: { type: DataTypes.JSON, - allowNull: false, + allowNull: true, defaultValue: null, comment: "", primaryKey: false, diff --git a/script/4.4/schema/1.update_report_automatic.sql b/script/4.4/schema/1.update_report_automatic.sql new file mode 100644 index 0000000..7c4e4a1 --- /dev/null +++ b/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; + + diff --git a/web/client/src/sections/service/components/automatic-Modal.jsx b/web/client/src/sections/service/components/automatic-Modal.jsx index b3d5460..33df7ba 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/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 [projectId, setProjectId] = useState(); //项目id - const [structId, setStructId] = useState(); //结构物id + const [structId, setStructId] = useState([]); //结构物id const [factorId, setFactorId] = useState([]); //监测因素id const [factorList, setFactorList] = useState([]); //监测因素 - const [factorChech, setFactorChech] = useState([]); //选中的监测因素 + const [structChech, setStructChech] = useState([]); //选中的结构物 + const [factorChech, setFactorChech] = useState({}); //选中的结构物 const [activeKey, setActiveKey] = useState([]); // const [correlationId, setCorrelationId] = useState([]); // @@ -23,13 +24,18 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat useEffect(async () => { if (eidtData?.id) { setProjectId(eidtData?.projectId) - setStructId(eidtData?.structId) + setStructId(eidtData?.structId || []) setFactorId(eidtData?.factors?.map(s => s.codeName) || []) let data = await getData(eidtData?.projectId) - let Factor = data?.find(s => s.strucId == eidtData?.structId)?.factor || [] - setFactorList(Factor) - setFactorChech(Factor?.filter(s => eidtData?.factors?.map(s => s.codeName)?.includes(s.proto))) + let struc = data?.filter(s => eidtData?.structId?.includes(s.strucId)) || [] + + 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)) + }) + setFactorChech(Factor) // setActiveKey(eidtData?.factors?.map(s => s.codeName) || []) } }, []) @@ -55,67 +61,100 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat onOk={() => { form.current.validate().then((v) => { + console.log(11, v); let data = { id: eidtData?.id, - reportName: v.reportName, - projectId: v.projectId, - projectName: v.projectName, - reportType: v.reportType, - reportPicPath: v.reportPicPath[0]?.response?.url, - overview: v.overview[0]?.response?.url, - framer: v.framer, - auditor: v.auditor, - ratifier: v.ratifier, - structId: v.structId, - projectOverview: v.projectOverview, - 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: [] + reportName: v.reportName, //报表名称 + projectId: v.projectId, //所属项目 + projectName: v.projectName, //项目名称 + reportType: v.reportType, //报表类型 + reportPicPath: v.reportPicPath && v.reportPicPath[0] && v.reportPicPath[0]?.response?.url || eidtData.reportPicPath, //首页图片 + framer: v.framer, //制定者 + auditor: v.auditor, //审核者 + ratifier: v.ratifier, //批准者 + coverTime: v.coverTime && moment(v.coverTime).format('YYYY-MM-DD'), + structId: v.structId, //结构物id + structList: [] } - v.factorId?.forEach(d => { - let index = d.length - let factorData = {} + v.structId?.forEach(p => { + let structFind = eidtData?.structList?.find(d => d.structId == p) || {} + let structData = { structId: p } + let structNameIndex = p.toString().length || 0 + for (let key in v) { - factorData.codeName = d - factorData.tempName = factorData.tempName || [] - if (key?.indexOf(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 - 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(index) == 'startEndTime') { - factorData.startTime = v[key] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') - factorData.endTime = v[key] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') - } - 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') + if (key?.indexOf(p) != -1) { + //结构物概况图片 + if (key?.slice(structNameIndex) == 'overview') structData.overview = v[key] && v[key][0]?.response?.url || structFind.overview + //结构物描述 + if (key?.slice(structNameIndex) == 'projectOverview') structData.projectOverview = v[key] + //结论 + if (key?.slice(structNameIndex) == 'conclusion') structData.conclusion = v[key] + //开始结束时间 + if (key?.slice(structNameIndex) == 'reportTime') { + structData.reportStartTime = v[key] && v[key][0] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') + structData.reportEndTime = v[key] && v[key][1] && 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 - data.factors?.push(factorData) + + // debugger + + v[p + 'factorId']?.forEach(d => { + let factorFind = structFind?.factors?.find(c => c.codeName == d) || {} + let index = d.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.proto == 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') + factorData.endTime = v[key] && v[key][1] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') + } + //关联温度的测点 + if (key?.slice(index) == 'tempName1') { + factorData.tempName?.push({ + index: 1, + id: v[key], + name: factorChech[p]?.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[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]).format('YYYY-MM-DD HH:mm:ss') + //关联开始结束时间 + if (key?.slice(index) == 'releTime') { + factorData.releStartTime = v[key] && v[key][0] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') + factorData.releEndTime = v[key] && v[key][1] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') + } + } + } + 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) }) dispatch(service.postAutomaticReport(data)).then((res) => { @@ -127,7 +166,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat }) }} - width={700} + width={770} onCancel={() => close()} >
{ setProjectId(v) getData(v) - form.current.setValue('structId', null) - setStructId("") - setFactorList([]) - form.current.setValue('factorId', []) - setFactorChech([]) + form.current.setValue('structId', []) + setStructId([]) + // setFactorList([]) + // form.current.setValue('factorId', []) + setStructChech([]) }} > {projectList?.map((item) => { - return + return })} - - - + + { - setFactorList(strucData?.find(s => s.strucId == v)?.factor || []) + // setFactorList(strucData?.find(s => v.includes(s.stdrucId)) || []) setStructId(v) - form.current.setValue('factorId', []) - setFactorChech([]) + // form.current.setValue('factorId', []) + setStructChech(strucData?.filter(s => v.includes(s.strucId)) || []) }} > {strucData?.map((item) => { - return + return })} - - - 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 - })} - - - - {factorChech?.length > 0 ? 0 ? { @@ -245,86 +258,131 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat }} > { - factorChech?.map(s => { - return + structChech?.map(s => { + let structFind = eidtData?.structList?.find(d => d.structId == s.strucId) || {} + return
- c.codeName == s.proto)?.pointDescrip || ""} - rules={[{ required: true, message: "请输入布点描述" }]} - /> - 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: "请上传布点图片" }]} + - - {s.proto == 2001 && - c.codeName == s.proto)?.factorDescrip || ""} - /> - } - - c.codeName == s.proto)?.sensorNames?.map(a => a.id) || []} - rules={[{ required: true, message: "请选择测点选择" }]} - > - {s.sensor?.map((item) => { - return - })} - - 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: "请选择开始结束时间" }]} + - { - ['2001', '4004', '4007', '4008'].includes(s.proto) && - 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) && <> - c.codeName == s.proto)?.tempName?.find(c => c.index == 1)?.id || ""} - onChange={v => { - - - }} - > - {s.sensor?.map((item) => { - return - - })} - - c.codeName == s.proto)?.tempName?.find(c => c.index == 2)?.id || ""} - > - {factorList?.find(d => d.proto == 1004 || d.proto == 1002)?.sensor?.map((item) => { - return - - })} - - 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} - /> - - } - - {/* c.codeName == s.proto)?.glStaName || ""} + d.structId == s.strucId)?.conclusion || ""} + rules={[{ required: true, message: "请输入结构物描述" }]} /> - c.codeName == s.proto)?.tempStaName || ""} - /> */} - + + s.codeName) || []} + rules={[{ required: true, message: "请选择监测因素" }]} disabled={structId ? false : true} + onChange={v => { + setFactorChech({ ...factorChech, [s.strucId]: s.factor?.filter(d => v.includes(d.proto)) || [] }) + // setActiveKey(v) + }} > + {s.factor?.map((item) => { + return + })} + + {factorChech[s.strucId] ? { + // setActiveKey(v) + }} + > + { + factorChech[s.strucId]?.map(p => { + let factorFind = structFind?.factors?.find(c => c.codeName == p.proto) || {} + return +
+ + + + + + {s.proto == 2001 && + + } + + a.id) || []} + rules={[{ required: true, message: "请选择测点选择" }]} + > + {p.sensor?.map((item) => { + return + })} + + + { + ['2001', '4004', '4007', '4008'].includes(p.proto) && + + } + { + ['4009', '3001', '4004', '4001', '4007'].includes(s.proto) && <> + c.index == 1)?.id || ""} + onChange={v => { + + + }} + > + {p.sensor?.map((item) => { + return + + })} + + c.index == 2)?.id || ""} + > + {s.factors?.find(d => d.proto == 1004 || d.proto == 1002)?.sensor?.map((item) => { + return + + })} + + + + } +
+
+ }) + } + + +
: ""}
}) @@ -333,6 +391,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat
: ""} + From 78d0f37488e1d07b193395a95481e53cab9ffd44 Mon Sep 17 00:00:00 2001 From: wenlele Date: Mon, 15 Jan 2024 14:38:24 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=B8=80=E5=9B=BE=E7=BB=9F=E6=8F=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/analysis/containers/network.jsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/web/client/src/sections/analysis/containers/network.jsx b/web/client/src/sections/analysis/containers/network.jsx index 45a38b7..bfc1480 100644 --- a/web/client/src/sections/analysis/containers/network.jsx +++ b/web/client/src/sections/analysis/containers/network.jsx @@ -92,7 +92,7 @@ const Network = ({ > { - setProjectValue(v) - setSpinning(true) - form.current.setValue('projectId', v) + if (projectValue != v) { + setProjectValue(v) + setSpinning(true) + form.current.setValue('projectId', v) + } }} /> ({ value: d.thingId, label: d.strucName })) || []} onSelect={v => { - setSpinning(true) - setThingId(v) - form.current.setValue('thingId', v) + if (thingId != v) { + setSpinning(true) + setThingId(v) + form.current.setValue('thingId', v) + } }} /> From 4cf137dcffbda7fabdcc816104e0956e55f1b665 Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 17 Jan 2024 17:20:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?structId=20=20=E5=8F=82=E6=95=B0=E5=8E=BB?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/service/components/automatic-Modal.jsx | 2 +- web/client/src/sections/service/containers/automaticReport.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/client/src/sections/service/components/automatic-Modal.jsx b/web/client/src/sections/service/components/automatic-Modal.jsx index 33df7ba..66e1273 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/web/client/src/sections/service/components/automatic-Modal.jsx @@ -278,7 +278,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat /> d.structId == s.strucId)?.conclusion || ""} - rules={[{ required: true, message: "请输入结构物描述" }]} + // rules={[{ required: true, message: "请输入结论" }]} /> { + dispatch(service.postGenerateReport({ ...row, structId: "" })).then((res) => { if (res.success) { setQuery({ limit: 10, page: 0 }) getData({ limit: 10, page: 0, keyword: keyword }) From 1ad0f97842bf8374f4b55768502277ce7a830927 Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 17 Jan 2024 18:18:06 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/components/automatic-Modal.jsx | 41 ++++++++++--------- .../service/containers/automaticReport.jsx | 6 +-- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/web/client/src/sections/service/components/automatic-Modal.jsx b/web/client/src/sections/service/components/automatic-Modal.jsx index 66e1273..47e8365 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/web/client/src/sections/service/components/automatic-Modal.jsx @@ -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, //报表名称 @@ -81,7 +81,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat let structFind = eidtData?.structList?.find(d => d.structId == p) || {} let structData = { structId: p } let structNameIndex = p.toString().length || 0 - + for (let key in v) { if (key?.indexOf(p) != -1) { //结构物概况图片 @@ -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() @@ -278,7 +279,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat /> d.structId == s.strucId)?.conclusion || ""} - // rules={[{ required: true, message: "请输入结论" }]} + // rules={[{ required: true, message: "请输入结论" }]} /> 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 + return })} @@ -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 + let factorFind = structFind?.factors?.find(c => c.codeName == p.id) || {} + return
- - {s.proto == 2001 && - } - a.id) || []} rules={[{ required: true, message: "请选择测点选择" }]} > @@ -338,20 +339,20 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat return })} - { ['2001', '4004', '4007', '4008'].includes(p.proto) && - } { ['4009', '3001', '4004', '4001', '4007'].includes(s.proto) && <> - c.index == 1)?.id || ""} onChange={v => { @@ -363,7 +364,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat })} - 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 })} - diff --git a/web/client/src/sections/service/containers/automaticReport.jsx b/web/client/src/sections/service/containers/automaticReport.jsx index 67029df..11663e9 100644 --- a/web/client/src/sections/service/containers/automaticReport.jsx +++ b/web/client/src/sections/service/containers/automaticReport.jsx @@ -134,9 +134,9 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener 4007: 'QDQXJC', 1004: 'JGWDJC' } - row?.factors?.forEach(d => { - d.codeName = dataList[d.codeName] - }) + // row?.factors?.forEach(d => { + // d.codeName = dataList[d.codeName] + // }) dispatch(service.postGenerateReport({ ...row, structId: "" })).then((res) => { if (res.success) { From 20b520d8a61c1cd8acdc2f1b2080f591dd0930aa Mon Sep 17 00:00:00 2001 From: wenlele Date: Thu, 18 Jan 2024 14:56:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=A7=84=E5=88=99=20=20=20=E6=96=87=E5=AD=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/service/components/automatic-Modal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/service/components/automatic-Modal.jsx b/web/client/src/sections/service/components/automatic-Modal.jsx index 47e8365..a6a61c9 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/web/client/src/sections/service/components/automatic-Modal.jsx @@ -54,7 +54,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat return ( <> Date: Fri, 19 Jan 2024 10:53:48 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/components/automatic-Modal.jsx | 16 ++++++++-------- .../service/containers/automaticReport.jsx | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/client/src/sections/service/components/automatic-Modal.jsx b/web/client/src/sections/service/components/automatic-Modal.jsx index a6a61c9..e666797 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/web/client/src/sections/service/components/automatic-Modal.jsx @@ -72,7 +72,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat framer: v.framer, //制定者 auditor: v.auditor, //审核者 ratifier: v.ratifier, //批准者 - coverTime: v.coverTime && moment(v.coverTime).format('YYYY-MM-DD'), + coverTime: v.coverTime && moment(v.coverTime), structId: v.structId, //结构物id structList: [] } @@ -92,8 +92,8 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat if (key?.slice(structNameIndex) == 'conclusion') structData.conclusion = v[key] //开始结束时间 if (key?.slice(structNameIndex) == 'reportTime') { - structData.reportStartTime = v[key] && v[key][0] && moment(v[key][0]).format('YYYY-MM-DD HH:mm:ss') - structData.reportEndTime = v[key] && v[key][1] && 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]) } //包含的监测因素 structData.factors = [] @@ -121,8 +121,8 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat 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') - factorData.endTime = v[key] && v[key][1] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') + 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') { @@ -141,11 +141,11 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat }) } //数据初始时间 - if (key?.slice(index) == 'initialTime') factorData.initialTime = v[key] && moment(v[key]).format('YYYY-MM-DD HH:mm:ss') + 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]).format('YYYY-MM-DD HH:mm:ss') - factorData.releEndTime = v[key] && v[key][1] && moment(v[key][1]).format('YYYY-MM-DD HH:mm:ss') + factorData.releStartTime = v[key] && v[key][0] && moment(v[key][0]) + factorData.releEndTime = v[key] && v[key][1] && moment(v[key][1]) } } } diff --git a/web/client/src/sections/service/containers/automaticReport.jsx b/web/client/src/sections/service/containers/automaticReport.jsx index 11663e9..107c045 100644 --- a/web/client/src/sections/service/containers/automaticReport.jsx +++ b/web/client/src/sections/service/containers/automaticReport.jsx @@ -137,7 +137,7 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener // row?.factors?.forEach(d => { // d.codeName = dataList[d.codeName] // }) - + // console.log(1212, row); dispatch(service.postGenerateReport({ ...row, structId: "" })).then((res) => { if (res.success) { setQuery({ limit: 10, page: 0 })