164 lines
6.0 KiB
QML
164 lines
6.0 KiB
QML
import QtQuick 2.4
|
|
import QtQuick.Dialogs 1.3
|
|
import QtQuick.Controls 1.4
|
|
import "./common"
|
|
import "./Style"
|
|
|
|
Dialog{
|
|
id: self
|
|
property var dialogWidth: 820
|
|
property var dialogHeight: 600
|
|
property var rowWidth: 595
|
|
property var historyModel: ListModel{}
|
|
signal showDialog
|
|
width: dialogWidth
|
|
height: dialogHeight
|
|
onVisibleChanged: {
|
|
if(visible)
|
|
{
|
|
showDialog()
|
|
historyModel.clear()
|
|
for(var i = 0 ; i < g_proHistoryData.length; ++i)
|
|
{
|
|
historyModel.append( {"start":g_proHistoryData[i].start ,"stop": g_proHistoryData[i].stop, "mea": !!g_proHistoryData[i].mea ?g_proHistoryData[i].mea:"" , "channel": !!g_proHistoryData[i].channel ? g_proHistoryData[i].channel:"", "remark":!!g_proHistoryData[i].remark?g_proHistoryData[i].remark: ""})
|
|
}
|
|
}
|
|
}
|
|
|
|
contentItem: Rectangle {
|
|
color: "#fefefe"
|
|
TableView{
|
|
id: tableHistory
|
|
width: rowWidth
|
|
height: 280
|
|
anchors.fill: parent
|
|
model: historyModel
|
|
// headerDelegate: Rectangle{
|
|
// anchors.top: parent.top
|
|
// width: parent.width
|
|
// height: 25
|
|
// color: "white"
|
|
// QxText {
|
|
// anchors.centerIn: parent
|
|
// font.pointSize: 10
|
|
// text: styleData.value
|
|
// }
|
|
// Rectangle{
|
|
// width: 1
|
|
// height: parent.height
|
|
// visible: styleData.value !== "序号"
|
|
// color: "lightgray"
|
|
// }
|
|
// Rectangle{
|
|
// y: parent.height
|
|
// width: parent.width
|
|
// height: 1
|
|
// color: "lightgray"
|
|
// }
|
|
// }
|
|
// rowDelegate: Rectangle{
|
|
// height: 20
|
|
// color : styleData.row ===tableHistory.currentRow ?"#beebff": ( (styleData.row %2 == 0) ? "#f2f2f2": "white" )
|
|
// }
|
|
// itemDelegate: Item {
|
|
// clip: true
|
|
// QxText {
|
|
// visible: styleData.role === "id"
|
|
// anchors.centerIn: parent
|
|
// color: "#999999"
|
|
// elide: styleData.elideMode
|
|
// font.pointSize: 10
|
|
// text:styleData.row + 1
|
|
// }
|
|
// QxText{
|
|
// z: 2
|
|
// visible: styleData.role == "start" || styleData.role == "stop"
|
|
// anchors.centerIn: parent
|
|
// text: !!styleData ? Qt.formatDateTime(new Date(styleData.value), "yyyy-MM-dd hh:mm:ss") : ""
|
|
// }
|
|
// QxText{
|
|
// z: 2
|
|
// visible: styleData.role != "id" && styleData.role != "start" && styleData.role != "stop"&& styleData.role != "remark"
|
|
// anchors.centerIn: parent
|
|
// text: !!styleData ? styleData.value : ""
|
|
// }
|
|
// QxText{
|
|
// z: 2
|
|
// visible: styleData.role === "remark" && !tp.visible
|
|
// text: !!styleData ? styleData.value : ""
|
|
// }
|
|
// QxTextInput{
|
|
// z: 2
|
|
// id: tp
|
|
// visible: false
|
|
// onTextChanged: {
|
|
// if( styleData.role === "remark" )
|
|
// model.remark = text
|
|
// updateHistorys()
|
|
// }
|
|
// onFocusChanged: {
|
|
// if(!focus)
|
|
// visible = false
|
|
// }
|
|
// Connections{
|
|
// target: self
|
|
// function onShowDialog()
|
|
// {
|
|
// tp.visible = false
|
|
// }
|
|
// }
|
|
// }
|
|
// MouseArea{
|
|
// visible: styleData.role === "remark"
|
|
// anchors.fill: parent
|
|
|
|
// onClicked: {
|
|
// tp.text = styleData.value
|
|
// tp.focus = true
|
|
// tp.visible = true
|
|
// }
|
|
// }
|
|
// Rectangle{
|
|
// width: 1
|
|
// height: parent.height
|
|
// visible: styleData.role !== "id"
|
|
// color: "lightgray"
|
|
// }
|
|
// }
|
|
// TableViewColumn{title: "序号"; role: "id";width: 80}
|
|
// TableViewColumn{title: "开始时间"; role: "start";width: 180}
|
|
// TableViewColumn{title: "结束时间"; role: "stop";width: 180}
|
|
// TableViewColumn{title: "测量项"; role: "mea";width: 140}
|
|
// TableViewColumn{title: "通道数"; role: "channel";width: 80}
|
|
// TableViewColumn{title: "备注"; role: "remark";width: 160}
|
|
onDoubleClicked:
|
|
{
|
|
self.accept()
|
|
}
|
|
}
|
|
}
|
|
|
|
title: "历史数据"
|
|
standardButtons: Dialog.NoButton
|
|
onAccepted:{
|
|
if(tableHistory.currentRow > -1)
|
|
{
|
|
var start = new Date(historyModel.get(tableHistory.currentRow).start).toISOString().slice(0, 24)
|
|
var stop = new Date(historyModel.get(tableHistory.currentRow).stop).toISOString().slice(0, 24)
|
|
updateGrafanaTime(start, stop)
|
|
}
|
|
}
|
|
|
|
function updateHistorys()
|
|
{
|
|
g_proHistoryData = []
|
|
for(var i = 0 ; i < historyModel.count; ++i)
|
|
{
|
|
var item = historyModel.get(i)
|
|
g_proHistoryData.push( {"start": item.start ,"stop": item.stop, "mea": item.mea , "channel": item.channel, "remark":item.remark})
|
|
}
|
|
update_proData()
|
|
}
|
|
}
|
|
|