139 lines
3.9 KiB
QML
139 lines
3.9 KiB
QML
|
|
import QtQuick
|
|||
|
|
import QtQuick.Controls
|
|||
|
|
import "./common"
|
|||
|
|
|
|||
|
|
|
|||
|
|
Item{
|
|||
|
|
property var groupInfos: []
|
|||
|
|
property var groupModel: ListModel{}
|
|||
|
|
property var interfaceModel: ListModel{}
|
|||
|
|
|
|||
|
|
Component.onCompleted: {
|
|||
|
|
refreshTasks()
|
|||
|
|
}
|
|||
|
|
onVisibleChanged: if (visible) refreshTasks()
|
|||
|
|
function refreshTasks()
|
|||
|
|
{
|
|||
|
|
groupInfos = getGroupInfo()
|
|||
|
|
groupModel.clear()
|
|||
|
|
for (var i = 0; i < groupInfos.length; i++)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
groupModel.append({
|
|||
|
|
"id": groupInfos[i].id,
|
|||
|
|
"name": groupInfos[i].name
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
initJsonModel(funcModel, "funcModel.json")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getGroupInfo()
|
|||
|
|
{
|
|||
|
|
return taskGroupManager.getInfo("all")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getTaskInfo(group_id)
|
|||
|
|
{
|
|||
|
|
return taskManager.getGroupTask(group_id)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Item{
|
|||
|
|
anchors.fill: parent
|
|||
|
|
clip: true
|
|||
|
|
ListView{
|
|||
|
|
id: funLstView
|
|||
|
|
model: funcModel
|
|||
|
|
header: table_func_header
|
|||
|
|
boundsBehavior: Flickable.StopAtBounds
|
|||
|
|
anchors.fill: parent
|
|||
|
|
delegate: table_func_delegate
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Component {
|
|||
|
|
id: table_func_header
|
|||
|
|
Rectangle {
|
|||
|
|
width: funLstView.width
|
|||
|
|
height: 40
|
|||
|
|
color: "#F7F7F7"
|
|||
|
|
z:2
|
|||
|
|
Row {
|
|||
|
|
width: parent.width
|
|||
|
|
height: parent.height
|
|||
|
|
property var childcount: 3
|
|||
|
|
QxHLabel {
|
|||
|
|
text: "功能"
|
|||
|
|
width: parent.width/3
|
|||
|
|
}
|
|||
|
|
QxHLabel {
|
|||
|
|
text: "分组"
|
|||
|
|
width: parent.width/3
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
QxHLabel {
|
|||
|
|
text: "任务"
|
|||
|
|
width: parent.width/3
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Component {
|
|||
|
|
id: table_func_delegate
|
|||
|
|
Rectangle {
|
|||
|
|
width: funLstView.width
|
|||
|
|
height: 58
|
|||
|
|
color: index % 2 == 0 ? "#F8FAFF" : "#FFFFFF"
|
|||
|
|
z:2
|
|||
|
|
Row {
|
|||
|
|
width: parent.width
|
|||
|
|
height: parent.height
|
|||
|
|
property var childcount: 3
|
|||
|
|
|
|||
|
|
QxLabel {
|
|||
|
|
text: name
|
|||
|
|
width: parent.width/3
|
|||
|
|
}
|
|||
|
|
SetComboBox {
|
|||
|
|
id: cbGroup
|
|||
|
|
text: groupName
|
|||
|
|
cbmodel: groupModel
|
|||
|
|
width: parent.width/3
|
|||
|
|
onCurrentIndexChanged: {
|
|||
|
|
if(currentIndex != -1)
|
|||
|
|
{
|
|||
|
|
var group_name = groupModel.get(currentIndex).name
|
|||
|
|
var group_id = groupModel.get(currentIndex).id
|
|||
|
|
groupName = group_name
|
|||
|
|
groupId = group_id
|
|||
|
|
cbTask.cbmodel.clear()
|
|||
|
|
var taskInfo = getTaskInfo(group_id)
|
|||
|
|
for(var i = 0; i < taskInfo.length; i++)
|
|||
|
|
{
|
|||
|
|
cbTask.cbmodel.append(taskInfo[i])
|
|||
|
|
}
|
|||
|
|
cbTask.selectItem(taskName)
|
|||
|
|
updateJsonFile(funcModel, "funcModel.json")
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SetComboBox {
|
|||
|
|
id: cbTask
|
|||
|
|
text: taskName
|
|||
|
|
width: parent.width/3
|
|||
|
|
onCurrentIndexChanged: {
|
|||
|
|
if(currentIndex != -1)
|
|||
|
|
{
|
|||
|
|
taskName = text
|
|||
|
|
taskId = cbTask.cbmodel.get(currentIndex).id.toString()
|
|||
|
|
updateJsonFile(funcModel, "funcModel.json")
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|