mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 10:32:48 +08:00
引入easyadmin'
This commit is contained in:
143
public/static/admin/js/index.js
Normal file
143
public/static/admin/js/index.js
Normal file
@@ -0,0 +1,143 @@
|
||||
define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin", "miniTab"], function ($, ea, echarts, undefined, miniAdmin, miniTab) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var options = {
|
||||
iniUrl: ea.url('ajax/initAdmin'), // 初始化接口
|
||||
clearUrl: ea.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 () {
|
||||
ea.request.get({
|
||||
url: 'login/out',
|
||||
prefix: true,
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
window.location = ea.url('login/index');
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
welcome: function () {
|
||||
|
||||
miniTab.listen();
|
||||
|
||||
/**
|
||||
* 查看公告信息
|
||||
**/
|
||||
$('body').on('click', '.layuimini-notice', function () {
|
||||
var title = $(this).children('.layuimini-notice-title').text(),
|
||||
noticeTime = $(this).children('.layuimini-notice-extra').text(),
|
||||
content = $(this).children('.layuimini-notice-content').html();
|
||||
var html = '<div style="padding:15px 20px; text-align:justify; line-height: 22px;border-bottom:1px solid #e2e2e2;background-color: #2f4056;color: #ffffff">\n' +
|
||||
'<div style="text-align: center;margin-bottom: 20px;font-weight: bold;border-bottom:1px solid #718fb5;padding-bottom: 5px"><h4 class="text-danger">' + title + '</h4></div>\n' +
|
||||
'<div style="font-size: 12px">' + content + '</div>\n' +
|
||||
'</div>\n';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '系统公告' + '<span style="float: right;right: 1px;font-size: 12px;color: #b1b3b9;margin-top: 1px">' + noticeTime + '</span>',
|
||||
area: '300px;',
|
||||
shade: 0.8,
|
||||
id: 'layuimini-notice',
|
||||
btn: ['查看', '取消'],
|
||||
btnAlign: 'c',
|
||||
moveType: 1,
|
||||
content: html,
|
||||
success: function (layero) {
|
||||
var btn = layero.find('.layui-layer-btn');
|
||||
btn.find('.layui-layer-btn0').attr({
|
||||
href: 'https://gitee.com/zhongshaofa/layuimini',
|
||||
target: '_blank'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 报表功能
|
||||
*/
|
||||
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]
|
||||
}
|
||||
]
|
||||
};
|
||||
echartsRecords.setOption(optionRecords);
|
||||
window.addEventListener("resize", function () {
|
||||
echartsRecords.resize();
|
||||
});
|
||||
},
|
||||
editAdmin: function () {
|
||||
ea.listen();
|
||||
},
|
||||
editPassword: function () {
|
||||
ea.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
48
public/static/admin/js/login.js
Normal file
48
public/static/admin/js/login.js
Normal file
@@ -0,0 +1,48 @@
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
42
public/static/admin/js/mall/cate.js
Normal file
42
public/static/admin/js/mall/cate.js
Normal file
@@ -0,0 +1,42 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.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: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{width: 250, title: '操作', templet: ea.table.tool}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
83
public/static/admin/js/mall/goods.js
Normal file
83
public/static/admin/js/mall/goods.js
Normal file
@@ -0,0 +1,83 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.table.render({
|
||||
init: init,
|
||||
toolbar: ['refresh',
|
||||
[{
|
||||
text: '添加',
|
||||
url: init.add_url,
|
||||
method: 'open',
|
||||
auth: 'add',
|
||||
class: 'layui-btn layui-btn-normal layui-btn-sm',
|
||||
icon: 'fa fa-plus ',
|
||||
extend: 'data-full="true"',
|
||||
}],
|
||||
'delete', 'export'],
|
||||
cols: [[
|
||||
{type: "checkbox"},
|
||||
{field: 'id', width: 80, title: 'ID'},
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{field: 'cate.title', minWidth: 80, title: '商品分类'},
|
||||
{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: 'discount_price', width: 100, title: '折扣价', templet: ea.table.price},
|
||||
{field: 'total_stock', width: 100, title: '库存统计'},
|
||||
{field: 'stock', width: 100, title: '剩余库存'},
|
||||
{field: 'virtual_sales', width: 100, title: '虚拟销量'},
|
||||
{field: 'sales', width: 80, title: '销量'},
|
||||
{field: 'status', title: '状态', width: 85, selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
operat: [
|
||||
[{
|
||||
text: '编辑',
|
||||
url: init.edit_url,
|
||||
method: 'open',
|
||||
auth: 'edit',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-success',
|
||||
extend: 'data-full="true"',
|
||||
}, {
|
||||
text: '入库',
|
||||
url: init.stock_url,
|
||||
method: 'open',
|
||||
auth: 'stock',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-normal',
|
||||
}],
|
||||
'delete']
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
},
|
||||
stock: function () {
|
||||
ea.listen();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
64
public/static/admin/js/system/admin.js
Normal file
64
public/static/admin/js/system/admin.js
Normal file
@@ -0,0 +1,64 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
|
||||
ea.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: 'phone', minWidth: 80, title: '手机'},
|
||||
{field: 'login_num', minWidth: 80, title: '登录次数'},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
text: '设置密码',
|
||||
url: init.password_url,
|
||||
method: 'open',
|
||||
auth: 'password',
|
||||
class: 'layui-btn layui-btn-normal layui-btn-xs',
|
||||
}],
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
},
|
||||
password: function () {
|
||||
ea.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
90
public/static/admin/js/system/auth.js
Normal file
90
public/static/admin/js/system/auth.js
Normal file
@@ -0,0 +1,90 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.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: ea.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{
|
||||
width: 250,
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
operat: [
|
||||
'edit',
|
||||
[{
|
||||
text: '授权',
|
||||
url: init.authorize_url,
|
||||
method: 'open',
|
||||
auth: 'authorize',
|
||||
class: 'layui-btn layui-btn-normal layui-btn-xs',
|
||||
}],
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
},
|
||||
authorize: function () {
|
||||
var tree = layui.tree;
|
||||
|
||||
ea.request.get(
|
||||
{
|
||||
url: window.location.href,
|
||||
}, function (res) {
|
||||
res.data = res.data || [];
|
||||
tree.render({
|
||||
elem: '#node_ids',
|
||||
data: res.data,
|
||||
showCheckbox: true,
|
||||
id: 'nodeDataId',
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ea.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;
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
23
public/static/admin/js/system/config.js
Normal file
23
public/static/admin/js/system/config.js
Normal file
@@ -0,0 +1,23 @@
|
||||
define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {
|
||||
|
||||
var form = layui.form;
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
upload_type: upload_type
|
||||
}
|
||||
});
|
||||
|
||||
form.on("radio(upload_type)", function (data) {
|
||||
app.upload_type = this.value;
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
35
public/static/admin/js/system/log.js
Normal file
35
public/static/admin/js/system/log.js
Normal file
@@ -0,0 +1,35 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
|
||||
var init = {
|
||||
table_elem: '#currentTable',
|
||||
table_render_id: 'currentTableRenderId',
|
||||
index_url: 'system.log/index',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var util = layui.util;
|
||||
ea.table.render({
|
||||
init: init,
|
||||
toolbar: ['refresh'],
|
||||
cols: [[
|
||||
{field: 'id', width: 80, title: 'ID', search: false},
|
||||
{field: 'month', title: '日志月份', hide: true, search: 'time', timeType: 'month', searchValue: util.toDateString(new Date(), 'yyyy-MM')},
|
||||
{field: 'admin.username', minWidth: 80, title: '后台用户', search: false},
|
||||
{field: 'method', minWidth: 80, title: '请求方法'},
|
||||
{field: 'url', minWidth: 80, title: '路由地址'},
|
||||
{field: 'title', minWidth: 80, title: '日志标题'},
|
||||
{field: 'content', minWidth: 80, title: '操作内容'},
|
||||
{field: 'ip', minWidth: 80, title: 'IP地址'},
|
||||
{field: 'useragent', minWidth: 80, title: 'useragent'},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
};
|
||||
|
||||
return Controller;
|
||||
});
|
||||
195
public/static/admin/js/system/menu.js
Normal file
195
public/static/admin/js/system/menu.js
Normal file
@@ -0,0 +1,195 @@
|
||||
define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
|
||||
var renderTable = function () {
|
||||
layer.load(2);
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
homdPid: 99999999,
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
url: ea.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([[
|
||||
{type: 'checkbox'},
|
||||
{field: 'title', width: 250, title: '菜单名称', align: 'left'},
|
||||
{field: 'icon', width: 80, title: '图标', templet: ea.table.icon},
|
||||
{field: 'href', minWidth: 120, title: '菜单链接'},
|
||||
{
|
||||
field: 'is_home',
|
||||
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', title: '状态', width: 85, templet: ea.table.switch},
|
||||
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
||||
{
|
||||
width: 200,
|
||||
title: '操作',
|
||||
templet: ea.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"',
|
||||
}, {
|
||||
text: '编辑',
|
||||
url: init.edit_url,
|
||||
method: 'open',
|
||||
auth: 'edit',
|
||||
class: 'layui-btn layui-btn-xs layui-btn-success',
|
||||
extend: 'data-full="true"',
|
||||
}],
|
||||
'delete'
|
||||
]
|
||||
}
|
||||
]], init),
|
||||
done: function () {
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
renderTable();
|
||||
|
||||
$('body').on('click', '[data-treetable-refresh]', function () {
|
||||
renderTable();
|
||||
});
|
||||
|
||||
$('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 ? ea.url(url) : window.location.href;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
ea.msg.error('请勾选需要删除的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
$.each(data, function (i, v) {
|
||||
ids.push(v.id);
|
||||
});
|
||||
ea.msg.confirm('确定删除?', function () {
|
||||
ea.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: ids
|
||||
},
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
renderTable();
|
||||
});
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
ea.table.listenSwitch({filter: 'status', url: init.modify_url});
|
||||
|
||||
ea.table.listenEdit(init, 'currentTable', init.table_render_id, true);
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: 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: ea.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) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
});
|
||||
});
|
||||
},
|
||||
edit: 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: ea.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) {
|
||||
return data;
|
||||
}, function (res) {
|
||||
ea.msg.success(res.msg, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.$('[data-treetable-refresh]').trigger("click");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
69
public/static/admin/js/system/node.js
Normal file
69
public/static/admin/js/system/node.js
Normal file
@@ -0,0 +1,69 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.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', minWidth: 200, align: 'left', title: '系统节点'},
|
||||
{field: 'title', minWidth: 80, title: '节点名称 <i class="table-edit-tips color-red">*</i>', edit: 'text'},
|
||||
{field: 'update_time', minWidth: 80, title: '更新时间', search: 'range'},
|
||||
{field: 'is_auth', title: '节点控制', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
86
public/static/admin/js/system/quick.js
Normal file
86
public/static/admin/js/system/quick.js
Normal file
@@ -0,0 +1,86 @@
|
||||
define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.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: 'href', minWidth: 120, title: '快捷链接'},
|
||||
{field: 'remark', minWidth: 80, title: '备注信息'},
|
||||
{field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
||||
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
||||
{width: 250, title: '操作', templet: ea.table.tool, operat: ['edit', 'delete']}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: 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: ea.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();
|
||||
},
|
||||
edit: 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: ea.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();
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
46
public/static/admin/js/system/uploadfile.js
Normal file
46
public/static/admin/js/system/uploadfile.js
Normal file
@@ -0,0 +1,46 @@
|
||||
define(["jquery", "easy-admin"], function ($, ea) {
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
var Controller = {
|
||||
|
||||
index: function () {
|
||||
ea.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.image},
|
||||
{field: 'url', minWidth: 120, title: '保存地址', templet: ea.table.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: ea.table.tool, operat: ['delete']}
|
||||
]],
|
||||
});
|
||||
|
||||
ea.listen();
|
||||
},
|
||||
add: function () {
|
||||
ea.listen();
|
||||
},
|
||||
edit: function () {
|
||||
ea.listen();
|
||||
},
|
||||
password: function () {
|
||||
ea.listen();
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Reference in New Issue
Block a user