店铺类型页面js调整
This commit is contained in:
parent
9c65f61271
commit
1a5ad63673
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace app\admin\controller\merchant\system\merchant;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use app\admin\controller\merchant\system\auth\Menu;
|
||||
use app\common\model\merchant\system\merchant\MerchantType as MerchantTypeModel;
|
||||
use app\common\model\merchant\system\auth\Menu as MenuModel;
|
||||
use app\common\controller\FormatList;
|
||||
@ -81,8 +82,12 @@ class MerchantType extends BaseController
|
||||
|
||||
// 给菜单权限附加选中状态
|
||||
foreach($data['list'] as $k=>$item) {
|
||||
if (in_array($item['id'], $checked_list['list'][0]['auth_ids'])) {
|
||||
$data['list'][$k]['checked'] = true;
|
||||
foreach ($checked_list['list'] as $auth) {
|
||||
if (in_array($item['id'], $auth['auth_ids'])) {
|
||||
if ($item['pid']>0 && $item['title']!='权限')
|
||||
$data['list'][$k]['checked'] = true;
|
||||
$data['list'][$k]['spread'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,9 +151,30 @@ class MerchantType extends BaseController
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? (int)$param['id'] : 0;
|
||||
|
||||
$detail = $this->merchant->Find($id);
|
||||
$detail = $this->merchant->getDetail($id);
|
||||
|
||||
if (!empty($detail)) {
|
||||
// 查出商户所有菜单数据权限 tree
|
||||
$menu = app()->make(MenuModel::class);
|
||||
$data = $menu->getList([],1);
|
||||
|
||||
// 获取已有权限
|
||||
$checked_list = $this->merchant->getList(['mer_type_id'=>$id]);
|
||||
|
||||
// 给菜单权限附加选中状态
|
||||
$list = [];
|
||||
foreach($data['list'] as $k=>$item) {
|
||||
foreach ($checked_list['list'] as $auth) {
|
||||
if (in_array($item['id'], $auth['auth_ids'])) {
|
||||
if ($item['pid']>0 && $item['title']!='权限')
|
||||
$data['list'][$k]['checked'] = true;
|
||||
$data['list'][$k]['spread'] = true;
|
||||
array_push($list, $data['list'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$format = app()->make(FormatList::class);
|
||||
View::assign('dataTree', $format->FormatCategory($list));
|
||||
View::assign('detail', $detail);
|
||||
return view($this->path['read']);
|
||||
} else {
|
||||
|
@ -1,82 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\facade\Route;
|
||||
use app\common\middleware\AdminAuthMiddleware;
|
||||
use app\common\middleware\AdminTokenMiddleware;
|
||||
use app\common\middleware\AllowOriginMiddleware;
|
||||
use app\common\middleware\LogMiddleware;
|
||||
|
||||
Route::group(function () {
|
||||
|
||||
//权限管理
|
||||
// Route::group('system/menu', function () {
|
||||
// Route::get('lst', '/getList')->name('systemMenuGetLst')->option([
|
||||
// '_alias' => '平台菜单/权限列表',
|
||||
// ]);
|
||||
// Route::get('create/form', '/createForm')->name('systemMenuCreateForm')->option([
|
||||
// '_alias' => '平台菜单/权限添加表单',
|
||||
// '_auth' => false,
|
||||
// '_form' => 'systemMenuCreate',
|
||||
// ]);
|
||||
// Route::get('update/form/:id', '/updateForm')->name('systemMenuUpdateForm')->option([
|
||||
// '_alias' => '平台菜单/权限编辑表单',
|
||||
// '_auth' => false,
|
||||
// '_form' => 'systemMenuUpdate',
|
||||
// ]);
|
||||
// Route::post('create', '/create')->name('systemMenuCreate')->option([
|
||||
// '_alias' => '平台菜单/权限添加',
|
||||
// ]);
|
||||
// Route::post('update/:id', '/update')->name('systemMenuUpdate')->option([
|
||||
// '_alias' => '平台菜单/权限编辑',
|
||||
// ]);
|
||||
// Route::delete('delete/:id', '/delete')->name('systemMenuDelete')->option([
|
||||
// '_alias' => '平台菜单/权限删除',
|
||||
// ]);
|
||||
// })->prefix('admin.system.auth.Menu')->option([
|
||||
// '_path' => '/setting/menu',
|
||||
// '_auth' => true,
|
||||
// ]);
|
||||
|
||||
//商户权限管理
|
||||
Route::group('merchant/menu', function () {
|
||||
Route::get('lst', '/getList')->name('systemMerchantMenuGetLst')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限列表',
|
||||
]);
|
||||
Route::get('create/form', '/createForm')->name('systemMerchantMenuCreateForm')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限添加表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantMenuCreate',
|
||||
]);
|
||||
Route::get('update/form/:id', '/updateForm')->name('systemMerchantMenuUpdateForm')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限编辑表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantMenuUpdate',
|
||||
]);
|
||||
Route::post('create', '/create')->name('systemMerchantMenuCreate')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限添加',
|
||||
]);
|
||||
Route::post('update/:id', '/update')->name('systemMerchantMenuUpdate')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限编辑',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([
|
||||
'_alias' => '商户菜单/权限删除',
|
||||
]);
|
||||
})->prefix('admin.system.auth.Menu')->option([
|
||||
'_path' => '/merchant/system',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
});
|
||||
// ->middleware(AllowOriginMiddleware::class)
|
||||
// ->middleware(AdminTokenMiddleware::class, true)
|
||||
// ->middleware(AdminAuthMiddleware::class)
|
||||
// ->middleware(LogMiddleware::class);
|
@ -1,246 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\facade\Route;
|
||||
|
||||
Route::group(function () {
|
||||
|
||||
//商户分类
|
||||
Route::group('system/merchant', function () {
|
||||
Route::get('category/lst', '/lst')->name('systemMerchantCategoryLst')->option([
|
||||
'_alias' => '商户分类列表',
|
||||
]);
|
||||
Route::get('category_lst', '/lst')->option([
|
||||
'_alias' => '商户分类列表',
|
||||
'_auth' => false,
|
||||
]);
|
||||
Route::post('category', '/create')->name('systemMerchantCategoryCreate')->option([
|
||||
'_alias' => '商户分类添加',
|
||||
]);
|
||||
Route::get('category/form', '/createForm')->name('systemMerchantCategoryCreateForm')->option([
|
||||
'_alias' => '商户分类添加表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantCategoryCreate',
|
||||
]);
|
||||
Route::delete('category/:id', '/delete')->name('systemMerchantCategoryDelete')->option([
|
||||
'_alias' => '商户分类删除',
|
||||
]);
|
||||
Route::post('category/:id', '/update')->name('systemMerchantCategoryUpdate')->option([
|
||||
'_alias' => '商户分类编辑',
|
||||
]);
|
||||
Route::get('category/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm')->option([
|
||||
'_alias' => '商户分类编辑表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantCategoryUpdate',
|
||||
]);
|
||||
Route::get('category/options', '/getOptions')->option([
|
||||
'_alias' => '商户分类筛选',
|
||||
'_auth' => false,
|
||||
]);
|
||||
})->prefix('admin.system.merchant.MerchantCategory')->option([
|
||||
'_path' => '/merchant/classify',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
//申请列表
|
||||
Route::group('merchant/intention', function () {
|
||||
Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([
|
||||
'_alias' => '列表',
|
||||
]);
|
||||
Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
|
||||
'_alias' => '审核',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
Route::get('mark/:id/form', '/form')->name('systemMerchantIntentionMarkForm')->option([
|
||||
'_alias' => '备注',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantIntentionMark',
|
||||
]);
|
||||
Route::get('status/:id/form', '/statusForm')->name('systemMerchantIntentionStatusForm')->option([
|
||||
'_alias' => '申请商户',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantIntentionStatus',
|
||||
]);
|
||||
|
||||
Route::post('mark/:id', '/mark')->name('systemMerchantIntentionMark')->option([
|
||||
'_alias' => '备注',
|
||||
]);
|
||||
Route::get('excel', '/excel');
|
||||
})->prefix('admin.system.merchant.MerchantIntention')->option([
|
||||
'_path' => '/merchant/application',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
//商户管理
|
||||
Route::group('system/merchant', function () {
|
||||
Route::get('create/form', '.Merchant/createForm')->name('systemMerchantCreateForm')->option([
|
||||
'_alias' => '商户列表',
|
||||
]);
|
||||
Route::get('count', '.Merchant/count')->name('systemMerchantCount')->option([
|
||||
'_alias' => '商户列表统计',
|
||||
]);
|
||||
Route::get('lst', '.Merchant/lst')->name('systemMerchantLst')->option([
|
||||
'_alias' => '商户列表',
|
||||
]);
|
||||
Route::post('create', '.Merchant/create')->name('systemMerchantCreate')->option([
|
||||
'_alias' => '商户添加',
|
||||
]);
|
||||
Route::get('update/form/:id', '.Merchant/updateForm')->name('systemMerchantUpdateForm')->option([
|
||||
'_alias' => '商户编辑表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantUpdate',
|
||||
]);
|
||||
Route::post('update/:id', '.Merchant/update')->name('systemMerchantUpdate')->option([
|
||||
'_alias' => '商户编辑',
|
||||
]);
|
||||
Route::post('status/:id', '.Merchant/switchStatus')->name('systemMerchantStatus')->option([
|
||||
'_alias' => '商户修改推荐',
|
||||
]);
|
||||
Route::post('close/:id', '.Merchant/switchClose')->name('systemMerchantClose')->option([
|
||||
'_alias' => '商户开启/关闭',
|
||||
]);
|
||||
Route::delete('delete/:id', '.Merchant/delete')->name('systemMerchantDelete')->option([
|
||||
'_alias' => '商户删除',
|
||||
]);
|
||||
Route::post('password/:id', '.MerchantAdmin/password')->name('systemMerchantAdminPassword')->option([
|
||||
'_alias' => '商户修改密码',
|
||||
]);
|
||||
Route::get('password/form/:id', '.MerchantAdmin/passwordForm')->name('systemMerchantAdminPasswordForm')->option([
|
||||
'_alias' => '商户修改密码表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantAdminPassword',
|
||||
]);
|
||||
Route::post('login/:id', '.Merchant/login')->name('systemMerchantLogin')->option([
|
||||
'_alias' => '商户登录',
|
||||
]);
|
||||
Route::get('changecopy/:id/form', '.Merchant/changeCopyNumForm')->name('systemMerchantChangeCopyForm')->option([
|
||||
'_alias' => '修改采集商品次数表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantChangeCopy',
|
||||
]);
|
||||
Route::post('changecopy/:id', '.Merchant/changeCopyNum')->name('systemMerchantChangeCopy')->option([
|
||||
'_alias' => '修改采集商品次数',
|
||||
]);
|
||||
})->prefix('admin.system.merchant')->option([
|
||||
'_path' => '/merchant/list',
|
||||
'_auth' => true,
|
||||
'_append'=> [
|
||||
[
|
||||
'_name' =>'uploadImage',
|
||||
'_path' =>'/merchant/list',
|
||||
'_alias' => '上传图片',
|
||||
'_auth' => true,
|
||||
],
|
||||
[
|
||||
'_name' =>'systemAttachmentLst',
|
||||
'_path' =>'/merchant/list',
|
||||
'_alias' => '图片列表',
|
||||
'_auth' => true,
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
// 店铺类型
|
||||
Route::group('merchant/type', function () {
|
||||
Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([
|
||||
'_alias' => '列表',
|
||||
]);
|
||||
Route::post('create', '/create')->name('systemMerchantTypeCreate')->option([
|
||||
'_alias' => '添加',
|
||||
]);
|
||||
Route::post('update/:id', '/update')->name('systemMerchantTypeUpdate')->option([
|
||||
'_alias' => '编辑',
|
||||
]);
|
||||
Route::delete('delete/:id', '/delete')->name('systemMerchantTypeDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
Route::get('mark/:id', '/markForm')->name('systemMerchantTypeMarkForm')->option([
|
||||
'_alias' => '备注',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMerchantTypeMark',
|
||||
]);
|
||||
Route::post('mark/:id', '/mark')->name('systemMerchantTypeMark')->option([
|
||||
'_alias' => '备注',
|
||||
]);
|
||||
|
||||
Route::get('detail/:id', '/detail')->name('systemMerchantTypeDetail')->option([
|
||||
'_alias' => '备注',
|
||||
]);
|
||||
|
||||
Route::get('options', '/options')->option([
|
||||
'_alias' => '筛选',
|
||||
'_auth' => false,
|
||||
]);
|
||||
Route::get('mer_auth', '/mer_auth')->option([
|
||||
'_alias' => '权限',
|
||||
'_auth' => false,
|
||||
]);
|
||||
})->prefix('admin.system.merchant.MerchantType')->option([
|
||||
'_path' => '/merchant/type',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
//保证金
|
||||
Route::group('margin', function () {
|
||||
//缴纳记录
|
||||
Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([
|
||||
'_alias' => '缴纳记录',
|
||||
]);
|
||||
//扣费记录
|
||||
Route::get('list/:id', 'merchant.MerchantMargin/getMarginLst')->name('systemMarginList')->option([
|
||||
'_alias' => '扣费记录',
|
||||
]);
|
||||
|
||||
//扣除保证金
|
||||
Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([
|
||||
'_alias' => '扣除保证金表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMarginSet',
|
||||
]);
|
||||
Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([
|
||||
'_alias' => '扣除保证金',
|
||||
]);
|
||||
|
||||
//退款申请
|
||||
Route::get('refund/lst', 'financial.Financial/getMarginLst')->name('systemMarginRefundList')->option([
|
||||
'_alias' => '退款申请列表',
|
||||
]);
|
||||
Route::get('refund/show/:id', 'financial.Financial/refundShow')->name('systemMarginRefundShow')->option([
|
||||
'_alias' => '退款申请详情',
|
||||
]);
|
||||
|
||||
//审核
|
||||
Route::get('refund/status/:id/form', 'financial.Financial/statusForm')->name('systemMarginRefundSwitchStatusForm')->option([
|
||||
'_alias' => '审核表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMarginRefundSwitchStatus',
|
||||
]);
|
||||
Route::post('refund/status/:id', 'financial.Financial/switchStatus')->name('systemMarginRefundSwitchStatus')->append(['type' => 1])->option([
|
||||
'_alias' => '审核',
|
||||
]);
|
||||
|
||||
//备注
|
||||
Route::get('refund/mark/:id/form', 'financial.Financial/markMarginForm')->name('systemMarginRefundMarkForm')->option([
|
||||
'_alias' => '备注表单',
|
||||
'_auth' => false,
|
||||
'_form' => 'systemMarginRefundMark',
|
||||
]);
|
||||
Route::post('refund/mark/:id', 'financial.Financial/mark')->name('systemMarginRefundMark')->option([
|
||||
'_alias' => '备注',
|
||||
]);
|
||||
})->prefix('admin.system.')->option([
|
||||
'_path' => '/merchant/deposit_list',
|
||||
'_auth' => true,
|
||||
]);
|
||||
|
||||
});
|
@ -20,14 +20,14 @@
|
||||
<td colspan="2" class="layui-td-gray">店铺类型名称<font>*</font></td>
|
||||
<td colspan="6">
|
||||
<input type="text" name="type_name" lay-verify="required" lay-reqText="请输入商品名称"
|
||||
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="{$detail.type_name}">
|
||||
autocomplete="off" placeholder="请输入商品名称" class="layui-input" value="">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" class="layui-td-gray">店铺类型要求</td>
|
||||
<td colspan="6">
|
||||
<textarea class="layui-textarea" name="type_info">{$detail.type_name}</textarea>
|
||||
<textarea class="layui-textarea" name="type_info"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -38,15 +38,15 @@
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="is_margin" value="1" title="有" checked="{$detail.is_margin}">
|
||||
<input type="radio" name="is_margin" value="0" title="无" checked="{$detail.is_margin}">
|
||||
<input type="radio" name="is_margin" value="1" title="有" checked="">
|
||||
<input type="radio" name="is_margin" value="0" title="无" checked="">
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="5"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="text" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="{$detail.margin}">
|
||||
<input type="text" name="margin" lay-verify="required" lay-reqText="0" autocomplete="off" placeholder="0" class="layui-input" value="">
|
||||
</td>
|
||||
<td colspan="5">单位:元</td>
|
||||
</tr>
|
||||
@ -64,7 +64,7 @@
|
||||
<tr>
|
||||
<td colspan="2" class="layui-td-gray">其它说明</td>
|
||||
<td colspan="6">
|
||||
<textarea class="layui-textarea" name="description">{$detail.description}</textarea>
|
||||
<textarea class="layui-textarea" name="description"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -116,7 +116,6 @@
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
console.log(data.field);
|
||||
// data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field == '') {
|
||||
layer.msg('请先完善店铺类型');
|
||||
@ -132,10 +131,18 @@
|
||||
|
||||
//获得选中的节点
|
||||
var checkData = tree.getChecked('id');
|
||||
var list = new Array();
|
||||
list = getChecked_list(checkData);
|
||||
data.field.auth = list
|
||||
tool.post('/admin/merchant/type/add', data.field, callback);
|
||||
var list = getChecked_list(checkData);
|
||||
|
||||
var params = new Object();
|
||||
params.id = data.field.id
|
||||
params.type_name = data.field.type_name
|
||||
params.type_info = data.field.type_info
|
||||
params.is_margin = data.field.is_margin
|
||||
params.margin = data.field.margin
|
||||
params.description = data.field.description
|
||||
params.auth = list
|
||||
|
||||
tool.post('/admin/merchant/type/add', params, callback);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -56,7 +56,7 @@
|
||||
<td colspan="2" style="height: 360px;" class="layui-td-gray">店铺权限<font>*</font></td>
|
||||
<td colspan="6" >
|
||||
<div class="data-box" data-admin='{:json_encode($dataTree)}'></div>
|
||||
<div id="test7" class="demo-tree"></div>
|
||||
<div id="test7" class="demo-tree-more"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -103,8 +103,6 @@
|
||||
var tree = layui.tree
|
||||
,layer = layui.layer
|
||||
,util = layui.util
|
||||
,spread = true
|
||||
//模拟数据
|
||||
,data = getData();
|
||||
|
||||
//开启复选框
|
||||
@ -112,12 +110,15 @@
|
||||
elem: '#test7'
|
||||
,data: data
|
||||
,showCheckbox: true
|
||||
,id:'id',//菜单id
|
||||
,id:'id'//菜单id
|
||||
// ,click: function(obj){
|
||||
// var data = obj.data; //获取当前点击的节点数据
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
console.log(data.field);
|
||||
// data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field == '') {
|
||||
layer.msg('请先完善店铺类型');
|
||||
@ -133,12 +134,20 @@
|
||||
|
||||
//获得选中的节点
|
||||
var checkData = tree.getChecked('id');
|
||||
var list = new Array();
|
||||
list = getChecked_list(checkData);
|
||||
data.field.auth = list
|
||||
tool.put('/admin/merchant/type/edit', data.field, callback);
|
||||
var list = getChecked_list(checkData);
|
||||
|
||||
return true;
|
||||
var params = new Object();
|
||||
params.id = data.field.id
|
||||
params.type_name = data.field.type_name
|
||||
params.type_info = data.field.type_info
|
||||
params.is_margin = data.field.is_margin
|
||||
params.margin = data.field.margin
|
||||
params.description = data.field.description
|
||||
params.auth = list
|
||||
|
||||
tool.put('/admin/merchant/type/edit', params, callback);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// 获取选中节点的id
|
||||
@ -191,7 +200,7 @@
|
||||
}
|
||||
|
||||
//所有保存到数据节点的变量都成为`dataBox`对象的属性
|
||||
console.log(dataBox.admin);
|
||||
// console.log(dataBox.admin)
|
||||
return dataBox.admin;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,6 @@
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(store_product)', function(obj) {
|
||||
console.log(obj.data);
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('/admin/merchant/type/read?id='+obj.data.id);
|
||||
|
@ -32,15 +32,15 @@
|
||||
<tr>
|
||||
<td class="layui-td-gray">店铺权限</td>
|
||||
<td colspan="3">
|
||||
|
||||
|
||||
<div class="data-box" data-admin='{:json_encode($dataTree)}'></div>
|
||||
<div id="test7" class="demo-tree-more"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="text-align:left">其它说明</td>
|
||||
<td colspan="6">
|
||||
<textarea class="layui-textarea" name="store_info" readonly>{$detail.store_info}</textarea>
|
||||
<textarea class="layui-textarea" name="store_info" readonly>{$detail.type_info}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -60,4 +60,68 @@
|
||||
</table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
<!-- /主体 -->
|
||||
{block name="script"}
|
||||
|
||||
<script>
|
||||
var moduleInit = ['tool','treeGrid', 'tagpicker', 'tinymce', 'admin'];
|
||||
var group_access = "{:session('gougu_admin')['group_access']}"
|
||||
|
||||
function gouguInit() {
|
||||
|
||||
// 店铺权限
|
||||
layui.use(['tree', 'util'], function(){
|
||||
var tree = layui.tree
|
||||
,layer = layui.layer
|
||||
,util = layui.util
|
||||
,data = getData();
|
||||
|
||||
//开启复选框
|
||||
tree.render({
|
||||
elem: '#test7'
|
||||
,data: data
|
||||
,showLine:false
|
||||
,id:'id'//菜单id
|
||||
// ,click: function(obj){
|
||||
// var data = obj.data; //获取当前点击的节点数据
|
||||
// }
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//获取店铺权限的数据[数据来自模板变量]
|
||||
function getData(){
|
||||
|
||||
/* 初始化页面渲染时传过来的js变量 */
|
||||
let dataContainerElem = document.querySelector('.data-box'), data = dataContainerElem ? dataContainerElem.dataset : {}, dataBox = {}; //模板变量容器,`.data-box`类选择器所在的所有`data`属性值集合
|
||||
Object.keys(data).forEach(function (key) {
|
||||
dataBox[key] = data[key];
|
||||
if (isJsonString(data[key]))
|
||||
dataBox[key] = JSON.parse(data[key]); //是json格式的字串才转对象
|
||||
});
|
||||
|
||||
/**
|
||||
* 判断字串是否属于json字串
|
||||
*/
|
||||
function isJsonString(str) {
|
||||
let flag = false;
|
||||
if (typeof str != 'string') return flag;
|
||||
try {
|
||||
JSON.parse(str);
|
||||
flag = true;
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
//所有保存到数据节点的变量都成为`dataBox`对象的属性
|
||||
// console.log(dataBox.admin)
|
||||
return dataBox.admin;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{/block}
|
@ -364,7 +364,9 @@ class Relevance extends Model
|
||||
*/
|
||||
public function batchInsert(array $data)
|
||||
{
|
||||
return Relevance::insertAll($data);
|
||||
$rows = Relevance::insertAll($data);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,13 +98,13 @@ class MerchantType extends Model
|
||||
*
|
||||
* @return array|object
|
||||
*/
|
||||
function Find(int $id)
|
||||
function getDetail(int $id)
|
||||
{
|
||||
if (empty($id)) {
|
||||
throw new ValidateException('未传递参数');
|
||||
return [];
|
||||
}
|
||||
$row = self::where('mer_type_id', $id)->field('mer_type_id as id,type_name,margin,type_info,description,is_margin,create_time,update_time')->find();
|
||||
$row = self::search(['mer_type_id'=>$id])->find();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user