feat: 后端全量更新 - 含所有本次需求
- Contract.php: 返回合约账户余额(balance_contract) - My.php: 地址管理增加BTC/ETH - AppContract.php: 一键平仓(closeall) - AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2) - site.php: 手续费减半(0.018→0.009) - agent_permission_setup.sql: 代理权限SQL - crypto_news_crawler.py: 新闻自动采集脚本
This commit is contained in:
Executable
+223
@@ -0,0 +1,223 @@
|
||||
define([], function () {
|
||||
require.config({
|
||||
paths: {
|
||||
knob: "../addons/btpanel/js/jquery.knob",
|
||||
codemirror: "../addons/btpanel/js/codemirror",
|
||||
loading: "../addons/btpanel/js/loading",
|
||||
},
|
||||
shim: {
|
||||
knob: ['jquery'],
|
||||
codemirror: ['css!../addons/btpanel/js/codemirror.css'],
|
||||
loading: ['jquery']
|
||||
}
|
||||
});
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
'async': '../addons/example/js/async',
|
||||
'BMap': ['//api.map.baidu.com/api?v=2.0&ak='],
|
||||
},
|
||||
shim: {
|
||||
'BMap': {
|
||||
deps: ['jquery'],
|
||||
exports: 'BMap'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.actionname == 'index') {
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
'kefu': '../addons/kefu/js/kefu'
|
||||
},
|
||||
shim: {
|
||||
'kefu': {
|
||||
deps: ['css!../addons/kefu/css/kefu_admin_default.css'],
|
||||
exports: 'KeFu'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(['kefu'], function (KeFu) {
|
||||
KeFu.initialize(document.domain, 'admin');
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
var parentConifg = window.parent.Config;
|
||||
} catch (err) {
|
||||
var parentConifg = false;
|
||||
}
|
||||
|
||||
if (parentConifg && parentConifg.modulename == 'admin') {
|
||||
// 监听后台iframe内的快捷键打开会话窗口
|
||||
$(document).on('keyup', function (event) {
|
||||
|
||||
if (window.parent.KeFu) {
|
||||
|
||||
// console.log('当前按钮的code-iframe内:', event.keyCode);
|
||||
|
||||
// 对打开会话窗口的监听
|
||||
// 打开会话窗口快捷键[ctrl + /],若需修改,请拿到对应键的keyCode替换下一行的191即可,191代表[/]键的keyCode
|
||||
if (event.keyCode === 191 && event.ctrlKey) {
|
||||
|
||||
if (window.parent.KeFu.last_sender) {
|
||||
if (parseInt(window.parent.KeFu.last_sender) === window.parent.KeFu.session_id) {
|
||||
// 展开分组
|
||||
if (!window.parent.KeFu.group_show.dialogue) {
|
||||
$('#heading_dialogue a').click();
|
||||
}
|
||||
} else {
|
||||
window.parent.KeFu.changeSession(window.parent.KeFu.last_sender);
|
||||
window.parent.KeFu.last_sender = null;
|
||||
}
|
||||
} else if (window.parent.KeFu.window_is_show) {
|
||||
window.parent.KeFu.toggle_window('hide');
|
||||
}
|
||||
|
||||
if (!window.parent.KeFu.window_is_show) {
|
||||
window.parent.KeFu.toggle_window('show');
|
||||
}
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
'kefu': '../addons/kefu/js/kefu'
|
||||
},
|
||||
shim: {
|
||||
'kefu': {
|
||||
deps: ['css!../addons/kefu/css/kefu_default.css'],
|
||||
exports: 'KeFu'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(['kefu'], function (KeFu) {
|
||||
KeFu.initialize(document.domain, 'index');
|
||||
});
|
||||
}
|
||||
}
|
||||
require.config({
|
||||
paths: {
|
||||
'summernote': '../addons/summernote/lang/summernote-zh-CN.min'
|
||||
},
|
||||
shim: {
|
||||
'summernote': ['../addons/summernote/js/summernote.min', 'css!../addons/summernote/css/summernote.css'],
|
||||
}
|
||||
});
|
||||
require(['form', 'upload'], function (Form, Upload) {
|
||||
var _bindevent = Form.events.bindevent;
|
||||
Form.events.bindevent = function (form) {
|
||||
_bindevent.apply(this, [form]);
|
||||
try {
|
||||
//绑定summernote事件
|
||||
if ($(".summernote,.editor", form).size() > 0) {
|
||||
require(['summernote'], function () {
|
||||
var imageButton = function (context) {
|
||||
var ui = $.summernote.ui;
|
||||
var button = ui.button({
|
||||
contents: '<i class="fa fa-file-image-o"/>',
|
||||
tooltip: __('Choose'),
|
||||
click: function () {
|
||||
parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=image/*", __('Choose'), {
|
||||
callback: function (data) {
|
||||
var urlArr = data.url.split(/\,/);
|
||||
$.each(urlArr, function () {
|
||||
var url = Fast.api.cdnurl(this);
|
||||
context.invoke('editor.insertImage', url);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return button.render();
|
||||
};
|
||||
var attachmentButton = function (context) {
|
||||
var ui = $.summernote.ui;
|
||||
var button = ui.button({
|
||||
contents: '<i class="fa fa-file"/>',
|
||||
tooltip: __('Choose'),
|
||||
click: function () {
|
||||
parent.Fast.api.open("general/attachment/select?element_id=&multiple=true&mimetype=*", __('Choose'), {
|
||||
callback: function (data) {
|
||||
var urlArr = data.url.split(/\,/);
|
||||
$.each(urlArr, function () {
|
||||
var url = Fast.api.cdnurl(this);
|
||||
var node = $("<a href='" + url + "'>" + url + "</a>");
|
||||
context.invoke('insertNode', node[0]);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return button.render();
|
||||
};
|
||||
|
||||
$(".summernote,.editor", form).summernote({
|
||||
height: 250,
|
||||
lang: 'zh-CN',
|
||||
fontNames: [
|
||||
'Arial', 'Arial Black', 'Serif', 'Sans', 'Courier',
|
||||
'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande',
|
||||
"Open Sans", "Hiragino Sans GB", "Microsoft YaHei",
|
||||
'微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆',
|
||||
],
|
||||
fontNamesIgnoreCheck: [
|
||||
"Open Sans", "Microsoft YaHei",
|
||||
'微软雅黑', '宋体', '黑体', '仿宋', '楷体', '幼圆'
|
||||
],
|
||||
toolbar: [
|
||||
['style', ['style', 'undo', 'redo']],
|
||||
['font', ['bold', 'underline', 'strikethrough', 'clear']],
|
||||
['fontname', ['color', 'fontname', 'fontsize']],
|
||||
['para', ['ul', 'ol', 'paragraph', 'height']],
|
||||
['table', ['table', 'hr']],
|
||||
['insert', ['link', 'picture', 'video']],
|
||||
['select', ['image', 'attachment']],
|
||||
['view', ['fullscreen', 'codeview', 'help']],
|
||||
],
|
||||
buttons: {
|
||||
image: imageButton,
|
||||
attachment: attachmentButton,
|
||||
},
|
||||
dialogsInBody: true,
|
||||
followingToolbar: false,
|
||||
callbacks: {
|
||||
onChange: function (contents) {
|
||||
$(this).val(contents);
|
||||
$(this).trigger('change');
|
||||
},
|
||||
onInit: function () {
|
||||
},
|
||||
onImageUpload: function (files) {
|
||||
var that = this;
|
||||
//依次上传图片
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
Upload.api.send(files[i], function (data) {
|
||||
var url = Fast.api.cdnurl(data.url);
|
||||
$(that).summernote("insertImage", url, 'filename');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
Executable
+840
@@ -0,0 +1,840 @@
|
||||
/*! AdminLTE app.js
|
||||
* ================
|
||||
* Main JS application file for AdminLTE v2. This file
|
||||
* should be included in all pages. It controls some layout
|
||||
* options and implements exclusive AdminLTE plugins.
|
||||
*
|
||||
* @Author Almsaeed Studio
|
||||
* @Support <http://www.almsaeedstudio.com>
|
||||
* @Email <abdullah@almsaeedstudio.com>
|
||||
* @version 2.3.8
|
||||
* @license MIT <http://opensource.org/licenses/MIT>
|
||||
*/
|
||||
|
||||
//Make sure jQuery has been loaded before app.js
|
||||
if (typeof jQuery === "undefined") {
|
||||
throw new Error("AdminLTE requires jQuery");
|
||||
}
|
||||
|
||||
/* AdminLTE
|
||||
*
|
||||
* @type Object
|
||||
* @description $.AdminLTE is the main object for the template's app.
|
||||
* It's used for implementing functions and options related
|
||||
* to the template. Keeping everything wrapped in an object
|
||||
* prevents conflict with other plugins and is a better
|
||||
* way to organize our code.
|
||||
*/
|
||||
$.AdminLTE = {};
|
||||
|
||||
/* --------------------
|
||||
* - AdminLTE Options -
|
||||
* --------------------
|
||||
* Modify these options to suit your implementation
|
||||
*/
|
||||
$.AdminLTE.options = {
|
||||
//Add slimscroll to navbar menus
|
||||
//This requires you to load the slimscroll plugin
|
||||
//in every page before app.js
|
||||
navbarMenuSlimscroll: true,
|
||||
navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar
|
||||
navbarMenuHeight: "200px", //The height of the inner menu
|
||||
//General animation speed for JS animated elements such as box collapse/expand and
|
||||
//sidebar treeview slide up/down. This options accepts an integer as milliseconds,
|
||||
//'fast', 'normal', or 'slow'
|
||||
animationSpeed: 300,
|
||||
//Sidebar push menu toggle button selector
|
||||
sidebarToggleSelector: "[data-toggle='offcanvas']",
|
||||
//Activate sidebar push menu
|
||||
sidebarPushMenu: true,
|
||||
//Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin)
|
||||
sidebarSlimScroll: true,
|
||||
//Enable sidebar expand on hover effect for sidebar mini
|
||||
//This option is forced to true if both the fixed layout and sidebar mini
|
||||
//are used together
|
||||
sidebarExpandOnHover: false,
|
||||
//BoxRefresh Plugin
|
||||
enableBoxRefresh: true,
|
||||
//Bootstrap.js tooltip
|
||||
enableBSToppltip: true,
|
||||
BSTooltipSelector: "[data-toggle='tooltip']",
|
||||
//Enable Fast Click. Fastclick.js creates a more
|
||||
//native touch experience with touch devices. If you
|
||||
//choose to enable the plugin, make sure you load the script
|
||||
//before AdminLTE's app.js
|
||||
enableFastclick: false,
|
||||
//Control Sidebar Tree views
|
||||
enableControlTreeView: true,
|
||||
//Control Sidebar Options
|
||||
enableControlSidebar: true,
|
||||
controlSidebarOptions: {
|
||||
//Which button should trigger the open/close event
|
||||
toggleBtnSelector: "[data-toggle='control-sidebar']",
|
||||
//The sidebar selector
|
||||
selector: ".control-sidebar",
|
||||
//Enable slide over content
|
||||
slide: true
|
||||
},
|
||||
//Box Widget Plugin. Enable this plugin
|
||||
//to allow boxes to be collapsed and/or removed
|
||||
enableBoxWidget: true,
|
||||
//Box Widget plugin options
|
||||
boxWidgetOptions: {
|
||||
boxWidgetIcons: {
|
||||
//Collapse icon
|
||||
collapse: 'fa-minus',
|
||||
//Open icon
|
||||
open: 'fa-plus',
|
||||
//Remove icon
|
||||
remove: 'fa-times'
|
||||
},
|
||||
boxWidgetSelectors: {
|
||||
//Remove button selector
|
||||
remove: '[data-widget="remove"]',
|
||||
//Collapse button selector
|
||||
collapse: '[data-widget="collapse"]'
|
||||
}
|
||||
},
|
||||
//Direct Chat plugin options
|
||||
directChat: {
|
||||
//Enable direct chat by default
|
||||
enable: true,
|
||||
//The button to open and close the chat contacts pane
|
||||
contactToggleSelector: '[data-widget="chat-pane-toggle"]'
|
||||
},
|
||||
//Define the set of colors to use globally around the website
|
||||
colors: {
|
||||
lightBlue: "#3c8dbc",
|
||||
red: "#f56954",
|
||||
green: "#00a65a",
|
||||
aqua: "#00c0ef",
|
||||
yellow: "#f39c12",
|
||||
blue: "#0073b7",
|
||||
navy: "#001F3F",
|
||||
teal: "#39CCCC",
|
||||
olive: "#3D9970",
|
||||
lime: "#01FF70",
|
||||
orange: "#FF851B",
|
||||
fuchsia: "#F012BE",
|
||||
purple: "#8E24AA",
|
||||
maroon: "#D81B60",
|
||||
black: "#222222",
|
||||
gray: "#d2d6de"
|
||||
},
|
||||
//The standard screen sizes that bootstrap uses.
|
||||
//If you change these in the variables.less file, change
|
||||
//them here too.
|
||||
screenSizes: {
|
||||
xs: 480,
|
||||
sm: 768,
|
||||
md: 992,
|
||||
lg: 1200
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------
|
||||
* - Implementation -
|
||||
* ------------------
|
||||
* The next block of code implements AdminLTE's
|
||||
* functions and plugins as specified by the
|
||||
* options above.
|
||||
*/
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
//Fix for IE page transitions
|
||||
$("body").removeClass("hold-transition");
|
||||
|
||||
//Extend options if external options exist
|
||||
if (typeof AdminLTEOptions !== "undefined") {
|
||||
$.extend(true,
|
||||
$.AdminLTE.options,
|
||||
AdminLTEOptions);
|
||||
}
|
||||
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
$.AdminLTE.options.sidebarSlimScroll = false;
|
||||
$(".main-sidebar").css({height: ($(window).height() - $(".main-header").height()) + "px", overflow: "scroll"});
|
||||
}
|
||||
|
||||
//Easy access to options
|
||||
var o = $.AdminLTE.options;
|
||||
|
||||
//Set up the object
|
||||
_init();
|
||||
|
||||
//Activate the layout maker
|
||||
$.AdminLTE.layout.activate();
|
||||
|
||||
//Enable sidebar tree view controls
|
||||
if (o.enableControlTreeView) {
|
||||
$.AdminLTE.tree('.sidebar');
|
||||
}
|
||||
|
||||
//Enable control sidebar
|
||||
if (o.enableControlSidebar) {
|
||||
$.AdminLTE.controlSidebar.activate();
|
||||
}
|
||||
|
||||
//Add slimscroll to navbar dropdown
|
||||
if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
|
||||
$(".navbar .menu").slimscroll({
|
||||
height: o.navbarMenuHeight,
|
||||
alwaysVisible: false,
|
||||
size: o.navbarMenuSlimscrollWidth
|
||||
}).css("width", "100%");
|
||||
}
|
||||
|
||||
//Activate sidebar push menu
|
||||
if (o.sidebarPushMenu) {
|
||||
$.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
|
||||
}
|
||||
|
||||
//Activate Bootstrap tooltip
|
||||
if (o.enableBSToppltip) {
|
||||
$('body').tooltip({
|
||||
selector: o.BSTooltipSelector,
|
||||
container: 'body'
|
||||
});
|
||||
}
|
||||
|
||||
//Activate box widget
|
||||
if (o.enableBoxWidget) {
|
||||
$.AdminLTE.boxWidget.activate();
|
||||
}
|
||||
|
||||
//Activate fast click
|
||||
if (o.enableFastclick && typeof FastClick != 'undefined') {
|
||||
FastClick.attach(document.body);
|
||||
}
|
||||
|
||||
//Activate direct chat widget
|
||||
if (o.directChat.enable) {
|
||||
$(document).on('click', o.directChat.contactToggleSelector, function () {
|
||||
var box = $(this).parents('.direct-chat').first();
|
||||
box.toggleClass('direct-chat-contacts-open');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* INITIALIZE BUTTON TOGGLE
|
||||
* ------------------------
|
||||
*/
|
||||
$('.btn-group[data-toggle="btn-toggle"]').each(function () {
|
||||
var group = $(this);
|
||||
$(this).find(".btn").on('click', function (e) {
|
||||
group.find(".btn.active").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
/* ----------------------------------
|
||||
* - Initialize the AdminLTE Object -
|
||||
* ----------------------------------
|
||||
* All AdminLTE functions are implemented below.
|
||||
*/
|
||||
function _init() {
|
||||
'use strict';
|
||||
/* Layout
|
||||
* ======
|
||||
* Fixes the layout height in case min-height fails.
|
||||
*
|
||||
* @type Object
|
||||
* @usage $.AdminLTE.layout.activate()
|
||||
* $.AdminLTE.layout.fix()
|
||||
* $.AdminLTE.layout.fixSidebar()
|
||||
*/
|
||||
$.AdminLTE.layout = {
|
||||
activate: function () {
|
||||
var _this = this;
|
||||
//_this.fix();
|
||||
_this.fixSidebar();
|
||||
//$('body, html, .wrapper').css('height', 'auto');
|
||||
$(window, ".wrapper").resize(function () {
|
||||
//_this.fix();
|
||||
_this.fixSidebar();
|
||||
});
|
||||
},
|
||||
fix: function () {
|
||||
// Remove overflow from .wrapper if layout-boxed exists
|
||||
$(".layout-boxed > .wrapper").css('overflow', 'hidden');
|
||||
//Get window height and the wrapper height
|
||||
var footer_height = $('.main-footer').outerHeight() || 0;
|
||||
var neg = $('.main-header').outerHeight() + footer_height;
|
||||
var window_height = $(window).height();
|
||||
var sidebar_height = $(".sidebar").height() || 0;
|
||||
//Set the min-height of the content and sidebar based on the
|
||||
//the height of the document.
|
||||
if ($("body").hasClass("fixed")) {
|
||||
$(".content-wrapper, .right-side").css('min-height', window_height - footer_height);
|
||||
} else {
|
||||
var postSetWidth;
|
||||
if (window_height >= sidebar_height) {
|
||||
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
|
||||
postSetWidth = window_height - neg;
|
||||
} else {
|
||||
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
|
||||
postSetWidth = sidebar_height;
|
||||
}
|
||||
|
||||
//Fix for the control sidebar height
|
||||
var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
|
||||
if (typeof controlSidebar !== "undefined") {
|
||||
if (controlSidebar.height() > postSetWidth)
|
||||
$(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
fixSidebar: function () {
|
||||
//Make sure the body tag has the .fixed class
|
||||
if (!$("body").hasClass("fixed")) {
|
||||
if (typeof $.fn.slimScroll != 'undefined') {
|
||||
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
||||
}
|
||||
return;
|
||||
} else if (typeof $.fn.slimScroll == 'undefined' && window.console) {
|
||||
window.console.error("Error: the fixed layout requires the slimscroll plugin!");
|
||||
}
|
||||
//Enable slimscroll for fixed layout
|
||||
if ($.AdminLTE.options.sidebarSlimScroll) {
|
||||
if (typeof $.fn.slimScroll != 'undefined') {
|
||||
//Destroy if it exists
|
||||
$(".sidebar").slimScroll({destroy: true}).height("auto").css("overflow", "inherit");
|
||||
if (!$("body").hasClass('sidebar-collapse')) {
|
||||
//Add slimscroll
|
||||
$(".sidebar").slimscroll({
|
||||
height: ($(window).height() - $(".main-header").height()) + "px",
|
||||
color: "rgba(0,0,0,0.2)",
|
||||
size: "8px"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* PushMenu()
|
||||
* ==========
|
||||
* Adds the push menu functionality to the sidebar.
|
||||
*
|
||||
* @type Function
|
||||
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
|
||||
*/
|
||||
$.AdminLTE.pushMenu = {
|
||||
activate: function (toggleBtn) {
|
||||
//Get the screen sizes
|
||||
var screenSizes = $.AdminLTE.options.screenSizes;
|
||||
|
||||
//Enable sidebar toggle
|
||||
$(document).on('click', toggleBtn, function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
//Enable sidebar push menu
|
||||
if ($(window).width() > (screenSizes.sm - 1)) {
|
||||
if ($("body").hasClass('sidebar-collapse')) {
|
||||
$("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
|
||||
} else {
|
||||
$("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
||||
}
|
||||
}
|
||||
//Handle sidebar push menu for small screens
|
||||
else {
|
||||
if ($("body").hasClass('sidebar-open')) {
|
||||
$("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
||||
} else {
|
||||
$("body").addClass('sidebar-open').trigger('expanded.pushMenu');
|
||||
}
|
||||
}
|
||||
$.AdminLTE.layout.fixSidebar();
|
||||
});
|
||||
|
||||
$(".content-wrapper").click(function () {
|
||||
//Enable hide menu when clicking on the content-wrapper on small screens
|
||||
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
|
||||
$("body").removeClass('sidebar-open');
|
||||
}
|
||||
});
|
||||
|
||||
//Enable expand on hover for sidebar mini
|
||||
if ($.AdminLTE.options.sidebarExpandOnHover) {
|
||||
this.expandOnHover();
|
||||
}
|
||||
},
|
||||
expandOnHover: function () {
|
||||
var _this = this;
|
||||
var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
|
||||
//Expand sidebar on hover
|
||||
$('.main-sidebar').hover(function () {
|
||||
if ($('body').hasClass('sidebar-mini')
|
||||
&& $("body").hasClass('sidebar-collapse')
|
||||
&& $(window).width() > screenWidth) {
|
||||
_this.expand();
|
||||
}
|
||||
}, function () {
|
||||
if ($('body').hasClass('sidebar-mini')
|
||||
&& $('body').hasClass('sidebar-expanded-on-hover')
|
||||
&& $(window).width() > screenWidth) {
|
||||
_this.collapse();
|
||||
}
|
||||
});
|
||||
},
|
||||
expand: function () {
|
||||
$("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
|
||||
},
|
||||
collapse: function () {
|
||||
if ($('body').hasClass('sidebar-expanded-on-hover')) {
|
||||
$('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Tree()
|
||||
* ======
|
||||
* Converts the sidebar into a multilevel
|
||||
* tree view menu.
|
||||
*
|
||||
* @type Function
|
||||
* @Usage: $.AdminLTE.tree('.sidebar')
|
||||
*/
|
||||
$.AdminLTE.tree = function (menu) {
|
||||
var _this = this;
|
||||
var animationSpeed = $.AdminLTE.options.animationSpeed;
|
||||
$(document).off('click', menu + ' li a')
|
||||
.on('click', menu + ' li a', function (e) {
|
||||
//Get the clicked link and the next element
|
||||
var $this = $(this);
|
||||
var checkElement = $this.next();
|
||||
//Check if the next element is a menu and is visible
|
||||
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
|
||||
//Close the menu
|
||||
checkElement.slideUp(animationSpeed, function () {
|
||||
checkElement.removeClass('menu-open');
|
||||
//Fix the layout in case the sidebar stretches over the height of the window
|
||||
//_this.layout.fix();
|
||||
});
|
||||
checkElement.parent("li").removeClass("active");
|
||||
checkElement.parent("li").removeClass('treeview-open');
|
||||
}
|
||||
//If the menu is not visible
|
||||
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
|
||||
//Get the parent menu
|
||||
var parent = $this.parents('ul').first();
|
||||
// modified by FastAdmin
|
||||
if ($(".show-submenu", menu).size() == 0) {
|
||||
//Close all open menus within the parent
|
||||
var ul = parent.find('ul:visible').slideUp(animationSpeed);
|
||||
//Remove the menu-open class from the parent
|
||||
ul.removeClass('menu-open');
|
||||
parent.find('li.treeview').removeClass("treeview-open");
|
||||
}
|
||||
//Get the parent li
|
||||
var parent_li = $this.parent("li");
|
||||
|
||||
//Open the target menu and add the menu-open class
|
||||
checkElement.slideDown(animationSpeed, function () {
|
||||
//Add the class active to the parent li
|
||||
checkElement.addClass('menu-open');
|
||||
//parent.find('li.active').removeClass('active');
|
||||
//parent_li.addClass('active');
|
||||
//Fix the layout in case the sidebar stretches over the height of the window
|
||||
_this.layout.fix();
|
||||
});
|
||||
parent_li.addClass('treeview-open');
|
||||
} else {
|
||||
if (!$this.parent().hasClass("active")) {
|
||||
$this.parent().addClass("active");
|
||||
}
|
||||
// modified by FastAdmin
|
||||
if ($(".show-submenu", menu).size() == 0) {
|
||||
$this.parent().siblings().find("ul.menu-open").slideUp();
|
||||
}
|
||||
}
|
||||
//if this isn't a link, prevent the page from being redirected
|
||||
if (checkElement.is('.treeview-menu')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* ControlSidebar
|
||||
* ==============
|
||||
* Adds functionality to the right sidebar
|
||||
*
|
||||
* @type Object
|
||||
* @usage $.AdminLTE.controlSidebar.activate(options)
|
||||
*/
|
||||
$.AdminLTE.controlSidebar = {
|
||||
//instantiate the object
|
||||
activate: function () {
|
||||
//Get the object
|
||||
var _this = this;
|
||||
//Update options
|
||||
var o = $.AdminLTE.options.controlSidebarOptions;
|
||||
//Get the sidebar
|
||||
var sidebar = $(o.selector);
|
||||
//The toggle button
|
||||
var btn = $(o.toggleBtnSelector);
|
||||
|
||||
//Listen to the click event
|
||||
btn.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//If the sidebar is not open
|
||||
if (!sidebar.hasClass('control-sidebar-open')
|
||||
&& !$('body').hasClass('control-sidebar-open')) {
|
||||
//Open the sidebar
|
||||
_this.open(sidebar, o.slide);
|
||||
} else {
|
||||
_this.close(sidebar, o.slide);
|
||||
}
|
||||
});
|
||||
|
||||
//If the body has a boxed layout, fix the sidebar bg position
|
||||
var bg = $(".control-sidebar-bg");
|
||||
_this._fix(bg);
|
||||
|
||||
//If the body has a fixed layout, make the control sidebar fixed
|
||||
if ($('body').hasClass('fixed')) {
|
||||
_this._fixForFixed(sidebar);
|
||||
} else {
|
||||
//If the content height is less than the sidebar's height, force max height
|
||||
if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
|
||||
_this._fixForContent(sidebar);
|
||||
}
|
||||
}
|
||||
},
|
||||
//Open the control sidebar
|
||||
open: function (sidebar, slide) {
|
||||
//Slide over content
|
||||
if (slide) {
|
||||
sidebar.addClass('control-sidebar-open');
|
||||
} else {
|
||||
//Push the content by adding the open class to the body instead
|
||||
//of the sidebar itself
|
||||
$('body').addClass('control-sidebar-open');
|
||||
}
|
||||
},
|
||||
//Close the control sidebar
|
||||
close: function (sidebar, slide) {
|
||||
if (slide) {
|
||||
sidebar.removeClass('control-sidebar-open');
|
||||
} else {
|
||||
$('body').removeClass('control-sidebar-open');
|
||||
}
|
||||
},
|
||||
_fix: function (sidebar) {
|
||||
var _this = this;
|
||||
if ($("body").hasClass('layout-boxed')) {
|
||||
sidebar.css('position', 'absolute');
|
||||
sidebar.height($(".wrapper").height());
|
||||
if (_this.hasBindedResize) {
|
||||
return;
|
||||
}
|
||||
$(window).resize(function () {
|
||||
_this._fix(sidebar);
|
||||
});
|
||||
_this.hasBindedResize = true;
|
||||
} else {
|
||||
sidebar.css({
|
||||
'position': 'fixed',
|
||||
'height': 'auto'
|
||||
});
|
||||
}
|
||||
},
|
||||
_fixForFixed: function (sidebar) {
|
||||
sidebar.css({
|
||||
'position': 'fixed',
|
||||
'max-height': '100%',
|
||||
'overflow': 'auto',
|
||||
});
|
||||
},
|
||||
_fixForContent: function (sidebar) {
|
||||
$(".content-wrapper, .right-side").css('min-height', sidebar.height());
|
||||
}
|
||||
};
|
||||
|
||||
/* BoxWidget
|
||||
* =========
|
||||
* BoxWidget is a plugin to handle collapsing and
|
||||
* removing boxes from the screen.
|
||||
*
|
||||
* @type Object
|
||||
* @usage $.AdminLTE.boxWidget.activate()
|
||||
* Set all your options in the main $.AdminLTE.options object
|
||||
*/
|
||||
$.AdminLTE.boxWidget = {
|
||||
selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
|
||||
icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
|
||||
animationSpeed: $.AdminLTE.options.animationSpeed,
|
||||
activate: function (_box) {
|
||||
var _this = this;
|
||||
if (!_box) {
|
||||
_box = document; // activate all boxes per default
|
||||
}
|
||||
//Listen for collapse event triggers
|
||||
$(_box).on('click', _this.selectors.collapse, function (e) {
|
||||
e.preventDefault();
|
||||
_this.collapse($(this));
|
||||
});
|
||||
|
||||
//Listen for remove event triggers
|
||||
$(_box).on('click', _this.selectors.remove, function (e) {
|
||||
e.preventDefault();
|
||||
_this.remove($(this));
|
||||
});
|
||||
},
|
||||
collapse: function (element) {
|
||||
var _this = this;
|
||||
//Find the box parent
|
||||
var box = element.parents(".box").first();
|
||||
//Find the body and the footer
|
||||
var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
|
||||
if (!box.hasClass("collapsed-box")) {
|
||||
//Convert minus into plus
|
||||
element.children(":first")
|
||||
.removeClass(_this.icons.collapse)
|
||||
.addClass(_this.icons.open);
|
||||
//Hide the content
|
||||
box_content.slideUp(_this.animationSpeed, function () {
|
||||
box.addClass("collapsed-box");
|
||||
});
|
||||
} else {
|
||||
//Convert plus into minus
|
||||
element.children(":first")
|
||||
.removeClass(_this.icons.open)
|
||||
.addClass(_this.icons.collapse);
|
||||
//Show the content
|
||||
box_content.slideDown(_this.animationSpeed, function () {
|
||||
box.removeClass("collapsed-box");
|
||||
});
|
||||
}
|
||||
},
|
||||
remove: function (element) {
|
||||
//Find the box parent
|
||||
var box = element.parents(".box").first();
|
||||
box.slideUp(this.animationSpeed);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* ------------------
|
||||
* - Custom Plugins -
|
||||
* ------------------
|
||||
* All custom plugins are defined below.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BOX REFRESH BUTTON
|
||||
* ------------------
|
||||
* This is a custom plugin to use with the component BOX. It allows you to add
|
||||
* a refresh button to the box. It converts the box's state to a loading state.
|
||||
*
|
||||
* @type plugin
|
||||
* @usage $("#box-widget").boxRefresh( options );
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.boxRefresh = function (options) {
|
||||
|
||||
// Render options
|
||||
var settings = $.extend({
|
||||
//Refresh button selector
|
||||
trigger: ".refresh-btn",
|
||||
//File source to be loaded (e.g: ajax/src.php)
|
||||
source: "",
|
||||
//Callbacks
|
||||
onLoadStart: function (box) {
|
||||
return box;
|
||||
}, //Right after the button has been clicked
|
||||
onLoadDone: function (box) {
|
||||
return box;
|
||||
} //When the source has been loaded
|
||||
|
||||
}, options);
|
||||
|
||||
//The overlay
|
||||
var overlay = $('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');
|
||||
|
||||
return this.each(function () {
|
||||
//if a source is specified
|
||||
if (settings.source === "") {
|
||||
if (window.console) {
|
||||
window.console.log("Please specify a source first - boxRefresh()");
|
||||
}
|
||||
return;
|
||||
}
|
||||
//the box
|
||||
var box = $(this);
|
||||
//the button
|
||||
var rBtn = box.find(settings.trigger).first();
|
||||
|
||||
//On trigger click
|
||||
rBtn.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//Add loading overlay
|
||||
start(box);
|
||||
|
||||
//Perform ajax call
|
||||
box.find(".box-body").load(settings.source, function () {
|
||||
done(box);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function start(box) {
|
||||
//Add overlay and loading img
|
||||
box.append(overlay);
|
||||
|
||||
settings.onLoadStart.call(box);
|
||||
}
|
||||
|
||||
function done(box) {
|
||||
//Remove overlay and loading img
|
||||
box.find(overlay).remove();
|
||||
|
||||
settings.onLoadDone.call(box);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
* EXPLICIT BOX CONTROLS
|
||||
* -----------------------
|
||||
* This is a custom plugin to use with the component BOX. It allows you to activate
|
||||
* a box inserted in the DOM after the app.js was loaded, toggle and remove box.
|
||||
*
|
||||
* @type plugin
|
||||
* @usage $("#box-widget").activateBox();
|
||||
* @usage $("#box-widget").toggleBox();
|
||||
* @usage $("#box-widget").removeBox();
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.fn.activateBox = function () {
|
||||
$.AdminLTE.boxWidget.activate(this);
|
||||
};
|
||||
|
||||
$.fn.toggleBox = function () {
|
||||
var button = $($.AdminLTE.boxWidget.selectors.collapse, this);
|
||||
$.AdminLTE.boxWidget.collapse(button);
|
||||
};
|
||||
|
||||
$.fn.removeBox = function () {
|
||||
var button = $($.AdminLTE.boxWidget.selectors.remove, this);
|
||||
$.AdminLTE.boxWidget.remove(button);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
* TODO LIST CUSTOM PLUGIN
|
||||
* -----------------------
|
||||
* This plugin depends on iCheck plugin for checkbox and radio inputs
|
||||
*
|
||||
* @type plugin
|
||||
* @usage $("#todo-widget").todolist( options );
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.fn.todolist = function (options) {
|
||||
// Render options
|
||||
var settings = $.extend({
|
||||
//When the user checks the input
|
||||
onCheck: function (ele) {
|
||||
return ele;
|
||||
},
|
||||
//When the user unchecks the input
|
||||
onUncheck: function (ele) {
|
||||
return ele;
|
||||
}
|
||||
}, options);
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
if (typeof $.fn.iCheck != 'undefined') {
|
||||
$('input', this).on('ifChecked', function () {
|
||||
var ele = $(this).parents("li").first();
|
||||
ele.toggleClass("done");
|
||||
settings.onCheck.call(ele);
|
||||
});
|
||||
|
||||
$('input', this).on('ifUnchecked', function () {
|
||||
var ele = $(this).parents("li").first();
|
||||
ele.toggleClass("done");
|
||||
settings.onUncheck.call(ele);
|
||||
});
|
||||
} else {
|
||||
$('input', this).on('change', function () {
|
||||
var ele = $(this).parents("li").first();
|
||||
ele.toggleClass("done");
|
||||
if ($('input', ele).is(":checked")) {
|
||||
settings.onCheck.call(ele);
|
||||
} else {
|
||||
settings.onUncheck.call(ele);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//set/get form element value
|
||||
$.fn.field = function (name, value) {
|
||||
if (typeof name !== "string")
|
||||
return false;
|
||||
var element = $(this).find("[name='" + name + "']");
|
||||
|
||||
if (typeof value === "undefined" && element.length >= 1) {
|
||||
switch (element.attr("type")) {
|
||||
case "checkbox":
|
||||
var result = new Array();
|
||||
element.each(function (i, val) {
|
||||
if ($(this).is(":checked")) {
|
||||
result.push($(this).val());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
break;
|
||||
case "radio":
|
||||
var result;
|
||||
element.each(function (i, val) {
|
||||
if ($(this).is(":checked")) {
|
||||
result = $(this).val();
|
||||
}
|
||||
});
|
||||
return result;
|
||||
break;
|
||||
default:
|
||||
return element.val();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (element.attr("type")) {
|
||||
case "checkbox":
|
||||
case "radio":
|
||||
value = $.isArray(value) ? value : [value];
|
||||
element.each(function (i) {
|
||||
$(this).prop({
|
||||
checked: $.inArray($(this).val(), value) > -1
|
||||
});
|
||||
});
|
||||
break;
|
||||
case undefined:
|
||||
default:
|
||||
element.val(value);
|
||||
break;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
define(['backend'], function (Backend) {
|
||||
|
||||
});
|
||||
Executable
+260
@@ -0,0 +1,260 @@
|
||||
define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
|
||||
var Backend = {
|
||||
api: {
|
||||
sidebar: function (params) {
|
||||
colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
|
||||
$colorNums = colorArr.length;
|
||||
badgeList = {};
|
||||
$.each(params, function (k, v) {
|
||||
$url = Fast.api.fixurl(k);
|
||||
|
||||
if ($.isArray(v)) {
|
||||
$nums = typeof v[0] !== 'undefined' ? v[0] : 0;
|
||||
$color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
|
||||
$class = typeof v[2] !== 'undefined' ? v[2] : 'label';
|
||||
} else {
|
||||
$nums = v;
|
||||
$color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
|
||||
$class = 'label';
|
||||
}
|
||||
//必须nums大于0才显示
|
||||
badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
|
||||
});
|
||||
$.each(badgeList, function (k, v) {
|
||||
var anchor = top.window.$("li a[addtabs][url='" + k + "']");
|
||||
if (anchor) {
|
||||
top.window.$(".pull-right-container", anchor).html(v);
|
||||
top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
|
||||
}
|
||||
});
|
||||
},
|
||||
addtabs: function (url, title, icon) {
|
||||
var dom = "a[url='{url}']"
|
||||
var leftlink = top.window.$(dom.replace(/\{url\}/, url));
|
||||
if (leftlink.size() > 0) {
|
||||
leftlink.trigger("click");
|
||||
} else {
|
||||
url = Fast.api.fixurl(url);
|
||||
leftlink = top.window.$(dom.replace(/\{url\}/, url));
|
||||
if (leftlink.size() > 0) {
|
||||
var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
|
||||
leftlink.trigger(event);
|
||||
} else {
|
||||
var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
|
||||
leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
|
||||
//能找到相对地址
|
||||
if (leftlink.size() > 0) {
|
||||
icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
|
||||
title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
|
||||
leftlink.trigger("fa.event.toggleitem");
|
||||
}
|
||||
var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
|
||||
if (navnode.size() > 0) {
|
||||
navnode.trigger("click");
|
||||
} else {
|
||||
//追加新的tab
|
||||
var id = Math.floor(new Date().valueOf() * Math.random());
|
||||
icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
|
||||
title = typeof title !== 'undefined' ? title : '';
|
||||
top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
|
||||
url: url,
|
||||
addtabs: id
|
||||
}).addClass("hide").appendTo(top.window.document.body).trigger("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
closetabs: function (url) {
|
||||
if (typeof url === 'undefined') {
|
||||
top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
|
||||
} else {
|
||||
var dom = "a[url='{url}']"
|
||||
var navlink = top.window.$(dom.replace(/\{url\}/, url));
|
||||
if (navlink.size() === 0) {
|
||||
url = Fast.api.fixurl(url);
|
||||
navlink = top.window.$(dom.replace(/\{url\}/, url));
|
||||
if (navlink.size() === 0) {
|
||||
} else {
|
||||
var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
|
||||
navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
|
||||
//能找到相对地址
|
||||
if (navlink.size() === 0) {
|
||||
navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navlink.size() > 0 && navlink.attr('addtabs')) {
|
||||
top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
|
||||
}
|
||||
}
|
||||
},
|
||||
replaceids: function (elem, url) {
|
||||
//如果有需要替换ids的
|
||||
if (url.indexOf("{ids}") > -1) {
|
||||
var ids = 0;
|
||||
var tableId = $(elem).data("table-id");
|
||||
if (tableId && $("#" + tableId).size() > 0 && $("#" + tableId).data("bootstrap.table")) {
|
||||
var Table = require("table");
|
||||
ids = Table.api.selectedids($("#" + tableId)).join(",");
|
||||
}
|
||||
url = url.replace(/\{ids\}/g, ids);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
refreshmenu: function () {
|
||||
top.window.$(".sidebar-menu").trigger("refresh");
|
||||
},
|
||||
gettablecolumnbutton: function (options) {
|
||||
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
||||
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
||||
if (tableOptions) {
|
||||
var columnObj = null;
|
||||
$.each(tableOptions.columns, function (i, columns) {
|
||||
$.each(columns, function (j, column) {
|
||||
if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
|
||||
columnObj = column;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (columnObj) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (columnObj) {
|
||||
return columnObj['buttons'][options.buttonIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
init: function () {
|
||||
//公共代码
|
||||
//添加ios-fix兼容iOS下的iframe
|
||||
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
||||
$("html").addClass("ios-fix");
|
||||
}
|
||||
//配置Toastr的参数
|
||||
Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
|
||||
//点击包含.btn-dialog的元素时弹出dialog
|
||||
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var button = Backend.api.gettablecolumnbutton(options);
|
||||
if (button && typeof button.callback === 'function') {
|
||||
options.callback = button.callback;
|
||||
}
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Backend.api.open(url, title, options);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
window[$(that).data("window") || 'self'].Backend.api.open(url, title, options);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-addtabs的元素时新增选项卡
|
||||
$(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var icon = $(that).attr("icon") || $(that).data("icon");
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Backend.api.addtabs(url, title, icon);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Backend.api.addtabs(url, title, icon);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-ajax的元素时发送Ajax请求
|
||||
$(document).on('click', '.btn-ajax,.ajaxit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
if (typeof options.url === 'undefined' && $(that).attr("href")) {
|
||||
options.url = $(that).attr("href");
|
||||
}
|
||||
options.url = Backend.api.replaceids(this, options.url);
|
||||
var success = typeof options.success === 'function' ? options.success : null;
|
||||
var error = typeof options.error === 'function' ? options.error : null;
|
||||
delete options.success;
|
||||
delete options.error;
|
||||
var button = Backend.api.gettablecolumnbutton(options);
|
||||
if (button) {
|
||||
if (typeof button.success === 'function') {
|
||||
success = button.success;
|
||||
}
|
||||
if (typeof button.error === 'function') {
|
||||
error = button.error;
|
||||
}
|
||||
}
|
||||
//如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
|
||||
if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
|
||||
success = function () {
|
||||
$("#" + options.tableId).bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Backend.api.ajax(options, success, error);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Backend.api.ajax(options, success, error);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '.btn-click,.clickit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var row = {};
|
||||
if (typeof options.tableId !== 'undefined') {
|
||||
var index = parseInt(options.rowIndex);
|
||||
var data = $("#" + options.tableId).bootstrapTable('getData');
|
||||
row = typeof data[index] !== 'undefined' ? data[index] : {};
|
||||
}
|
||||
var button = Backend.api.gettablecolumnbutton(options);
|
||||
var click = typeof button.click === 'function' ? button.click : $.noop;
|
||||
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
click.apply(that, [options, row, button]);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
click.apply(that, [options, row, button]);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//修复含有fixed-footer类的body边距
|
||||
if ($(".fixed-footer").size() > 0) {
|
||||
$(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
|
||||
}
|
||||
//修复不在iframe时layer-footer隐藏的问题
|
||||
if ($(".layer-footer").size() > 0 && self === top) {
|
||||
$(".layer-footer").show();
|
||||
}
|
||||
//tooltip和popover
|
||||
if (!('ontouchstart' in document.documentElement)) {
|
||||
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
||||
}
|
||||
$('body').popover({selector: '[data-toggle="popover"]'});
|
||||
}
|
||||
};
|
||||
Backend.api = $.extend(Fast.api, Backend.api);
|
||||
//将Template渲染至全局,以便于在子框架中调用
|
||||
window.Template = Template;
|
||||
//将Moment渲染至全局,以便于在子框架中调用
|
||||
window.Moment = Moment;
|
||||
//将Backend渲染至全局,以便于在子框架中调用
|
||||
window.Backend = Backend;
|
||||
|
||||
Backend.init();
|
||||
return Backend;
|
||||
});
|
||||
Executable
+632
@@ -0,0 +1,632 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: Config.api_url ? Config.api_url + '/addon/index' : "addon/downloaded",
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: '',
|
||||
multi_url: ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 弹窗自适应宽高
|
||||
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
|
||||
|
||||
table.on('load-success.bs.table', function (e, json) {
|
||||
if (json && typeof json.category != 'undefined' && $(".nav-category li").size() == 2) {
|
||||
$.each(json.category, function (i, j) {
|
||||
$("<li><a href='javascript:;' data-id='" + j.id + "'>" + j.name + "</a></li>").insertBefore($(".nav-category li:last"));
|
||||
});
|
||||
}
|
||||
});
|
||||
table.on('load-error.bs.table', function (e, status, res) {
|
||||
if (status == 404 && $(".btn-switch.active").data("type") != "local") {
|
||||
Layer.confirm(__('Store now available tips'), {
|
||||
title: __('Warmtips'),
|
||||
btn: [__('Switch to the local'), __('Try to reload')]
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
$(".panel .nav-tabs").hide();
|
||||
$(".toolbar > *:not(:first)").hide();
|
||||
$(".btn-switch[data-type='local']").trigger("click");
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
table.bootstrapTable('refresh');
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
||||
var parenttable = table.closest('.bootstrap-table');
|
||||
var d = $(".fixed-table-toolbar", parenttable).find(".search input");
|
||||
d.off("keyup drop blur");
|
||||
d.on("keyup", function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
var that = this;
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
var queryParams = options.queryParams;
|
||||
options.pageNumber = 1;
|
||||
options.queryParams = function (params) {
|
||||
var params = queryParams(params);
|
||||
params.search = $(that).val();
|
||||
return params;
|
||||
};
|
||||
table.bootstrapTable('refresh', {});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.helper("Moment", Moment);
|
||||
Template.helper("addons", Config['addons']);
|
||||
|
||||
$("#faupload-addon").data("params", function () {
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
return {
|
||||
uid: userinfo ? userinfo.id : '',
|
||||
token: userinfo ? userinfo.token : '',
|
||||
version: Config.faversion
|
||||
};
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
queryParams: function (params) {
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
$.extend(params, {
|
||||
uid: userinfo ? userinfo.id : '',
|
||||
token: userinfo ? userinfo.token : '',
|
||||
version: Config.faversion
|
||||
});
|
||||
return params;
|
||||
},
|
||||
columns: [
|
||||
[
|
||||
{field: 'id', title: 'ID', operate: false, visible: false},
|
||||
{
|
||||
field: 'home',
|
||||
title: __('Index'),
|
||||
width: '50px',
|
||||
formatter: Controller.api.formatter.home
|
||||
},
|
||||
{field: 'name', title: __('Name'), operate: false, visible: false, width: '120px'},
|
||||
{
|
||||
field: 'title',
|
||||
title: __('Title'),
|
||||
operate: 'LIKE',
|
||||
align: 'left',
|
||||
formatter: Controller.api.formatter.title
|
||||
},
|
||||
{field: 'intro', title: __('Intro'), operate: 'LIKE', align: 'left', class: 'visible-lg'},
|
||||
{
|
||||
field: 'author',
|
||||
title: __('Author'),
|
||||
operate: 'LIKE',
|
||||
width: '100px',
|
||||
formatter: Controller.api.formatter.author
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
title: __('Price'),
|
||||
operate: 'LIKE',
|
||||
width: '100px',
|
||||
align: 'center',
|
||||
formatter: Controller.api.formatter.price
|
||||
},
|
||||
{
|
||||
field: 'downloads',
|
||||
title: __('Downloads'),
|
||||
operate: 'LIKE',
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: Controller.api.formatter.downloads
|
||||
},
|
||||
{
|
||||
field: 'version',
|
||||
title: __('Version'),
|
||||
operate: 'LIKE',
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: Controller.api.formatter.version
|
||||
},
|
||||
{
|
||||
field: 'toggle',
|
||||
title: __('Status'),
|
||||
width: '80px',
|
||||
formatter: Controller.api.formatter.toggle
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: __('Operate'),
|
||||
align: 'center',
|
||||
table: table,
|
||||
formatter: Controller.api.formatter.operate,
|
||||
align: 'right'
|
||||
},
|
||||
]
|
||||
],
|
||||
responseHandler: function (res) {
|
||||
$.each(res.rows, function (i, j) {
|
||||
j.addon = typeof Config.addons[j.name] != 'undefined' ? Config.addons[j.name] : null;
|
||||
});
|
||||
return res;
|
||||
},
|
||||
dataType: 'jsonp',
|
||||
templateView: false,
|
||||
clickToSelect: false,
|
||||
search: true,
|
||||
showColumns: false,
|
||||
showToggle: false,
|
||||
showExport: false,
|
||||
showSearch: false,
|
||||
commonSearch: true,
|
||||
searchFormVisible: true,
|
||||
searchFormTemplate: 'searchformtpl',
|
||||
pageSize: 50,
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
// 离线安装
|
||||
require(['upload'], function (Upload) {
|
||||
Upload.api.upload("#faupload-addon", function (data, ret) {
|
||||
Config['addons'][data.addon.name] = data.addon;
|
||||
Toastr.success(ret.msg);
|
||||
operate(data.addon.name, 'enable', false);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// 查看插件首页
|
||||
$(document).on("click", ".btn-addonindex", function () {
|
||||
if ($(this).attr("href") == 'javascript:;') {
|
||||
Layer.msg(__('Not installed tips'), {icon: 7});
|
||||
} else if ($(this).closest(".operate").find("a.btn-enable").size() > 0) {
|
||||
Layer.msg(__('Not enabled tips'), {icon: 7});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 切换
|
||||
$(document).on("click", ".btn-switch", function () {
|
||||
$(".btn-switch").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$("form.form-commonsearch input[name='type']").val($(this).data("type"));
|
||||
table.bootstrapTable('refresh', {url: ($(this).data("url") ? $(this).data("url") : $.fn.bootstrapTable.defaults.extend.index_url), pageNumber: 1});
|
||||
return false;
|
||||
});
|
||||
$(document).on("click", ".nav-category li a", function () {
|
||||
$(".nav-category li").removeClass("active");
|
||||
$(this).parent().addClass("active");
|
||||
$("form.form-commonsearch input[name='category_id']").val($(this).data("id"));
|
||||
table.bootstrapTable('refresh', {url: $(this).data("url"), pageNumber: 1});
|
||||
return false;
|
||||
});
|
||||
var tables = [];
|
||||
$(document).on("click", "#droptables", function () {
|
||||
if ($(this).prop("checked")) {
|
||||
Fast.api.ajax({
|
||||
url: "addon/get_table_list",
|
||||
async: false,
|
||||
data: {name: $(this).data("name")}
|
||||
}, function (data) {
|
||||
tables = data.tables;
|
||||
return false;
|
||||
});
|
||||
var html;
|
||||
html = tables.length > 0 ? '<div class="alert alert-warning-light droptablestips" style="max-width:480px;max-height:300px;overflow-y: auto;">' + __('The following data tables will be deleted') + ':<br>' + tables.join("<br>") + '</div>'
|
||||
: '<div class="alert alert-warning-light droptablestips">' + __('The Addon did not create a data table') + '</div>';
|
||||
$(html).insertAfter($(this).closest("p"));
|
||||
} else {
|
||||
$(".droptablestips").remove();
|
||||
}
|
||||
$(window).resize();
|
||||
});
|
||||
|
||||
// 会员信息
|
||||
$(document).on("click", ".btn-userinfo", function () {
|
||||
var that = this;
|
||||
var area = [$(window).width() > 800 ? '500px' : '95%', $(window).height() > 600 ? '400px' : '95%'];
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
if (!userinfo) {
|
||||
Layer.open({
|
||||
content: Template("logintpl", {}),
|
||||
zIndex: 99,
|
||||
area: area,
|
||||
title: __('Login FastAdmin'),
|
||||
resize: false,
|
||||
btn: [__('Login'), __('Register')],
|
||||
yes: function (index, layero) {
|
||||
Fast.api.ajax({
|
||||
url: Config.api_url + '/user/login',
|
||||
dataType: 'jsonp',
|
||||
data: {
|
||||
account: $("#inputAccount", layero).val(),
|
||||
password: $("#inputPassword", layero).val(),
|
||||
_method: 'POST'
|
||||
}
|
||||
}, function (data, ret) {
|
||||
Controller.api.userinfo.set(data);
|
||||
Layer.closeAll();
|
||||
Layer.alert(ret.msg);
|
||||
}, function (data, ret) {
|
||||
});
|
||||
},
|
||||
btn2: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (layero, index) {
|
||||
$(".layui-layer-btn1", layero).prop("href", "http://www.fastadmin.net/user/register.html").prop("target", "_blank");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: Config.api_url + '/user/index',
|
||||
dataType: 'jsonp',
|
||||
data: {
|
||||
user_id: userinfo.id,
|
||||
token: userinfo.token,
|
||||
}
|
||||
}, function (data) {
|
||||
Layer.open({
|
||||
content: Template("userinfotpl", userinfo),
|
||||
area: area,
|
||||
title: __('Userinfo'),
|
||||
resize: false,
|
||||
btn: [__('Logout'), __('Cancel')],
|
||||
yes: function () {
|
||||
Fast.api.ajax({
|
||||
url: Config.api_url + '/user/logout',
|
||||
dataType: 'jsonp',
|
||||
data: {uid: userinfo.id, token: userinfo.token}
|
||||
}, function (data, ret) {
|
||||
Controller.api.userinfo.set(null);
|
||||
Layer.closeAll();
|
||||
Layer.alert(ret.msg);
|
||||
}, function (data, ret) {
|
||||
Controller.api.userinfo.set(null);
|
||||
Layer.closeAll();
|
||||
Layer.alert(ret.msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}, function (data) {
|
||||
Controller.api.userinfo.set(null);
|
||||
$(that).trigger('click');
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var install = function (name, version, force) {
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
var uid = userinfo ? userinfo.id : 0;
|
||||
var token = userinfo ? userinfo.token : '';
|
||||
Fast.api.ajax({
|
||||
url: 'addon/install',
|
||||
data: {
|
||||
name: name,
|
||||
force: force ? 1 : 0,
|
||||
uid: uid,
|
||||
token: token,
|
||||
version: version,
|
||||
faversion: Config.faversion
|
||||
}
|
||||
}, function (data, ret) {
|
||||
Layer.closeAll();
|
||||
Config['addons'][data.addon.name] = ret.data.addon;
|
||||
Layer.alert(__('Online installed tips'), {
|
||||
btn: [__('OK')],
|
||||
title: __('Warning'),
|
||||
icon: 1
|
||||
});
|
||||
Controller.api.refresh(table, name);
|
||||
}, function (data, ret) {
|
||||
//如果是需要购买的插件则弹出二维码提示
|
||||
if (ret && ret.code === -1) {
|
||||
//扫码支付
|
||||
Layer.open({
|
||||
content: Template("paytpl", ret.data),
|
||||
shade: 0.8,
|
||||
area: area,
|
||||
skin: 'layui-layer-msg layui-layer-pay',
|
||||
title: false,
|
||||
closeBtn: true,
|
||||
btn: false,
|
||||
resize: false,
|
||||
end: function () {
|
||||
Layer.alert(__('Pay tips'));
|
||||
}
|
||||
});
|
||||
} else if (ret && ret.code === -2) {
|
||||
//如果登录已经超时,重新提醒登录
|
||||
if (uid && uid != ret.data.uid) {
|
||||
Controller.api.userinfo.set(null);
|
||||
$(".operate[data-name='" + name + "'] .btn-install").trigger("click");
|
||||
return;
|
||||
}
|
||||
top.Fast.api.open(ret.data.payurl, __('Pay now'), {
|
||||
area: area,
|
||||
end: function () {
|
||||
top.Layer.alert(__('Pay tips'));
|
||||
}
|
||||
});
|
||||
} else if (ret && ret.code === -3) {
|
||||
//插件目录发现影响全局的文件
|
||||
Layer.open({
|
||||
content: Template("conflicttpl", ret.data),
|
||||
shade: 0.8,
|
||||
area: area,
|
||||
title: __('Warning'),
|
||||
btn: [__('Continue install'), __('Cancel')],
|
||||
end: function () {
|
||||
|
||||
},
|
||||
yes: function () {
|
||||
install(name, version, true);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
Layer.alert(ret.msg);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
var uninstall = function (name, force, droptables) {
|
||||
Fast.api.ajax({
|
||||
url: 'addon/uninstall',
|
||||
data: {name: name, force: force ? 1 : 0, droptables: droptables ? 1 : 0}
|
||||
}, function (data, ret) {
|
||||
delete Config['addons'][name];
|
||||
Layer.closeAll();
|
||||
Controller.api.refresh(table, name);
|
||||
}, function (data, ret) {
|
||||
if (ret && ret.code === -3) {
|
||||
//插件目录发现影响全局的文件
|
||||
Layer.open({
|
||||
content: Template("conflicttpl", ret.data),
|
||||
shade: 0.8,
|
||||
area: area,
|
||||
title: __('Warning'),
|
||||
btn: [__('Continue uninstall'), __('Cancel')],
|
||||
end: function () {
|
||||
|
||||
},
|
||||
yes: function () {
|
||||
uninstall(name, true, droptables);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
Layer.alert(ret.msg);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
var operate = function (name, action, force) {
|
||||
Fast.api.ajax({
|
||||
url: 'addon/state',
|
||||
data: {name: name, action: action, force: force ? 1 : 0}
|
||||
}, function (data, ret) {
|
||||
var addon = Config['addons'][name];
|
||||
addon.state = action === 'enable' ? 1 : 0;
|
||||
Layer.closeAll();
|
||||
Controller.api.refresh(table, name);
|
||||
}, function (data, ret) {
|
||||
if (ret && ret.code === -3) {
|
||||
//插件目录发现影响全局的文件
|
||||
Layer.open({
|
||||
content: Template("conflicttpl", ret.data),
|
||||
shade: 0.8,
|
||||
area: area,
|
||||
title: __('Warning'),
|
||||
btn: [__('Continue operate'), __('Cancel')],
|
||||
end: function () {
|
||||
|
||||
},
|
||||
yes: function () {
|
||||
operate(name, action, true);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
Layer.alert(ret.msg);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
var upgrade = function (name, version) {
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
var uid = userinfo ? userinfo.id : 0;
|
||||
var token = userinfo ? userinfo.token : '';
|
||||
Fast.api.ajax({
|
||||
url: 'addon/upgrade',
|
||||
data: {name: name, uid: uid, token: token, version: version, faversion: Config.faversion}
|
||||
}, function (data, ret) {
|
||||
Config['addons'][name] = data.addon;
|
||||
Layer.closeAll();
|
||||
Controller.api.refresh(table, name);
|
||||
}, function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// 点击安装
|
||||
$(document).on("click", ".btn-install", function () {
|
||||
var that = this;
|
||||
var name = $(this).closest(".operate").data("name");
|
||||
var version = $(this).data("version");
|
||||
|
||||
var userinfo = Controller.api.userinfo.get();
|
||||
var uid = userinfo ? userinfo.id : 0;
|
||||
|
||||
if (parseInt(uid) === 0) {
|
||||
return Layer.alert(__('Not login tips'), {
|
||||
title: __('Warning'),
|
||||
btn: [__('Login now')],
|
||||
yes: function (index, layero) {
|
||||
$(".btn-userinfo").trigger("click");
|
||||
},
|
||||
btn2: function () {
|
||||
install(name, version, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
install(name, version, false);
|
||||
});
|
||||
|
||||
// 点击卸载
|
||||
$(document).on("click", ".btn-uninstall", function () {
|
||||
var name = $(this).closest(".operate").data('name');
|
||||
if (Config['addons'][name].state == 1) {
|
||||
Layer.alert(__('Please disable the add before trying to uninstall'), {icon: 7});
|
||||
return false;
|
||||
}
|
||||
Template.helper("__", __);
|
||||
Layer.confirm(Template("uninstalltpl", {addon: Config['addons'][name]}), {focusBtn: false}, function (index, layero) {
|
||||
uninstall(name, false, $("input[name='droptables']", layero).prop("checked"));
|
||||
});
|
||||
});
|
||||
|
||||
// 点击配置
|
||||
$(document).on("click", ".btn-config", function () {
|
||||
var name = $(this).closest(".operate").data("name");
|
||||
Fast.api.open("addon/config?name=" + name, __('Setting'));
|
||||
});
|
||||
|
||||
// 点击启用/禁用
|
||||
$(document).on("click", ".btn-enable,.btn-disable", function () {
|
||||
var name = $(this).data("name");
|
||||
var action = $(this).data("action");
|
||||
operate(name, action, false);
|
||||
});
|
||||
|
||||
// 点击升级
|
||||
$(document).on("click", ".btn-upgrade", function () {
|
||||
var name = $(this).closest(".operate").data('name');
|
||||
if (Config['addons'][name].state == 1) {
|
||||
Layer.alert(__('Please disable the add before trying to upgrade'), {icon: 7});
|
||||
return false;
|
||||
}
|
||||
var version = $(this).data("version");
|
||||
|
||||
Layer.confirm(__('Upgrade tips', Config['addons'][name].title), function () {
|
||||
upgrade(name, version);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", ".operate .btn-group .dropdown-toggle", function () {
|
||||
$(this).closest(".btn-group").toggleClass("dropup", $(document).height() - $(this).offset().top <= 200);
|
||||
});
|
||||
|
||||
$(document).on("click", ".view-screenshots", function () {
|
||||
var row = Table.api.getrowbyindex(table, parseInt($(this).data("index")));
|
||||
var data = [];
|
||||
$.each(row.screenshots, function (i, j) {
|
||||
data.push({
|
||||
"src": j
|
||||
});
|
||||
});
|
||||
var json = {
|
||||
"title": row.title,
|
||||
"data": data
|
||||
};
|
||||
top.Layer.photos(top.JSON.parse(JSON.stringify({photos: json})));
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
config: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
formatter: {
|
||||
title: function (value, row, index) {
|
||||
var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank">' + value + '</a>';
|
||||
if (row.screenshots && row.screenshots.length > 0) {
|
||||
title += ' <a href="javascript:;" data-index="' + index + '" class="view-screenshots text-success" title="' + __('View addon screenshots') + '" data-toggle="tooltip"><i class="fa fa-image"></i></a>';
|
||||
}
|
||||
return title;
|
||||
},
|
||||
operate: function (value, row, index) {
|
||||
return Template("operatetpl", {item: row, index: index});
|
||||
},
|
||||
toggle: function (value, row, index) {
|
||||
if (!row.addon) {
|
||||
return '';
|
||||
}
|
||||
return '<a href="javascript:;" data-toggle="tooltip" title="' + __('Click to toggle status') + '" class="btn btn-toggle btn-' + (row.addon.state == 1 ? "disable" : "enable") + '" data-action="' + (row.addon.state == 1 ? "disable" : "enable") + '" data-name="' + row.name + '"><i class="fa ' + (row.addon.state == 0 ? 'fa-toggle-on fa-rotate-180 text-gray' : 'fa-toggle-on text-success') + ' fa-2x"></i></a>';
|
||||
},
|
||||
author: function (value, row, index) {
|
||||
var url = 'javascript:';
|
||||
if (typeof row.homepage !== 'undefined') {
|
||||
url = row.homepage;
|
||||
} else if (typeof row.qq !== 'undefined' && row.qq) {
|
||||
url = 'https://wpa.qq.com/msgrd?v=3&uin=' + row.qq + '&site=fastadmin.net&menu=yes';
|
||||
}
|
||||
return '<a href="' + url + '" target="_blank" data-toggle="tooltip" class="text-primary">' + value + '</a>';
|
||||
},
|
||||
price: function (value, row, index) {
|
||||
if (isNaN(value)) {
|
||||
return value;
|
||||
}
|
||||
return parseFloat(value) == 0 ? '<span class="text-success">' + __('Free') + '</span>' : '<span class="text-danger">¥' + value + '</span>';
|
||||
},
|
||||
downloads: function (value, row, index) {
|
||||
return value;
|
||||
},
|
||||
version: function (value, row, index) {
|
||||
return row.addon && row.addon.version != row.version ? '<a href="' + row.url + '?version=' + row.version + '" target="_blank"><span class="releasetips text-primary" data-toggle="tooltip" title="' + __('New version tips', row.version) + '">' + row.addon.version + '<i></i></span></a>' : row.version;
|
||||
},
|
||||
home: function (value, row, index) {
|
||||
return row.addon && parseInt(row.addon.state) > 0 ? '<a href="' + row.addon.url + '" data-toggle="tooltip" title="' + __('View addon index page') + '" target="_blank"><i class="fa fa-home text-primary"></i></a>' : '<a href="javascript:;"><i class="fa fa-home text-gray"></i></a>';
|
||||
},
|
||||
},
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
userinfo: {
|
||||
get: function () {
|
||||
var userinfo = localStorage.getItem("fastadmin_userinfo");
|
||||
return userinfo ? JSON.parse(userinfo) : null;
|
||||
},
|
||||
set: function (data) {
|
||||
if (data) {
|
||||
localStorage.setItem("fastadmin_userinfo", JSON.stringify(data));
|
||||
} else {
|
||||
localStorage.removeItem("fastadmin_userinfo");
|
||||
}
|
||||
}
|
||||
},
|
||||
refresh: function (table, name) {
|
||||
//刷新左侧边栏
|
||||
Fast.api.refreshmenu();
|
||||
|
||||
//刷新行数据
|
||||
if ($(".operate[data-name='" + name + "']").length > 0) {
|
||||
var index = $(".operate[data-name='" + name + "']").closest("tr[data-index]").data("index");
|
||||
var row = Table.api.getrowbyindex(table, index);
|
||||
row.addon = typeof Config['addons'][name] !== 'undefined' ? Config['addons'][name] : undefined;
|
||||
table.bootstrapTable("updateRow", {index: index, row: row});
|
||||
} else if ($(".btn-switch.active").data("type") == "local") {
|
||||
$(".btn-refresh").trigger("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_coin/index' + location.search,
|
||||
add_url: 'app/app_ai_coin/add',
|
||||
edit_url: 'app/app_ai_coin/edit',
|
||||
del_url: 'app/app_ai_coin/del',
|
||||
// multi_url: 'app/app_ai_coin/multi',
|
||||
// import_url: 'app/app_ai_coin/import',
|
||||
table: 'app_ai_coin',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'coinname', title: __('Coinname'), operate: 'LIKE'},
|
||||
{field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'precision', title: '交易精度', operate: 'LIKE'},
|
||||
{field: 'price_precision', title: '价格精度', operate: 'LIKE'},
|
||||
{field: 'image', title: '币种图', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label},
|
||||
{field: 'coin_type', title: '币种类型', searchList: {"1":'精选币种',"2":'多空币种'}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label},
|
||||
// {field: 'coin_desc', title: '币种描述', operate: 'LIKE'},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
// {field: 'exchange_id', title: __('Exchange_id')},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'high', title: __('High'), operate:'BETWEEN'},
|
||||
{field: 'close', title: __('Close'), operate:'BETWEEN'},
|
||||
{field: 'low', title: __('Low'), operate:'BETWEEN'},
|
||||
{field: 'open', title: __('Open'), operate:'BETWEEN'},
|
||||
{field: 'increase', title: __('Increase')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_grade/index' + location.search,
|
||||
// add_url: 'app/app_ai_grade/add',
|
||||
edit_url: 'app/app_ai_grade/edit',
|
||||
// del_url: 'app/app_ai_grade/del',
|
||||
// multi_url: 'app/app_ai_grade/multi',
|
||||
// import_url: 'app/app_ai_grade/import',
|
||||
table: 'app_ai_grade',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'level', title: __('Level')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'team_num', title: __('Team_num')},
|
||||
{field: 'team_prize', title: __('Team_prize')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_strategy/index' + location.search,
|
||||
add_url: 'app/app_ai_strategy/add',
|
||||
edit_url: 'app/app_ai_strategy/edit',
|
||||
del_url: 'app/app_ai_strategy/del',
|
||||
// multi_url: 'app/app_ai_strategy/multi',
|
||||
// import_url: 'app/app_ai_strategy/import',
|
||||
table: 'app_ai_strategy',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'coinname', title: __('币种')},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
{field: 'first_num', title: __('First_num'), operate:'BETWEEN'},
|
||||
{field: 'num', title: __('Num')},
|
||||
{field: 'zy_percent', title: __('Zy_percent'), operate:'BETWEEN'},
|
||||
{field: 'zy_ht', title: __('Zy_ht'), operate:'BETWEEN'},
|
||||
{field: 'bc_ht', title: __('Bc_ht'), operate:'BETWEEN'},
|
||||
{field: 'cc_price', title: __('Cc_price'), operate:'BETWEEN'},
|
||||
{field: 'cc_num', title: __('Cc_num'), operate:'BETWEEN'},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'is_double', title: __('Is_double'), searchList: {"0":__('Is_double 0'),"1":__('Is_double 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'double_max', title: __('Double_max'), operate:'BETWEEN'},
|
||||
{field: 'cc_amount', title: __('持仓金额'), operate:'BETWEEN'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('更新时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_strategy_order/index' + location.search,
|
||||
// add_url: 'app/app_ai_strategy_order/add',
|
||||
edit_url: 'app/app_ai_strategy_order/edit',
|
||||
del_url: 'app/app_ai_strategy_order/del',
|
||||
// multi_url: 'app/app_ai_strategy_order/multi',
|
||||
// import_url: 'app/app_ai_strategy_order/import',
|
||||
table: 'app_ai_strategy_order',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'nickname', title: __('用户'), operate: 'LIKE'},
|
||||
{field: 'coinname', title: __('币种')},
|
||||
{field: 'strategy_id', title: __('Strategy_id')},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'order_sn', title: __('Order_sn')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'fee', title: __('Fee'), operate:'BETWEEN'},
|
||||
{field: 'bc_time', title: __('Bc_time'), operate:'RANGE'},
|
||||
{field: 'strategy_code', title: __('Strategy_code')},
|
||||
{field: 'income', title: __('Income'), operate:'BETWEEN'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'remake', title: __('Remake')},
|
||||
// {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
// {field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_user_income/index' + location.search,
|
||||
// add_url: 'app/app_ai_user_income/add',
|
||||
edit_url: 'app/app_ai_user_income/edit',
|
||||
// del_url: 'app/app_ai_user_income/del',
|
||||
// multi_url: 'app/app_ai_user_income/multi',
|
||||
// import_url: 'app/app_ai_user_income/import',
|
||||
table: 'app_ai_user_income',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'jstime', title: __('Jstime')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ai_user_income_all/index' + location.search,
|
||||
// add_url: 'app/app_ai_user_income_all/add',
|
||||
edit_url: 'app/app_ai_user_income_all/edit',
|
||||
// del_url: 'app/app_ai_user_income_all/del',
|
||||
// multi_url: 'app/app_ai_user_income_all/multi',
|
||||
// import_url: 'app/app_ai_user_income_all/import',
|
||||
table: 'app_ai_user_income_all',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'income', title: __('Income'), operate:'BETWEEN'},
|
||||
{field: 'fee', title: __('Fee'), operate:'BETWEEN'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'pcnum', title: __('Pcnum'), operate:'BETWEEN'},
|
||||
{field: 'income_per', title: __('Income_per'), operate:'BETWEEN'},
|
||||
{field: 'exchange_id', title: __('Exchange_id')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_angel_set/index' + location.search,
|
||||
add_url: 'app/app_angel_set/add',
|
||||
edit_url: 'app/app_angel_set/edit',
|
||||
// del_url: 'app/app_angel_set/del',
|
||||
// multi_url: 'app/app_angel_set/multi',
|
||||
// import_url: 'app/app_angel_set/import',
|
||||
table: 'app_angel_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'level', title: __('Level')},
|
||||
{field: 'curr_id', title: __('Curr_id')},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'all_num', title: __('All_num')},
|
||||
{field: 'count_num', title: __('Count_num')},
|
||||
{field: 'real_num', title: __('Real_num')},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
{field: 'interest', title: __('Interest'), operate:'BETWEEN'},
|
||||
{field: 'push_award', title: __('Push_award'), operate:'BETWEEN'},
|
||||
{field: 'freed_day', title: __('Freed_day')},
|
||||
{field: 'freed_bl', title: __('Freed_bl'), operate:'BETWEEN'},
|
||||
{field: 'min_invest', title: __('Min_invest')},
|
||||
{field: 'max_invest', title: __('Max_invest')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_angel_user/index' + location.search,
|
||||
// add_url: 'app/app_angel_user/add',
|
||||
edit_url: 'app/app_angel_user/edit',
|
||||
// del_url: 'app/app_angel_user/del',
|
||||
// multi_url: 'app/app_angel_user/multi',
|
||||
// import_url: 'app/app_angel_user/import',
|
||||
table: 'app_angel_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('昵称')},
|
||||
{field: 'angel_id', title: __('Angel_id')},
|
||||
{field: 'num', title: __('Num')},
|
||||
{field: 'real_num', title: __('Real_num'), operate:'BETWEEN'},
|
||||
{field: 'usdt', title: __('Usdt'), operate:'BETWEEN'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'days', title: __('Days')},
|
||||
{field: 'count_lixi', title: __('Count_lixi'), operate:'BETWEEN'},
|
||||
{field: 'wait_lixi', title: __('Wait_lixi'), operate:'BETWEEN'},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'lasttime', title: __('Lasttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_auth/index' + location.search,
|
||||
add_url: 'app/app_auth/add',
|
||||
edit_url: 'app/app_auth/edit',
|
||||
del_url: 'app/app_auth/del',
|
||||
// multi_url: 'app/app_auth/multi',
|
||||
// import_url: 'app/app_auth/import',
|
||||
table: 'app_auth',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'card_num', title: __('Card_num'), operate: 'LIKE'},
|
||||
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
||||
{field: 'card_image', title: __('身份证正面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'cardbm_image', title: __('身份证反面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_auth_high/index' + location.search,
|
||||
add_url: 'app/app_auth_high/add',
|
||||
edit_url: 'app/app_auth_high/edit',
|
||||
del_url: 'app/app_auth_high/del',
|
||||
// multi_url: 'app/app_auth_high/multi',
|
||||
// import_url: 'app/app_auth_high/import',
|
||||
table: 'app_auth_high',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'card_image', title: __('Card_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'cardbm_image', title: __('Cardbm_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_banner/index' + location.search,
|
||||
add_url: 'app/app_banner/add',
|
||||
edit_url: 'app/app_banner/edit',
|
||||
del_url: 'app/app_banner/del',
|
||||
// multi_url: 'app/app_banner/multi',
|
||||
// import_url: 'app/app_banner/import',
|
||||
table: 'app_banner',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'image_en', title: '英文图', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
// {field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_banner_pc/index' + location.search,
|
||||
add_url: 'app/app_banner_pc/add',
|
||||
edit_url: 'app/app_banner_pc/edit',
|
||||
del_url: 'app/app_banner_pc/del',
|
||||
// multi_url: 'app/app_banner_pc/multi',
|
||||
// import_url: 'app/app_banner_pc/import',
|
||||
table: 'app_banner_pc',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'image_en', title: __('Image_en'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_coin_trade/index' + location.search,
|
||||
add_url: 'app/app_coin_trade/add',
|
||||
edit_url: 'app/app_coin_trade/edit',
|
||||
del_url: 'app/app_coin_trade/del',
|
||||
// multi_url: 'app/app_coin_trade/multi',
|
||||
// import_url: 'app/app_coin_trade/import',
|
||||
table: 'app_coin_trade',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'user_name', title: __('用户')},
|
||||
{field: 'curr_name', title: __('币种')},
|
||||
{field: 'type', title: __('Type'), searchList: {"sell":__('Type sell'),"buy":__('Type buy')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'cart', title: __('Cart'), searchList: {"market":__('Cart market'),"limit":__('Cart limit')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
|
||||
{field: 'have_num', title: __('Have_num'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'canceltime', title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_contract/index' + location.search,
|
||||
add_url: 'app/app_contract/add',
|
||||
edit_url: 'app/app_contract/edit',
|
||||
del_url: 'app/app_contract/del',
|
||||
// multi_url: 'app/app_contract/multi',
|
||||
// import_url: 'app/app_contract/import',
|
||||
table: 'app_contract',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'user_name', title: __('用户')},
|
||||
{field: 'coin_id', title: __('Coin_id')},
|
||||
{field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'type', title: __('Type'), searchList: {"more":__('Type more'),"free":__('Type free')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'pc_price', title: __('Pc_price'), operate:'BETWEEN'},
|
||||
{field: 'num', title: __('Num')},
|
||||
{field: 'multiple', title: __('Multiple')},
|
||||
{field: 'promise_fee', title: __('Promise_fee'), operate:'BETWEEN'},
|
||||
{field: 'fee', title: __('Fee'), operate:'BETWEEN'},
|
||||
{field: 'zy_price', title: __('Zy_price'), operate:'BETWEEN'},
|
||||
{field: 'zs_price', title: __('Zs_price'), operate:'BETWEEN'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'pctime', title: __('Pctime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'income', title: __('Income'), operate:'BETWEEN'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
// 一键平仓按钮事件
|
||||
$(document).on('click', '.btn-closeall', function () {
|
||||
Layer.confirm('确定要一键平仓所有持仓中的合约订单吗?此操作不可撤销!', {
|
||||
icon: 0,
|
||||
title: '一键平仓确认'
|
||||
}, function (index) {
|
||||
Layer.close(index);
|
||||
$.ajax({
|
||||
url: 'app/app_contract/closeall',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (ret) {
|
||||
if (ret.code === 1) {
|
||||
Layer.alert(ret.msg, {icon: 1});
|
||||
table.bootstrapTable('refresh');
|
||||
} else {
|
||||
Layer.alert(ret.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
Layer.alert('请求失败', {icon: 2});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_cooperation/index' + location.search,
|
||||
add_url: 'app/app_cooperation/add',
|
||||
edit_url: 'app/app_cooperation/edit',
|
||||
del_url: 'app/app_cooperation/del',
|
||||
multi_url: 'app/app_cooperation/multi',
|
||||
import_url: 'app/app_cooperation/import',
|
||||
table: 'app_cooperation',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'email', title: __('Email'), operate: 'LIKE'},
|
||||
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_curr_apply/index' + location.search,
|
||||
add_url: 'app/app_curr_apply/add',
|
||||
edit_url: 'app/app_curr_apply/edit',
|
||||
del_url: 'app/app_curr_apply/del',
|
||||
multi_url: 'app/app_curr_apply/multi',
|
||||
import_url: 'app/app_curr_apply/import',
|
||||
table: 'app_curr_apply',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'faxin_num', title: __('Faxin_num')},
|
||||
{field: 'web_url', title: __('Web_url'), operate: 'LIKE', formatter: Table.api.formatter.url},
|
||||
{field: 'white_paper', title: __('White_paper'), operate: 'LIKE'},
|
||||
{field: 'qun', title: __('Qun'), operate: 'LIKE'},
|
||||
{field: 'email', title: __('Email'), operate: 'LIKE'},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_curr_release/index' + location.search,
|
||||
add_url: 'app/app_curr_release/add',
|
||||
edit_url: 'app/app_curr_release/edit',
|
||||
// del_url: 'app/app_curr_release/del',
|
||||
// multi_url: 'app/app_curr_release/multi',
|
||||
// import_url: 'app/app_curr_release/import',
|
||||
table: 'app_curr_release',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'cesi_user', title: __('Cesi_user'), operate: 'LIKE'},
|
||||
{field: 'usdt', title: __('Usdt'), operate:'BETWEEN'},
|
||||
{field: 'count_num', title: __('Count_num'), operate:'BETWEEN'},
|
||||
{field: 'is_bb', title: __('Is_bb'), searchList: {"1":__('Is_bb 1'),"0":__('Is_bb 0')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'is_hytrade', title: __('Is_hytrade'), searchList: {"0":__('Is_hytrade 0'),"1":__('Is_hytrade 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'is_tk', title: __('Is_tk'), searchList: {"1":__('Is_tk 1'),"0":__('Is_tk 0')}, formatter: Table.api.formatter.normal},
|
||||
// {field: 'rate_id', title: __('Rate_id')},
|
||||
// {field: 'btcron_id', title: __('Btcron_id')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_currency/index' + location.search,
|
||||
add_url: 'app/app_currency/add',
|
||||
edit_url: 'app/app_currency/edit',
|
||||
// del_url: 'app/app_currency/del',
|
||||
// multi_url: 'app/app_currency/multi',
|
||||
// import_url: 'app/app_currency/import',
|
||||
table: 'app_currency',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'full_name', title: __('Full_name'), operate: 'LIKE'},
|
||||
{field: 'exchange', title: __('Exchange'), operate:'BETWEEN'},
|
||||
// {field: 'suffix', title: __('Suffix'), operate: 'LIKE'},
|
||||
{field: 'thumb_image', title: __('Thumb_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'process', title: __('Process'), operate:'BETWEEN'},
|
||||
{field: 'is_reg', title: __('Is_reg'), searchList: {"1":__('Is_reg 1'),"0":__('Is_reg 0')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'is_wid', title: __('Is_wid'), searchList: {"1":__('Is_wid 1'),"0":__('Is_wid 0')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'min_widthdraw', title: __('Min_widthdraw'), operate:'BETWEEN'},
|
||||
{field: 'max_widthdraw', title: __('Max_widthdraw'), operate:'BETWEEN'},
|
||||
{field: 'is_tran', title: __('Is_tran')},
|
||||
{field: 'is_otc', title: __('Is_otc'), searchList: {"1":__('Is_otc 1'),"0":__('Is_otc 0')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'min_hang', title: __('Min_hang'), operate:'BETWEEN'},
|
||||
{field: 'max_hang', title: __('Max_hang'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_currency_user/index' + location.search,
|
||||
// add_url: 'app/app_currency_user/add',
|
||||
edit_url: 'app/app_currency_user/edit',
|
||||
// del_url: 'app/app_currency_user/del',
|
||||
// multi_url: 'app/app_currency_user/multi',
|
||||
// import_url: 'app/app_currency_user/import',
|
||||
table: 'app_currency_user',
|
||||
recharge: 'app/app_currency_user/recharge',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'user_name', title: __('用户')},
|
||||
{field: 'coinname', title: __('Curr_id')},
|
||||
{field: 'num', title: __('现货余额'), operate:'BETWEEN'},
|
||||
{field: 'num_fb', title: __('法币余额'), operate:'BETWEEN'},
|
||||
// {field: 'num_lh', title: __('量化余额'), operate:'BETWEEN'},
|
||||
// {field: 'num_dj', title: __('冻结现货'), operate:'BETWEEN'},
|
||||
// {field: 'num_fb_dj', title: __('冻结法币'), operate:'BETWEEN'},
|
||||
// {field: 'num_lh_dj', title: __('冻结量化'), operate:'BETWEEN'},
|
||||
// {field: 'address', title: "erc20地址", operate: 'LIKE'},
|
||||
// {field: 'tron_address', title: "trc20地址", operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
recharge: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
freeze: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_cycleset/index' + location.search,
|
||||
add_url: 'app/app_cycleset/add',
|
||||
edit_url: 'app/app_cycleset/edit',
|
||||
del_url: 'app/app_cycleset/del',
|
||||
multi_url: 'app/app_cycleset/multi',
|
||||
import_url: 'app/app_cycleset/import',
|
||||
table: 'app_cycleset',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
// {field: 'curr_id', title: __('Curr_id')},
|
||||
{field: 'limit_num', title: __('Limit_num'), operate: 'LIKE'},
|
||||
{field: 'trade_time', title: __('Trade_time'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
||||
// {field: 'show_name', title: __('Show_name'), operate: 'LIKE'},
|
||||
// {field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_dapp_cate/index' + location.search,
|
||||
add_url: 'app/app_dapp_cate/add',
|
||||
edit_url: 'app/app_dapp_cate/edit',
|
||||
del_url: 'app/app_dapp_cate/del',
|
||||
// multi_url: 'app/app_dapp_cate/multi',
|
||||
// import_url: 'app/app_dapp_cate/import',
|
||||
table: 'app_dapp_cate',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'name_en', title: __('Name_en'), operate: 'LIKE'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_dapp_list/index' + location.search,
|
||||
add_url: 'app/app_dapp_list/add',
|
||||
edit_url: 'app/app_dapp_list/edit',
|
||||
del_url: 'app/app_dapp_list/del',
|
||||
// multi_url: 'app/app_dapp_list/multi',
|
||||
// import_url: 'app/app_dapp_list/import',
|
||||
table: 'app_dapp_list',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'cate_name', title: __('分类')},
|
||||
{field: 'is_hot', title: __('Is_hot'), searchList: {"1":__('Is_hot 1'),"0":__('Is_hot 0')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'logo_image', title: __('图标-日间'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'logo2_image', title: __('图标-夜间'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'name_en', title: __('Name_en'), operate: 'LIKE'},
|
||||
{field: 'open_status', title: __('Open_status'), searchList: {"1":__('Open_status 1'),"2":__('Open_status 2'),"3":__('Open_status 3')}, formatter: Table.api.formatter.status},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_detailed/index' + location.search,
|
||||
// add_url: 'app/app_detailed/add',
|
||||
edit_url: 'app/app_detailed/edit',
|
||||
// del_url: 'app/app_detailed/del',
|
||||
// multi_url: 'app/app_detailed/multi',
|
||||
// import_url: 'app/app_detailed/import',
|
||||
table: 'app_detailed',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
//这里我们手动设置底部的值
|
||||
$("#money").text(data.count_price);
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title:'用户ID'},
|
||||
{field: 'user_name', title:'用户'},
|
||||
{field: 'coinname', title:'货币'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'cart', title: __('Cart'), searchList: {"1":__('Cart 1'),"2":__('Cart 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"4":__('Type 4'),"5":__('Type 5'),"6":__('Type 6'),"7":__('Type 7'),"8":__('Type 8'),"9":__('Type 9'),"10":__('Type 10')}, formatter: Table.api.formatter.normal},
|
||||
// {field: 'serial_no', title: __('Serial_no')},
|
||||
// {field: 'order_result', title: __('Order_result'), searchList: {"process":__('Process'),"result":__('Result')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
// {field: 'admin_name', title: __('客户代理')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'hash', title: __('Hash'), operate: 'LIKE'},
|
||||
{field: 'before_num', title: __('Before_num'), operate:'BETWEEN'},
|
||||
{field: 'after_num', title: __('After_num'), operate:'BETWEEN'},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_detailed_fb/index' + location.search,
|
||||
// add_url: 'app/app_detailed_fb/add',
|
||||
// edit_url: 'app/app_detailed_fb/edit',
|
||||
// del_url: 'app/app_detailed_fb/del',
|
||||
// multi_url: 'app/app_detailed_fb/multi',
|
||||
// import_url: 'app/app_detailed_fb/import',
|
||||
table: 'app_detailed_fb',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
//这里我们手动设置底部的值
|
||||
$("#money").text(data.count_price);
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title:'用户ID'},
|
||||
{field: 'user_name', title:'用户'},
|
||||
{field: 'coinname', title:'货币'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'cart', title: __('Cart'), searchList: {"1":__('Cart 1'),"2":__('Cart 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'before_num', title: __('Before_num'), operate:'BETWEEN'},
|
||||
{field: 'after_num', title: __('After_num'), operate:'BETWEEN'},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_detailed_lh/index' + location.search,
|
||||
// add_url: 'app/app_detailed_lh/add',
|
||||
// edit_url: 'app/app_detailed_lh/edit',
|
||||
// del_url: 'app/app_detailed_lh/del',
|
||||
// multi_url: 'app/app_detailed_lh/multi',
|
||||
// import_url: 'app/app_detailed_lh/import',
|
||||
table: 'app_detailed_lh',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
//这里我们手动设置底部的值
|
||||
$("#money").text(data.count_price);
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title:'用户ID'},
|
||||
{field: 'user_name', title:'用户'},
|
||||
{field: 'coinname', title:'货币'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'cart', title: __('Cart'), searchList: {"1":__('Cart 1'),"2":__('Cart 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"4":__('Type 4')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'before_num', title: __('Before_num'), operate:'BETWEEN'},
|
||||
{field: 'after_num', title: __('After_num'), operate:'BETWEEN'},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ems_template/index' + location.search,
|
||||
add_url: 'app/app_ems_template/add',
|
||||
edit_url: 'app/app_ems_template/edit',
|
||||
del_url: 'app/app_ems_template/del',
|
||||
// multi_url: 'app/app_ems_template/multi',
|
||||
// import_url: 'app/app_ems_template/import',
|
||||
table: 'app_ems_template',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'event', title: __('Event'), operate: 'LIKE'},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_exchange_set/index' + location.search,
|
||||
add_url: 'app/app_exchange_set/add',
|
||||
edit_url: 'app/app_exchange_set/edit',
|
||||
del_url: 'app/app_exchange_set/del',
|
||||
multi_url: 'app/app_exchange_set/multi',
|
||||
import_url: 'app/app_exchange_set/import',
|
||||
table: 'app_exchange_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'name_sx', title: __('Name_sx'), operate: 'LIKE'},
|
||||
{field: 'exchange', title: __('Exchange'), operate:'BETWEEN'},
|
||||
{field: 'sign', title: __('Sign'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_help/index' + location.search,
|
||||
add_url: 'app/app_help/add',
|
||||
edit_url: 'app/app_help/edit',
|
||||
del_url: 'app/app_help/del',
|
||||
// multi_url: 'app/app_help/multi',
|
||||
// import_url: 'app/app_help/import',
|
||||
table: 'app_help',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
// {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'title_en', title: __('Title_en'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ico_set/index' + location.search,
|
||||
add_url: 'app/app_ico_set/add',
|
||||
edit_url: 'app/app_ico_set/edit',
|
||||
del_url: 'app/app_ico_set/del',
|
||||
// multi_url: 'app/app_ico_set/multi',
|
||||
// import_url: 'app/app_ico_set/import',
|
||||
table: 'app_ico_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'cover_image', title: __('Cover_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'curr_name', title: __('私募币种')},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'count_num', title: __('Count_num')},
|
||||
{field: 'real_num', title: __('Real_num')},
|
||||
// {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
|
||||
{field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ico_user/index' + location.search,
|
||||
add_url: 'app/app_ico_user/add',
|
||||
edit_url: 'app/app_ico_user/edit',
|
||||
del_url: 'app/app_ico_user/del',
|
||||
multi_url: 'app/app_ico_user/multi',
|
||||
import_url: 'app/app_ico_user/import',
|
||||
table: 'app_ico_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'ico_id', title: __('Ico_id')},
|
||||
{field: 'ico_name', title: __('私募名称')},
|
||||
{field: 'num', title: __('Num')},
|
||||
{field: 'bili', title: __('中签比例(%)')},
|
||||
{field: 'status', title: __('状态'), formatter: Table.api.formatter.status, searchList: {1: __('已发放'), 0: __('未发放')}},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 启动和暂停按钮
|
||||
$(document).on("click", ".btn-start", function () {
|
||||
//在table外不可以使用添加.btn-change的方法
|
||||
//只能自己调用Table.api.multi实现
|
||||
//如果操作全部则ids可以置为空
|
||||
var ids = Table.api.selectedids(table);
|
||||
Table.api.multi("changestatus", ids.join(","), table, this);
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ico_yuyue/index' + location.search,
|
||||
add_url: 'app/app_ico_yuyue/add',
|
||||
edit_url: 'app/app_ico_yuyue/edit',
|
||||
del_url: 'app/app_ico_yuyue/del',
|
||||
multi_url: 'app/app_ico_yuyue/multi',
|
||||
import_url: 'app/app_ico_yuyue/import',
|
||||
table: 'app_ico_yuyue',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'ico_id', title: __('Ico_id')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_ip_set/index' + location.search,
|
||||
// add_url: 'app/app_ip_set/add',
|
||||
edit_url: 'app/app_ip_set/edit',
|
||||
// del_url: 'app/app_ip_set/del',
|
||||
// multi_url: 'app/app_ip_set/multi',
|
||||
// import_url: 'app/app_ip_set/import',
|
||||
table: 'app_ip_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'content', title: __('Content'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_level/index' + location.search,
|
||||
// add_url: 'app/app_level/add',
|
||||
edit_url: 'app/app_level/edit',
|
||||
// del_url: 'app/app_level/del',
|
||||
// multi_url: 'app/app_level/multi',
|
||||
// import_url: 'app/app_level/import',
|
||||
table: 'app_level',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'level', title: __('Level')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'team_num', title: __('Team_num')},
|
||||
{field: 'team_prize', title: __('Team_prize'), operate:'BETWEEN'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_market/index' + location.search,
|
||||
add_url: 'app/app_market/add',
|
||||
edit_url: 'app/app_market/edit',
|
||||
del_url: 'app/app_market/del',
|
||||
// multi_url: 'app/app_market/multi',
|
||||
// import_url: 'app/app_market/import',
|
||||
table: 'app_market',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'fb_name', title: __('法币国家')},
|
||||
{field: 'curr_name', title: __('货币名称')},
|
||||
{field: 'num', title: __('Num')},
|
||||
{field: 'residue_num', title: __('Residue_num')},
|
||||
{field: 'free', title: __('Free'), operate:'BETWEEN'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'min_price', title: __('Min_price'), operate:'BETWEEN'},
|
||||
{field: 'max_price', title: __('Max_price'), operate:'BETWEEN'},
|
||||
// {field: 'payment', title: __('Payment')},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_market_appeal/index' + location.search,
|
||||
// add_url: 'app/app_market_appeal/add',
|
||||
edit_url: 'app/app_market_appeal/edit',
|
||||
del_url: 'app/app_market_appeal/del',
|
||||
// multi_url: 'app/app_market_appeal/multi',
|
||||
// import_url: 'app/app_market_appeal/import',
|
||||
table: 'app_market_appeal',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'order_id', title: __('Order_id')},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'content', title: __('Content'), operate: 'LIKE'},
|
||||
{field: 'annex_images', title: __('Annex_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
{field: 'status', title: __('Status'), searchList: {"2":__('Status 2'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
|
||||
{field: 'discreption', title: __('Discreption'), operate: 'LIKE'},
|
||||
{field: 'victory', title: __('Victory'), searchList: {"1":__('Victory 1'),"2":__('Victory 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_market_cancel_log/index' + location.search,
|
||||
// add_url: 'app/app_market_cancel_log/add',
|
||||
// edit_url: 'app/app_market_cancel_log/edit',
|
||||
del_url: 'app/app_market_cancel_log/del',
|
||||
// multi_url: 'app/app_market_cancel_log/multi',
|
||||
// import_url: 'app/app_market_cancel_log/import',
|
||||
table: 'app_market_cancel_log',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'type', title: __('Type')},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_market_country/index' + location.search,
|
||||
add_url: 'app/app_market_country/add',
|
||||
edit_url: 'app/app_market_country/edit',
|
||||
del_url: 'app/app_market_country/del',
|
||||
multi_url: 'app/app_market_country/multi',
|
||||
import_url: 'app/app_market_country/import',
|
||||
table: 'app_market_country',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'curr_name', title: __('Curr_name'), operate: 'LIKE'},
|
||||
{field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||
{field: 'usdt_price', title: __('Usdt_price'), operate:'BETWEEN'},
|
||||
{field: 'pay_name', title: __('Pay_name'), operate: 'LIKE'},
|
||||
{field: 'pay_image', title: __('Pay_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_market_user/index' + location.search,
|
||||
// add_url: 'app/app_market_user/add',
|
||||
edit_url: 'app/app_market_user/edit',
|
||||
del_url: 'app/app_market_user/del',
|
||||
// multi_url: 'app/app_market_user/multi',
|
||||
// import_url: 'app/app_market_user/import',
|
||||
table: 'app_market_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'order_num', title: __('Order_num'), operate: 'LIKE'},
|
||||
{field: 'order_id', title: __('Order_id')},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'relid', title: __('Relid')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'free_num', title: __('Free_num'), operate:'BETWEEN'},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status},
|
||||
{field: 'voucher_image', title: __('Voucher_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'add_time', title: __('Add_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'succ_time', title: __('Succ_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'cancel_time', title: __('Cancel_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_messages/index' + location.search,
|
||||
add_url: 'app/app_messages/add',
|
||||
edit_url: 'app/app_messages/edit',
|
||||
del_url: 'app/app_messages/del',
|
||||
// multi_url: 'app/app_messages/multi',
|
||||
// import_url: 'app/app_messages/import',
|
||||
table: 'app_messages',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_product/index' + location.search,
|
||||
add_url: 'app/app_product/add',
|
||||
edit_url: 'app/app_product/edit',
|
||||
del_url: 'app/app_product/del',
|
||||
// multi_url: 'app/app_product/multi',
|
||||
// import_url: 'app/app_product/import',
|
||||
table: 'app_product',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'curr_name', title: __('币种')},
|
||||
{field: 'min_num', title: __('Min_num'), operate:'BETWEEN'},
|
||||
{field: 'max_num', title: __('Max_num')},
|
||||
{field: 'fast_rixi', title: __('Fast_rixi'), operate:'BETWEEN'},
|
||||
{field: 'day', title: __('周期')},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_product_user/index' + location.search,
|
||||
// add_url: 'app/app_product_user/add',
|
||||
edit_url: 'app/app_product_user/edit',
|
||||
del_url: 'app/app_product_user/del',
|
||||
// multi_url: 'app/app_product_user/multi',
|
||||
// import_url: 'app/app_product_user/import',
|
||||
table: 'app_product_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'product_name', title: __('产品名称')},
|
||||
{field: 'curr_name', title: __('币种')},
|
||||
{field: 'rixi', title: __('Rixi'), operate:'BETWEEN'},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'day', title: __('Day')},
|
||||
{field: 'alr_day', title: __('Alr_day')},
|
||||
{field: 'alr_num', title: __('Alr_num'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'lasttime', title: __('Lasttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_proxy/index' + location.search,
|
||||
add_url: 'app/app_proxy/add',
|
||||
edit_url: 'app/app_proxy/edit',
|
||||
del_url: 'app/app_proxy/del',
|
||||
// multi_url: 'app/app_proxy/multi',
|
||||
// import_url: 'app/app_proxy/import',
|
||||
table: 'app_proxy',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
||||
// {field: 'password', title: __('Password'), operate: 'LIKE'},
|
||||
// {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.status},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'remake', title: __('Remake'), operate: 'LIKE'},
|
||||
{field: 'register_url', title: '专属注册链接', operate: false, formatter: function(value, row) {
|
||||
if (!value) return '-';
|
||||
return '<a href="javascript:;" class="btn btn-xs btn-info btn-copy-url" data-url="' + value + '" title="点击复制"><i class="fa fa-copy"></i> 复制链接</a>';
|
||||
}},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
// 复制注册链接
|
||||
$(document).on('click', '.btn-copy-url', function () {
|
||||
var url = $(this).data('url');
|
||||
var input = document.createElement('input');
|
||||
input.value = url;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(input);
|
||||
Toastr.success('注册链接已复制: ' + url);
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_proxy_tj/index' + location.search,
|
||||
// add_url: 'app/app_proxy_tj/add',
|
||||
// edit_url: 'app/app_proxy_tj/edit',
|
||||
// del_url: 'app/app_proxy_tj/del',
|
||||
// multi_url: 'app/app_proxy_tj/multi',
|
||||
// import_url: 'app/app_proxy_tj/import',
|
||||
table: 'app_proxy',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_name', title: __('代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('用户ID')},
|
||||
{field: 'team_num', title: __('团队人数'), operate: false},
|
||||
{field: 'today_user', title: __('今日注册'), operate: false},
|
||||
{field: 'count_reg', title: __('累计充值(USDT)'), operate: false},
|
||||
{field: 'today_reg', title: __('今日充值(USDT)'), operate: false},
|
||||
{field: 'count_wid', title: __('累计提现(USDT)'), operate: false},
|
||||
{field: 'today_wid', title: __('今日提现(USDT)'), operate: false},
|
||||
{field: 'count_trade', title: __('累计币币交易(USDT)'), operate: false},
|
||||
{field: 'today_trade', title: __('今日币币交易(USDT)'), operate: false},
|
||||
{field: 'count_cont', title: __('累计合约交易(USDT)'), operate: false},
|
||||
{field: 'today_cont', title: __('今日合约交易(USDT)'), operate: false},
|
||||
{field: 'count_ico', title: __('累计ICO(USDT)'), operate: false},
|
||||
{field: 'today_ico', title: __('今日ICO(USDT)'), operate: false},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+100
@@ -0,0 +1,100 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_rate/index' + location.search,
|
||||
add_url: 'app/app_rate/add',
|
||||
edit_url: 'app/app_rate/edit',
|
||||
del_url: 'app/app_rate/del',
|
||||
// multi_url: 'app/app_rate/multi',
|
||||
// import_url: 'app/app_rate/import',
|
||||
table: 'app_rate',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
||||
{field: 'coinname', title: __('Coinname'), operate: 'LIKE'},
|
||||
{field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
|
||||
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
|
||||
{field: 'is_zqtrade', title: __('Is_zqtrade'), searchList: {"0":__('Is_zqtrade 0'),"1":__('Is_zqtrade 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'is_hytrade', title: __('Is_hytrade'), searchList: {"0":__('Is_hytrade 0'),"1":__('Is_hytrade 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'high', title: __('High'), operate:'BETWEEN'},
|
||||
{field: 'low', title: __('Low'), operate:'BETWEEN'},
|
||||
{field: 'open', title: __('Open'), operate:'BETWEEN'},
|
||||
{field: 'close', title: __('Close'), operate:'BETWEEN'},
|
||||
{field: 'usdt', title: __('Usdt'), operate:'BETWEEN'},
|
||||
{field: 'rmb', title: __('Rmb'), operate:'BETWEEN'},
|
||||
{field: 'increase', title: __('Increase'), operate:'BETWEEN'},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'jd', title: __('Jd')},
|
||||
{field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'cover_image', title: __('资讯封面图'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'level', title: __('Level')},
|
||||
{field: 'count_price', title: __('Count_price'), operate:'BETWEEN'},
|
||||
{field: 'liutong_num', title: __('Liutong_num'), operate:'BETWEEN'},
|
||||
{field: 'gongji_num', title: __('Gongji_num'), operate:'BETWEEN'},
|
||||
{field: 'count_num', title: __('Count_num'), operate:'BETWEEN'},
|
||||
{field: 'faxin_time', title: __('Faxin_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'faxin_price', title: __('Faxin_price'), operate:'BETWEEN'},
|
||||
{field: 'market_jd', title: __('交易精度')},
|
||||
{field: 'price_jd', title: __('价格精度')},
|
||||
{field: 'qukuai', title: __('Qukuai'), operate: 'LIKE'},
|
||||
{
|
||||
field: 'operate', title: __('Operate'),
|
||||
table: table,
|
||||
// buttons: [
|
||||
// {
|
||||
// name: 'detail',
|
||||
// title: '调整价格',
|
||||
// text: '调整价格',
|
||||
// classname: 'btn btn-xs btn-success btn-dialog',
|
||||
// icon: 'fa fa-list',
|
||||
// url: 'app/app_rate/get_ctrl',
|
||||
// callback: function (data) {
|
||||
// Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
|
||||
// }
|
||||
// },
|
||||
// ],
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
get_ctrl: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_recharge/index' + location.search,
|
||||
add_url: 'app/app_recharge/add',
|
||||
edit_url: 'app/app_recharge/edit',
|
||||
del_url: 'app/app_recharge/del',
|
||||
multi_url: 'app/app_recharge/multi',
|
||||
import_url: 'app/app_recharge/import',
|
||||
table: 'app_recharge',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
// {field: 'curr_id', title: __('Curr_id')},
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
||||
{field: 'hash', title: __('Hash'), operate: 'LIKE'},
|
||||
{field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
|
||||
{field: 'card_num', title: __('Card_num'), operate: 'LIKE'},
|
||||
{field: 'voucher_image', title: __('Voucher_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_recharge_bank/index' + location.search,
|
||||
add_url: 'app/app_recharge_bank/add',
|
||||
edit_url: 'app/app_recharge_bank/edit',
|
||||
del_url: 'app/app_recharge_bank/del',
|
||||
// multi_url: 'app/app_recharge_bank/multi',
|
||||
// import_url: 'app/app_recharge_bank/import',
|
||||
table: 'app_recharge_bank',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
// {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
|
||||
{field: 'bank_user', title: __('Bank_user'), operate: 'LIKE'},
|
||||
{field: 'card_num', title: __('Card_num'), operate: 'LIKE'},
|
||||
{field: 'card_code', title: __('银行代码'), operate: 'LIKE'},
|
||||
{field: 'exchange', title: __('Exchange'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_recharge_set/index' + location.search,
|
||||
// add_url: 'app/app_recharge_set/add',
|
||||
edit_url: 'app/app_recharge_set/edit',
|
||||
del_url: 'app/app_recharge_set/del',
|
||||
// multi_url: 'app/app_recharge_set/multi',
|
||||
// import_url: 'app/app_recharge_set/import',
|
||||
table: 'app_recharge_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'curr', title: __('Curr'), operate: 'LIKE'},
|
||||
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
||||
{field: 'curr_name', title: __('Curr_name'), operate: 'LIKE'},
|
||||
{field: 'curr_id', title: __('Curr_id')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_shequ_set/index' + location.search,
|
||||
add_url: 'app/app_shequ_set/add',
|
||||
edit_url: 'app/app_shequ_set/edit',
|
||||
del_url: 'app/app_shequ_set/del',
|
||||
// multi_url: 'app/app_shequ_set/multi',
|
||||
// import_url: 'app/app_shequ_set/import',
|
||||
table: 'app_shequ_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'content', title: __('Content'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_widthdraw/index' + location.search,
|
||||
// add_url: 'app/app_widthdraw/add',
|
||||
edit_url: 'app/app_widthdraw/edit',
|
||||
// del_url: 'app/app_widthdraw/del',
|
||||
// multi_url: 'app/app_widthdraw/multi',
|
||||
// import_url: 'app/app_widthdraw/import',
|
||||
table: 'app_widthdraw',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
console.log(data);
|
||||
//这里我们手动设置底部的值
|
||||
$("#money").text(data.count_price);
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: '用户ID'},
|
||||
{field: 'nickname', title: __('用户')},
|
||||
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
||||
{field: 'bank_name', title: __('开户行'), operate: 'LIKE'},
|
||||
{field: 'bank_user', title: __('收款人'), operate: 'LIKE'},
|
||||
{field: 'card_num', title: __('银行卡号'), operate: 'LIKE'},
|
||||
{field: 'bank_code', title: __('银行代码'), operate: 'LIKE'},
|
||||
{field: 'curr_name', title: __('币种')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'fee', title: __('Fee'), operate:'BETWEEN'},
|
||||
{field: 'real_num', title: __('Real_num'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"2":__('Status 2'),"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'add_time', title: __('Add_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'exam_time', title: __('Exam_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'hash', title: __('Hash'), operate: 'LIKE'},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_widthdraw_address/index' + location.search,
|
||||
// add_url: 'app/app_widthdraw_address/add',
|
||||
edit_url: 'app/app_widthdraw_address/edit',
|
||||
del_url: 'app/app_widthdraw_address/del',
|
||||
// multi_url: 'app/app_widthdraw_address/multi',
|
||||
// import_url: 'app/app_widthdraw_address/import',
|
||||
table: 'app_widthdraw_address',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'nickname', title: __('昵称')},
|
||||
{field: 'email', title: __('邮箱')},
|
||||
{field: 'curr_name', title: __('币种')},
|
||||
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
||||
{field: 'notice', title: __('Notice'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_zhiya_detail/index' + location.search,
|
||||
// add_url: 'app/app_zhiya_detail/add',
|
||||
// edit_url: 'app/app_zhiya_detail/edit',
|
||||
// del_url: 'app/app_zhiya_detail/del',
|
||||
// multi_url: 'app/app_zhiya_detail/multi',
|
||||
// import_url: 'app/app_zhiya_detail/import',
|
||||
table: 'app_zhiya_detail',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'user_name', title: __('用户')},
|
||||
{field: 'zhiya_id', title: __('Zhiya_id')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_zhiya_set/index' + location.search,
|
||||
add_url: 'app/app_zhiya_set/add',
|
||||
edit_url: 'app/app_zhiya_set/edit',
|
||||
del_url: 'app/app_zhiya_set/del',
|
||||
// multi_url: 'app/app_zhiya_set/multi',
|
||||
// import_url: 'app/app_zhiya_set/import',
|
||||
table: 'app_zhiya_set',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'day', title: __('Day')},
|
||||
{field: 'yield', title: __('Yield'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_zhiya_user/index' + location.search,
|
||||
add_url: 'app/app_zhiya_user/add',
|
||||
edit_url: 'app/app_zhiya_user/edit',
|
||||
del_url: 'app/app_zhiya_user/del',
|
||||
multi_url: 'app/app_zhiya_user/multi',
|
||||
import_url: 'app/app_zhiya_user/import',
|
||||
table: 'app_zhiya_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'user_name', title: __('用户')},
|
||||
{field: 'day', title: __('周期(天)')},
|
||||
{field: 'num', title: __('Num'), operate:'BETWEEN'},
|
||||
{field: 'profit_num', title: __('Profit_num'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
{field: 'add_time', title: __('Add_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'last_time', title: __('Last_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/app_zixun/index' + location.search,
|
||||
add_url: 'app/app_zixun/add',
|
||||
edit_url: 'app/app_zixun/edit',
|
||||
del_url: 'app/app_zixun/del',
|
||||
// multi_url: 'app/app_zixun/multi',
|
||||
// import_url: 'app/app_zixun/import',
|
||||
table: 'app_zixun',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'title_en', title: __('Title_en'), operate: 'LIKE'},
|
||||
{field: 'cover_image', title: __('Cover_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'look_num', title: __('Look_num')},
|
||||
{field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/baobiao/index' + location.search,
|
||||
// add_url: 'app/baobiao/add',
|
||||
// edit_url: 'app/baobiao/edit',
|
||||
// del_url: 'app/baobiao/del',
|
||||
// multi_url: 'app/baobiao/multi',
|
||||
// import_url: 'app/baobiao/import',
|
||||
table: 'user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
||||
{field: 'email', title: __('Email'), operate: 'LIKE'},
|
||||
{field: 'count_usdt', title: __('总资产(USDT)'), operate: false},
|
||||
{field: 'youxiao_usdt', title: __('可用资产(USDT)'), operate: false},
|
||||
{field: 'usdt_num', title: __('当前USDT'), operate: false},
|
||||
{field: 'btcex', title: __('当前BTCEX'), operate: false},
|
||||
{field: 'ico_usdt', title: __('ICO占用(USDT)'), operate: false},
|
||||
{field: 'heyue_usdt', title: __('合约占用(USDT)'), operate: false},
|
||||
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/his_order/index' + location.search,
|
||||
add_url: 'app/his_order/add',
|
||||
edit_url: 'app/his_order/edit',
|
||||
del_url: 'app/his_order/del',
|
||||
multi_url: 'app/his_order/multi',
|
||||
import_url: 'app/his_order/import',
|
||||
table: 'his_order',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
{field: 'serial_no', title: __('Serial_no')},
|
||||
{field: 'user_name', title: '用户'},
|
||||
{field: 'createtime', title: __('Createtime'),formatter: Controller.api.createtime,
|
||||
operate:'RANGE', addclass:'datetimerange', autocomplete:false,
|
||||
formatter: Table.api.formatter.datetime},
|
||||
{field: 'symbol', title: __('Symbol'), searchList: {"btcusdt":__('Btcusdt'),"bchusdt":__('Bchusdt'),"ethusdt":__('Ethusdt'),"ltcusdt":__('Ltcusdt'),"eosusdt":__('Eosusdt'),"etcusdt":__('Etcusdt')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'trade_num', title: __('Trade_num'), operate:'BETWEEN'},
|
||||
{field: 'trade_cycle', title: __('Trade_cycle')},
|
||||
{field: 'expect_percent', title: __('Expect_percent'), operate:'BETWEEN'},
|
||||
{field: 'expect_income', title: __('Expect_income'), operate:'BETWEEN'},
|
||||
{field: 'current_price', title: __('Current_price'), operate:'BETWEEN'},
|
||||
{field: 'close_price', title: __('Close_price'), operate:'BETWEEN'},
|
||||
{field: 'trade_result_num', title: __('Trade_result_num'), operate:'BETWEEN'},
|
||||
{field: 'order_hash', title: __('Order_hash'), operate: 'LIKE'},
|
||||
{field: 'open_time', title: __('Open_time')},
|
||||
{field: 'trade_result', title: __('Trade_result'), searchList: {"win":__('Trade_result win'),"loss":__('Trade_result loss'),"equal":"平"}, formatter: Table.api.formatter.normal},
|
||||
{field: 'rise_or_fall', title: __('Rise_or_fall'), searchList: {"rise":__('Rise_or_fall rise'),"fall":__('Rise_or_fall fall')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+360
@@ -0,0 +1,360 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form','bootstrap-datetimepicker','pako'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/order/index' + location.search,
|
||||
add_url: 'app/order/add',
|
||||
edit_url: 'app/order/edit',
|
||||
del_url: 'app/order/del',
|
||||
multi_url: 'app/order/multi',
|
||||
import_url: 'app/order/import',
|
||||
table: 'order',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var flag = 0;
|
||||
var nowtime = 0;
|
||||
//当表格数据加载完成时
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里我们手动设置底部的值
|
||||
$("#risenum").text(data.extend.risenum);
|
||||
$("#risewin").text(data.extend.risewin);
|
||||
$("#fallnum").text(data.extend.fallnum);
|
||||
$("#fallwin").text(data.extend.fallwin);
|
||||
var sock = null;
|
||||
var wsuri = "wss://api-aws.huobi.pro/ws";
|
||||
var pako = window.pako;
|
||||
sock = new WebSocket(wsuri);
|
||||
sock.onopen = function() {
|
||||
console.log("connected to " + wsuri);
|
||||
sock.send(JSON.stringify({"sub":"market.btcusdt.trade.detail","id":"BTC"}))
|
||||
sock.send(JSON.stringify({"sub":"market.ethusdt.trade.detail","id":"ETH"}))
|
||||
sock.send(JSON.stringify({"sub":"market.eosusdt.trade.detail","id":"EOS"}))
|
||||
sock.send(JSON.stringify({"sub":"market.bchusdt.trade.detail","id":"BCH"}))
|
||||
sock.send(JSON.stringify({"sub":"market.ltcusdt.trade.detail","id":"LTC"}))
|
||||
}
|
||||
sock.onclose = function(e) {
|
||||
console.log("connection closed (" + e.code + ")");
|
||||
}
|
||||
sock.onmessage = function(evt) {
|
||||
if(evt.data instanceof Blob){
|
||||
var result = '';
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
|
||||
result = JSON.parse(pako.inflate(reader.result,{to:'string'}));
|
||||
if(result.ping){
|
||||
sock.send(JSON.stringify({pong:result.ping}));
|
||||
}
|
||||
if(result.ch == 'market.btcusdt.trade.detail')
|
||||
{
|
||||
$.each(result.tick.data,function (m,n) {//循环得出“speciesName”
|
||||
var increase = ((n.price-parseFloat(data.extend.coin.BTC))*100/data.extend.coin.BTC).toFixed(2);
|
||||
var text = n.price.toFixed(2)+' <h5>'+increase+'%</h5>';
|
||||
$("#sbtcusdt").html(text);
|
||||
var color = '#EE6363';
|
||||
if(increase>=0) color = '#00FF7F';
|
||||
$("#sbtcusdt").css({"color":color});
|
||||
});
|
||||
}else if(result.ch == 'market.ethusdt.trade.detail')
|
||||
{
|
||||
$.each(result.tick.data,function (m,n) {//循环得出“speciesName”
|
||||
var increase = ((n.price-parseFloat(data.extend.coin.ETH))*100/data.extend.coin.ETH).toFixed(2);
|
||||
var text = n.price.toFixed(2)+' <h5>'+increase+'%</h5>';
|
||||
$("#sethusdt").html(text);
|
||||
var color = '#EE6363';
|
||||
if(increase>=0) color = '#00FF7F';
|
||||
$("#sethusdt").css({"color":color});
|
||||
});
|
||||
}else if(result.ch == 'market.bchusdt.trade.detail')
|
||||
{
|
||||
$.each(result.tick.data,function (m,n) {//循环得出“speciesName”
|
||||
var increase = ((n.price-parseFloat(data.extend.coin.BCH))*100/data.extend.coin.BCH).toFixed(2);
|
||||
var text = n.price.toFixed(2)+' <h5>'+increase+'%</h5>';
|
||||
$("#sbchusdt").html(text);
|
||||
var color = '#EE6363';
|
||||
if(increase>=0) color = '#00FF7F';
|
||||
$("#sbchusdt").css({"color":color});
|
||||
});
|
||||
}else if(result.ch == 'market.ltcusdt.trade.detail')
|
||||
{
|
||||
$.each(result.tick.data,function (m,n) {//循环得出“speciesName”
|
||||
var increase = ((n.price-parseFloat(data.extend.coin.LTC))*100/data.extend.coin.LTC).toFixed(2);
|
||||
var text = n.price.toFixed(2)+' <h5>'+increase+'%</h5>';
|
||||
$("#sltcusdt").html(text);
|
||||
var color = '#EE6363';
|
||||
if(increase>=0) color = '#00FF7F';
|
||||
$("#sltcusdt").css({"color":color});
|
||||
});
|
||||
}else if(result.ch == 'market.eosusdt.trade.detail')
|
||||
{
|
||||
$.each(result.tick.data,function (m,n) {//循环得出“speciesName”
|
||||
var increase = ((n.price-parseFloat(data.extend.coin.EOS))*100/data.extend.coin.EOS).toFixed(2);
|
||||
var text = n.price.toFixed(2)+' <h5>'+increase+'%</h5>';
|
||||
$("#seosusdt").html(text);
|
||||
var color = '#EE6363';
|
||||
if(increase>=0) color = '#00FF7F';
|
||||
$("#seosusdt").css({"color":color});
|
||||
});
|
||||
}
|
||||
// console.log(result);
|
||||
}
|
||||
reader.readAsBinaryString(evt.data);
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
flag = 1;
|
||||
nowtime = data.extend.nowtime;
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
// {field: 'daili_name', title: __('所属代理'), operate: 'LIKE'},
|
||||
// {field: 'serial_no', title: __('Serial_no')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'symbol', title: __('Symbol'), searchList: {"btcusdt":__('Symbol btcusdt'),"bchusdt":__('Symbol bchusdt'),"ethusdt":__('Symbol ethusdt'),"ltcusdt":__('Symbol ltcusdt'),"eosusdt":__('Symbol eosusdt')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'trade_num', title: __('Trade_num'), operate:'BETWEEN'},
|
||||
{field: 'trade_cycle', title: __('Trade_cycle')},
|
||||
{field: 'expect_percent', title: __('Expect_percent'), operate:'BETWEEN'},
|
||||
// {field: 'expect_income', title: __('Expect_income'), operate:'BETWEEN'},
|
||||
// {field: 'current_price', title: __('Current_price'), operate:'BETWEEN'},
|
||||
// {field: 'order_hash', title: __('Order_hash'), operate: 'LIKE'},
|
||||
{field: 'rise_or_fall', title: __('Rise_or_fall'), searchList: {"rise":__('Rise_or_fall rise'),"fall":__('Rise_or_fall fall')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'set_loss', title: __('设置盈亏'), searchList: {"0":__('默认'),"1":__('盈'),"2":__('亏')}, formatter: Table.api.formatter.normal},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table, events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: '设置盈亏',
|
||||
title: __('设置盈亏'),
|
||||
text: '设置盈亏',
|
||||
classname: 'btn btn-xs btn-primary btn-dialog',
|
||||
icon: 'fa fa-list',
|
||||
url: 'app/order/set_yk?',
|
||||
callback: function (data) {
|
||||
Layer.alert("success");
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '设置比例',
|
||||
title: __('设置比例'),
|
||||
text: '设置比例',
|
||||
classname: 'btn btn-xs btn-success btn-dialog',
|
||||
icon: 'fa fa-list',
|
||||
url: 'app/order/set_bl?',
|
||||
callback: function (data) {
|
||||
Layer.alert("success");
|
||||
}
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
})
|
||||
var int=self.setInterval(function () {
|
||||
var params = {silent: true};
|
||||
$('#table').bootstrapTable('refresh', params);
|
||||
},2000);
|
||||
|
||||
var int1 = self.setInterval(function () {
|
||||
nowtime += 1;
|
||||
$("#nowtime").text(timestampToTime(nowtime));
|
||||
|
||||
}, 1000);
|
||||
|
||||
function timestampToTime(timestamp) {
|
||||
var date = new Date();//时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
||||
var Y = date.getFullYear() + '-';
|
||||
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
|
||||
var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
|
||||
var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
|
||||
var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
|
||||
var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
|
||||
|
||||
strDate = Y+M+D+h+m+s;
|
||||
return strDate;
|
||||
|
||||
}
|
||||
$('#createstime').datetimepicker({
|
||||
format: 'YYYY-MM-DD'});
|
||||
$('#createprice').click(function(){
|
||||
var symbols = $('#symbols').val();
|
||||
var zhouqi = $('#zhouqi').val();
|
||||
var rise_or_falls = $('#rise_or_falls').val();
|
||||
var prices = $('#prices').val();
|
||||
var createstime = $('#createstime').val();
|
||||
|
||||
$("#newcreate").html('');
|
||||
|
||||
$.post("app/order/createPrice",{"symbols":symbols,"zhouqi":zhouqi,
|
||||
"rise_or_falls":rise_or_falls,"prices":prices,"createstime":createstime},function(datas){
|
||||
if(datas.code == 0){
|
||||
alert(datas.msg);
|
||||
}else {
|
||||
var data = datas;
|
||||
var html = '<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa">' +
|
||||
' <label for="id" class="control-label col-xs-4">起始价格</label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="openprice" readonly value="' + data.data.openprice + '" data-index="1"></div>' +
|
||||
' </div>' +
|
||||
' <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa">' +
|
||||
' <label for="id" class="control-label col-xs-4" ><span id="newpricetime1">' + data.data.newprice1.times + '</span></label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="newprice1" value="' + data.data.newprice1.price + '" data-index="1"></div>' +
|
||||
' </div>' +
|
||||
' <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa">' +
|
||||
' <label for="id" class="control-label col-xs-4"><span id="newpricetime2">' + data.data.newprice2.times + '</span></label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="newprice2" value="' + data.data.newprice2.price + '" data-index="1"></div>' +
|
||||
' </div>' +
|
||||
' <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa">' +
|
||||
' <label for="id" class="control-label col-xs-4"><span id="newpricetime3">' + data.data.newprice3.times + '</span></label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="newprice3" value="' + data.data.newprice3.price + '" data-index="1"></div>' +
|
||||
' </div>' +
|
||||
' <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa" >' +
|
||||
' <label for="id" class="control-label col-xs-4"><span id="newpricetime4">' + data.data.newprice4.times + '</span></label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="newprice4" value="' + data.data.newprice4.price + '" data-index="1"></div>' +
|
||||
' </div>' +
|
||||
' <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3" id="pricefa">' +
|
||||
' <label for="id" class="control-label col-xs-4"><span id="newpricetime5">' + data.data.newprice5.times + '</span></label>' +
|
||||
' <div class="col-xs-8">' +
|
||||
' <input type="text" class="form-control" name="openprice" id="newprice5" value="' + data.data.newprice5.price + '" data-index="1"></div>' +
|
||||
' </div>';
|
||||
$("#newcreate").html(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#submitprice').on('click',function() {
|
||||
var symbols = $('#symbols').val();
|
||||
var zhouqi = $('#zhouqi').val();
|
||||
var rise_or_falls = $('#rise_or_falls').val();
|
||||
var prices = $('#prices').val();
|
||||
var createstime = $('#createstime').val();
|
||||
var newpricetime1 = $('#newpricetime1').text();
|
||||
var newpricetime2 = $('#newpricetime2').text();
|
||||
var newpricetime3 = $('#newpricetime3').text();
|
||||
var newpricetime4 = $('#newpricetime4').text();
|
||||
var newpricetime5 = $('#newpricetime5').text();
|
||||
var newprice1 = $('#newprice1').val();
|
||||
var newprice2 = $('#newprice2').val();
|
||||
var newprice3 = $('#newprice3').val();
|
||||
var newprice4 = $('#newprice4').val();
|
||||
var newprice5 = $('#newprice5').val();
|
||||
// console.log(newpricetime1,newpricetime2,newpricetime3,newpricetime4,newpricetime5,
|
||||
// newprice1,newprice2,newprice3,newprice4,newprice5);
|
||||
$.post("app/order/buildPrice", {
|
||||
"symbols": symbols, "zhouqi": zhouqi, "rise_or_falls": rise_or_falls,
|
||||
"prices": prices, "createstime": createstime,'newpricetime1':newpricetime1,'newpricetime2':newpricetime2,
|
||||
'newpricetime3':newpricetime3,'newpricetime4':newpricetime4,'newpricetime5':newpricetime5,'newprice1':newprice1,
|
||||
'newprice2':newprice2,'newprice3':newprice3,'newprice4':newprice4,'newprice5':newprice5,
|
||||
}, function (datas) {
|
||||
alert(datas.msg);
|
||||
});
|
||||
});
|
||||
|
||||
$('#cleanprice').on('click',function() {
|
||||
var r=confirm("确定取消所有调控价格吗?");
|
||||
if (r==true){
|
||||
$.post("app/order/cleanPrice", {}, function (datas) {
|
||||
alert(datas.msg);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
|
||||
},
|
||||
jianting: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/order/jianting' + location.search,
|
||||
table: 'order',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var int=self.setInterval(function () {
|
||||
var params = {silent: true};
|
||||
$('#table').bootstrapTable('refresh', params);
|
||||
},2000);
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'createtimes', title: '操作',formatter: Controller.api.createtime},
|
||||
{field: 'createtime', title: '场次',formatter: Controller.api.createtime,
|
||||
operate:'RANGE', addclass:'datetimerange', autocomplete:false,
|
||||
formatter: Table.api.formatter.datetime},
|
||||
{field: 'ordercount', title: '下单人数', operate:'BETWEEN',searchable:false},
|
||||
{field: 'ordersum', title: '下单总金额',searchable:false},
|
||||
{field: 'risep', title: '涨',searchable:false},
|
||||
{field: 'fallp', title: '跌',searchable:false},
|
||||
{field: 'normalp', title: '低仓',searchable:false},
|
||||
{field: 'middlep', title: '中仓',searchable:false},
|
||||
{field: 'weighestp', title: '重仓',searchable:false},
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
set_yk: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
set_bl: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
createtime: function (value, row, index) {
|
||||
//这里手动构造URL
|
||||
url = "app/order?" + this.field + "=" + value;
|
||||
|
||||
//方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容
|
||||
return '<a href="' + url + '" class="label label-success addtabsit" title="持仓订单管理">查看明细</a>';
|
||||
|
||||
//方式二,直接调用Table.api.formatter.addtabs
|
||||
// return Table.api.formatter.addtabs(value, row, index, url);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// export default socket
|
||||
|
||||
|
||||
return Controller;
|
||||
});
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/user_address/index' + location.search,
|
||||
add_url: 'app/user_address/add',
|
||||
edit_url: 'app/user_address/edit',
|
||||
del_url: 'app/user_address/del',
|
||||
multi_url: 'app/user_address/multi',
|
||||
import_url: 'app/user_address/import',
|
||||
table: 'user_address',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_name', title: '用户'},
|
||||
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'app/user_grade/index' + location.search,
|
||||
add_url: 'app/user_grade/add',
|
||||
edit_url: 'app/user_grade/edit',
|
||||
del_url: 'app/user_grade/del',
|
||||
multi_url: 'app/user_grade/multi',
|
||||
import_url: 'app/user_grade/import',
|
||||
table: 'user_grade',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'name_en', title: '英文名', operate: 'LIKE'},
|
||||
{field: 'children_size', title: __('Children_size')},
|
||||
{field: 'standard_amount', title: __('Standard_amount'), operate:'BETWEEN'},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'auth/admin/index',
|
||||
add_url: 'auth/admin/add',
|
||||
edit_url: 'auth/admin/edit',
|
||||
del_url: 'auth/admin/del',
|
||||
multi_url: 'auth/admin/multi',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
//在表格内容渲染完成后回调的事件
|
||||
table.on('post-body.bs.table', function (e, json) {
|
||||
$("tbody tr[data-index]", this).each(function () {
|
||||
if (parseInt($("td:eq(1)", this).text()) == Config.admin.id) {
|
||||
$("input[type=checkbox]", this).prop("disabled", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'username', title: __('Username')},
|
||||
{field: 'nickname', title: __('Nickname')},
|
||||
{field: 'groups_text', title: __('Group'), operate:false, formatter: Table.api.formatter.label},
|
||||
{field: 'email', title: __('Email')},
|
||||
{field: 'status', title: __("Status"), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
|
||||
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
||||
if(row.id == Config.admin.id){
|
||||
return '';
|
||||
}
|
||||
return Table.api.formatter.operate.call(this, value, row, index);
|
||||
}}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
edit: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'auth/adminlog/index',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
// del_url: 'auth/adminlog/del',
|
||||
multi_url: 'auth/adminlog/multi',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID', operate: false},
|
||||
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索'},
|
||||
{field: 'url', title: __('Url'), formatter: Table.api.formatter.url},
|
||||
{field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search},
|
||||
{field: 'browser', title: __('Browser'), operate: false, formatter: Controller.api.formatter.browser},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [{
|
||||
name: 'detail',
|
||||
text: __('Detail'),
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-info btn-xs btn-detail btn-dialog',
|
||||
url: 'auth/adminlog/detail'
|
||||
}],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {
|
||||
browser: function (value, row, index) {
|
||||
return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+160
@@ -0,0 +1,160 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, undefined) {
|
||||
//读取选中的条目
|
||||
$.jstree.core.prototype.get_all_checked = function (full) {
|
||||
var obj = this.get_selected(), i, j;
|
||||
for (i = 0, j = obj.length; i < j; i++) {
|
||||
obj = obj.concat(this.get_node(obj[i]).parents);
|
||||
}
|
||||
obj = $.grep(obj, function (v, i, a) {
|
||||
return v != '#';
|
||||
});
|
||||
obj = obj.filter(function (itm, i, a) {
|
||||
return i == a.indexOf(itm);
|
||||
});
|
||||
return full ? $.map(obj, $.proxy(function (i) {
|
||||
return this.get_node(i);
|
||||
}, this)) : obj;
|
||||
};
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
"index_url": "auth/group/index",
|
||||
"add_url": "auth/group/add",
|
||||
"edit_url": "auth/group/edit",
|
||||
"del_url": "auth/group/del",
|
||||
"multi_url": "auth/group/multi",
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
//在表格内容渲染完成后回调的事件
|
||||
table.on('post-body.bs.table', function (e, json) {
|
||||
$("tbody tr[data-index]", this).each(function () {
|
||||
if (Config.admin.group_ids.indexOf(parseInt(parseInt($("td:eq(1)", this).text()))) > -1) {
|
||||
$("input[type=checkbox]", this).prop("disabled", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true,},
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'pid', title: __('Parent')},
|
||||
{field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) {
|
||||
return value.toString().replace(/(&|&)nbsp;/g, ' ');
|
||||
}
|
||||
},
|
||||
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||
{
|
||||
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
||||
if (Config.admin.group_ids.indexOf(parseInt(row.id)) > -1) {
|
||||
return '';
|
||||
}
|
||||
return Table.api.formatter.operate.call(this, value, row, index);
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
pagination: false,
|
||||
search: false,
|
||||
commonSearch: false,
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);//当内容渲染完成后
|
||||
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"), null, null, function () {
|
||||
if ($("#treeview").size() > 0) {
|
||||
var r = $("#treeview").jstree("get_all_checked");
|
||||
$("input[name='row[rules]']").val(r.join(','));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
//渲染权限节点树
|
||||
//变更级别后需要重建节点树
|
||||
$(document).on("change", "select[name='row[pid]']", function () {
|
||||
var pid = $(this).data("pid");
|
||||
var id = $(this).data("id");
|
||||
if ($(this).val() == id) {
|
||||
$("option[value='" + pid + "']", this).prop("selected", true).change();
|
||||
Backend.api.toastr.error(__('Can not change the parent to self'));
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
url: "auth/group/roletree",
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id, pid: $(this).val()},
|
||||
success: function (ret) {
|
||||
if (ret.hasOwnProperty("code")) {
|
||||
var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : "";
|
||||
if (ret.code === 1) {
|
||||
//销毁已有的节点树
|
||||
$("#treeview").jstree("destroy");
|
||||
Controller.api.rendertree(data);
|
||||
} else {
|
||||
Backend.api.toastr.error(ret.msg);
|
||||
}
|
||||
}
|
||||
}, error: function (e) {
|
||||
Backend.api.toastr.error(e.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
//全选和展开
|
||||
$(document).on("click", "#checkall", function () {
|
||||
$("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all");
|
||||
});
|
||||
$(document).on("click", "#expandall", function () {
|
||||
$("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all");
|
||||
});
|
||||
$("select[name='row[pid]']").trigger("change");
|
||||
},
|
||||
rendertree: function (content) {
|
||||
$("#treeview")
|
||||
.on('redraw.jstree', function (e) {
|
||||
$(".layer-footer").attr("domrefresh", Math.random());
|
||||
})
|
||||
.jstree({
|
||||
"themes": {"stripes": true},
|
||||
"checkbox": {
|
||||
"keep_selected_style": false,
|
||||
},
|
||||
"types": {
|
||||
"root": {
|
||||
"icon": "fa fa-folder-open",
|
||||
},
|
||||
"menu": {
|
||||
"icon": "fa fa-folder-open",
|
||||
},
|
||||
"file": {
|
||||
"icon": "fa fa-file-o",
|
||||
}
|
||||
},
|
||||
"plugins": ["checkbox", "types"],
|
||||
"core": {
|
||||
'check_callback': true,
|
||||
"data": content
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+199
@@ -0,0 +1,199 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
"index_url": "auth/rule/index",
|
||||
"add_url": "auth/rule/add",
|
||||
"edit_url": "auth/rule/edit",
|
||||
"del_url": "auth/rule/del",
|
||||
"multi_url": "auth/rule/multi",
|
||||
"table": "auth_rule"
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
sortName: '',
|
||||
escape: false,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true,},
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title},
|
||||
{field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon},
|
||||
{field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||
{
|
||||
field: 'ismenu',
|
||||
title: __('Ismenu'),
|
||||
align: 'center',
|
||||
table: table,
|
||||
formatter: Table.api.formatter.toggle
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '<a href="javascript:;" class="btn btn-success btn-xs btn-toggle"><i class="fa fa-chevron-up"></i></a>',
|
||||
operate: false,
|
||||
formatter: Controller.api.formatter.subnode
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
],
|
||||
pagination: false,
|
||||
search: false,
|
||||
commonSearch: false,
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
//表格内容渲染前
|
||||
table.on('pre-body.bs.table', function (e, data) {
|
||||
var options = table.bootstrapTable("getOptions");
|
||||
options.escape = true;
|
||||
});
|
||||
//当内容渲染完成后
|
||||
table.on('post-body.bs.table', function (e, data) {
|
||||
var options = table.bootstrapTable("getOptions");
|
||||
options.escape = false;
|
||||
//默认隐藏所有子节点
|
||||
//$("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide();
|
||||
$(".btn-node-sub.disabled").closest("tr").hide();
|
||||
|
||||
//显示隐藏子节点
|
||||
$(".btn-node-sub").off("click").on("click", function (e) {
|
||||
var status = $(this).data("shown") ? true : false;
|
||||
$("a.btn[data-pid='" + $(this).data("id") + "']").each(function () {
|
||||
$(this).closest("tr").toggle(!status);
|
||||
});
|
||||
$(this).data("shown", !status);
|
||||
return false;
|
||||
});
|
||||
//点击切换/排序/删除操作后刷新左侧菜单
|
||||
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) {
|
||||
if ($(this).hasClass("btn-change")) {
|
||||
var index = $(this).data("index");
|
||||
var row = Table.api.getrowbyindex(table, index);
|
||||
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
|
||||
table.bootstrapTable("updateRow", {index: index, row: row});
|
||||
} else if ($(this).hasClass("btn-delone")) {
|
||||
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
|
||||
$(this).closest("tr[data-index]").remove();
|
||||
} else {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
} else if ($(this).hasClass("btn-dragsort")) {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
Fast.api.refreshmenu();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
//批量删除后的回调
|
||||
$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
|
||||
Fast.api.refreshmenu();
|
||||
});
|
||||
//展开隐藏一级
|
||||
$(document.body).on("click", ".btn-toggle", function (e) {
|
||||
$("a.btn[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
|
||||
var that = this;
|
||||
var show = $("i", that).hasClass("fa-chevron-down");
|
||||
$("i", that).toggleClass("fa-chevron-down", !show);
|
||||
$("i", that).toggleClass("fa-chevron-up", show);
|
||||
$("a.btn[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
|
||||
$(".btn-node-sub[data-pid=0]").data("shown", show);
|
||||
});
|
||||
//展开隐藏全部
|
||||
$(document.body).on("click", ".btn-toggle-all", function (e) {
|
||||
var that = this;
|
||||
var show = $("i", that).hasClass("fa-plus");
|
||||
$("i", that).toggleClass("fa-plus", !show);
|
||||
$("i", that).toggleClass("fa-minus", show);
|
||||
$(".btn-node-sub.disabled").closest("tr").toggle(show);
|
||||
$(".btn-node-sub").data("shown", show);
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
formatter: {
|
||||
title: function (value, row, index) {
|
||||
value = value.toString().replace(/(&|&)nbsp;/g, ' ');
|
||||
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
||||
},
|
||||
name: function (value, row, index) {
|
||||
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
||||
},
|
||||
icon: function (value, row, index) {
|
||||
return '<span class="' + (!row.ismenu || row.status == 'hidden' ? 'text-muted' : '') + '"><i class="' + value + '"></i></span>';
|
||||
},
|
||||
subnode: function (value, row, index) {
|
||||
return '<a href="javascript:;" data-toggle="tooltip" title="' + __('Toggle sub menu') + '" data-id="' + row.id + '" data-pid="' + row.pid + '" class="btn btn-xs '
|
||||
+ (row.haschild == 1 || row.ismenu == 1 ? 'btn-success' : 'btn-default disabled') + ' btn-node-sub"><i class="fa fa-sitemap"></i></a>';
|
||||
}
|
||||
},
|
||||
bindevent: function () {
|
||||
$(document).on('click', "input[name='row[ismenu]']", function () {
|
||||
var name = $("input[name='row[name]']");
|
||||
name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node"));
|
||||
});
|
||||
$("input[name='row[ismenu]']:checked").trigger("click");
|
||||
|
||||
var iconlist = [];
|
||||
var iconfunc = function () {
|
||||
Layer.open({
|
||||
type: 1,
|
||||
area: ['99%', '98%'], //宽高
|
||||
content: Template('chooseicontpl', {iconlist: iconlist})
|
||||
});
|
||||
};
|
||||
Form.api.bindevent($("form[role=form]"), function (data) {
|
||||
Fast.api.refreshmenu();
|
||||
});
|
||||
$(document).on('click', ".btn-search-icon", function () {
|
||||
if (iconlist.length == 0) {
|
||||
$.get(Config.site.cdnurl + "/assets/libs/font-awesome/less/variables.less", function (ret) {
|
||||
var exp = /fa-var-(.*):/ig;
|
||||
var result;
|
||||
while ((result = exp.exec(ret)) != null) {
|
||||
iconlist.push(result[1]);
|
||||
}
|
||||
iconfunc();
|
||||
});
|
||||
} else {
|
||||
iconfunc();
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#chooseicon ul li', function () {
|
||||
$("input[name='row[icon]']").val('fa fa-' + $(this).data("font"));
|
||||
Layer.closeAll();
|
||||
});
|
||||
$(document).on('keyup', 'input.js-icon-search', function () {
|
||||
$("#chooseicon ul li").show();
|
||||
if ($(this).val() != '') {
|
||||
$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+320
@@ -0,0 +1,320 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'form', 'template', 'loading'], function($, undefined, Backend, Form, Template, Loading) {
|
||||
var Controller = {
|
||||
index: function() {
|
||||
Controller.api.events.toolbar();
|
||||
Controller.init.table();
|
||||
},
|
||||
add: function() {
|
||||
Controller.init.selectpicker();
|
||||
Controller.api.form();
|
||||
},
|
||||
edit: function() {
|
||||
Controller.init.selectpicker(true);
|
||||
Controller.api.form();
|
||||
},
|
||||
init: {
|
||||
selectpicker: function(disabled = false) {
|
||||
$('#sType').on('loaded.bs.select , changed.bs.select', function(e, clickedIndex, isSelected, previousValue) {
|
||||
var id = $('#id').val();
|
||||
var sType = $(this).selectpicker('val');
|
||||
$('#sTypeDom').hide();
|
||||
$('.rememory').hide();
|
||||
$('.urladdress').hide();
|
||||
$('.sbody').hide();
|
||||
switch (sType) {
|
||||
case 'toShell':
|
||||
$('.sbody').show().find('textarea').attr('placeholder', '');
|
||||
$('#sBodyTitle').html('脚本内容:');
|
||||
break;
|
||||
case 'site':
|
||||
Controller.init.toBackup(sType);
|
||||
$('.sbody').show().find('textarea').attr('placeholder', '每行一条规则,目录不能以/结尾,示例:\ndata/config.php\nstatic/upload\n *.log\n').text();
|
||||
$('#sBodyTitle').html('排除规则:');
|
||||
break;
|
||||
case 'database':
|
||||
Controller.init.toBackup(sType);
|
||||
break;
|
||||
case 'logs':
|
||||
Controller.init.toBackup(sType);
|
||||
break;
|
||||
case 'path':
|
||||
Controller.init.toBackup(sType);
|
||||
$('.sbody').show().find('textarea').attr('placeholder', '每行一条规则,目录不能以/结尾,示例:\ndata/config.php\nstatic/upload\n *.log\n').text();
|
||||
$('#sBodyTitle').html('排除规则:');
|
||||
break;
|
||||
case 'rememory':
|
||||
$('.rememory').show();
|
||||
break;
|
||||
case 'toUrl':
|
||||
$('.urladdress').show();
|
||||
break;
|
||||
case 'syncTime':
|
||||
$(this).selectpicker('val', 'toShell');
|
||||
$(this).selectpicker('refresh');
|
||||
$('.sbody').show().find('textarea').text('echo "|-正在尝试从0.pool.bt.cn同步时间..";\n\
|
||||
ntpdate -u 0.pool.bt.cn\n\
|
||||
if [ $? = 1 ];then\n\
|
||||
echo "|-正在尝试从1.pool.bt.cn同步时间..";\n\
|
||||
ntpdate -u 1.pool.bt.cn\n\
|
||||
fi\n\
|
||||
if [ $? = 1 ];then\n\
|
||||
echo "|-正在尝试从0.asia.pool.ntp.org同步时间..";\n\
|
||||
ntpdate -u 0.asia.pool.ntp.org\n\
|
||||
fi\n\
|
||||
if [ $? = 1 ];then\n\
|
||||
echo "|-正在尝试从www.bt.cn同步时间..";\n\
|
||||
getBtTime=$(curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/index/get_time)\n\
|
||||
if [ "${getBtTime}" ];then \n\
|
||||
date -s "$(date -d @$getBtTime +"%Y-%m-%d %H:%M:%S")"\n\
|
||||
fi\n\
|
||||
fi\n\
|
||||
echo "|-正在尝试将当前系统时间写入硬件..";\n\
|
||||
hwclock -w\n\
|
||||
date\n\
|
||||
echo "|-时间同步完成!";');
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
if (disabled) {
|
||||
$(this).prop('disabled', true);
|
||||
$(this).selectpicker('refresh');
|
||||
}
|
||||
});
|
||||
$('#type').on('loaded.bs.select , changed.bs.select', function(e, clickedIndex, isSelected, previousValue) {
|
||||
var type = $(this).selectpicker('val');
|
||||
$('#whereDom').html(Template(type + "-tpl", {}));
|
||||
if (type == 'week') $('#whereDom').find('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
},
|
||||
toBackup: function(sType = '') {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getDataList",
|
||||
data: { type: sType == 'database' ? 'databases' : 'sites' },
|
||||
dataType: "JSON",
|
||||
success: function(res) {
|
||||
res.data.unshift({ name: '所有', ps: 'ALL' });
|
||||
res.orderOpt.unshift({ name: '服务器磁盘', value: 'localhost' });
|
||||
res.title = Config.crontab['sTypeArray'][sType];
|
||||
var html;
|
||||
if (sType == 'path') {
|
||||
html = Template("sTypePathTpl", res);
|
||||
} else {
|
||||
html = Template("sTypeSiteTpl", res);
|
||||
}
|
||||
$('#sTypeDom').html(html);
|
||||
$('#sTypeDom').show();
|
||||
$('#sTypeDom').find('.selectpicker').selectpicker('refresh');
|
||||
}
|
||||
});
|
||||
},
|
||||
table: function() {
|
||||
$('table').loading();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getCrontab",
|
||||
dataType: "JSON",
|
||||
success: function(rdata) {
|
||||
if (rdata == []) {
|
||||
$('table').loading('hide');
|
||||
var html = Template("<tr><td colspan='6'>暂无数据</td></tr>", {});
|
||||
$('#table-crontab').html(html);
|
||||
} else {
|
||||
$.post('btpanel/ajax/getDataList', {}, function(res) {
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
for (var j = 0; j < res.orderOpt.length; j++) {
|
||||
if (rdata[i].backupTo == 'localhost') {
|
||||
rdata[i].backupTo = '本地磁盘';
|
||||
} else if (rdata[i].backupTo == res.orderOpt[j].value) {
|
||||
rdata[i].backupTo = res.orderOpt[j].name;
|
||||
} else if (rdata[i].backupTo == '') {
|
||||
rdata[i].backupTo = ''
|
||||
}
|
||||
}
|
||||
var arrs = ['site', 'database', 'path'];
|
||||
if ($.inArray(rdata[i].sType, arrs) == -1) rdata[i].backupTo = "--";
|
||||
}
|
||||
$('table').loading('hide');
|
||||
var html = Template('crontabtpl', { data: rdata });
|
||||
$('#table-crontab').html(html);
|
||||
//绑定各种事件
|
||||
Controller.api.events.startTask();
|
||||
Controller.api.events.getLogs();
|
||||
Controller.api.events.delCrontab();
|
||||
Controller.api.events.getCrontabFind();
|
||||
Controller.api.events.setTaskStatus();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
api: {
|
||||
events: {
|
||||
delCrontab: function() {
|
||||
$('.btn-del').click(function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var title = $(this).parent().siblings('td[data-field="name"]').html();
|
||||
var confirm = Layer.confirm('是否要删除【' + title + '】?', { title: '提示', icon: 3 }, function(index) {
|
||||
if (index > 0) {
|
||||
var loadT = Layer.msg('正在删除,请稍后...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('btpanel/ajax/delCrontab', { id: id }, function(rdata) {
|
||||
Layer.closeAll();
|
||||
Layer.close(confirm);
|
||||
Layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
if (rdata.status) Controller.init.table();
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
toolbar: function() {
|
||||
$('.btn-refresh').click(function() {
|
||||
Controller.init.table();
|
||||
})
|
||||
$('.btn-add').click(function() {
|
||||
Fast.api.open('btpanel/crontab/add?', '新增定时任务', {
|
||||
callback: function(data) {
|
||||
Controller.init.table();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 编辑计划任务
|
||||
getCrontabFind: function() {
|
||||
$('.btn-edit').click(function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var title = $(this).parent().siblings('td[data-field="name"]').html();
|
||||
Fast.api.open('btpanel/crontab/edit?id=' + id, '【' + title + '】编辑', {
|
||||
callback: function(data) {
|
||||
Controller.init.table();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
//执行任务脚本
|
||||
startTask: function() {
|
||||
$('.btn-StartTask').click(function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var title = $(this).parent().siblings('td[data-field="name"]').html();
|
||||
var confirm = Layer.confirm('是否要立即执行【' + title + '】?', { title: '提示', icon: 3 }, function(index) {
|
||||
if (index > 0) {
|
||||
var loadT = Layer.msg('正在执行,请稍后...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('btpanel/ajax/startTask', { id: id }, function(rdata) {
|
||||
Layer.closeAll();
|
||||
Layer.close(confirm);
|
||||
Layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getLogs: function() {
|
||||
$('.btn-GetLogs').click(function() {
|
||||
$('table').loading();
|
||||
var id = $(this).parent().data('id');
|
||||
var title = $(this).parent().siblings('td[data-field="name"]').html();
|
||||
$.post('btpanel/ajax/GetLogs', { id: id, type: 'crontab' }, function(rdata) {
|
||||
$('table').loading('hide');
|
||||
if (!rdata.status) {
|
||||
Layer.msg(rdata.msg, { icon: 2 });
|
||||
return;
|
||||
};
|
||||
Layer.open({
|
||||
id: 'logs',
|
||||
type: 1,
|
||||
title: '【' + title + '】日志',
|
||||
shadeClose: false,
|
||||
btn: ['清空', '关闭'],
|
||||
yes: function(index, layero) {
|
||||
var confirm = Layer.confirm('是否要清空【' + title + '】的日志?', { title: '提示', icon: 3 }, function(index) {
|
||||
if (index > 0) {
|
||||
var loadT = Layer.msg('正在执行,请稍后...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('btpanel/ajax/delLogs', { id: id }, function(rdata) {
|
||||
Layer.closeAll();
|
||||
Layer.close(confirm);
|
||||
Layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
area: ['800px', '600px'], //宽高
|
||||
content: '<pre id="editor" style="overflow: auto; border: 0px none; line-height:23px;padding: 15px; margin: 0px; white-space: pre-wrap; height: 558px; background-color: rgb(51,51,51);color:#f1f1f1;border-radius:0px;font-family: \"微软雅黑\"">' + (rdata.msg == '' ? '当前日志为空' : rdata.msg) + '</pre>',
|
||||
success: function() {
|
||||
var scrollHeight = $('#editor').prop("scrollHeight");
|
||||
$('#editor').animate({ scrollTop: scrollHeight }, 200);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
},
|
||||
setTaskStatus: function() {
|
||||
$('.set_task_status').off('click').on('click', function() {
|
||||
var id = $(this).data('id');
|
||||
var status = $(this).children('span').data('status');
|
||||
var title = $(this).parent().siblings('td[data-field="name"]').html();
|
||||
var confirm = Layer.confirm(status == '0' ? '计划任务暂停后将无法继续运行,您真的要停用【' + title + '】吗?' : '该计划任务已停用,是否要启用【' + title + '】', { title: '提示', icon: 3 }, function(index) {
|
||||
if (index > 0) {
|
||||
var loadT = Layer.msg('正在设置状态,请稍后...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('btpanel/ajax/setCronStatus', { id: id }, function(rdata) {
|
||||
Layer.closeAll();
|
||||
Layer.close(confirm);
|
||||
Layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
if (rdata.status) Controller.init.table();
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
form: function() {
|
||||
Form.api.bindevent($("form[role=form]"), null, null, function(success, error) {
|
||||
var form = {
|
||||
id: '',
|
||||
name: '',
|
||||
type: '',
|
||||
where1: '',
|
||||
hour: '',
|
||||
minute: '',
|
||||
week: '',
|
||||
sType: '',
|
||||
sBody: '',
|
||||
sName: '',
|
||||
backupTo: '',
|
||||
save: '',
|
||||
urladdress: '',
|
||||
}
|
||||
$('input[class="form-control"],textarea[class="form-control"],select[class="form-control selectpicker"]').each(function(i, element) {
|
||||
element == this
|
||||
var name = $(element).attr('name');
|
||||
var value = $(element).val();
|
||||
if (form.hasOwnProperty(name)) {
|
||||
form[name] = value;
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: $(this).attr('action'),
|
||||
data: form,
|
||||
dataType: "JSON",
|
||||
success: function(ret) {
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
parent.Layer.close(index);
|
||||
parent.Layer.msg(ret.msg, { icon: ret.status ? 1 : 2 });
|
||||
Fast.api.close(ret)
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+412
@@ -0,0 +1,412 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'echarts', 'template', 'knob','loading'], function($, undefined, Backend, Form, Table, Echarts, Template,Loading) {
|
||||
var network, isInit = true;
|
||||
var rate = 2000;
|
||||
var lineChart = [];
|
||||
var Controller = {
|
||||
index: function() {
|
||||
Controller.init.knob();
|
||||
Controller.init.table();
|
||||
$(document).loading();
|
||||
var height = $('.panel-ServerInfo .panel-body').height()-65;
|
||||
$('.panel-liveLine .tab-pane').height(height + 'px');
|
||||
/* shown.bs.tab为tab选项卡高亮 */
|
||||
$('#liveLine a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
||||
lineChart[$(this).data('chart')].resize();
|
||||
});
|
||||
Controller.module.net.chart.init(height - $('#net-info').height()-10);
|
||||
Controller.module.cpu.chart.init(height);
|
||||
setInterval(function() {
|
||||
$.ajax({
|
||||
type: "Post",
|
||||
url: "btpanel/ajax/getNetWork",
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
network = res;
|
||||
Controller.module.cpu.value(res.cpu);
|
||||
Controller.module.load.value(res.load);
|
||||
Controller.module.memory.value(res.mem);
|
||||
Controller.module.disk.value(res.disk);
|
||||
Controller.module.net.value(res.up, res.down, res.upTotal, res.downTotal);
|
||||
if (isInit) {
|
||||
isInit = false;
|
||||
$(document).loading('hide');
|
||||
Controller.init.event();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, rate);
|
||||
},
|
||||
init: {
|
||||
table: function() {
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'btpanel/ajax/getSiteData',
|
||||
pk: 'id',
|
||||
sort:'id',
|
||||
pagination: false,
|
||||
columns: [
|
||||
[
|
||||
{ field: 'id', title: 'ID'},
|
||||
{ field: 'name', title: '网站名',formatter: Controller.api.table.formatter.name},
|
||||
{ field: 'path', title: '根目录' },
|
||||
{ field: 'backup_count', title: '备份' },
|
||||
{ field: 'addtime', title: '创建时间' },
|
||||
{ field: 'edate', title: '到期时间' },
|
||||
{ field: 'status', title: '状态', formatter: Controller.api.table.formatter.status },
|
||||
{ field: 'ps', title: '备注' }
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
$('#siteType').change(function (e) {
|
||||
e.preventDefault();
|
||||
table.bootstrapTable('refresh',{
|
||||
url: 'btpanel/index/getSiteData?type='+$('#siteType option:selected').val()
|
||||
});
|
||||
});
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
knob: function() {
|
||||
$(".knob").knob({
|
||||
'fgColor': "#3c8dbc",
|
||||
'readOnly': true,
|
||||
'step': 0.1,
|
||||
'height': '100px',
|
||||
format: function(v) {
|
||||
return v + '%';
|
||||
},
|
||||
release: function(v) {
|
||||
$('.knob').attr('type', 'text');
|
||||
}
|
||||
});
|
||||
},
|
||||
event: function() {
|
||||
Controller.module.cpu.hover();
|
||||
Controller.module.load.hover();
|
||||
Controller.module.memory.hover();
|
||||
Controller.module.disk.hover();
|
||||
}
|
||||
},
|
||||
module: {
|
||||
cpu: {
|
||||
value: function(data) {
|
||||
$('.knob-cpu').val(data[0]).trigger('change');
|
||||
Controller.api.echarts.addData(lineChart['cpu'], [data[0]]);
|
||||
},
|
||||
hover: function(data) {
|
||||
$('#panel-cpu').hover(function() {
|
||||
var d = network.cpu;
|
||||
if (d) {
|
||||
var _this = $(this);
|
||||
var crs = '';
|
||||
var n1 = 0;
|
||||
for (var i = 0; i < d[2].length; i++) {
|
||||
n1++;
|
||||
crs += 'CPU-' + i + ": " + d[2][i] + '%' + (n1 % 2 == 0 ? '</br>' : ' | ');
|
||||
}
|
||||
layer.tips(d[3] + "</br>" + d[5] + "个物理CPU," + (d[5] * d[4]) + "个物理核心," + d[1] + "线程</br>" + crs, _this.find('.knob-cpu'), { time: 0, tips: [3, '#999'] });
|
||||
}
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
});
|
||||
},
|
||||
chart: {
|
||||
init: function(height) {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
$('#chart-cpu').height(height)
|
||||
var Chart = Echarts.init(document.getElementById('chart-cpu'), 'walden');
|
||||
var obj = {};
|
||||
obj.dataZoom = [];
|
||||
obj.unit = '百分比';
|
||||
obj.dataset = {
|
||||
dimensions: ['时间', 'CPU'],
|
||||
source: []
|
||||
};
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: '#52a9ff' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
lineChart['cpu'] = Chart;
|
||||
return Chart;
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
load: {
|
||||
value: function(data) {
|
||||
var _lval = Math.round((data.one / data.max) * 100);
|
||||
if (_lval > 100) _lval = 100;
|
||||
$('.knob-load').val(_lval).trigger('change');
|
||||
},
|
||||
hover: function() {
|
||||
$('#panel-load').hover(function() {
|
||||
var _this = $(this);
|
||||
var d = network.load;
|
||||
layer.tips('最近1分钟平均负载:' + d.one + '</br>最近5分钟平均负载:' + d.five + '</br>最近15分钟平均负载:' + d.fifteen + '', _this.find('.knob-load'), { time: 0, tips: [3, '#999'] });
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
})
|
||||
}
|
||||
},
|
||||
memory: {
|
||||
value: function(data) {
|
||||
var _memory = (data.memRealUsed * 100 / data.memTotal).toFixed(1)
|
||||
$('.knob-memory').val(_memory).trigger('change');
|
||||
},
|
||||
hover: function() {
|
||||
$('#panel-memory').hover(function() {
|
||||
var _this = $(this);
|
||||
var d = network.mem;
|
||||
var tips = '总大小:' + d.memTotal + '<br>' +
|
||||
'可用的物理内存: ' + d.memFree + ' MB<br>' +
|
||||
'已使用的物理内存: ' + d.memRealUsed + ' MB<br>' +
|
||||
'缓存化内存: ' + d.memCached + ' MB<br>' +
|
||||
'系统缓冲: ' + d.memBuffers + ' MB';
|
||||
layer.tips(tips, _this.find('.knob-memory'), { time: 0, tips: [3, '#999'] });
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
})
|
||||
}
|
||||
},
|
||||
disk: {
|
||||
value: function(data) {
|
||||
if (data.length > 0) {
|
||||
var size = data[0].size[3];
|
||||
$('.knob-disk').val(size.replace('%', '')).trigger('change');
|
||||
}
|
||||
},
|
||||
hover: function() {
|
||||
$('#panel-disk').hover(function() {
|
||||
var _this = $(this);
|
||||
var d = network.disk;
|
||||
var tips = '';
|
||||
$.each(d, function(index, item) {
|
||||
tips += '<b>基础信息</b><br>' +
|
||||
'文件系统:' + item.filesystem + '<br>' +
|
||||
'类型:' + item.type + '<br>' +
|
||||
'挂载点:' + item.path + '<br>' +
|
||||
'<b>Inode信息</b><br>' +
|
||||
'总数:' + item.inodes[0] + '<br>' +
|
||||
'已用:' + item.inodes[1] + '<br>' +
|
||||
'可用:' + item.inodes[2] + '<br>' +
|
||||
'Inode使用率:' + item.inodes[3] + '<br>' +
|
||||
'<b>容量信息</b><br>' +
|
||||
'容量:' + item.size[0] + '<br>' +
|
||||
'已用:' + item.size[1] + '<br>' +
|
||||
'可用:' + item.size[2] + '<br>' +
|
||||
'使用率:' + item.size[3];
|
||||
});
|
||||
layer.tips(tips, _this.find('.knob-disk'), { time: 0, tips: [3, '#999'] });
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
})
|
||||
}
|
||||
},
|
||||
net: {
|
||||
value: function(up, down, upTotal, downTotal) {
|
||||
$('#upSpeed').html(up + ' KB');
|
||||
$('#downSpeed').html(down + ' KB');
|
||||
$('#upAll').html(Controller.api.formatBytes(upTotal, 2));
|
||||
$('#downAll').html(Controller.api.formatBytes(downTotal, 2));
|
||||
Controller.api.echarts.addData(lineChart['net'], [up, down]);
|
||||
},
|
||||
chart: {
|
||||
init: function(height) {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
$('#chart-net').height(height)
|
||||
var Chart = Echarts.init(document.getElementById('chart-net'), 'walden');
|
||||
var obj = {};
|
||||
obj.dataZoom = [];
|
||||
obj.unit = '单位:KB/s';
|
||||
obj.dataset = {
|
||||
dimensions: ['时间', '上行', '下行'],
|
||||
source: []
|
||||
};
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: '#f7b851' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}, {
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: '#52a9ff' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
lineChart['net'] = Chart;
|
||||
return Chart;
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
api: {
|
||||
echarts: {
|
||||
getOptions(obj) {
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
},
|
||||
formatter: obj.formatter
|
||||
},
|
||||
dataset: obj.dataset,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#666"
|
||||
}
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '10%',
|
||||
top: '10%'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: obj.unit,
|
||||
boundaryGap: [0, '100%'],
|
||||
min: 0,
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "#ddd"
|
||||
}
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#666"
|
||||
}
|
||||
}
|
||||
},
|
||||
dataZoom: [{
|
||||
type: 'inside',
|
||||
start: 0,
|
||||
zoomLock: true
|
||||
}, {
|
||||
start: 0,
|
||||
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
||||
handleSize: '80%',
|
||||
handleStyle: {
|
||||
color: '#fff',
|
||||
shadowBlur: 3,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.6)',
|
||||
shadowOffsetX: 2,
|
||||
shadowOffsetY: 2
|
||||
}
|
||||
}],
|
||||
series: []
|
||||
};
|
||||
if (obj.legend) option.legend = obj.legend;
|
||||
if (obj.dataZoom) option.dataZoom = obj.dataZoom;
|
||||
|
||||
for (var i = 0; i < obj.series.length; i++) {
|
||||
var item = obj.series[i];
|
||||
var series = {
|
||||
type: item.type ? item.type : 'line',
|
||||
smooth: item.smooth ? item.smooth : true,
|
||||
symbol: item.symbol ? item.symbol : 'none',
|
||||
showSymbol: item.showSymbol ? item.showSymbol : false,
|
||||
sampling: item.sampling ? item.sampling : 'average',
|
||||
areaStyle: item.areaStyle ? item.areaStyle : {},
|
||||
lineStyle: item.lineStyle ? item.lineStyle : {},
|
||||
itemStyle: item.itemStyle ? item.itemStyle : { normal: { color: 'rgb(0, 153, 238)' } },
|
||||
symbolSize: 6,
|
||||
symbol: 'none'
|
||||
}
|
||||
option.series.push(series);
|
||||
}
|
||||
return option;
|
||||
},
|
||||
addData: function(chart, arr, limit = 300) {
|
||||
var option = chart.getOption();
|
||||
var data = option.dataset[0].source;
|
||||
var now = new Date();
|
||||
var time = [now.getHours(), now.getMinutes() + 1, now.getSeconds()].join(':');
|
||||
var newData = [time];
|
||||
newData = newData.concat(arr)
|
||||
data.push(newData);
|
||||
if (limit && data.length > limit / (rate / 1000)) {
|
||||
data.shift();
|
||||
}
|
||||
chart.setOption({
|
||||
dataset: {
|
||||
source: data
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
table: {
|
||||
formatter: {
|
||||
name: function(value, row, index) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getWebSiteDomain",
|
||||
data: {
|
||||
id:row.id
|
||||
},
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
$.each(res, function (i, domain) {
|
||||
if(document.domain == domain.name){
|
||||
value = domain.name+' <span class="label label-success">当前站点</span>';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return value
|
||||
},
|
||||
status: function(value, row, index) {
|
||||
var color = value == '1' ? 'text-green' : 'text-red';
|
||||
var icon = value == '1' ? 'fa-play' : 'fa-pause';
|
||||
var text = value == '1' ? '运行中' : '已停止';
|
||||
return "<span class="+color+">"+text+"<i class='fa fa-fw " + icon + "'></i></span>"
|
||||
}
|
||||
}
|
||||
},
|
||||
formatBytes: function(a, b) {
|
||||
if (0 == a) return "0 Bytes";
|
||||
var c = 1024,
|
||||
d = b || 2,
|
||||
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
||||
f = Math.floor(Math.log(a) / Math.log(c));
|
||||
return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f]
|
||||
},
|
||||
bindevent: function() {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'template'], function($, undefined, Backend, Template) {
|
||||
var Controller = {
|
||||
index: function() {
|
||||
window.navPages = function(page){
|
||||
Controller.init.table(page);
|
||||
};
|
||||
Controller.init.table(1);
|
||||
Controller.api.events.panelErrorLogs();
|
||||
},
|
||||
init:{
|
||||
table: function(page) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getLogs",
|
||||
data: {
|
||||
limit:20,
|
||||
p:page,
|
||||
tojs:$('#table-page').data('events')
|
||||
},
|
||||
dataType: "JSON",
|
||||
success: function (res) {
|
||||
var html = Template('logstpl', res);
|
||||
$('#table-logs').html(html);
|
||||
$('#table-page').html(res.page);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
api: {
|
||||
events:{
|
||||
panelErrorLogs:function(){
|
||||
$('.label-run-logs').click(function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getPanelErrorLogs",
|
||||
dataType: "JSON",
|
||||
success: function (res) {
|
||||
Layer.open({
|
||||
type: 1,
|
||||
title:false,
|
||||
area: ['800px', '600px'], //宽高
|
||||
content: '<pre id="editor" style="overflow: auto; border: 0px none; line-height:23px;padding: 15px; margin: 0px; white-space: pre-wrap; height: 600px; background-color: rgb(51,51,51);color:#f1f1f1;border-radius:0px;font-family: \"微软雅黑\"">' + (res.msg == '' ? '当前日志为空' : res.msg) + '</pre>'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+647
@@ -0,0 +1,647 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'echarts', 'template'], function($, undefined, Backend, Echarts, Template) {
|
||||
var chart = [];
|
||||
var Controller = {
|
||||
index: function() {
|
||||
if (!Config.SetControl.status) {
|
||||
Layer.confirm('检测到宝塔面板没有开启监控,是否立即开启?', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
btn: ['立即开启', '暂不开启'] //可以无限个按钮
|
||||
}, function(index, layero) {
|
||||
Layer.close(index);
|
||||
Layer.prompt({
|
||||
value: Config.SetControl.day,
|
||||
title: '保存天数'
|
||||
}, function(value, index, elem){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/setControl",
|
||||
data: {
|
||||
type:1,
|
||||
day:value
|
||||
},
|
||||
dataType: "JSON",
|
||||
success: function(res) {
|
||||
Layer.msg(res.msg)
|
||||
Layer.close(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//默认查询时间为今天
|
||||
$('.chart-line').data('start', Moment().startOf('day').unix());
|
||||
$('.chart-line').data('end', Moment().endOf('day').unix());
|
||||
Controller.api.echarts.init();
|
||||
Controller.api.daterangepicker();
|
||||
},
|
||||
module: {
|
||||
cpu: {
|
||||
init: function(data) {
|
||||
var Chart = Echarts.init(document.getElementById('chart-cpu'), 'walden');
|
||||
var obj = {};
|
||||
obj.unit = '百分比';
|
||||
obj.dataset = {
|
||||
dimensions: ['addtime', 'pro'],
|
||||
source: data
|
||||
};
|
||||
obj.formatter = function(params) {
|
||||
return params[0].value.addtime + '<br>CPU:' + params[0].value.pro + '%';
|
||||
}
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: '#52a9ff' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
chart['chart-cpu'] = Chart;
|
||||
return Chart;
|
||||
}
|
||||
},
|
||||
load: {
|
||||
init: function(data) {
|
||||
var Chart = Echarts.init(document.getElementById('chart-load'), 'walden');
|
||||
var option = {
|
||||
animation: false,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
},
|
||||
formatter: function(params) {
|
||||
return params[0].value.addtime + '<br>1分钟:' + params[0].value.one + '<br>5分钟:' + params[0].value.five + '<br>15分钟:' + params[0].value.fifteen + '<br>资源使用率:' + params[0].value.pro + '%';
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['one', 'five', 'fifteen'],
|
||||
right: '16%',
|
||||
top: '10px',
|
||||
formatter: function(name) {
|
||||
switch (name) {
|
||||
case 'one':
|
||||
name = '1分钟'
|
||||
break;
|
||||
case 'five':
|
||||
name = '5分钟'
|
||||
break;
|
||||
case 'fifteen':
|
||||
name = '15分钟'
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
},
|
||||
axisPointer: {
|
||||
link: { xAxisIndex: 'all' },
|
||||
lineStyle: {
|
||||
color: '#aaaa',
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
dataset: [{
|
||||
dimensions: ['addtime', 'pro', 'one', 'five', 'fifteen'],
|
||||
source: data
|
||||
}],
|
||||
grid: [{ // 直角坐标系内绘图网格
|
||||
top: '10%',
|
||||
left: '2%',
|
||||
right: '55%',
|
||||
width: '45%',
|
||||
height: 'auto'
|
||||
},
|
||||
{
|
||||
top: '10%',
|
||||
left: '54%',
|
||||
width: '44%',
|
||||
height: 'auto'
|
||||
}
|
||||
],
|
||||
xAxis: [{ // 直角坐标系grid的x轴
|
||||
type: 'category',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#666'
|
||||
}
|
||||
},
|
||||
},
|
||||
{ // 直角坐标系grid的x轴
|
||||
type: 'category',
|
||||
gridIndex: 1,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#666'
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [{
|
||||
scale: true,
|
||||
name: '资源使用率%',
|
||||
splitLine: { // y轴网格显示
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "#ddd"
|
||||
}
|
||||
},
|
||||
nameTextStyle: { // 坐标轴名样式
|
||||
color: '#666',
|
||||
fontSize: 12,
|
||||
align: 'left'
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#666',
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
scale: true,
|
||||
name: '负载详情',
|
||||
gridIndex: 1,
|
||||
splitLine: { // y轴网格显示
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: "#ddd"
|
||||
}
|
||||
},
|
||||
nameTextStyle: { // 坐标轴名样式
|
||||
color: '#666',
|
||||
fontSize: 12,
|
||||
align: 'left'
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#666',
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
dataZoom: [{
|
||||
type: 'inside',
|
||||
start: 0,
|
||||
end: 100,
|
||||
xAxisIndex: [0, 1],
|
||||
zoomLock: true
|
||||
}, {
|
||||
xAxisIndex: [0, 1],
|
||||
type: 'slider',
|
||||
start: 0,
|
||||
end: 100,
|
||||
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
||||
handleSize: '100%',
|
||||
handleStyle: {
|
||||
color: '#fff',
|
||||
shadowBlur: 3,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.6)',
|
||||
shadowOffsetX: 2,
|
||||
shadowOffsetY: 2
|
||||
},
|
||||
left: '2%',
|
||||
right: '2%'
|
||||
}],
|
||||
series: [{
|
||||
name: 'pro',
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 2,
|
||||
color: 'rgb(255, 140, 0)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(255, 140, 0)'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
xAxisIndex: 1,
|
||||
yAxisIndex: 1,
|
||||
name: 'one',
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 2,
|
||||
color: 'rgb(30, 144, 255)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(30, 144, 255)'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
xAxisIndex: 1,
|
||||
yAxisIndex: 1,
|
||||
name: 'five',
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 2,
|
||||
color: 'rgb(0, 178, 45)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(0, 178, 45)'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
xAxisIndex: 1,
|
||||
yAxisIndex: 1,
|
||||
name: 'fifteen',
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 2,
|
||||
color: 'rgb(147, 38, 255)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(147, 38, 255)'
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
],
|
||||
textStyle: {
|
||||
color: '#666',
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
chart['chart-load'] = Chart;
|
||||
return Chart;
|
||||
}
|
||||
},
|
||||
memory: {
|
||||
init: function(data) {
|
||||
var Chart = Echarts.init(document.getElementById('chart-memory'), 'walden');
|
||||
var obj = {};
|
||||
obj.unit = '百分比';
|
||||
obj.dataset = {
|
||||
dimensions: ['addtime', 'mem'],
|
||||
source: data
|
||||
};
|
||||
obj.formatter = function(params) {
|
||||
return params[0].value.addtime + '<br>内存:' + params[0].value.mem + '%';
|
||||
}
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: '#52a9ff' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
chart['chart-memory'] = Chart;
|
||||
return Chart;
|
||||
}
|
||||
},
|
||||
disk: {
|
||||
init: function(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
data[i].read_bytes = (data[i].read_bytes / 1024 / 60).toFixed(3);
|
||||
data[i].write_bytes = (data[i].write_bytes / 1024 / 60).toFixed(3);
|
||||
}
|
||||
var Chart = Echarts.init(document.getElementById('chart-disk'), 'walden');
|
||||
var obj = {};
|
||||
obj.unit = '单位:KB/s';
|
||||
obj.dataset = {
|
||||
dimensions: ['addtime', 'write_bytes', 'read_bytes'],
|
||||
source: data
|
||||
};
|
||||
obj.legend = {
|
||||
data: ['write_bytes', 'read_bytes'],
|
||||
formatter: function(name) {
|
||||
switch (name) {
|
||||
case 'write_bytes':
|
||||
name = '写入字节数'
|
||||
break;
|
||||
case 'read_bytes':
|
||||
name = '读取字节数'
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
obj.formatter = function(params) {
|
||||
return params[0].value.addtime + '<br>读取字节数:' + params[0].value.read_bytes + 'kb/s<br>写入字节数:' + params[0].value.write_bytes + 'kb/s';
|
||||
}
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: 'rgb(255, 70, 131)' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}, {
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: 'rgb(46, 165, 186)' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
chart['chart-disk'] = Chart;
|
||||
return Chart;
|
||||
}
|
||||
},
|
||||
net: {
|
||||
init: function(data) {
|
||||
var Chart = Echarts.init(document.getElementById('chart-net'), 'walden');
|
||||
var obj = {};
|
||||
obj.unit = '单位:KB/s';
|
||||
obj.dataset = {
|
||||
dimensions: ['addtime', 'up', 'down'],
|
||||
source: data
|
||||
};
|
||||
obj.legend = {
|
||||
data: ['up', 'down'],
|
||||
formatter: function(name) {
|
||||
switch (name) {
|
||||
case 'up':
|
||||
name = '上行'
|
||||
break;
|
||||
case 'down':
|
||||
name = '下行'
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
obj.formatter = function(params) {
|
||||
return params[0].value.addtime + '<br>上行:' + params[0].value.up + 'kb/s<br>下行:' + params[0].value.down + 'kb/s';
|
||||
}
|
||||
obj.series = [{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: 'rgb(255, 70, 131)' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}, {
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { normal: { width: 1, color: '#aaa' } },
|
||||
itemStyle: { normal: { color: 'rgb(46, 165, 186)' } },
|
||||
areaStyle: { opacity: 0.5 }
|
||||
}];
|
||||
var option = Controller.api.echarts.getOptions(obj);
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
Chart.setOption(option);
|
||||
$(window).resize(function() {
|
||||
Chart.resize();
|
||||
});
|
||||
chart['chart-net'] = Chart;
|
||||
return Chart;
|
||||
}
|
||||
}
|
||||
},
|
||||
api: {
|
||||
echarts: {
|
||||
init() {
|
||||
$('.chart-line').each(function(index, element) {
|
||||
element == this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getMonitorData",
|
||||
data: $(element).data(),
|
||||
dataType: "JSON",
|
||||
success: function(res) {
|
||||
switch ($(element).attr('id')) {
|
||||
case 'chart-load':
|
||||
Controller.module.load.init(res);
|
||||
break;
|
||||
case 'chart-cpu':
|
||||
Controller.module.cpu.init(res);
|
||||
break;
|
||||
case 'chart-memory':
|
||||
Controller.module.memory.init(res);
|
||||
break;
|
||||
case 'chart-disk':
|
||||
Controller.module.disk.init(res);
|
||||
break;
|
||||
case 'chart-net':
|
||||
Controller.module.net.init(res);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getData(id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "btpanel/ajax/getMonitorData",
|
||||
data: $('#' + id).data(),
|
||||
dataType: "JSON",
|
||||
success: function(res) {
|
||||
chart[id].setOption({
|
||||
dataset: {
|
||||
source: res
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
getOptions(obj) {
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
},
|
||||
formatter: obj.formatter
|
||||
},
|
||||
dataset: obj.dataset,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#666"
|
||||
}
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
top: '10%',
|
||||
bottom: 60
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: obj.unit,
|
||||
boundaryGap: [0, '100%'],
|
||||
min: 0,
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "#ddd"
|
||||
}
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#666"
|
||||
}
|
||||
}
|
||||
},
|
||||
dataZoom: [{
|
||||
type: 'slider',
|
||||
start: 0,
|
||||
end: 100,
|
||||
zoomLock: true
|
||||
}, {
|
||||
start: 0,
|
||||
end: 100,
|
||||
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
||||
handleSize: '80%',
|
||||
handleStyle: {
|
||||
color: '#fff',
|
||||
shadowBlur: 3,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.6)',
|
||||
shadowOffsetX: 2,
|
||||
shadowOffsetY: 2
|
||||
}
|
||||
}],
|
||||
series: []
|
||||
};
|
||||
if (obj.legend) option.legend = obj.legend;
|
||||
if (obj.dataZoom) option.dataZoom = obj.dataZoom;
|
||||
|
||||
for (var i = 0; i < obj.series.length; i++) {
|
||||
var item = obj.series[i];
|
||||
var series = {
|
||||
type: item.type ? item.type : 'line',
|
||||
smooth: item.smooth ? item.smooth : true,
|
||||
symbol: item.symbol ? item.symbol : 'none',
|
||||
showSymbol: item.showSymbol ? item.showSymbol : false,
|
||||
sampling: item.sampling ? item.sampling : 'average',
|
||||
areaStyle: item.areaStyle ? item.areaStyle : {},
|
||||
lineStyle: item.lineStyle ? item.lineStyle : {},
|
||||
itemStyle: item.itemStyle ? item.itemStyle : { normal: { color: 'rgb(0, 153, 238)' } },
|
||||
symbolSize: 6,
|
||||
symbol: 'none'
|
||||
}
|
||||
option.series.push(series);
|
||||
}
|
||||
return option;
|
||||
}
|
||||
},
|
||||
daterangepicker: function() {
|
||||
require(['bootstrap-daterangepicker'], function() {
|
||||
var options = {
|
||||
timePicker: false,
|
||||
autoUpdateInput: false,
|
||||
timePickerSeconds: true,
|
||||
timePicker24Hour: true,
|
||||
autoApply: true,
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
customRangeLabel: __("Custom Range"),
|
||||
applyLabel: __("Apply"),
|
||||
cancelLabel: __("Clear"),
|
||||
},
|
||||
|
||||
};
|
||||
var origincallback = function(start, end) {
|
||||
var $chart = $(this.element).parents('.panel').find('.chart-line');
|
||||
$chart.data('start', start.unix());
|
||||
$chart.data('end', end.unix());
|
||||
Controller.api.echarts.getData($chart.attr('id'));
|
||||
};
|
||||
|
||||
$(".datetimerange").each(function() {
|
||||
var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
|
||||
$(this).on('apply.daterangepicker', function(ev, picker) {
|
||||
callback.call(picker, picker.startDate, picker.endDate);
|
||||
});
|
||||
$(this).on('cancel.daterangepicker', function(ev, picker) {
|
||||
$(this).val('').trigger('blur');
|
||||
});
|
||||
$(this).daterangepicker($.extend(true, options, $(this).data()), callback);
|
||||
});
|
||||
});
|
||||
$('.label-date').hover(function() {
|
||||
var active = $(this).hasClass("label-active");
|
||||
if (!active) {
|
||||
$(this).removeClass('label-default').addClass('label-success');
|
||||
}
|
||||
}, function() {
|
||||
var active = $(this).hasClass("label-active");
|
||||
if (!active) {
|
||||
$(this).removeClass('label-success').addClass('label-default');
|
||||
}
|
||||
});
|
||||
$('.label-date').click(function() {
|
||||
var active = $(this).hasClass("label-active");
|
||||
if (!active) {
|
||||
$(this).siblings('.label-date').removeClass('label-success label-active').addClass('label-default');
|
||||
$(this).removeClass('label-default').addClass('label-success label-active')
|
||||
var date = $(this).data('date');
|
||||
var $chart = $(this).parents('.panel').find('.chart-line');
|
||||
switch (date) {
|
||||
case 'yesterday':
|
||||
$chart.data('start', Moment().subtract(1, 'days').startOf('day').unix());
|
||||
$chart.data('end', Moment().subtract(1, 'days').endOf('day').unix());
|
||||
Controller.api.echarts.getData($chart.attr('id'));
|
||||
break;
|
||||
case 'today':
|
||||
$chart.data('start', Moment().startOf('day').unix());
|
||||
$chart.data('end', Moment().endOf('day').unix());
|
||||
Controller.api.echarts.getData($chart.attr('id'));
|
||||
break;
|
||||
case 'last7':
|
||||
$chart.data('start', Moment().subtract(6, 'days').startOf('day').unix());
|
||||
$chart.data('end', Moment().subtract(6, 'days').endOf('day').unix());
|
||||
Controller.api.echarts.getData($chart.attr('id'));
|
||||
break;
|
||||
case 'last30':
|
||||
$chart.data('start', Moment().subtract(29, 'days').startOf('day').unix());
|
||||
$chart.data('end', Moment().subtract(29, 'days').endOf('day').unix());
|
||||
Controller.api.echarts.getData($chart.attr('id'));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'category/index',
|
||||
add_url: 'category/add',
|
||||
edit_url: 'category/edit',
|
||||
del_url: 'category/del',
|
||||
multi_url: 'category/multi',
|
||||
dragsort_url: 'ajax/weigh',
|
||||
table: 'category',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
pagination: false,
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'type', title: __('Type'), operate: false, searchList: Config.searchList, formatter: Table.api.formatter.label},
|
||||
{field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) {
|
||||
return value.toString().replace(/(&|&)nbsp;/g, ' ');
|
||||
}
|
||||
},
|
||||
{field: 'nickname', title: __('Nickname')},
|
||||
{field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag},
|
||||
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'status', title: __('Status'), operate: false, formatter: Table.api.formatter.status},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
//绑定TAB事件
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
// var options = table.bootstrapTable(tableOptions);
|
||||
var typeStr = $(this).attr("href").replace('#', '');
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
options.pageNumber = 1;
|
||||
options.queryParams = function (params) {
|
||||
// params.filter = JSON.stringify({type: typeStr});
|
||||
params.type = typeStr;
|
||||
|
||||
return params;
|
||||
};
|
||||
table.bootstrapTable('refresh', {});
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
//必须默认触发shown.bs.tab事件
|
||||
// $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
|
||||
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
setTimeout(function () {
|
||||
$("#c-type").trigger("change");
|
||||
}, 100);
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
$(document).on("change", "#c-type", function () {
|
||||
$("#c-pid option[data-type='all']").prop("selected", true);
|
||||
$("#c-pid option").removeClass("hide");
|
||||
$("#c-pid option[data-type!='" + $(this).val() + "'][data-type!='all']").addClass("hide");
|
||||
$("#c-pid").data("selectpicker") && $("#c-pid").selectpicker("refresh");
|
||||
});
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+114
@@ -0,0 +1,114 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = Echarts.init(document.getElementById('echart'), 'walden');
|
||||
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
title: {
|
||||
text: '',
|
||||
subtext: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: [__('Sales'), __('Orders')]
|
||||
},
|
||||
toolbox: {
|
||||
show: false,
|
||||
feature: {
|
||||
magicType: {show: true, type: ['stack', 'tiled']},
|
||||
saveAsImage: {show: true}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: Orderdata.column
|
||||
},
|
||||
yAxis: {},
|
||||
grid: [{
|
||||
left: 'left',
|
||||
top: 'top',
|
||||
right: '10',
|
||||
bottom: 30
|
||||
}],
|
||||
series: [{
|
||||
name: __('Sales'),
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {
|
||||
normal: {}
|
||||
},
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 1.5
|
||||
}
|
||||
},
|
||||
data: Orderdata.paydata
|
||||
},
|
||||
{
|
||||
name: __('Orders'),
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {
|
||||
normal: {}
|
||||
},
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 1.5
|
||||
}
|
||||
},
|
||||
data: Orderdata.createdata
|
||||
}]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
|
||||
//动态添加数据,可以通过Ajax获取数据然后填充
|
||||
setInterval(function () {
|
||||
Orderdata.column.push((new Date()).toLocaleTimeString().replace(/^\D*/, ''));
|
||||
var amount = Math.floor(Math.random() * 200) + 20;
|
||||
Orderdata.createdata.push(amount);
|
||||
Orderdata.paydata.push(Math.floor(Math.random() * amount) + 1);
|
||||
|
||||
//按自己需求可以取消这个限制
|
||||
if (Orderdata.column.length >= 20) {
|
||||
//移除最开始的一条数据
|
||||
Orderdata.column.shift();
|
||||
Orderdata.paydata.shift();
|
||||
Orderdata.createdata.shift();
|
||||
}
|
||||
myChart.setOption({
|
||||
xAxis: {
|
||||
data: Orderdata.column
|
||||
},
|
||||
series: [{
|
||||
name: __('Sales'),
|
||||
data: Orderdata.paydata
|
||||
},
|
||||
{
|
||||
name: __('Orders'),
|
||||
data: Orderdata.createdata
|
||||
}]
|
||||
});
|
||||
}, 2000);
|
||||
$(window).resize(function () {
|
||||
myChart.resize();
|
||||
});
|
||||
|
||||
$(document).on("click", ".btn-refresh", function () {
|
||||
setTimeout(function () {
|
||||
myChart.resize();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
return Controller;
|
||||
});
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
//
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/baidumap/index',
|
||||
add_url: 'example/baidumap/add',
|
||||
edit_url: 'example/baidumap/edit',
|
||||
del_url: 'example/baidumap/del',
|
||||
multi_url: 'example/baidumap/multi',
|
||||
table: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: 'ID', operate: false},
|
||||
{field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
|
||||
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'url', title: __('Url'), align: 'left'},
|
||||
{field: 'ip', title: __('IP')},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
map: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
require(['async!BMap'], function () {
|
||||
// 更多文档可参考 http://lbsyun.baidu.com/jsdemo.htm
|
||||
// 百度地图API功能
|
||||
var map = new BMap.Map("allmap");
|
||||
var point = new BMap.Point(116.404, 39.915);
|
||||
|
||||
map.centerAndZoom(point, 13); //设置中心坐标点和级别
|
||||
var marker = new BMap.Marker(point); // 创建标注
|
||||
map.addOverlay(marker); // 将标注添加到地图中
|
||||
marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
|
||||
|
||||
map.enableDragging(); //开启拖拽
|
||||
//map.enableInertialDragging(); //开启惯性拖拽
|
||||
map.enableScrollWheelZoom(true); //是否允许缩放
|
||||
//map.centerAndZoom("上海",15); //根据城市名设定地图中心点
|
||||
|
||||
var geolocation = new BMap.Geolocation();
|
||||
geolocation.getCurrentPosition(function (r) {
|
||||
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
|
||||
var mk = new BMap.Marker(r.point);
|
||||
map.addOverlay(mk);
|
||||
map.panTo(r.point);
|
||||
//Layer.alert('您的位置:' + r.point.lng + ',' + r.point.lat);
|
||||
} else {
|
||||
Layer.alert('failed' + this.getStatus());
|
||||
}
|
||||
}, {enableHighAccuracy: true});
|
||||
|
||||
// 点搜索按钮时解析地址坐标
|
||||
$(document).on('click', '.btn-search', function () {
|
||||
// 创建地址解析器实例
|
||||
var myGeo = new BMap.Geocoder();
|
||||
// 将地址解析结果显示在地图上,并调整地图视野
|
||||
myGeo.getPoint($("#searchaddress").val(), function (point) {
|
||||
if (point) {
|
||||
map.centerAndZoom(point, 16);
|
||||
map.addOverlay(new BMap.Marker(point));
|
||||
} else {
|
||||
Layer.alert("您选择地址没有解析到结果!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/bootstraptable/index',
|
||||
add_url: '',
|
||||
edit_url: 'example/bootstraptable/edit',
|
||||
del_url: 'example/bootstraptable/del',
|
||||
multi_url: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
//在普通搜索提交搜索前
|
||||
table.on('common-search.bs.table', function (event, table, query) {
|
||||
//这里可以获取到普通搜索表单中字段的查询条件
|
||||
console.log(query);
|
||||
});
|
||||
|
||||
//在普通搜索渲染后
|
||||
table.on('post-common-search.bs.table', function (event, table) {
|
||||
var form = $("form", table.$commonsearch);
|
||||
$("input[name='title']", form).addClass("selectpage").data("source", "auth/adminlog/selectpage").data("primaryKey", "title").data("field", "title").data("orderBy", "id desc");
|
||||
$("input[name='username']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "username").data("field", "username").data("orderBy", "id desc");
|
||||
Form.events.cxselect(form);
|
||||
Form.events.selectpage(form);
|
||||
});
|
||||
|
||||
//在表格内容渲染完成后回调的事件
|
||||
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
||||
console.log(e, settings, json, xhr);
|
||||
});
|
||||
|
||||
//当表格数据加载完成时
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
console.log(data);
|
||||
//这里我们手动设置底部的值
|
||||
$("#money").text(data.extend.money);
|
||||
$("#price").text(data.extend.price);
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
// 这里使用的是Bootstrap-table插件渲染表格
|
||||
// 相关文档:https://doc.fastadmin.net/doc/table.html
|
||||
table.bootstrapTable({
|
||||
//表格参数可以参考:https://doc.fastadmin.net/doc/190.html
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
//更多列参数可以参考:https://doc.fastadmin.net/doc/191.html
|
||||
//该列为复选框字段,如果后台的返回state值将会默认选中
|
||||
{field: 'state', checkbox: true,},
|
||||
//sortable为是否排序,operate为搜索时的操作符,visible表示是否可见
|
||||
{field: 'id', title: 'ID', sortable: true, operate: false},
|
||||
//直接响应搜索
|
||||
{field: 'username', title: __('管理员'), formatter: Table.api.formatter.search},
|
||||
//模糊搜索
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', width: '280px'},
|
||||
//通过Ajax渲染searchList,也可以使用JSON数据
|
||||
{
|
||||
field: 'url',
|
||||
title: __('Url'),
|
||||
align: 'left',
|
||||
searchList: $.getJSON('example/bootstraptable/searchlist?search=a&field=row[user_id]'),
|
||||
formatter: Controller.api.formatter.url,
|
||||
addClass: "selectpicker"
|
||||
},
|
||||
//点击IP时同时执行搜索此IP
|
||||
{
|
||||
field: 'ip',
|
||||
title: __('IP'),
|
||||
events: Controller.api.events.ip,
|
||||
formatter: Controller.api.formatter.ip
|
||||
},
|
||||
//自定义栏位,custom是不存在的字段
|
||||
{field: 'custom', title: __('切换'), operate: false, formatter: Controller.api.formatter.custom},
|
||||
//browser是一个不存在的字段
|
||||
//通过formatter来渲染数据,同时为它添加上事件
|
||||
{
|
||||
field: 'browser',
|
||||
title: __('Browser'),
|
||||
operate: false,
|
||||
events: Controller.api.events.browser,
|
||||
formatter: Controller.api.formatter.browser
|
||||
},
|
||||
{
|
||||
field: 'admin_id', title: __('联动搜索'), searchList: function (column) {
|
||||
return Template('categorytpl', {});
|
||||
}, formatter: function (value, row, index) {
|
||||
return '无';
|
||||
}, visible: false
|
||||
},
|
||||
//启用时间段搜索
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Update time'),
|
||||
sortable: true,
|
||||
formatter: Table.api.formatter.datetime,
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange'
|
||||
},
|
||||
//操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
|
||||
{
|
||||
field: 'operate',
|
||||
width: "150px",
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'click',
|
||||
title: __('点击执行事件'),
|
||||
classname: 'btn btn-xs btn-info btn-click',
|
||||
icon: 'fa fa-leaf',
|
||||
// dropdown: '更多',//如果包含dropdown,将会以下拉列表的形式展示
|
||||
click: function (data) {
|
||||
Layer.alert("点击按钮执行的事件");
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'detail',
|
||||
title: __('弹出窗口打开'),
|
||||
classname: 'btn btn-xs btn-primary btn-dialog',
|
||||
icon: 'fa fa-list',
|
||||
url: 'example/bootstraptable/detail',
|
||||
callback: function (data) {
|
||||
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'ajax',
|
||||
title: __('发送Ajax'),
|
||||
classname: 'btn btn-xs btn-success btn-magic btn-ajax',
|
||||
icon: 'fa fa-magic',
|
||||
confirm: '确认发送Ajax请求?',
|
||||
url: 'example/bootstraptable/detail',
|
||||
success: function (data, ret) {
|
||||
Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
|
||||
//如果需要阻止成功提示,则必须使用return false;
|
||||
//return false;
|
||||
},
|
||||
error: function (data, ret) {
|
||||
console.log(data, ret);
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'addtabs',
|
||||
title: __('新选项卡中打开'),
|
||||
classname: 'btn btn-xs btn-warning btn-addtabs',
|
||||
icon: 'fa fa-folder-o',
|
||||
url: 'example/bootstraptable/detail'
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
},
|
||||
],
|
||||
],
|
||||
//更多配置参数可参考:https://doc.fastadmin.net/doc/190.html
|
||||
//亦可以参考require-table.js中defaults的配置
|
||||
//快捷搜索,这里可在控制器定义快捷搜索的字段
|
||||
search: true,
|
||||
//启用普通表单搜索
|
||||
commonSearch: true,
|
||||
//显示导出按钮
|
||||
showExport: true,
|
||||
//启用跨页选择
|
||||
maintainSelected: true,
|
||||
//启用固定列
|
||||
fixedColumns: true,
|
||||
//固定左侧列数
|
||||
fixedNumber: 3,
|
||||
//固定右侧列数
|
||||
fixedRightNumber: 1,
|
||||
//导出类型
|
||||
exportDataType: "all", //共有basic, all, selected三种值 basic当前页 all全部 selected仅选中
|
||||
//导出下拉列表选项
|
||||
exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
|
||||
//可以控制是否默认显示搜索单表,false则隐藏,默认为false
|
||||
searchFormVisible: true,
|
||||
queryParams: function (params) {
|
||||
//这里可以追加搜索条件
|
||||
var filter = JSON.parse(params.filter);
|
||||
var op = JSON.parse(params.op);
|
||||
//这里可以动态赋值,比如从URL中获取admin_id的值,filter.admin_id=Fast.api.query('admin_id');
|
||||
filter.admin_id = 1;
|
||||
op.admin_id = "=";
|
||||
params.filter = JSON.stringify(filter);
|
||||
params.op = JSON.stringify(op);
|
||||
return params;
|
||||
},
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
// 监听下拉列表改变的事件
|
||||
$(document).on('change', 'select[name=admin]', function () {
|
||||
$("input[name='admin_id']").val($(this).val());
|
||||
});
|
||||
|
||||
//自定义Tab筛选条件
|
||||
$('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
|
||||
var value = $(this).data("value");
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
var queryParams = options.queryParams;
|
||||
options.pageNumber = 1;
|
||||
options.queryParams = function (params) {
|
||||
//这一行必须要存在,否则在点击下一页时会丢失搜索栏数据
|
||||
params = queryParams(params);
|
||||
|
||||
//如果希望追加搜索条件,可使用
|
||||
var filter = params.filter ? JSON.parse(params.filter) : {};
|
||||
var op = params.op ? JSON.parse(params.op) : {};
|
||||
if (value) {
|
||||
//这里可以自定义多个筛选条件
|
||||
filter.admin_id = value;
|
||||
op.admin_id = '=';
|
||||
} else {
|
||||
//选全部时要移除相应的条件
|
||||
delete filter.admin_id;
|
||||
delete op.admin_id;
|
||||
}
|
||||
|
||||
params.filter = JSON.stringify(filter);
|
||||
params.op = JSON.stringify(op);
|
||||
|
||||
//如果希望忽略搜索栏搜索条件,可使用
|
||||
//params.filter = JSON.stringify(value?{admin_id: value}:{});
|
||||
//params.op = JSON.stringify(value?{admin_id: '='}:{});
|
||||
return params;
|
||||
};
|
||||
|
||||
table.trigger("uncheckbox");
|
||||
table.bootstrapTable('refresh', {pageNumber: 1});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 指定搜索条件
|
||||
$(document).on("click", ".btn-singlesearch", function () {
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
var queryParams = options.queryParams;
|
||||
options.pageNumber = 1;
|
||||
options.queryParams = function (params) {
|
||||
//这一行必须要存在,否则在点击下一页时会丢失搜索栏数据
|
||||
params = queryParams(params);
|
||||
|
||||
//如果希望追加搜索条件,可使用
|
||||
var filter = params.filter ? JSON.parse(params.filter) : {};
|
||||
var op = params.op ? JSON.parse(params.op) : {};
|
||||
filter.url = 'login';
|
||||
op.url = 'like';
|
||||
|
||||
params.filter = JSON.stringify(filter);
|
||||
params.op = JSON.stringify(op);
|
||||
|
||||
//如果希望忽略搜索栏搜索条件,可使用
|
||||
//params.filter = JSON.stringify({url: 'login'});
|
||||
//params.op = JSON.stringify({url: 'like'});
|
||||
return params;
|
||||
};
|
||||
table.bootstrapTable('refresh', {});
|
||||
Toastr.info("当前执行的是自定义搜索,搜索URL中包含login的数据");
|
||||
return false;
|
||||
});
|
||||
|
||||
// 获取选中项
|
||||
$(document).on("click", ".btn-selected", function () {
|
||||
Layer.alert(JSON.stringify(Table.api.selecteddata(table)));
|
||||
});
|
||||
|
||||
// 启动和暂停按钮
|
||||
$(document).on("click", ".btn-start,.btn-pause", function () {
|
||||
//在table外不可以使用添加.btn-change的方法
|
||||
//只能自己调用Table.api.multi实现
|
||||
//如果操作全部则ids可以置为空
|
||||
var ids = Table.api.selectedids(table);
|
||||
Table.api.multi("changestatus", ids.join(","), table, this);
|
||||
});
|
||||
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
detail: function () {
|
||||
$(document).on('click', '.btn-callback', function () {
|
||||
Fast.api.close($("input[name=callback]").val());
|
||||
});
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {//渲染的方法
|
||||
url: function (value, row, index) {
|
||||
return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
|
||||
},
|
||||
ip: function (value, row, index) {
|
||||
return '<a class="btn btn-xs btn-ip bg-success"><i class="fa fa-map-marker"></i> ' + value + '</a>';
|
||||
},
|
||||
browser: function (value, row, index) {
|
||||
//这里我们直接使用row的数据
|
||||
return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
|
||||
},
|
||||
custom: function (value, row, index) {
|
||||
//添加上btn-change可以自定义请求的URL进行数据处理
|
||||
return '<a class="btn-change text-success" data-url="example/bootstraptable/change" data-confirm="确认切换状态?" data-id="' + row.id + '"><i class="fa ' + (row.title == '' ? 'fa-toggle-on fa-flip-horizontal text-gray' : 'fa-toggle-on') + ' fa-2x"></i></a>';
|
||||
},
|
||||
},
|
||||
events: {//绑定事件的方法
|
||||
ip: {
|
||||
//格式为:方法名+空格+DOM元素
|
||||
'click .btn-ip': function (e, value, row, index) {
|
||||
e.stopPropagation();
|
||||
var container = $("#table").data("bootstrap.table").$container;
|
||||
var options = $("#table").bootstrapTable('getOptions');
|
||||
//这里我们手动将数据填充到表单然后提交
|
||||
$("form.form-commonsearch [name='ip']", container).val(value);
|
||||
$("form.form-commonsearch", container).trigger('submit');
|
||||
Toastr.info("执行了自定义搜索操作");
|
||||
}
|
||||
},
|
||||
browser: {
|
||||
'click .btn-browser': function (e, value, row, index) {
|
||||
e.stopPropagation();
|
||||
Layer.alert("该行数据为: <code>" + JSON.stringify(row) + "</code>");
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/colorbadge/index',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: 'example/colorbadge/del',
|
||||
multi_url: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'ip', title: __('IP')},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
],
|
||||
onLoadSuccess: function (data) {
|
||||
// 在表格第次加载成功后,刷新左侧菜单栏彩色小角标,支持一次渲染多个
|
||||
// 如果需要在进入后台即显示左侧的彩色小角标,请使用服务端渲染方式,详情修改application/admin/controller/Index.php
|
||||
Backend.api.sidebar({
|
||||
'example/colorbadge': data.total
|
||||
});
|
||||
Toastr.info("左侧角标已经刷新成功");
|
||||
}
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
edit: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/controllerjump/index',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: 'example/controllerjump/del',
|
||||
multi_url: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'ip', title: __('IP'),formatter: Controller.api.formatter.ip},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
edit: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
api: {
|
||||
formatter: {
|
||||
ip: function (value, row, index) {
|
||||
//这里手动构造URL
|
||||
url = "example/bootstraptable?" + this.field + "=" + value;
|
||||
|
||||
//方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容
|
||||
//return '<a href="' + url + '" class="label label-success addtabsit" title="' + __("Search %s", value) + '">' + __('Search %s', value) + '</a>';
|
||||
|
||||
//方式二,直接调用Table.api.formatter.addtabs
|
||||
this.url = url;
|
||||
return Table.api.formatter.addtabs.call(this, value, row, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
Template.helper("Fast", Fast);
|
||||
|
||||
//因为日期选择框不会触发change事件,导致无法刷新textarea,所以加上判断
|
||||
$(document).on("dp.change", "#second-form .datetimepicker", function () {
|
||||
$(this).parent().prev().find("input").trigger("change");
|
||||
});
|
||||
$(document).on("fa.event.appendfieldlist", "#first-table .btn-append", function (e, obj) {
|
||||
|
||||
});
|
||||
$(document).on("fa.event.appendfieldlist", "#second-table .btn-append", function (e, obj) {
|
||||
//绑定动态下拉组件
|
||||
Form.events.selectpage(obj);
|
||||
//绑定日期组件
|
||||
Form.events.datetimepicker(obj);
|
||||
//绑定上传组件
|
||||
Form.events.faupload(obj);
|
||||
|
||||
//上传成功回调事件,变更按钮的背景
|
||||
$(".upload-image", obj).data("upload-success", function (data) {
|
||||
$(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')");
|
||||
})
|
||||
});
|
||||
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
||||
Layer.alert(data.data);
|
||||
});
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
//
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/customsearch/index',
|
||||
add_url: 'example/customsearch/add',
|
||||
edit_url: '',
|
||||
del_url: 'example/customsearch/del',
|
||||
multi_url: 'example/customsearch/multi',
|
||||
table: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
searchFormVisible: true,
|
||||
searchFormTemplate: 'customformtpl',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: 'ID', operate: false},
|
||||
{field: 'admin_id', title: __('Admin_id'), visible: false, operate: false},
|
||||
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'url', title: __('Url'), align: 'left'},
|
||||
{field: 'ip', title: __('IP')},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
$("#cxselect-example .col-xs-12").each(function () {
|
||||
$("textarea", this).val($(this).prev().prev().html().replace(/[ ]{2}/g, ''));
|
||||
});
|
||||
|
||||
//这里需要手动为Form绑定上元素事件
|
||||
Form.api.bindevent($("form#cxselectform"));
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+206
@@ -0,0 +1,206 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'echarts', 'echarts-theme'], function ($, undefined, Backend, Table, Form, Template, Echarts) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
//这句话在多选项卡统计表时必须存在,否则会导致影响的图表宽度不正确
|
||||
$(document).on("click", ".charts-custom a[data-toggle=\"tab\"]", function () {
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
var id = $(that).attr("href");
|
||||
var chart = Echarts.getInstanceByDom($(id)[0]);
|
||||
chart.resize();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var lineChart = Echarts.init(document.getElementById('line-chart'), 'walden');
|
||||
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
data: [49, 92, 61, 134, 90, 130, 120],
|
||||
type: 'line'
|
||||
}]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
lineChart.setOption(option);
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var areaChart = Echarts.init(document.getElementById('area-chart'), 'walden');
|
||||
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||
type: 'line',
|
||||
areaStyle: {}
|
||||
}]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
areaChart.setOption(option);
|
||||
|
||||
var pieChart = Echarts.init(document.getElementById('pie-chart'), 'walden');
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 10,
|
||||
data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '访问来源',
|
||||
type: 'pie',
|
||||
radius: ['50%', '70%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
normal: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
fontSize: '30',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
normal: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{value: 335, name: '直接访问'},
|
||||
{value: 310, name: '邮件营销'},
|
||||
{value: 234, name: '联盟广告'},
|
||||
{value: 135, name: '视频广告'},
|
||||
{value: 1548, name: '搜索引擎'}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
pieChart.setOption(option);
|
||||
|
||||
var barChart = Echarts.init(document.getElementById('bar-chart'), 'walden');
|
||||
option = {
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
dataset: {
|
||||
source: [
|
||||
['产品销售', '2015', '2016', '2017'],
|
||||
['风扇', 43.3, 85.8, 93.7],
|
||||
['电视机', 83.1, 73.4, 55.1],
|
||||
['空调', 86.4, 65.2, 82.5],
|
||||
['冰箱', 72.4, 53.9, 39.1]
|
||||
]
|
||||
},
|
||||
xAxis: {type: 'category'},
|
||||
yAxis: {},
|
||||
// Declare several bar series, each will be mapped
|
||||
// to a column of dataset.source by default.
|
||||
series: [
|
||||
{type: 'bar'},
|
||||
{type: 'bar'},
|
||||
{type: 'bar'}
|
||||
]
|
||||
};
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
barChart.setOption(option);
|
||||
|
||||
|
||||
var barChart = Echarts.init(document.getElementById('simplebar-chart'));
|
||||
option = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#fff"
|
||||
}
|
||||
},
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#fff"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
data: [120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: "#fff",
|
||||
opacity: 0.6
|
||||
}
|
||||
}]
|
||||
};
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
barChart.setOption(option);
|
||||
|
||||
var barChart = Echarts.init(document.getElementById('smoothline-chart'));
|
||||
option = {
|
||||
textStyle: {
|
||||
color: "#fff"
|
||||
},
|
||||
color: ['#fff'],
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#fff"
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#fff"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: {
|
||||
opacity: 0.4
|
||||
}
|
||||
|
||||
}]
|
||||
};
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
barChart.setOption(option);
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init();
|
||||
|
||||
//绑定事件
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var panel = $($(this).attr("href"));
|
||||
if (panel.size() > 0) {
|
||||
Controller.table[panel.attr("id")].call(this);
|
||||
$(this).on('click', function (e) {
|
||||
$($(this).attr("href")).find(".btn-refresh").trigger("click");
|
||||
});
|
||||
}
|
||||
//移除绑定的事件
|
||||
$(this).unbind('shown.bs.tab');
|
||||
});
|
||||
|
||||
//必须默认触发shown.bs.tab事件
|
||||
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
|
||||
},
|
||||
table: {
|
||||
first: function () {
|
||||
// 表格1
|
||||
var table1 = $("#table1");
|
||||
table1.bootstrapTable({
|
||||
url: 'example/multitable/table1',
|
||||
toolbar: '#toolbar1',
|
||||
sortName: 'id',
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'url', title: __('Url'), formatter: Table.api.formatter.url},
|
||||
{field: 'imagewidth', title: __('Imagewidth')},
|
||||
{field: 'imageheight', title: __('Imageheight')},
|
||||
{field: 'mimetype', title: __('Mimetype')},
|
||||
{field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格1绑定事件
|
||||
Table.api.bindevent(table1);
|
||||
},
|
||||
second: function () {
|
||||
// 表格2
|
||||
var table2 = $("#table2");
|
||||
table2.bootstrapTable({
|
||||
url: 'example/multitable/table2',
|
||||
extend: {
|
||||
index_url: '',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: '',
|
||||
multi_url: '',
|
||||
table: '',
|
||||
},
|
||||
toolbar: '#toolbar2',
|
||||
sortName: 'id',
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url},
|
||||
{field: 'ip', title: __('ip')},
|
||||
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格2绑定事件
|
||||
Table.api.bindevent(table2);
|
||||
}
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/relationmodel/index',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: 'example/relationmodel/del',
|
||||
multi_url: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID', operate: '='},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'},
|
||||
{field: 'admin.avatar', title: __('Avatar'), operate: false, formatter: Table.api.formatter.image},
|
||||
{field: 'admin.username', title: __('Username'), operate: 'FIND_IN_SET'},
|
||||
{field: 'admin.nickname', title: __('Nickname'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'},
|
||||
{field: 'ip', title: __('IP'), operate: '='},
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'admin.createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
],
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
edit: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init();
|
||||
this.table.first();
|
||||
this.table.second();
|
||||
},
|
||||
table: {
|
||||
first: function () {
|
||||
// 表格1
|
||||
var table1 = $("#table1");
|
||||
table1.bootstrapTable({
|
||||
url: 'example/tablelink/table1',
|
||||
toolbar: '#toolbar1',
|
||||
sortName: 'id',
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
// {field: 'state', checkbox: true,},
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'username', title: __('Nickname')},
|
||||
{
|
||||
field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, buttons: [
|
||||
{
|
||||
name: 'log',
|
||||
title: '日志列表',
|
||||
text: '日志列表',
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-primary btn-xs btn-click',
|
||||
click: function (e, data) {
|
||||
$("#myTabContent2 .form-commonsearch input[name='username']").val(data.username);
|
||||
$("#myTabContent2 .btn-refresh").trigger("click");
|
||||
}
|
||||
}
|
||||
], formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格1绑定事件
|
||||
Table.api.bindevent(table1);
|
||||
},
|
||||
second: function () {
|
||||
// 表格2
|
||||
var table2 = $("#table2");
|
||||
table2.bootstrapTable({
|
||||
url: 'example/tablelink/table2',
|
||||
extend: {
|
||||
index_url: '',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: '',
|
||||
multi_url: '',
|
||||
table: '',
|
||||
},
|
||||
toolbar: '#toolbar2',
|
||||
sortName: 'id',
|
||||
search: false,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true,},
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'username', title: __('Nickname')},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url},
|
||||
{field: 'ip', title: __('ip')},
|
||||
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格2绑定事件
|
||||
Table.api.bindevent(table2);
|
||||
}
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'example/tabletemplate/index',
|
||||
add_url: '',
|
||||
edit_url: '',
|
||||
del_url: 'example/tabletemplate/del',
|
||||
multi_url: '',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
Template.helper("Moment", Moment);
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
templateView: true,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true, },
|
||||
{field: 'id', title: 'ID', operate: false},
|
||||
//直接响应搜索
|
||||
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||
//模糊搜索
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符', style: 'width:200px'},
|
||||
//通过Ajax渲染searchList
|
||||
{field: 'url', title: __('Url'), align: 'left', formatter: Controller.api.formatter.url},
|
||||
//点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式
|
||||
{field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip},
|
||||
//browser是一个不存在的字段
|
||||
//通过formatter来渲染数据,同时为它添加上事件
|
||||
{field: 'browser', title: __('Browser'), operate: false, events: Controller.api.events.browser, formatter: Controller.api.formatter.browser},
|
||||
//启用时间段搜索
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
],
|
||||
],
|
||||
//禁用默认搜索
|
||||
search: false,
|
||||
//启用普通表单搜索
|
||||
commonSearch: false,
|
||||
//可以控制是否默认显示搜索单表,false则隐藏,默认为false
|
||||
searchFormVisible: false,
|
||||
//分页大小
|
||||
pageSize: 12
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
//指定搜索条件
|
||||
$(document).on("click", ".btn-toggle-view", function () {
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
table.bootstrapTable('refreshOptions', {templateView: !options.templateView});
|
||||
});
|
||||
|
||||
//点击详情
|
||||
$(document).on("click", ".btn-detail[data-id]", function () {
|
||||
Backend.api.open('example/bootstraptable/detail/ids/' + $(this).data('id'), __('Detail'));
|
||||
});
|
||||
|
||||
//获取选中项
|
||||
$(document).on("click", ".btn-selected", function () {
|
||||
//在templateView的模式下不能调用table.bootstrapTable('getSelections')来获取选中的ID,只能通过下面的Table.api.selectedids来获取
|
||||
Layer.alert(JSON.stringify(Table.api.selectedids(table)));
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {
|
||||
url: function (value, row, index) {
|
||||
return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
|
||||
},
|
||||
ip: function (value, row, index) {
|
||||
return '<a class="btn btn-xs btn-ip bg-success"><i class="fa fa-map-marker"></i> ' + value + '</a>';
|
||||
},
|
||||
browser: function (value, row, index) {
|
||||
//这里我们直接使用row的数据
|
||||
return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
|
||||
}
|
||||
},
|
||||
events: {
|
||||
ip: {
|
||||
'click .btn-ip': function (e, value, row, index) {
|
||||
var options = $("#table").bootstrapTable('getOptions');
|
||||
//这里我们手动将数据填充到表单然后提交
|
||||
$("#commonSearchContent_" + options.idTable + " form [name='ip']").val(value);
|
||||
$("#commonSearchContent_" + options.idTable + " form").trigger('submit');
|
||||
Toastr.info("执行了自定义搜索操作");
|
||||
}
|
||||
},
|
||||
browser: {
|
||||
'click .btn-browser': function (e, value, row, index) {
|
||||
Layer.alert("该行数据为: <code>" + JSON.stringify(row) + "</code>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'general/attachment/index',
|
||||
add_url: 'general/attachment/add',
|
||||
edit_url: 'general/attachment/edit',
|
||||
del_url: 'general/attachment/del',
|
||||
multi_url: 'general/attachment/multi',
|
||||
table: 'attachment'
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_id', title: __('Admin_id'), visible: false, addClass: "selectpage", extend: "data-source='auth/admin/index' data-field='nickname'"},
|
||||
{field: 'user_id', title: __('User_id'), visible: false, addClass: "selectpage", extend: "data-source='user/user/index' data-field='nickname'"},
|
||||
{field: 'preview', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
|
||||
{field: 'url', title: __('Url'), formatter: Controller.api.formatter.url, visible: false},
|
||||
{field: 'filename', title: __('Filename'), formatter: Controller.api.formatter.filename, operate: 'like'},
|
||||
{
|
||||
field: 'filesize', title: __('Filesize'), operate: 'BETWEEN', sortable: true, formatter: function (value, row, index) {
|
||||
var size = parseFloat(value);
|
||||
var i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
return (size / Math.pow(1024, i)).toFixed(i < 2 ? 0 : 2) * 1 + ' ' + ['B', 'KB', 'MB', 'GB', 'TB'][i];
|
||||
}
|
||||
},
|
||||
{field: 'imagewidth', title: __('Imagewidth'), sortable: true},
|
||||
{field: 'imageheight', title: __('Imageheight'), sortable: true},
|
||||
{field: 'imagetype', title: __('Imagetype'), formatter: Table.api.formatter.search, operate: 'like'},
|
||||
{field: 'storage', title: __('Storage'), formatter: Table.api.formatter.search, operate: 'like'},
|
||||
{field: 'mimetype', title: __('Mimetype'), formatter: Table.api.formatter.search},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
formatter: Table.api.formatter.datetime,
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
],
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
},
|
||||
select: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'general/attachment/select',
|
||||
}
|
||||
});
|
||||
var urlArr = [];
|
||||
var multiple = Backend.api.query('multiple');
|
||||
multiple = multiple == 'true' ? true : false;
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function (e, row) {
|
||||
if (e.type == 'check' || e.type == 'uncheck') {
|
||||
row = [row];
|
||||
} else {
|
||||
urlArr = [];
|
||||
}
|
||||
$.each(row, function (i, j) {
|
||||
if (e.type.indexOf("uncheck") > -1) {
|
||||
var index = urlArr.indexOf(j.url);
|
||||
if (index > -1) {
|
||||
urlArr.splice(index, 1);
|
||||
}
|
||||
} else {
|
||||
urlArr.indexOf(j.url) == -1 && urlArr.push(j.url);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
sortName: 'id',
|
||||
showToggle: false,
|
||||
showExport: false,
|
||||
maintainSelected: true,
|
||||
columns: [
|
||||
[
|
||||
{field: 'state', checkbox: multiple, visible: multiple, operate: false},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false},
|
||||
{field: 'user_id', title: __('User_id'), formatter: Table.api.formatter.search, visible: false},
|
||||
{field: 'url', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
|
||||
{field: 'filename', title: __('Filename'), formatter: Controller.api.formatter.filename, operate: 'like'},
|
||||
{field: 'imagewidth', title: __('Imagewidth'), operate: false},
|
||||
{field: 'imageheight', title: __('Imageheight'), operate: false},
|
||||
{
|
||||
field: 'mimetype', title: __('Mimetype'), operate: 'LIKE %...%',
|
||||
process: function (value, arg) {
|
||||
return value.replace(/\*/g, '%');
|
||||
}
|
||||
},
|
||||
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD', operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
{
|
||||
field: 'operate', title: __('Operate'), events: {
|
||||
'click .btn-chooseone': function (e, value, row, index) {
|
||||
Fast.api.close({url: row.url, multiple: multiple});
|
||||
},
|
||||
}, formatter: function () {
|
||||
return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 选中多个
|
||||
$(document).on("click", ".btn-choose-multi", function () {
|
||||
Fast.api.close({url: urlArr.join(","), multiple: multiple});
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
require(['upload'], function (Upload) {
|
||||
Upload.api.upload($("#toolbar .faupload"), function () {
|
||||
$(".btn-refresh").trigger("click");
|
||||
});
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
//上传完成后刷新父窗口
|
||||
$(".faupload").data("upload-complete", function (files) {
|
||||
window.parent.$(".btn-refresh").trigger("click");
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {
|
||||
thumb: function (value, row, index) {
|
||||
if (row.mimetype.indexOf("image") > -1) {
|
||||
return '<a href="' + row.fullurl + '" target="_blank"><img src="' + row.fullurl + row.thumb_style + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
||||
} else {
|
||||
return '<a href="' + row.fullurl + '" target="_blank"><img src="' + Fast.api.fixurl("ajax/icon") + "?suffix=" + row.imagetype + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
||||
}
|
||||
},
|
||||
url: function (value, row, index) {
|
||||
return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';
|
||||
},
|
||||
filename: function (value, row, index) {
|
||||
return '<div style="width:180px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+140
@@ -0,0 +1,140 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
$("form.edit-form").data("validator-options", {
|
||||
display: function (elem) {
|
||||
return $(elem).closest('tr').find("td:first").text();
|
||||
}
|
||||
});
|
||||
Form.api.bindevent($("form.edit-form"));
|
||||
|
||||
//不可见的元素不验证
|
||||
$("form#add-form").data("validator-options", {
|
||||
ignore: ':hidden',
|
||||
rules: {
|
||||
content: function () {
|
||||
return ['radio', 'checkbox', 'select', 'selects'].indexOf($("#add-form select[name='row[type]']").val()) > -1;
|
||||
},
|
||||
extend: function () {
|
||||
return $("#add-form select[name='row[type]']").val() == 'custom';
|
||||
}
|
||||
}
|
||||
});
|
||||
Form.api.bindevent($("form#add-form"), function (ret) {
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
});
|
||||
|
||||
//渲染关联显示字段和存储字段
|
||||
var renderselect = function (id, data, defaultvalue) {
|
||||
var html = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html.push("<option value='" + data[i].name + "' " + (defaultvalue == data[i].name ? "selected" : "") + " data-subtext='" + data[i].title + "'>" + data[i].name + "</option>");
|
||||
}
|
||||
var select = $(id);
|
||||
$(select).html(html.join(""));
|
||||
select.trigger("change");
|
||||
if (select.data("selectpicker")) {
|
||||
select.selectpicker('refresh');
|
||||
}
|
||||
};
|
||||
//关联表切换
|
||||
$(document).on('change', "#c-selectpage-table", function (e, first) {
|
||||
var that = this;
|
||||
Fast.api.ajax({
|
||||
url: "general/config/get_fields_list",
|
||||
data: {table: $(that).val()},
|
||||
}, function (data, ret) {
|
||||
renderselect("#c-selectpage-primarykey", data.fieldList, first ? $("#c-selectpage-primarykey").data("value") : '');
|
||||
renderselect("#c-selectpage-field", data.fieldList, first ? $("#c-selectpage-field").data("value") : '');
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//如果编辑模式则渲染已知数据
|
||||
if (['selectpage', 'selectpages'].indexOf($("#c-type").val()) > -1) {
|
||||
$("#c-selectpage-table").trigger("change", true);
|
||||
}
|
||||
|
||||
//切换类型时
|
||||
$(document).on("change", "#c-type", function () {
|
||||
var value = $(this).val();
|
||||
$(".tf").addClass("hidden");
|
||||
$(".tf.tf-" + value).removeClass("hidden");
|
||||
if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").size() == 1) {
|
||||
//异步加载表列表
|
||||
Fast.api.ajax({
|
||||
url: "general/config/get_table_list",
|
||||
}, function (data, ret) {
|
||||
renderselect("#c-selectpage-table", data.tableList);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//切换显示隐藏变量字典列表
|
||||
$(document).on("change", "form#add-form select[name='row[type]']", function (e) {
|
||||
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
|
||||
});
|
||||
|
||||
//选择规则
|
||||
$(document).on("click", ".rulelist > li > a", function () {
|
||||
var ruleArr = $("#rule").val() == '' ? [] : $("#rule").val().split(";");
|
||||
var rule = $(this).data("value");
|
||||
var index = ruleArr.indexOf(rule);
|
||||
if (index > -1) {
|
||||
ruleArr.splice(index, 1);
|
||||
} else {
|
||||
ruleArr.push(rule);
|
||||
}
|
||||
$("#rule").val(ruleArr.join(";"));
|
||||
$(this).parent().toggleClass("active");
|
||||
});
|
||||
|
||||
//添加向发件人发送测试邮件按钮和方法
|
||||
$('input[name="row[mail_from]"]').parent().next().append('<a class="btn btn-info testmail">' + __('Send a test message') + '</a>');
|
||||
$(document).on("click", ".testmail", function () {
|
||||
var that = this;
|
||||
Layer.prompt({title: __('Please input your email'), formType: 0}, function (value, index) {
|
||||
Backend.api.ajax({
|
||||
url: "general/config/emailtest",
|
||||
data: $(that).closest("form").serialize() + "&receiver=" + value
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//删除配置
|
||||
$(document).on("click", ".btn-delcfg", function () {
|
||||
var that = this;
|
||||
Layer.confirm(__('Are you sure you want to delete this item?'), {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
Backend.api.ajax({
|
||||
url: "general/config/del",
|
||||
data: {name: $(that).data("name")}
|
||||
}, function () {
|
||||
$(that).closest("tr").remove();
|
||||
Layer.close(index);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload'], function ($, undefined, Backend, Table, Form, Upload) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
search: true,
|
||||
advancedSearch: true,
|
||||
pagination: true,
|
||||
extend: {
|
||||
"index_url": "general/profile/index",
|
||||
"add_url": "",
|
||||
"edit_url": "",
|
||||
"del_url": "",
|
||||
"multi_url": "",
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: [
|
||||
[
|
||||
{field: 'id', title: 'ID'},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url},
|
||||
{field: 'ip', title: __('ip'), formatter:Table.api.formatter.search},
|
||||
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||
]
|
||||
],
|
||||
commonSearch: false
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);//当内容渲染完成后
|
||||
|
||||
// 给上传按钮添加上传成功事件
|
||||
$("#faupload-avatar").data("upload-success", function (data) {
|
||||
var url = Backend.api.cdnurl(data.url);
|
||||
$(".profile-user-img").prop("src", url);
|
||||
Toastr.success("上传成功!");
|
||||
});
|
||||
|
||||
// 给表单绑定事件
|
||||
Form.api.bindevent($("#update-form"), function () {
|
||||
$("input[name='row[password]']").val('');
|
||||
var url = Backend.api.cdnurl($("#c-avatar").val());
|
||||
top.window.$(".user-panel .image img,.user-menu > a > img,.user-header > img").prop("src", url);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+399
@@ -0,0 +1,399 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], function ($, undefined, Backend, undefined, AdminLTE, Form) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
//双击重新加载页面
|
||||
$(document).on("dblclick", ".sidebar-menu li > a", function (e) {
|
||||
$("#con_" + $(this).attr("addtabs") + " iframe").attr('src', function (i, val) {
|
||||
return val;
|
||||
});
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
//修复在移除窗口时下拉框不隐藏的BUG
|
||||
$(window).on("blur", function () {
|
||||
$("[data-toggle='dropdown']").parent().removeClass("open");
|
||||
if ($("body").hasClass("sidebar-open")) {
|
||||
$(".sidebar-toggle").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
//快捷搜索
|
||||
$(".menuresult").width($("form.sidebar-form > .input-group").width());
|
||||
var searchResult = $(".menuresult");
|
||||
$("form.sidebar-form").on("blur", "input[name=q]", function () {
|
||||
searchResult.addClass("hide");
|
||||
}).on("focus", "input[name=q]", function () {
|
||||
if ($("a", searchResult).size() > 0) {
|
||||
searchResult.removeClass("hide");
|
||||
}
|
||||
}).on("keyup", "input[name=q]", function () {
|
||||
searchResult.html('');
|
||||
var val = $(this).val();
|
||||
var html = [];
|
||||
if (val != '') {
|
||||
$("ul.sidebar-menu li a[addtabs]:not([href^='javascript:;'])").each(function () {
|
||||
if ($("span:first", this).text().indexOf(val) > -1 || $(this).attr("py").indexOf(val) > -1 || $(this).attr("pinyin").indexOf(val) > -1) {
|
||||
html.push('<a data-url="' + $(this).attr("href") + '" href="javascript:;">' + $("span:first", this).text() + '</a>');
|
||||
if (html.length >= 100) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$(searchResult).append(html.join(""));
|
||||
if (html.length > 0) {
|
||||
searchResult.removeClass("hide");
|
||||
} else {
|
||||
searchResult.addClass("hide");
|
||||
}
|
||||
});
|
||||
//快捷搜索点击事件
|
||||
$("form.sidebar-form").on('mousedown click', '.menuresult a[data-url]', function () {
|
||||
Backend.api.addtabs($(this).data("url"));
|
||||
});
|
||||
|
||||
//切换左侧sidebar显示隐藏
|
||||
$(document).on("click fa.event.toggleitem", ".sidebar-menu li > a", function (e) {
|
||||
var nextul = $(this).next("ul");
|
||||
if (nextul.length == 0 && (!$(this).parent("li").hasClass("treeview") || ($("body").hasClass("multiplenav") && $(this).parent().parent().hasClass("sidebar-menu")))) {
|
||||
$(".sidebar-menu li").removeClass("active");
|
||||
}
|
||||
//当外部触发隐藏的a时,触发父辈a的事件
|
||||
if (!$(this).closest("ul").is(":visible")) {
|
||||
//如果不需要左侧的菜单栏联动可以注释下面一行即可
|
||||
$(this).closest("ul").prev().trigger("click");
|
||||
}
|
||||
|
||||
var visible = nextul.is(":visible");
|
||||
if (!visible) {
|
||||
$(this).parents("li").addClass("active");
|
||||
} else {
|
||||
}
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
//清除缓存
|
||||
$(document).on('click', "ul.wipecache li a", function () {
|
||||
$.ajax({
|
||||
url: 'ajax/wipecache',
|
||||
dataType: 'json',
|
||||
data: {type: $(this).data("type")},
|
||||
cache: false,
|
||||
success: function (ret) {
|
||||
if (ret.hasOwnProperty("code")) {
|
||||
var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
||||
if (ret.code === 1) {
|
||||
Toastr.success(msg ? msg : __('Wipe cache completed'));
|
||||
} else {
|
||||
Toastr.error(msg ? msg : __('Wipe cache failed'));
|
||||
}
|
||||
} else {
|
||||
Toastr.error(__('Unknown data format'));
|
||||
}
|
||||
}, error: function () {
|
||||
Toastr.error(__('Network error'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//全屏事件
|
||||
$(document).on('click', "[data-toggle='fullscreen']", function () {
|
||||
var doc = document.documentElement;
|
||||
if ($(document.body).hasClass("full-screen")) {
|
||||
$(document.body).removeClass("full-screen");
|
||||
document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
|
||||
} else {
|
||||
$(document.body).addClass("full-screen");
|
||||
doc.requestFullscreen ? doc.requestFullscreen() : doc.mozRequestFullScreen ? doc.mozRequestFullScreen() : doc.webkitRequestFullscreen ? doc.webkitRequestFullscreen() : doc.msRequestFullscreen && doc.msRequestFullscreen();
|
||||
}
|
||||
});
|
||||
|
||||
var multiplenav = $("#secondnav").size() > 0 ? true : false;
|
||||
var firstnav = $("#firstnav .nav-addtabs");
|
||||
var nav = multiplenav ? $("#secondnav .nav-addtabs") : firstnav;
|
||||
|
||||
//刷新菜单事件
|
||||
$(document).on('refresh', '.sidebar-menu', function () {
|
||||
Fast.api.ajax({
|
||||
url: 'index/index',
|
||||
data: {action: 'refreshmenu'},
|
||||
loading: false
|
||||
}, function (data) {
|
||||
$(".sidebar-menu li:not([data-rel='external'])").remove();
|
||||
$(".sidebar-menu").prepend(data.menulist);
|
||||
if (multiplenav) {
|
||||
firstnav.html(data.navlist);
|
||||
}
|
||||
$("li[role='presentation'].active a", nav).trigger('click');
|
||||
return false;
|
||||
}, function () {
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
if (multiplenav) {
|
||||
firstnav.css("overflow", "inherit");
|
||||
//一级菜单自适应
|
||||
$(window).resize(function () {
|
||||
var siblingsWidth = 0;
|
||||
firstnav.siblings().each(function () {
|
||||
siblingsWidth += $(this).outerWidth();
|
||||
});
|
||||
firstnav.width(firstnav.parent().width() - siblingsWidth);
|
||||
firstnav.refreshAddtabs();
|
||||
});
|
||||
|
||||
//点击顶部第一级菜单栏
|
||||
firstnav.on("click", "li a", function () {
|
||||
$("li", firstnav).removeClass("active");
|
||||
$(this).closest("li").addClass("active");
|
||||
$(".sidebar-menu > li[pid]").addClass("hidden");
|
||||
if ($(this).attr("url") == "javascript:;") {
|
||||
var sonlist = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']");
|
||||
sonlist.removeClass("hidden");
|
||||
var sidenav;
|
||||
var last_id = $(this).attr("last-id");
|
||||
if (last_id) {
|
||||
sidenav = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "'] a[addtabs='" + last_id + "']");
|
||||
} else {
|
||||
sidenav = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']:first > a");
|
||||
}
|
||||
if (sidenav) {
|
||||
sidenav.attr("href") != "javascript:;" && sidenav.trigger('click');
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var mobilenav = $(".mobilenav");
|
||||
$("#firstnav .nav-addtabs li a").each(function () {
|
||||
mobilenav.append($(this).clone().addClass("btn btn-app"));
|
||||
});
|
||||
|
||||
//点击移动端一级菜单
|
||||
mobilenav.on("click", "a", function () {
|
||||
$("a", mobilenav).removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$(".sidebar-menu > li[pid]").addClass("hidden");
|
||||
if ($(this).attr("url") == "javascript:;") {
|
||||
var sonlist = $(".sidebar-menu > li[pid='" + $(this).attr("addtabs") + "']");
|
||||
sonlist.removeClass("hidden");
|
||||
}
|
||||
});
|
||||
|
||||
//点击左侧菜单栏
|
||||
$(document).on('click', '.sidebar-menu li a[addtabs]', function (e) {
|
||||
var parents = $(this).parentsUntil("ul.sidebar-menu", "li");
|
||||
var top = parents[parents.length - 1];
|
||||
var pid = $(top).attr("pid");
|
||||
if (pid) {
|
||||
var obj = $("li a[addtabs=" + pid + "]", firstnav);
|
||||
var last_id = obj.attr("last-id");
|
||||
if (!last_id || last_id != pid) {
|
||||
obj.attr("last-id", $(this).attr("addtabs"));
|
||||
if (!obj.closest("li").hasClass("active")) {
|
||||
obj.trigger("click");
|
||||
}
|
||||
}
|
||||
mobilenav.find("a").removeClass("active");
|
||||
mobilenav.find("a[addtabs='" + pid + "']").addClass("active");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//这一行需要放在点击左侧链接事件之前
|
||||
var addtabs = Config.referer ? localStorage.getItem("addtabs") : null;
|
||||
|
||||
//绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格
|
||||
nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav});
|
||||
|
||||
if ($("ul.sidebar-menu li.active a").size() > 0) {
|
||||
$("ul.sidebar-menu li.active a").trigger("click");
|
||||
} else {
|
||||
if (multiplenav) {
|
||||
$("li:first > a", firstnav).trigger("click");
|
||||
} else {
|
||||
$("ul.sidebar-menu li a[url!='javascript:;']:first").trigger("click");
|
||||
}
|
||||
}
|
||||
|
||||
//如果是刷新操作则直接返回刷新前的页面
|
||||
if (Config.referer) {
|
||||
if (Config.referer === $(addtabs).attr("url")) {
|
||||
var active = $("ul.sidebar-menu li a[addtabs=" + $(addtabs).attr("addtabs") + "]");
|
||||
if (multiplenav && active.size() == 0) {
|
||||
active = $("ul li a[addtabs='" + $(addtabs).attr("addtabs") + "']");
|
||||
}
|
||||
if (active.size() > 0) {
|
||||
active.trigger("click");
|
||||
} else {
|
||||
$(addtabs).appendTo(document.body).addClass("hide").trigger("click");
|
||||
}
|
||||
} else {
|
||||
//刷新页面后跳到到刷新前的页面
|
||||
Backend.api.addtabs(Config.referer);
|
||||
}
|
||||
}
|
||||
|
||||
var my_skins = [
|
||||
"skin-blue",
|
||||
"skin-black",
|
||||
"skin-red",
|
||||
"skin-yellow",
|
||||
"skin-purple",
|
||||
"skin-green",
|
||||
"skin-blue-light",
|
||||
"skin-black-light",
|
||||
"skin-red-light",
|
||||
"skin-yellow-light",
|
||||
"skin-purple-light",
|
||||
"skin-green-light",
|
||||
"skin-black-blue",
|
||||
"skin-black-purple",
|
||||
"skin-black-red",
|
||||
"skin-black-green",
|
||||
"skin-black-yellow",
|
||||
"skin-black-pink",
|
||||
];
|
||||
setup();
|
||||
|
||||
function change_layout(cls) {
|
||||
$("body").toggleClass(cls);
|
||||
AdminLTE.layout.fixSidebar();
|
||||
//Fix the problem with right sidebar and layout boxed
|
||||
if (cls == "layout-boxed")
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
|
||||
if ($('body').hasClass('fixed') && cls == 'fixed') {
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
AdminLTE.layout.activate();
|
||||
}
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar"));
|
||||
}
|
||||
|
||||
function change_skin(cls) {
|
||||
if (!$("body").hasClass(cls)) {
|
||||
$("body").removeClass(my_skins.join(' ')).addClass(cls);
|
||||
localStorage.setItem('skin', cls);
|
||||
var cssfile = Config.site.cdnurl + "/assets/css/skins/" + cls + ".css";
|
||||
$('head').append('<link rel="stylesheet" href="' + cssfile + '" type="text/css" />');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function setup() {
|
||||
var tmp = localStorage.getItem('skin');
|
||||
if (tmp && $.inArray(tmp, my_skins) != -1)
|
||||
change_skin(tmp);
|
||||
|
||||
// 皮肤切换
|
||||
$("[data-skin]").on('click', function (e) {
|
||||
if ($(this).hasClass('knob'))
|
||||
return;
|
||||
e.preventDefault();
|
||||
change_skin($(this).data('skin'));
|
||||
});
|
||||
|
||||
// 布局切换
|
||||
$("[data-layout]").on('click', function () {
|
||||
change_layout($(this).data('layout'));
|
||||
});
|
||||
|
||||
// 切换子菜单显示和菜单小图标的显示
|
||||
$("[data-menu]").on('click', function () {
|
||||
if ($(this).data("menu") == 'show-submenu') {
|
||||
$("ul.sidebar-menu").toggleClass("show-submenu");
|
||||
} else {
|
||||
nav.toggleClass("disable-top-badge");
|
||||
}
|
||||
});
|
||||
|
||||
// 右侧控制栏切换
|
||||
$("[data-controlsidebar]").on('click', function () {
|
||||
change_layout($(this).data('controlsidebar'));
|
||||
var slide = !AdminLTE.options.controlSidebarOptions.slide;
|
||||
AdminLTE.options.controlSidebarOptions.slide = slide;
|
||||
if (!slide)
|
||||
$('.control-sidebar').removeClass('control-sidebar-open');
|
||||
});
|
||||
|
||||
// 右侧控制栏背景切换
|
||||
$("[data-sidebarskin='toggle']").on('click', function () {
|
||||
var sidebar = $(".control-sidebar");
|
||||
if (sidebar.hasClass("control-sidebar-dark")) {
|
||||
sidebar.removeClass("control-sidebar-dark")
|
||||
sidebar.addClass("control-sidebar-light")
|
||||
} else {
|
||||
sidebar.removeClass("control-sidebar-light")
|
||||
sidebar.addClass("control-sidebar-dark")
|
||||
}
|
||||
});
|
||||
|
||||
// 菜单栏展开或收起
|
||||
$("[data-enable='expandOnHover']").on('click', function () {
|
||||
$(this).attr('disabled', true);
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
if (!$('body').hasClass('sidebar-collapse'))
|
||||
$("[data-layout='sidebar-collapse']").click();
|
||||
});
|
||||
|
||||
// 重设选项
|
||||
if ($('body').hasClass('fixed')) {
|
||||
$("[data-layout='fixed']").attr('checked', 'checked');
|
||||
}
|
||||
if ($('body').hasClass('layout-boxed')) {
|
||||
$("[data-layout='layout-boxed']").attr('checked', 'checked');
|
||||
}
|
||||
if ($('body').hasClass('sidebar-collapse')) {
|
||||
$("[data-layout='sidebar-collapse']").attr('checked', 'checked');
|
||||
}
|
||||
if ($('ul.sidebar-menu').hasClass('show-submenu')) {
|
||||
$("[data-menu='show-submenu']").attr('checked', 'checked');
|
||||
}
|
||||
if (nav.hasClass('disable-top-badge')) {
|
||||
$("[data-menu='disable-top-badge']").attr('checked', 'checked');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(window).resize();
|
||||
|
||||
},
|
||||
login: function () {
|
||||
var lastlogin = localStorage.getItem("lastlogin");
|
||||
if (lastlogin) {
|
||||
lastlogin = JSON.parse(lastlogin);
|
||||
$("#profile-img").attr("src", Backend.api.cdnurl(lastlogin.avatar));
|
||||
$("#profile-name").val(lastlogin.username);
|
||||
}
|
||||
|
||||
//让错误提示框居中
|
||||
Fast.config.toastr.positionClass = "toast-top-center";
|
||||
|
||||
//本地验证未通过时提示
|
||||
$("#login-form").data("validator-options", {
|
||||
invalid: function (form, errors) {
|
||||
$.each(errors, function (i, j) {
|
||||
Toastr.error(j);
|
||||
});
|
||||
},
|
||||
target: '#errtips'
|
||||
});
|
||||
|
||||
//为表单绑定事件
|
||||
Form.api.bindevent($("#login-form"), function (data) {
|
||||
localStorage.setItem("lastlogin", JSON.stringify({
|
||||
id: data.id,
|
||||
username: data.username,
|
||||
avatar: data.avatar
|
||||
}));
|
||||
location.href = Backend.api.fixurl(data.url);
|
||||
}, function (data) {
|
||||
$("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return Controller;
|
||||
});
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/blacklist/index' + location.search,
|
||||
add_url: 'kefu/blacklist/add',
|
||||
edit_url: 'kefu/blacklist/edit',
|
||||
del_url: 'kefu/blacklist/del',
|
||||
multi_url: 'kefu/blacklist/multi',
|
||||
table: 'kefu_blacklist',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('User_id')},
|
||||
{field: 'kefuuser.nickname', title: __('nickname'), operate: 'LIKE', placeholder: '模糊查找'},
|
||||
{field: 'fu_user_nickname', title: __('fu_user_nickname')},
|
||||
{field: 'admin.nickname', title: __('Admin_id'), operate: 'LIKE', placeholder: '模糊查找'},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+118
@@ -0,0 +1,118 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload'], function ($, undefined, Backend, Table, Form, Upload) {
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
search: true,
|
||||
advancedSearch: true,
|
||||
pagination: true,
|
||||
extend: {
|
||||
"index_url": "kefu/config/index",
|
||||
"add_url": "",
|
||||
"edit_url": "",
|
||||
"del_url": "",
|
||||
"multi_url": "",
|
||||
}
|
||||
});
|
||||
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
|
||||
$('input[name="row[csr_admin]"]').data("eSelect", function () {
|
||||
Controller.api.build_csr_config()
|
||||
});
|
||||
|
||||
$('input[name="row[csr_admin]"]').data("eTagRemove", function (data) {
|
||||
if (!Controller.selectPageReady) {
|
||||
Controller.selectPageReady = true;
|
||||
} else {
|
||||
Controller.api.build_csr_config()
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.run_config', function () {
|
||||
Fast.api.open("addon/config?name=kefu", __('Setting'));
|
||||
});
|
||||
|
||||
$('input[name="row[csr_distribution]"]').on('change', function (that) {
|
||||
var csr_distribution = $(that.target).val();
|
||||
var tis = '';
|
||||
|
||||
if (csr_distribution == 0) {
|
||||
tis = '按工作强度:优先分配给当前接待量最少的客服,若有多个客服接待量相同,则分配给其中最久未进行接待的客服';
|
||||
} else if (csr_distribution == 1) {
|
||||
tis = '智能分配:根据接待上限和当前接待量,分配给最能接待的客服';
|
||||
} else if (csr_distribution == 2) {
|
||||
tis = '轮流分配:每次都分配给最久未进行接待的客服';
|
||||
}
|
||||
|
||||
$('#distribution_help').html(tis);
|
||||
})
|
||||
},
|
||||
selectPageReady: false,
|
||||
api: {
|
||||
build_csr_config: function () {
|
||||
|
||||
var csr = $('input[name="row[csr_admin]"]').selectPageText();
|
||||
var csrs = csr.split(",");
|
||||
|
||||
for (var i = 0; i < csrs.length; i++) {
|
||||
Controller.api.build_csr_input(csrs[i]);
|
||||
}
|
||||
|
||||
// 删除-获取已构建的配置框
|
||||
var csr_config_list = $('#csr_config').children("div");
|
||||
var csr_config_length = $('#csr_config').children("div").length;
|
||||
|
||||
if (csrs.length) {
|
||||
|
||||
for (var i = 0; i < csr_config_length; i++) {
|
||||
let csr = $(csr_config_list[i]).data('name').toString();
|
||||
|
||||
if (csrs.indexOf(csr) == -1) {
|
||||
Controller.api.build_csr_input(csr, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i in csr_config_length) {
|
||||
let csr = $(csr_config_list[i]).data('name')
|
||||
Controller.api.build_csr_input(csr, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
build_csr_input: function (username, is_del = false) {
|
||||
|
||||
if (!username) {
|
||||
return;
|
||||
}
|
||||
|
||||
var csr_item = $('#csr_config').children("[data-name='" + username + "']");
|
||||
|
||||
if (is_del && csr_item.length) {
|
||||
// 删除
|
||||
csr_item.remove();
|
||||
return;
|
||||
} else if (csr_item.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var el = $('\
|
||||
<div data-name="' + username + '">\
|
||||
<div class="form-group">\
|
||||
<label class="control-label">' + username + ':</label>\
|
||||
<div class="input-group">\
|
||||
<div class="input-group-addon">接待上限</div>\
|
||||
<input class="form-control" name="row[csr_config][' + username + ']" placeholder="请输入接待上限人数" value="1" />\
|
||||
<div class="input-group-addon">人</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
');
|
||||
|
||||
$('#csr_config').append(el)//插入
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Controller;
|
||||
})
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/csrkpi/index' + location.search,
|
||||
add_url: 'kefu/csrkpi/add',
|
||||
edit_url: 'kefu/csrkpi/edit',
|
||||
del_url: 'kefu/csrkpi/del',
|
||||
multi_url: 'kefu/csrkpi/multi',
|
||||
table: 'kefu_csr_config',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin.nickname', title: __('Admin_id')},
|
||||
{field: 'ceiling', title: __('Ceiling'), sortable: true},
|
||||
{field: 'reception_count', title: __('Reception_count'), sortable: true},
|
||||
{field: 'sum_message_count', title: __('sum_message_count')},
|
||||
{field: 'sum_reception_count', title: __('sum_reception_count')},
|
||||
{
|
||||
field: 'last_reception_time',
|
||||
title: __('Last_reception_time'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime,
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'keep_alive',
|
||||
title: __('Keep Alive'),
|
||||
searchList: {"0": __('关'), "1": __('开')},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {
|
||||
"0": __('Status 0'),
|
||||
"1": __('Status 1'),
|
||||
"2": __('Status 2'),
|
||||
"3": __('Status 3')
|
||||
},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+144
@@ -0,0 +1,144 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/fastreply/index' + location.search,
|
||||
add_url: 'kefu/fastreply/add',
|
||||
edit_url: 'kefu/fastreply/edit',
|
||||
del_url: 'kefu/fastreply/del',
|
||||
multi_url: 'kefu/fastreply/multi',
|
||||
table: 'kefu_fast_reply',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin.nickname', title: __('Admin_id')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE', placeholder: '模糊查找'},
|
||||
{
|
||||
field: 'content',
|
||||
title: __('Content'),
|
||||
operate: 'LIKE',
|
||||
placeholder: '模糊查找',
|
||||
formatter: Controller.api.formatter.value_substring
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {"0": __('Status 0'), "1": __('Status 1')},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'kefu/fastreply/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'title', title: __('Title'), align: 'left'},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'kefu/fastreply/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'kefu/fastreply/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {
|
||||
value_substring: function (value) {
|
||||
let value_length = value.replace(/[\u0391-\uFFE5]/g, "aa").length;
|
||||
|
||||
return value_length > 20 ? value.substring(0, 20) + '...' : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+181
@@ -0,0 +1,181 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/kbs/index' + location.search,
|
||||
add_url: 'kefu/kbs/add',
|
||||
edit_url: 'kefu/kbs/edit',
|
||||
del_url: 'kefu/kbs/del',
|
||||
multi_url: 'kefu/kbs/multi',
|
||||
table: 'kefu_kbs',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'questions',
|
||||
title: __('Questions'),
|
||||
formatter: Controller.api.formatter.value_substring,
|
||||
operate: 'LIKE'
|
||||
},
|
||||
{field: 'match', title: __('Match')},
|
||||
{field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {"0": __('Status 0'), "1": __('Status 1'), "2": __('Status 2')},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'kefu/kbs/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'questions',
|
||||
title: __('Questions'),
|
||||
formatter: Controller.api.formatter.value_substring,
|
||||
operate: 'LIKE'
|
||||
},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'kefu/kbs/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'kefu/kbs/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
testmatch: function () {
|
||||
$('#str1, #str2').on('change', function () {
|
||||
Controller.api.test_match();
|
||||
})
|
||||
|
||||
$('.post_test_match').on('click', function () {
|
||||
Controller.api.test_match(true);
|
||||
})
|
||||
},
|
||||
api: {
|
||||
test_match: function (mandatory = false) {
|
||||
var str1 = $('#str1').val();
|
||||
var str2 = $('#str2').val();
|
||||
|
||||
if (str1 && str2) {
|
||||
$.post("kefu/kbs/testMatch", {
|
||||
'str1': str1,
|
||||
'str2': str2
|
||||
}, function (res) {
|
||||
if (res.code == 1) {
|
||||
$('.progress').show();
|
||||
$('#match').css('width', res.data + '%').html('匹配度:' + res.data + '%');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (mandatory) {
|
||||
layer.msg('请输入要计算匹配度的字符串!');
|
||||
}
|
||||
}
|
||||
},
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
|
||||
$('.test_match').on('click', function () {
|
||||
Backend.api.addtabs('kefu/kbs/testMatch', '匹配度测试');
|
||||
});
|
||||
},
|
||||
formatter: {
|
||||
value_substring: function (value) {
|
||||
let value_length = value.replace(/[\u0391-\uFFE5]/g, "aa").length;
|
||||
return value_length > 20 ? value.substring(0, 20) + '...' : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/leavemessage/index' + location.search,
|
||||
add_url: 'kefu/leavemessage/add',
|
||||
edit_url: 'kefu/leavemessage/edit',
|
||||
del_url: 'kefu/leavemessage/del',
|
||||
multi_url: 'kefu/leavemessage/multi',
|
||||
table: 'kefu_leave_message',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'kefuuser.avatar',
|
||||
title: __('Kefuuser.avatar'),
|
||||
events: Table.api.events.image,
|
||||
formatter: Table.api.formatter.image,
|
||||
operate: false
|
||||
},
|
||||
{
|
||||
field: 'kefuuser.nickname',
|
||||
title: __('Kefuuser.nickname'),
|
||||
operate: 'LIKE',
|
||||
placeholder: '模糊查找'
|
||||
},
|
||||
{field: 'fu_user_nickname', 'title': __('绑定用户'), operate: false},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE', placeholder: '模糊查找'},
|
||||
{field: 'contact', title: __('Contact')},
|
||||
{
|
||||
field: 'kefuuser.referrer',
|
||||
title: __('Kefuuser.referrer'),
|
||||
formatter: Controller.api.formatter.url
|
||||
},
|
||||
{
|
||||
field: 'message',
|
||||
title: __('Message'),
|
||||
operate: 'LIKE',
|
||||
placeholder: '模糊查找',
|
||||
formatter: Controller.api.formatter.value_substring
|
||||
},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatter: {
|
||||
value_substring: function (value) {
|
||||
let value_length = value.replace(/[\u0391-\uFFE5]/g, "aa").length;
|
||||
|
||||
return value_length > 20 ? value.substring(0, 20) + '...' : value;
|
||||
},
|
||||
url: function (value, row, index) {
|
||||
if (value) {
|
||||
value = value.split(' IP');
|
||||
return value[0] ? Table.api.formatter.url(value[0], row, index) : '';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+286
@@ -0,0 +1,286 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/record/index' + location.search,
|
||||
add_url: 'kefu/record/add',
|
||||
edit_url: 'kefu/record/edit',
|
||||
del_url: 'kefu/record/del',
|
||||
multi_url: 'kefu/record/multi',
|
||||
record_url: 'kefu/record/index/session_id/{session_id}',
|
||||
table: 'kefu_record',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'session_id', title: __('Session_id')},
|
||||
{
|
||||
field: 'sender_identity',
|
||||
title: __('Sender_identity'),
|
||||
searchList: {"0": __('Sender_identity 0'), "1": __('Sender_identity 1')},
|
||||
formatter: Table.api.formatter.normal,
|
||||
sortable: true
|
||||
},
|
||||
{field: 'sender_id', title: __('Sender_id'), sortable: true},
|
||||
{
|
||||
field: 'message_type',
|
||||
title: __('Message_type'),
|
||||
searchList: {
|
||||
"0": __('Message_type 0'),
|
||||
"1": __('Message_type 1'),
|
||||
"2": __('Message_type 2'),
|
||||
"3": __('Message_type 3'),
|
||||
"4": __('Message_type 4'),
|
||||
"5": __('Message_type 5')
|
||||
},
|
||||
formatter: Table.api.formatter.normal,
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'message',
|
||||
title: __('Message'),
|
||||
operate: 'LIKE',
|
||||
placeholder: '模糊查找',
|
||||
formatter: Controller.api.formatter.message
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {"0": __('Status 0'), "1": __('Status 1')},
|
||||
formatter: Table.api.formatter.status,
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime,
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'record',
|
||||
title: '只看该会话',
|
||||
classname: 'btn btn-xs btn-info btn-addtabs',
|
||||
icon: 'fa fa-file-text-o',
|
||||
url: $.fn.bootstrapTable.defaults.extend.record_url,
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
Controller.api.toolbar = Config.toolbar;
|
||||
},
|
||||
sessionrecord: function () {
|
||||
var session_id = Fast.api.query('session_id');
|
||||
Controller.api.toolbar = Config.toolbar;
|
||||
|
||||
Controller.api.loadRecord(session_id)
|
||||
|
||||
$(window).scroll(function (e) {
|
||||
|
||||
var scrollTop = $(this).scrollTop();
|
||||
var scrollHeight = $(document).height();
|
||||
var windowHeight = $(this).height();
|
||||
if (scrollTop + windowHeight == scrollHeight) {
|
||||
Controller.api.loadRecord(session_id)
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.record', function (e) {
|
||||
|
||||
var img_obj = $(e.target);
|
||||
if (img_obj.hasClass('emoji')) {
|
||||
return;
|
||||
}
|
||||
img_obj = img_obj[0];
|
||||
var scrollTop = $(window).scrollTop();
|
||||
|
||||
layer.photos({
|
||||
photos: {
|
||||
"title": "聊天图片预览",
|
||||
"id": "record",
|
||||
data: [
|
||||
{
|
||||
"src": img_obj.src
|
||||
}
|
||||
]
|
||||
}, end: function () {
|
||||
$(window).scrollTop(scrollTop)
|
||||
}, anim: 5
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
formatCard: function (message) {
|
||||
var message = message.split('#');
|
||||
var message_arr = [];
|
||||
for (let i in message) {
|
||||
let message_temp = message[i].split('=');
|
||||
if (typeof message_temp[1] != 'undefined') {
|
||||
message_arr[message_temp[0]] = message_temp[1];
|
||||
}
|
||||
}
|
||||
return message_arr;
|
||||
},
|
||||
formatter: {
|
||||
message: function (value, row, index) {
|
||||
if (row.message_type == 0 || row.message_type == 3) {
|
||||
|
||||
let value_length = value.replace(/[\u0391-\uFFE5]/g, "aa").length;
|
||||
return value_length > 20 ? value.substring(0, 20) + '...' : value;
|
||||
} else if (row.message_type == 2) {
|
||||
return Table.api.formatter.url(value, row, index);
|
||||
} else if (row.message_type == 1) {
|
||||
return Table.api.formatter.image(value, row, index);
|
||||
} else if (row.message_type == 4 || row.message_type == 5) {
|
||||
var message = Controller.api.formatCard(value);
|
||||
var card_url = (row.message_type == 4) ? Controller.api.toolbar.goods.card_url : Controller.api.toolbar.order.card_url
|
||||
card_url += '?ref=addtabs&id=' + message['id'];
|
||||
|
||||
return '<a class="btn-addtabs" href="' + card_url + '">查看</a>';
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
loadRecord: function (session_id) {
|
||||
|
||||
if (Controller.limit === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
Fast.api.ajax({
|
||||
url: 'kefu/record/sessionRecord',
|
||||
type: 'GET',
|
||||
dataType: "json",
|
||||
loading: true,
|
||||
data: {
|
||||
addtabs: 1,
|
||||
sort: 'id',
|
||||
order: 'asc',
|
||||
offset: Controller.offset,
|
||||
limit: Controller.limit,
|
||||
filter: '{"session_id":"' + session_id + '"}',
|
||||
op: '{"session_id":"="}',
|
||||
_: new Date().getTime()
|
||||
},
|
||||
success: function (ret) {
|
||||
var index = Layer.load(true);
|
||||
index && Layer.close(index);
|
||||
|
||||
Controller.offset += 10;
|
||||
// Controller.limit += 10;
|
||||
|
||||
if (ret.rows.length) {
|
||||
// 渲染到页面
|
||||
for (var i in ret.rows) {
|
||||
Controller.api.buildRecord(ret.rows[i])
|
||||
}
|
||||
|
||||
if (ret.rows.length < 10) {
|
||||
Controller.limit = false;
|
||||
}
|
||||
} else {
|
||||
Controller.limit = false;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
buildRecord: function (row) {
|
||||
var message = '';
|
||||
|
||||
row.createtime = Table.api.formatter.datetime(row.createtime)
|
||||
row.sender_identity = (row.sender_identity == 0) ? 'me' : 'you';
|
||||
|
||||
if (row.message_type == 1) {
|
||||
message = Controller.api.buildChatImg(row.message, '聊天图片', 'record');
|
||||
} else if (row.message_type == 2) {
|
||||
var file_name = row.message.split('.');
|
||||
var file_suffix = file_name[file_name.length - 1];
|
||||
message = Controller.api.buildChatA(row.message, file_suffix, 'record');
|
||||
} else if (row.message_type == 3) {
|
||||
Controller.api.buildPrompt(row.message);
|
||||
return;
|
||||
} else if (row.message_type == 4 || row.message_type == 5) {
|
||||
var message_arr = Controller.api.formatCard(row.message);
|
||||
|
||||
var card_url = (row.message_type == 4) ? Controller.api.toolbar.goods.card_url : Controller.api.toolbar.order.card_url
|
||||
card_url += '?ref=addtabs&id=' + message_arr['id'];
|
||||
|
||||
message = '<a class="btn-addtabs" href="' + card_url + '">\n' +
|
||||
' <div class="record_card">\n' +
|
||||
' <img src="' + message_arr['logo'] + '" />\n' +
|
||||
' <div class="record_card_body">\n' +
|
||||
' <div class="record_card_title">' + message_arr['subject'] + '</div>\n' +
|
||||
(message_arr['note'] ? '<div class="record_card_note">' + message_arr['note'] + '</div>\n' : '') +
|
||||
' <div class="record_card_price">\n' +
|
||||
(message_arr['price'] ? '<span>¥' + message_arr['price'] + '</span>\n' : '') +
|
||||
(message_arr['number'] ? '<span>x' + message_arr['number'] + '</span>\n' : '') +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </a>';
|
||||
} else {
|
||||
message = row.message;
|
||||
}
|
||||
|
||||
$('.chat').append('<div class="record_item">\
|
||||
<p><span class="user_name">' + row.sender_id + '</span> ' + row.createtime + ' </p>\
|
||||
<div class="bubble ' + row.sender_identity + '">' + message + '</div>\
|
||||
</div>');
|
||||
},
|
||||
buildChatA: function (filepath, file_suffix, class_name) {
|
||||
if (class_name == 'record') {
|
||||
return '<a target="_blank" class="' + class_name + '" href="' + filepath + '">点击下载:' + file_suffix + ' 文件</a>';
|
||||
} else {
|
||||
return '<a target="_blank" class="' + class_name + '" href="' + filepath + '">点击下载:' + file_suffix + ' 文件</a>';
|
||||
}
|
||||
},
|
||||
buildChatImg: function (filename, facename, class_name = 'emoji') {
|
||||
|
||||
return '<img class="' + class_name + '" title="' + facename + '" src="' + filename + '" />';
|
||||
},
|
||||
buildPrompt: function (data) {
|
||||
$('.chat').append('<div class="status"><span>' + data + '</span></div>');
|
||||
},
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/session/index' + location.search,
|
||||
add_url: 'kefu/session/add',
|
||||
edit_url: 'kefu/session/edit',
|
||||
del_url: 'kefu/session/del',
|
||||
multi_url: 'kefu/session/multi',
|
||||
record_url: 'kefu/record/sessionRecord/session_id/{ids}',
|
||||
table: 'kefu_session',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'kefuuser.nickname',
|
||||
title: __('Kefuuser.nickname'),
|
||||
operate: 'LIKE',
|
||||
placeholder: '模糊查找'
|
||||
},
|
||||
{field: 'fu_user_nickname', 'title': __('绑定用户'), operate: false},
|
||||
// {field: 'kefuuser.avatar', title: __('Kefuuser.avatar'),operate:false , events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'csr.nickname', title: __('Crs Nickname'), operate: 'LIKE', placeholder: '模糊查找'},
|
||||
// {field: 'csr_id', title: __('Csr_id')},
|
||||
{field: 'user_message_count', title: __('user_message_count'), operate: false},
|
||||
{field: 'csr_message_count', title: __('csr_message_count'), operate: false},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate', title: __('Operate'), table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'record',
|
||||
title: '审查聊天记录',
|
||||
classname: 'btn btn-xs btn-info btn-dialog',
|
||||
icon: 'fa fa-file-text-o',
|
||||
url: $.fn.bootstrapTable.defaults.extend.record_url,
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'kefu/session/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'kefu/session/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'kefu/session/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/toolbar/index' + location.search,
|
||||
add_url: 'kefu/toolbar/add',
|
||||
edit_url: 'kefu/toolbar/edit',
|
||||
del_url: 'kefu/toolbar/del',
|
||||
multi_url: 'kefu/toolbar/multi',
|
||||
table: 'kefu_toolbar',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
// {field: 'position', title: __('Position'), searchList: {"frontend":__('Position frontend'),"backend":__('Position backend'),"general":__('Position general')}, formatter: Table.api.formatter.flag, custom:{frontend: 'info', backend:'success', general:'warning'}},
|
||||
{field: 'mark', title: __('Mark')},
|
||||
{field: 'title', title: __('Title')},
|
||||
{
|
||||
field: 'icon_image',
|
||||
title: __('Icon_image'),
|
||||
events: Table.api.events.image,
|
||||
formatter: Table.api.formatter.image
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {"0": __('Status 0'), "1": __('Status 1')},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'kefu/toolbar/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'title', title: __('Title'), align: 'left'},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'kefu/toolbar/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'kefu/toolbar/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
var mark = $('#c-mark').val();
|
||||
if (mark == 'goods' || mark == 'order') {
|
||||
$('.data_api').show(200);
|
||||
$('#c-data_api').attr('placeholder', mark == 'goods' ? '请输入商品数据接口Url' : '请输入订单数据接口Url')
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'kefu/user/index' + location.search,
|
||||
add_url: 'kefu/user/add',
|
||||
edit_url: 'kefu/user/edit',
|
||||
del_url: 'kefu/user/del',
|
||||
multi_url: 'kefu/user/multi',
|
||||
table: 'kefu_user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
// {field: 'user_id', title: __('User_id')},
|
||||
{field: 'user.nickname', title: __('User_id')},
|
||||
// {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'nickname', title: __('Nickname')},
|
||||
{field: 'referrer', title: __('Referrer')},
|
||||
{field: 'contact', title: __('Contact')},
|
||||
{field: 'note', title: __('Note')},
|
||||
// {field: 'token', title: __('Token')},
|
||||
// {field: 'wechat_openid', title: __('Wechat_openid')},
|
||||
{
|
||||
field: 'createtime',
|
||||
title: __('Createtime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user