diff --git a/FluentUI/Controls/TabView.qml b/FluentUI/Controls/TabView.qml index d0f3d7a..a5b5985 100644 --- a/FluentUI/Controls/TabView.qml +++ b/FluentUI/Controls/TabView.qml @@ -10,6 +10,9 @@ Item { property int itemWidth: 146 property bool addButtonVisibility: true signal newPressed + signal closeTabed(var item) + signal closeTabOk() + signal clickNav(var item) id:control implicitHeight: height implicitWidth: width @@ -127,6 +130,7 @@ Item { drag.axis: Drag.XAxis onClicked: { tab_nav.currentIndex = model.index + clickNav(model) } } Rectangle{ @@ -194,7 +198,9 @@ Item { verticalCenter: parent.verticalCenter } onClicked: { + closeTabed(model) tab_model.remove(index) + closeTabOk() } } Rectangle{ @@ -254,4 +260,7 @@ Item { function choose(index) { tab_nav.currentIndex = index } + function get_cur_tab() { + return tab_model.get(tab_nav.currentIndex) + } } diff --git a/Gallery/CMakeLists.txt b/Gallery/CMakeLists.txt index c82aff5..912bbe8 100644 --- a/Gallery/CMakeLists.txt +++ b/Gallery/CMakeLists.txt @@ -158,10 +158,12 @@ set(RESOURCES_FILES res/image/icons/dry.png res/image/icons/dw.png res/image/icons/fwq.png - res/image/icons/icon_car.png + res/image/icons/car.png res/image/icons/park.png res/image/icons/sf.png res/image/icons/u.png + res/image/icons/gc.png + res/image/icons/mime.png Gallery_zh_CN.qm Gallery_en_US.qm ) @@ -241,6 +243,11 @@ qt_add_qml_module(${PROJECT_NAME} QML_FILES res/qml/window/NewFolderWindow.qml QML_FILES res/qml/screen/NewFolderScreen.qml QML_FILES res/qml/component/LeftMainMenu.qml + QML_FILES res/qml/window/SearchNearWindow.qml + QML_FILES res/qml/screen/SearchNearScreen.qml + QML_FILES res/qml/window/SimTransportWindow.qml + QML_FILES res/qml/screen/SimTransportScreen.qml + QML_FILES res/qml/component/LeftResource.qml ) if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") diff --git a/Gallery/Gallery_en_US.ts b/Gallery/Gallery_en_US.ts index 6f26524..7e29eed 100644 --- a/Gallery/Gallery_en_US.ts +++ b/Gallery/Gallery_en_US.ts @@ -761,7 +761,7 @@ RightMainContent - + 您确认要删除吗? diff --git a/Gallery/Gallery_zh_CN.ts b/Gallery/Gallery_zh_CN.ts index 5aa5111..4c6658b 100644 --- a/Gallery/Gallery_zh_CN.ts +++ b/Gallery/Gallery_zh_CN.ts @@ -1092,7 +1092,7 @@ RightMainContent - + 您确认要删除吗? diff --git a/Gallery/res/image/icons/car.png b/Gallery/res/image/icons/car.png new file mode 100644 index 0000000..b215087 Binary files /dev/null and b/Gallery/res/image/icons/car.png differ diff --git a/Gallery/res/image/icons/gc.png b/Gallery/res/image/icons/gc.png new file mode 100644 index 0000000..9c18889 Binary files /dev/null and b/Gallery/res/image/icons/gc.png differ diff --git a/Gallery/res/image/icons/mime.png b/Gallery/res/image/icons/mime.png new file mode 100644 index 0000000..beaf4a2 Binary files /dev/null and b/Gallery/res/image/icons/mime.png differ diff --git a/Gallery/res/qml/App.qml b/Gallery/res/qml/App.qml index 6aa5914..f8e2cbc 100644 --- a/Gallery/res/qml/App.qml +++ b/Gallery/res/qml/App.qml @@ -29,6 +29,8 @@ Starter { "/icons": R.resolvedUrl("res/qml/window/PointIconListWindow.qml"), "/newProject": R.resolvedUrl("res/qml/window/NewProjectWindow.qml"), "/newFolder": R.resolvedUrl("res/qml/window/NewFolderWindow.qml"), + "/searchNear": R.resolvedUrl("res/qml/window/SearchNearWindow.qml"), + "/sim": R.resolvedUrl("res/qml/window/SimTransportWindow.qml"), "/example": R.resolvedUrl("res/qml/window/MainWindow.qml"), "/login": R.resolvedUrl("res/qml/window/LoginWindow.qml"), diff --git a/Gallery/res/qml/Global.qml b/Gallery/res/qml/Global.qml index 317d7e3..8ac915f 100644 --- a/Gallery/res/qml/Global.qml +++ b/Gallery/res/qml/Global.qml @@ -10,4 +10,6 @@ QtObject { property var starter property int displayMode: NavigationViewType.Auto property int windowEffect: WindowEffectType.Normal + + signal sendMessage(var message) } diff --git a/Gallery/res/qml/component/ComAnalysisInfo.qml b/Gallery/res/qml/component/ComAnalysisInfo.qml index d0b94e1..bbc1497 100644 --- a/Gallery/res/qml/component/ComAnalysisInfo.qml +++ b/Gallery/res/qml/component/ComAnalysisInfo.qml @@ -4,23 +4,134 @@ import QtQuick.Controls import FluentUI.Controls import FluentUI.impl -ColumnLayout { - spacing: 5 - Button{ - text: "运输成本分析" - onClicked: { - WindowRouter.go("/example",{type:"WindowType.Standard"}) +Item { + anchors.fill: parent + ListModel{ + id: tab_model + ListElement{ + title: "运煤计算" + } + ListElement{ + title: "站点规划" + } + ListElement{ + title: "站内规划" } } - Button{ - text: "补能站整体规划" + + TabBar { + id: bar + width: parent.width + clip: true + Repeater { + model: tab_model + TabButton { + id: btn_tab + text: model.title + font.pointSize: 10 + } + } } - Button{ - text: "站内规划" - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'green' + + StackLayout { + currentIndex: bar.currentIndex + anchors{ + left: bar.left + right: bar.right + top: bar.bottom + bottom: parent.bottom + topMargin: 10 + } + Rectangle{ + Layout.fillWidth: true + Layout.fillHeight: true + color: 'transparent' + ColumnLayout{ + anchors.fill: parent + spacing: 15 + Rectangle{ + Layout.preferredHeight: 100 + Layout.fillWidth: true + + color: "transparent" + + border.color: "#ffffff" + border.width: 2 + + ColumnLayout{ + RowLayout{ + Label{ + text: "方案一" + } + } + RowLayout{ + Label{ + Layout.preferredWidth: 180 + text: "预期收益:1000万,碳减排:500万吨,投建站点年收益:100万" + wrapMode: Label.WordWrap + } + } + RowLayout{ + Button{ + text: "查看" + } + Button{ + text: "导出报告" + } + } + } + } + Button{ + text: "新建方案" + highlighted: true + onClicked: { + WindowRouter.go("/sim",{type:"WindowType.Standard"}) + } + } + + Item{ + Layout.fillHeight: true + } + } + } + Rectangle{ + Layout.fillWidth: true + Layout.fillHeight: true + color: 'transparent' + Label{ + text: "设计站点位置,计算成本收益" + } + } + Rectangle{ + Layout.fillWidth: true + Layout.fillHeight: true + color: 'transparent' + Label{ + text: "设计站内数据,瓶颈分析" + } + } } + + // Button{ + // text: "运煤计算" + // onClicked: { + // WindowRouter.go("/sim",{type:"WindowType.Standard"}) + // } + // } + + + + + + // Button{ + // text: "补能站整体规划" + // } + // Button{ + // text: "站内规划" + // } + // Rectangle{ + // Layout.fillHeight: true + // Layout.fillWidth: true + // color: 'green' + // } } diff --git a/Gallery/res/qml/component/ComDesignInfo.qml b/Gallery/res/qml/component/ComDesignInfo.qml index b0ebe67..3e4319d 100644 --- a/Gallery/res/qml/component/ComDesignInfo.qml +++ b/Gallery/res/qml/component/ComDesignInfo.qml @@ -16,6 +16,7 @@ ColumnLayout { signal textColorChanged(var color); property var cur_color + property var entityId spacing: 5 Label{ @@ -169,10 +170,7 @@ ColumnLayout { if (data.img) { icon_img.source = "qrc:/qt/qml/Gallery/res/image/icons/" + data.img } - - // com_tb.text = "" - // com_color.current = "#ffffff" - // icon_img.source = "qrc:/qt/qml/Gallery/res/image/ico_home.png" + control.entityId = data.id } function update_only_data(data) @@ -186,6 +184,7 @@ ColumnLayout { com_tb.text = data.title com_color.current = data.textColor icon_img.source = "qrc:/qt/qml/Gallery/res/image/icons/" + data.img + control.entityId = data.id } else { console.log("reset info...") control.lon = "" @@ -195,6 +194,7 @@ ColumnLayout { com_tb.text = "" com_color.current = "#ffffff" icon_img.source = "qrc:/qt/qml/Gallery/res/image/ico_home.png" + control.entityId = "" } } } diff --git a/Gallery/res/qml/component/ComDesignInfoLine.qml b/Gallery/res/qml/component/ComDesignInfoLine.qml index 2676ab4..40ae630 100644 --- a/Gallery/res/qml/component/ComDesignInfoLine.qml +++ b/Gallery/res/qml/component/ComDesignInfoLine.qml @@ -12,6 +12,7 @@ ColumnLayout { signal textChanged(var text); signal textColorChanged(var color); + property var entityId property var points: [[],[]] signal lineWidth(var width) signal lineColorChanged(var color) @@ -68,13 +69,17 @@ ColumnLayout { id: data_model } - ColumnLayout{ + ScrollView { Layout.fillWidth: true - Repeater{ - model:data_model - AutoLoader{ - property var modelData: model - sourceComponent: comp_page + Layout.preferredHeight: 200 + ColumnLayout{ + anchors.fill: parent + Repeater{ + model:data_model + AutoLoader{ + property var modelData: model + sourceComponent: comp_page + } } } } @@ -120,35 +125,35 @@ ColumnLayout { } // 文字样式 - // RowLayout{ - // Layout.fillWidth: true - // Layout.fillHeight: true - // ColorPicker{ - // id: com_color - // // anchors.verticalCenter: parent.verticalCenter - // // onAccepted: function() { - // // control.textColorChanged(com_color.current + "") - // // } - // onCurrentChanged: { - // if (control.isNeedSignal) { - // control.textColorChanged(com_color.current + "") - // } - // control.isNeedSignal = true - // } - // } - // TextBox{ - // id: com_tb - // Layout.preferredHeight: 35 - // Layout.fillWidth: true - // placeholderText: "标题" - // onTextChanged: { - // if (control.isNeedSignal) { - // control.textChanged(text) - // } - // control.isNeedSignal = true - // } - // } - // } + RowLayout{ + Layout.fillWidth: true + Layout.fillHeight: true + // ColorPicker{ + // id: com_color + // // anchors.verticalCenter: parent.verticalCenter + // // onAccepted: function() { + // // control.textColorChanged(com_color.current + "") + // // } + // onCurrentChanged: { + // if (control.isNeedSignal) { + // control.textColorChanged(com_color.current + "") + // } + // control.isNeedSignal = true + // } + // } + TextBox{ + id: com_tb + Layout.preferredHeight: 35 + Layout.fillWidth: true + placeholderText: "标题" + onTextChanged: { + if (control.isNeedSignal) { + control.textChanged(text) + } + control.isNeedSignal = true + } + } + } Rectangle{ @@ -163,38 +168,24 @@ ColumnLayout { for(var d of data.pos) { data_model.append(d) } - console.log("update info ...") + console.log("update info ..." + data.id) com_line_width.text = data.lineWidth com_color_line.current = data.lineColor + com_tb.text = data.title + control.entityId = data.id } function update_only_data(data) { if (data) { + control.entityId = data.id } else { data_model.clear() control.isNeedSignal = false com_line_width.text = "1" com_color_line.current = "#ffffff" + com_tb.text = "" + control.entityId = "" } - // if (data) { - // control.lon = data.pos[0] - // control.lat = data.pos[1] - // control.hei = data.pos[2] - - // control.isNeedSignal = false - // com_tb.text = data.title - // com_color.current = data.textColor - // icon_img.source = "qrc:/qt/qml/Gallery/res/image/icons/" + data.img - // } else { - // console.log("reset info...") - // control.lon = "" - // control.lat = "" - // control.hei = "" - - // com_tb.text = "" - // com_color.current = "#ffffff" - // icon_img.source = "qrc:/qt/qml/Gallery/res/image/ico_home.png" - // } } } diff --git a/Gallery/res/qml/component/ComDesignInfoPolygon.qml b/Gallery/res/qml/component/ComDesignInfoPolygon.qml index 8776768..43243ab 100644 --- a/Gallery/res/qml/component/ComDesignInfoPolygon.qml +++ b/Gallery/res/qml/component/ComDesignInfoPolygon.qml @@ -65,13 +65,17 @@ ColumnLayout { id: data_model } - ColumnLayout{ + ScrollView { Layout.fillWidth: true - Repeater{ - model:data_model - AutoLoader{ - property var modelData: model - sourceComponent: comp_page + Layout.preferredHeight: 200 + ColumnLayout{ + anchors.fill: parent + Repeater{ + model:data_model + AutoLoader{ + property var modelData: model + sourceComponent: comp_page + } } } } @@ -162,6 +166,7 @@ ColumnLayout { control.isNeedSignal = false com_color_bg.current = "#ffffff" com_tb.text = "" + control.entityId = "" } } } diff --git a/Gallery/res/qml/component/LeftMainMenu.qml b/Gallery/res/qml/component/LeftMainMenu.qml index 16fe3e0..d83da17 100644 --- a/Gallery/res/qml/component/LeftMainMenu.qml +++ b/Gallery/res/qml/component/LeftMainMenu.qml @@ -110,12 +110,12 @@ Item { Layout.fillHeight: true Layout.fillWidth: true id: dataGrid - anchors{ - top: parent.top - bottom: parent.bottom - left: parent.left - bottomMargin: 10 - } + // anchors{ + // top: parent.top + // bottom: parent.bottom + // left: parent.left + // bottomMargin: 10 + // } verticalHeaderVisible: false horizonalHeaderVisible: false width: 240 @@ -146,7 +146,7 @@ Item { icon.height: 18 spacing: 5 onClicked: { - // console.log(dataModel.) + console.log(dataGrid) folderNew.launch({ title: "" }) } } @@ -158,13 +158,16 @@ Item { id: folderNew path: "/newFolder" onResult: (data)=>{ - console.log(JSON.stringify(data)) + var data = {id: control.generateUUID(), title: data.title, height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", cdata: null} + control.setMenuData(data) } } //////////// Component.onCompleted: { - var data = {id: "1", title: "主页", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", cdata: null} + var data = {id: "1", title: "充电站规划", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", cdata: null} + control.setMenuData(data) + var data = {id: "12", title: "运输计划", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", cdata: null} control.setMenuData(data) } @@ -180,4 +183,14 @@ Item { dataModel.sourceData = initData } + + function generateUUID() { + var d = new Date().getTime(); + var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random()*16)%16 | 0; + d = Math.floor(d/16); + return (c=='x' ? r : (r&0x3|0x8)).toString(16); + }); + return uuid; + } } diff --git a/Gallery/res/qml/component/LeftMainMenuTab.qml b/Gallery/res/qml/component/LeftMainMenuTab.qml index 63d2794..432aa43 100644 --- a/Gallery/res/qml/component/LeftMainMenuTab.qml +++ b/Gallery/res/qml/component/LeftMainMenuTab.qml @@ -9,6 +9,8 @@ Item { signal clickMenuItem(var data) + signal clickResource(var data) + property var colors : [Colors.yellow,Colors.orange,Colors.red,Colors.magenta,Colors.purple,Colors.blue,Colors.teal,Colors.green] property var randomAccentColor: function(){ @@ -79,10 +81,18 @@ Item { } } - Rectangle{ + // 资源面板 + LeftResource{ Layout.fillWidth: true Layout.fillHeight: true - color: 'yellow' + onClickResource: function(data) { + control.clickResource(data) + } + + // color: 'yellow' + // LeftResource{ + // anchors.fill: parent + // } } Rectangle{ Layout.fillWidth: true diff --git a/Gallery/res/qml/component/LeftProjectMenu.qml b/Gallery/res/qml/component/LeftProjectMenu.qml index bab18c7..8b57791 100644 --- a/Gallery/res/qml/component/LeftProjectMenu.qml +++ b/Gallery/res/qml/component/LeftProjectMenu.qml @@ -165,15 +165,6 @@ Item { tmp.cdata = data } - // initData.push({key: "组件1", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png"}) - // initData.push({key: "线路1", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", children: [ - // {key: "新疆", height: 36, icon: ""}, - // {key: "耳字豪", height: 36, icon: ""} - // ]}) - // initData.push({key: "陆港集合", height: 35, icon: "qrc:/qt/qml/Gallery/res/image/ico_tab.png", children: [ - // {key: "耳字豪陆港", height: 36, icon: ""} - // ]}) - dataModel.sourceData = initData } } diff --git a/Gallery/res/qml/component/LeftResource.qml b/Gallery/res/qml/component/LeftResource.qml new file mode 100644 index 0000000..a7ed9c8 --- /dev/null +++ b/Gallery/res/qml/component/LeftResource.qml @@ -0,0 +1,143 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI.Controls +import FluentUI.impl +import Gallery + +ColumnLayout { + id: control + + signal clickResource(var name) + + anchors.fill: parent + + ColumnLayout{ + Layout.fillHeight: true + Layout.fillWidth: true + spacing: 10 + + Rectangle{ + Layout.preferredWidth: 200 + Layout.preferredHeight: 50 + color: "transparent" + + border.color: "#ffffff" + border.width: 2 + + RowLayout{ + anchors.fill: parent + Label{ + Layout.leftMargin: 10 + Layout.fillWidth: true + text: "新疆煤炭资源(156个)" + font.pointSize: 10 + } + Button{ + text: "加载" + Layout.rightMargin: 10 + onClicked: { + control.clickResource({type: "meitan", title: "新疆煤炭资源"}) + } + } + } + + // MouseArea{ + // anchors.fill: parent + // hoverEnabled: true + // onEntered: parent.color = "#292929" + // onExited: parent.color = "transparent" + // } + } + + + Rectangle{ + Layout.preferredWidth: 200 + Layout.preferredHeight: 50 + color: "transparent" + + border.color: "#ffffff" + border.width: 2 + + RowLayout{ + anchors.fill: parent + Label{ + Layout.leftMargin: 10 + Layout.fillWidth: true + text: "G7高速周边充电站(15个)" + font.pointSize: 10 + } + Button{ + text: "加载" + Layout.rightMargin: 10 + } + } + + MouseArea{ + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = "#292929" + onExited: parent.color = "transparent" + } + } + + Rectangle{ + Layout.preferredWidth: 200 + Layout.preferredHeight: 50 + color: "transparent" + + border.color: "#ffffff" + border.width: 2 + + RowLayout{ + anchors.fill: parent + Label{ + Layout.leftMargin: 10 + Layout.fillWidth: true + text: "全国陆港分布(15个)" + font.pointSize: 10 + } + Button{ + text: "加载" + Layout.rightMargin: 10 + onClicked: { + control.clickResource({type: "lugang", title: "全国陆港分布"}) + } + } + } + } + + + Rectangle{ + Layout.preferredWidth: 200 + Layout.preferredHeight: 50 + color: "transparent" + + border.color: "#ffffff" + border.width: 2 + + RowLayout{ + anchors.fill: parent + Label{ + Layout.leftMargin: 10 + Layout.fillWidth: true + text: "包头市倾斜摄影数据" + font.pointSize: 10 + } + Button{ + text: "加载" + Layout.rightMargin: 10 + } + } + + MouseArea{ + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = "#292929" + onExited: parent.color = "transparent" + } + } + + + } +} diff --git a/Gallery/res/qml/component/RightComponentInfo.qml b/Gallery/res/qml/component/RightComponentInfo.qml index e006ee1..7a963d2 100644 --- a/Gallery/res/qml/component/RightComponentInfo.qml +++ b/Gallery/res/qml/component/RightComponentInfo.qml @@ -89,7 +89,7 @@ Item { control.iconChanged(data) } onTextChanged: function(data) { - control.textChanged(data) + control.textChanged({title: data, id: com_design.entityId}) } onTextColorChanged: function(data) { console.log(data) @@ -109,12 +109,12 @@ Item { console.log("change line color ==" + data) control.lineInfoChanged({lineColor: data}) } + onTextChanged: function(data) { + control.lineInfoChanged({title: data, id: com_design_line.entityId }) + } // onIconChanged: function(data) { // control.iconChanged(data) // } - // onTextChanged: function(data) { - // control.textChanged(data) - // } // onTextColorChanged: function(data) { // console.log(data) // control.textColorChanged(data) @@ -138,7 +138,10 @@ Item { Rectangle{ Layout.fillWidth: true Layout.fillHeight: true - color: 'yellow' + color: 'transparent' + Label{ + text: "对接thingboard接口?" + } } Rectangle{ Layout.fillWidth: true diff --git a/Gallery/res/qml/component/RightMainContent.qml b/Gallery/res/qml/component/RightMainContent.qml index 6b00d9b..47ebaf5 100644 --- a/Gallery/res/qml/component/RightMainContent.qml +++ b/Gallery/res/qml/component/RightMainContent.qml @@ -6,6 +6,9 @@ import FluentUI.impl import Gallery Item { + id: control + signal clickSee(var item) + anchors.fill: parent Component{ id: item_project @@ -77,13 +80,13 @@ Item { } } IconButton{ - text: "查看" + text: "设计" icon.name: FluentIcons.graph_RedEye icon.width: 10 icon.height: 10 spacing: 3 onClicked: { - + control.clickSee(model) } } IconButton{ @@ -140,6 +143,14 @@ Item { desc: "" img: "qrc:/qt/qml/Gallery/res/image/card/bg_card.png" } + ListElement { + uuid: "2" + title: "河津站" + company: "绿电智联(浙江)数据科技有限公司" + time: "2025-01-05 12:00:00" + desc: "" + img: "qrc:/qt/qml/Gallery/res/image/card/bg_card.png" + } } // 新建项目弹框 @@ -154,7 +165,7 @@ Item { var day = d.getDate() var str_time = year + "-" + (month >= 10 ? month : "0" + month) + "-" + (day >= 10 ? day : "0" + day) - list_model.append({title: data.title, company: data.company, desc: data.desc, time: str_time}) + list_model.append({title: data.title, company: data.company, desc: data.desc, time: str_time, uuid: control.generateUUID()}) // var ml = Qt.createComponent("qrc:/qt/qml/FluentUI/Controls/PaneItemExpander.qml"); // if (ml.status === Component.Ready) { // var menu = ml.createObject(nav_menu,{title: data.title }) @@ -201,4 +212,14 @@ Item { } } } + + function generateUUID() { + var d = new Date().getTime(); + var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random()*16)%16 | 0; + d = Math.floor(d/16); + return (c=='x' ? r : (r&0x3|0x8)).toString(16); + }); + return uuid; + } } diff --git a/Gallery/res/qml/component/TitleBar.qml b/Gallery/res/qml/component/TitleBar.qml index 624c487..739f96c 100644 --- a/Gallery/res/qml/component/TitleBar.qml +++ b/Gallery/res/qml/component/TitleBar.qml @@ -7,7 +7,7 @@ import FluentUI.impl import Qt5Compat.GraphicalEffects Item { - signal clickNav(var path) + signal clickNav(var path, var params) id: control property var mapTabs: {"": ""} // anchors.fill: parent @@ -69,7 +69,7 @@ Item { onEntered: parent.color = "#000000" onExited: parent.color = "#292929" onClicked: { - control.clickNav("home") + control.clickNav("home", "") // selectedSegment = model.text // segmentDialog.close() } @@ -95,7 +95,25 @@ Item { id:com_page Rectangle{ anchors.fill: parent - color: "transparent" + color: "green" + } + } + onClickNav: function(data) { + control.clickNav("other", data.argument.path) + } + onCloseTabed: function(index) { + console.log("tab count=" + tab_view.count()) + control.mapTabs[index.argument.path] = undefined + } + onCloseTabOk: { + if (tab_view.count() > 0) { + tab_view.choose(tab_view.count() - 1) + var curt = tab_view.get_cur_tab() + var uuid = curt.argument.path + console.log(curt.argument.title) + control.clickNav("other", uuid) + } else { + control.clickNav("home", "") } } function newTab(){ diff --git a/Gallery/res/qml/component/ToolBar.qml b/Gallery/res/qml/component/ToolBar.qml index b53a601..8492313 100644 --- a/Gallery/res/qml/component/ToolBar.qml +++ b/Gallery/res/qml/component/ToolBar.qml @@ -79,25 +79,53 @@ Item { ToggleButton{ Layout.fillWidth: false text: "三角" + onClicked: { + control.clickButton("StartTriangle") + } } ToggleButton{ Layout.fillWidth: false text: "圆" + onClicked: { + control.clickButton("StartCircle") + } } ToggleButton{ Layout.fillWidth: false text: "椭圆" + onClicked: { + control.clickButton("StartEllipse") + } } ToggleButton{ Layout.fillWidth: false text: "自由线" + onClicked: { + control.clickButton("StartFreeLine") + } } ToggleButton{ Layout.fillWidth: false text: "自由面" + onClicked: { + control.clickButton("StartFreeSurface") + } } } } + + Rectangle{ + Layout.preferredWidth: 100 + Layout.preferredHeight: 30 + color: "transparent" + // Button{ + // text: "运输仿真" + // highlighted: true + // onClicked: { + // WindowRouter.go("/sim",{type:"WindowType.Standard"}) + // } + // } + } } } diff --git a/Gallery/res/qml/screen/MainPageScreen.qml b/Gallery/res/qml/screen/MainPageScreen.qml index e8f18d3..20e3270 100644 --- a/Gallery/res/qml/screen/MainPageScreen.qml +++ b/Gallery/res/qml/screen/MainPageScreen.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls import FluentUI.Controls import FluentUI.impl +import Gallery import "../component" Item { @@ -21,10 +22,14 @@ Item { TitleBar{ id: title_bar Layout.preferredWidth: parent.width - - onClickNav: (params) => { - control.is_home = true - nav_main.visitUrl("/") + onClickNav: (type, params) => { + if (type == "home") { + control.is_home = true + } else if (type == "other") { + control.is_home = false + map_container.run_js("QT_Refresh", params) + } + // nav_main.visitUrl("/") } } @@ -32,7 +37,9 @@ Item { visible: !control.is_home Layout.preferredWidth: parent.width onClickButton: (fun) => { - console.log(fun) + control.show_right = false + com_info.reset_info() + map_container.run_js(fun) } } @@ -48,31 +55,41 @@ Item { color: "transparent" // 主页的菜单。 - // LeftMainMenu{ - // anchors.fill: parent + LeftMainMenu{ + anchors.fill: parent + } + + // LeftNavMenu{ + // id: nav_main + // height: parent.height + // onClickMenu: (item) => { + // if (item.key == "/") { + // control.is_home = true + // } else if (item.key == "/newproject") { + + // } else { + // console.log(item.title + ", filter list...") + // control.is_home = false + // title_bar.addTab(item.title, item.key) + // } + // } // } + } - LeftNavMenu{ - id: nav_main - height: parent.height - onClickMenu: (item) => { - if (item.key == "/") { - control.is_home = true - } else if (item.key == "/newproject") { - - } else { - console.log(item.title + ", filter list...") - control.is_home = false - title_bar.addTab(item.title, item.key) - } + Rectangle{ + visible: control.is_home + Layout.fillHeight: true + Layout.fillWidth: true + color: "transparent" + RightMainContent { + anchors.fill: parent + onClickSee: function(data) { + title_bar.addTab(data.title, data.uuid) + control.is_home = false } } } - // Rectangle{ - // visible: control.is_home - // } - // LeftProjectMenu{ // visible: !control.is_home @@ -87,9 +104,20 @@ Item { Layout.leftMargin: 10 onClickMenuItem: function(data) { - map_container.run_js("QT_ZoomTo", [data.id]) - // 更新右侧 - com_info.update_only_data(data) + console.log(JSON.stringify(data)) + if (data.type && data.type == "resource") { + map_container.run_js("QT_ZoomToResource", data.id) + } else { + map_container.run_js("QT_ZoomTo", [data.id]) + // 更新右侧 + com_info.update_only_data(data) + } + } + + onClickResource: function(data) { + map_container.run_js("QT_LoadResource", [data.type, data.title]) + // 需要更新元素tab数据 + } } @@ -103,6 +131,7 @@ Item { Layout.fillHeight: true Layout.fillWidth: true onAsyncMapInfo: function(data) { + com_info.reset_info() console.log("接受===" + data.type) if (data.type == "point") { control.right_type = data.type @@ -125,6 +154,11 @@ Item { control.right_type = data.type com_info.update_design(data.data) left_tab.setMenuData(data.data) + } else if (data.type == "search-near") { + WindowRouter.go("/searchNear",{type:"WindowType.Standard"}) + } else if (data.type == "resource") { + // 资源类的没有右侧面板 + left_tab.setMenuData(data.data) } } } @@ -141,7 +175,12 @@ Item { map_container.run_js("QT_ChangeIcon", {img: data}) } onTextChanged: function(data) { - map_container.run_js("QT_ChangeIcon", {text: data}) + map_container.run_js("QT_ChangeIcon", {text: data.title}) + // 更新左侧标题 + console.log("id====" + data.id) + if (data.title && data.id) { + left_tab.setMenuData(data) + } } onTextColorChanged: function(data) { map_container.run_js("QT_ChangeIcon", {textColor: data}) @@ -149,6 +188,11 @@ Item { onLineInfoChanged: function(data) { map_container.run_js("QT_ChangeLine", data) + // 更新左侧标题 + console.log("id====" + data.id) + if (data.title && data.id) { + left_tab.setMenuData(data) + } } onPolyInfoChanged: function(data) { @@ -161,4 +205,14 @@ Item { } } } + + + Connections { + target: Global + onSendMessage: function(message) { + console.log("Window 2 received:", message) + map_container.run_js("QT_StartSim", "") + } + } + } diff --git a/Gallery/res/qml/screen/PointIconListScreen.qml b/Gallery/res/qml/screen/PointIconListScreen.qml index b52747a..38cfe1a 100644 --- a/Gallery/res/qml/screen/PointIconListScreen.qml +++ b/Gallery/res/qml/screen/PointIconListScreen.qml @@ -17,6 +17,11 @@ Item { ListModel{ id: point_model + ListElement{ + key: "mime.png" + title: "煤矿" + image: "qrc:/qt/qml/Gallery/res/image/icons/mime.png" + } ListElement{ key: "dry.png" title: "陆港" @@ -33,9 +38,9 @@ Item { image: "qrc:/qt/qml/Gallery/res/image/icons/fwq.png" } ListElement{ - key: "icon_car.png" + key: "car.png" title: "车辆" - image: "qrc:/qt/qml/Gallery/res/image/icons/icon_car.png" + image: "qrc:/qt/qml/Gallery/res/image/icons/car.png" } ListElement{ key: "sf.png" @@ -47,6 +52,11 @@ Item { title: "U型路口" image: "qrc:/qt/qml/Gallery/res/image/icons/u.png" } + ListElement{ + key: "gc.png" + title: "发电厂" + image: "qrc:/qt/qml/Gallery/res/image/icons/gc.png" + } } GridView{ diff --git a/Gallery/res/qml/screen/SearchNearScreen.qml b/Gallery/res/qml/screen/SearchNearScreen.qml new file mode 100644 index 0000000..9e6ab4c --- /dev/null +++ b/Gallery/res/qml/screen/SearchNearScreen.qml @@ -0,0 +1,235 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI.Controls +import FluentUI.impl + +ColumnLayout { + anchors.fill: parent + anchors.rightMargin: 10 + + // 输入框 + RowLayout{ + Layout.preferredHeight: 50 + spacing: 15 + TextBox{ + Layout.fillWidth: true + Layout.leftMargin: 10 + Layout.preferredHeight: 35 + placeholderText: "关键词" + } + Button{ + text: "搜索" + Layout.preferredWidth: 90 + Layout.preferredHeight: 35 + } + ComboBox{ + model: ListModel { + id: model + ListElement { text: "1公里内" } + ListElement { text: "5公里内" } + ListElement { text: "10公里内" } + } + Layout.rightMargin: 10 + } + } + + + ListModel{ + id: tab_model + ListElement{ + title: "充电站" + } + ListElement{ + title: "加氢站" + } + ListElement{ + title: "煤矿" + } + ListElement{ + title: "陆港" + } + ListElement{ + title: "收费站" + } + ListElement{ + title: "服务区" + } + } + // 过滤条件 + RowLayout{ + spacing: 15 + Layout.leftMargin: 10 + Repeater { + model: tab_model + Rectangle{ + width: 80 + height: 30 + color: "#0C53C0" + Label{ + text: model.title + anchors.centerIn: parent + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = "#60B0EF" + onExited: parent.color = "#0C53C0" + onClicked: { + console.log("cdz") + } + } + } + } + + } + // 搜索结果 + ColumnLayout{ + Layout.fillHeight: true + Rectangle{ + Layout.fillHeight: true + Layout.fillWidth: true + Layout.leftMargin: 10 + Layout.rightMargin: 10 + Layout.topMargin: 10 + Layout.bottomMargin: 10 + color: "transparent" + border.color: "#ffffff" + border.width: 2 + + ColumnLayout{ + anchors.fill: parent + Rectangle{ + Layout.leftMargin: 2 + Layout.topMargin: 2 + + Layout.preferredWidth: parent.width - 4 + height: 60 + color: "transparent" + + ColumnLayout{ + anchors.fill: parent + spacing: 5 + RowLayout{ + Layout.fillWidth: true + Label{ + Layout.fillWidth: true + Layout.leftMargin: 5 + text: "新电青丰1号站充电桩" + font.pointSize: 14 + } + Label{ + Layout.preferredWidth: 90 + Layout.rightMargin: 5 + text: "2.7km" + horizontalAlignment: Text.AlignRight + font.pointSize: 8 + } + } + RowLayout{ + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 5 + Label{ + Layout.leftMargin: 5 + Layout.fillWidth: true + text: "营业中,充电桩:6个,空闲:2个,实时电价:1元/kwh,服务费:1.2元/kwh" + font.pointSize: 8 + } + + Button{ + text: "查看" + highlighted: true + } + Button{ + text: "导航去" + highlighted: true + Layout.rightMargin: 5 + } + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = "#292929" + onExited: parent.color = "transparent" + } + + Rectangle{ + width: parent.width + height: 1 + color: "#fff" + anchors.bottom: parent.bottom + } + } + + Rectangle{ + Layout.leftMargin: 2 + Layout.topMargin: 2 + + Layout.preferredWidth: parent.width - 4 + height: 60 + color: "transparent" + + ColumnLayout{ + anchors.fill: parent + spacing: 5 + RowLayout{ + Layout.fillWidth: true + Label{ + Layout.fillWidth: true + Layout.leftMargin: 5 + text: "青河县鹏新矿业" + font.pointSize: 14 + } + Label{ + Layout.preferredWidth: 90 + Layout.rightMargin: 5 + text: "2.7km" + horizontalAlignment: Text.AlignRight + font.pointSize: 8 + } + } + RowLayout{ + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 5 + Label{ + Layout.leftMargin: 5 + Layout.fillWidth: true + text: "营业中,煤炭价格:300元/吨,装载车辆:35辆,周边道路:畅通" + font.pointSize: 8 + } + + Button{ + text: "查看" + highlighted: true + } + Button{ + text: "导航去" + highlighted: true + Layout.rightMargin: 5 + } + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = "#292929" + onExited: parent.color = "transparent" + } + Rectangle{ + width: parent.width + height: 1 + color: "#fff" + anchors.bottom: parent.bottom + } + } + + Item{ + Layout.fillHeight: true + } + } + } + } +} diff --git a/Gallery/res/qml/screen/SimTransportScreen.qml b/Gallery/res/qml/screen/SimTransportScreen.qml new file mode 100644 index 0000000..a7c0ad3 --- /dev/null +++ b/Gallery/res/qml/screen/SimTransportScreen.qml @@ -0,0 +1,104 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI.Controls +import FluentUI.impl +import Gallery + +ColumnLayout { + anchors.left: parent.left + anchors.leftMargin: 50 + anchors.top: parent.top + anchors.topMargin: 20 + spacing: 20 + + RowLayout{ + Label{ + text: "收货方:" + Layout.preferredWidth: 70 + } + TextField{ + placeholderText: "TextField" + Layout.preferredWidth: 250 + } + } + + RowLayout{ + Label{ + text: "供货方:" + Layout.preferredWidth: 70 + } + RadioButton { + checked: true + text: "所有煤矿" + } + RadioButton { + text: "框选范围" + } + } + + RowLayout{ + Label{ + text: "车辆类型:" + Layout.preferredWidth: 70 + } + CheckBox { + checked: true + text: "电车" + } + CheckBox { + text: "氢车" + } + CheckBox { + text: "燃油车" + } + } + + RowLayout{ + Label{ + text: "开始时间:" + Layout.preferredWidth: 70 + } + DatePicker { + } + } + + RowLayout{ + Label{ + text: "结束时间:" + Layout.preferredWidth: 70 + } + DatePicker { + } + } + + RowLayout{ + Label{ + text: "" + Layout.preferredWidth: 70 + } + Button{ + text: "开始计算" + onClicked: { + Global.sendMessage('start-sim') + + lbl_zongjie.visible = true + } + } + Button{ + text: "导出报告" + } + } + + Label{ + id: lbl_zongjie + visible: false + Layout.fillWidth: true + text: "计算总结:成本:xxx,收益:xxx,投建站点:2座,后期预估收益:100万/年" + wrapMode: Label.WordWrap + } + + Item{ + Layout.fillHeight: true + } +} diff --git a/Gallery/res/qml/window/MainPageWindow.qml b/Gallery/res/qml/window/MainPageWindow.qml index 8b20c82..2b412ab 100644 --- a/Gallery/res/qml/window/MainPageWindow.qml +++ b/Gallery/res/qml/window/MainPageWindow.qml @@ -9,8 +9,8 @@ import "../component" FramelessWindow { id: window title: "Antsev Studio" - width: 800 - height: 600 + width: 1200 + height: 700 visible: true fitsAppBarWindows: false launchMode: WindowType.SingleInstance diff --git a/Gallery/res/qml/window/SearchNearWindow.qml b/Gallery/res/qml/window/SearchNearWindow.qml new file mode 100644 index 0000000..3fad333 --- /dev/null +++ b/Gallery/res/qml/window/SearchNearWindow.qml @@ -0,0 +1,19 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI.Controls +import FluentUI.impl +import Gallery + +FramelessWindow { + property var argument + id: window + title: "搜索周边" + width: 600 + height: 400 + fixSize: true + visible: true + launchMode: WindowType.SingleInstance + windowEffect: Global.windowEffect + initialItem: R.resolvedUrl("res/qml/screen/SearchNearScreen.qml") +} diff --git a/Gallery/res/qml/window/SimTransportWindow.qml b/Gallery/res/qml/window/SimTransportWindow.qml new file mode 100644 index 0000000..acc73ca --- /dev/null +++ b/Gallery/res/qml/window/SimTransportWindow.qml @@ -0,0 +1,27 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI.Controls +import FluentUI.impl +import Gallery + +FramelessWindow { + property var argument + id: window + title: "整体运输仿真" + width: 600 + height: 500 + fixSize: true + visible: true + launchMode: WindowType.Standard + windowEffect: Global.windowEffect + onInit: + (arg)=>{ + argument = arg + } + onNewInit: + (arg)=>{ + argument = arg + } + initialItem: R.resolvedUrl("res/qml/screen/SimTransportScreen.qml") +}