1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use json::{JsonValue};
use crate::{Action, Model, Response};
use crate::dict::flow::Flow;

pub struct Select {
    pub model: Flow,
}

impl Action for Select {
    fn title(&mut self) -> &'static str { "数据列表" }
    fn name(&mut self) -> &'static str { "dict.flow.select" }
    fn token(&mut self) -> bool { true }
    fn params(&mut self) -> JsonValue {
        return self.model.table_select_fields();
    }

    fn index(&mut self, _header: JsonValue, request: JsonValue) -> Response {
        let list = self.model.table_select(  request.clone(),vec!["name", "code"], vec![
            vec!["state", "=", "启用"]
        ]);
        return self.success(list, "ok");
    }
}