From d798786b514252d27dcc1e1807df7db35add4caa Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 10 Dec 2019 15:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=95=86=E5=93=81=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95=E4=B8=AD=E7=88=B6?= =?UTF-8?q?=E7=BA=A7=E4=B8=8B=E6=8B=89=E6=A1=86=E5=8F=96=E6=B6=88=E6=9C=AC?= =?UTF-8?q?=E8=BA=AB=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/modules/goods/models/ars/Category.php | 4 ++-- backend/modules/goods/views/category/_form.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/modules/goods/models/ars/Category.php b/backend/modules/goods/models/ars/Category.php index 827ec36..7831e78 100755 --- a/backend/modules/goods/models/ars/Category.php +++ b/backend/modules/goods/models/ars/Category.php @@ -102,9 +102,9 @@ class Category extends \yii\db\ActiveRecord * @return array * 数据键值对 */ - public static function modelColumn() + public static function modelColumn($model) { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->andWhere(['!=', 'id', $model->id])->indexBy('id')->column(); } public function getIconFile() diff --git a/backend/modules/goods/views/category/_form.php b/backend/modules/goods/views/category/_form.php index 87b09b9..e6b4713 100755 --- a/backend/modules/goods/views/category/_form.php +++ b/backend/modules/goods/views/category/_form.php @@ -17,7 +17,7 @@ use backend\modules\goods\models\ars\Category; field($model, 'name')->textInput(['maxlength' => true]) ?> - field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], Category::modelColumn())) ?> + field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], Category::modelColumn($model))) ?> field($model, 'sort_order')->textInput() ?>