304 lines
10 KiB
QML
304 lines
10 KiB
QML
|
|
// import QtQuick
|
||
|
|
// import QtQuick.Controls
|
||
|
|
|
||
|
|
// Page {
|
||
|
|
// title: qsTr("Page 2")
|
||
|
|
// Rectangle
|
||
|
|
// {
|
||
|
|
// anchors.fill: parent
|
||
|
|
// color: "lightgreen"
|
||
|
|
// }
|
||
|
|
// Label {
|
||
|
|
// text: qsTr("You are on Page 2.")
|
||
|
|
// anchors.centerIn: parent
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
import QtQuick
|
||
|
|
import QtQuick.Dialogs
|
||
|
|
import QtQuick.Controls
|
||
|
|
import QtWebEngine
|
||
|
|
import "./common"
|
||
|
|
// import "./Style"
|
||
|
|
Page {
|
||
|
|
id: self
|
||
|
|
// width: 400
|
||
|
|
// height: 300
|
||
|
|
property var weburl: "http://" + g_settingGrafanaHost + ":" + g_settingGrafanaPort + g_settingGrafanaDashboardsUrl1
|
||
|
|
property var curQueueId: ""
|
||
|
|
Rectangle
|
||
|
|
{
|
||
|
|
id: btnRectangle
|
||
|
|
anchors.left: parent.left
|
||
|
|
anchors.right: parent.right
|
||
|
|
anchors.top: parent.top
|
||
|
|
height: 30
|
||
|
|
z:2
|
||
|
|
Row
|
||
|
|
{
|
||
|
|
anchors.verticalCenter: parent.verticalCenter
|
||
|
|
anchors.left: parent.left
|
||
|
|
spacing: 5
|
||
|
|
QxTitleButton{
|
||
|
|
enabled: !lstRunning && comIsOpen
|
||
|
|
text:"开始采集"
|
||
|
|
onClicked: {
|
||
|
|
g_gatherInfo.start = new Date().getTime()
|
||
|
|
var channelCount = 0
|
||
|
|
for(var i = 0; i < settingView.tgModel.count; ++i)
|
||
|
|
{
|
||
|
|
var item = settingView.tgModel.get(i)
|
||
|
|
if(item.gdkgzt == "1")
|
||
|
|
channelCount++
|
||
|
|
}
|
||
|
|
|
||
|
|
g_gatherInfo.stop = ""
|
||
|
|
g_gatherInfo.mea = ""
|
||
|
|
g_gatherInfo.channel = String(channelCount)
|
||
|
|
g_gatherInfo.remark = ""
|
||
|
|
runLstCmd("读实时数据")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
QxTitleButton{
|
||
|
|
enabled: lstRunning && comIsOpen
|
||
|
|
text:"结束采集"
|
||
|
|
onClicked: {
|
||
|
|
g_gatherInfo.stop = new Date().getTime()
|
||
|
|
g_proHistoryData.push({"start": g_gatherInfo.start, "stop": g_gatherInfo.stop, "mea": g_gatherInfo.mea, "channel": g_gatherInfo.channel, "remark": g_gatherInfo.remark})
|
||
|
|
update_proData()
|
||
|
|
stopLstCmd()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
QxTitleButton{
|
||
|
|
text:"导入双综合环境数据"
|
||
|
|
onClicked: fileDialog.visible = true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Row
|
||
|
|
{
|
||
|
|
anchors.verticalCenter: parent.verticalCenter
|
||
|
|
anchors.right: parent.right
|
||
|
|
anchors.rightMargin: 10
|
||
|
|
spacing: 30
|
||
|
|
QxText{
|
||
|
|
text: "测试人员: " + g_session.name
|
||
|
|
}
|
||
|
|
QxText{
|
||
|
|
text:"测试地点: " + g_settingLocation
|
||
|
|
}
|
||
|
|
QxText{
|
||
|
|
text:"测试单位: " + g_settingCompany
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// WebEngines{
|
||
|
|
// anchors.left: parent.left
|
||
|
|
// anchors.right: parent.right
|
||
|
|
// anchors.top: btnRectangle.bottom
|
||
|
|
// anchors.bottom: parent.bottom
|
||
|
|
// }
|
||
|
|
WebEngineView {
|
||
|
|
id: webengine
|
||
|
|
anchors.left: parent.left
|
||
|
|
anchors.right: parent.right
|
||
|
|
anchors.top: btnRectangle.bottom
|
||
|
|
anchors.bottom: parent.bottom
|
||
|
|
url: "http://www.baidu.com"//g_settingGrafanaDashboardsUrl1 != "" ? weburl : ""
|
||
|
|
}
|
||
|
|
function formatText(count, modelData) {
|
||
|
|
var data = count === 12 ? modelData + 1 : modelData;
|
||
|
|
return data.toString().length < 2 ? "0" + data : data;
|
||
|
|
}
|
||
|
|
|
||
|
|
FontMetrics {
|
||
|
|
id: fontMetrics
|
||
|
|
}
|
||
|
|
Component {
|
||
|
|
id: delegateComponent
|
||
|
|
|
||
|
|
Label {
|
||
|
|
text: formatText(Tumbler.tumbler.count, modelData)
|
||
|
|
opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
|
||
|
|
horizontalAlignment: Text.AlignHCenter
|
||
|
|
verticalAlignment: Text.AlignVCenter
|
||
|
|
font.pixelSize: fontMetrics.font.pixelSize * 1.25
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// Dialog
|
||
|
|
// {
|
||
|
|
// id: dateDlg
|
||
|
|
// property var mea: ""
|
||
|
|
// property var path: ""
|
||
|
|
// onAccepted:{
|
||
|
|
// var date = new Date(Qt.formatDateTime(calendar.selectedDate, "yyyy/MM/dd")+" "+formatText(hoursTumbler, hoursTumbler.currentIndex)+":"+formatText(minutesTumbler, minutesTumbler.currentIndex)+":"+formatText(secondTumbler, secondTumbler.currentIndex))
|
||
|
|
// var result = backend_proxy.importExternalData(mea,date.getTime(),path)
|
||
|
|
// if(result.code !== 200)
|
||
|
|
// {
|
||
|
|
// alert.show(result.msg)
|
||
|
|
// }else
|
||
|
|
// {
|
||
|
|
// g_gatherInfo.start = date.getTime()
|
||
|
|
// g_gatherInfo.stop = result.data
|
||
|
|
// g_gatherInfo.mea = mea
|
||
|
|
// g_gatherInfo.channel = "0"
|
||
|
|
// g_gatherInfo.remark = ""
|
||
|
|
// g_proHistoryData.push({"start": g_gatherInfo.start, "stop": g_gatherInfo.stop, "mea": g_gatherInfo.mea, "channel": g_gatherInfo.channel, "remark": g_gatherInfo.remark})
|
||
|
|
// update_proData()
|
||
|
|
// }
|
||
|
|
// mea = ""
|
||
|
|
// path = ""
|
||
|
|
// }
|
||
|
|
// contentItem: Rectangle {
|
||
|
|
// color: "#fefefe"
|
||
|
|
// Column
|
||
|
|
// {
|
||
|
|
// spacing: 5
|
||
|
|
// Row{
|
||
|
|
// Calendar {
|
||
|
|
// id: calendar
|
||
|
|
// }
|
||
|
|
// Frame {
|
||
|
|
// id: frame
|
||
|
|
// height: calendar.height
|
||
|
|
// wheelEnabled: true
|
||
|
|
// Row {
|
||
|
|
// id: row
|
||
|
|
|
||
|
|
// Tumbler {
|
||
|
|
// id: hoursTumbler
|
||
|
|
// wheelEnabled: true
|
||
|
|
// width: 30
|
||
|
|
// height: calendar.height
|
||
|
|
// model: 24
|
||
|
|
// delegate: delegateComponent
|
||
|
|
// }
|
||
|
|
|
||
|
|
// Tumbler {
|
||
|
|
// id: minutesTumbler
|
||
|
|
// wheelEnabled: true
|
||
|
|
// width: 30
|
||
|
|
// height: calendar.height
|
||
|
|
// model: 60
|
||
|
|
// delegate: delegateComponent
|
||
|
|
// }
|
||
|
|
// Tumbler {
|
||
|
|
// id: secondTumbler
|
||
|
|
// wheelEnabled: true
|
||
|
|
// width: 30
|
||
|
|
// height: calendar.height
|
||
|
|
// model: 60
|
||
|
|
// delegate: delegateComponent
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// Row
|
||
|
|
// {
|
||
|
|
// anchors.right: parent.right
|
||
|
|
// spacing: 20
|
||
|
|
// Button
|
||
|
|
// {
|
||
|
|
// text: "确认"
|
||
|
|
// onClicked: dateDlg.accept()
|
||
|
|
// }
|
||
|
|
// Button
|
||
|
|
// {
|
||
|
|
// text: "取消"
|
||
|
|
// onClicked: dateDlg.reject()
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
|
||
|
|
|
||
|
|
// FileDialog {
|
||
|
|
// id: fileDialog
|
||
|
|
// title: "请选择文件"
|
||
|
|
// folder: shortcuts.home
|
||
|
|
// selectMultiple: false
|
||
|
|
// nameFilters: [ "Csv files (*.csv)", "All files (*)" ]
|
||
|
|
// onAccepted: {
|
||
|
|
// if( fileDialog.fileUrls.length == 1)
|
||
|
|
// {
|
||
|
|
// var zdFile = fileDialog.fileUrls[0].match(/[^\/\\]+$/)[0]
|
||
|
|
// g_proData.zdfile = zdFile
|
||
|
|
// var path = fileDialog.fileUrls[0].replace("file:///","")
|
||
|
|
// var arr = zdFile.split("_")
|
||
|
|
// if(arr.length == 1)
|
||
|
|
// {
|
||
|
|
// dateDlg.mea = zdFile.replace(/\.[^/.]+$/, "")
|
||
|
|
// dateDlg.path = path
|
||
|
|
// dateDlg.visible = true
|
||
|
|
// }
|
||
|
|
// else if(arr.length == 2)
|
||
|
|
// {
|
||
|
|
// var dateString =arr[1].replace(/\.[^/.]+$/, "")
|
||
|
|
// var dateStr = dateString.replace(/(\d{4})-(\d{2})-(\d{2})-(\d{2})-(\d{2})-(\d{2})-(\d{2})/, '$1/$2/$3 $4:$5:$6.$7');
|
||
|
|
// var date = new Date(dateStr);
|
||
|
|
|
||
|
|
// var result = backend_proxy.importExternalData(arr[0],date.getTime(),path)
|
||
|
|
// if(result.code !== 200)
|
||
|
|
// {
|
||
|
|
// alert.show(result.msg)
|
||
|
|
// }
|
||
|
|
// else
|
||
|
|
// {
|
||
|
|
// g_gatherInfo.start = date.getTime()
|
||
|
|
// g_gatherInfo.stop = result.data
|
||
|
|
// g_gatherInfo.mea = arr[0]
|
||
|
|
// g_gatherInfo.channel = "0"
|
||
|
|
// g_gatherInfo.remark = ""
|
||
|
|
// g_proHistoryData.push({"start": g_gatherInfo.start, "stop": g_gatherInfo.stop, "mea": g_gatherInfo.mea, "channel": g_gatherInfo.channel, "remark": g_gatherInfo.remark})
|
||
|
|
// update_proData()
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
|
||
|
|
// console.log("You chose: " + fileDialog.fileUrls)
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// onRejected: {
|
||
|
|
// console.log("Canceled")
|
||
|
|
// }
|
||
|
|
// visible: false
|
||
|
|
// }
|
||
|
|
function runLstCmd(cmdName){
|
||
|
|
curQueueId = ""
|
||
|
|
for(var i = 0; i < mainWin._command.cmdLstModel.count; ++i)
|
||
|
|
{
|
||
|
|
var item = mainWin._command.cmdLstModel.get(i)
|
||
|
|
if(item.name == cmdName)
|
||
|
|
{
|
||
|
|
curQueueId = item.id
|
||
|
|
break
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var result = backend_proxy.send_queue(curQueueId)
|
||
|
|
|
||
|
|
if(result.code !== 200)
|
||
|
|
{
|
||
|
|
lstRunning = false
|
||
|
|
alert.show(result.msg)
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
lstRunning = true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function stopLstCmd(){
|
||
|
|
var result = backend_proxy.stop_queue(1,2,3)
|
||
|
|
if(result.code !== 200)
|
||
|
|
{
|
||
|
|
lstRunning = true
|
||
|
|
alert.show(result.msg)
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
lstRunning = false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|