From 550990c994f41f31e47ee3470493b3565c46ccbe Mon Sep 17 00:00:00 2001 From: augushong Date: Tue, 11 Apr 2023 16:51:55 +0800 Subject: [PATCH] =?UTF-8?q?select=E6=94=AF=E6=8C=81=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E4=BC=A0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/mall/Goods.php | 7 ++++--- public/static/admin/js/mall/goods.js | 3 +-- public/static/plugs/easy-admin/easy-admin.js | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/admin/controller/mall/Goods.php b/app/admin/controller/mall/Goods.php index 4bc6698..14fca33 100644 --- a/app/admin/controller/mall/Goods.php +++ b/app/admin/controller/mall/Goods.php @@ -1,10 +1,10 @@ model = new MallGoods(); + + $this->assign('select_list_cate', MallCate::select(), true); } /** diff --git a/public/static/admin/js/mall/goods.js b/public/static/admin/js/mall/goods.js index 5bf5deb..ffb1c3a 100644 --- a/public/static/admin/js/mall/goods.js +++ b/public/static/admin/js/mall/goods.js @@ -24,8 +24,7 @@ define(["jquery", "easy-admin"], function ($, ea) { { type: "checkbox" }, { field: 'id', width: 80, title: 'ID', totalRowText: '合计:' }, { field: 'sort', width: 80, title: '排序', edit: 'text' }, - { field: 'cate.title', minWidth: 80, title: '商品分类', }, - { field: 'cate.id', minWidth: 80, title: '商品分类', hide: true, defaultSearchValue: ea.getQueryVariable('cate_id', '') }, + { field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ea.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ea.getQueryVariable('cate_id', '') }, { field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image }, { field: 'title', minWidth: 80, title: '商品名称', }, { field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ea.table.image }, diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js index 473bef5..8deaf6c 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/easy-admin/easy-admin.js @@ -892,8 +892,23 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick } // 如果未定义则默认使用value - if (val.templet === undefined) { + if (cols[i][index]['templet'] === undefined) { cols[i][index]['templet'] = admin.table.value; + } else { + // 针对特定的模板做数据调整 + + if (cols[i][index]['templet'] == admin.table.list) { + if (val.selectValue) { + + var newSelectList = {}; + val.selectList.map(item => { + newSelectList[item[val.selectValue]] = item[val.selectLabel]; + }); + + cols[i][index]['selectList'] = newSelectList; + + } + } } if (val.fieldFormat == undefined) {