oralce同步到influxDB
This commit is contained in:
323
influx-data/influx-target/src/main/resources/static/index.html
Normal file
323
influx-data/influx-target/src/main/resources/static/index.html
Normal file
@@ -0,0 +1,323 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>迁移</title>
|
||||
<link rel="stylesheet" href="./element.css" />
|
||||
<script src="./vue.js"></script>
|
||||
<script src="./element.js"></script>
|
||||
<script src="./locale.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" >
|
||||
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
||||
<el-form-item label="时间区间">
|
||||
<el-date-picker
|
||||
v-model="formInline.date"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:size="size"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据指标">
|
||||
<el-select
|
||||
v-model="formInline.tableNames"
|
||||
placeholder="请选择指标"
|
||||
filterable
|
||||
clearable
|
||||
multiple
|
||||
collapse-tags
|
||||
style="width: 360px"
|
||||
>
|
||||
<el-option label="电压闪变数据表-DataFlicker" value="DataFlicker"></el-option>
|
||||
<el-option label="电压波动数据表-DataFluc" value="DataFluc"></el-option>
|
||||
<el-option label="谐波电流角度数据表-DataHarmphasicI" value="DataHarmphasicI"></el-option>
|
||||
<el-option label="谐波电压角度数据表-DataHarmphasicV" value="DataHarmphasicV"></el-option>
|
||||
<el-option label="有功功率数据表-DataHarmpowerP" value="DataHarmpowerP"></el-option>
|
||||
<el-option label="无功功率数据表-DataHarmpowerQ" value="DataHarmpowerQ"></el-option>
|
||||
<el-option label="视在功率数据表-DataHarmpowerS" value="DataHarmpowerS"></el-option>
|
||||
<el-option label="谐波电流含有率数据表-DataHarmrateI" value="DataHarmrateI"></el-option>
|
||||
<el-option label="谐波电压含有率数据表-DataHarmrateV" value="DataHarmrateV"></el-option>
|
||||
<el-option label="电流简谐波幅值数据表-DataInharmI" value="DataInharmI"></el-option>
|
||||
<el-option label="电压间谐波幅值数据表-DataInharmV" value="DataInharmV"></el-option>
|
||||
<el-option label="谐波电流幅值数据表-DataI" value="DataI"></el-option>
|
||||
<el-option label="长时闪变数据表-DataPlt" value="DataPlt"></el-option>
|
||||
<el-option label="谐波电压幅值数据表-DataV" value="DataV"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-checkbox v-model="formInline.checkAll" @change="handleCheckAllChange">{{formInline.checkAll?'取消全选':'全选'}}</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据状态">
|
||||
<el-select v-model="formInline.states" placeholder="请选择状态" clearable multiple collapse-tags>
|
||||
<el-option label="执行中" value="0"></el-option>
|
||||
<el-option label="成功" value="1"></el-option>
|
||||
<el-option label="失败" value="2"></el-option>
|
||||
<el-option label="未执行" value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="query">查询</el-button>
|
||||
<el-button type="primary" @click="move()">迁移</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="tableData" style="width: 100%; height: calc(100vh - 120px)" stripe align="center" v-loading="formInline.loading">
|
||||
<el-table-column prop="tableName" label="指标名"></el-table-column>
|
||||
<el-table-column prop="tableName_CN" label="表名"></el-table-column>
|
||||
<el-table-column prop="excuteDate" label="日期(年月日)">
|
||||
<!-- <template #default="scope"> {{scope.row.startTime&&scope.row.startTime.split(' ')[0]}} </template>-->
|
||||
</el-table-column>
|
||||
<el-table-column prop="rowCount" label="条目数"></el-table-column>
|
||||
<el-table-column prop="updateTime" label="执行时间"></el-table-column>
|
||||
<el-table-column prop="duration" label="消耗时长" >
|
||||
<template #default="scope">
|
||||
{{ formatNumber(scope.row, 'duration') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="状态">
|
||||
<template #default="scope">
|
||||
<el-tag effect="dark" type="danger" v-if="scope.row.state === 2">失败</el-tag>
|
||||
<el-tag effect="dark" type="primary" v-else-if="scope.row.state === 0">执行中</el-tag>
|
||||
<el-tag effect="dark" type="success" v-else-if="scope.row.state === 1">成功</el-tag>
|
||||
<el-tag effect="dark" type="danger" v-else-if="scope.row.state === 3">未执行</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="操作">
|
||||
<template #default="scope">
|
||||
<el-popconfirm title="确定删除此条记录吗?" @confirm="jobRemove(scope.row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" text v-if="scope.row.state === 1">删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-button type="primary" text v-if="scope.row.state === 2 || scope.row.state === 3" @click="move(scope.row)">迁移</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="padding-top: 10px; display: flex; justify-content: flex-end">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total,prev, pager, next"
|
||||
:total="formInline.total"
|
||||
:page-size="formInline.pageSize"
|
||||
:current-page="formInline.currentPage"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const { createApp, ref, reactive } = Vue
|
||||
createApp({
|
||||
setup() {
|
||||
const tableData = ref([])
|
||||
const message = ref('Hello Vue!')
|
||||
// 格式化时间YYYY-MM-DD
|
||||
const formatTime = (date) => {
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1
|
||||
let day = date.getDate()
|
||||
if (month < 10) {
|
||||
month = '0' + month
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day
|
||||
}
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
const formInline = reactive({
|
||||
loading: true,
|
||||
states: ['0', '1'],
|
||||
checkAll:true,
|
||||
tableNames: [
|
||||
'DataFlicker',
|
||||
'DataFluc',
|
||||
'DataHarmphasicI',
|
||||
'DataHarmphasicV',
|
||||
'DataHarmpowerP',
|
||||
'DataHarmpowerQ',
|
||||
'DataHarmpowerS',
|
||||
'DataHarmrateI',
|
||||
'DataHarmrateV',
|
||||
'DataInharmI',
|
||||
'DataInharmV',
|
||||
'DataI',
|
||||
'DataPlt',
|
||||
'DataV',
|
||||
|
||||
],
|
||||
tableNames2: [
|
||||
'DataFlicker',
|
||||
'DataFluc',
|
||||
'DataHarmphasicI',
|
||||
'DataHarmphasicV',
|
||||
'DataHarmpowerP',
|
||||
'DataHarmpowerQ',
|
||||
'DataHarmpowerS',
|
||||
'DataHarmrateI',
|
||||
'DataHarmrateV',
|
||||
'DataInharmI',
|
||||
'DataInharmV',
|
||||
'DataI',
|
||||
'DataPlt',
|
||||
'DataV',
|
||||
],
|
||||
date: [formatTime(new Date()), formatTime(new Date())],
|
||||
total: 0,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
})
|
||||
|
||||
const query = () => {
|
||||
formInline.loading = true
|
||||
console.log('submit!')
|
||||
let url = window.location.origin + '/jobDetail/jobQuery';
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
states: formInline.states,
|
||||
tableNames: formInline.tableNames,
|
||||
startTime: formInline.date[0],
|
||||
endTime: formInline.date[1],
|
||||
currentPage: formInline.currentPage,
|
||||
pageSize: formInline.pageSize,
|
||||
}),
|
||||
})
|
||||
.then((res) => {
|
||||
formInline.loading = false
|
||||
return res.json()
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
res.records.forEach(item=>{
|
||||
for(let key in item){
|
||||
if(!item[key] && item[key] !== 0){
|
||||
item[key] = '/'
|
||||
}
|
||||
}
|
||||
})
|
||||
tableData.value = res.records
|
||||
formInline.total = res.total
|
||||
})
|
||||
}
|
||||
query()
|
||||
const handleCurrentChange = (val) => {
|
||||
formInline.currentPage = val
|
||||
query()
|
||||
}
|
||||
const handleSizeChange = (val) => {
|
||||
formInline.currentPage = 1
|
||||
formInline.pageSize = val
|
||||
query()
|
||||
}
|
||||
|
||||
const move = (row) => {
|
||||
let obj = {
|
||||
tableNames: formInline.tableNames,
|
||||
startTime: formInline.date[0],
|
||||
endTime: formInline.date[1],
|
||||
}
|
||||
if (row) {
|
||||
obj = {
|
||||
tableNames: [row.tableName],
|
||||
startTime: row.excuteDate,
|
||||
endTime: row.excuteDate,
|
||||
}
|
||||
}
|
||||
fetch('/data/dataSync', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(obj),
|
||||
})
|
||||
.then((res) => {
|
||||
return res.json()
|
||||
})
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
ElementPlus.ElMessage.success('数据迁移成功')
|
||||
query()
|
||||
} else {
|
||||
ElementPlus.ElMessage.error('数据迁移失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 处理数据精度
|
||||
const formatNumber = (row,column) =>{
|
||||
const duration = row[column];
|
||||
if(/^-?\d*\.?\d+$/.test(duration)){
|
||||
let time = Number(duration);
|
||||
return (time/60).toFixed(2) + " 分钟";
|
||||
}
|
||||
return duration;
|
||||
}
|
||||
const jobRemove = (row) => {
|
||||
fetch('/jobDetail/jobRemove', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
tableName: row.tableName,
|
||||
excuteDate: row.excuteDate,
|
||||
}),
|
||||
})
|
||||
.then((res) => {
|
||||
return res.json()
|
||||
})
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
ElementPlus.ElMessage.success('数据删除成功')
|
||||
query()
|
||||
} else {
|
||||
ElementPlus.ElMessage.error('数据删除失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleCheckAllChange = ()=>{
|
||||
console.log(formInline.checkAll)
|
||||
if(formInline.checkAll){
|
||||
formInline.tableNames = JSON.parse(JSON.stringify(formInline.tableNames2))
|
||||
}else{
|
||||
formInline.tableNames = []
|
||||
}
|
||||
|
||||
}
|
||||
return {
|
||||
handleCheckAllChange,
|
||||
message,
|
||||
formInline,
|
||||
query,
|
||||
tableData,
|
||||
handleCurrentChange,
|
||||
handleSizeChange,
|
||||
move,
|
||||
jobRemove,
|
||||
formatNumber,
|
||||
}
|
||||
},
|
||||
})
|
||||
.use(ElementPlus, {
|
||||
locale: ElementPlusLocaleZhCn,
|
||||
})
|
||||
.mount('#app')
|
||||
</script>
|
||||
</body>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#app {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
</html>
|
||||
Reference in New Issue
Block a user