diff --git a/application/admin/controller/Goodscategory.php b/application/admin/controller/Goodscategory.php index adcfb7e9f..83fdf6aa4 100755 --- a/application/admin/controller/Goodscategory.php +++ b/application/admin/controller/Goodscategory.php @@ -55,6 +55,9 @@ class GoodsCategory extends Common // 是否 $this->assign('common_is_text_list', lang('common_is_text_list')); + // 商品分类 + $this->assign('goods_category_list', GoodsService::GoodsCategory()); + // 编辑器文件存放地址 $this->assign('editor_path_type', 'goods_category'); diff --git a/application/admin/view/default/goodscategory/index.html b/application/admin/view/default/goodscategory/index.html index cbb38ff2e..9e6508a7b 100755 --- a/application/admin/view/default/goodscategory/index.html +++ b/application/admin/view/default/goodscategory/index.html @@ -19,6 +19,28 @@
+
+ + +
+
    @@ -77,7 +99,6 @@ {{include file="lib/enable" /}}
    -
    diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index a2123bbaf..0f9e478ac 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -2047,6 +2047,12 @@ class GoodsService 'big_images' => $attachment['data']['big_images'], ]; + // 父级id宇当前id不能相同 + if(!empty($params['id']) && $params['id'] == $data['pid']) + { + return DataReturn('父级不能与当前相同', -10); + } + // 添加 if(empty($params['id'])) { diff --git a/public/static/common/js/common.js b/public/static/common/js/common.js index 138a61354..1d38c0ef8 100755 --- a/public/static/common/js/common.js +++ b/public/static/common/js/common.js @@ -470,6 +470,16 @@ function FormDataFill(json, tag) }); } + // 是否存在pid和当前id相同 + if($form.find('select[name="pid"]').length > 0) + { + $form.find('select[name="pid"]').find('option').removeAttr('disabled'); + if((json['id'] || null) != null) + { + $form.find('select[name="pid"]').find('option[value="'+json['id']+'"]').attr('disabled', true); + } + } + // 多选插件事件更新 if($('.chosen-select').length > 0) { @@ -1378,7 +1388,13 @@ $(function() // 父节点赋值 var id = parseInt($(this).data('id')) || 0; - $('#data-save-win').find('input[name="pid"]').val(id); + $('#data-save-win').find('input[name="pid"], select[name="pid"]').val(id); + + // 多选插件事件更新 + if($('.chosen-select').length > 0) + { + $('.chosen-select').trigger('chosen:updated'); + } }); /** @@ -1461,6 +1477,12 @@ $(function() { $(this).blur(); }); + + // 多选插件事件更新 + if($('.chosen-select').length > 0) + { + $('.chosen-select').trigger('chosen:updated'); + } } /**