From 373aedfc0b91f7fccfafd460b2b9e303a6334919 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 25 Feb 2019 14:09:57 +0800 Subject: [PATCH] * finish task #5297. --- module/block/model.php | 2 +- module/product/control.php | 7 +------ module/tree/model.php | 10 ++++++++-- www/theme/default/style.css | 8 ++++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/module/block/model.php b/module/block/model.php index c01fc354a2..6866c8b298 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -662,7 +662,7 @@ class blockModel extends model $products = $this->loadModel('product')->getList($status); if(empty($products)) return $products; - $lines = $this->loadModel('tree')->getLinePairs(); + $lines = $this->loadModel('tree')->getLinePairs($useShort = true); $productList = array(); foreach($lines as $id => $name) { diff --git a/module/product/control.php b/module/product/control.php index b668c69b28..477099f1f1 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -588,14 +588,9 @@ class product extends control $this->view->extra = $extra; $products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($this->products))->orderBy('`order` desc')->fetchAll('id'); - $productPairs = array(); - foreach($products as $product) $productPairs[$product->id] = $product->name; - $productsPinyin = common::convert2Pinyin($productPairs); - - foreach($products as $key => $product) $product->key = $productsPinyin[$product->name]; /* Sort products as lines' order first. */ - $lines = $this->loadModel('tree')->getLinePairs(); + $lines = $this->loadModel('tree')->getLinePairs($useShort = true); $productList = array(); foreach($lines as $id => $name) { diff --git a/module/tree/model.php b/module/tree/model.php index ce3cabb835..04fdc20304 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -173,12 +173,18 @@ class treeModel extends model /** * Get line pairs. * + * @param bool $useShort * @access public * @return array */ - public function getLinePairs() + public function getLinePairs($useShort = false) { - return $this->dao->select('id, name')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->fetchPairs(); + $lines = $this->dao->select('id,name,short')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->fetchAll('id'); + + $linePairs = array(); + foreach($lines as $lineID => $line) $linePairs[$lineID] = ($useShort and !empty($line->short)) ? $line->short : $line->name; + + return $linePairs; } /** diff --git a/www/theme/default/style.css b/www/theme/default/style.css index 39d8931ad3..4cde902cc7 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -15,3 +15,11 @@ /* Finish task #5068*/ .main-table .table{cursor:pointer;} + +#dropMenu.show-right-col{width:502px;max-width:520px;} +#dropMenu>.search-box{max-width:240px;} +#dropMenu .list-group{width:250px; max-width:260px;} +#dropMenu.show-right-col>.list-group{width:502px;max-width:520px;} +#dropMenu.show-right-col .col-left>.list-group{width:250px;max-width:260px;} +#dropMenu.show-right-col .col-right>.list-group{width:250px;max-width:260px;} +#dropMenu .col-footer{width:230px;}