mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
将js代码架构改为app下渲染;
This commit is contained in:
@@ -50,4 +50,7 @@ OSS_STATIC_PREFIX=static_ulthon_admin
|
||||
DEFAULT_AUTH_CHECK=false
|
||||
|
||||
# 严格要求部分事件的返回数据,不符则抛出异常
|
||||
STRICT_EVENT=true
|
||||
STRICT_EVENT=true
|
||||
|
||||
# 严格要求每个页面都建立js文件
|
||||
STRICT_VIEW_JS=true
|
||||
@@ -1473,11 +1473,11 @@ class BuildCurdService
|
||||
$var_name = $this->getFieldVarName($field);
|
||||
|
||||
if ($val['formType'] == 'image') {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.image}";
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.image}";
|
||||
} elseif ($val['formType'] == 'images') {
|
||||
continue;
|
||||
} elseif ($val['formType'] == 'file') {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.url}";
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.url}";
|
||||
} elseif ($val['formType'] == 'files') {
|
||||
continue;
|
||||
} elseif ($val['formType'] == 'editor') {
|
||||
@@ -1486,18 +1486,18 @@ class BuildCurdService
|
||||
continue;
|
||||
} elseif (in_array($field, $this->switchFields)) {
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
$templateValue = "{field: '{$field}', search: 'select', selectList: ea.getDataBrage('{$var_name}'), title: '{$val['comment']}', templet: ea.table.switch}";
|
||||
$templateValue = "{field: '{$field}', search: 'select', selectList: ua.getDataBrage('{$var_name}'), title: '{$val['comment']}', templet: ua.table.switch}";
|
||||
} else {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.switch}";
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.switch}";
|
||||
}
|
||||
} elseif (in_array($val['formType'], ['select', 'checkbox', 'radio', 'switch'])) {
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
$templateValue = "{field: '{$field}', search: 'select', selectList: ea.getDataBrage('{$var_name}'), title: '{$val['comment']}'}";
|
||||
$templateValue = "{field: '{$field}', search: 'select', selectList: ua.getDataBrage('{$var_name}'), title: '{$val['comment']}'}";
|
||||
} else {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}'}";
|
||||
}
|
||||
} elseif (in_array($field, ['remark'])) {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.text}";
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.text}";
|
||||
} elseif (in_array($field, $this->sortFields)) {
|
||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}', edit: 'text'}";
|
||||
} else {
|
||||
@@ -1512,11 +1512,11 @@ class BuildCurdService
|
||||
$table = Str::camel($table);
|
||||
foreach ($tableVal['tableColumns'] as $field => $val) {
|
||||
if ($val['formType'] == 'image') {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}";
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.image}";
|
||||
} elseif ($val['formType'] == 'images') {
|
||||
continue;
|
||||
} elseif ($val['formType'] == 'file') {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.url}";
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.url}";
|
||||
} elseif ($val['formType'] == 'files') {
|
||||
continue;
|
||||
} elseif ($val['formType'] == 'editor') {
|
||||
@@ -1526,9 +1526,9 @@ class BuildCurdService
|
||||
} elseif ($val['formType'] == 'select') {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}";
|
||||
} elseif (in_array($field, ['remark'])) {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.text}";
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.text}";
|
||||
} elseif (in_array($field, $this->switchFields)) {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.switch}";
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.switch}";
|
||||
} elseif (in_array($field, $this->sortFields)) {
|
||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}";
|
||||
} else {
|
||||
@@ -1539,7 +1539,7 @@ class BuildCurdService
|
||||
}
|
||||
}
|
||||
|
||||
$indexCols .= $this->formatColsRow("{width: 250, title: '操作', templet: ea.table.tool , fixed:'right'},\r");
|
||||
$indexCols .= $this->formatColsRow("{width: 250, title: '操作', templet: ua.table.tool , fixed:'right'},\r");
|
||||
|
||||
$jsValue = $this->replaceTemplate(
|
||||
$this->getTemplate("static{$this->DS}js"),
|
||||
|
||||
@@ -14,20 +14,20 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{{indexCols}}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
33
app/admin/view/common/_require.html
Normal file
33
app/admin/view/common/_require.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="__STATIC__/admin/css/public.css" media="all">
|
||||
<link rel="stylesheet" href="__STATIC__/common/css/theme/index.css">
|
||||
|
||||
<!-- 基础js -->
|
||||
<script src="__STATIC__/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
|
||||
<script src="__STATIC__/common/js/app.js"></script>
|
||||
<script src="__STATIC__/plugs/layui-v2.8.16/layui.js" charset="utf-8"></script>
|
||||
|
||||
<!-- 其他js -->
|
||||
<script src="__STATIC__/plugs/jq-module/jquery.particleground.min.js"></script>
|
||||
<script src="__STATIC__/plugs/echarts/echarts.min.js"></script>
|
||||
<script src="__STATIC__/plugs/echarts/echarts-theme.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/layuimini/miniMenu.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/layuimini/miniTab.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/layuimini/miniTheme.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/layuimini/miniAdmin.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/treetable-lay/treetable.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/tableData/tableData.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/tagInput/tagInput.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/propertyInput/propertyInput.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/iconPicker/iconPickerFa.js"></script>
|
||||
<script src="__STATIC__/plugs/lay-module/autocomplete/autocomplete.js"></script>
|
||||
<script src="__STATIC__/plugs/vue-2.6.10/vue.min.js"></script>
|
||||
<script src="__STATIC__/plugs/ckeditor4/ckeditor.js"></script>
|
||||
<script src="__STATIC__/plugs/jq-module/city-picker/js/city-picker.data.min.js"></script>
|
||||
<script src="__STATIC__/plugs/jq-module/city-picker/js/city-picker.min.js"></script>
|
||||
<script src="__STATIC__/plugs/clipboard.js/clipboard.min.js"></script>
|
||||
<script src="__STATIC__/plugs/ulthon-admin/ulthon-admin.js"></script>
|
||||
0
app/admin/view/debug/log/_common.js
Normal file
0
app/admin/view/debug/log/_common.js
Normal file
@@ -1,53 +0,0 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">uid</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="uid" class="layui-input" lay-verify="required" placeholder="请输入uid" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">level</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="level" class="layui-input" lay-verify="required" placeholder="请输入level" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">日志内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="content" class="layui-textarea" lay-verify="required" placeholder="请输入日志内容"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">create_time_title</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="create_time_title" class="layui-input" lay-verify="required" placeholder="请输入create_time_title" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">app_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="app_name" class="layui-input" lay-verify="required" placeholder="请输入app_name" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">controller_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="controller_name" class="layui-input" lay-verify="required" placeholder="请输入controller_name" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">action_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="action_name" class="layui-input" lay-verify="required" placeholder="请输入action_name" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,53 +0,0 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">uid</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="uid" class="layui-input" lay-verify="required" placeholder="请输入uid" value="{$row.uid|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">level</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="level" class="layui-input" lay-verify="required" placeholder="请输入level" value="{$row.level|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">日志内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="content" class="layui-textarea" lay-verify="required" placeholder="请输入日志内容">{$row.content|raw|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">create_time_title</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="create_time_title" class="layui-input" lay-verify="required" placeholder="请输入create_time_title" value="{$row.create_time_title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">app_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="app_name" class="layui-input" lay-verify="required" placeholder="请输入app_name" value="{$row.app_name|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">controller_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="controller_name" class="layui-input" lay-verify="required" placeholder="请输入controller_name" value="{$row.controller_name|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">action_name</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="action_name" class="layui-input" lay-verify="required" placeholder="请输入action_name" value="{$row.action_name|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
51
app/admin/view/debug/log/index.js
Normal file
51
app/admin/view/debug/log/index.js
Normal file
@@ -0,0 +1,51 @@
|
||||
$(function () {
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'debug.log/index',
|
||||
add_url: 'debug.log/add',
|
||||
edit_url: 'debug.log/edit',
|
||||
delete_url: 'debug.log/delete',
|
||||
export_url: 'debug.log/export',
|
||||
modify_url: 'debug.log/modify',
|
||||
};
|
||||
|
||||
var uidList = [];
|
||||
ua.table.render({
|
||||
init: init,
|
||||
size: 'sm',
|
||||
limit: 50,
|
||||
cols: [[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'id', title: 'id', search: 'number_limit' },
|
||||
{ field: 'id', title: 'id模糊匹配', trueHide: true, fieldAlias: '[id]like' },
|
||||
{ field: 'id', title: '最大id', trueHide: true, fieldAlias: '[id]max', searchOp: 'max' },
|
||||
{
|
||||
field: 'uid', title: 'uid', minWidth: 120,
|
||||
},
|
||||
{ field: 'level', title: 'level', minWidth: 70 },
|
||||
{
|
||||
field: 'content', title: '日志内容', minWidth: 450, align: 'left', templet: function (data) {
|
||||
|
||||
if (uidList.indexOf(data.uid) < 0) {
|
||||
uidList.push(data.uid);
|
||||
}
|
||||
var currentUidIndex = uidList.indexOf(data.uid);
|
||||
|
||||
var className = 'log-group log-group-' + (currentUidIndex % 2);
|
||||
return '<div class="' + className + '">' + data.content + '</div>';
|
||||
}
|
||||
},
|
||||
{ field: 'create_time', title: '记录时间', minWidth: 160, search: 'time_limit' },
|
||||
{ field: 'app_name', title: 'app_name' },
|
||||
{ field: 'controller_name', title: 'controller_name', },
|
||||
{ field: 'action_name', title: 'action_name' },
|
||||
]],
|
||||
toolbar: [
|
||||
'refresh',
|
||||
'export'
|
||||
]
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
0
app/admin/view/index/_common.js
Normal file
0
app/admin/view/index/_common.js
Normal file
3
app/admin/view/index/edit_admin.js
Normal file
3
app/admin/view/index/edit_admin.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/index/edit_password.js
Normal file
3
app/admin/view/index/edit_password.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
@@ -111,4 +111,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
25
app/admin/view/index/index.js
Normal file
25
app/admin/view/index/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
$(function () {
|
||||
var options = {
|
||||
iniUrl: ua.url('ajax/initAdmin'), // 初始化接口
|
||||
clearUrl: ua.url("ajax/clearCache"), // 缓存清理接口
|
||||
urlHashLocation: true, // 是否打开hash定位
|
||||
bgColorDefault: false, // 主题默认配置
|
||||
multiModule: true, // 是否开启多模块
|
||||
menuChildOpen: false, // 是否默认展开菜单
|
||||
loadingTime: 0, // 初始化加载时间
|
||||
pageAnim: true, // iframe窗口动画
|
||||
maxTabNum: 20, // 最大的tab打开数量
|
||||
};
|
||||
miniAdmin.render(options);
|
||||
|
||||
$('.login-out').on("click", function () {
|
||||
ua.request.get({
|
||||
url: 'login/out',
|
||||
prefix: true,
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
window.location = ua.url('login/index');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
83
app/admin/view/index/welcome.js
Normal file
83
app/admin/view/index/welcome.js
Normal file
@@ -0,0 +1,83 @@
|
||||
$(function () {
|
||||
/**
|
||||
* 报表功能
|
||||
*/
|
||||
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
|
||||
var optionRecords = {
|
||||
title: {
|
||||
text: '访问统计'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '邮件营销',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name: '联盟广告',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
name: '视频广告',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
name: '直接访问',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
name: '搜索引擎',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var checkChartVisibleTimer = setInterval(() => {
|
||||
var isChartVisible = $('#echarts-records').is(':visible');
|
||||
if (isChartVisible) {
|
||||
echartsRecords.setOption(optionRecords);
|
||||
echartsRecords.resize();
|
||||
window.addEventListener("resize", function () {
|
||||
echartsRecords.resize();
|
||||
});
|
||||
|
||||
clearInterval(checkChartVisibleTimer);
|
||||
}
|
||||
}, 3000);
|
||||
ua.listen();
|
||||
});
|
||||
@@ -7,14 +7,7 @@
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="__STATIC__/admin/css/public.css?v={$version}" media="all">
|
||||
|
||||
<link rel="stylesheet" href="__STATIC__/common/css/theme/index.css?v={$version}">
|
||||
|
||||
{include file='common/_require'/}
|
||||
<script>
|
||||
window.CONFIG = {
|
||||
ADMIN: "{$adminModuleName|default='admin'}",
|
||||
@@ -25,11 +18,15 @@
|
||||
VERSION: "{$version|default='1.0.0'}",
|
||||
CSRF_TOKEN: "{:token()}",
|
||||
};
|
||||
|
||||
var PATH_CONFIG = {
|
||||
iconLess: "__STATIC__/plugs/font-awesome-4.7.0/less/variables.less",
|
||||
};
|
||||
window.PATH_CONFIG = PATH_CONFIG;
|
||||
</script>
|
||||
<script src="__STATIC__/common/js/app.js"></script>
|
||||
<script src="__STATIC__/plugs/layui-v2.8.16/layui.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/plugs/require-2.3.6/require.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/config-admin.js?v={$version}" charset="utf-8"></script>
|
||||
|
||||
{$content_js|raw}
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
0
app/admin/view/login/_common.js
Normal file
0
app/admin/view/login/_common.js
Normal file
@@ -1,4 +1,4 @@
|
||||
<div class="layui-btn layui-btn-xs" id="demo-login-btn">演示账号快速登录</div>
|
||||
<div class="layui-btn layui-btn-xs" id="demo-login-btn">演示账号一键填写</div>
|
||||
<script>
|
||||
$('#demo-login-btn').click(function() {
|
||||
$('[name="username"]').val('admin')
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
|
||||
<button class="login-btn" lay-submit>立即登录</button>
|
||||
</div>
|
||||
<div class="layui-form-item" style="padding: 10px;">
|
||||
<div class="layui-form-item" style="padding: 10px;text-align: right;">
|
||||
<div class="layui-btn-container">
|
||||
{:event_view_content("AdminLoginType")}
|
||||
</div>
|
||||
|
||||
45
app/admin/view/login/index.js
Normal file
45
app/admin/view/login/index.js
Normal file
@@ -0,0 +1,45 @@
|
||||
$(function () {
|
||||
if (top.location !== self.location) {
|
||||
top.location = self.location;
|
||||
}
|
||||
|
||||
$('.bind-password').on('click', function () {
|
||||
if ($(this).hasClass('icon-5')) {
|
||||
$(this).removeClass('icon-5');
|
||||
$("input[name='password']").attr('type', 'password');
|
||||
} else {
|
||||
$(this).addClass('icon-5');
|
||||
$("input[name='password']").attr('type', 'text');
|
||||
}
|
||||
});
|
||||
|
||||
$('.icon-nocheck').on('click', function () {
|
||||
if ($(this).hasClass('icon-check')) {
|
||||
$(this).removeClass('icon-check');
|
||||
} else {
|
||||
$(this).addClass('icon-check');
|
||||
}
|
||||
});
|
||||
|
||||
$('.login-tip').on('click', function () {
|
||||
$('.icon-nocheck').click();
|
||||
});
|
||||
|
||||
ua.listen(function (data) {
|
||||
data['keep_login'] = $('.icon-nocheck').hasClass('icon-check') ? 1 : 0;
|
||||
return data;
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
window.location = ua.url('index');
|
||||
});
|
||||
}, function (res) {
|
||||
ua.msg.error(res.msg, function () {
|
||||
$('#refreshCaptcha').trigger("click");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('.forget-password').click(function () {
|
||||
layer.msg('可以使用重置密码命令设置:<br/>php think admin:resetPassword<br><a target="_blank" href="http://doc.ulthon.com/home/read/ulthon_admin/reset_password/15/16.html"> 参考文档</a>');
|
||||
});
|
||||
});
|
||||
10
app/admin/view/mall/cate/_common.js
Normal file
10
app/admin/view/mall/cate/_common.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'mall.cate/index',
|
||||
add_url: 'mall.cate/add',
|
||||
edit_url: 'mall.cate/edit',
|
||||
delete_url: 'mall.cate/delete',
|
||||
export_url: 'mall.cate/export',
|
||||
modify_url: 'mall.cate/modify',
|
||||
};
|
||||
3
app/admin/view/mall/cate/add.js
Normal file
3
app/admin/view/mall/cate/add.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function(){
|
||||
ua.listen();
|
||||
})
|
||||
3
app/admin/view/mall/cate/edit.js
Normal file
3
app/admin/view/mall/cate/edit.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
20
app/admin/view/mall/cate/index.js
Normal file
20
app/admin/view/mall/cate/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$(function () {
|
||||
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ field: 'title', minWidth: 80, title: '分类名称' },
|
||||
{ field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image },
|
||||
{ field: 'remark', minWidth: 80, title: '备注信息' },
|
||||
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{ width: 250, title: '操作', templet: ua.table.tool }
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
13
app/admin/view/mall/goods/_common.js
Normal file
13
app/admin/view/mall/goods/_common.js
Normal file
@@ -0,0 +1,13 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'mall.goods/index',
|
||||
add_url: 'mall.goods/add',
|
||||
edit_url: 'mall.goods/edit',
|
||||
delete_url: 'mall.goods/delete',
|
||||
export_url: 'mall.goods/export',
|
||||
modify_url: 'mall.goods/modify',
|
||||
stock_url: 'mall.goods/stock',
|
||||
read_url: 'mall.goods/read',
|
||||
formFullScreen: true,
|
||||
};
|
||||
3
app/admin/view/mall/goods/add.js
Normal file
3
app/admin/view/mall/goods/add.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function(){
|
||||
ua.listen();
|
||||
})
|
||||
3
app/admin/view/mall/goods/edit.js
Normal file
3
app/admin/view/mall/goods/edit.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
69
app/admin/view/mall/goods/index.js
Normal file
69
app/admin/view/mall/goods/index.js
Normal file
@@ -0,0 +1,69 @@
|
||||
$(function () {
|
||||
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
totalRow: true,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID', totalRowText: '合计:' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ua.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ua.getQueryVariable('cate_id', '') },
|
||||
{ field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image },
|
||||
{ field: 'title', minWidth: 80, title: '商品名称', },
|
||||
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ua.table.image },
|
||||
{ field: 'market_price', width: 100, title: '市场价', templet: ua.table.price },
|
||||
{
|
||||
field: 'discount_price', width: 120, title: '折扣价', templet: ua.table.price, totalRow: true,
|
||||
templet: ua.table.copyText,
|
||||
valueParser(value) {
|
||||
return '¥' + value;
|
||||
},
|
||||
copyText(value, data) {
|
||||
return data.discount_price;
|
||||
}
|
||||
},
|
||||
{ field: 'total_stock', width: 100, title: '库存统计', totalRow: '{{= parseInt(d.TOTAL_NUMS) }} 个' },
|
||||
{
|
||||
field: 'stock',
|
||||
width: 100,
|
||||
title: '剩余库存',
|
||||
valueParser(value, data) {
|
||||
if (value >= 20) {
|
||||
return value;
|
||||
}
|
||||
return value + '(缺货)';
|
||||
}
|
||||
},
|
||||
{ field: 'virtual_sales', width: 100, title: '虚拟销量' },
|
||||
{ field: 'sales', width: 80, title: '销量' },
|
||||
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ua.table.tool,
|
||||
fixed: 'right',
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
text: '入库',
|
||||
url: init.stock_url,
|
||||
method: 'open',
|
||||
auth: 'stock',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-normal',
|
||||
}, {
|
||||
text: '详情',
|
||||
url: init.read_url,
|
||||
method: 'open',
|
||||
auth: 'edit',
|
||||
extend: 'data-full="true"',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-primary',
|
||||
},],
|
||||
'delete']
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/mall/goods/read.js
Normal file
3
app/admin/view/mall/goods/read.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/mall/goods/stock.js
Normal file
3
app/admin/view/mall/goods/stock.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
10
app/admin/view/mall/tag/_common.js
Normal file
10
app/admin/view/mall/tag/_common.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'mall.tag/index',
|
||||
add_url: 'mall.tag/add',
|
||||
edit_url: 'mall.tag/edit',
|
||||
delete_url: 'mall.tag/delete',
|
||||
export_url: 'mall.tag/export',
|
||||
modify_url: 'mall.tag/modify',
|
||||
};
|
||||
3
app/admin/view/mall/tag/add.js
Normal file
3
app/admin/view/mall/tag/add.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/mall/tag/edit.js
Normal file
3
app/admin/view/mall/tag/edit.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
13
app/admin/view/mall/tag/index.js
Normal file
13
app/admin/view/mall/tag/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
$(function () {
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'id', title: 'id' },
|
||||
{ field: 'title', title: '名称' },
|
||||
{ width: 250, title: '操作', templet: ua.table.tool },
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
11
app/admin/view/system/admin/_common.js
Normal file
11
app/admin/view/system/admin/_common.js
Normal file
@@ -0,0 +1,11 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.admin/index',
|
||||
add_url: 'system.admin/add',
|
||||
edit_url: 'system.admin/edit',
|
||||
delete_url: 'system.admin/delete',
|
||||
modify_url: 'system.admin/modify',
|
||||
export_url: 'system.admin/export',
|
||||
password_url: 'system.admin/password',
|
||||
};
|
||||
3
app/admin/view/system/admin/add.js
Normal file
3
app/admin/view/system/admin/add.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/system/admin/edit.js
Normal file
3
app/admin/view/system/admin/edit.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
@@ -1,12 +1,6 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.admin/add')}"
|
||||
data-auth-edit="{:auth('system.admin/edit')}"
|
||||
data-auth-delete="{:auth('system.admin/delete')}"
|
||||
data-auth-password="{:auth('system.admin/password')}"
|
||||
data-auth-modify="{:auth('system.admin/modify')}"
|
||||
lay-filter="currentTable">
|
||||
<table id="currentTable" class="layui-table layui-hide" data-auth-add="{:auth('system.admin/add')}" data-auth-edit="{:auth('system.admin/edit')}" data-auth-delete="{:auth('system.admin/delete')}" data-auth-password="{:auth('system.admin/password')}" data-auth-modify="{:auth('system.admin/modify')}" lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
38
app/admin/view/system/admin/index.js
Normal file
38
app/admin/view/system/admin/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
$(function () {
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ field: 'username', minWidth: 80, title: '登录账户' },
|
||||
{ field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ua.table.image },
|
||||
{ field: 'phone', minWidth: 80, title: '手机' },
|
||||
{ field: 'login_num', minWidth: 80, title: '登录次数' },
|
||||
{ field: 'remark', minWidth: 80, title: '备注信息', defaultValue: '无' },
|
||||
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
text: '设置密码',
|
||||
titleField: 'username',
|
||||
url: init.password_url,
|
||||
method: 'open',
|
||||
auth: 'password',
|
||||
class: 'layui-btn layui-btn-normal layui-btn-xs',
|
||||
}],
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
3
app/admin/view/system/admin/password.js
Normal file
3
app/admin/view/system/admin/password.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
11
app/admin/view/system/auth/_common.js
Normal file
11
app/admin/view/system/auth/_common.js
Normal file
@@ -0,0 +1,11 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.auth/index',
|
||||
add_url: 'system.auth/add',
|
||||
edit_url: 'system.auth/edit',
|
||||
delete_url: 'system.auth/delete',
|
||||
export_url: 'system.auth/export',
|
||||
modify_url: 'system.auth/modify',
|
||||
authorize_url: 'system.auth/authorize',
|
||||
};
|
||||
3
app/admin/view/system/auth/add.js
Normal file
3
app/admin/view/system/auth/add.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
32
app/admin/view/system/auth/authorize.js
Normal file
32
app/admin/view/system/auth/authorize.js
Normal file
@@ -0,0 +1,32 @@
|
||||
$(function () {
|
||||
var tree = layui.tree;
|
||||
|
||||
ua.request.get(
|
||||
{
|
||||
url: window.location.href,
|
||||
}, function (res) {
|
||||
res.data = res.data || [];
|
||||
tree.render({
|
||||
elem: '#node_ids',
|
||||
data: res.data,
|
||||
showCheckbox: true,
|
||||
id: 'nodeDataId',
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ua.listen(function (data) {
|
||||
var checkedData = tree.getChecked('nodeDataId');
|
||||
var ids = [];
|
||||
$.each(checkedData, function (i, v) {
|
||||
ids.push(v.id);
|
||||
if (v.children !== undefined && v.children.length > 0) {
|
||||
$.each(v.children, function (ii, vv) {
|
||||
ids.push(vv.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
data.node = JSON.stringify(ids);
|
||||
return data;
|
||||
});
|
||||
});
|
||||
3
app/admin/view/system/auth/edit.js
Normal file
3
app/admin/view/system/auth/edit.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
ua.listen();
|
||||
});
|
||||
33
app/admin/view/system/auth/index.js
Normal file
33
app/admin/view/system/auth/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
$(function () {
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ field: 'title', minWidth: 80, title: '权限名称' },
|
||||
{ field: 'remark', minWidth: 80, title: '备注信息' },
|
||||
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
text: '授权',
|
||||
url: init.authorize_url,
|
||||
method: 'open',
|
||||
auth: 'authorize',
|
||||
class: 'layui-btn layui-btn-normal layui-btn-xs',
|
||||
}],
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
0
app/admin/view/system/config/_common.js
Normal file
0
app/admin/view/system/config/_common.js
Normal file
12
app/admin/view/system/config/index.js
Normal file
12
app/admin/view/system/config/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
$(function () {
|
||||
var form = layui.form;
|
||||
$('.show-type-item').hide();
|
||||
$('.show-type-item.' + upload_type).show();
|
||||
form.on("radio(upload_type)", function (data) {
|
||||
|
||||
$('.show-type-item').hide();
|
||||
$('.show-type-item.' + this.value).show();
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
14
app/admin/view/system/menu/_common.js
Normal file
14
app/admin/view/system/menu/_common.js
Normal file
@@ -0,0 +1,14 @@
|
||||
var table = layui.table,
|
||||
treetable = layui.treetable,
|
||||
iconPickerFa = layui.iconPickerFa,
|
||||
autocomplete = layui.autocomplete;
|
||||
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.menu/index',
|
||||
add_url: 'system.menu/add',
|
||||
delete_url: 'system.menu/delete',
|
||||
edit_url: 'system.menu/edit',
|
||||
modify_url: 'system.menu/modify',
|
||||
};
|
||||
31
app/admin/view/system/menu/add.js
Normal file
31
app/admin/view/system/menu/add.js
Normal file
@@ -0,0 +1,31 @@
|
||||
$(function () {
|
||||
iconPickerFa.render({
|
||||
elem: '#icon',
|
||||
url: PATH_CONFIG.iconLess,
|
||||
limit: 12,
|
||||
click: function (data) {
|
||||
$('#icon').val('fa ' + data.icon);
|
||||
},
|
||||
success: function (d) {
|
||||
|
||||
}
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{-d.node}}',
|
||||
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ua.listen(function (data) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
});
|
||||
});
|
||||
});
|
||||
31
app/admin/view/system/menu/edit.js
Normal file
31
app/admin/view/system/menu/edit.js
Normal file
@@ -0,0 +1,31 @@
|
||||
$(function () {
|
||||
iconPickerFa.render({
|
||||
elem: '#icon',
|
||||
url: PATH_CONFIG.iconLess,
|
||||
limit: 12,
|
||||
click: function (data) {
|
||||
$('#icon').val('fa ' + data.icon);
|
||||
},
|
||||
success: function (d) {
|
||||
console.log(d);
|
||||
}
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{-d.node}}',
|
||||
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ua.listen(function (data) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
});
|
||||
});
|
||||
});
|
||||
162
app/admin/view/system/menu/index.js
Normal file
162
app/admin/view/system/menu/index.js
Normal file
@@ -0,0 +1,162 @@
|
||||
$(function () {
|
||||
|
||||
var renderTable = function () {
|
||||
layer.load(2);
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
homdPid: 99999999,
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
url: ua.url(init.index_url),
|
||||
elem: init.table_elem,
|
||||
id: init.table_render_id,
|
||||
toolbar: '#toolbar',
|
||||
page: false,
|
||||
skin: 'line',
|
||||
|
||||
// @todo 不直接使用ua.table.render(); 进行表格初始化, 需要使用 ua.table.formatCols(); 方法格式化`cols`列数据
|
||||
cols: ua.table.formatCols([[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'title', sort: false, width: 250, title: '菜单名称', align: 'left' },
|
||||
{ field: 'icon', sort: false, width: 80, title: '图标', templet: ua.table.icon },
|
||||
{ field: 'href', sort: false, minWidth: 120, title: '菜单链接' },
|
||||
{
|
||||
field: 'is_home', sort: false,
|
||||
width: 80,
|
||||
title: '类型',
|
||||
templet: function (d) {
|
||||
if (d.pid === 99999999) {
|
||||
return '<span class="layui-badge layui-bg-blue">首页</span>';
|
||||
}
|
||||
if (d.pid === 0) {
|
||||
return '<span class="layui-badge layui-bg-gray">模块</span>';
|
||||
} else {
|
||||
return '<span class="layui-badge-rim">菜单</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'status', sort: false, title: '状态', width: 85, templet: ua.table.switch },
|
||||
{ field: 'sort', sort: false, width: 80, title: '排序', edit: 'text' },
|
||||
{
|
||||
width: 220,
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
[{
|
||||
text: '添加下级',
|
||||
url: init.add_url,
|
||||
method: 'open',
|
||||
auth: 'add',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-normal',
|
||||
extend: 'data-full="true"',
|
||||
_if: function (data) {
|
||||
if (data.pid == 99999999) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}, {
|
||||
text: '编辑',
|
||||
url: init.edit_url,
|
||||
method: 'open',
|
||||
auth: 'edit',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-success',
|
||||
extend: 'data-full="true"',
|
||||
_if: 'status'
|
||||
}, {
|
||||
text: '删除',
|
||||
method: 'none',
|
||||
auth: 'delete',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-danger',
|
||||
extend: 'data-treetable-delete-item="1" data-url="' + init.delete_url + '"',
|
||||
data: ['id', 'title'],
|
||||
_if(data) {
|
||||
|
||||
if (data.pid == ua.getDataBrage('menu_home_pid')) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
},],
|
||||
|
||||
]
|
||||
}
|
||||
]], init),
|
||||
done: function () {
|
||||
layer.closeAll('loading');
|
||||
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$(".layui-table-fixed").each(function () {
|
||||
$($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
renderTable();
|
||||
|
||||
$('body').on('click', '[data-treetable-refresh]', function () {
|
||||
renderTable();
|
||||
});
|
||||
|
||||
$('body').on('click', '[data-treetable-delete-item]', function () {
|
||||
var id = $(this).data('id');
|
||||
var url = $(this).attr('data-url');
|
||||
url = url != undefined ? ua.url(url) : window.location.href;
|
||||
ua.msg.confirm('确定删除?', function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
renderTable();
|
||||
});
|
||||
});
|
||||
});
|
||||
return false;
|
||||
})
|
||||
|
||||
$('body').on('click', '[data-treetable-delete]', function () {
|
||||
var tableId = $(this).attr('data-treetable-delete'),
|
||||
url = $(this).attr('data-url');
|
||||
tableId = tableId || init.table_render_id;
|
||||
url = url != undefined ? ua.url(url) : window.location.href;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ua.msg.error('请勾选需要删除的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
$.each(data, function (i, v) {
|
||||
ids.push(v.id);
|
||||
});
|
||||
ua.msg.confirm('确定删除?', function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: ids
|
||||
},
|
||||
}, function (res) {
|
||||
ua.msg.success(res.msg, function () {
|
||||
renderTable();
|
||||
});
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
ua.table.listenSwitch({ filter: 'status', url: init.modify_url });
|
||||
|
||||
ua.table.listenEdit(init, 'currentTable', init.table_render_id, false);
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
9
app/admin/view/system/node/_common.js
Normal file
9
app/admin/view/system/node/_common.js
Normal file
@@ -0,0 +1,9 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.node/index',
|
||||
add_url: 'system.node/add',
|
||||
edit_url: 'system.node/edit',
|
||||
delete_url: 'system.node/delete',
|
||||
modify_url: 'system.node/modify',
|
||||
};
|
||||
47
app/admin/view/system/node/index.js
Normal file
47
app/admin/view/system/node/index.js
Normal file
@@ -0,0 +1,47 @@
|
||||
$(function () {
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
search: false,
|
||||
page: false,
|
||||
toolbar: ['refresh',
|
||||
[{
|
||||
text: '更新节点',
|
||||
title: '确定更新新节点?',
|
||||
url: 'system.node/refreshNode?force=0',
|
||||
method: 'request',
|
||||
auth: 'refresh',
|
||||
class: 'layui-btn layui-btn-success layui-btn-sm',
|
||||
icon: 'fa fa-hourglass',
|
||||
extend: 'data-table="' + init.table_render_id + '"',
|
||||
}, {
|
||||
text: '强制更新节点',
|
||||
title: '该操作会覆盖已存在的节点信息。<br>确定强制更新节点?',
|
||||
url: 'system.node/refreshNode?force=1',
|
||||
method: 'request',
|
||||
auth: 'refresh',
|
||||
class: 'layui-btn layui-btn-sm layui-btn-normal',
|
||||
icon: 'fa fa-hourglass',
|
||||
extend: 'data-table="' + init.table_render_id + '"',
|
||||
}, {
|
||||
|
||||
text: '清除失效节点',
|
||||
title: '确定清除失效节点?',
|
||||
url: 'system.node/clearNode',
|
||||
method: 'request',
|
||||
auth: 'clear',
|
||||
class: 'layui-btn layui-btn-sm layui-btn-danger',
|
||||
icon: 'fa fa-trash-o',
|
||||
extend: 'data-table="' + init.table_render_id + '"',
|
||||
}
|
||||
]],
|
||||
cols: [[
|
||||
{ field: 'node', sort: false, minWidth: 200, align: 'left', title: '系统节点' },
|
||||
{ field: 'title', sort: false, minWidth: 80, title: '节点名称 <i class="table-edit-tips color-red">*</i>', edit: 'text' },
|
||||
{ field: 'update_time', sort: false, minWidth: 80, title: '更新时间', search: 'range' },
|
||||
{ field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
13
app/admin/view/system/quick/_common.js
Normal file
13
app/admin/view/system/quick/_common.js
Normal file
@@ -0,0 +1,13 @@
|
||||
var iconPickerFa = layui.iconPickerFa,
|
||||
autocomplete = layui.autocomplete;
|
||||
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.quick/index',
|
||||
add_url: 'system.quick/add',
|
||||
edit_url: 'system.quick/edit',
|
||||
delete_url: 'system.quick/delete',
|
||||
export_url: 'system.quick/export',
|
||||
modify_url: 'system.quick/modify',
|
||||
};
|
||||
23
app/admin/view/system/quick/add.js
Normal file
23
app/admin/view/system/quick/add.js
Normal file
@@ -0,0 +1,23 @@
|
||||
$(function () {
|
||||
iconPickerFa.render({
|
||||
elem: '#icon',
|
||||
url: PATH_CONFIG.iconLess,
|
||||
limit: 12,
|
||||
click: function (data) {
|
||||
$('#icon').val('fa ' + data.icon);
|
||||
},
|
||||
success: function (d) {
|
||||
console.log(d);
|
||||
}
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{d.node}}',
|
||||
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
23
app/admin/view/system/quick/edit.js
Normal file
23
app/admin/view/system/quick/edit.js
Normal file
@@ -0,0 +1,23 @@
|
||||
$(function () {
|
||||
iconPickerFa.render({
|
||||
elem: '#icon',
|
||||
url: PATH_CONFIG.iconLess,
|
||||
limit: 12,
|
||||
click: function (data) {
|
||||
$('#icon').val('fa ' + data.icon);
|
||||
},
|
||||
success: function (d) {
|
||||
console.log(d);
|
||||
}
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{d.node}}',
|
||||
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
20
app/admin/view/system/quick/index.js
Normal file
20
app/admin/view/system/quick/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$(function () {
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{type: "checkbox"},
|
||||
{field: 'id', width: 80, title: 'ID'},
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{field: 'title', minWidth: 80, title: '权限名称'},
|
||||
{field: 'icon', width: 80, title: '图标', templet: ua.table.icon},
|
||||
{field: 'href', minWidth: 120, title: '快捷链接'},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{width: 250, title: '操作', templet: ua.table.tool, operat: ['edit', 'delete']}
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
10
app/admin/view/system/uploadfile/_common.js
Normal file
10
app/admin/view/system/uploadfile/_common.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.uploadfile/index',
|
||||
add_url: 'system.uploadfile/add',
|
||||
edit_url: 'system.uploadfile/edit',
|
||||
delete_url: 'system.uploadfile/delete',
|
||||
modify_url: 'system.uploadfile/modify',
|
||||
export_url: 'system.uploadfile/export',
|
||||
};
|
||||
4
app/admin/view/system/uploadfile/add.js
Normal file
4
app/admin/view/system/uploadfile/add.js
Normal file
@@ -0,0 +1,4 @@
|
||||
$(function () {
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
34
app/admin/view/system/uploadfile/index.js
Normal file
34
app/admin/view/system/uploadfile/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
$(function () {
|
||||
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: { 'local': '本地', 'alioss': '阿里云', 'qnoss': '七牛云', ',txcos': '腾讯云' } },
|
||||
{ field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ua.table.filePreview },
|
||||
{
|
||||
field: 'url', minWidth: 120, title: '保存地址', templet: ua.table.url, urlNameField: function (data) {
|
||||
return data.url;
|
||||
}
|
||||
},
|
||||
{ field: 'original_name', minWidth: 80, title: '文件原名' },
|
||||
{ field: 'mime_type', minWidth: 80, title: 'mime类型' },
|
||||
{ field: 'file_ext', minWidth: 80, title: '文件后缀' },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250, title: '操作', templet: ua.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
|
||||
var selectMode = ua.getQueryVariable("select_mode");
|
||||
|
||||
console.log(selectMode);
|
||||
if (selectMode == 'radio' || selectMode == 'checkbox') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
});
|
||||
@@ -274,7 +274,7 @@ function event_view_content($name)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$content.= $value_event['view_content'];
|
||||
$content .= $value_event['view_content'];
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
@@ -9,6 +9,7 @@ use app\common\service\AuthService;
|
||||
use think\facade\Env;
|
||||
use think\facade\View;
|
||||
use think\Model;
|
||||
use think\template\exception\TemplateNotFoundException;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
@@ -140,6 +141,29 @@ class AdminController extends BaseController
|
||||
return $this->app->view->assign($name, $value);
|
||||
}
|
||||
|
||||
protected function fetchJS()
|
||||
{
|
||||
$content_js = '';
|
||||
|
||||
try {
|
||||
$content_js .= View::layout(false)
|
||||
->config([
|
||||
'view_suffix' => 'js',
|
||||
])->fetch('_common');
|
||||
|
||||
$content_js .= View::layout(false)
|
||||
->config([
|
||||
'view_suffix' => 'js',
|
||||
])->fetch();
|
||||
} catch (TemplateNotFoundException $th) {
|
||||
if (Env::get('adminsystem.strict_view_js', true)) {
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
|
||||
return "<script>{$content_js}</script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析和获取模板内容 用于输出.
|
||||
* @param string $template
|
||||
@@ -150,7 +174,17 @@ class AdminController extends BaseController
|
||||
{
|
||||
$this->assign('data_brage', json_encode($this->dataBrage));
|
||||
|
||||
return $this->app->view->fetch($template, $vars);
|
||||
$vars['content_js'] = $this->fetchJS();
|
||||
|
||||
$content_main = View::layout($this->layout)
|
||||
->config([
|
||||
'view_suffix' => 'html',
|
||||
])->fetch($template, $vars);
|
||||
|
||||
$html = '';
|
||||
$html .= $content_main;
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,4 +36,16 @@ class View extends ThinkView
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置模板引擎.
|
||||
* @param array $config 参数
|
||||
* @return $this
|
||||
*/
|
||||
public function config(array $config)
|
||||
{
|
||||
$this->driver()->config($config);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\App;
|
||||
class PathTools
|
||||
{
|
||||
/**
|
||||
* 系统生成的文件,这些文件应当是可以任意删除的
|
||||
* 系统生成的文件,这些文件应当是可以任意删除的.
|
||||
*
|
||||
* @param string $file_name
|
||||
* @return string
|
||||
@@ -49,6 +49,29 @@ class PathTools
|
||||
if (!is_dir($dir_name)) {
|
||||
mkdir($dir_name, 0777, true);
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
public static function mapDir($dir, $callback = null)
|
||||
{
|
||||
$result = [];
|
||||
$cdir = scandir($dir);
|
||||
foreach ($cdir as $key => $value) {
|
||||
if (!in_array($value, ['.', '..'])) {
|
||||
$current_path = $dir . DS . $value;
|
||||
if (is_dir($current_path)) {
|
||||
$result[$value] = self::mapDir($current_path, $callback);
|
||||
} else {
|
||||
if (is_callable($callback)) {
|
||||
$result[$value] = $callback($current_path, $value, $dir);
|
||||
} else {
|
||||
$result[$value] = $current_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 模板设置
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -7,29 +8,29 @@ use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 模板引擎类型使用Think
|
||||
'type' => 'Think',
|
||||
'type' => 'Think',
|
||||
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||
'auto_rule' => 1,
|
||||
'auto_rule' => 1,
|
||||
// 模板目录名
|
||||
'view_dir_name' => 'view',
|
||||
// 模板后缀
|
||||
'view_suffix' => 'html',
|
||||
'view_suffix' => 'html',
|
||||
// 模板文件名分隔符
|
||||
'view_depr' => DIRECTORY_SEPARATOR,
|
||||
'view_depr' => DIRECTORY_SEPARATOR,
|
||||
// 模板引擎普通标签开始标记
|
||||
'tpl_begin' => '{',
|
||||
'tpl_begin' => '{',
|
||||
// 模板引擎普通标签结束标记
|
||||
'tpl_end' => '}',
|
||||
'tpl_end' => '}',
|
||||
// 标签库标签开始标记
|
||||
'taglib_begin' => '{',
|
||||
'taglib_begin' => '{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}',
|
||||
'taglib_end' => '}',
|
||||
// 模板缓存
|
||||
'display_cache' => true,
|
||||
// 字符替换
|
||||
'tpl_replace_string' => [
|
||||
'__STATIC__' => Env::get('adminsystem.static_path', '/static'),
|
||||
'__JS__' => '/static/javascript',
|
||||
'__JS__' => '/static/javascript',
|
||||
],
|
||||
'default_filter' => 'ua_htmlentities', // 默认过滤方法 用于普通标签输出
|
||||
'default_filter' => 'ua_htmlentities', // 默认过滤方法 用于普通标签输出
|
||||
];
|
||||
|
||||
@@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
index: function () {
|
||||
var uidList = [];
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
size: 'sm',
|
||||
limit: 50,
|
||||
@@ -51,13 +51,13 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -3,8 +3,8 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var options = {
|
||||
iniUrl: ea.url('ajax/initAdmin'), // 初始化接口
|
||||
clearUrl: ea.url("ajax/clearCache"), // 缓存清理接口
|
||||
iniUrl: ua.url('ajax/initAdmin'), // 初始化接口
|
||||
clearUrl: ua.url("ajax/clearCache"), // 缓存清理接口
|
||||
urlHashLocation: true, // 是否打开hash定位
|
||||
bgColorDefault: false, // 主题默认配置
|
||||
multiModule: true, // 是否开启多模块
|
||||
@@ -16,12 +16,12 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
|
||||
miniAdmin.render(options);
|
||||
|
||||
$('.login-out').on("click", function () {
|
||||
ea.request.get({
|
||||
ua.request.get({
|
||||
url: 'login/out',
|
||||
prefix: true,
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
window.location = ea.url('login/index');
|
||||
ua.msg.success(res.msg, function () {
|
||||
window.location = ua.url('login/index');
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -108,13 +108,13 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi
|
||||
clearInterval(checkChartVisibleTimer)
|
||||
}
|
||||
}, 3000);
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
editAdmin: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
editPassword: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -3,49 +3,7 @@ define(["easy-admin"], function (ea) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
|
||||
if (top.location !== self.location) {
|
||||
top.location = self.location;
|
||||
}
|
||||
|
||||
$('.bind-password').on('click', function () {
|
||||
if ($(this).hasClass('icon-5')) {
|
||||
$(this).removeClass('icon-5');
|
||||
$("input[name='password']").attr('type', 'password');
|
||||
} else {
|
||||
$(this).addClass('icon-5');
|
||||
$("input[name='password']").attr('type', 'text');
|
||||
}
|
||||
});
|
||||
|
||||
$('.icon-nocheck').on('click', function () {
|
||||
if ($(this).hasClass('icon-check')) {
|
||||
$(this).removeClass('icon-check');
|
||||
} else {
|
||||
$(this).addClass('icon-check');
|
||||
}
|
||||
});
|
||||
|
||||
$('.login-tip').on('click', function () {
|
||||
$('.icon-nocheck').click();
|
||||
});
|
||||
|
||||
ea.listen(function (data) {
|
||||
data['keep_login'] = $('.icon-nocheck').hasClass('icon-check') ? 1 : 0;
|
||||
return data;
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
window.location = ea.url('index');
|
||||
})
|
||||
}, function (res) {
|
||||
ea.msg.error(res.msg, function () {
|
||||
$('#refreshCaptcha').trigger("click");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('.forget-password').click(function () {
|
||||
layer.msg('可以使用重置密码命令设置:<br/>php think admin:resetPassword<br><a target="_blank" href="http://doc.ulthon.com/home/read/ulthon_admin/reset_password/15/16.html"> 参考文档</a>')
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
@@ -14,28 +14,28 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{type: "checkbox"},
|
||||
{field: 'id', width: 80, title: 'ID'},
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{field: 'title', minWidth: 80, title: '分类名称'},
|
||||
{field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image},
|
||||
{field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{width: 250, title: '操作', templet: ea.table.tool}
|
||||
{width: 250, title: '操作', templet: ua.table.tool}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -17,21 +17,21 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
totalRow: true,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID', totalRowText: '合计:' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ 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: 'cate_id', minWidth: 80, title: '商品分类', selectList: ua.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ua.getQueryVariable('cate_id', '') },
|
||||
{ field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image },
|
||||
{ field: 'title', minWidth: 80, title: '商品名称', },
|
||||
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ea.table.image },
|
||||
{ field: 'market_price', width: 100, title: '市场价', templet: ea.table.price },
|
||||
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ua.table.image },
|
||||
{ field: 'market_price', width: 100, title: '市场价', templet: ua.table.price },
|
||||
{
|
||||
field: 'discount_price', width: 120, title: '折扣价', templet: ea.table.price, totalRow: true,
|
||||
templet: ea.table.copyText,
|
||||
field: 'discount_price', width: 120, title: '折扣价', templet: ua.table.price, totalRow: true,
|
||||
templet: ua.table.copyText,
|
||||
valueParser(value) {
|
||||
return '¥' + value
|
||||
},
|
||||
@@ -53,12 +53,12 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
},
|
||||
{ field: 'virtual_sales', width: 100, title: '虚拟销量' },
|
||||
{ field: 'sales', width: 80, title: '销量' },
|
||||
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
|
||||
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
templet: ua.table.tool,
|
||||
fixed: 'right',
|
||||
operat: [
|
||||
'edit',
|
||||
@@ -81,19 +81,19 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
stock: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
read: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -14,23 +14,23 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{type: 'checkbox'},
|
||||
{field: 'id', title: 'id'},
|
||||
{field: 'title', title: '名称'},
|
||||
{width: 250, title: '操作', templet: ea.table.tool},
|
||||
{width: 250, title: '操作', templet: ua.table.tool},
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -12,10 +12,10 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
password_url: 'system.admin/password',
|
||||
};
|
||||
|
||||
var authList = ea.getDataBrage('auth_list', []);
|
||||
var count = ea.getDataBrage('count', 0);
|
||||
var tips = ea.getDataBrage('tips', '');
|
||||
var tips = ea.getDataBrage('adminCustomFlag');
|
||||
var authList = ua.getDataBrage('auth_list', []);
|
||||
var count = ua.getDataBrage('count', 0);
|
||||
var tips = ua.getDataBrage('tips', '');
|
||||
var tips = ua.getDataBrage('adminCustomFlag');
|
||||
|
||||
console.log(authList);
|
||||
console.log(count);
|
||||
@@ -25,24 +25,24 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
index: function () {
|
||||
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||||
{ field: 'username', minWidth: 80, title: '登录账户' },
|
||||
{ field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ea.table.image },
|
||||
{ field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ua.table.image },
|
||||
{ field: 'phone', minWidth: 80, title: '手机' },
|
||||
{ field: 'login_num', minWidth: 80, title: '登录次数' },
|
||||
{ field: 'remark', minWidth: 80, title: '备注信息', defaultValue: '无' },
|
||||
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
|
||||
{ field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
templet: ea.table.tool,
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
@@ -59,16 +59,16 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
password: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{type: "checkbox"},
|
||||
@@ -23,12 +23,12 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{field: 'title', minWidth: 80, title: '权限名称'},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
@@ -44,18 +44,18 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
authorize: function () {
|
||||
var tree = layui.tree;
|
||||
|
||||
ea.request.get(
|
||||
ua.request.get(
|
||||
{
|
||||
url: window.location.href,
|
||||
}, function (res) {
|
||||
@@ -69,7 +69,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
}
|
||||
);
|
||||
|
||||
ea.listen(function (data) {
|
||||
ua.listen(function (data) {
|
||||
var checkedData = tree.getChecked('nodeDataId');
|
||||
var ids = [];
|
||||
$.each(checkedData, function (i, v) {
|
||||
|
||||
@@ -13,7 +13,7 @@ define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {
|
||||
$('.show-type-item.' + this.value).show();
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -26,18 +26,18 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
homdPid: 99999999,
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
url: ea.url(init.index_url),
|
||||
url: ua.url(init.index_url),
|
||||
elem: init.table_elem,
|
||||
id: init.table_render_id,
|
||||
toolbar: '#toolbar',
|
||||
page: false,
|
||||
skin: 'line',
|
||||
|
||||
// @todo 不直接使用ea.table.render(); 进行表格初始化, 需要使用 ea.table.formatCols(); 方法格式化`cols`列数据
|
||||
cols: ea.table.formatCols([[
|
||||
// @todo 不直接使用ua.table.render(); 进行表格初始化, 需要使用 ua.table.formatCols(); 方法格式化`cols`列数据
|
||||
cols: ua.table.formatCols([[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'title', sort: false, width: 250, title: '菜单名称', align: 'left' },
|
||||
{ field: 'icon', sort: false, width: 80, title: '图标', templet: ea.table.icon },
|
||||
{ field: 'icon', sort: false, width: 80, title: '图标', templet: ua.table.icon },
|
||||
{ field: 'href', sort: false, minWidth: 120, title: '菜单链接' },
|
||||
{
|
||||
field: 'is_home', sort: false,
|
||||
@@ -54,13 +54,13 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'status', sort: false, title: '状态', width: 85, templet: ea.table.switch },
|
||||
{ field: 'status', sort: false, title: '状态', width: 85, templet: ua.table.switch },
|
||||
{ field: 'sort', sort: false, width: 80, title: '排序', edit: 'text' },
|
||||
{
|
||||
width: 220,
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
templet: ea.table.tool,
|
||||
templet: ua.table.tool,
|
||||
operat: [
|
||||
[{
|
||||
text: '添加下级',
|
||||
@@ -94,7 +94,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
data: ['id', 'title'],
|
||||
_if(data) {
|
||||
|
||||
if (data.pid == ea.getDataBrage('menu_home_pid')) {
|
||||
if (data.pid == ua.getDataBrage('menu_home_pid')) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -126,15 +126,15 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
$('body').on('click', '[data-treetable-delete-item]', function () {
|
||||
var id = $(this).data('id');
|
||||
var url = $(this).attr('data-url');
|
||||
url = url != undefined ? ea.url(url) : window.location.href;
|
||||
ea.msg.confirm('确定删除?', function () {
|
||||
ea.request.post({
|
||||
url = url != undefined ? ua.url(url) : window.location.href;
|
||||
ua.msg.confirm('确定删除?', function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
renderTable();
|
||||
});
|
||||
});
|
||||
@@ -146,25 +146,25 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
var tableId = $(this).attr('data-treetable-delete'),
|
||||
url = $(this).attr('data-url');
|
||||
tableId = tableId || init.table_render_id;
|
||||
url = url != undefined ? ea.url(url) : window.location.href;
|
||||
url = url != undefined ? ua.url(url) : window.location.href;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ea.msg.error('请勾选需要删除的数据');
|
||||
ua.msg.error('请勾选需要删除的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
$.each(data, function (i, v) {
|
||||
ids.push(v.id);
|
||||
});
|
||||
ea.msg.confirm('确定删除?', function () {
|
||||
ea.request.post({
|
||||
ua.msg.confirm('确定删除?', function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: ids
|
||||
},
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
renderTable();
|
||||
});
|
||||
});
|
||||
@@ -172,11 +172,11 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
return false;
|
||||
});
|
||||
|
||||
ea.table.listenSwitch({ filter: 'status', url: init.modify_url });
|
||||
ua.table.listenSwitch({ filter: 'status', url: init.modify_url });
|
||||
|
||||
ea.table.listenEdit(init, 'currentTable', init.table_render_id, false);
|
||||
ua.table.listenEdit(init, 'currentTable', init.table_render_id, false);
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
iconPickerFa.render({
|
||||
@@ -192,17 +192,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ea.url('system.menu/getMenuTips'),
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{-d.node}}',
|
||||
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ea.listen(function (data) {
|
||||
ua.listen(function (data) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
@@ -223,17 +223,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ea.url('system.menu/getMenuTips'),
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{-d.node}}',
|
||||
template_txt: '{{-d.node}} <span class=\'layui-badge layui-bg-gray\'>{{-d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ea.listen(function (data) {
|
||||
ua.listen(function (data) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
|
||||
@@ -13,7 +13,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
search: false,
|
||||
page: false,
|
||||
@@ -52,17 +52,17 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
{ field: 'node', sort: false, minWidth: 200, align: 'left', title: '系统节点' },
|
||||
{ field: 'title', sort: false, minWidth: 80, title: '节点名称 <i class="table-edit-tips color-red">*</i>', edit: 'text' },
|
||||
{ field: 'update_time', sort: false, minWidth: 80, title: '更新时间', search: 'range' },
|
||||
{ field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch },
|
||||
{ field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -17,23 +17,23 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{type: "checkbox"},
|
||||
{field: 'id', width: 80, title: 'ID'},
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{field: 'title', minWidth: 80, title: '权限名称'},
|
||||
{field: 'icon', width: 80, title: '图标', templet: ea.table.icon},
|
||||
{field: 'icon', width: 80, title: '图标', templet: ua.table.icon},
|
||||
{field: 'href', minWidth: 120, title: '快捷链接'},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{width: 250, title: '操作', templet: ea.table.tool, operat: ['edit', 'delete']}
|
||||
{width: 250, title: '操作', templet: ua.table.tool, operat: ['edit', 'delete']}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
iconPickerFa.render({
|
||||
@@ -49,14 +49,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ea.url('system.menu/getMenuTips'),
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{d.node}}',
|
||||
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
iconPickerFa.render({
|
||||
@@ -72,14 +72,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea
|
||||
});
|
||||
autocomplete.render({
|
||||
elem: $('#href')[0],
|
||||
url: ea.url('system.menu/getMenuTips'),
|
||||
url: ua.url('system.menu/getMenuTips'),
|
||||
template_val: '{{d.node}}',
|
||||
template_txt: '{{d.node}} <span class=\'layui-badge layui-bg-gray\'>{{d.title}}</span>',
|
||||
onselect: function (resp) {
|
||||
}
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -14,15 +14,15 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
ua.table.render({
|
||||
init: init,
|
||||
cols: [[
|
||||
{ type: "checkbox" },
|
||||
{ field: 'id', width: 80, title: 'ID' },
|
||||
{ field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: { 'local': '本地', 'alioss': '阿里云', 'qnoss': '七牛云', ',txcos': '腾讯云' } },
|
||||
{ field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ea.table.filePreview },
|
||||
{ field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ua.table.filePreview },
|
||||
{
|
||||
field: 'url', minWidth: 120, title: '保存地址', templet: ea.table.url, urlNameField: function (data) {
|
||||
field: 'url', minWidth: 120, title: '保存地址', templet: ua.table.url, urlNameField: function (data) {
|
||||
return data.url;
|
||||
}
|
||||
},
|
||||
@@ -31,8 +31,8 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
{ field: 'file_ext', minWidth: 80, title: '文件后缀' },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{
|
||||
width: 250, title: '操作', templet: ea.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
|
||||
var selectMode = ea.getQueryVariable("select_mode");
|
||||
width: 250, title: '操作', templet: ua.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
|
||||
var selectMode = ua.getQueryVariable("select_mode");
|
||||
|
||||
console.log(selectMode);
|
||||
if (selectMode == 'radio' || selectMode == 'checkbox') {
|
||||
@@ -44,16 +44,16 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
},
|
||||
password: function () {
|
||||
ea.listen();
|
||||
ua.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini 主体框架扩展
|
||||
*/
|
||||
|
||||
|
||||
define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, miniTheme, miniTab) {
|
||||
(function () {
|
||||
|
||||
var $ = layui.$,
|
||||
layer = layui.layer,
|
||||
element = layui.element;
|
||||
element = layui.element
|
||||
miniMenu = window.miniMenu
|
||||
miniTheme = window.miniTheme
|
||||
miniTab = window.miniTab;
|
||||
|
||||
if (!/http(s*):\/\//.test(location.href)) {
|
||||
var tips = "请先将项目部署至web容器(Apache/Tomcat/Nginx/IIS/等),否则部分数据将无法显示";
|
||||
@@ -108,7 +103,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
* @param clearUrl
|
||||
*/
|
||||
renderClear: function (clearUrl) {
|
||||
$('.layuimini-clear').attr('data-href',clearUrl);
|
||||
$('.layuimini-clear').attr('data-href', clearUrl);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -175,7 +170,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
el.msExitFullscreen();
|
||||
} else if (el.oRequestFullscreen) {
|
||||
el.oCancelFullScreen();
|
||||
}else if (el.mozCancelFullScreen) {
|
||||
} else if (el.mozCancelFullScreen) {
|
||||
el.mozCancelFullScreen();
|
||||
} else if (el.webkitCancelFullScreen) {
|
||||
el.webkitCancelFullScreen();
|
||||
@@ -211,7 +206,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
* @returns {*}
|
||||
*/
|
||||
success: function (title) {
|
||||
return layer.msg(title, {icon: 1, shade: this.shade, scrollbar: false, time: 2000, shadeClose: true});
|
||||
return layer.msg(title, { icon: 1, shade: this.shade, scrollbar: false, time: 2000, shadeClose: true });
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -220,7 +215,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
* @returns {*}
|
||||
*/
|
||||
error: function (title) {
|
||||
return layer.msg(title, {icon: 2, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true});
|
||||
return layer.msg(title, { icon: 2, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true });
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -251,7 +246,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
* 清理
|
||||
*/
|
||||
$('body').on('click', '[data-clear]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
sessionStorage.clear();
|
||||
|
||||
// 判断是否清理服务端
|
||||
@@ -293,14 +288,14 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
tips = $(this).prop("innerHTML"),
|
||||
isShow = $('.layuimini-tool i').attr('data-side-fold');
|
||||
if (isShow == 0 && tips) {
|
||||
tips = "<ul class='layuimini-menu-left-zoom layui-nav layui-nav-tree layui-this'><li class='layui-nav-item layui-nav-itemed'>"+tips+"</li></ul>" ;
|
||||
tips = "<ul class='layuimini-menu-left-zoom layui-nav layui-nav-tree layui-this'><li class='layui-nav-item layui-nav-itemed'>" + tips + "</li></ul>";
|
||||
window.openTips = layer.tips(tips, $(this), {
|
||||
tips: [2, '#2f4056'],
|
||||
time: 300000,
|
||||
skin:"popup-tips",
|
||||
success:function (el) {
|
||||
var left = $(el).position().left - 10 ;
|
||||
$(el).css({ left:left });
|
||||
skin: "popup-tips",
|
||||
success: function (el) {
|
||||
var left = $(el).position().left - 10;
|
||||
$(el).css({ left: left });
|
||||
element.render();
|
||||
}
|
||||
});
|
||||
@@ -350,5 +345,5 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi
|
||||
|
||||
|
||||
|
||||
return miniAdmin;
|
||||
});
|
||||
window.miniAdmin = miniAdmin;
|
||||
})()
|
||||
@@ -1,12 +1,6 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini 菜单框架扩展
|
||||
*/
|
||||
define(["jquery"], function ($) {
|
||||
(function () {
|
||||
var element = layui.element,
|
||||
laytpl = layui.laytpl,
|
||||
laytpl = layui.laytpl,
|
||||
layer = layui.layer;
|
||||
|
||||
var miniMenu = {
|
||||
@@ -39,9 +33,9 @@ define(["jquery"], function ($) {
|
||||
var leftMenuHtml = '',
|
||||
childOpenClass = '',
|
||||
leftMenuCheckDefault = 'layui-this';
|
||||
var me = this ;
|
||||
var me = this;
|
||||
if (menuChildOpen) childOpenClass = ' layui-nav-itemed';
|
||||
leftMenuHtml = this.renderLeftMenu(menuList,{ childOpenClass:childOpenClass }) ;
|
||||
leftMenuHtml = this.renderLeftMenu(menuList, { childOpenClass: childOpenClass });
|
||||
$('.layui-layout-body').addClass('layuimini-single-module'); //单模块标识
|
||||
$('.layuimini-header-menu').remove();
|
||||
$('.layuimini-menu-left').html(leftMenuHtml);
|
||||
@@ -52,63 +46,63 @@ define(["jquery"], function ($) {
|
||||
/**
|
||||
* 渲染一级菜单
|
||||
*/
|
||||
compileMenu: function(menu,isSub){
|
||||
var menuHtml = '<li {{#if( d.menu){ }} data-menu="{{-d.menu}}" {{#}}} class="layui-nav-item menu-li {{-d.childOpenClass}} {{-d.className}}" {{#if( d.id){ }} id="{{-d.id}}" {{#}}}> <a {{#if( d.href){ }} layuimini-href="{{-d.href}}" {{#}}} {{#if( d.target){ }} target="{{-d.target}}" {{#}}} href="javascript:;">{{#if( d.icon){ }} <i class="{{-d.icon}}"></i> {{#}}} <span class="layui-left-nav">{{-d.title}}</span></a> {{# if(d.children){}} {{-d.children}} {{#}}} </li>' ;
|
||||
if(isSub){
|
||||
menuHtml = '<dd class="menu-dd {{-d.childOpenClass}} {{- d.className }}"> <a href="javascript:;" {{#if( d.menu){ }} data-menu="{{-d.menu}}" {{#}}} {{#if( d.id){ }} id="{{-d.id}}" {{#}}} {{#if(( !d.child || !d.child.length ) && d.href){ }} layuimini-href="{{-d.href}}" {{#}}} {{#if( d.target){ }} target="{{-d.target}}" {{#}}}> {{#if( d.icon){ }} <i class="{{-d.icon}}"></i> {{#}}} <span class="layui-left-nav"> {{-d.title}}</span></a> {{# if(d.children){}} {{-d.children}} {{#}}}</dd>'
|
||||
compileMenu: function (menu, isSub) {
|
||||
var menuHtml = '<li {{#if( d.menu){ }} data-menu="{{-d.menu}}" {{#}}} class="layui-nav-item menu-li {{-d.childOpenClass}} {{-d.className}}" {{#if( d.id){ }} id="{{-d.id}}" {{#}}}> <a {{#if( d.href){ }} layuimini-href="{{-d.href}}" {{#}}} {{#if( d.target){ }} target="{{-d.target}}" {{#}}} href="javascript:;">{{#if( d.icon){ }} <i class="{{-d.icon}}"></i> {{#}}} <span class="layui-left-nav">{{-d.title}}</span></a> {{# if(d.children){}} {{-d.children}} {{#}}} </li>';
|
||||
if (isSub) {
|
||||
menuHtml = '<dd class="menu-dd {{-d.childOpenClass}} {{- d.className }}"> <a href="javascript:;" {{#if( d.menu){ }} data-menu="{{-d.menu}}" {{#}}} {{#if( d.id){ }} id="{{-d.id}}" {{#}}} {{#if(( !d.child || !d.child.length ) && d.href){ }} layuimini-href="{{-d.href}}" {{#}}} {{#if( d.target){ }} target="{{-d.target}}" {{#}}}> {{#if( d.icon){ }} <i class="{{-d.icon}}"></i> {{#}}} <span class="layui-left-nav"> {{-d.title}}</span></a> {{# if(d.children){}} {{-d.children}} {{#}}}</dd>';
|
||||
}
|
||||
return laytpl(menuHtml).render(menu);
|
||||
},
|
||||
compileMenuContainer :function(menu,isSub){
|
||||
var wrapperHtml = '<ul class="layui-nav layui-nav-tree layui-left-nav-tree {{-d.className}}" id="{{-d.id}}">{{-d.children}}</ul>' ;
|
||||
if(isSub){
|
||||
wrapperHtml = '<dl class="layui-nav-child ">{{-d.children}}</dl>' ;
|
||||
compileMenuContainer: function (menu, isSub) {
|
||||
var wrapperHtml = '<ul class="layui-nav layui-nav-tree layui-left-nav-tree {{-d.className}}" id="{{-d.id}}">{{-d.children}}</ul>';
|
||||
if (isSub) {
|
||||
wrapperHtml = '<dl class="layui-nav-child ">{{-d.children}}</dl>';
|
||||
}
|
||||
if(!menu.children){
|
||||
if (!menu.children) {
|
||||
return "";
|
||||
}
|
||||
return laytpl(wrapperHtml).render(menu);
|
||||
},
|
||||
|
||||
each:function(list,callback){
|
||||
each: function (list, callback) {
|
||||
var _list = [];
|
||||
for(var i = 0 ,length = list.length ; i<length ;i++ ){
|
||||
_list[i] = callback(i,list[i]) ;
|
||||
for (var i = 0, length = list.length; i < length; i++) {
|
||||
_list[i] = callback(i, list[i]);
|
||||
}
|
||||
return _list ;
|
||||
return _list;
|
||||
},
|
||||
renderChildrenMenu:function(menuList,options){
|
||||
var me = this ;
|
||||
menuList = menuList || [] ;
|
||||
var html = this.each(menuList,function (idx,menu) {
|
||||
if(menu.child && menu.child.length){
|
||||
menu.children = me.renderChildrenMenu(menu.child,{ childOpenClass: options.childOpenClass || '' });
|
||||
renderChildrenMenu: function (menuList, options) {
|
||||
var me = this;
|
||||
menuList = menuList || [];
|
||||
var html = this.each(menuList, function (idx, menu) {
|
||||
if (menu.child && menu.child.length) {
|
||||
menu.children = me.renderChildrenMenu(menu.child, { childOpenClass: options.childOpenClass || '' });
|
||||
}
|
||||
menu.className = "" ;
|
||||
menu.childOpenClass = options.childOpenClass || ''
|
||||
return me.compileMenu(menu,true)
|
||||
menu.className = "";
|
||||
menu.childOpenClass = options.childOpenClass || '';
|
||||
return me.compileMenu(menu, true);
|
||||
}).join("");
|
||||
return me.compileMenuContainer({ children:html },true)
|
||||
return me.compileMenuContainer({ children: html }, true);
|
||||
},
|
||||
renderLeftMenu :function(leftMenus,options){
|
||||
renderLeftMenu: function (leftMenus, options) {
|
||||
options = options || {};
|
||||
var me = this ;
|
||||
var leftMenusHtml = me.each(leftMenus || [],function (idx,leftMenu) { // 左侧菜单遍历
|
||||
var children = me.renderChildrenMenu(leftMenu.child, { childOpenClass:options.childOpenClass });
|
||||
var me = this;
|
||||
var leftMenusHtml = me.each(leftMenus || [], function (idx, leftMenu) { // 左侧菜单遍历
|
||||
var children = me.renderChildrenMenu(leftMenu.child, { childOpenClass: options.childOpenClass });
|
||||
var leftMenuHtml = me.compileMenu({
|
||||
href:leftMenu.href,
|
||||
target:leftMenu.target,
|
||||
childOpenClass:options.childOpenClass,
|
||||
icon:leftMenu.icon,
|
||||
title:leftMenu.title,
|
||||
children:children,
|
||||
href: leftMenu.href,
|
||||
target: leftMenu.target,
|
||||
childOpenClass: options.childOpenClass,
|
||||
icon: leftMenu.icon,
|
||||
title: leftMenu.title,
|
||||
children: children,
|
||||
className: '',
|
||||
});
|
||||
return leftMenuHtml ;
|
||||
return leftMenuHtml;
|
||||
}).join("");
|
||||
|
||||
leftMenusHtml = me.compileMenuContainer({ id:options.parentMenuId,className:options.leftMenuCheckDefault,children:leftMenusHtml }) ;
|
||||
return leftMenusHtml ;
|
||||
leftMenusHtml = me.compileMenuContainer({ id: options.parentMenuId, className: options.leftMenuCheckDefault, children: leftMenusHtml });
|
||||
return leftMenusHtml;
|
||||
},
|
||||
/**
|
||||
* 多模块
|
||||
@@ -117,7 +111,7 @@ define(["jquery"], function ($) {
|
||||
*/
|
||||
renderMultiModule: function (menuList, menuChildOpen) {
|
||||
menuList = menuList || [];
|
||||
var me = this ;
|
||||
var me = this;
|
||||
var headerMenuHtml = '',
|
||||
headerMobileMenuHtml = '',
|
||||
leftMenuHtml = '',
|
||||
@@ -127,27 +121,27 @@ define(["jquery"], function ($) {
|
||||
|
||||
if (menuChildOpen) childOpenClass = ' layui-nav-itemed';
|
||||
var headerMenuHtml = this.each(menuList, function (index, val) { //顶部菜单渲染
|
||||
var menu = 'multi_module_' + index ;
|
||||
var id = menu+"HeaderId";
|
||||
var topMenuItemHtml = "" ;
|
||||
var menu = 'multi_module_' + index;
|
||||
var id = menu + "HeaderId";
|
||||
var topMenuItemHtml = "";
|
||||
topMenuItemHtml = me.compileMenu({
|
||||
className:headerMenuCheckDefault,
|
||||
menu:menu,
|
||||
id:id,
|
||||
title:val.title,
|
||||
href:"",
|
||||
target:"",
|
||||
children:""
|
||||
className: headerMenuCheckDefault,
|
||||
menu: menu,
|
||||
id: id,
|
||||
title: val.title,
|
||||
href: "",
|
||||
target: "",
|
||||
children: ""
|
||||
});
|
||||
leftMenuHtml+=me.renderLeftMenu(val.child,{
|
||||
parentMenuId:menu,
|
||||
childOpenClass:childOpenClass,
|
||||
leftMenuCheckDefault:leftMenuCheckDefault
|
||||
leftMenuHtml += me.renderLeftMenu(val.child, {
|
||||
parentMenuId: menu,
|
||||
childOpenClass: childOpenClass,
|
||||
leftMenuCheckDefault: leftMenuCheckDefault
|
||||
});
|
||||
headerMobileMenuHtml +=me.compileMenu({ id:id,menu:menu,id:id,icon:val.icon, title:val.title, },true);
|
||||
headerMobileMenuHtml += me.compileMenu({ id: id, menu: menu, id: id, icon: val.icon, title: val.title, }, true);
|
||||
headerMenuCheckDefault = "";
|
||||
leftMenuCheckDefault = "layui-hide" ;
|
||||
return topMenuItemHtml ;
|
||||
leftMenuCheckDefault = "layui-hide";
|
||||
return topMenuItemHtml;
|
||||
}).join("");
|
||||
$('.layui-layout-body').addClass('layuimini-multi-module'); //多模块标识
|
||||
$('.layuimini-menu-header-pc').html(headerMenuHtml); //电脑
|
||||
@@ -165,7 +159,7 @@ define(["jquery"], function ($) {
|
||||
* 菜单模块切换
|
||||
*/
|
||||
$('body').on('click', '[data-menu]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var menuId = $(this).attr('data-menu');
|
||||
// header
|
||||
$(".layuimini-header-menu .layui-nav-item.layui-this").removeClass('layui-this');
|
||||
@@ -182,7 +176,7 @@ define(["jquery"], function ($) {
|
||||
* 菜单缩放
|
||||
*/
|
||||
$('body').on('click', '.layuimini-site-mobile', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var isShow = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
if (isShow == 1) { // 缩放
|
||||
$('.layuimini-tool [data-side-fold]').attr('data-side-fold', 0);
|
||||
@@ -203,7 +197,7 @@ define(["jquery"], function ($) {
|
||||
* 菜单缩放
|
||||
*/
|
||||
$('body').on('click', '[data-side-fold]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var isShow = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
if (isShow == 1) { // 缩放
|
||||
$('.layuimini-tool [data-side-fold]').attr('data-side-fold', 0);
|
||||
@@ -232,9 +226,9 @@ define(["jquery"], function ($) {
|
||||
* 手机端点开模块
|
||||
*/
|
||||
$('body').on('click', '.layuimini-header-menu.layuimini-mobile-show dd', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var check = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
if(check === "1"){
|
||||
if (check === "1") {
|
||||
$('.layuimini-site-mobile').trigger("click");
|
||||
element.init();
|
||||
}
|
||||
@@ -245,5 +239,5 @@ define(["jquery"], function ($) {
|
||||
};
|
||||
|
||||
|
||||
return miniMenu;
|
||||
});
|
||||
window.miniMenu = miniMenu;
|
||||
})();
|
||||
@@ -1,16 +1,8 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini tab框架扩展
|
||||
*/
|
||||
define(["jquery"], function ($) {
|
||||
var element = layui.element,
|
||||
$ = layui.$;
|
||||
|
||||
(function () {
|
||||
var element = layui.element;
|
||||
$ = layui.$;
|
||||
|
||||
var miniTab = {
|
||||
|
||||
/**
|
||||
* 初始化tab
|
||||
* @param options
|
||||
@@ -20,10 +12,9 @@ define(["jquery"], function ($) {
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
options.menuList = options.menuList || []; // todo 后期菜单想改为不操作dom, 而是直接操作初始化传过来的数据
|
||||
options.menuList = options.menuList || []; // todo 后期菜单想改为不操作dom, 而是直接操作初始化传过来的数据
|
||||
options.homeInfo = options.homeInfo || {};
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () {
|
||||
};
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () { };
|
||||
miniTab.listen(options);
|
||||
miniTab.listenRoll();
|
||||
miniTab.listenSwitch(options);
|
||||
@@ -44,22 +35,27 @@ define(["jquery"], function ($) {
|
||||
options.title = options.title || null;
|
||||
options.isIframe = options.isIframe || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
if ($(".layuimini-tab .layui-tab-title li").length >= options.maxTabNum) {
|
||||
if ($('.layuimini-tab .layui-tab-title li').length >= options.maxTabNum) {
|
||||
layer.msg('Tab窗口已达到限定数量,请先关闭部分Tab');
|
||||
return false;
|
||||
}
|
||||
var ele = element;
|
||||
if (options.isIframe) ele = parent.layui.element;
|
||||
ele.tabAdd('layuiminiTab', {
|
||||
title: '<span class="layuimini-tab-active"></span><span>' + options.title + '</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>' //用于演示
|
||||
, content: '<iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" src="' + options.href + '"></iframe>'
|
||||
, id: options.tabId
|
||||
title:
|
||||
'<span class="layuimini-tab-active"></span><span>' +
|
||||
options.title +
|
||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>', //用于演示
|
||||
content:
|
||||
'<iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" src="' +
|
||||
options.href +
|
||||
'"></iframe>',
|
||||
id: options.tabId,
|
||||
});
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'add');
|
||||
sessionStorage.setItem('layuiminimenu_' + options.tabId, options.title);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 切换选项卡
|
||||
* @param tabId
|
||||
@@ -75,7 +71,7 @@ define(["jquery"], function ($) {
|
||||
*/
|
||||
delete: function (tabId, isParent) {
|
||||
// todo 未知BUG,不知道是不是layui问题,必须先删除元素
|
||||
$(".layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar").remove();
|
||||
$('.layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar').remove();
|
||||
|
||||
if (isParent === true) {
|
||||
parent.layui.element.tabDelete('layuiminiTab', tabId);
|
||||
@@ -90,7 +86,7 @@ define(["jquery"], function ($) {
|
||||
openNewTabByIframe: function (options) {
|
||||
options.href = options.href || null;
|
||||
options.title = options.title || null;
|
||||
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = parent.layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
if (options.href === null || options.href === undefined) options.href = new Date().getTime();
|
||||
var checkTab = miniTab.check(options.href, true);
|
||||
if (!checkTab) {
|
||||
@@ -109,7 +105,7 @@ define(["jquery"], function ($) {
|
||||
* 在iframe层关闭当前tab方法
|
||||
*/
|
||||
deleteCurrentByIframe: function () {
|
||||
var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document);
|
||||
var ele = $('.layuimini-tab .layui-tab-title li.layui-this', parent.document);
|
||||
if (ele.length > 0) {
|
||||
var layId = $(ele[0]).attr('lay-id');
|
||||
miniTab.delete(layId, true);
|
||||
@@ -123,14 +119,14 @@ define(["jquery"], function ($) {
|
||||
// 判断选项卡上是否有
|
||||
var checkTab = false;
|
||||
if (isIframe === undefined || isIframe === false) {
|
||||
$(".layui-tab-title li").each(function () {
|
||||
$('.layui-tab-title li').each(function () {
|
||||
var checkTabId = $(this).attr('lay-id');
|
||||
if (checkTabId != null && checkTabId === tabId) {
|
||||
checkTab = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
parent.layui.$(".layui-tab-title li").each(function () {
|
||||
parent.layui.$('.layui-tab-title li').each(function () {
|
||||
var checkTabId = $(this).attr('lay-id');
|
||||
if (checkTabId != null && checkTabId === tabId) {
|
||||
checkTab = true;
|
||||
@@ -147,7 +143,12 @@ define(["jquery"], function ($) {
|
||||
*/
|
||||
openTabRignMenu: function (tabId, left) {
|
||||
miniTab.closeTabRignMenu();
|
||||
var menuHtml = '<div class="layui-unselect layui-form-select layui-form-selected layuimini-tab-mousedown layui-show" data-tab-id="' + tabId + '" style="left: ' + left + 'px!important">\n' +
|
||||
var menuHtml =
|
||||
'<div class="layui-unselect layui-form-select layui-form-selected layuimini-tab-mousedown layui-show" data-tab-id="' +
|
||||
tabId +
|
||||
'" style="left: ' +
|
||||
left +
|
||||
'px!important">\n' +
|
||||
'<dl>\n' +
|
||||
'<dd><a href="javascript:;" layuimini-tab-menu-close="current">关 闭 当 前</a></dd>\n' +
|
||||
'<dd><a href="javascript:;" layuimini-tab-menu-close="other">关 闭 其 他</a></dd>\n' +
|
||||
@@ -203,22 +204,22 @@ define(["jquery"], function ($) {
|
||||
* 打开新窗口
|
||||
*/
|
||||
$('body').on('click', '[layuimini-href]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var tabId = $(this).attr('layuimini-href'),
|
||||
href = $(this).attr('layuimini-href'),
|
||||
title = $(this).text(),
|
||||
target = $(this).attr('target');
|
||||
|
||||
var el = $("[layuimini-href='" + href + "']", ".layuimini-menu-left");
|
||||
var el = $("[layuimini-href='" + href + "']", '.layuimini-menu-left');
|
||||
layer.close(window.openTips);
|
||||
if (el.length) {
|
||||
$(el).closest(".layui-nav-tree").find(".layui-this").removeClass("layui-this");
|
||||
$(el).parent().addClass("layui-this");
|
||||
$(el).closest('.layui-nav-tree').find('.layui-this').removeClass('layui-this');
|
||||
$(el).parent().addClass('layui-this');
|
||||
}
|
||||
|
||||
if (target === '_blank') {
|
||||
layer.close(loading);
|
||||
window.open(href, "_blank");
|
||||
window.open(href, '_blank');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -241,14 +242,14 @@ define(["jquery"], function ($) {
|
||||
* 在iframe子菜单上打开新窗口
|
||||
*/
|
||||
$('body').on('click', '[layuimini-content-href]', function () {
|
||||
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = parent.layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var tabId = $(this).attr('layuimini-content-href'),
|
||||
href = $(this).attr('layuimini-content-href'),
|
||||
title = $(this).attr('data-title'),
|
||||
target = $(this).attr('target');
|
||||
if (target === '_blank') {
|
||||
parent.layer.close(loading);
|
||||
window.open(href, "_blank");
|
||||
window.open(href, '_blank');
|
||||
return false;
|
||||
}
|
||||
if (tabId === null || tabId === undefined) tabId = new Date().getTime();
|
||||
@@ -270,7 +271,7 @@ define(["jquery"], function ($) {
|
||||
* 关闭选项卡
|
||||
**/
|
||||
$('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var $parent = $(this).parent();
|
||||
var tabId = $parent.attr('lay-id');
|
||||
if (tabId !== undefined || tabId !== null) {
|
||||
@@ -283,9 +284,9 @@ define(["jquery"], function ($) {
|
||||
* 选项卡操作
|
||||
*/
|
||||
$('body').on('click', '[layuimini-tab-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var closeType = $(this).attr('layuimini-tab-close');
|
||||
$(".layuimini-tab .layui-tab-title li").each(function () {
|
||||
$('.layuimini-tab .layui-tab-title li').each(function () {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
var id = $(this).attr('id');
|
||||
var isCurrent = $(this).hasClass('layui-this');
|
||||
@@ -307,16 +308,18 @@ define(["jquery"], function ($) {
|
||||
/**
|
||||
* 禁用网页右键
|
||||
*/
|
||||
$(".layuimini-tab .layui-tab-title").unbind("mousedown").bind("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
$('.layuimini-tab .layui-tab-title')
|
||||
.unbind('mousedown')
|
||||
.bind('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 注册鼠标右键
|
||||
*/
|
||||
$('body').on('mousedown', '.layuimini-tab .layui-tab-title li', function (e) {
|
||||
var left = $(this).offset().left - $('.layuimini-tab ').offset().left + ($(this).width() / 2),
|
||||
var left = $(this).offset().left - $('.layuimini-tab ').offset().left + $(this).width() / 2,
|
||||
tabId = $(this).attr('lay-id');
|
||||
if (e.which === 3) {
|
||||
miniTab.openTabRignMenu(tabId, left);
|
||||
@@ -334,10 +337,10 @@ define(["jquery"], function ($) {
|
||||
* tab右键选项卡操作
|
||||
*/
|
||||
$('body').on('click', '[layuimini-tab-menu-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var loading = layer.load(0, { shade: false, time: 2 * 1000 });
|
||||
var closeType = $(this).attr('layuimini-tab-menu-close'),
|
||||
currentTabId = $('.layuimini-tab-mousedown').attr('data-tab-id');
|
||||
$(".layuimini-tab .layui-tab-title li").each(function () {
|
||||
$('.layuimini-tab .layui-tab-title li').each(function () {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
var id = $(this).attr('id');
|
||||
if (id !== 'layuiminiHomeTabId') {
|
||||
@@ -365,9 +368,7 @@ define(["jquery"], function ($) {
|
||||
options.filter = options.filter || null;
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () {
|
||||
|
||||
};
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () { };
|
||||
element.on('tab(' + options.filter + ')', function (data) {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
if (options.urlHashLocation) {
|
||||
@@ -378,9 +379,9 @@ define(["jquery"], function ($) {
|
||||
}
|
||||
// 判断是否为新增窗口
|
||||
if ($('.layuimini-menu-left').attr('layuimini-tab-tag') === 'add') {
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no')
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no');
|
||||
} else {
|
||||
$("[layuimini-href]").parent().removeClass('layui-this');
|
||||
$('[layuimini-href]').parent().removeClass('layui-this');
|
||||
if (options.multiModule) {
|
||||
miniTab.listenSwitchMultiModule(tabId);
|
||||
} else {
|
||||
@@ -403,10 +404,10 @@ define(["jquery"], function ($) {
|
||||
options.menuList = options.menuList || [];
|
||||
if (!options.urlHashLocation) return false;
|
||||
var tabId = location.hash.replace(/^#/, '');
|
||||
if (tabId === null || tabId === undefined || tabId ==='') return false;
|
||||
if (tabId === null || tabId === undefined || tabId === '') return false;
|
||||
|
||||
// 判断是否为首页
|
||||
if(tabId ===options.homeInfo.href) return false;
|
||||
if (tabId === options.homeInfo.href) return false;
|
||||
|
||||
// 判断是否为右侧菜单
|
||||
var menu = miniTab.searchMenu(tabId, options.menuList);
|
||||
@@ -425,9 +426,9 @@ define(["jquery"], function ($) {
|
||||
|
||||
// 判断是否为快捷菜单
|
||||
var isSearchMenu = false;
|
||||
$("[layuimini-content-href]").each(function () {
|
||||
if ($(this).attr("layuimini-content-href") === tabId) {
|
||||
var title = $(this).attr("data-title");
|
||||
$('[layuimini-content-href]').each(function () {
|
||||
if ($(this).attr('layuimini-content-href') === tabId) {
|
||||
var title = $(this).attr('data-title');
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: tabId,
|
||||
@@ -444,7 +445,10 @@ define(["jquery"], function ($) {
|
||||
if (isSearchMenu) return false;
|
||||
|
||||
// 既不是右侧菜单、快捷菜单,就直接打开
|
||||
var title = sessionStorage.getItem('layuiminimenu_' + tabId) === null ? tabId : sessionStorage.getItem('layuiminimenu_' + tabId);
|
||||
var title =
|
||||
sessionStorage.getItem('layuiminimenu_' + tabId) === null
|
||||
? tabId
|
||||
: sessionStorage.getItem('layuiminimenu_' + tabId);
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: tabId,
|
||||
@@ -460,11 +464,11 @@ define(["jquery"], function ($) {
|
||||
* 监听滚动
|
||||
*/
|
||||
listenRoll: function () {
|
||||
$(".layuimini-tab-roll-left").click(function () {
|
||||
miniTab.rollClick("left");
|
||||
$('.layuimini-tab-roll-left').click(function () {
|
||||
miniTab.rollClick('left');
|
||||
});
|
||||
$(".layuimini-tab-roll-right").click(function () {
|
||||
miniTab.rollClick("right");
|
||||
$('.layuimini-tab-roll-right').click(function () {
|
||||
miniTab.rollClick('right');
|
||||
});
|
||||
},
|
||||
|
||||
@@ -473,21 +477,21 @@ define(["jquery"], function ($) {
|
||||
* @param tabId
|
||||
*/
|
||||
listenSwitchSingleModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
$('[layuimini-href]').each(function () {
|
||||
if ($(this).attr('layuimini-href') === tabId) {
|
||||
// 自动展开菜单栏
|
||||
var addMenuClass = function ($element, type) {
|
||||
if (type === 1) {
|
||||
$element.addClass('layui-this');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$('.layuimini-header-menu li').attr('class', 'layui-nav-item');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
} else {
|
||||
$element.addClass('layui-nav-itemed');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$('.layuimini-header-menu li').attr('class', 'layui-nav-item');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
@@ -504,19 +508,21 @@ define(["jquery"], function ($) {
|
||||
* @param tabId
|
||||
*/
|
||||
listenSwitchMultiModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
|
||||
$('[layuimini-href]').each(function () {
|
||||
if ($(this).attr('layuimini-href') === tabId) {
|
||||
// 自动展开菜单栏
|
||||
var addMenuClass = function ($element, type) {
|
||||
if (type === 1) {
|
||||
$element.addClass('layui-this');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
$('.layuimini-header-menu li').attr('class', 'layui-nav-item');
|
||||
$('#' + moduleId + 'HeaderId').addClass('layui-this');
|
||||
$('.layuimini-menu-left .layui-nav.layui-nav-tree').attr(
|
||||
'class',
|
||||
'layui-nav layui-nav-tree layui-hide',
|
||||
);
|
||||
$('#' + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
@@ -524,10 +530,13 @@ define(["jquery"], function ($) {
|
||||
$element.addClass('layui-nav-itemed');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
$('.layuimini-header-menu li').attr('class', 'layui-nav-item');
|
||||
$('#' + moduleId + 'HeaderId').addClass('layui-this');
|
||||
$('.layuimini-menu-left .layui-nav.layui-nav-tree').attr(
|
||||
'class',
|
||||
'layui-nav layui-nav-tree layui-hide',
|
||||
);
|
||||
$('#' + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
@@ -545,16 +554,19 @@ define(["jquery"], function ($) {
|
||||
rollPosition: function () {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var autoLeft = 0;
|
||||
$tabTitle.children("li").each(function () {
|
||||
$tabTitle.children('li').each(function () {
|
||||
if ($(this).hasClass('layui-this')) {
|
||||
return false;
|
||||
} else {
|
||||
autoLeft += $(this).outerWidth();
|
||||
}
|
||||
});
|
||||
$tabTitle.animate({
|
||||
scrollLeft: autoLeft - $tabTitle.width() / 3
|
||||
}, 200);
|
||||
$tabTitle.animate(
|
||||
{
|
||||
scrollLeft: autoLeft - $tabTitle.width() / 3,
|
||||
},
|
||||
200,
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -565,17 +577,22 @@ define(["jquery"], function ($) {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var left = $tabTitle.scrollLeft();
|
||||
if ('left' === direction) {
|
||||
$tabTitle.animate({
|
||||
scrollLeft: left - 450
|
||||
}, 200);
|
||||
$tabTitle.animate(
|
||||
{
|
||||
scrollLeft: left - 450,
|
||||
},
|
||||
200,
|
||||
);
|
||||
} else {
|
||||
$tabTitle.animate({
|
||||
scrollLeft: left + 450
|
||||
}, 200);
|
||||
$tabTitle.animate(
|
||||
{
|
||||
scrollLeft: left + 450,
|
||||
},
|
||||
200,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
return miniTab;
|
||||
});
|
||||
window.miniTab = miniTab;
|
||||
})();
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
/**
|
||||
* date:2020/02/28
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini tab框架扩展
|
||||
*/
|
||||
define(["jquery"], function ($) {
|
||||
(function () {
|
||||
var $ = layui.$,
|
||||
layer = layui.layer;
|
||||
|
||||
@@ -486,7 +480,7 @@ define(["jquery"], function ($) {
|
||||
{
|
||||
title: '拟物',
|
||||
className: 'neomorphic',
|
||||
|
||||
|
||||
},
|
||||
]
|
||||
return listElemStyle;
|
||||
@@ -606,6 +600,5 @@ define(["jquery"], function ($) {
|
||||
}
|
||||
};
|
||||
|
||||
return miniTheme;
|
||||
})
|
||||
;
|
||||
window.miniTheme = miniTheme;
|
||||
})();
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* date:2020/03/01
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini 统计框架扩展
|
||||
*/
|
||||
define(["jquery"], function ($) {
|
||||
var $ = layui.$;
|
||||
|
||||
var miniTongji = {
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @param options
|
||||
*/
|
||||
render: function (options) {
|
||||
options.specific = options.specific || false;
|
||||
options.domains = options.domains || [];
|
||||
var domain = window.location.hostname;
|
||||
if (options.specific === false || (options.specific === true && options.domains.indexOf(domain) >=0)) {
|
||||
miniTongji.listen();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听统计代码
|
||||
*/
|
||||
listen: function () {
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?d97abf6d61c21d773f97835defbdef4e";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
return miniTongji;
|
||||
});
|
||||
@@ -1,15 +1,17 @@
|
||||
define(['jquery', 'vue'], function ($, Vue) {
|
||||
(function () {
|
||||
const propertyInputCss = '/static/plugs/lay-module/propertyInput/propertyInput.css';
|
||||
const propertyInputHtml = '/static/plugs/lay-module/propertyInput/propertyInput.html';
|
||||
|
||||
var propertyInput = function () {
|
||||
var cssElement = document.createElement('link');
|
||||
$(function () {
|
||||
var cssElement = document.createElement('link');
|
||||
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
|
||||
cssElement.setAttribute('href', propertyInputCss);
|
||||
cssElement.setAttribute('href', propertyInputCss);
|
||||
|
||||
document.body.appendChild(cssElement);
|
||||
document.body.appendChild(cssElement);
|
||||
});
|
||||
};
|
||||
var propertyInputTemplate = '';
|
||||
|
||||
@@ -29,11 +31,11 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
var defaultOption = {
|
||||
placeholder: '请选择',
|
||||
required: ''
|
||||
}
|
||||
};
|
||||
|
||||
var options = $.extend(defaultOption, data);
|
||||
|
||||
options.value = $.trim(options.value)
|
||||
options.value = $.trim(options.value);
|
||||
|
||||
|
||||
app = new Vue({
|
||||
@@ -48,7 +50,7 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
listItem: {
|
||||
@@ -63,7 +65,7 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
|
||||
created() {
|
||||
if (this.setting.value) {
|
||||
if(typeof this.setting.value === 'string'){
|
||||
if (typeof this.setting.value === 'string') {
|
||||
this.setting.value = JSON.parse(this.setting.value);
|
||||
}
|
||||
this.listItem = this.setting.value;
|
||||
@@ -81,13 +83,13 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
methods: {
|
||||
|
||||
removeItem(item, index) {
|
||||
this.listTag.splice(index, 1)
|
||||
this.listTag.splice(index, 1);
|
||||
},
|
||||
onAddItem() {
|
||||
this.listItem.push({
|
||||
name: '',
|
||||
value: ''
|
||||
})
|
||||
});
|
||||
},
|
||||
onItemNameChange(item, index, event) {
|
||||
this.listItem[index].name = event.target.value;
|
||||
@@ -99,17 +101,17 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
onItemMoveUp(item, index) {
|
||||
var arr = this.listItem;
|
||||
if (index != 0) {
|
||||
arr[index] = arr.splice(index - 1, 1, arr[index])[0]
|
||||
arr[index] = arr.splice(index - 1, 1, arr[index])[0];
|
||||
} else {
|
||||
arr.push(arr.shift())
|
||||
arr.push(arr.shift());
|
||||
}
|
||||
},
|
||||
onItemMoveDown(item, index) {
|
||||
var arr = this.listItem;
|
||||
if (index != arr.length - 1) {
|
||||
arr[index] = arr.splice(index + 1, 1, arr[index])[0]
|
||||
arr[index] = arr.splice(index + 1, 1, arr[index])[0];
|
||||
} else {
|
||||
arr.unshift(arr.splice(index, 1)[0])
|
||||
arr.unshift(arr.splice(index, 1)[0]);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -120,16 +122,16 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
name: '',
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
];
|
||||
} else {
|
||||
this.listItem.splice(index, 1)
|
||||
this.listItem.splice(index, 1);
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
};
|
||||
|
||||
return new propertyInput();
|
||||
})
|
||||
window.propertyInput = new propertyInput();
|
||||
})();
|
||||
@@ -1,15 +1,14 @@
|
||||
define(['jquery', 'vue'], function ($, Vue) {
|
||||
(function () {
|
||||
const tableDataCss = '/static/plugs/lay-module/tableData/tableData.css';
|
||||
const tableDataHtml = '/static/plugs/lay-module/tableData/tableData.html';
|
||||
|
||||
var tableData = function () {
|
||||
var cssElement = document.createElement('link');
|
||||
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
|
||||
cssElement.setAttribute('href', tableDataCss);
|
||||
|
||||
document.body.appendChild(cssElement);
|
||||
$(function () {
|
||||
var cssElement = document.createElement('link');
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
cssElement.setAttribute('href', tableDataCss);
|
||||
document.body.appendChild(cssElement);
|
||||
});
|
||||
};
|
||||
var tableDataTemplate = '';
|
||||
|
||||
@@ -42,19 +41,19 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
height: clientHeight,
|
||||
placeholder: '请选择',
|
||||
selectConfirmCallback: 'onTableDataConfirm',
|
||||
}
|
||||
};
|
||||
|
||||
var options = $.extend(defaultOption, data);
|
||||
|
||||
var valueField = options.valueField;
|
||||
|
||||
if (options.index.indexOf('?') > -1) {
|
||||
options.index += '&'
|
||||
options.index += '&';
|
||||
} else {
|
||||
options.index += '?'
|
||||
options.index += '?';
|
||||
}
|
||||
|
||||
options.index += 'select_mode=' + options.selectType
|
||||
options.index += 'select_mode=' + options.selectType;
|
||||
|
||||
app = new Vue({
|
||||
el: elem,
|
||||
@@ -63,14 +62,14 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
setting: options,
|
||||
listSelected: [],
|
||||
value: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
listSelected(value) {
|
||||
|
||||
var valueList = value.map(itemValue => itemValue[valueField])
|
||||
var valueList = value.map(itemValue => itemValue[valueField]);
|
||||
|
||||
this.value = valueList.join(',')
|
||||
this.value = valueList.join(',');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -87,9 +86,9 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
op: JSON.stringify({ [options.valueField]: 'in' }),
|
||||
group: options.valueField
|
||||
}, (result) => {
|
||||
loading.hide()
|
||||
loading.hide();
|
||||
this.listSelected = result.data;
|
||||
})
|
||||
});
|
||||
|
||||
},
|
||||
mounted() {
|
||||
@@ -102,7 +101,7 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
methods: {
|
||||
openSelectPage() {
|
||||
|
||||
if(options.readonly == 1){
|
||||
if (options.readonly == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -124,17 +123,17 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
this.listSelected = [];
|
||||
}
|
||||
|
||||
var itemFind = this.listSelected.find(itemSelect => itemSelect[valueField] == dataItem[valueField])
|
||||
var itemFind = this.listSelected.find(itemSelect => itemSelect[valueField] == dataItem[valueField]);
|
||||
|
||||
if (itemFind == undefined) {
|
||||
this.listSelected.push(dataItem)
|
||||
this.listSelected.push(dataItem);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
this.$forceUpdate();
|
||||
layer.close(index);
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
end: function () {
|
||||
@@ -148,10 +147,10 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
this.listSelected.splice(index, 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
};
|
||||
|
||||
return new tableData();
|
||||
})
|
||||
window.tableData = new tableData();
|
||||
})();
|
||||
@@ -1,15 +1,17 @@
|
||||
define(['jquery', 'vue'], function ($, Vue) {
|
||||
(function () {
|
||||
const tagInputCss = '/static/plugs/lay-module/tagInput/tagInput.css';
|
||||
const tagInputHtml = '/static/plugs/lay-module/tagInput/tagInput.html';
|
||||
|
||||
var tagInput = function () {
|
||||
var cssElement = document.createElement('link');
|
||||
$(function () {
|
||||
var cssElement = document.createElement('link');
|
||||
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
cssElement.setAttribute('rel', 'stylesheet');
|
||||
|
||||
cssElement.setAttribute('href', tagInputCss);
|
||||
cssElement.setAttribute('href', tagInputCss);
|
||||
|
||||
document.body.appendChild(cssElement);
|
||||
document.body.appendChild(cssElement);
|
||||
});
|
||||
};
|
||||
var tagInputTemplate = '';
|
||||
|
||||
@@ -29,7 +31,7 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
var defaultOption = {
|
||||
placeholder: '请选择',
|
||||
required: ''
|
||||
}
|
||||
};
|
||||
|
||||
var options = $.extend(defaultOption, data);
|
||||
|
||||
@@ -45,21 +47,21 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
inputWidth: 100,
|
||||
inputValuePreview: '',
|
||||
listTag: []
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
inputValue(value) {
|
||||
|
||||
this.inputValuePreview = value;
|
||||
this.updateInputWidth()
|
||||
this.updateInputWidth();
|
||||
},
|
||||
listTag(value) {
|
||||
this.value = value.join(',')
|
||||
this.value = value.join(',');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (options.value.length > 0) {
|
||||
this.listTag = options.value.split(',')
|
||||
this.listTag = options.value.split(',');
|
||||
|
||||
}
|
||||
|
||||
@@ -80,12 +82,12 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.listTag.push(this.inputValue)
|
||||
this.listTag.push(this.inputValue);
|
||||
this.inputValue = '';
|
||||
return false;
|
||||
},
|
||||
onContainerClick() {
|
||||
$(this.$refs['tagInputMain']).focus()
|
||||
$(this.$refs['tagInputMain']).focus();
|
||||
},
|
||||
onInputChange(e) {
|
||||
|
||||
@@ -102,13 +104,13 @@ define(['jquery', 'vue'], function ($, Vue) {
|
||||
this.inputWidth = width + 60;
|
||||
},
|
||||
removeItem(item, index) {
|
||||
this.listTag.splice(index, 1)
|
||||
this.listTag.splice(index, 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
};
|
||||
|
||||
return new tagInput();
|
||||
})
|
||||
window.tagInput = new tagInput();
|
||||
})();
|
||||
@@ -1,16 +1,16 @@
|
||||
define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput', 'propertyInput', 'miniTab', 'clipboardjs'], function ($, undefined, miniTheme, tableData, citypicker, tagInput, propertyInput, miniTab, ClipboardJS) {
|
||||
(function () {
|
||||
|
||||
window.onInitElemStyle = function () {
|
||||
miniTheme.renderElemStyle()
|
||||
miniTheme.renderElemStyle();
|
||||
|
||||
$('iframe').each(function (index, iframe) {
|
||||
|
||||
if (typeof iframe.contentWindow.onInitElemStyle == "function") {
|
||||
iframe.contentWindow.onInitElemStyle();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
window.onInitElemStyle();
|
||||
|
||||
var lastTableWhere = {};
|
||||
@@ -60,7 +60,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
// visio扩展名数组
|
||||
'visio': ['vsd', 'vsdx'],
|
||||
'file': []
|
||||
}
|
||||
};
|
||||
|
||||
var allExtGroup = [];
|
||||
|
||||
@@ -68,14 +68,14 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (Object.hasOwnProperty.call(extGroup, extGroupName)) {
|
||||
const extGroupList = extGroup[extGroupName];
|
||||
|
||||
allExtGroup = allExtGroup.concat(extGroupList)
|
||||
allExtGroup = allExtGroup.concat(extGroupList);
|
||||
|
||||
}
|
||||
}
|
||||
init.upload_exts += allExtGroup.join('|')
|
||||
init.upload_exts += allExtGroup.join('|');
|
||||
|
||||
extGroup['office'] = [].concat(extGroup['word'], extGroup['excel'], extGroup['ppt'], extGroup['pdf'])
|
||||
extGroup['media'] = [].concat(extGroup['image'], extGroup['music'], extGroup['video'])
|
||||
extGroup['office'] = [].concat(extGroup['word'], extGroup['excel'], extGroup['ppt'], extGroup['pdf']);
|
||||
extGroup['media'] = [].concat(extGroup['image'], extGroup['music'], extGroup['video']);
|
||||
|
||||
var admin = {
|
||||
config: {
|
||||
@@ -143,7 +143,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (option.prefix == true) {
|
||||
option.url = admin.url(option.url);
|
||||
}
|
||||
loading.show()
|
||||
loading.show();
|
||||
$.ajax({
|
||||
url: option.url,
|
||||
type: type,
|
||||
@@ -202,7 +202,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
success: function (msg, callback) {
|
||||
if (callback === undefined) {
|
||||
callback = function () {
|
||||
}
|
||||
};
|
||||
}
|
||||
var index = layer.msg(msg, { icon: 1, shade: admin.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback);
|
||||
return index;
|
||||
@@ -211,7 +211,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
error: function (msg, callback) {
|
||||
if (callback === undefined) {
|
||||
callback = function () {
|
||||
}
|
||||
};
|
||||
}
|
||||
var index = layer.msg(msg, { icon: 2, shade: admin.config.shade, scrollbar: false, time: 3000, shadeClose: true }, callback);
|
||||
return index;
|
||||
@@ -272,10 +272,10 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
layEvent: 'TABLE_SEARCH',
|
||||
icon: 'layui-icon-search',
|
||||
extend: 'data-table-id="' + options.id + '"'
|
||||
})
|
||||
});
|
||||
}
|
||||
if (options.defaultToolbar === undefined) {
|
||||
options.defaultToolbar = defaultToolbar
|
||||
options.defaultToolbar = defaultToolbar;
|
||||
}
|
||||
|
||||
var table2card = function () {
|
||||
@@ -289,20 +289,20 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if ($(cell).hasClass('laytable-cell-checkbox')) {
|
||||
colsHeader.push('选择');
|
||||
} else {
|
||||
colsHeader.push($(cell).find('span').first().text())
|
||||
colsHeader.push($(cell).find('span').first().text());
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
domTable.find('.layui-table-main').find('tr').each(function (index, domTr) {
|
||||
|
||||
$(domTr).find('td').each(function (indexTd, domTd) {
|
||||
|
||||
$('<div class="data-item">' + colsHeader[indexTd] + '</div>').insertBefore($(domTd).find('.layui-table-cell'))
|
||||
})
|
||||
})
|
||||
$('<div class="data-item">' + colsHeader[indexTd] + '</div>').insertBefore($(domTd).find('.layui-table-cell'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var tableFixedAutoHeight = function () {
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
@@ -310,20 +310,20 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
$($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var optionDone = function () { }
|
||||
var optionDone = function () { };
|
||||
if (options.done != undefined) {
|
||||
optionDone = options.done;
|
||||
}
|
||||
options.done = function () {
|
||||
optionDone()
|
||||
table2card()
|
||||
tableFixedAutoHeight()
|
||||
optionDone();
|
||||
table2card();
|
||||
tableFixedAutoHeight();
|
||||
|
||||
// 监听表格内的复制组件
|
||||
admin.api.copyText('[lay-id=' + options.id + ']');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
selectMode = admin.getQueryVariable("select_mode");
|
||||
@@ -343,7 +343,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
options.page = {
|
||||
layout: ['first', 'prev', 'page', 'next', 'last', 'count']
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
} else if (options.cols[0][0].type != 'checkbox') {
|
||||
options.cols[0].unshift({
|
||||
type: 'checkbox'
|
||||
})
|
||||
});
|
||||
}
|
||||
} else if (selectMode == 'radio') {
|
||||
if (options.cols[0][0].type == 'checkbox') {
|
||||
@@ -362,7 +362,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
} else if (options.cols[0][0].type != 'radio') {
|
||||
options.cols[0].unshift({
|
||||
type: 'radio'
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -384,13 +384,13 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (selectMode == 'checkbox' || selectMode == 'radio') {
|
||||
options.toolbar.unshift('selectConfirm');
|
||||
|
||||
options.height = 'full-85'
|
||||
options.height = 'full-85';
|
||||
}
|
||||
|
||||
if (options.init.formFullScreen == true) {
|
||||
options.init.formFullScreen = 'true'
|
||||
options.init.formFullScreen = 'true';
|
||||
} else {
|
||||
options.init.formFullScreen = 'false'
|
||||
options.init.formFullScreen = 'false';
|
||||
}
|
||||
|
||||
options.toolbar = admin.table.renderToolbar(options.toolbar, options.elem, options.id, options.init);
|
||||
@@ -402,7 +402,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
options.cols = admin.table.renderTrueHide(options.cols, options);
|
||||
|
||||
|
||||
var parseData = function (res) { return res }
|
||||
var parseData = function (res) { return res; };
|
||||
|
||||
if (typeof options.parseData === 'function') {
|
||||
parseData = options.parseData;
|
||||
@@ -428,9 +428,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
}
|
||||
}
|
||||
|
||||
res = parseData(res)
|
||||
res = parseData(res);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表格
|
||||
@@ -452,7 +452,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
admin.table.listenExport(options);
|
||||
|
||||
// 监听表格选择器
|
||||
admin.table.listenTableSelectConfirm(options)
|
||||
admin.table.listenTableSelectConfirm(options);
|
||||
|
||||
return newTable;
|
||||
},
|
||||
@@ -523,7 +523,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
var fieldPlusArr = d.fieldAlias.replace('[').split(']');
|
||||
|
||||
d.elemIdName = fieldPlusArr.join('-')
|
||||
d.elemIdName = fieldPlusArr.join('-');
|
||||
}
|
||||
|
||||
d.elemIdName = d.elemIdName.replace('.', '-');
|
||||
@@ -543,7 +543,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var formSearchHideClass = '';
|
||||
|
||||
if (d.searchHide) {
|
||||
formSearchHideClass = ' search-hide-item'
|
||||
formSearchHideClass = ' search-hide-item';
|
||||
}
|
||||
|
||||
if (d.field !== false && d.search !== false) {
|
||||
@@ -653,7 +653,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
options.where = {
|
||||
filter: JSON.stringify(formatFilter),
|
||||
op: JSON.stringify(formatOp)
|
||||
}
|
||||
};
|
||||
|
||||
lastTableWhere[tableId] = options.where;
|
||||
|
||||
@@ -689,7 +689,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
for (k in item) {
|
||||
var v = item[k];
|
||||
if (v.auth == undefined) {
|
||||
v.auth = 'add'
|
||||
v.auth = 'add';
|
||||
}
|
||||
if (admin.checkAuth(v.auth, elem)) {
|
||||
check = true;
|
||||
@@ -699,7 +699,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
}
|
||||
}
|
||||
if (!check) {
|
||||
data[dk].pop()
|
||||
data[dk].pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
col.forEach(colItem => {
|
||||
var trueHide = false;
|
||||
if (typeof colItem.trueHide == 'function') {
|
||||
trueHide = colItem.trueHide(colItem, col, options)
|
||||
trueHide = colItem.trueHide(colItem, col, options);
|
||||
} else if (typeof colItem.trueHide == 'string') {
|
||||
trueHide = !admin.checkAuth(colItem.trueHide, options.elem);
|
||||
} else {
|
||||
@@ -723,11 +723,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
}
|
||||
|
||||
if (!trueHide) {
|
||||
newCol.push(colItem)
|
||||
newCol.push(colItem);
|
||||
}
|
||||
});
|
||||
|
||||
newData.push(newCol)
|
||||
newData.push(newCol);
|
||||
}
|
||||
|
||||
return newData;
|
||||
@@ -782,18 +782,18 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
if (typeof operat.titleField == 'function') {
|
||||
console.log(operat.titleField(data, operat));
|
||||
titleEndfix = operat.titleField(data, operat)
|
||||
titleEndfix = operat.titleField(data, operat);
|
||||
|
||||
} else if (data[operat.titleField]) {
|
||||
titleEndfix = '-' + data[operat.titleField];
|
||||
}
|
||||
|
||||
if (typeof operat.text == 'function') {
|
||||
operat.text = operat.text(data, operat)
|
||||
operat.text = operat.text(data, operat);
|
||||
}
|
||||
|
||||
if (typeof operat.title == 'function') {
|
||||
operat.title = operat.title(data, operat)
|
||||
operat.title = operat.title(data, operat);
|
||||
}
|
||||
|
||||
var formatOperat = operat;
|
||||
@@ -813,7 +813,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
formatOperat.dataBind = ' ';
|
||||
operat.data.forEach((item, index) => {
|
||||
formatOperat.dataBind += 'data-' + item + '="' + data[item] + '" '
|
||||
formatOperat.dataBind += 'data-' + item + '="' + data[item] + '" ';
|
||||
});
|
||||
|
||||
html = '<a ' + formatOperat.class + formatOperat.method + formatOperat.extend + formatOperat.dataBind + '>' + formatOperat.icon + formatOperat.text + '</a>';
|
||||
@@ -836,11 +836,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (val['width'] == undefined && val['minWidth'] == undefined) {
|
||||
var width = null;
|
||||
if (val.title) {
|
||||
width = val.title.length * 15 + 55
|
||||
width = val.title.length * 15 + 55;
|
||||
}
|
||||
|
||||
if (width != null) {
|
||||
cols[i][index]['minWidth'] = width
|
||||
cols[i][index]['minWidth'] = width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -953,11 +953,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
endVal.endTemplet = endVal.templet;
|
||||
endVal.templet = function (data) {
|
||||
if (!data.LAY_COL) {
|
||||
data.LAY_COL = this
|
||||
data.LAY_COL = this;
|
||||
}
|
||||
|
||||
return this.endTemplet(data)
|
||||
}
|
||||
return this.endTemplet(data);
|
||||
};
|
||||
|
||||
cols[i][index] = endVal;
|
||||
|
||||
@@ -1023,7 +1023,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
operat.text = operat.text || operat.title;
|
||||
operat.extend = operat.extend || '';
|
||||
|
||||
operat._if = operat._if || function () { return true };
|
||||
operat._if = operat._if || function () { return true; };
|
||||
|
||||
if (typeof operat._if == 'function') {
|
||||
if (operat._if(data, operat) !== true) {
|
||||
@@ -1032,7 +1032,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
} else if (typeof operat._if == 'string') {
|
||||
var ifValue = admin.table.returnColumnValue(data, operat._if, false);
|
||||
if (!ifValue) {
|
||||
return ''
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,17 +1056,17 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var fieldParam = operat.field(data, operat);
|
||||
|
||||
if (typeof fieldParam == 'string') {
|
||||
operat.url = fieldParam
|
||||
operat.url = fieldParam;
|
||||
} else {
|
||||
var querys = '';
|
||||
if (operat.url.indexOf("?") !== -1) {
|
||||
if (operat.url.indexOf("?") !== operat.url.length - 1) {
|
||||
querys = '&'
|
||||
querys = '&';
|
||||
}
|
||||
} else {
|
||||
querys = '?'
|
||||
querys = '?';
|
||||
}
|
||||
operat.url += querys + $.param(fieldParam)
|
||||
operat.url += querys + $.param(fieldParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1101,7 +1101,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
var groupName = admin.getExtGroupName(data.file_ext);
|
||||
|
||||
return '<a href="' + value + '"><img style="height:40px;width:40px" src="/static/admin/images/upload-icons/' + groupName + '.png" /></a>'
|
||||
return '<a href="' + value + '"><img style="height:40px;width:40px" src="/static/admin/images/upload-icons/' + groupName + '.png" /></a>';
|
||||
}
|
||||
|
||||
},
|
||||
@@ -1133,7 +1133,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
|
||||
if (admin.empty(value)) {
|
||||
return ''
|
||||
return '';
|
||||
}
|
||||
|
||||
var urlName = value;
|
||||
@@ -1143,9 +1143,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var urlNameFieldType = typeof urlNameField;
|
||||
|
||||
if (urlNameFieldType == 'string') {
|
||||
urlName = data[urlNameField]
|
||||
urlName = data[urlNameField];
|
||||
} else if (urlNameFieldType == 'function') {
|
||||
urlName = urlNameField(data)
|
||||
urlName = urlNameField(data);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@@ -1202,8 +1202,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
},
|
||||
bytes: (data) => {
|
||||
var size = admin.table.returnColumnValue(data);
|
||||
sizeReadable = admin.bytes(size)
|
||||
return sizeReadable
|
||||
sizeReadable = admin.bytes(size);
|
||||
return sizeReadable;
|
||||
},
|
||||
copyText(data) {
|
||||
var option = data.LAY_COL;
|
||||
@@ -1248,7 +1248,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (val !== '') {
|
||||
formatFilter[key] = val;
|
||||
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key)
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key);
|
||||
|
||||
var op = $('#c-' + elemId).attr('data-search-op');
|
||||
op = op || '%*%';
|
||||
@@ -1259,8 +1259,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var where = {
|
||||
filter: JSON.stringify(formatFilter),
|
||||
op: JSON.stringify(formatOp)
|
||||
}
|
||||
lastTableWhere[tableId] = where
|
||||
};
|
||||
lastTableWhere[tableId] = where;
|
||||
table.reloadData(tableId, {
|
||||
page: {
|
||||
curr: 1
|
||||
@@ -1313,7 +1313,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
var lastWhere = lastTableWhere[option.id] ?? {};
|
||||
|
||||
lastWhere.sort = {}
|
||||
lastWhere.sort = {};
|
||||
lastWhere.sort[obj.field] = obj.type;
|
||||
|
||||
table.reloadData(option.id, {
|
||||
@@ -1383,7 +1383,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
}
|
||||
|
||||
parent.window[selectConfirmCallback](checkStatus.data);
|
||||
})
|
||||
});
|
||||
},
|
||||
listenExport: function (options) {
|
||||
|
||||
@@ -1407,7 +1407,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
switch (col.fieldFormat) {
|
||||
case 'image':
|
||||
imageFields.push(col.field)
|
||||
imageFields.push(col.field);
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
@@ -1417,7 +1417,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
break;
|
||||
case 'date':
|
||||
|
||||
dateFields.push(col.field)
|
||||
dateFields.push(col.field);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1445,7 +1445,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (val !== '') {
|
||||
formatFilter[key] = val;
|
||||
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key)
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key);
|
||||
|
||||
var op = $('#c-' + elemId).attr('data-search-op');
|
||||
op = op || '%*%';
|
||||
@@ -1460,7 +1460,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
image_fields: JSON.stringify(imageFields),
|
||||
select_fields: JSON.stringify(selectFields),
|
||||
date_fields: JSON.stringify(dateFields),
|
||||
}
|
||||
};
|
||||
|
||||
var query = $.param(searchQuery);
|
||||
|
||||
@@ -1470,11 +1470,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (toUrl.indexOf('?') < 0) {
|
||||
toUrl += '?';
|
||||
} else {
|
||||
toUrl += '&'
|
||||
toUrl += '&';
|
||||
}
|
||||
toUrl += query;
|
||||
|
||||
window.open(toUrl)
|
||||
window.open(toUrl);
|
||||
|
||||
layer.close(index);
|
||||
});
|
||||
@@ -1538,7 +1538,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
}
|
||||
},
|
||||
end: function () {
|
||||
index = null
|
||||
index = null;
|
||||
}
|
||||
});
|
||||
if (admin.checkMobile() || width === undefined || height === undefined) {
|
||||
@@ -1547,7 +1547,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (isResize) {
|
||||
$(window).on("resize", function () {
|
||||
index && layer.full(index);
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
listen: function (preposeCallback, ok, no, ex) {
|
||||
@@ -1785,7 +1785,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
@@ -1827,8 +1827,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
api: {
|
||||
button: function () {
|
||||
$('button[target="_blank"]').click(function () {
|
||||
window.open(admin.url($(this).attr('href')))
|
||||
})
|
||||
window.open(admin.url($(this).attr('href')));
|
||||
});
|
||||
},
|
||||
form: function (url, data, ok, no, ex, refreshTable) {
|
||||
if (refreshTable === undefined) {
|
||||
@@ -1881,7 +1881,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
// var options = {
|
||||
// url :'system.menu/index?id=1'
|
||||
// }
|
||||
// ea.api.reloadTable('currentTableRenderId',options)
|
||||
// ua.api.reloadTable('currentTableRenderId',options)
|
||||
reloadTable: function (tableName, options, mode) {
|
||||
tableName = tableName || 'currentTableRenderId';
|
||||
if (mode == 'table') {
|
||||
@@ -1936,7 +1936,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
// 自动添加layui事件过滤器
|
||||
if (filter === undefined || filter === '') {
|
||||
filter = 'save_form_' + (i + 1);
|
||||
$(this).attr('lay-filter', filter)
|
||||
$(this).attr('lay-filter', filter);
|
||||
}
|
||||
if (url === undefined || url === '' || url === null) {
|
||||
url = window.location.href;
|
||||
@@ -1946,9 +1946,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
form.on('submit(' + filter + ')', function (data) {
|
||||
var dataField = data.field;
|
||||
|
||||
dataField = admin.api.formSubmitEditor(dataField, v)
|
||||
dataField = admin.api.formSubmitEditor(dataField, v);
|
||||
|
||||
dataField = admin.api.formSubmitCity(dataField, v)
|
||||
dataField = admin.api.formSubmitCity(dataField, v);
|
||||
|
||||
if (typeof preposeCallback === 'function') {
|
||||
dataField = preposeCallback(dataField);
|
||||
@@ -1963,7 +1963,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
},
|
||||
formSubmitEditor(dataField, form) {
|
||||
// 富文本数据处理
|
||||
var editorList = $(form).closest('.layui-form').find('.editor')
|
||||
var editorList = $(form).closest('.layui-form').find('.editor');
|
||||
if (editorList.length > 0) {
|
||||
$.each(editorList, function (i, v) {
|
||||
var name = $(this).attr("name");
|
||||
@@ -2005,9 +2005,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
formatTargetList[targetType] = 0;
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
var codeArr = code.split('/')
|
||||
var codeArr = code.split('/');
|
||||
var textArr = text.split('/');
|
||||
|
||||
if (formatTargetList['name'] == 1) {
|
||||
@@ -2035,9 +2035,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
dataField[fieldName + '_code_district'] = codeArr[2] || '';
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
return dataField
|
||||
return dataField;
|
||||
},
|
||||
upload: function () {
|
||||
var uploadList = document.querySelectorAll("[data-upload]");
|
||||
@@ -2125,8 +2125,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
if (extGroup.image.indexOf(ext) != -1) {
|
||||
// 是图片
|
||||
liHtml += '<li><a title="点击预览"><img src="' + v + '" data-images onerror="this.src=\'' + BASE_URL + 'admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="' + uploadFilenameField + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
|
||||
liHtml += '<li><a title="点击预览"><img src="' + v + '" data-images onerror="this.src=\'/admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="' + uploadFilenameField + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
} else {
|
||||
// 不是图片
|
||||
// 遍历extGroup数组找到扩展名所在的索引
|
||||
@@ -2166,14 +2165,14 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var currentUrlList = currentUrl.split(sign);
|
||||
var deleteIndex = currentUrlList.indexOf(deleteUrl);
|
||||
|
||||
currentUrlList.splice(deleteIndex, 1)
|
||||
currentUrlList.splice(deleteIndex, 1);
|
||||
$(elem).val(currentUrlList.join(sign));
|
||||
$(elem).trigger("input");
|
||||
|
||||
if (currentFilename) {
|
||||
|
||||
var currentFilenameList = currentFilename.split(sign);
|
||||
currentFilenameList.splice(deleteIndex, 1)
|
||||
currentFilenameList.splice(deleteIndex, 1);
|
||||
|
||||
$(elemFilenameField).val(currentFilenameList.join(sign));
|
||||
}
|
||||
@@ -2193,7 +2192,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
|
||||
if (uploadFilenameField) {
|
||||
var elemFilenameField = "input[name='" + uploadFilenameField + "']";
|
||||
var elemFilename = $(elemFilenameField)
|
||||
var elemFilename = $(elemFilenameField);
|
||||
}
|
||||
|
||||
var selectCheck = uploadNumber === 'one' ? 'radio' : 'checkbox';
|
||||
@@ -2227,16 +2226,16 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var currentFilename = $(elemFilename).val();
|
||||
var filenameArray = currentFilename.split(uploadSign);
|
||||
if (currentFilename.length == 0 || selectCheck == 'radio') {
|
||||
filenameArray = []
|
||||
filenameArray = [];
|
||||
}
|
||||
}
|
||||
$.each(data, function (index, val) {
|
||||
if (urlArray.indexOf(val.url) == -1) {
|
||||
urlArray.push(val.url)
|
||||
urlArray.push(val.url);
|
||||
}
|
||||
if (uploadFilenameField) {
|
||||
if (filenameArray.indexOf(val.original_name) == -1) {
|
||||
filenameArray.push(val.original_name)
|
||||
filenameArray.push(val.original_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2253,10 +2252,10 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
$(elem).trigger("input");
|
||||
layer.close(index);
|
||||
admin.msg.success('选择成功');
|
||||
}
|
||||
};
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -2291,7 +2290,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
if (typeof template != 'function') {
|
||||
template = function (data, fields) {
|
||||
return data[fields[1]];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var fields = selectFields.replace(/\s/g, "").split(',');
|
||||
@@ -2356,7 +2355,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
tableData() {
|
||||
var tableList = document.querySelectorAll('[data-toggle="table-data"]');
|
||||
$.each(tableList, function (i, v) {
|
||||
var data = $(v).data()
|
||||
var data = $(v).data();
|
||||
tableData.render(v, data, admin);
|
||||
});
|
||||
|
||||
@@ -2364,7 +2363,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
tagInput() {
|
||||
var list = document.querySelectorAll('[data-toggle="tag-input"]');
|
||||
$.each(list, function (i, v) {
|
||||
var data = $(v).data()
|
||||
var data = $(v).data();
|
||||
tagInput.render(v, data, admin);
|
||||
});
|
||||
|
||||
@@ -2372,8 +2371,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
propertyInput() {
|
||||
var list = document.querySelectorAll('[data-toggle="property-input"]');
|
||||
$.each(list, function (i, v) {
|
||||
var data = $(v).data()
|
||||
data.value = $(v).text()
|
||||
var data = $(v).data();
|
||||
data.value = $(v).text();
|
||||
|
||||
propertyInput.render(v, data, admin);
|
||||
});
|
||||
@@ -2381,7 +2380,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
},
|
||||
copyText(elem) {
|
||||
if (elem == undefined) {
|
||||
elem = 'body'
|
||||
elem = 'body';
|
||||
}
|
||||
var list = $(elem).find('[data-toggle="copy-text"]');
|
||||
|
||||
@@ -2395,11 +2394,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
var clipboard = new ClipboardJS(v);
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
admin.msg.success('复制成功')
|
||||
admin.msg.success('复制成功');
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
admin.msg.error('复制失败')
|
||||
admin.msg.error('复制失败');
|
||||
|
||||
});
|
||||
});
|
||||
@@ -2456,23 +2455,24 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
|
||||
for (t = 0, e = f.length; t < e; t++) if (r === f[t]) return !0;
|
||||
if ("object" == typeof r) {
|
||||
for (n in r) if (r.hasOwnProperty(n)) return !1;
|
||||
return !0
|
||||
return !0;
|
||||
}
|
||||
return !1
|
||||
return !1;
|
||||
},
|
||||
|
||||
bytes(size) {
|
||||
if (size > 0) {
|
||||
const kb = 1024
|
||||
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const i = Math.floor(Math.log(size) / Math.log(kb))
|
||||
const num = (size / Math.pow(kb, i)).toPrecision(3)
|
||||
const u = unit[i]
|
||||
const kb = 1024;
|
||||
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
const i = Math.floor(Math.log(size) / Math.log(kb));
|
||||
const num = (size / Math.pow(kb, i)).toPrecision(3);
|
||||
const u = unit[i];
|
||||
return num + u;
|
||||
}
|
||||
return '0B';
|
||||
}
|
||||
|
||||
};
|
||||
return admin;
|
||||
});
|
||||
|
||||
window.ulAdmin = window.ua = admin;
|
||||
})();
|
||||
Reference in New Issue
Block a user