import QtQuick import QtQuick.Controls import "./common" Item{ property var deviceInfos: [] property var devModel: ListModel{} property var interfaceModel: ListModel{} Component.onCompleted: { refreshDevices() } onVisibleChanged: if (visible) refreshDevices() function refreshDevices() { deviceInfos = getDeviceInfo() devModel.clear() for (var i = 0; i < deviceInfos.length; i++) { console.info(typeof(deviceInfos[i].interface)) devModel.append({ "id": deviceInfos[i].id, "name": deviceInfos[i].name, "dev_model_id": deviceInfos[i].dev_model_id, "interface": deviceInfos[i].interface, }) } initJsonModel(funcModel, "funcModel.json") } function getDeviceInfo() { return deviceManager.getInfo("all") } function getInterFaceName(id) { var interFaceInfos = interfaceManager.getInfo(id) if(interFaceInfos.length > 0) return interFaceInfos[0].name return "" } function getInstructionInfo(dev_model_id) { return instructionManager.getDevmodelInstructions(dev_model_id) } Item{ anchors.fill: parent clip: true ListView{ id: funLstView model: funcTaskModel 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_id = groupModel.get(currentIndex).dev_model_id deviceName = text deviceId = devModel.get(currentIndex).id.toString() var interfaces = JSON.parse(devModel.get(currentIndex).interface) cbInterface.cbmodel.clear() for(var i =0; i