From 0ee56aad241f412af2b29a4a5378b3181b97d41a Mon Sep 17 00:00:00 2001 From: wjsjwr Date: Tue, 7 Jan 2025 17:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E4=BB=93=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 19 ++++++++++++++----- bookkeeper/Cargo.lock | 2 +- bookkeeper/Cargo.toml | 2 +- bookkeeper/src/main.rs | 8 ++++++-- bookkeeper/templates/index.html.j2 | 29 ++++++++++++++++++----------- bookkeeper/templates/nav.html.j2 | 2 +- 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 49d3c1e..ec37514 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,12 +10,12 @@ - - + + @@ -273,7 +281,8 @@ - diff --git a/bookkeeper/Cargo.lock b/bookkeeper/Cargo.lock index 59bc5ca..645c0ed 100644 --- a/bookkeeper/Cargo.lock +++ b/bookkeeper/Cargo.lock @@ -423,7 +423,7 @@ dependencies = [ [[package]] name = "bookkeeper" -version = "0.1.1" +version = "0.1.2" dependencies = [ "chrono", "entity", diff --git a/bookkeeper/Cargo.toml b/bookkeeper/Cargo.toml index 1f8d579..560a99d 100644 --- a/bookkeeper/Cargo.toml +++ b/bookkeeper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bookkeeper" -version = "0.1.1" +version = "0.1.2" edition = "2021" [dependencies] diff --git a/bookkeeper/src/main.rs b/bookkeeper/src/main.rs index 08ec2d7..dc6c723 100644 --- a/bookkeeper/src/main.rs +++ b/bookkeeper/src/main.rs @@ -57,8 +57,8 @@ impl sea_orm_rocket::Pool for SeaOrmPool { } } -#[get("/?&")] -async fn index(conn: Connection<'_, Db>, last: Option, name: Option<&str>) -> Template { +#[get("/?&&")] +async fn index(conn: Connection<'_, Db>, last: Option, name: Option<&str>, is_done: Option) -> Template { let mut partial = TE::find(); if let Some(last) = last { @@ -69,6 +69,10 @@ async fn index(conn: Connection<'_, Db>, last: Option, name: Option<&str>) partial = partial.filter(transaction::Column::Name.eq(name)); } + if let Some(done) = is_done { + partial = partial.filter(transaction::Column::IsDone.eq(done)); + } + let rows: Vec = partial .order_by_desc(transaction::Column::Date) .order_by_desc(transaction::Column::Id) diff --git a/bookkeeper/templates/index.html.j2 b/bookkeeper/templates/index.html.j2 index 0c627ef..ec63b97 100644 --- a/bookkeeper/templates/index.html.j2 +++ b/bookkeeper/templates/index.html.j2 @@ -28,11 +28,11 @@ {% if loop.index == 1 %} {{ r.code|string|padLeft(6) }} {{ r.name }} - {{ r.date }} + {{ r.date }} {{ r.buy|float|round(4) }} {{ r.volume }} {{ r.net_buy|float|round(2) }} - {{ p.date or "" }} + {{ p.date or "" }} {{ (p.sell or 0)|float|round(4) }} {{ p.volume or "" }} {{ (p.net_sell or 0)|float|round(2) }} @@ -65,24 +65,31 @@ {{ r.code|string|padLeft(6) }} {{ r.name }} - {{ r.date }} + {{ r.date }} {{ r.buy|float|round(4) }} {{ r.volume }} {{ r.net_buy|float|round(2) }} - - - - - - - - + + + + + - + -   {% endif %} {% endfor %} - 添加     高级筛选 + + 添加 +       + 高级筛选 +       + 未清仓 +       + 已清仓 + diff --git a/bookkeeper/templates/nav.html.j2 b/bookkeeper/templates/nav.html.j2 index 3fa66d6..0f88e9b 100644 --- a/bookkeeper/templates/nav.html.j2 +++ b/bookkeeper/templates/nav.html.j2 @@ -3,7 +3,7 @@