CODE 1 year ago
parent
commit
6f4bb60c80
  1. 6
      api/app/lib/controllers/alarm/dataContinuity.js
  2. 2
      api/app/lib/controllers/firmwareUpgrade/index.js
  3. 9
      api/app/lib/models/alarm_data_continuity.js
  4. 5
      script/4.1/schema/1.update_alarm_data_continuity.sql
  5. 9
      web/client/src/sections/data/containers/dataQuery.jsx

6
api/app/lib/controllers/alarm/dataContinuity.js

@ -9,7 +9,7 @@ async function postDataContinuity (ctx) {
try { try {
const { utils: { sendAppearToWeb }, clickHouse } = ctx.app.fs const { utils: { sendAppearToWeb }, clickHouse } = ctx.app.fs
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { type, file, } = ctx.request.body const { type, file, fileUrl } = ctx.request.body
const now = moment().format() const now = moment().format()
if (!type) { if (!type) {
@ -24,7 +24,7 @@ async function postDataContinuity (ctx) {
} }
await models.AlarmDataContinuity.create({ await models.AlarmDataContinuity.create({
type, file, createTime: now type, file, createTime: now, fileUrl
}); });
ctx.status = 204; ctx.status = 204;
@ -183,7 +183,7 @@ async function dataContinuityList (ctx) {
let findOption = { let findOption = {
order: [['createTime', 'desc']], order: [['createTime', 'desc']],
where: {}, where: {},
attributes: ['id', 'type', 'createTime'], attributes: ['id', 'type', 'createTime', 'fileUrl'],
} }
if (limit) { if (limit) {

2
api/app/lib/controllers/firmwareUpgrade/index.js

@ -279,7 +279,7 @@ async function getThingMessages(ctx){
try{ try{
const {thingIds,device_meta_id,searchVal}=ctx.request.body const {thingIds,device_meta_id,searchVal}=ctx.request.body
const res= await ctx.app.fs.craw.post(ApiTable.getThingMessages,{data:{thingIds,device_meta_id}}) const res= await ctx.app.fs.craw.post(ApiTable.getThingMessages,{query:{token:'22767e1f-db8d-4a1d-87d4-56347cf21247'},data:{thingIds,device_meta_id}})
// console.log('xxxxxx',res) // console.log('xxxxxx',res)
let rslt=[] let rslt=[]
if(res){ if(res){

9
api/app/lib/models/alarm_data_continuity.js

@ -42,6 +42,15 @@ module.exports = dc => {
field: "create_time", field: "create_time",
autoIncrement: false autoIncrement: false
}, },
fileUrl: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "file_url",
autoIncrement: false
},
}, { }, {
tableName: "alarm_data_continuity", tableName: "alarm_data_continuity",
comment: "", comment: "",

5
script/4.1/schema/1.update_alarm_data_continuity.sql

@ -0,0 +1,5 @@
alter table alarm_data_continuity
add file_url varchar;
comment on column alarm_data_continuity.file_url is '文件地址';

9
web/client/src/sections/data/containers/dataQuery.jsx

@ -121,9 +121,14 @@ const DataQuery = (props) => {
title: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
render: (text, record, index) => { render: (text, record, index) => {
return ( return (
<Space> <Space>
<Button theme='borderless' type="primary" onClick={() => { {
record?.fileUrl ? <Button theme='borderless' type='primary' style={{ marginRight: 8 }} ><a href={`/_file-server/${record.fileUrl + '?filename=' + (record?.alarmDataContinuityType?.name || dataContinuityType?.find(d => d.typeNumber == record.type)?.name) + moment(record.createTime).format('YYYY-MM-DD HH:mm:ss') + '.' + record?.fileUrl?.split('.').pop()}`}>
下载
</a></Button>
: <Button theme='borderless' type="primary" onClick={() => {
dispatch(sectionData.getContinuityDetail(record.id)).then(res => { dispatch(sectionData.getContinuityDetail(record.id)).then(res => {
if (res.success) { if (res.success) {
downloadWord(res.payload?.data?.file || '', (record?.alarmDataContinuityType?.name || dataContinuityType?.find(d => d.typeNumber == record.type)?.name) + moment(record.createTime).format('YYYY-MM-DD HH:mm:ss')) downloadWord(res.payload?.data?.file || '', (record?.alarmDataContinuityType?.name || dataContinuityType?.find(d => d.typeNumber == record.type)?.name) + moment(record.createTime).format('YYYY-MM-DD HH:mm:ss'))
@ -133,6 +138,8 @@ const DataQuery = (props) => {
}}> }}>
下载 下载
</Button> </Button>
}
<Button theme='borderless' type="primary" onClick={() => { <Button theme='borderless' type="primary" onClick={() => {
setCheckData(record); setCheckData(record);
setCheckVis(true); setCheckVis(true);

Loading…
Cancel
Save