将js代码架构改为app下渲染;

This commit is contained in:
2023-09-18 16:32:46 +08:00
parent 4d9434454e
commit ca729da0a9
86 changed files with 1572 additions and 719 deletions

View 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>

View File

View 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>

View 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="{$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>

View 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();
});

View File

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -111,4 +111,4 @@
</div>
</div>
</div>
</body>
</body>

View 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');
});
});
});
});

View 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();
});

View File

@@ -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>

View File

View 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')

View File

@@ -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>

View 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>');
});
});

View 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',
};

View File

@@ -0,0 +1,3 @@
$(function(){
ua.listen();
})

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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();
});

View 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,
};

View File

@@ -0,0 +1,3 @@
$(function(){
ua.listen();
})

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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',
};

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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();
});

View 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',
};

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View File

@@ -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>

View 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();
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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',
};

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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;
});
});

View File

@@ -0,0 +1,3 @@
$(function () {
ua.listen();
});

View 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();
});

View File

View 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();
});

View 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',
};

View 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");
});
});
});

View 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");
});
});
});

View 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();
});

View 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',
};

View 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();
});

View 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',
};

View 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();
});

View 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();
});

View 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();
});

View 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',
};

View File

@@ -0,0 +1,4 @@
$(function () {
ua.listen();
});

View 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();
});