This commit is contained in:
walkor 2022-12-08 10:43:17 +08:00
parent 1dd101981d
commit ab811d6fc5
6 changed files with 26 additions and 46 deletions

View File

@ -17,7 +17,7 @@ class Base
protected $model = null; protected $model = null;
/** /**
* 无需登录的方法及鉴权 * 无需登录及鉴权的方法
* @var array * @var array
*/ */
protected $noNeedLogin = []; protected $noNeedLogin = [];
@ -28,6 +28,13 @@ class Base
*/ */
protected $noNeedAuth = []; protected $noNeedAuth = [];
/**
* 数据限制
* 例如当$dataLimit='admin_id'时将只返回当前管理员的数据
* @var string
*/
protected $dataLimit = null;
/** /**
* 返回格式化json数据 * 返回格式化json数据
* *

View File

@ -117,6 +117,10 @@ class Crud extends Base
unset($where[$column]); unset($where[$column]);
} }
} }
// 按照数据限制字段返回数据
if ($this->dataLimit) {
$where[$this->dataLimit] = admin_id();
}
return [$where, $format, $page_size, $field, $order]; return [$where, $format, $page_size, $field, $order];
} }

View File

@ -21,6 +21,12 @@ class UploadController extends Crud
*/ */
protected $model = null; protected $model = null;
/**
* 按照admin_id字段限制返回数据
* @var string
*/
protected $dataLimit = 'admin_id';
/** /**
* 构造函数 * 构造函数
* @return void * @return void

View File

@ -35,13 +35,6 @@
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">管理员id</label>
<div class="layui-input-block">
<input type="number" name="admin_id" value="" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">上传时间</label> <label class="layui-form-label">上传时间</label>
<div class="layui-input-block"> <div class="layui-input-block">

View File

@ -34,13 +34,6 @@
<input type="text" name="ext" value="" class="layui-input"> <input type="text" name="ext" value="" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">管理员</label>
<div class="layui-input-block">
<div name="admin_id" id="admin_id" value="" ></div>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">上传时间</label> <label class="layui-form-label">上传时间</label>
@ -116,27 +109,6 @@
}); });
}) })
// 字段 管理员 admin_id
layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({
url: "/app/admin/admin/select?format=select",
dataType: "json",
success: function (e) {
let value = layui.$("#admin_id").attr("value");
let initValue = value ? value.split(",") : [];
layui.xmSelect.render({
el: "#admin_id",
name: "admin_id",
initValue: initValue,
data: e.data,
model: {"icon":"hidden","label":{"type":"text"}},
clickClose: true,
radio: true,
})
}
});
});
// 字段 类别 category // 字段 类别 category
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
@ -271,10 +243,8 @@
// 获取表格中下拉或树形组件数据 // 获取表格中下拉或树形组件数据
let apis = []; let apis = [];
apis.push(["admin_id", "/app/admin/admin/select?format=select"]);
apis.push(["category", "/app/admin/dict/get/upload"]); apis.push(["category", "/app/admin/dict/get/upload"]);
let apiResults = {}; let apiResults = {};
apiResults["admin_id"] = [];
apiResults["category"] = []; apiResults["category"] = [];
let count = apis.length; let count = apis.length;
layui.each(apis, function (k, item) { layui.each(apis, function (k, item) {

View File

@ -77,25 +77,25 @@ return [
'type' => 1, 'type' => 1,
'weight' => 800, 'weight' => 800,
], ],
[
'title' => '系统设置',
'key' => 'plugin\\admin\\app\\controller\\ConfigController',
'href' => '/app/admin/config/index',
'type' => 1,
'weight' => 700,
],
[ [
'title' => '附件管理', 'title' => '附件管理',
'key' => 'plugin\\admin\\app\\controller\\UploadController', 'key' => 'plugin\\admin\\app\\controller\\UploadController',
'href' => '/app/admin/upload/index', 'href' => '/app/admin/upload/index',
'type' => 1, 'type' => 1,
'weight' => 600, 'weight' => 700,
], ],
[ [
'title' => '字典设置', 'title' => '字典设置',
'key' => 'plugin\\admin\\app\\controller\\DictController', 'key' => 'plugin\\admin\\app\\controller\\DictController',
'href' => '/app/admin/dict/index', 'href' => '/app/admin/dict/index',
'type' => 1, 'type' => 1,
'weight' => 600,
],
[
'title' => '系统设置',
'key' => 'plugin\\admin\\app\\controller\\ConfigController',
'href' => '/app/admin/config/index',
'type' => 1,
'weight' => 500, 'weight' => 500,
], ],
] ]