修改了FileList的数据来源规则
parent
a9fd98043b
commit
7be44d40b1
|
@ -5,10 +5,16 @@ import "qrc:///AicsKnowledgeBase/qml/global"
|
|||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
signal search(string tag)
|
||||
signal open(string file)
|
||||
property bool disableHeader: false
|
||||
property bool autoRequest: false
|
||||
property string url: "http://127.0.0.1:4523/m1/2914957-0-5604d062/"
|
||||
property ListModel dataModel: ListModel {}
|
||||
function setListData(listmodel) {
|
||||
listView.model = listmodel
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
|
@ -17,7 +23,11 @@ Item {
|
|||
model: fileListModel
|
||||
delegate: fileListItemDelegate
|
||||
Component.onCompleted: {
|
||||
if (autoRequest) {
|
||||
update()
|
||||
} else {
|
||||
listView.model = dataModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +124,7 @@ Item {
|
|||
}
|
||||
fileListModel.append(modelItem)
|
||||
}
|
||||
console.log(fileListModel)
|
||||
listView.currentIndex = -1
|
||||
})
|
||||
}
|
||||
|
@ -140,7 +151,8 @@ Item {
|
|||
size: isDir ? 0 : model.size
|
||||
stars: isDir ? 0 : model.stars
|
||||
// split string to array
|
||||
tags: isDir ? [] : model.tags.split(",")
|
||||
tags: isDir ? [] : model.tags.length === 0 ? [] : model.tags.split(
|
||||
",")
|
||||
onTagClicked: {
|
||||
emit: search(tag)
|
||||
console.log(tag)
|
||||
|
@ -165,7 +177,7 @@ Item {
|
|||
type: "FOLDER"
|
||||
}
|
||||
ListElement {
|
||||
uid: "2"
|
||||
uuid: "2"
|
||||
title: "File 2"
|
||||
isDir: false
|
||||
brief: "This is a test file"
|
||||
|
@ -176,7 +188,7 @@ Item {
|
|||
stars: 10
|
||||
}
|
||||
ListElement {
|
||||
uid: "3"
|
||||
uuid: "3"
|
||||
title: "File 3"
|
||||
isDir: false
|
||||
brief: "This is a test file"
|
||||
|
|
|
@ -37,5 +37,7 @@ FluArea {
|
|||
}
|
||||
}
|
||||
|
||||
FileList {}
|
||||
FileList {
|
||||
autoRequest: true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ FluArea {
|
|||
// Layout.topMargin: 20
|
||||
// text: "Search"
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
按标题,内容搜索
|
||||
*/
|
||||
|
@ -54,7 +56,6 @@ FluArea {
|
|||
FluTextBox {
|
||||
//placeholderText:""
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
FluIconButton {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
@ -62,7 +63,6 @@ FluArea {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//按文件类型
|
||||
RowLayout {
|
||||
id: selectFormat
|
||||
|
@ -107,7 +107,8 @@ FluArea {
|
|||
}
|
||||
|
||||
function setAllStatus() {
|
||||
selectAllFormat.checked = selectVideo.checked && selectDoc.checked && selectAudio.checked
|
||||
selectAllFormat.checked = selectVideo.checked
|
||||
&& selectDoc.checked && selectAudio.checked
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,14 +121,11 @@ FluArea {
|
|||
text: "标签: "
|
||||
}
|
||||
|
||||
|
||||
Tag {
|
||||
width: 290
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
FluArea {
|
||||
backgroundColor: "#f9f9f9"
|
||||
border.width: 0
|
||||
|
@ -136,6 +134,37 @@ FluArea {
|
|||
|
||||
FileList {
|
||||
disableHeader: true
|
||||
dataModel: ListModel {
|
||||
ListElement {
|
||||
uuid: "0"
|
||||
title: "File 1"
|
||||
isDir: true
|
||||
brief: "This is a test file"
|
||||
type: "FOLDER"
|
||||
}
|
||||
ListElement {
|
||||
uuid: "2"
|
||||
title: "File 2"
|
||||
isDir: false
|
||||
brief: "This is a test file"
|
||||
size: 500
|
||||
type: "WORD"
|
||||
date: "2020-09-09"
|
||||
pageView: 100
|
||||
stars: 10
|
||||
}
|
||||
ListElement {
|
||||
uuid: "3"
|
||||
title: "File 3"
|
||||
isDir: false
|
||||
brief: "This is a test file"
|
||||
type: "PPT"
|
||||
date: "2020-09-09"
|
||||
pageView: 100
|
||||
size: 10200000022
|
||||
stars: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue