Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
05f1629803
@ -105,7 +105,10 @@
|
||||
</select>
|
||||
|
||||
<select id="getBindDeviceByLink" resultMap="EquipmentMap">
|
||||
select t.id ,t."name",t.iot_model_id,t.iot_addr from sys_equipment t where t.id in (select distinct equipment_id from sys_imptabmapping where link_id =#{linkId})
|
||||
select se.id ,se."name",se.iot_model_id,se.iot_addr,min(imp.porder) as porder from sys_imptabmapping imp
|
||||
left join sys_equipment se on imp.equipment_id = se.id
|
||||
where link_id = #{linkId}
|
||||
group by se.id ,se."name",se.iot_model_id,se.iot_addr order by porder
|
||||
</select>
|
||||
|
||||
<delete id="deleteMappingByLinkId">
|
||||
|
@ -609,12 +609,18 @@ const handleRes = (res: any, selectAllDevices: any) => {
|
||||
attIndex = highSpeedExoprtHeader.value.indexOf(attName)
|
||||
}
|
||||
xData.forEach((time: any, index: number) => {
|
||||
const dataItem = [
|
||||
escapeCsvValue(deviceName + '\t'), // 风机名称
|
||||
escapeCsvValue(timestampToTime(time) + '\t'), // 时间
|
||||
]
|
||||
dataItem[attIndex] = escapeCsvValue(yData[index] + '\t')
|
||||
highSpeedExoprtData.value.push(dataItem.join(','))
|
||||
const tableDataIndex = highSpeedExoprtData.value.findIndex(
|
||||
(data: any) => data.name == deviceName && data.time == timestampToTime(time)
|
||||
)
|
||||
if (tableDataIndex > -1) {
|
||||
highSpeedExoprtData.value[tableDataIndex][attName] = yData[index]
|
||||
} else {
|
||||
highSpeedExoprtData.value.push({
|
||||
name: deviceName,
|
||||
time: timestampToTime(time),
|
||||
[attName]: yData[index],
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let attIndex = lowSpeedExoprtHeader.value.indexOf(attName)
|
||||
@ -623,26 +629,20 @@ const handleRes = (res: any, selectAllDevices: any) => {
|
||||
attIndex = lowSpeedExoprtHeader.value.indexOf(attName)
|
||||
}
|
||||
xData.forEach((time: any, index: number) => {
|
||||
const dataItem = [
|
||||
escapeCsvValue(deviceName) + '\t', // 风机名称
|
||||
escapeCsvValue(timestampToTime(time)) + '\t' + '\t', // 时间
|
||||
]
|
||||
dataItem[attIndex] = escapeCsvValue(yData[index] + '\t')
|
||||
lowSpeedExoprtData.value.push(dataItem.join(','))
|
||||
const tableDataIndex = lowSpeedExoprtData.value.findIndex(
|
||||
(data: any) => data.name == deviceName && data.time == timestampToTime(time)
|
||||
)
|
||||
if (tableDataIndex > -1) {
|
||||
lowSpeedExoprtData.value[tableDataIndex][attName] = yData[index]
|
||||
} else {
|
||||
lowSpeedExoprtData.value.push({
|
||||
name: deviceName,
|
||||
time: timestampToTime(time),
|
||||
[attName]: yData[index],
|
||||
})
|
||||
}
|
||||
highcsvContent.value = highSpeedExoprtData.value.length
|
||||
? highSpeedExoprtHeader.value + '\n' + highSpeedExoprtData.value.join('\n')
|
||||
: []
|
||||
lowcsvContent.value = lowSpeedExoprtData.value.length
|
||||
? lowSpeedExoprtHeader.value + '\n' + lowSpeedExoprtData.value.join('\n')
|
||||
: []
|
||||
if (!yData.length) {
|
||||
ElMessage.info(`${deviceName + attName}数据为空`)
|
||||
return
|
||||
})
|
||||
}
|
||||
console.log(selectAllDevicesIndex)
|
||||
console.log(irnIndex)
|
||||
const seriesData = {
|
||||
name: deviceName + attName,
|
||||
type: 'line',
|
||||
@ -681,28 +681,31 @@ const handleRes = (res: any, selectAllDevices: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const escapeCsvValue = (value: any) => {
|
||||
if (value === undefined || value === null) {
|
||||
return ' '
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
if (value.includes(',') || value.includes('"') || value.includes('\n')) {
|
||||
return `"${value.replace(/"/g, '""')}"`
|
||||
}
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
const statAnalysisExport = () => {
|
||||
const tables = [
|
||||
{ data: highcsvContent.value, filename: '多机对比_高频' + new Date().getTime() + '.csv' },
|
||||
{ data: lowcsvContent.value, filename: '多机对比_低频' + new Date().getTime() + '.csv' },
|
||||
{ header: highSpeedExoprtHeader.value, data: highSpeedExoprtData.value, filename: '多机对比_高频' + new Date().getTime() + '.csv' },
|
||||
{ header: lowSpeedExoprtHeader.value, data: lowSpeedExoprtData.value, filename: '多机对比_低频' + new Date().getTime() + '.csv' },
|
||||
]
|
||||
|
||||
tables.forEach((table) => {
|
||||
const csvContent = table.data
|
||||
if (csvContent.length) {
|
||||
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
|
||||
if (table.data.length) {
|
||||
let str = ''
|
||||
table.data.forEach((item: any) => {
|
||||
table.header.forEach((prop: any, index: number) => {
|
||||
let val = ''
|
||||
if (index == 0) {
|
||||
val = item.name
|
||||
} else if (index == 1) {
|
||||
val = item.time
|
||||
} else {
|
||||
val = typeof item[prop] === 'number' ? String(item[prop]) : item[prop] ? item[prop] : ''
|
||||
}
|
||||
str += val + '\t' + ','
|
||||
})
|
||||
str += '\n'
|
||||
})
|
||||
str = table.header + '\n' + str
|
||||
if (str.length) {
|
||||
const blob = new Blob([str], { type: 'text/csv;charset=utf-8;' })
|
||||
const link = document.createElement('a')
|
||||
if (link.download !== undefined) {
|
||||
const url = URL.createObjectURL(blob)
|
||||
@ -714,6 +717,7 @@ const statAnalysisExport = () => {
|
||||
document.body.removeChild(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user