diff --git a/api/app/lib/controllers/service/report.js b/api/app/lib/controllers/service/report.js index 7812a33..b7ee8ca 100644 --- a/api/app/lib/controllers/service/report.js +++ b/api/app/lib/controllers/service/report.js @@ -258,6 +258,12 @@ async function postGenerateReport (ctx) { startTime: moment().format('YYYY-MM-DD HH:mm:ss'), reportType: data.reportType }) + + await models.ReportAutomatic.update({ time: moment().format('YYYY-MM-DD HH:mm:ss') }, { + where: { + id: data.id + } + }) ctx.status = 200; ctx.body = res.outLink } else { diff --git a/api/app/lib/models/report_automatic.js b/api/app/lib/models/report_automatic.js index 116f63e..f2bf788 100644 --- a/api/app/lib/models/report_automatic.js +++ b/api/app/lib/models/report_automatic.js @@ -125,7 +125,7 @@ module.exports = dc => { }, time: { type: DataTypes.DATE, - allowNull: false, + allowNull: true, defaultValue: null, comment: "", primaryKey: false, diff --git a/script/3.6/schema/2.create_report_automatic.sql b/script/3.6/schema/2.create_report_automatic.sql index 77d4016..148e57b 100644 --- a/script/3.6/schema/2.create_report_automatic.sql +++ b/script/3.6/schema/2.create_report_automatic.sql @@ -24,3 +24,5 @@ alter table report_automatic add constraint report_automatic_pk primary key (id); + +alter table report_automatic alter column time drop 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 2ddadec..2c2c89a 100644 --- a/web/client/src/sections/service/components/automatic-Modal.jsx +++ b/web/client/src/sections/service/components/automatic-Modal.jsx @@ -17,10 +17,12 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat const [factorList, setFactorList] = useState([]); //监测因素 const [factorChech, setFactorChech] = useState([]); //选中的监测因素 const [activeKey, setActiveKey] = useState([]); // + const [correlationId, setCorrelationId] = useState([]); // useEffect(async () => { if (eidtData?.id) { + console.log(eidtData); setProjectId(eidtData?.projectId) setStructId(eidtData?.structId) setFactorId(eidtData?.factors?.map(s => s.codeName) || []) @@ -68,7 +70,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat 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: moment().format('YYYY-MM-DD HH:mm:ss'), + time: eidtData?.time && moment(eidtData?.time).format('YYYY-MM-DD HH:mm:ss') || null, factors: [] } @@ -115,7 +117,6 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat factorData.tempStaName = factorData?.tempName?.find(s => s.index == 2)?.name || factorData?.tempName?.find(s => s.index == 1)?.name data.factors?.push(factorData) }) - console.log(111, data); dispatch(service.postAutomaticReport(data)).then((res) => { if (res.success) { @@ -138,7 +139,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat > { factorChech?.map(s => { - return + return
c.codeName == s.proto)?.pointDescrip || ""} @@ -274,6 +275,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat { ['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')} /> } @@ -281,6 +283,10 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat ['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 @@ -295,6 +301,9 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat })} + 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} + /> } @@ -304,9 +313,7 @@ const AutomaticModal = ({ actions, dispatch, apiRoot, qiniuUrl, visible, eidtDat c.codeName == s.proto)?.tempStaName || ""} /> */} - 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} - /> +
diff --git a/web/client/src/sections/service/containers/automaticReport.jsx b/web/client/src/sections/service/containers/automaticReport.jsx index bc27b72..e4f7763 100644 --- a/web/client/src/sections/service/containers/automaticReport.jsx +++ b/web/client/src/sections/service/containers/automaticReport.jsx @@ -23,6 +23,7 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener const [projectId, setProjectId] = useState() //项目id const [projectSearch, setProjectSearch] = useState() //项目搜索 const [keyword, setKeyword] = useState() //报表关键字 + const [id, setId] = useState() const page = useRef(query.page);//哪一页 @@ -44,6 +45,7 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener if (res.success) { setTableData(res.payload.data?.rows) setLimits(res.payload.data?.count) + setId("") } }) } @@ -70,7 +72,7 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener dataIndex: "reportType", key: 'reportType', }, { - title: "最近生产时间", + title: "最近生成时间", dataIndex: "time", key: 'time', render: (txet, row) => txet && moment(txet).format('YYYY-MM-DD HH:mm:ss') || '--' @@ -103,7 +105,8 @@ const AutomaticReport = ({ dispatch, actions, user, clientHeight, loading, gener > - diff --git a/web/client/src/sections/service/containers/reportFile.jsx b/web/client/src/sections/service/containers/reportFile.jsx index 0bb8594..1a87f7c 100644 --- a/web/client/src/sections/service/containers/reportFile.jsx +++ b/web/client/src/sections/service/containers/reportFile.jsx @@ -68,10 +68,8 @@ const ReportFile = ({ dispatch, actions, user, clientHeight, loading, socket, qi render: (_, row) => { return (
-