521 lines
16 KiB
QML
521 lines
16 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import QtQuick.Dialogs
|
|
import "./common"
|
|
// import "./Style"
|
|
Rectangle {
|
|
signal logoutClick
|
|
signal createProClick
|
|
signal openProClick
|
|
signal deleteProClick
|
|
signal createDialogAcceptClick
|
|
signal openDialogAcceptClick
|
|
signal deleteDialogAcceptClick
|
|
signal closeClick
|
|
// property alias _ability: ability
|
|
property alias _proTableView: proTableView
|
|
// property alias _command: command
|
|
property alias _createDialog: createDialog
|
|
property alias _openDialog: openProDialog
|
|
property alias _tfProName: tfProName
|
|
property alias _tfRemark: tfRemark
|
|
property alias _statusToolbar: statusToolbar
|
|
// property alias _setting: setting
|
|
property var rowWidth : 300
|
|
property var rowHeight : 30
|
|
|
|
property var proModel: ListModel{}
|
|
color: "#efefef"
|
|
Rectangle {
|
|
id: toolBar
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
height: 35
|
|
color:"#0076f6"
|
|
|
|
Row {
|
|
anchors.fill: parent
|
|
spacing: 2
|
|
Item {
|
|
width: 3
|
|
height: 1
|
|
}
|
|
|
|
Rectangle{
|
|
width: 28
|
|
height: 28
|
|
radius: 14
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
Image
|
|
{
|
|
width: 20
|
|
height: 20
|
|
anchors.centerIn: parent
|
|
source: "../logo/logo.png"
|
|
}
|
|
}
|
|
|
|
Rectangle
|
|
{
|
|
width: Math.max(nameText.width+10, 60)
|
|
height: 28
|
|
radius: 3
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
color: "#0089ff"
|
|
QxText{
|
|
id: nameText
|
|
anchors.centerIn: parent
|
|
text: g_session.name
|
|
color: "white"
|
|
font.bold: true
|
|
}
|
|
}
|
|
|
|
Button {
|
|
id: proselect
|
|
text: "工程"
|
|
//style: ToolButtonStyle{}
|
|
onClicked: {
|
|
menuPro.visible = true
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "用户"
|
|
//style: ToolButtonStyle{}
|
|
visible: isAdmin
|
|
onClicked: userManager.visible = true
|
|
}
|
|
Button {
|
|
text: "设置"
|
|
//style: ToolButtonStyle{}
|
|
enabled: !lstRunning
|
|
onClicked: settingView.visible = true
|
|
}
|
|
|
|
Item {
|
|
width: 50
|
|
height: 1
|
|
}
|
|
}
|
|
|
|
|
|
Row{
|
|
anchors.right: parent.right
|
|
Button {
|
|
text: "../resource/user"
|
|
//style: ImageButtonStyle{}
|
|
onClicked: logoutClick()
|
|
}
|
|
Button {
|
|
text: "../resource/min"
|
|
//style: ImageButtonStyle{}
|
|
onClicked: root.showMinimized()
|
|
}
|
|
Button {
|
|
text: windowMaximized ? "../resource/normal" : "../resource/max"
|
|
//style: ImageButtonStyle{}
|
|
onClicked: toggleMaximized()
|
|
}
|
|
Button {
|
|
text: "../resource/close"
|
|
//style: ImageButtonStyle{}
|
|
onClicked: closeClick()
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
// TabView{
|
|
// id: gamatabView
|
|
// visible: !isAdmin
|
|
// anchors.left: parent.left
|
|
// anchors.right: parent.right
|
|
// anchors.top: toolBar.bottom
|
|
// anchors.bottom: parent.bottom
|
|
// anchors.leftMargin: 5
|
|
// anchors.rightMargin: 5
|
|
// anchors.bottomMargin: 30
|
|
// //style: TabViewStyle{}
|
|
// currentIndex: 0
|
|
// Tab{title: "数据采集";}
|
|
// Tab{title: "数据分析";}
|
|
// // Tab{title: "历史数据";}
|
|
// DataGather{
|
|
// anchors.fill:parent
|
|
// visible: gamatabView.currentIndex == 0
|
|
// }
|
|
// DataAnalysis{
|
|
// anchors.fill:parent
|
|
// visible: gamatabView.currentIndex == 1
|
|
// }
|
|
// DataHistory{
|
|
// anchors.fill:parent
|
|
// visible: gamatabView.currentIndex == 2
|
|
// }
|
|
// }
|
|
// TabView{
|
|
// id: tabView
|
|
// visible: isAdmin
|
|
// anchors.left: parent.left
|
|
// anchors.right: parent.right
|
|
// anchors.top: toolBar.bottom
|
|
// anchors.bottom: parent.bottom
|
|
// anchors.leftMargin: 5
|
|
// anchors.rightMargin: 5
|
|
// anchors.bottomMargin: 30
|
|
// //style: TabViewStyle{}
|
|
// currentIndex: 1
|
|
// Tab{title: "电机控制"}
|
|
// Tab{title: "指令测试"}
|
|
// Tab{title: "数据可视化"}
|
|
|
|
// Ability{
|
|
// id: ability
|
|
// visible: tabView.currentIndex == 0
|
|
|
|
// }
|
|
// Command{
|
|
// id: command
|
|
// anchors.fill: parent
|
|
// visible: tabView.currentIndex == 1
|
|
// }
|
|
// WebEngines{
|
|
// anchors.fill:parent
|
|
// visible: tabView.currentIndex == 2
|
|
// }
|
|
// }
|
|
StatusToolBar{
|
|
id: statusToolbar
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.bottom: parent.bottom
|
|
anchors.top: tabView.bottom
|
|
z:3
|
|
}
|
|
|
|
Rectangle { id: empty
|
|
visible: false
|
|
// visible: g_curPro.id === ""
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: toolBar.bottom
|
|
anchors.bottom: parent.bottom
|
|
anchors.leftMargin: 5
|
|
anchors.rightMargin: 5
|
|
anchors.bottomMargin: 5
|
|
QxText{
|
|
anchors.centerIn: parent
|
|
font.pointSize: 50
|
|
color: "#bdbdbd"
|
|
text: "请选择工程"
|
|
}
|
|
|
|
MouseArea{
|
|
anchors.fill:parent
|
|
onClicked: {}
|
|
}
|
|
|
|
z:2
|
|
}
|
|
|
|
UserManager{
|
|
id: userManager
|
|
visible: false
|
|
}
|
|
|
|
SettingView
|
|
{
|
|
id: settingView
|
|
|
|
visible: false
|
|
}
|
|
|
|
Dialog{
|
|
id: openProDialog
|
|
title: "打开工程"
|
|
standardButtons: Dialog.NoButton
|
|
width: 800
|
|
height: 600
|
|
onAccepted: openDialogAcceptClick()
|
|
Column
|
|
{
|
|
anchors.centerIn: parent
|
|
spacing: 20
|
|
Rectangle{
|
|
width:800
|
|
height: 600
|
|
TableView{
|
|
id: proTableView
|
|
anchors.fill: parent
|
|
model: proModel
|
|
// onDoubleClicked: {
|
|
// if( openProDialog.title == "删除工程" )
|
|
// {
|
|
// removeProDlg.msg=proModel.get(proTableView.currentRow).name
|
|
// removeProDlg.visible=true
|
|
// }
|
|
// else
|
|
// {
|
|
// openProDialog.accept()
|
|
// }
|
|
// }
|
|
// 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: 25
|
|
// color : proTableView.currentRow === styleData.row ? "#beebff": ( (styleData.row %2 == 0) ? "#f2f2f2": "white" )
|
|
// }
|
|
// itemDelegate: Item {
|
|
// clip: true
|
|
// QxText {
|
|
// visible: styleData.role === "sid"
|
|
// x: 5
|
|
// anchors.centerIn: parent
|
|
// color: "#999999"
|
|
// elide: styleData.elideMode
|
|
// font.pointSize: 10
|
|
// text: styleData.row + 1
|
|
// }
|
|
|
|
// QxText{
|
|
// z: 2
|
|
// anchors.centerIn: parent
|
|
// visible: styleData.role !== "sid"
|
|
// text: !!styleData.value ? styleData.value : ""
|
|
// }
|
|
// Rectangle{
|
|
// width: 1
|
|
// height: parent.height
|
|
// visible: styleData.role !== "sid"
|
|
// color: "lightgray"
|
|
// }
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proNoCol
|
|
// title: "序号"
|
|
// role: "sid"
|
|
// width: 50
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proNameCol
|
|
// title: "名称"
|
|
// role: "name"
|
|
// width: 150
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proCreateTimeCol
|
|
// title: "创建时间"
|
|
// role: "date"
|
|
// width: 200
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proOpenTimeCol
|
|
// title: "打开时间"
|
|
// role: "last_date"
|
|
// width: 200
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proCsperson
|
|
// title: "测试人员"
|
|
// role: "csperson"
|
|
// width: 200
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proCsLocation
|
|
// title: "测试地点"
|
|
// role: "cslocation"
|
|
// width: 200
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proCsCompany
|
|
// title: "测试单位"
|
|
// role: "cscompany"
|
|
// width: 200
|
|
// }
|
|
// TableViewColumn {
|
|
// id: proCsSummary
|
|
// title: "测试概要"
|
|
// role: "cssummary"
|
|
// width: 200
|
|
// }
|
|
}
|
|
}
|
|
Item
|
|
{
|
|
width:800
|
|
height: 30
|
|
Row{
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 5
|
|
Button
|
|
{
|
|
text: openProDialog.title == "删除工程" ? "删除" : "打开"
|
|
enabled: proTableView.currentRow > -1
|
|
//style: ButtonStyle{}
|
|
onClicked: {
|
|
|
|
if( openProDialog.title == "删除工程" )
|
|
{
|
|
removeProDlg.msg=proModel.get(proTableView.currentRow).name
|
|
removeProDlg.visible=true
|
|
}
|
|
else
|
|
{
|
|
openProDialog.accept()
|
|
}
|
|
}
|
|
}
|
|
Button
|
|
{
|
|
text: "取消"
|
|
//style: ButtonStyle{}
|
|
onClicked: openProDialog.reject()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Dialog {
|
|
id: createDialog
|
|
title: "新建工程"
|
|
standardButtons: Dialog.NoButton
|
|
|
|
width: 350
|
|
height: 200
|
|
|
|
Column
|
|
{
|
|
anchors.centerIn: parent
|
|
spacing: 30
|
|
|
|
Item{
|
|
width: rowWidth
|
|
height: rowHeight
|
|
|
|
QxText{text: "工程名"}
|
|
QxTextField{id: tfProName;anchors.right: parent.right;width: 200;height: 30;_pt:"请输入工程名"}
|
|
}
|
|
|
|
Item{
|
|
width: rowWidth
|
|
height: rowHeight
|
|
QxText{text:"备注"}
|
|
QxTextField{id:tfRemark;anchors.right: parent.right;width: 200;height: 30;_pt:"请输入备注"}
|
|
}
|
|
|
|
Row
|
|
{
|
|
width: rowWidth
|
|
height: rowHeight
|
|
|
|
spacing: 100
|
|
|
|
Button
|
|
{
|
|
text: "确认"
|
|
//style: ButtonStyle{}
|
|
onClicked: createDialog.accept()
|
|
}
|
|
Button
|
|
{
|
|
text: "取消"
|
|
//style: ButtonStyle{}
|
|
onClicked: createDialog.reject()
|
|
}
|
|
}
|
|
}
|
|
onAccepted: createDialogAcceptClick()
|
|
|
|
}
|
|
|
|
Item {
|
|
id: menuPro
|
|
z: 99
|
|
anchors.fill: parent
|
|
visible: false
|
|
MouseArea{
|
|
anchors.fill: parent
|
|
onClicked: menuPro.visible = false
|
|
}
|
|
Rectangle {
|
|
x: proselect.x
|
|
y: proselect.y + proselect.height
|
|
visible: true
|
|
width: 122
|
|
height: col.height + 2
|
|
border.width: 1
|
|
border.color: "#a3a3a4"
|
|
Column{
|
|
id: col
|
|
anchors.centerIn: parent
|
|
Button { text: "创建工程" ;onClicked: {menuPro.visible = false; createProClick()}}//style: MenuButtonStyle{}}
|
|
Button { text: "打开工程" ;onClicked: {menuPro.visible = false;openProClick()}}//style: MenuButtonStyle{}}
|
|
Button { text: "删除工程" ;visible: isAdmin; onClicked: {menuPro.visible = false;deleteProClick()}}//style: MenuButtonStyle{}}
|
|
}
|
|
}
|
|
|
|
}
|
|
Dialog {
|
|
id: removeProDlg
|
|
property var msg: ""
|
|
title: "删除工程"
|
|
standardButtons: Dialog.NoButton
|
|
Column
|
|
{
|
|
anchors.centerIn: parent
|
|
spacing: 10
|
|
QxText {
|
|
text: "删除工程:\n" + removeProDlg.msg
|
|
}
|
|
Row
|
|
{
|
|
anchors.right: parent.right
|
|
|
|
spacing: 20
|
|
Button
|
|
{
|
|
text: "是"
|
|
//style: ButtonStyle{}
|
|
onClicked: removeProDlg.accept()
|
|
}
|
|
Button
|
|
{
|
|
text: "否"
|
|
//style: ButtonStyle{}
|
|
onClicked: removeProDlg.reject()
|
|
}
|
|
}
|
|
}
|
|
visible: false
|
|
width: 300
|
|
height: 100
|
|
onAccepted: deleteDialogAcceptClick()
|
|
}
|
|
}
|