From b834e5b8ce158730fbff6fbf2880e464f9290747 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Wed, 15 Nov 2023 11:28:17 +0800 Subject: [PATCH] * Fix chart filter select item not display in screen. --- module/screen/model.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/module/screen/model.php b/module/screen/model.php index ac1457a35a..57231f5a6d 100644 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -814,18 +814,14 @@ class screenModel extends model if($table) $options = $this->dao->select("id, {$field}")->from($table)->fetchPairs(); } break; - case 'string': - if($field) + default: + if($field && $sql) { - if($sql) - { - $cols = $this->dbh->query($sql)->fetchAll(); - foreach($cols as $col) - { - $data = $col->$field; - $options[$data] = $data; - } - } + $options = $this->dao->select("tt.`$field`,tt.`$field`") + ->from("($sql)")->alias('tt') + ->groupBy("tt.`$field`") + ->orderBy("tt.`$field` desc") + ->fetchPairs(); } break; }