Skip to content

Commit

Permalink
Merge branch 'dev-location' into FluentUI-Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AMOSOMNUM committed Dec 6, 2023
2 parents 71b6bac + 95f4c90 commit 91b477c
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 169 deletions.
2 changes: 1 addition & 1 deletion libs/Qt-Based-JsonDeserialiser
6 changes: 3 additions & 3 deletions qml/page/T_DepartmentEvents.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FluScrollablePage {

function loadDepartmentPage() {
statusMode = FluStatusViewType.Loading
if (UserHelper.permission == 1)
if (UserHelper.permission === 1)
DepartmentEventsController.loadDepartments()
else
DepartmentEventsController.loadDepartmentsWithSubscriptionInfo()
Expand Down Expand Up @@ -86,7 +86,7 @@ FluScrollablePage {

FluTextButton {
id: subscribeButton
visible: UserHelper.permission != 1
visible: UserHelper.permission !== 1
Layout.alignment: Qt.AlignRight
checked: true
state: "noSub"
Expand Down Expand Up @@ -141,7 +141,7 @@ FluScrollablePage {
anchors.fill: parent
onClicked: {
departmentId = id
if (UserHelper.permission != 1) {
if (UserHelper.permission !== 1) {
if (subscribed) {
subscribeButton.checked = true
subscribeButton.state = "noSub"
Expand Down
148 changes: 52 additions & 96 deletions qml/page/T_EventoEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,19 @@ import QtQuick.Window
import FluentUI
import SAST_Evento
import "../window"
import "../page"

FluScrollablePage {
id: page
launchMode: FluPageType.SingleTask
property var locationArr: []
property var departmentArr: []

function parseJSON(data) {
var result = []
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
var item = data[i]
var key = item.key
var name = item.label
var isLeaf = false
var children = []

if (item.children && Array.isArray(item.children))
children = parseJSON(item.children)
else
isLeaf = true

result.push(tree_view_location.createItem(name, isLeaf,
children, {
"id": key
}))
}
} else {
result.push(tree_view_location.createItem(data.name, true, [], {
"id": data.key
}))
}
return result
}

function loadEditInfo() {
statusMode = FluStatusViewType.Loading
EventoEditController.loadEditInfo()
}

signal listReady

Component.onCompleted: {
loadEditInfo()
}
onErrorClicked: {
loadEditInfo()
}
Expand All @@ -57,17 +27,6 @@ FluScrollablePage {
Connections {
target: EventoEditController
function onLoadEditSuccessEvent() {
departmentArr = []
var json = JSON.parse(EventoEditController.departmentJson)
for (var ii = 0; ii < json.length; ++ii) {
departmentArr.push(tree_view_department.createItem(
json[ii].departmentName, true, [], {
"id": json[ii].id
}))
}
json = JSON.parse(EventoEditController.locationJson)
locationArr = parseJSON(json[0].children)
listReady()
statusMode = FluStatusViewType.Success
}
}
Expand All @@ -80,15 +39,28 @@ FluScrollablePage {
}
}

Connections {
target: EventoEditController
function onCreateSuccessEvent() {
statusMode = FluStatusViewType.Success
showSuccess("操作成功")
returnPage()
}
}

Connections {
target: EventoEditController
function onCreateErrorEvent(message) {
statusMode = FluStatusViewType.Success
showError(message, 4000)
}
}

Item {
id: item_all
Layout.fillWidth: true
implicitHeight: 650 + textbox_description.implicitHeight

Component.onCompleted: {
loadEditInfo()
}

FluArea {
id: area1
width: parent.width
Expand All @@ -97,6 +69,7 @@ FluScrollablePage {
top: parent.top
}
}

FluArea {
id: area2
width: parent.width
Expand All @@ -106,6 +79,7 @@ FluScrollablePage {
topMargin: 10
}
}

FluArea {
id: area3
width: parent.width
Expand Down Expand Up @@ -145,6 +119,7 @@ FluScrollablePage {
leftMargin: 20
}
}

FluTextBox {
id: textbox_title
implicitWidth: 600
Expand All @@ -167,6 +142,7 @@ FluScrollablePage {
font.pixelSize: 20
font.bold: true
}

FluTextBox {
id: textbox_tag
implicitWidth: 600
Expand All @@ -188,6 +164,7 @@ FluScrollablePage {
topMargin: 15
}
}

FluText {
id: text_start2
text: "开始"
Expand All @@ -197,6 +174,7 @@ FluScrollablePage {
top: item_event_time.top
}
}

FluCalendarPicker {
id: clender_picker_event_start
width: 220
Expand All @@ -207,6 +185,7 @@ FluScrollablePage {
top: item_event_time.top
}
}

FluTimePicker {
id: time_picker_event_start
hourFormat: FluTimePickerType.HH
Expand All @@ -218,6 +197,7 @@ FluScrollablePage {
top: item_event_time.top
}
}

FluText {
id: text_end2
text: "结束"
Expand All @@ -228,6 +208,7 @@ FluScrollablePage {
topMargin: 15
}
}

FluCalendarPicker {
id: clender_picker_event_end
width: 220
Expand All @@ -238,6 +219,7 @@ FluScrollablePage {
top: text_end2.top
}
}

FluTimePicker {
id: time_picker_event_end
hourFormat: FluTimePickerType.HH
Expand All @@ -260,6 +242,7 @@ FluScrollablePage {
topMargin: 15
}
}

FluText {
id: text_start1
text: "开始"
Expand All @@ -269,6 +252,7 @@ FluScrollablePage {
top: item_register_time.top
}
}

FluCalendarPicker {
id: clender_picker_register_start
width: 220
Expand All @@ -280,6 +264,7 @@ FluScrollablePage {
top: item_register_time.top
}
}

FluTimePicker {
id: time_picker_register_start
hourFormat: FluTimePickerType.HH
Expand All @@ -291,6 +276,7 @@ FluScrollablePage {
top: item_register_time.top
}
}

FluText {
id: text_end1
text: "结束"
Expand All @@ -301,6 +287,7 @@ FluScrollablePage {
topMargin: 15
}
}

FluCalendarPicker {
id: clender_picker_register_end
width: 220
Expand All @@ -311,6 +298,7 @@ FluScrollablePage {
top: text_end1.top
}
}

FluTimePicker {
id: time_picker_register_end
hourFormat: FluTimePickerType.HH
Expand Down Expand Up @@ -342,23 +330,17 @@ FluScrollablePage {
top: item_location.top
left: textbox_title.left
}
FluTreeView {
id: tree_view_location
property int locationId: 0
width: 200
height: 200
selectionMode: FluTreeViewType.Single
Connections {
target: page
function onListReady() {
tree_view_location.updateData(locationArr)
}
ListView {
id: location_view
anchors.fill: parent
model: LocationModel

delegate: FluText {
text: title
}
onItemClicked: item => {
locationId = item.data.id
}
}
}

FluText {
id: item_department
text: "部门"
Expand All @@ -380,16 +362,12 @@ FluScrollablePage {
left: item_department.right
leftMargin: 60
}
FluTreeView {
id: tree_view_department
width: 200
height: 200
selectionMode: FluTreeViewType.Multiple
Connections {
target: page
function onListReady() {
tree_view_department.updateData(departmentArr)
}
ListView {
anchors.fill: parent
model: DepartmentModel

delegate: FluText {
text: title
}
}
}
Expand All @@ -405,6 +383,7 @@ FluScrollablePage {
topMargin: 40
}
}

FluComboBox {
id: combo_box_type
width: 200
Expand All @@ -427,6 +406,7 @@ FluScrollablePage {
topMargin: 15
}
}

FluMultilineTextBox {
id: textbox_description
width: 600
Expand All @@ -439,8 +419,6 @@ FluScrollablePage {
}

// deprecated


/*
Item {
visible: false
Expand Down Expand Up @@ -579,29 +557,7 @@ FluScrollablePage {
}
}

T_Calendar {
id: control
}

function returnPage() {
control.reload()
MainWindow.window.pushPage("qrc:/qml/page/T_Calendar.qml")
}

Connections {
target: EventoEditController
function onCreateSuccessEvent() {
statusMode = FluStatusViewType.Success
showSuccess("操作成功")
returnPage()
}
}

Connections {
target: EventoEditController
function onCreateErrorEvent(message) {
statusMode = FluStatusViewType.Success
showError(message, 4000)
}
}
}
Loading

0 comments on commit 91b477c

Please sign in to comment.