From 1f53d988964fa77664c6808d90fc34d6bdec1b4f Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Fri, 23 Aug 2024 08:13:54 +0000 Subject: [PATCH] * [story#60464,1h] add check all. --- lib/pivotstate/pivotstate.class.php | 18 ++++++++++++++++++ lib/zin/wg/fieldselectpanel/v1.php | 26 ++++++++++++++------------ module/bi/lang/de.php | 2 ++ module/bi/lang/en.php | 2 ++ module/bi/lang/fr.php | 2 ++ module/bi/lang/zh-cn.php | 2 ++ 6 files changed, 40 insertions(+), 12 deletions(-) diff --git a/lib/pivotstate/pivotstate.class.php b/lib/pivotstate/pivotstate.class.php index 9f98e1732f..3a5754b22b 100644 --- a/lib/pivotstate/pivotstate.class.php +++ b/lib/pivotstate/pivotstate.class.php @@ -647,6 +647,24 @@ class pivotState return $funcs; } + /** + * Process check all. + * + * @access public + * @return void + */ + public function processCheckAll() + { + $from = $this->sqlBuilder['from']; + $joins = $this->sqlBuilder['joins']; + if($from['select'] == '*') $this->sqlBuilder['from']['select'] = array_keys($this->getTableDescList($from['alias'])); + + foreach($joins as $index => $join) + { + if($join['select'] == '*') $this->sqlBuilder['joins'][$index]['select'] = array_keys($this->getTableDescList($join['alias'])); + } + } + /** * Generate func alias. * diff --git a/lib/zin/wg/fieldselectpanel/v1.php b/lib/zin/wg/fieldselectpanel/v1.php index b40cac7db1..0c9192690e 100644 --- a/lib/zin/wg/fieldselectpanel/v1.php +++ b/lib/zin/wg/fieldselectpanel/v1.php @@ -33,10 +33,12 @@ class fieldSelectPanel extends wg protected function build() { - list($table, $alias, $col) = $this->prop(array('table', 'alias', 'col')); + global $lang; + list($table, $alias, $fields, $values, $col) = $this->prop(array('table', 'alias', 'fields', 'values', 'col')); - $panelClass = $col == 1 ? "w-full" : 'w-1/' . min($col, 6) . '-gap-4'; - $checkClass = 'checkbox-col-' . max(floor(6 / $col), 1); + $isCheckedAll = count($fields) == count($values); + $panelClass = $col == 1 ? "w-full" : 'w-1/' . min($col, 6) . '-gap-4'; + $checkClass = 'checkbox-col-' . max(floor(6 / $col), 1); return panel ( @@ -45,21 +47,21 @@ class fieldSelectPanel extends wg set::title("$table({$alias})"), set::headingClass('bg-gray-100 relative'), set::bodyClass('h-70 overflow-y-auto'), - /*to::heading + to::heading ( div ( - setClass('absolute right-4'), - checkbox + setClass('absolute right-4 flex gap-x-2'), + btn ( - setClass('select-field-checkbox'), - set::name("{$alias}all"), - set::text($lang->bi->allFields), - set::value('*'), - set('data-alias', $alias) + setClass('p-0 check-all'), + set('data-alias', $alias), + set('data-checked', $isCheckedAll), + set::type('ghost'), + $isCheckedAll ? $lang->bi->cancelAll : $lang->bi->checkAll ) ) - ),*/ + ), checkList ( setClass("flex justify-start gap-x-0 checkbox-col $checkClass"), diff --git a/module/bi/lang/de.php b/module/bi/lang/de.php index dcd814c51c..22466d85a7 100644 --- a/module/bi/lang/de.php +++ b/module/bi/lang/de.php @@ -38,6 +38,8 @@ $lang->bi->addFunc = 'Add function'; $lang->bi->emptyFuncs = 'Empty function。'; $lang->bi->addWhere = 'Add group'; $lang->bi->emptyWheres = 'Empty where。'; +$lang->bi->checkAll = 'Check All'; +$lang->bi->cancelAll = 'Cancel All'; $lang->bi->whereGroupTitle = 'The %s group'; $lang->bi->addWhereGroup = 'Add group'; diff --git a/module/bi/lang/en.php b/module/bi/lang/en.php index dcd814c51c..22466d85a7 100644 --- a/module/bi/lang/en.php +++ b/module/bi/lang/en.php @@ -38,6 +38,8 @@ $lang->bi->addFunc = 'Add function'; $lang->bi->emptyFuncs = 'Empty function。'; $lang->bi->addWhere = 'Add group'; $lang->bi->emptyWheres = 'Empty where。'; +$lang->bi->checkAll = 'Check All'; +$lang->bi->cancelAll = 'Cancel All'; $lang->bi->whereGroupTitle = 'The %s group'; $lang->bi->addWhereGroup = 'Add group'; diff --git a/module/bi/lang/fr.php b/module/bi/lang/fr.php index dcd814c51c..22466d85a7 100644 --- a/module/bi/lang/fr.php +++ b/module/bi/lang/fr.php @@ -38,6 +38,8 @@ $lang->bi->addFunc = 'Add function'; $lang->bi->emptyFuncs = 'Empty function。'; $lang->bi->addWhere = 'Add group'; $lang->bi->emptyWheres = 'Empty where。'; +$lang->bi->checkAll = 'Check All'; +$lang->bi->cancelAll = 'Cancel All'; $lang->bi->whereGroupTitle = 'The %s group'; $lang->bi->addWhereGroup = 'Add group'; diff --git a/module/bi/lang/zh-cn.php b/module/bi/lang/zh-cn.php index 9d7ba918e7..5ef6de7513 100644 --- a/module/bi/lang/zh-cn.php +++ b/module/bi/lang/zh-cn.php @@ -42,6 +42,8 @@ $lang->bi->addFunc = '新增函数字段'; $lang->bi->emptyFuncs = '暂未新增函数字段。'; $lang->bi->addWhere = '添加组'; $lang->bi->emptyWheres = '暂未添加确定性查询条件。'; +$lang->bi->checkAll = '全选'; +$lang->bi->cancelAll = '取消全选'; $lang->bi->whereGroupTitle = '第%s组确定性查询条件'; $lang->bi->addWhereGroup = '添加组';