This commit is contained in:
shijing 2024-10-30 09:04:04 +08:00
commit dabedbd432
2 changed files with 73 additions and 7 deletions

View File

@ -501,7 +501,6 @@ export default {
axisLabel: { axisLabel: {
color: "#ffffff", color: "#ffffff",
}, },
splitLine: { splitLine: {
show: true, show: true,
lineStyle: { lineStyle: {

View File

@ -30,9 +30,10 @@
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
<el-date-picker v-model="timeRange" type="datetimerange" range-separator="" <el-date-picker v-model="timeRange" type="datetimerange"
start-placeholder="开始时间" end-placeholder="结束时间" @change="handleQuery" value-format="YYYY-MM-DD HH:mm:ss" range-separator="至"
style="width: 100%" /> start-placeholder="开始时间" end-placeholder="结束时间" @change="handleQuery"
style="width: 100%" />
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@ -41,7 +42,8 @@
></el-button> ></el-button>
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-container>
<el-main class="nopadding">
<scTable <scTable
ref="table" ref="table"
:apiObj="apiObj" :apiObj="apiObj"
@ -51,6 +53,7 @@
:query="query" :query="query"
highlightCurrentRow highlightCurrentRow
@row-click="rowClick" @row-click="rowClick"
@dataChange="dataChange"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="测点" prop="mpoint_name"> <el-table-column label="测点" prop="mpoint_name">
@ -93,6 +96,12 @@
</el-table-column> </el-table-column>
</scTable> </scTable>
</el-main> </el-main>
<el-aside style="width: 50%; float: right;">
<!-- 折线图组件 -->
<scEcharts :option="chartOption" height="400px" />
</el-aside>
</el-container>
</el-container>
<el-dialog title="校正" v-model="visible"> <el-dialog title="校正" v-model="visible">
<el-main style="padding: 0 20px 20px 20px"> <el-main style="padding: 0 20px 20px 20px">
<el-form <el-form
@ -142,9 +151,9 @@
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
</el-container> </template>
</template>
<script> <script>
export default { export default {
name: "sflog", name: "sflog",
data() { data() {
@ -157,6 +166,42 @@ export default {
start_time: null, start_time: null,
end_time: null end_time: null
}, },
chartOption: {
color: ["#80FFA5", "#00DDFF", "#37A2FF", "#FF0087", "#FFBF00"],
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
},
legend: {
icon: "stack",
top: 5,
right: 5,
data: [],
},
grid: {
left: "2%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
name: "",
type: "category",
data: [],
},
yAxis: {
name: "当前值",
type: "value",
},
series: [],
},
options: [ options: [
{ label: "小时", value: "hour"}, { label: "小时", value: "hour"},
{ label: "天", value: "day" }, { label: "天", value: "day" },
@ -177,6 +222,28 @@ export default {
this.getMpoints(); this.getMpoints();
}, },
methods: { methods: {
dataChange(req, tableData) {
let that = this;
let option = { ...that.chartOption };
// x
option.xAxis.data = tableData.map((item, index) => (index+1).toString());
// y
option.series = [
{
name: '总生产',
type: 'line', // 线
data: tableData.map((item) => parseFloat(item.val)), //
smooth: true, // 线
}
];
option.legend.data = ['总生产'];
//
that.chartOption = option;
},
getMpoints() { getMpoints() {
let that = this; let that = this;
this.$API.enm.mpoint.list this.$API.enm.mpoint.list