This commit is contained in:
你的名字
2025-10-15 14:53:54 +08:00
commit ac0f12b21a
864 changed files with 200931 additions and 0 deletions

View File

@ -0,0 +1,92 @@
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',
};
return {
index: function () {
let _table = ea.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID', searchOp: '='},
{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: 'role', minWidth: 80, title: '角色权限', align: 'left', search: 'none', templet: function (d) {
let auth_ids = d.auth_ids || []
let html = ``
$.each(auth_ids, (idx, item) =>
html += `<span class="layui-badge">${auth_list[item] || '-'}</span> `
)
return html
}
},
{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'
]
}
]],
});
$('body').on('click', '[data-table-reset]', function () {
$('.layui-menu li').removeClass('layui-menu-item-checked').animate(
{}, 0, () => $('.layui-menu li:eq(0)').addClass('layui-menu-item-checked')
)
})
layui.util.on({
authSearch: function (e) {
let auth_id = $(this).data('auth_id')
$('.layui-menu li').removeClass('layui-menu-item-checked').animate(
{}, 0, () => $(this).parents('li').addClass('layui-menu-item-checked')
)
let _where = auth_id ? {
filter: JSON.stringify({auth_ids: auth_id}),
op: JSON.stringify({auth_ids: 'find_in_set'})
} : {}
_table.reload({where: _where})
},
})
ea.listen();
},
add: function () {
ea.listen();
},
edit: function () {
ea.listen();
},
password: function () {
ea.listen();
}
};
});

View File

@ -0,0 +1,107 @@
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',
};
return {
index: function () {
ea.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID', searchOp: '='},
{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 () {
let setting = {
check: {
enable: true,
chkStyle: "checkbox",
},
view: {
showIcon: true,
showLine: true,
selectedMulti: false,
dblClickExpand: false
}, callback: {
onClick: function (e, treeId, treeNode, clickFlag) {
treeObj.checkNode(treeNode, !treeNode.checked, true);
}
}
};
let treeObj
let treeData = []
ea.request.get({url: window.location.href}, function (res) {
res.data = res.data || [];
$.each(res.data, function (index, value) {
treeData[index] = []
treeData[index].id = value.id
treeData[index].name = value.title
treeData[index].pId = 0
treeData[index].open = true
let children = value.children
treeData[index]['children'] = []
$.each(children, function (idx, val) {
treeData[index]['children'].push({id: val.id, name: val.title, checked: val.checked, pId: value.id})
})
})
$.fn.zTree.init($("#tree"), setting, treeData);
treeObj = $.fn.zTree.getZTreeObj("tree");
}
);
ea.listen(function (data) {
let checkedData = treeObj.getCheckedNodes();
let ids = []
for (var i = 0; i < checkedData.length; i++) {
ids.push(checkedData[i].id)
}
data.node = JSON.stringify(ids);
return data;
});
}
}
}
)

View File

@ -0,0 +1,34 @@
define(["jquery", "easy-admin"], function ($, ea) {
var form = layui.form;
return {
index: function () {
var _group = 'site'
let tabs = layui.tabs
var TABS_ID = 'docDemoTabBrief';
tabs.on(`afterChange(${TABS_ID})`, function (data) {
_group = $(this).data('group')
})
let _upload_type = upload_type || 'local'
$('.upload_type').addClass('layui-hide')
$('.' + _upload_type).removeClass('layui-hide')
form.on("radio(upload_type)", function (data) {
_upload_type = this.value;
$('.upload_type').addClass('layui-hide')
$('.' + _upload_type).removeClass('layui-hide')
});
form.on("submit", function (data) {
data.field['group'] = _group
});
ea.listen('', function (res) {
ea.msg.success(res.msg);
}, function (err) {
ea.msg.error(err.msg);
});
}
};
});

View File

@ -0,0 +1,208 @@
define(["jquery", "easy-admin", "miniTab"], function ($, ea, miniTab) {
var form = layui.form;
var table = layui.table;
var init = {
save_url: 'system.curd_generate/save',
};
return {
index: function () {
let element = layui.element;
element.on('tab(curd-hash)', function (obj) {
let id = obj.id
let _html = `
<div style="padding: 50px 25px;">
<fieldset class="layui-elem-field">
<legend>提示</legend>
<div class="layui-field-box">
<p><a class="layui-font-blue" target="_blank" rel="nofollow" href="https://edocs.easyadmin8.top/#/md/curd/command">命令可查询文档</a></p>
</div>
</fieldset>
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-input-group" style="width: 100%;">
<div class="layui-input-split layui-input-prefix" style="width: 100px;">
php think curd
</div>
<input type="text" class="layui-input" name="command" placeholder="在这里输入命令参数" lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid layui-bg-cyan" type="button" lay-submit="system.CurdGenerate/save?type=console" lay-filter="curd-console-submit">一键执行</button>
</div>
</form>
</div>
`
if (id == '2') {
layer.open({
title: '命令行一键生成 CRUD/CRUD',
type: 1,
shade: 0.3,
shadeClose: false,
area: ['42%', 'auto'],
content: _html,
success: function () {
form.on('submit(curd-console-submit)', function (data) {
let field = data.field
let url = $(this).attr('lay-submit')
let options = {url: ea.url(url), data: field}
ea.msg.confirm('确认执行该操作?<br>如果命令行中存在强制覆盖或者删除将会马上执行!', function () {
ea.request.post(options, function (rs) {
let msg = rs.msg || '未知~'
layer.msg(msg.replace(/\n/g, '<br>'), {shade: 0.3, shadeClose: true})
let code = rs?.code || '-1'
if (code != '1') return
})
})
})
},
end: function () {
element.tabChange('curd-hash', '1');
}
})
}
});
miniTab.listen();
let createStatus = false
let tb_prefix
let tb_name
form.on('submit(search)', function (data) {
let field = data.field
tb_prefix = field.tb_prefix
tb_name = field.tb_name
ea.request.get({url: $(this).attr('lay-submit'), prefix: true, data: field}, function (res) {
createStatus = true
$('.tableShow').removeClass('layui-hide')
$('.table-text').text(field.tb_prefix + field.tb_name)
let _data = res.data
let fieldsHtml = ``
$.each(_data.list, function (i, v) {
if (v.Key != 'PRI') fieldsHtml += `
<div class="input_tag">
<input lay-skin="tag" class="checkbox_${v.Field}" type="checkbox"
title="${v.Field} (${v.Type})" value="${v.Field}" lay-filter="checkbox-filter" />
</div>
`
})
$('.table_fields').html(fieldsHtml)
form.render('checkbox')
form.on('checkbox(checkbox-filter)', function (data) {
let _checked = data.elem.checked
$.each($(`.checkbox_${data.value}`), function (i, v) {
if (i > 0) $(this).prop('checked', false);
})
$(data.elem).prop('checked', _checked);
});
table.render({
elem: '#currentTable', cols: [
[
{field: 'name', title: '字段', minWidth: 80},
{field: 'type', title: '类型', minWidth: 80},
{field: 'key', title: '键', minWidth: 80},
{field: 'extra', title: '是否自增', minWidth: 80},
{field: 'null', title: '是否为空', minWidth: 80},
{field: 'desc', title: '描述', minWidth: 80},
]
], data: _data.data, page: false,
});
}, function (error) {
createStatus = false
ea.msg.error(error.msg)
$('.tableShow').addClass('layui-hide')
return
})
form.on('submit(add)', function (data) {
let table = $('.table-text').text()
if (!table || !createStatus) {
ea.msg.error('请先查询数据')
return
}
let url = $(this).attr('lay-submit')
let fields = {}
$.each($('.table_fields'), function (i, v) {
let _name = $(this).data('name')
let _inputs = {}
$.each($(v).find('.input_tag'), function (i, v) {
let checkedVal = $(this).find('input:checked').val()
if (checkedVal) {
_inputs[i] = checkedVal
}
})
fields[_name] = _inputs
})
let options = {url: url, prefix: true, data: {tb_prefix: tb_prefix, tb_name: tb_name, tb_fields: fields}}
layer.confirm('确定要自动生成【' + table + '】对应的CURD?', function (index) {
ea.request.post(options, function (res) {
createStatus = true
ea.msg.success(res.msg)
appendHtml(res['data']['result'], res['data']['link'])
}, function (error) {
createStatus = false
let code = error.code
if (code != '1') {
if (code < 0) {
createStatus = true
layer.confirm(error.msg, {
btn: ['确定强制覆盖生成', '取消'], title: '提示', icon: 0,
yes: function () {
options.prefix = false
options.data.force = 1
ea.request.post(options, function (rs) {
createStatus = true
ea.msg.success(rs.msg)
appendHtml(rs['data']['result'], rs['data']['link'])
})
}
});
return
}
ea.msg.error(error.msg)
return
}
})
})
})
form.on('submit(delete)', function (data) {
let table = $('.table-text').text()
if (!table || !createStatus) {
ea.msg.error('请先查询数据')
return
}
let url = $(this).attr('lay-submit')
let options = {url: url, prefix: true, data: {tb_prefix: tb_prefix, tb_name: tb_name}}
layer.confirm('确定要删除【' + table + '】对应CURD的文件?<br>确定清楚自己在做什么!', function (index) {
ea.request.post(options, function (res) {
ea.msg.success(res.msg)
$('.table-text').text('')
$('.file-list').empty()
$('.table_fields').empty()
$('.tableShow').addClass('layui-hide')
createStatus = false
})
})
})
return
})
function appendHtml(array, link) {
$('.file-list').empty()
let html = ''
$.each(array, function (idx, item) {
html += '<li class="layui-form-item">' + item + '</li>'
})
html += '<a layuimini-content-href="' + link + '" data-title="页面预览">' +
'<button class="layui-btn"><i class="layui-icon layui-icon-link"></i> 自动生成页面预览</button>' +
'</a>'
$('.file-list').html(html)
}
}
};
});

View File

@ -0,0 +1,92 @@
define(["jquery", "easy-admin"], function ($, ea) {
var init = {
table_elem: '#currentTable',
table_render_id: 'currentTableRenderId',
index_url: 'system.log/index',
export_url: 'system.log/export',
deleteMonthLog_url: 'system.log/deleteMonthLog',
};
return {
index: function () {
var util = layui.util;
ea.table.render({
init: init,
lineStyle: 'height: auto;word-break: break-all;',
toolbar: ['refresh', 'export',
[{
text: '框架日志',
url: 'system.log/record',
method: 'open',
auth: 'record',
class: 'layui-btn layui-btn-sm',
icon: 'fa fa-book',
extend: 'data-width="95%" data-height="95%"'
}, {
text: '删除部分日志',
url: 'system.log/deleteMonthLog',
method: 'open',
auth: 'deleteMonthLog',
class: 'layui-btn layui-btn-sm layui-btn-danger',
icon: 'fa fa-remove',
extend: 'data-width="35%" data-height="42%"'
},]
],
cols: [[
{field: 'id', width: 80, title: 'ID', search: false},
{field: 'month', width: 80, title: '日志月份', hide: true, search: 'time', timeType: 'month', searchValue: util.toDateString(new Date(), 'yyyy-MM')},
{
field: 'admin.username', width: 100, title: '后台用户', search: false, templet: function (res) {
let admin = res.admin
return admin ? admin.username : '-'
}
},
{field: 'method', width: 100, title: '请求方法'},
{field: 'title', minWidth: 180, title: '请求标题'},
{field: 'ip', width: 150, title: 'IP地址'},
{field: 'url', minWidth: 150, title: '路由地址', align: "left"},
{
field: 'content', minWidth: 200, title: '请求数据', align: "left", templet: function (res) {
let html = '<div class="layui-colla-item">' +
'<div class="layui-colla-title">点击预览</div>' +
'<div class="layui-colla-content">' + prettyFormat(JSON.stringify(res.content)) + '</div>' +
'</div>'
return '<div class="layui-collapse" lay-accordion>' + html + '</div>'
}
},
{
field: 'response', minWidth: 200, title: '回调数据', align: "left", templet: function (res) {
let html = '<div class="layui-colla-item">' +
'<div class="layui-colla-title">点击预览</div>' +
'<div class="layui-colla-content">' + prettyFormat(JSON.stringify(res.response)) + '</div>' +
'</div>'
return '<div class="layui-collapse" lay-accordion>' + html + '</div>'
}
},
{field: 'create_time', minWidth: 100, title: '创建时间', search: 'range'},
]],
done: function () {
layui.element.render('collapse')
}
});
ea.listen();
},
deleteMonthLog: function () {
layui.form.on('submit(submit)', function (data) {
let field = data.field
let options = {
url: ea.url(init.deleteMonthLog_url),
data: field,
}
ea.msg.confirm('确认执行该操作?重要数据请先做好相关备份!', function () {
ea.request.post(options, function (rs) {
let msg = rs.msg || '未知~'
layer.msg(msg.replace(/\n/g, '<br>'), {shade: 0.3, shadeClose: true, time: 2000})
})
})
})
}
};
});

View File

@ -0,0 +1,213 @@
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',
};
return {
index: function () {
var renderTable = function () {
layer.load(2);
treetable.render({
where: {limit: 9999},
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: 230,
title: '操作',
templet: ea.table.tool,
operat: [
[{
text: '添加下级',
url: init.add_url,
method: 'open',
auth: 'add',
class: 'layui-btn layui-btn-xs layui-btn-normal',
}, {
text: '编辑',
url: init.edit_url,
method: 'open',
auth: 'edit',
class: 'layui-btn layui-btn-xs layui-btn-success',
}],
'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;
});
$('body').on('click', '[data-treetable-arrow]', function () {
const $icon = $(this).find('i');
const $textNode = $icon[0].nextSibling;
if ($icon.hasClass('fa-arrow-up')) {
treetable.foldAll(init.table_elem);
$icon.removeClass('fa-arrow-up').addClass('fa-arrow-down');
$textNode.textContent = ' 一键展开';
$(this).attr('data-arrow', 'down');
} else {
treetable.expandAll(init.table_elem);
$icon.removeClass('fa-arrow-down').addClass('fa-arrow-up');
$textNode.textContent = ' 一键折叠';
$(this).attr('data-arrow', 'up');
}
})
ea.table.listenSwitch({filter: 'status', url: init.modify_url});
ea.table.listenEdit(init, 'currentTable', init.table_render_id, true);
ea.listen();
},
add: function () {
$(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 () {
$(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");
});
});
}
};
});

View File

@ -0,0 +1,83 @@
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',
menu_url: 'system.node/refreshMenu',
};
return {
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 + '"',
},{
text: '刷新目录菜单',
title: '确定刷新菜单?',
url: 'system.node/refreshMenu',
method: 'request',
auth: 'menu',
class: 'layui-btn layui-btn-sm layui-btn-info',
icon: 'fa fa-list',
extend: 'data-table="' + init.table_render_id + '"',
}
]],
cols: [[
{
field: 'node', minWidth: 200, align: 'left', title: '系统节点', templet: function (d) {
return `<span>${d.node}</span>`;
}
},
{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();
}
};
});

View File

@ -0,0 +1,89 @@
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',
};
return {
index: function () {
ea.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID', searchOp: '='},
{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 () {
$(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">{{d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen();
},
edit: function () {
$(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">{{d.title}}</span>',
onselect: function (resp) {
}
});
ea.listen();
},
};
});

View File

@ -0,0 +1,45 @@
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',
};
return {
index: function () {
ea.table.render({
init: init,
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID', searchOp: '='},
{field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: upload_types},
{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();
}
};
});