first commit
This commit is contained in:
@@ -0,0 +1,542 @@
|
||||
layui.define([], function (exports) {
|
||||
let element = layui.element;
|
||||
let $gouguApp = $("#GouguApp");
|
||||
let $gouguAppBody = $("#GouguAppBody");
|
||||
let $gouguMenuList = $("#menuList");
|
||||
let tab = {
|
||||
// tab动画加载效果
|
||||
loading: function() {
|
||||
let load = '<div class="tab-loading"><div class="tab-loader"></div></div>';
|
||||
let $iframe = $gouguAppBody.find('.gg-tab-page.layui-show iframe');
|
||||
if (!$iframe.next().length) {
|
||||
$iframe.parent().append(load);
|
||||
let tabLoad = $iframe.parent().find('.tab-loading');
|
||||
let tab_timestamp = $iframe.data('timestamp');
|
||||
let timestamp = new Date().getTime();
|
||||
//console.log(tab_timestamp);
|
||||
if(timestamp-tab_timestamp<666){
|
||||
$iframe.on('load', function() {
|
||||
tabLoad.fadeOut(666, function() {
|
||||
tabLoad.remove();
|
||||
});
|
||||
})
|
||||
}
|
||||
else{
|
||||
tabLoad.fadeOut(666, function() {
|
||||
tabLoad.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
//历史tab预加载
|
||||
tabTem: function (id, url, title) {
|
||||
element.tabAdd('gg-admin-tab', {
|
||||
id: id,
|
||||
url:url,
|
||||
title: '<span class="gg-tab-active"></span>' + title
|
||||
});
|
||||
$gouguAppBody.append('<div class="gg-tab-page" title="'+title+'" id="tabItem' + id + '" data-id="' + id + '" data-url="' + url + '"></div>');
|
||||
},
|
||||
/*新增一个Tab页面
|
||||
* @id,tab页面唯一标识,可是标签中data-id的属性值
|
||||
* @url,tab页面地址
|
||||
* @name,tab页面标题,
|
||||
*/
|
||||
tabAdd: function (id, url, title) {
|
||||
let thetabs = $('#pageTabUl').find('li');
|
||||
if (thetabs.length > 15) {
|
||||
layer.tips('点击LOGO快速关闭已开的TAB页面', $('.layui-logo'));
|
||||
}
|
||||
if (thetabs.length > 20) {
|
||||
layer.msg('你已打开了太多TAB页面了,请关闭部分TAB再使用');
|
||||
return false;
|
||||
}
|
||||
element.tabAdd('gg-admin-tab', {
|
||||
id: id,
|
||||
url:url,
|
||||
title: '<span class="gg-tab-active"></span>' + title
|
||||
});
|
||||
// 获取当前时间戳(毫秒数)
|
||||
let timestamp = new Date().getTime();
|
||||
$gouguAppBody.append('<div class="gg-tab-page" title="'+title+'" id="tabItem'+id+'" data-id="'+id +'"><iframe id="'+id+'" data-frameid="'+id+'" data-timestamp="'+timestamp+'" src="'+url+'" frameborder="0" align="left" width="100%" height="100%" scrolling="yes"></iframe></div>');
|
||||
this.tabChange(id);
|
||||
},
|
||||
//从子页面打开新的Tab页面,防止id重复,使用时间戳作为唯一标识
|
||||
sonAdd: function (url, title,id) {
|
||||
if ($(".layui-tab-title li[lay-id]").length <= 0) {
|
||||
//打开新的tab项
|
||||
this.tabAdd(id, url, title);
|
||||
} else {
|
||||
//否则判断该tab项是否以及存在
|
||||
let isHas = false;
|
||||
$.each($(".layui-tab-title li[lay-id]"), function () {
|
||||
//如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开
|
||||
if ($(this).attr("lay-id") == id) {
|
||||
isHas = true;
|
||||
$('[data-frameid="' + id + '"]').attr('src', url);
|
||||
//最后不管是否新增tab,最后都转到要打开的选项页面上
|
||||
tab.tabChange(id);
|
||||
}
|
||||
})
|
||||
if (isHas == false) {
|
||||
//标志为false 新增一个tab项
|
||||
tab.tabAdd(id, url, title);
|
||||
}
|
||||
}
|
||||
try {
|
||||
layer.close(window.openTips);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
},
|
||||
//根据传入的id传入到指定的tab项,并滚动定位
|
||||
tabChange: function (id) {
|
||||
element.tabChange('gg-admin-tab', id);
|
||||
},
|
||||
//删除tab页面
|
||||
tabDelete: function (id) {
|
||||
if (id == 0) {
|
||||
return;
|
||||
}
|
||||
element.tabDelete('gg-admin-tab', id);
|
||||
},
|
||||
/*删除所有tab页面
|
||||
*@ids 是一个数组,存放多个id,调用tabDelete方法分别删除
|
||||
*/
|
||||
tabDeleteAll: function (ids) {
|
||||
let that = this;
|
||||
$.each(ids, function (i, item) {
|
||||
that.tabDelete(item);
|
||||
})
|
||||
},
|
||||
//tab页面关闭自己,需要使用父iframe配合一起调用,如:parent.tab.sonClose();
|
||||
sonClose: function (id) {
|
||||
$('.layui-tab .layui-tab-title .layui-this i').click();
|
||||
},
|
||||
//滚动tab
|
||||
tabRoll: function (event, index) {
|
||||
let $tabTitle = $("#pageTabs .layui-tab-title"),
|
||||
$tabs = $tabTitle.children("li"),
|
||||
$outerWidth = ($tabTitle.prop("scrollWidth"), $tabTitle.outerWidth()),
|
||||
$left = parseFloat($tabTitle.css("left"));
|
||||
if ("left" === event) {
|
||||
if (!$left && $left <= 0){
|
||||
return;
|
||||
}
|
||||
let roll = -$left - $outerWidth;
|
||||
$tabs.each(function (item, i) {
|
||||
let $item = $(i),$itemleft = $item.position().left;
|
||||
if ($itemleft >= roll) {
|
||||
return $tabTitle.css("left", -$itemleft), false;
|
||||
}
|
||||
})
|
||||
} else "auto" === event ? ! function () {
|
||||
let $itemleft, $item = $tabs.eq(index);
|
||||
if ($item[0]) {
|
||||
if ($itemleft = $item.position().left, $itemleft < -$left) return $tabTitle.css("left", -$itemleft);
|
||||
if ($itemleft + $item.outerWidth() >= $outerWidth - $left) {
|
||||
let $diff = $itemleft + $item.outerWidth() - ($outerWidth - $left);
|
||||
$tabs.each(function (e, i) {
|
||||
let $tabitem = $(i),$tabitemleft = $tabitem.position().left;
|
||||
if ($tabitemleft + $left > 0 && $tabitemleft - $left > $diff) return $tabTitle.css("left", -$tabitemleft), false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}() : $tabs.each(function (item, i) {
|
||||
let $item = $(i),$itemleft = $item.position().left;
|
||||
if ($itemleft + $item.outerWidth() >= $outerWidth - $left) return $tabTitle.css("left", -$itemleft), false;
|
||||
})
|
||||
},
|
||||
tabFollow:function(id){
|
||||
$gouguMenuList.find('.side-menu-item').removeClass('layui-this');
|
||||
$gouguMenuList.find('dd').removeClass('layui-this').removeClass('layui-nav-itemed');
|
||||
$gouguMenuList.find('.menu-li').removeClass('layui-nav-itemed');
|
||||
$gouguMenuList.find('.gg-second-menu').removeClass('current');
|
||||
$('#GouguAppBody').removeClass('expand-menu');
|
||||
$('.side-menu-item').each(function (index,item){
|
||||
if($(item).data("id") == id) {
|
||||
//console.log(item);
|
||||
$(item).addClass('layui-this');
|
||||
$(item).parents('dd').addClass('layui-nav-itemed');
|
||||
$(item).parents('dl').addClass('current');
|
||||
|
||||
let $menuli = $(item).parents('.menu-li');
|
||||
$menuli.addClass('layui-nav-itemed');
|
||||
|
||||
// 展开菜单模式
|
||||
if ($('.layout-menu-expand').length) {
|
||||
$menuli.siblings().find('a').removeClass('layui-this');
|
||||
$menuli.children('a').addClass('layui-this');
|
||||
// 子级菜单
|
||||
$menuli.siblings().find('.gg-second-menu').removeClass('current');
|
||||
if ($menuli.children('.gg-second-menu').length) {
|
||||
$('#GouguAppBody').addClass('expand-menu');
|
||||
let second_menu = $(this).parent().parent();
|
||||
second_menu.removeClass('show-up');
|
||||
//console.log(second_menu.html());
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
refresh:function(id){
|
||||
if(parent.document.getElementById(id)){
|
||||
let src = parent.document.getElementById(id).contentWindow.location.href ? parent.document.getElementById(id).contentWindow.location.href : iframe.src;
|
||||
document.getElementById(id).src = src;
|
||||
}
|
||||
},
|
||||
tabCookie:function(){
|
||||
let thetabs = $('#pageTabUl').find('li'),tab_id = 0,tab_array=[];
|
||||
thetabs.each(function(index,item){
|
||||
let _id = $(item).attr('lay-id'),_url = $(item).attr('lay-url'),_title = $(item).text();
|
||||
if(_id>0){
|
||||
tab_array.push({'id':_id,'url':_url,'title':_title});
|
||||
}
|
||||
if($(item).hasClass('layui-this')){
|
||||
tab_id = _id;
|
||||
}
|
||||
})
|
||||
if(tab_array.length>0){
|
||||
let tabs_obj = {'tab_id':tab_id,'tab_array':tab_array};
|
||||
tab.setCookie('gougutab',JSON.stringify(tabs_obj));
|
||||
}
|
||||
else{
|
||||
tab.delCookie('gougutab');
|
||||
}
|
||||
},
|
||||
setCookie: function (name, value, days) {
|
||||
let expires = "";
|
||||
if (days) {
|
||||
let date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
}
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
},
|
||||
getCookie: function (name) {
|
||||
let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
|
||||
if (arr != null) {
|
||||
return unescape(arr[ 2 ]);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
delCookie: function (name) {
|
||||
this.setCookie(name, "", -1);
|
||||
},
|
||||
officeView:function (id,mode){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: 'OFFICE文件查看(当前使用的是微软官方的OFFICE接口,服务器需要连接外网才能查看)',
|
||||
id:'officeView',
|
||||
shadeClose: false,
|
||||
maxmin: false, //开启最大化最小化按钮
|
||||
area: ['100%', window.innerHeight+'px'],
|
||||
offset: 'b',
|
||||
//zIndex:2999,
|
||||
resize:false,
|
||||
anim: 2,
|
||||
scrollbar:false,
|
||||
//content: '/api/office/view?id='+id+'&mode='+mode,
|
||||
content: '/api/office/officeapps?id='+id+'&mode='+mode,
|
||||
cancel: function(index, layero, that){
|
||||
//layer.msg('文件在后台保存中,请稍再查看或下载...', {time: 3*1000});
|
||||
}
|
||||
});
|
||||
},
|
||||
pdfView:function (href){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: 'PDF文件查看(当前使用的是浏览器自身接口查看)',
|
||||
id:'pdfView',
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
maxmin: false, //开启最大化最小化按钮
|
||||
area: ['100%', window.innerHeight+'px'],
|
||||
offset: 'b',
|
||||
//zIndex:2999,
|
||||
resize:false,
|
||||
content: href
|
||||
});
|
||||
},
|
||||
videoView:function (href){
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '视频文件播放',
|
||||
id:'videoView',
|
||||
shadeClose: false,
|
||||
area: ['810px', '510px'],
|
||||
content: '<div style="padding:5px 5px 0"><video src="'+href+'" playsinline="" controls="true" style="width:800px; height:450px"></video></div>'
|
||||
});
|
||||
},
|
||||
audioView:function (href){
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '音频文件播放',
|
||||
id:'audioView',
|
||||
shadeClose: false,
|
||||
area: ['500px', '120px'],
|
||||
content: '<audio src="'+href+'" playsinline="" controls="true" style="width:500px; height:60px"></audio>'
|
||||
});
|
||||
},
|
||||
photoView:function (href){
|
||||
let photos = { "data": [{"src": href}]};
|
||||
layer.photos({
|
||||
photos: photos,
|
||||
anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
|
||||
});
|
||||
}
|
||||
};
|
||||
//切换tab
|
||||
element.on('tab(gg-admin-tab)', function (data) {
|
||||
let thisPage = $gouguAppBody.find('.gg-tab-page').eq(data.index);
|
||||
let id = thisPage.data('id');
|
||||
let url = thisPage.data('url');
|
||||
if(thisPage.find('iframe').length==0){
|
||||
// 获取当前时间戳(毫秒数)
|
||||
let timestamp = new Date().getTime();
|
||||
thisPage.html('<iframe id="'+id+'" data-frameid="'+id+'" data-timestamp="'+timestamp+'" src="'+url+'" frameborder="0" align="left" width="100%" height="100%" scrolling="yes"></iframe>');
|
||||
}
|
||||
tab.tabFollow(id);
|
||||
$gouguAppBody.find('.gg-tab-page').removeClass('layui-show');
|
||||
thisPage.addClass('layui-show');
|
||||
if(data.index==0){
|
||||
tab.refresh(0);
|
||||
}
|
||||
tab.loading();
|
||||
tab.tabRoll("auto", data.index);
|
||||
tab.tabCookie();
|
||||
});
|
||||
//删除tab
|
||||
element.on('tabDelete(gg-admin-tab)', function (data) {
|
||||
$gouguAppBody.find('.gg-tab-page').eq(data.index).remove();
|
||||
tab.tabRoll("auto", data.index);
|
||||
tab.tabCookie();
|
||||
});
|
||||
|
||||
//右滚动tab
|
||||
$('[gg-event="tabRollRight"]').click(function () {
|
||||
tab.tabRoll("right");
|
||||
})
|
||||
//左滚动tab
|
||||
$('[gg-event="tabRollLeft"]').click(function () {
|
||||
tab.tabRoll("left");
|
||||
})
|
||||
|
||||
//关闭全部tab,只保留首页
|
||||
$gouguApp.on('click', '[gg-event="closeAllTabs"]', function () {
|
||||
let thetabs = $('#pageTabs .layui-tab-title').find('li'), ids = [];
|
||||
for (let i = 0; i < thetabs.length; i++) {
|
||||
let id = thetabs.eq(i).attr('lay-id');
|
||||
ids.push(id);
|
||||
}
|
||||
tab.tabDeleteAll(ids);
|
||||
return false;
|
||||
})
|
||||
|
||||
//关闭其他tab
|
||||
$gouguApp.on('click', '[gg-event="closeOtherTabs"]', function () {
|
||||
let thetabs = $('#pageTabs .layui-tab-title').find('li'), ids = [];
|
||||
let thisid = $('#pageTabs .layui-tab-title').find('.layui-this').attr('lay-id');
|
||||
for (let i = 0; i < thetabs.length; i++) {
|
||||
let id = thetabs.eq(i).attr('lay-id');
|
||||
if (id != thisid) {
|
||||
ids.push(id);
|
||||
}
|
||||
}
|
||||
tab.tabDeleteAll(ids);
|
||||
return false;
|
||||
})
|
||||
|
||||
//关闭当前tab
|
||||
$gouguApp.on('click', '[gg-event="closeThisTabs"]', function () {
|
||||
let thisid = $('#pageTabs .layui-tab-title').find('.layui-this').attr('lay-id');
|
||||
tab.tabDelete(thisid);
|
||||
return false;
|
||||
})
|
||||
|
||||
//当点击有side-menu-item属性的标签时,即左侧菜单栏中内容 ,触发tab
|
||||
$('body').on('click', 'a.side-menu-item', function () {
|
||||
let that = $(this);
|
||||
let url = that.data("href"), id = that.data("id"), title = that.data("title");
|
||||
if (url == '' || url == '/') {
|
||||
return false;
|
||||
}
|
||||
//这时会判断右侧.layui-tab-title属性下的有lay-id属性的li的数目,即已经打开的tab项数目
|
||||
//$('.site-menu-active').removeClass('layui-this');
|
||||
//that.addClass('layui-this');
|
||||
//$gouguApp.removeClass('side-spread-sm');
|
||||
if ($(".layui-tab-title li[lay-id]").length <= 0) {
|
||||
//打开新的tab项
|
||||
tab.tabAdd(id, url, title);
|
||||
} else {
|
||||
//否则判断该tab项是否以及存在
|
||||
let isHas = false;
|
||||
$.each($(".layui-tab-title li[lay-id]"), function () {
|
||||
//如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开
|
||||
if ($(this).attr("lay-id") == id) {
|
||||
isHas = true;
|
||||
$('[data-frameid="' + id + '"]').attr('src', url);
|
||||
//最后不管是否新增tab,最后都转到要打开的选项页面上
|
||||
tab.tabChange(id);
|
||||
}
|
||||
})
|
||||
if (isHas == false) {
|
||||
//标志为false 新增一个tab项
|
||||
tab.tabAdd(id, url, title);
|
||||
}
|
||||
}
|
||||
try {
|
||||
layer.close(window.openTips);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
//左侧菜单展开&收缩
|
||||
$gouguApp.on('click', '[gg-event="shrink"]', function () {
|
||||
let that_i = $(this).children('i');
|
||||
if (that_i.hasClass("layui-icon-shrink-right")) {
|
||||
that_i.removeClass("layui-icon-shrink-right").addClass("layui-icon-spread-left");
|
||||
}
|
||||
else{
|
||||
that_i.removeClass("layui-icon-spread-left").addClass("layui-icon-shrink-right");
|
||||
}
|
||||
$gouguApp.toggleClass('side-spread');
|
||||
})
|
||||
/*
|
||||
$gouguApp.on('click', '[gg-event="shade"]', function () {
|
||||
$gouguApp.removeClass('side-spread-sm');
|
||||
})
|
||||
*/
|
||||
|
||||
//左上角清除缓存
|
||||
$gouguApp.on('click', '[gg-event="cache"]', function (e) {
|
||||
let that = $(this);
|
||||
let url = $(this).data('href');
|
||||
if (that.attr('class') === 'clearThis') {
|
||||
layer.tips('正在努力清理中...', this);
|
||||
return false;
|
||||
}
|
||||
layer.tips('正在清理系统缓存...', this);
|
||||
that.attr('class', 'clearThis');
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function (res) {
|
||||
if (res.code == 1) {
|
||||
setTimeout(function () {
|
||||
that.attr('class', '');
|
||||
layer.tips(res.msg, that);
|
||||
}, 1000)
|
||||
} else {
|
||||
layer.tips(res.msg, that);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//右上角刷新当前tab页面
|
||||
$gouguApp.on('click', '[gg-event="refresh"]', function () {
|
||||
let that = $(this);
|
||||
if (that.hasClass("refreshThis")) {
|
||||
that.removeClass("refreshThis");
|
||||
let iframe = $(".gg-tab-page.layui-show").find("iframe")[0];
|
||||
if (iframe) {
|
||||
tab.refresh(iframe.id);
|
||||
}
|
||||
setTimeout(function () {
|
||||
that.attr("class", "refreshThis");
|
||||
}, 2000)
|
||||
} else {
|
||||
layer.tips("每2秒只可刷新一次", this, {
|
||||
tips: 1
|
||||
});
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
//右上角全屏&退出全屏
|
||||
$gouguApp.on("click", ".fullScreen", function () {
|
||||
if ($(this).hasClass("layui-icon-screen-restore")) {
|
||||
screenFun(2).then(function () {
|
||||
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
||||
});
|
||||
} else {
|
||||
screenFun(1).then(function () {
|
||||
$(".fullScreen").eq(0).addClass("layui-icon-screen-restore");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//小菜单展现多级菜单
|
||||
$gouguApp.on("mouseenter", ".layui-nav-tree .menu-li", function () {
|
||||
let tips = $(this).prop("innerHTML");
|
||||
if ($gouguApp.hasClass('side-spread') && tips) {
|
||||
tips = "<ul class='layuimini-menu-left-zoom layui-nav layui-nav-tree layui-this'><li class='layui-nav-item layui-nav-itemed'>" + tips + "</li></ul>";
|
||||
window.openTips = layer.tips(tips, $(this), {
|
||||
tips: [2, '#2f4056'],
|
||||
time: 300000,
|
||||
skin: "popup-tips",
|
||||
success: function (el) {
|
||||
let left = $(el).position().left - 10;
|
||||
$(el).addClass('side-layout').css({ left: left });
|
||||
element.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("mouseleave", ".popup-tips", function () {
|
||||
try {
|
||||
layer.close(window.openTips);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
function screenFun(num) {
|
||||
num = num || 1;
|
||||
num = num * 1;
|
||||
let docElm = document.documentElement;
|
||||
switch (num) {
|
||||
case 1:
|
||||
if (docElm.requestFullscreen) {
|
||||
docElm.requestFullscreen();
|
||||
} else if (docElm.mozRequestFullScreen) {
|
||||
docElm.mozRequestFullScreen();
|
||||
} else if (docElm.webkitRequestFullScreen) {
|
||||
docElm.webkitRequestFullScreen();
|
||||
} else if (docElm.msRequestFullscreen) {
|
||||
docElm.msRequestFullscreen();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return new Promise(function (res, rej) {
|
||||
res("返回值");
|
||||
});
|
||||
}
|
||||
|
||||
function isFullscreen() {
|
||||
return document.fullscreenElement ||
|
||||
document.msFullscreenElement ||
|
||||
document.mozFullScreenElement ||
|
||||
document.webkitFullscreenElement || false;
|
||||
}
|
||||
|
||||
window.onresize = function () {
|
||||
if (!isFullscreen()) {
|
||||
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
||||
}
|
||||
}
|
||||
exports('admin', tab);
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,35 @@
|
||||
layui.define([], function (exports) {
|
||||
var MOD_NAME = 'excel';
|
||||
var modFile = layui.cache.modules['excel'];
|
||||
var modPath = modFile.substr(0, modFile.lastIndexOf('.'));
|
||||
var settings = {
|
||||
name: '表格'
|
||||
};
|
||||
var excel = {
|
||||
init: function (tableId, options) {
|
||||
loadScript();
|
||||
var opts = $.extend({}, settings, options);
|
||||
$('#'+tableId).table2excel({
|
||||
name: opts.name,
|
||||
filename: opts.name + new Date().getTime() + ".xls",
|
||||
exclude: ".noExl",
|
||||
exclude_img: false,
|
||||
exclude_links: false,
|
||||
exclude_inputs: false,
|
||||
preserveColors:true
|
||||
});
|
||||
}
|
||||
}
|
||||
function loadScript() {
|
||||
if (typeof table2excel == 'undefined') {
|
||||
$.ajax({ //获取插件
|
||||
url: modPath + '/table2excel.js' ,
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
async: false
|
||||
});
|
||||
}
|
||||
}
|
||||
loadScript();
|
||||
exports(MOD_NAME, excel);
|
||||
});
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* jQuery table2excel - v1.1.2
|
||||
* jQuery plugin to export an .xls file in browser from an HTML table
|
||||
* https://github.com/rainabba/jquery-table2excel
|
||||
*
|
||||
* Made by rainabba
|
||||
* Under MIT License
|
||||
*/
|
||||
(function ($, window, document, undefined) {
|
||||
var pluginName = "table2excel",
|
||||
defaults = {
|
||||
exclude: ".noExl",
|
||||
name: "Table2Excel",
|
||||
filename: "table2excel",
|
||||
fileext: ".xls",
|
||||
exclude_img: true,
|
||||
exclude_links: true,
|
||||
exclude_inputs: true,
|
||||
preserveColors: true,
|
||||
subtotal: 0,//"合计"行所在的行号(不包括标题行),0表示没有合计行...
|
||||
width: 50,//表格宽度百分比,默认100%
|
||||
trHeight:32,//表格行高,默认32px
|
||||
thBackgroundColor:"#eeeeee"//TH背景色
|
||||
};
|
||||
//插件配置
|
||||
function Plugin(element, options) {
|
||||
this.element = element;
|
||||
this.settings = $.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
Plugin.prototype = {
|
||||
init: function () {
|
||||
var e = this;
|
||||
var w = getWidth(e.settings);//导出EXCEL表格的宽度,默认100%
|
||||
var utf8Heading = "<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=UTF-8\">";
|
||||
e.template = {
|
||||
head: "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">" + utf8Heading + "<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>",
|
||||
sheet: {
|
||||
head: "<x:ExcelWorksheet><x:Name>",
|
||||
tail: "</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"
|
||||
},
|
||||
mid: "</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>",
|
||||
table: {
|
||||
head: " <table border='1' style='width:" + w + "%;'>",//<table>的边框&宽度
|
||||
tail: " </table>"
|
||||
},
|
||||
foot: "</body></html>"
|
||||
};
|
||||
e.tableRows = [];
|
||||
|
||||
//读取原始表
|
||||
var rowNumber = 0;//行号
|
||||
$(e.element).each(function (i, o) {
|
||||
var tempRows = "";//table的html
|
||||
$(o).find("tr").not(e.settings.exclude).each(function (i, p) {
|
||||
//<tr>的样式
|
||||
var trStyles = "height:"+e.settings.trHeight+"px;";//整行样式
|
||||
//开始创建一行表格
|
||||
tempRows += "<tr align='center' style='" + trStyles + "'>";//内容居中:align='center'
|
||||
|
||||
//读取原始<table>的<th>表头行(表头必须是<th>!表头如果是<td>的话则会当做普通数据行处理...)
|
||||
$(p).find("th").not(e.settings.exclude).each(function (i, q) {
|
||||
//<th>的样式:
|
||||
var thStyles = "background-color: "+e.settings.thBackgroundColor+";";
|
||||
var rc = {
|
||||
rows: $(this).attr("rowspan"),
|
||||
cols: $(this).attr("colspan"),
|
||||
flag: $(q).find(e.settings.exclude)
|
||||
};
|
||||
if (rc.flag.length > 0) {
|
||||
tempRows += "<td> </td>"; //空格!
|
||||
} else {
|
||||
tempRows += "<td";
|
||||
if (rc.rows > 0) {
|
||||
tempRows += " rowspan='" + rc.rows + "' ";//跨行
|
||||
}
|
||||
if (rc.cols > 0) {
|
||||
tempRows += " colspan='" + rc.cols + "' ";//跨列
|
||||
}
|
||||
if (thStyles) {
|
||||
tempRows += " style='" + thStyles + "'";//样式
|
||||
}
|
||||
tempRows += ">" + $(q).html() + "</td>";//内容
|
||||
}
|
||||
});
|
||||
|
||||
//读取原始<table>的<td>数据行
|
||||
$(p).find("td").not(e.settings.exclude).each(function (i, q) {
|
||||
// Reset for this column
|
||||
additionalStyles = "";
|
||||
// Preserve background and text colors on the row
|
||||
if(e.settings.preserveColors){
|
||||
let compStyle = getComputedStyle(q);
|
||||
additionalStyles += (compStyle && compStyle.backgroundColor ? "background-color: " + compStyle.backgroundColor + ";" : "");
|
||||
additionalStyles += (compStyle && compStyle.color ? "color: " + compStyle.color + ";" : "");
|
||||
}
|
||||
|
||||
//<td>的样式
|
||||
var tdStyles = "background-color:#8DB4E2;";//合计行的样式
|
||||
var rc = {
|
||||
rows: $(this).attr("rowspan"),
|
||||
cols: $(this).attr("colspan"),
|
||||
align:$(this).attr("align"),
|
||||
flag: $(q).find(e.settings.exclude)
|
||||
};
|
||||
var align='';
|
||||
if( rc.align && rc.align.length > 1 ) {
|
||||
align =' align="'+rc.align+'" valign="center" ';
|
||||
}
|
||||
if (rc.flag.length > 0) {
|
||||
tempRows += "<td "+align+"> </td>"; //空格!
|
||||
} else {
|
||||
tempRows += "<td "+align;
|
||||
if (rc.rows > 0) {
|
||||
tempRows += " rowspan='" + rc.rows + "' ";//跨行
|
||||
}
|
||||
if (rc.cols > 0) {
|
||||
tempRows += " colspan='" + rc.cols + "' ";//跨列
|
||||
}
|
||||
var subtotal = getSubtotal(e.settings);//获取"合计"行所在的行号(不包括标题行)
|
||||
if (rowNumber == subtotal) {//if(当前行行号 == 合计行行号)
|
||||
if (tdStyles) {
|
||||
tempRows += " style='mso-number-format:\"\@\"; " + tdStyles + "' ";//样式
|
||||
}
|
||||
else {
|
||||
tempRows += " style='mso-number-format:\"\@\";' ";//纯文本
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(additionalStyles!=''){
|
||||
tempRows += " style='" + additionalStyles + "'";
|
||||
}
|
||||
else{
|
||||
tempRows += " style='mso-number-format:\"\@\";' ";//纯文本
|
||||
}
|
||||
}
|
||||
tempRows += ">" + $(q).html() + "</td>";
|
||||
}
|
||||
});
|
||||
tempRows += "</tr>";//生成一行结束
|
||||
rowNumber++;//行号+1
|
||||
});
|
||||
// exclude img tags
|
||||
if (e.settings.exclude_img) {
|
||||
tempRows = exclude_img(tempRows);
|
||||
}
|
||||
// exclude link tags
|
||||
if (e.settings.exclude_links) {
|
||||
tempRows = exclude_links(tempRows);
|
||||
}
|
||||
// exclude input tags
|
||||
if (e.settings.exclude_inputs) {
|
||||
tempRows = exclude_inputs(tempRows);
|
||||
}
|
||||
e.tableRows.push(tempRows);
|
||||
});
|
||||
e.tableToExcel(e.tableRows, e.settings.name, e.settings.sheetName);
|
||||
},
|
||||
tableToExcel: function (table, name, sheetName) {
|
||||
var e = this, fullTemplate = "", i, link, a;
|
||||
e.format = function (s, c) {
|
||||
return s.replace(/{(\w+)}/g, function (m, p) {
|
||||
return c[p];
|
||||
});
|
||||
};
|
||||
sheetName = typeof sheetName === "undefined" ? "Sheet" : sheetName;
|
||||
e.ctx = {
|
||||
worksheet: name || "Worksheet",
|
||||
table: table,
|
||||
sheetName: sheetName
|
||||
};
|
||||
fullTemplate = e.template.head;
|
||||
if ($.isArray(table)) {
|
||||
Object.keys(table).forEach(function (i) {
|
||||
//fullTemplate += e.template.sheet.head + "{worksheet" + i + "}" + e.template.sheet.tail;
|
||||
fullTemplate += e.template.sheet.head + sheetName + i + e.template.sheet.tail;
|
||||
});
|
||||
}
|
||||
fullTemplate += e.template.mid;
|
||||
if ($.isArray(table)) {
|
||||
Object.keys(table).forEach(function (i) {
|
||||
fullTemplate += e.template.table.head + "{table" + i + "}" + e.template.table.tail;
|
||||
});
|
||||
}
|
||||
fullTemplate += e.template.foot;
|
||||
for (i in table) {
|
||||
e.ctx["table" + i] = table[i];
|
||||
}
|
||||
delete e.ctx.table;
|
||||
var isIE = navigator.appVersion.indexOf("MSIE 10") !== -1 || (navigator.userAgent.indexOf("Trident") !== -1 && navigator.userAgent.indexOf("rv:11") !== -1); // this works with IE10 and IE11 both :)
|
||||
//if (typeof msie !== "undefined" && msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // this works ONLY with IE 11!!!
|
||||
if (isIE) {
|
||||
if (typeof Blob !== "undefined") {
|
||||
//use blobs if we can
|
||||
fullTemplate = e.format(fullTemplate, e.ctx); // with this, works with IE
|
||||
fullTemplate = [fullTemplate];
|
||||
//convert to array
|
||||
var blob1 = new Blob(fullTemplate, { type: "text/html" });
|
||||
window.navigator.msSaveBlob(blob1, getFileName(e.settings));
|
||||
} else {
|
||||
//otherwise use the iframe and save
|
||||
//requires a blank iframe on page called txtArea1
|
||||
txtArea1.document.open("text/html", "replace");
|
||||
txtArea1.document.write(e.format(fullTemplate, e.ctx));
|
||||
txtArea1.document.close();
|
||||
txtArea1.focus();
|
||||
sa = txtArea1.document.execCommand("SaveAs", true, getFileName(e.settings));
|
||||
}
|
||||
|
||||
} else {
|
||||
var blob = new Blob([e.format(fullTemplate, e.ctx)], { type: "application/vnd.ms-excel" });
|
||||
window.URL = window.URL || window.webkitURL;
|
||||
link = window.URL.createObjectURL(blob);
|
||||
a = document.createElement("a");
|
||||
a.download = getFileName(e.settings);
|
||||
a.href = link;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//获取excel文件名
|
||||
function getFileName(settings) {
|
||||
return (settings.filename ? settings.filename : "table2excel");
|
||||
}
|
||||
//获取"合计"行所在的行号(不包括标题行)
|
||||
function getSubtotal(settings) {
|
||||
return (settings.subtotal ? settings.subtotal : 0);//默认值0
|
||||
}
|
||||
//导出Excel的表格宽度百分比的值(不含%号),默认100%
|
||||
function getWidth(settings) {
|
||||
return (settings.width ? settings.width : 100);
|
||||
}
|
||||
// Removes all img tags
|
||||
function exclude_img(string) {
|
||||
var _patt = /(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;
|
||||
return string.replace(/<img[^>]*>/gi, function myFunction(x) {
|
||||
var res = _patt.exec(x);
|
||||
if (res !== null && res.length >= 2) {
|
||||
return res[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
// Removes all link tags
|
||||
function exclude_links(string) {
|
||||
return string.replace(/<a[^>]*>|<\/a>/gi, "");
|
||||
}
|
||||
// Removes input params
|
||||
function exclude_inputs(string) {
|
||||
var _patt = /(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;
|
||||
return string.replace(/<input[^>]*>|<\/input>/gi, function myFunction(x) {
|
||||
var res = _patt.exec(x);
|
||||
if (res !== null && res.length >= 2) {
|
||||
return res[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
$.fn[pluginName] = function (options) {
|
||||
var e = this;
|
||||
e.each(function () {
|
||||
if (!$.data(e, "plugin_" + pluginName)) {
|
||||
$.data(e, "plugin_" + pluginName, new Plugin(this, options));
|
||||
}
|
||||
});
|
||||
// chain jQuery functions
|
||||
return e;
|
||||
};
|
||||
})(jQuery, window, document);
|
||||
@@ -0,0 +1,174 @@
|
||||
/* formSelects多选css */
|
||||
select[xm-select]{display: none !important;}
|
||||
.xm-select-parent * {margin: 0;padding: 0;font-family: "Helvetica Neue", Helvetica, "PingFang SC", 微软雅黑, Tahoma, Arial, sans-serif; box-sizing: initial;}
|
||||
.xm-select-parent {text-align: left;}
|
||||
.xm-select-parent select {display: none;}
|
||||
.xm-select-parent .xm-select-title {position: relative;min-height: 36px;}
|
||||
.xm-select-parent .xm-input {cursor: pointer;border-radius: 2px;border-width: 1px;border-style: solid;border-color: #E6E6E6;display: block;width: 100%;box-sizing: border-box;background-color: #FFF;height: 36px;line-height: 1.3;padding-left: 10px;outline: 0}
|
||||
.xm-select-parent .xm-select-sj {display: inline-block;width: 0;height: 0;border-style: dashed;border-color: transparent;overflow: hidden;position: absolute;right: 10px;top: 50%;margin-top: -3px;cursor: pointer;border-width: 6px;border-top-color: #C2C2C2;border-top-style: solid;transition: all .3s;-webkit-transition: all .3s}
|
||||
.xm-select-parent .xm-form-selected .xm-select-sj {margin-top: -9px;transform: rotate(180deg)}
|
||||
.xm-select-parent .xm-form-select dl {display: none;position: absolute;left: 0;top: 42px;padding: 5px 0;z-index: 999;min-width: 100%;border: 1px solid #d2d2d2;max-height: 300px;overflow-y: auto;background-color: #fff;border-radius: 2px;box-shadow: 0 2px 4px rgba(0, 0, 0, .12);box-sizing: border-box;animation-fill-mode: both;-webkit-animation-name: layui-upbit;animation-name: layui-upbit;-webkit-animation-duration: .3s;animation-duration: .3s;-webkit-animation-fill-mode: both;animation-fill-mode: both}
|
||||
@-webkit-keyframes layui-upbit {
|
||||
from {-webkit-transform: translate3d(0, 30px, 0);opacity: .3}
|
||||
to {-webkit-transform: translate3d(0, 0, 0);opacity: 1}
|
||||
}
|
||||
@keyframes layui-upbit {
|
||||
from {transform: translate3d(0, 30px, 0);opacity: .3}
|
||||
to {transform: translate3d(0, 0, 0);opacity: 1}
|
||||
}
|
||||
.xm-select-parent .xm-form-selected dl {display: block}
|
||||
.xm-select-parent .xm-form-select dl dd,.xm-select-parent .xm-form-select dl dt {padding: 0 10px;line-height: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis}
|
||||
.xm-select-parent .xm-form-select dl dd {cursor: pointer;height: 30px;}
|
||||
.xm-select-parent .xm-form-select dl dd:hover {background-color: #f2f2f2}
|
||||
.xm-select-parent .xm-form-select dl dt {font-size: 12px;color: #999}
|
||||
.layui-select-disabled .xm-dis-disabled {border-color: #eee!important}
|
||||
.xm-select-parent .xm-form-select dl .xm-select-tips {padding-left: 10px!important;color: #999;font-size: 14px}
|
||||
.xm-unselect {-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none}
|
||||
|
||||
.xm-form-checkbox {position: relative;display: block;vertical-align: middle;cursor: pointer;font-size: 0;-webkit-transition: .1s linear;transition: .1s linear;box-sizing: border-box;height: auto!important;line-height: normal!important;border: none!important;margin-right: 0;padding-right: 0;background: 0 0;}
|
||||
.xm-form-checkbox > i {color: #FFF; font-size: 14px; width: 14px; height: 14px; position: absolute; top: 7px; border: 1px solid #5FB878; border-radius: 2px; z-index: 2;}
|
||||
.xm-form-checkbox:hover > i {border-color: #5FB878;}
|
||||
.xm-form-checkbox > span{display: block;position: relative;padding: 0 15px 0 30px;height: 100%;font-size: 14px;border-radius: 2px 0 0 2px;background-color: #d2d2d2;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;background: 0 0;color: #666;line-height: 30px;}
|
||||
|
||||
.xm-select-parent dl{width: 100%;}
|
||||
.xm-select-parent dl dd{position: relative;}
|
||||
.xm-select-parent dl dd > i:not(.icon-sousuo){position: absolute; right: 10px; top: 2px; color: #AAAAAA;}
|
||||
.xm-select-parent dl dd.xm-select-this div i {border: none; color: #009688; font-size: 18px;}
|
||||
.xm-select-parent dl dd.xm-select-this div i:after{content: '\e613';}
|
||||
.xm-select-parent dl dd.xm-dis-disabled div i {border-color: #C2C2C2;}
|
||||
.xm-select-parent dl dd.xm-dis-disabled.xm-select-this div i {color: #C2C2C2;}
|
||||
.xm-select-radio div.xm-form-checkbox > i {border-radius: 20px;}
|
||||
.xm-select-parent dl.xm-select-radio dd.xm-select-this div i:after{content: '\e62b';}
|
||||
|
||||
.xm-dis-disabled,.xm-dis-disabled:hover {cursor: not-allowed!important}
|
||||
.xm-form-select dl dd.xm-dis-disabled {background-color: #fff!important}
|
||||
.xm-form-select dl dd.xm-dis-disabled span {color: #C2C2C2}
|
||||
.xm-form-select dl dd.xm-dis-disabled .xm-icon-yes {border-color: #C2C2C2}
|
||||
.xm-select-parent {position: relative;-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none}
|
||||
.xm-select-parent .xm-select {line-height: normal;height: auto;padding: 4px 10px 1px 10px;overflow: hidden;min-height: 36px;left: 0;z-index: 99;position: absolute;background: 0 0;padding-right: 20px}
|
||||
.xm-select-parent .xm-select:hover {border-color: #C0C4CC}
|
||||
.xm-select-parent .xm-select .xm-select-label {display: inline-block;margin: 0;vertical-align: middle}
|
||||
.xm-select-parent .xm-select-title div.xm-select-label>span {position: relative;padding: 2px 5px;background-color: #009688;border-radius: 2px;color: #FFF;display: inline-block;line-height: 18px;height: 18px;margin: 2px 5px 2px 0;cursor: initial;user-select: none;font-size: 14px;padding-right: 25px;-webkit-user-select: none;}
|
||||
.xm-select-parent .xm-select-title div.xm-select-label>span i {position: absolute; margin-left: 8px; font-size: 12px; cursor: pointer; line-height: 20px;}
|
||||
.xm-select-parent .xm-select .xm-select-input {border: none;height: 28px;background-color: transparent;padding: 0;vertical-align: middle;display: inline-block;width: 50px}
|
||||
.xm-select-parent .xm-select--suffix input {border: none}
|
||||
.xm-form-selected .xm-select,.xm-form-selected .xm-select:hover {border-color: #009688!important}
|
||||
.xm-select--suffix+div {position: absolute;top: 0;left: 0;bottom: 0;right: 0}
|
||||
.xm-select-dis .xm-select--suffix+div {z-index: 100;cursor: no-drop!important;opacity: .2;background-color: #FFF;}
|
||||
.xm-select-disabled,.xm-select-disabled:hover {color: #d2d2d2!important;cursor: not-allowed!important;background-color: #fff}
|
||||
.xm-select-none {display: none;margin: 5px 0;text-align: center;}
|
||||
.xm-select-none:hover {background-color: #FFF!important}
|
||||
.xm-select-empty {display: block}
|
||||
.xm-span-hide {display: none!important;}
|
||||
.layui-form-pane .xm-select,.layui-form-pane .xm-select:hover {border: none!important;top: 0px}
|
||||
.layui-form-pane .xm-select-title {border: 1px solid #e6e6e6!important}
|
||||
.xm-select-hide {display: none !important;}
|
||||
div[xm-hg] .xm-select-label{white-space: nowrap; overflow: hidden; position: absolute; right: 30px; left: 0; padding-left: 10px;}
|
||||
|
||||
/* 颜色相关 */
|
||||
div[xm-select-skin] .xm-select-title div.xm-select-label>span {border: 1px solid #009688}
|
||||
div[xm-select-skin] .xm-select-title div.xm-select-label>span i:hover {opacity: .8;filter: alpha(opacity=80);cursor: pointer}
|
||||
div[xm-select-skin=default] .xm-select-title div.xm-select-label>span {background-color: #F0F2F5;color: #909399;border: 1px solid #F0F2F5}
|
||||
div[xm-select-skin=default] .xm-select-title div.xm-select-label>span i {color: #C0C4CC}
|
||||
div[xm-select-skin=default] .xm-select-title div.xm-select-label>span i:before {content: '\e60b'; font-size: 14px; margin-left: -3px;}
|
||||
div[xm-select-skin=default] dl dd:not(.xm-dis-disabled) i {border-color: #5FB878}
|
||||
div[xm-select-skin=default] dl dd.xm-select-this:not(.xm-dis-disabled) i {color: #5FB878}
|
||||
div[xm-select-skin=default].xm-form-selected .xm-select,div[xm-select-skin=default].xm-form-selected .xm-select:hover {border-color: #C0C4CC!important}
|
||||
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span {background-color: #009688;color: #FFF;border: 1px solid #009688}
|
||||
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span i {background-color: #009688; color: #FFF}
|
||||
div[xm-select-skin=primary] dl dd:not(.xm-dis-disabled) i {border-color: #009688}
|
||||
div[xm-select-skin=primary] dl dd.xm-select-this:not(.xm-dis-disabled) i {color: #009688}
|
||||
div[xm-select-skin=primary].xm-form-selected .xm-select,div[xm-select-skin=primary].xm-form-selected .xm-select:hover {border-color: #009688!important}
|
||||
div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span {background-color: #1E9FFF;color: #FFF;border: 1px solid #1E9FFF}
|
||||
div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span i {background-color: #1E9FFF;color: #FFF}
|
||||
div[xm-select-skin=normal] dl dd:not(.xm-dis-disabled) i {border-color: #1E9FFF}
|
||||
div[xm-select-skin=normal] dl dd.xm-select-this:not(.xm-dis-disabled) i {color: #1E9FFF}
|
||||
div[xm-select-skin=normal].xm-form-selected .xm-select,div[xm-select-skin=normal].xm-form-selected .xm-select:hover {border-color: #1E9FFF!important}
|
||||
div[xm-select-skin=warm] .xm-select-title div.xm-select-label>span {background-color: #FFB800;color: #FFF;border: 1px solid #FFB800}
|
||||
div[xm-select-skin=warm] .xm-select-title div.xm-select-label>span i {background-color: #FFB800;color: #FFF}
|
||||
div[xm-select-skin=warm] dl dd:not(.xm-dis-disabled) i {border-color: #FFB800}
|
||||
div[xm-select-skin=warm] dl dd.xm-select-this:not(.xm-dis-disabled) i {color: #FFB800}
|
||||
div[xm-select-skin=warm].xm-form-selected .xm-select,div[xm-select-skin=warm].xm-form-selected .xm-select:hover {border-color: #FFB800!important}
|
||||
div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span {background-color: #FF5722;color: #FFF;border: 1px solid #FF5722}
|
||||
div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span i {background-color: #FF5722;color: #FFF}
|
||||
div[xm-select-skin=danger] dl dd:not(.xm-dis-disabled) i {border-color: #FF5722}
|
||||
div[xm-select-skin=danger] dl dd.xm-select-this:not(.xm-dis-disabled) i {color: #FF5722}
|
||||
div[xm-select-skin=danger].xm-form-selected .xm-select,div[xm-select-skin=danger].xm-form-selected .xm-select:hover {border-color: #FF5722!important}
|
||||
|
||||
|
||||
/* 多选联动 */
|
||||
.xm-select-parent .layui-form-danger+.xm-select-title .xm-select {border-color: #FF5722 !important;}
|
||||
.xm-select-linkage li {padding: 10px 0px;cursor: pointer;}
|
||||
.xm-select-linkage li span {padding-left: 20px;padding-right: 30px;display: inline-block;height: 20px;overflow: hidden;text-overflow: ellipsis;}
|
||||
.xm-select-linkage li.xm-select-this span {border-left: 5px solid #009688;color: #009688;padding-left: 15px;}
|
||||
.xm-select-linkage-group {position: absolute;left: 0;top: 0;right: 0;bottom: 0;overflow-x: hidden;overflow-y: auto;}
|
||||
.xm-select-linkage-group li:hover {border-left: 1px solid #009688;}
|
||||
.xm-select-linkage-group li:hover span {padding-left: 19px;}
|
||||
.xm-select-linkage-group li.xm-select-this:hover span {padding-left: 15px;border-left-width: 4px;}
|
||||
.xm-select-linkage-group:nth-child(4n+1){background-color: #EFEFEF; left: 0;}
|
||||
.xm-select-linkage-group:nth-child(4n+1) li.xm-select-active{background-color: #F5F5F5;}
|
||||
.xm-select-linkage-group:nth-child(4n+2){background-color: #F5F5F5; left: 100px;}
|
||||
.xm-select-linkage-group:nth-child(4n+3) li.xm-select-active{background-color: #FAFAFA;}
|
||||
.xm-select-linkage-group:nth-child(4n+3){background-color: #FAFAFA; left: 200px;}
|
||||
.xm-select-linkage-group:nth-child(4n+3) li.xm-select-active{background-color: #FFFFFF;}
|
||||
.xm-select-linkage-group:nth-child(4n+4){background-color: #FFFFFF; left: 300px;}
|
||||
.xm-select-linkage-group:nth-child(4n+4) li.xm-select-active{background-color: #EFEFEF;}
|
||||
.xm-select-linkage li{list-style: none;}
|
||||
.xm-select-linkage-hide {display: none;}
|
||||
.xm-select-linkage-show {display: block;}
|
||||
|
||||
div[xm-select-skin='default'] .xm-select-linkage li.xm-select-this span {border-left-color: #5FB878;color: #5FB878;}
|
||||
div[xm-select-skin='default'] .xm-select-linkage-group li:hover {border-left-color: #5FB878;}
|
||||
div[xm-select-skin='primary'] .xm-select-linkage li.xm-select-this span {border-left-color: #1E9FFF;color: #1E9FFF;}
|
||||
div[xm-select-skin='primary'] .xm-select-linkage-group li:hover {border-left-color: #1E9FFF;}
|
||||
div[xm-select-skin='normal'] .xm-select-linkage li.xm-select-this span {border-left-color: #1E9FFF;color: #1E9FFF;}
|
||||
div[xm-select-skin='normal'] .xm-select-linkage-group li:hover {border-left-color: #1E9FFF;}
|
||||
div[xm-select-skin='warm'] .xm-select-linkage li.xm-select-this span {border-left-color: #FFB800;color: #FFB800;}
|
||||
div[xm-select-skin='warm'] .xm-select-linkage-group li:hover {border-left-color: #FFB800;}
|
||||
div[xm-select-skin='danger'] .xm-select-linkage li.xm-select-this span {border-left-color: #FF5722;color: #FF5722;}
|
||||
div[xm-select-skin='danger'] .xm-select-linkage-group li:hover {border-left-color: #FF5722;}
|
||||
|
||||
|
||||
/* 快捷操作 */
|
||||
.xm-select-tips[style]:hover{background-color: #FFF!important;}
|
||||
.xm-select-parent dd > .xm-cz{position: absolute; top: 0px; right: 10px;}
|
||||
.xm-select-parent dd > .xm-cz-group{margin-right: 30px; border-right: 2px solid #ddd; height: 16px; margin-top: 8px; line-height: 16px; overflow: hidden;}
|
||||
.xm-select-parent dd > .xm-cz-group .xm-cz{display: inline-block; margin-right: 30px;}
|
||||
.xm-select-parent dd > .xm-cz-group .xm-cz i{margin-right: 5px;}
|
||||
.xm-select-parent dd > .xm-cz-group[show='name'] .xm-cz i{display: none;}
|
||||
.xm-select-parent dd > .xm-cz-group[show='icon'] .xm-cz span{display: none;}
|
||||
.xm-select-parent dd .xm-cz:hover{color: #009688;}
|
||||
div[xm-select-skin='default'] dd .xm-cz:hover{color: #C0C4CC;}
|
||||
div[xm-select-skin='primary'] dd .xm-cz:hover{color: #009688;}
|
||||
div[xm-select-skin='normal'] dd .xm-cz:hover{color: #1E9FFF;}
|
||||
div[xm-select-skin='warm'] dd .xm-cz:hover{color: #FFB800;}
|
||||
div[xm-select-skin='danger'] dd .xm-cz:hover{color: #FF5722;}
|
||||
|
||||
|
||||
/* 下拉里面的搜索 */
|
||||
.xm-select-tips .xm-input{border: none; border-bottom: 1px solid #E6E6E6; padding-left: 27px;}
|
||||
.xm-select-tips .icon-sousuo{position: absolute;}
|
||||
.xm-select-tips.xm-dl-input{display: none;}
|
||||
div[xm-select-search-type="1"] .xm-select-tips.xm-dl-input{display: block;}
|
||||
div[xm-select-search-type="1"] .xm-select .xm-select-input{display: none !important;}
|
||||
|
||||
/* 阿里巴巴矢量图标库 */
|
||||
@font-face {font-family: "xm-iconfont";
|
||||
src: url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831'); /* IE9*/
|
||||
src: url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAsYAAsAAAAAEQwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8ukovY21hcAAAAYAAAACrAAACPBtV6wxnbHlmAAACLAAABnEAAAmMovtEvWhlYWQAAAigAAAAMQAAADYSctBCaGhlYQAACNQAAAAgAAAAJAgBA69obXR4AAAI9AAAABsAAAAwMCX//WxvY2EAAAkQAAAAGgAAABoN8gwubWF4cAAACSwAAAAeAAAAIAEiAM9uYW1lAAAJTAAAAUUAAAJtPlT+fXBvc3QAAAqUAAAAhAAAALJ1LunfeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWacwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByeMbwwZ27438AQw9zMcAQozAiSAwDk4AxmeJzlks0JwzAMhZ8bN/1xD4GU0h2Se26BbJMJOkkn6KmTPbJF8mT5UGg3qMRn0EPIRs8A9gAq0YsIhDcCLF5SQ9YrnLMe8VB9RSMlMjCxYcueIyfOy7CuAFHU7lP9iqApt5L3ksBJbzlgZ9PVkXDUvbWa6x8T/i0u+XyWKtmmHW0NDI55yeRok2DjaKdg65jX7Bzzm71jXnN08vzJkQvg7Ng/WAYH9Qb3wzM/AHicjVVvbFzFEd/Zfbv7/vn9uXf33vl8Pt/dO99BHOzEZ9/DKTImRS0KjUoLDUFCjtpCMGkT1D9qldQmhkiUSv2G1BBB1VYqilGREOIDViWEGzttqkpI/cAXqyL5gFRALVIF+VCJe9fZd+fEpR/o6d3s7G9mZ2dmZ3aJIKR3h0ZYmVgkIjGZJV8mDxECtenOTDOu1UU+hJoD+TCqzcNMk2V8O5OCbDVRPgZhEt4JCNTZ/4HA3+DfuWIxl8pcFFErG3K7oD7fvev8UaMUmEu259lrRjBsfs6cLhYbRfzSbSjGRVAkfQYihUXsyPkHTVyyZDNmXzSHg3Tl+aPKxpJFqbWGdtLl8w8iYDxuDTQIx7yc1YCdIx7Jk3HSwbwQwGBcyMKZVtG0ZCuJxjFJBb+foMSfhJaPOSr4FYgwSwqIx2MHJALtAdBi/7xcSMJL+fxmmBS2guD61tZm96X02mgcj0J1NAaIR9UMmhXIV24FuLUC71+r1AEmK1AYrQHUK/Tly/m8MrOZz2+FSf7jzc3NK9XR9F2lVq+gmRp0r+HK9B+VJmR263Rgd7ALwR/FOFfx/FeJS0YxQh9drakgMJhaBVizkwgqWxLD6eQ0Qo8f7p44fJziSH9x+PjLZUO+/jZ9+K35X37ljn/Rv+yW4Ziuf2nl4PfS5/LrP47OHTsFJULYjf369UZAEBmSqEOSJmG4Me6LeznA0BFkcDoJlGynVzmH2vY21DhPr25v9DjvbfTp2TXG1s5mlK0q4S7lT++6obbRox/s6CHF2LMEsHvoFfSFQIKnKQMZJVFCD6WH0p0PVvvcRx8uph8eUks0jOFNtskOkpDsJ18k9+NqVRg3qqMCSSerjyRuYUi1/vFH7YIqikGVcD+ehFl/pqPSPKZ6DG6mHisljFhBFvU/PoRkSNd/JHO6Ja5JOXcfwIGJbm/igBq/hn8Kfb57YbYUxyX4cwkLKH1u4gD9GVSL6USxCjjCO2p8VdcvH9XRYIQWqUblu3pR/v2BvXMAc3tTmJiDAQ895B9NL0C9BFdKqqRKczDX/Whg7O1irVbcqZ8/sbfYBOZwihC+6wSDzszUf+dF7rRO1O+fKaDO+nXOr6+vf8L5J44Qe4UvnlyRntwrxMoKzpFdeRJBNb9dGyiur1+nE59R+uwi9M1G395jb9KP0bcK2YM9nJB5cojcS75OFskxclzdc+pW699z8iYbtf14BGKf77ruZNyXKC0e50OEBI+V/Aug5Dex/9WjJfipuqnS00gfybjXbNe1f762tXmRPp3Bdl/l6g5JXyqXR0bK8J3PR+jvwYs8/GBnTM+kr8FX4ZknwC16XtG9iH9QfNn1vDHPe2GAj3ieV3XdF2+IPdeteh62Ra+HfQrsKWKSBtlHSOBgM7KkKQBLWnZoq1mVwotCLRGhOtSkMzMuqq2ml3SqUehdnZtynbtPLB88/Dy9dDrYVzoy/MTT6Svnlpd/AHueon5wpnGsEae/PZm+d3Jp6SSUTy7R3xw4f9/B5RN3O+5t3VNncjm6Cnt+uLx8DpedGj4yvD84HceNxTcG6ku4VPmZ9n6nNdj95BHyB3IJKxBPsKm6rpn4QopmqzlFm1MwqdxO5rPGnIc7aSfCGg1Vqyo6nUlQhnh7WiFhXzgGhVC4qjPRki9xdGCc4zXeSWb9BG1ktlqz2Q5Y7S2sIJfivkpVKCCDpyCWdbQzECj76qMVqvyJ/LxyI2rTv1bTC25lSM9xAUJ4Lc+U0wXTsKXDmaA8tHX+hvDt4Wa9IHLcMUBz9VwpL4xi2aGasAPPKNUbbmD/2jAtk0uXY4eJx8zRgj9iAnVNt5X+BL5vlHTOaiOmG7g6+7ZBNUOaefNXuJF3u25RjVvBLeW8E4wV7ZJBpbAXXGnqrwgupWVTAKqZjq5HbW44fMguNJhgwmw8oOk8GCqE8F3GhLB0uS/UDVt4lgjtqGxK/rpwuaDAqKHZNuWmJjVKuWUxbpg2B9DtoRdN3TKF9B0hw4p41C5i3CI9w4civP3aQLlmLMK3wpJpaI7BvmlhPtH3nPWCKQAdE2hK9zyuUeAm921qCA2kvqY8N1yDMq4beJlG+4XQqHDCQnqPlJIyyN579S4tIGcRv/82BbFfK9SgnVHkZzMeaSQjqR5/fP5XF2Chh+sW0g0gn27snqXv3/bsszsfJbCAIiTdjRTVCBL6jV0K5D8H/8xVAAAAeJxjYGRgYADi16c/vIvnt/nKwM3CAALXZxxzhtH///23YVFhbgZyORiYQKIAm34OJQAAAHicY2BkYGBu+N/AEMOi/P/f//8sKgxAERTAAwCmuAa3eJxjYWBgYAFhRiiNFf//z6L8/x+IDQAkCQRQAAAAAAAAjAEAATgBfgGaAiACbgMMA2AEhATGAAB4nGNgZGBg4GE4DMQgwATEXEDIwPAfzGcAAB2tAfIAAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nG2L3QqCQBCFZ9RWU7sOfAeh8IFi3N10EHYUG1p8+gSjqz44F+cPEjgo4T81Jphihic0mGOBZyyxwhovUCxKIe4ylthRuDqV+I22UcLQ6+QH4ubWdZZkU3m4o/0tUqtSvT33TPLits12fzc+zhRcvoquo0o281OLhcMw7Q+AD8sULE0=') format('woff'),
|
||||
url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.ttf?t=1534240067831') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.svg?t=1534240067831#iconfont') format('svg'); /* iOS 4.1- */
|
||||
}
|
||||
.xm-iconfont {font-family:"xm-iconfont" !important; font-size:14px; font-style:normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}
|
||||
.icon-quanxuan:before { content: "\e62c"; }
|
||||
.icon-caidan:before { content: "\e610"; }
|
||||
.icon-fanxuan:before { content: "\e837"; }
|
||||
.icon-pifu:before { content: "\e668"; }
|
||||
.icon-qingkong:before { content: "\e63e"; }
|
||||
.icon-sousuo:before { content: "\e600"; }
|
||||
.icon-danx:before { content: "\e62b"; }
|
||||
.icon-duox:before { content: "\e613"; }
|
||||
.icon-close:before { content: "\e601"; }
|
||||
.icon-expand:before { content: "\e641"; }
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,181 @@
|
||||
layui.define(['layer'],function(exports){
|
||||
//提示:模块也可以依赖其它模块,如:layui.define('layer', callback);
|
||||
let laydate = layui.laydate;
|
||||
const opts={
|
||||
"target":'laydateplus',
|
||||
"type":'date',
|
||||
"rangeLinked":false,
|
||||
"callback": null
|
||||
};
|
||||
var laydatePlus = function(options){
|
||||
this.settings = $.extend({}, opts, options);
|
||||
let me = this;
|
||||
$('#'+this.settings.target).click(function(){
|
||||
me.init();
|
||||
});
|
||||
};
|
||||
laydatePlus.prototype = {
|
||||
init: function () {
|
||||
var me = this;
|
||||
|
||||
let shortcuts = [
|
||||
{
|
||||
text: "昨天",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setDate(date1.getDate() - 1);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setDate(date2.getDate() - 1);
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "今天",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setDate(date1.getDate());
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setDate(date2.getDate());
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "最近7天",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setDate(date1.getDate() - 7);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "最近30天",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setDate(date1.getDate() - 30);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "本周",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var today = new Date();
|
||||
var date1 = new Date(today.setDate(today.getDate() - today.getDay() + (today.getDay() === 0 ? -6 : 1)));
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date(today.setDate(today.getDate() + 6));
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "上周",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var today = new Date();
|
||||
var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
|
||||
var date1 = new Date(lastWeek.getFullYear(), lastWeek.getMonth(), lastWeek.getDate() - lastWeek.getDay() + 1);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date(lastWeek.getFullYear(), lastWeek.getMonth(), lastWeek.getDate() - lastWeek.getDay() + 7);
|
||||
date2.setHours(23, 59, 59, 999);
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "上个月",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setMonth(date1.getMonth() - 1);
|
||||
date1.setDate(1);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setDate(1);
|
||||
date2.setHours(0, 0, 0, 0);
|
||||
date2 = date2.getTime() - 1;
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "这个月",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setDate(1);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setMonth(date2.getMonth() + 1);
|
||||
date2.setDate(1);
|
||||
date2.setHours(0, 0, 0, 0);
|
||||
date2 = date2.getTime() - 1;
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
},
|
||||
{
|
||||
text: "下个月",
|
||||
value: function(){
|
||||
var value = [];
|
||||
var date1 = new Date();
|
||||
date1.setMonth(date1.getMonth() + 1);
|
||||
date1.setDate(1);
|
||||
date1.setHours(0, 0, 0, 0);
|
||||
value.push(date1);
|
||||
var date2 = new Date();
|
||||
date2.setMonth(date2.getMonth() + 2);
|
||||
date2.setDate(1);
|
||||
date2.setHours(0, 0, 0, 0);
|
||||
date2 = date2.getTime() - 1;
|
||||
value.push(new Date(date2));
|
||||
return value;
|
||||
}()
|
||||
}
|
||||
];
|
||||
// 日期时间范围
|
||||
laydate.render({
|
||||
elem: '#'+me.settings.target,
|
||||
type: me.settings.type,
|
||||
range: '~',
|
||||
trigger: 'none',
|
||||
rangeLinked:me.settings.rangeLinked,
|
||||
shortcuts: shortcuts,
|
||||
show:true,
|
||||
done: function(value, date, endDate){
|
||||
if (typeof me.settings.callback === 'function') {
|
||||
me.settings.callback(value, date, endDate);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//输出接口
|
||||
exports('laydatePlus', laydatePlus);
|
||||
});
|
||||
@@ -0,0 +1,695 @@
|
||||
layui.define(['tool','oaPicker','uploadPlus'], function (exports) {
|
||||
const layer = layui.layer;
|
||||
const form = layui.form;
|
||||
const tool = layui.tool;
|
||||
const uploadPlus = layui.uploadPlus;
|
||||
const opts={
|
||||
"checkBox":"checkBox",//审核容器id
|
||||
"checking_btn":"",//待审核状态下自定义添加的按钮
|
||||
"checked_btn":"",//审核通过自定义添加的按钮
|
||||
"check_name": "",//审核类型标识
|
||||
"check_btn":1,//是否显示提交审核按钮
|
||||
"check_ok":function(){
|
||||
//审核通过的执行函数
|
||||
},
|
||||
"check_no":function(){
|
||||
//审核拒绝的执行函数
|
||||
},
|
||||
"check_back":function(){
|
||||
//撤回的执行函数
|
||||
},
|
||||
"check_reversed":function(){
|
||||
//反确认的执行函数
|
||||
}
|
||||
};
|
||||
const obj = {
|
||||
loading:false,
|
||||
checkStatus: function (status) {
|
||||
statusArray = ['待提交审批','审批中','审批通过','审批不通过','已撤回'];
|
||||
return '<span class="check-status-color-'+status+'">'+statusArray[status]+'</span>';
|
||||
},
|
||||
statusTemplate: function (status) {
|
||||
let me = this;
|
||||
let tem =`
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">审批状态</td>
|
||||
<td>${me.checkStatus(status)}</td>
|
||||
</tr>
|
||||
`;
|
||||
return tem;
|
||||
},
|
||||
uidsTemplate: function () {
|
||||
let tem =`
|
||||
<td class="layui-td-gray-2">审批人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="check_uames" value="" autocomplete="off" placeholder="请选择审批人" lay-verify="required" lay-reqText="请选择审批人" class="layui-input picker-admin" readonly><input type="text" name="check_uids" value="" readonly style="display:none;">
|
||||
</td>
|
||||
`;
|
||||
return tem;
|
||||
},
|
||||
flowTemplate: function (data) {
|
||||
let flowtype='<option value="" title="">--请选择--</option>';
|
||||
if(data && data.length>0){
|
||||
for(let i=0;i<data.length;i++){
|
||||
flowtype+='<option value="'+data[i].id+'" title="'+data[i].check_type+'">'+data[i].title+'</option>';
|
||||
}
|
||||
}
|
||||
let tem =`
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">审批流程<font>*</font></td>
|
||||
<td>
|
||||
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
|
||||
${flowtype}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
return tem;
|
||||
},
|
||||
copyTemplate: function (detail) {
|
||||
let me = this;
|
||||
let tem =`
|
||||
<tr style="${detail.is_copy==0?'display:none':''}">
|
||||
<td class="layui-td-gray-2">抄送人</td>
|
||||
<td>
|
||||
<input type="text" name="check_copy_unames" value="" readonly autocomplete="off" placeholder="请选择审批通过后的抄送人" class="layui-input picker-admin" data-type="2"><input type="text" name="check_copy_uids" value="" readonly style="display:none;">
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
return tem;
|
||||
},
|
||||
btnTemplate: function () {
|
||||
let me = this;
|
||||
let tem =`
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="checkform">提交审批</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
${me.sets.checking_btn}
|
||||
</div>
|
||||
`;
|
||||
if(me.sets.check_btn == 1){
|
||||
return tem;
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
},
|
||||
recordTemplate: function (record) {
|
||||
let me = this;
|
||||
let tem ='';
|
||||
if(record.length>0){
|
||||
tem+='<tr><td class="layui-td-gray-2">审批记录</td><td colspan="5"><ul class="layui-timeline flow-record pt-2">';
|
||||
for(let l=0;l<record.length;l++){
|
||||
let check_content='';
|
||||
if(record[l].content!=''){
|
||||
check_content='审批意见:<span class="green">'+record[l].content+'</span>。';
|
||||
}
|
||||
tem+='<li class="layui-timeline-item delete-'+record[l].delete_time+'">\
|
||||
<i class="layui-icon layui-timeline-axis"></i>\
|
||||
<p style="padding-left:24px">'+record[l].check_time_str+'<span class="black ml-2">'+record[l].name+'</span><span class="check-status-color-'+(record[l].check_status+1)+'">『'+record[l].status_str+'』</span>了此申请。'+check_content+'</p>';
|
||||
let file_array= record[l].file_array;
|
||||
if(file_array.length>0){
|
||||
tem+='<p style="padding:4px 24px 0;">审批附件:</p><div class="layui-row" style="padding:2px 16px;">';
|
||||
for(let f=0;f<file_array.length;f++){
|
||||
tem+='<div class="layui-col-md4">'+tool.fileCard(file_array[f],1)+'</div>';
|
||||
}
|
||||
tem+='</div>';
|
||||
}
|
||||
tem+='</li>';
|
||||
}
|
||||
tem+='</ul></td></tr>';
|
||||
}
|
||||
return tem;
|
||||
},
|
||||
createTemplate: function (flow) {
|
||||
let me = this;
|
||||
let checkHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
${me.flowTemplate(flow)}
|
||||
<tr id="checkTR">${me.uidsTemplate()}</tr>
|
||||
${me.copyTemplate(flow[0])}
|
||||
</table>
|
||||
</form>
|
||||
`;
|
||||
return checkHtml;
|
||||
},
|
||||
//审批待提交模版
|
||||
initTemplate: function (detail) {
|
||||
let me = this;
|
||||
let checkHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
${me.statusTemplate(detail.check_status)}
|
||||
${me.recordTemplate(detail.check_record)}
|
||||
${me.flowTemplate(detail.flow)}
|
||||
<tr id="checkTR">${me.uidsTemplate()}</tr>
|
||||
${me.copyTemplate(detail)}
|
||||
</table>
|
||||
${me.btnTemplate()}
|
||||
</form>
|
||||
`;
|
||||
let viewHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
${me.statusTemplate(detail.check_status)}
|
||||
${me.recordTemplate(detail.check_record)}
|
||||
</table>
|
||||
</form>
|
||||
`;
|
||||
if(detail.is_creater==1){
|
||||
return checkHtml;
|
||||
}
|
||||
else{
|
||||
return viewHtml;
|
||||
}
|
||||
},
|
||||
//审批中模版
|
||||
checkTemplate: function (detail) {
|
||||
let me = this,flowHtml='',list = detail.nodes;
|
||||
for(var f=0;f<list.length;f++){
|
||||
//审批流程
|
||||
let checkUser = '',
|
||||
iconRight ='<span class="layui-icon layui-icon-right"></span>',
|
||||
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
|
||||
strStatus ='<div class="check-item-status">待审批</div>',
|
||||
check_types= '',
|
||||
sortClass ='';
|
||||
if(f == list.length-1){
|
||||
iconRight ='';
|
||||
}
|
||||
if(detail.check_step_sort == list[f].sort){
|
||||
sortClass ='flow-this';
|
||||
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
|
||||
strStatus ='<div class="check-item-status">当前审批</div>';
|
||||
if(list[f].check_uids_info.length>1){
|
||||
check_types= ' <span class="layui-badge layui-bg-blue">会签</span>';
|
||||
if(list[f].check_types==2){
|
||||
check_types= ' <span class="layui-badge layui-bg-orange">或签</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(list[f].check_role == 0 || list[f].check_role == 5){
|
||||
checkUser=list[f].check_uids_info[0].name;
|
||||
}
|
||||
if(list[f].check_role == 1 || list[f].check_role == 2 || list[f].check_role == 3 || list[f].check_role == 4){
|
||||
checkUser=list[f].flow_name;
|
||||
}
|
||||
if(list[f].check_list.length>0){
|
||||
let one=0,two=0,three=0;
|
||||
for(var m=0;m<list[f].check_uids_info.length;m++){
|
||||
if(list[f].check_uids_info[m].check_status == 2){
|
||||
three++
|
||||
}
|
||||
if(list[f].check_uids_info[m].check_status == 1){
|
||||
two++
|
||||
}
|
||||
if(list[f].check_uids_info[m].check_status == 0){
|
||||
one++
|
||||
}
|
||||
}
|
||||
//会签
|
||||
if(list[f].check_types==1){
|
||||
if(three > 0){
|
||||
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
|
||||
strStatus ='<div class="check-item-status">拒绝</div>';
|
||||
}
|
||||
else{
|
||||
if(one > 0){
|
||||
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
|
||||
strStatus ='<div class="check-item-status">待审批</div>';
|
||||
}
|
||||
else{
|
||||
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
|
||||
strStatus ='<div class="check-item-status">通过</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
//或签
|
||||
if(list[f].check_types==2){
|
||||
if(two > 0){
|
||||
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
|
||||
strStatus ='<div class="check-item-status">通过</div>';
|
||||
}
|
||||
else{
|
||||
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
|
||||
strStatus ='<div class="check-item-status">拒绝</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row '+sortClass+'" id="flow'+f+'">'+iconStatus+'<div class="check-item-name">'+check_types+checkUser+'</div>'+strStatus+iconRight+'</div>';
|
||||
}
|
||||
|
||||
let checkCopy=`<tr style="${detail.is_copy==0?'display:none':''}"><td class="layui-td-gray-2">抄送人</td><td colspan="3">${detail.copy_unames}</td></tr>`;
|
||||
|
||||
let checkNode = `<tr>
|
||||
<td class="layui-td-gray-2">审批节点 <font>*</font></td>
|
||||
<td colspan="3">
|
||||
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审批结束">
|
||||
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="check_uname" value="" readonly autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input picker-admin"><input type="hidden" name="check_uids" value="">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
let checkContent = `<tr style="${detail.is_file==0?'display:none':''}">
|
||||
<td class="layui-td-gray-2">审批附件 <button type="button" class="layui-btn layui-btn-xs" id="uploadBtnCheck"><i class="layui-icon"></i></button></td>
|
||||
<td colspan="3">
|
||||
<div class="layui-row" id="uploadBoxCheck"><input data-type="file" type="hidden" name="check_files" value=""></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">审批意见</td>
|
||||
<td colspan="3">
|
||||
<textarea name="content" placeholder="请输入审批意见" class="layui-textarea"></textarea>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
let btnCheck='<span class="layui-btn layui-btn-normal btn-check" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span><span class="layui-btn layui-btn-danger btn-check" data-status="2"><i class="layui-icon layui-icon-close"></i> 拒绝</span>';
|
||||
|
||||
if(detail.step.check_role==5){
|
||||
btnCheck='<span class="layui-btn layui-btn-normal btn-check" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span><span class="layui-btn layui-btn-danger btn-check" data-status="2"><i class="layui-icon layui-icon-close"></i> 退回</span>';
|
||||
}
|
||||
|
||||
let btnBack='<span class="layui-btn layui-btn-primary btn-check" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>';
|
||||
let btnCheckBack='<span class="layui-btn layui-btn-danger btn-check" data-event="check" data-status="4">反确认审核</span>';
|
||||
let btnExport='<a href="/api/export/pdf?types='+me.sets.check_name+'&id='+detail.id+'" class="layui-btn" target="_blank"><i class="layui-icon layui-icon-print"></i>审批单导出打印</a>';
|
||||
|
||||
let checkHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">审批状态</td>
|
||||
<td>${me.checkStatus(detail.check_status)}</td>
|
||||
<td class="layui-td-gray-2">当前审批人</td>
|
||||
<td>${detail.check_unames}</td>
|
||||
</tr>
|
||||
${checkCopy}
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">审批流</td>
|
||||
<td colspan="3">
|
||||
<div class="flow-flexbox check-items flow-flex-row" id="flowList">
|
||||
<div class="flow-flexbox check-item flow-flex-row">
|
||||
<i class="layui-icon layui-icon-add-circle" data-ok=""></i>
|
||||
<div class="check-item-name">${detail.admin_name}</div>
|
||||
<div class="check-item-status">创建</div>
|
||||
<span class="layui-icon layui-icon-right"></span>
|
||||
</div>
|
||||
${flowHtml}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
${me.recordTemplate(detail.check_record)}
|
||||
${detail.is_checker==1 && detail.step.check_role==0?checkNode:''}
|
||||
${detail.is_checker==1?checkContent:''}
|
||||
</table>
|
||||
<div class="pt-3">
|
||||
<input type="hidden" name="check_role" value="${detail.step.check_role}">
|
||||
${detail.is_checker==1?btnCheck:''}
|
||||
${detail.is_creater==1 && detail.is_back==1 && (detail.check_status==1 || detail.check_status==3)?btnBack:''}
|
||||
${detail.is_reversed == 1 && detail.is_creater==1 && typeof me.sets.check_reversed ==='function' && detail.check_status==2?btnCheckBack:''}
|
||||
${detail.is_export == 1 && detail.check_status==2?btnExport:''}
|
||||
${detail.check_status==2?me.sets.checked_btn:''}
|
||||
</div>
|
||||
</form>
|
||||
`;
|
||||
return checkHtml;
|
||||
},
|
||||
//审批撤回模版
|
||||
backTemplate: function (detail) {
|
||||
let me = this;
|
||||
let btnHtml ='';
|
||||
if(me.sets.check_btn == 1){
|
||||
btnHtml ='<div class="pt-3"><button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="checkform">提交审批</button><button type="reset" class="layui-btn layui-btn-primary">重置</button></div>';
|
||||
}
|
||||
let checkHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
${me.statusTemplate(detail.check_status)}
|
||||
${me.recordTemplate(detail.check_record)}
|
||||
${me.flowTemplate(detail.flow)}
|
||||
<tr id="checkTR">${me.uidsTemplate()}</tr>
|
||||
${me.copyTemplate(detail)}
|
||||
</table>
|
||||
${me.btnTemplate()}
|
||||
</form>
|
||||
`;
|
||||
let viewHtml = `
|
||||
<form class="layui-form">
|
||||
<h3 class="pb-2">审批操作</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
${me.statusTemplate(detail.check_status)}
|
||||
${me.recordTemplate(detail.check_record)}
|
||||
</table>
|
||||
</form>
|
||||
`;
|
||||
if(detail.is_creater==1 && detail.is_back==1){
|
||||
return checkHtml;
|
||||
}
|
||||
else{
|
||||
return viewHtml;
|
||||
}
|
||||
},
|
||||
submit:function(data,callback){
|
||||
tool.post("/api/check/submit_check", data, callback);
|
||||
},
|
||||
init: function (options) {
|
||||
this.sets = $.extend({}, opts, options);
|
||||
let me = this;
|
||||
let checkBox = $('#'+me.sets.checkBox);
|
||||
let action_id = checkBox.data('id');
|
||||
let check_status = checkBox.data('status');
|
||||
let check_flow_id = checkBox.data('checkflowid');
|
||||
if(action_id === undefined || check_status === undefined || check_flow_id === undefined){
|
||||
return false;
|
||||
}
|
||||
//获取审批信息
|
||||
$.ajax({
|
||||
url: "/api/check/get_flow_nodes",
|
||||
type:'get',
|
||||
data:{check_name:me.sets.check_name,action_id:action_id,flow_id:check_flow_id},
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
if(check_status==0){
|
||||
if(action_id==0){
|
||||
if(e.data.length>0){
|
||||
checkBox.append(me.createTemplate(e.data));
|
||||
}
|
||||
else{
|
||||
let none = '<h3 class="pb-2">审批操作</h3>\
|
||||
<table class="layui-table layui-table-form">\
|
||||
<tr>\
|
||||
<td class="layui-td-gray-2">审批流程<font>*</font></td>\
|
||||
<td><input type="text" name="flow_id" value="" autocomplete="off" placeholder="未设置审批流程,请联系管理员设置" lay-verify="required" lay-reqtext="未设置审批流程,请联系管理员设置" class="layui-input" readonly></td>\
|
||||
</tr>\
|
||||
</table>';
|
||||
checkBox.append(none);
|
||||
}
|
||||
}
|
||||
else{
|
||||
checkBox.append(me.initTemplate(e.data));
|
||||
}
|
||||
}
|
||||
else if(check_status==4){
|
||||
checkBox.append(me.backTemplate(e.data));
|
||||
}
|
||||
else{
|
||||
checkBox.append(me.checkTemplate(e.data));
|
||||
var fileUp = new uploadPlus({
|
||||
"target":'uploadBtnCheck',
|
||||
"targetBox":'uploadBoxCheck',
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//选择审批流
|
||||
form.on('select(flowtype)', function(data){
|
||||
var check_type = data.elem[data.elem.selectedIndex].title;
|
||||
if(data.value==''){
|
||||
$('#checkTR').html(me.uidsTemplate());
|
||||
checkBox.find('[name="check_copy_unames"]').val('');
|
||||
checkBox.find('[name="check_copy_uids"]').val('');
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
if(check_type == 1){
|
||||
$('#checkTR').html(me.uidsTemplate());
|
||||
form.render();
|
||||
}
|
||||
$.ajax({
|
||||
url: "/api/check/get_flow_users",
|
||||
type:'get',
|
||||
data:{id:data.value},
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
var flow_li='',flow_idx=0;
|
||||
var flow_data = e.data.flow_data;
|
||||
if(e.data.copy_uids && e.data.copy_uids !=''){
|
||||
checkBox.find('[name="check_copy_unames"]').val(e.data.copy_unames);
|
||||
checkBox.find('[name="check_copy_uids"]').val(e.data.copy_uids.split(','));
|
||||
}
|
||||
if(check_type == 2 || check_type == 3){
|
||||
for(var a=0;a<flow_data.length;a++){
|
||||
var check_types = '',check_role = '',user_li='';
|
||||
if(flow_data[a].check_types==1){
|
||||
check_types= ' <span class="layui-badge layui-bg-blue">会签</span>';
|
||||
}
|
||||
if(flow_data[a].check_types==2){
|
||||
check_types= ' <span class="layui-badge layui-bg-orange">或签</span>';
|
||||
}
|
||||
|
||||
if(flow_data[a].check_role==1){
|
||||
check_role = '当前部门负责人';
|
||||
}
|
||||
if(flow_data[a].check_role==2){
|
||||
check_role = '上级部门负责人';
|
||||
}
|
||||
if(flow_data[a].check_role==3){
|
||||
check_role = '岗位职称:'+flow_data[a].check_position;
|
||||
}
|
||||
if(flow_data[a].check_role==4){
|
||||
check_role = '指定人员';
|
||||
}
|
||||
if(flow_data[a].check_role==5){
|
||||
check_role = flow_data[a].flow_name;
|
||||
check_types= ' <span class="layui-badge layui-bg-green">可回退</span>';
|
||||
}
|
||||
let check_uids_info=flow_data[a].check_uids_info;
|
||||
if(check_uids_info.length>0){
|
||||
flow_idx++;
|
||||
for(var b=0;b<check_uids_info.length;b++){
|
||||
user_li+= '<li style="padding:3px 0;line-height:22px"><img src="'+check_uids_info[b].thumb+'" style="width:22px; height:22px; border-radius:50%; vertical-align: bottom; margin-right:8px;" />'+check_uids_info[b].name+'</li>';
|
||||
}
|
||||
flow_li+='<li class="layui-timeline-item" style="padding-bottom:5px;">\
|
||||
<i class="layui-icon layui-timeline-axis"></i>\
|
||||
<div class="layui-timeline-content">\
|
||||
<p class="layui-timeline-title" style="margin-bottom:3px">第'+flow_idx+'级审批『'+check_role+'』'+check_types+'</p>\
|
||||
<ul>'+user_li+'</ul>\
|
||||
</div>\
|
||||
</li>';
|
||||
}
|
||||
}
|
||||
if(flow_li==''){
|
||||
flow_li='<span style="color:#999;">审批流程错误,请联系管理员设置</span>';
|
||||
}
|
||||
formHtml = '<td class="layui-td-gray-2">审批流</td>\
|
||||
<td>\
|
||||
<ul id="flowList" class="layui-timeline">'+flow_li+'</ul>\
|
||||
</td>';
|
||||
$('#checkTR').html(formHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//提交审批
|
||||
form.on('submit(checkform)', function(data){
|
||||
data.field.action_id = action_id;
|
||||
data.field.check_name = me.sets.check_name;
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
if(typeof me.sets.post_form ==='string' && typeof me.sets.post_url ==='string'){
|
||||
let postData = form.val(me.sets.post_form);
|
||||
tool.post(me.sets.post_url, postData, function(res){
|
||||
if (res.code == 0) {
|
||||
tool.post("/api/check/submit_check", data.field, callback);
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
tool.post("/api/check/submit_check", data.field, callback);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//审批操作按钮
|
||||
checkBox.on('click','.btn-check', function(data){
|
||||
let content=checkBox.find('[name="content"]').val();
|
||||
let check_status=$(this).data('status');
|
||||
let check_role = checkBox.find('input[name="check_role"]').val();
|
||||
|
||||
let check_node=0,check_uids='',check_files='';
|
||||
if(check_role == 0 && check_status==1){
|
||||
check_node = checkBox.find('input[name="check_node"]:checked').val();
|
||||
check_uids = checkBox.find('input[name="check_uids"]').val();
|
||||
if(!check_node){
|
||||
layer.msg('请选择下一审批节点');
|
||||
return false;
|
||||
}
|
||||
if(check_node == 2 && check_uids==''){
|
||||
layer.msg('请选择下一审批人');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(check_status ==1 || check_status==2){
|
||||
let check_files = checkBox.find('input[name="check_files"]').val();
|
||||
let confirmTips='确定通过该审批?';
|
||||
if(check_status==2){
|
||||
confirmTips='确定拒绝该审批?';
|
||||
if(content==''){
|
||||
layer.msg('请输入审批意见');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
tool.ask(confirmTips, function(index){
|
||||
if(typeof me.sets.post_form ==='string' && typeof me.sets.post_url ==='string'){
|
||||
let postData = form.val(me.sets.post_form);
|
||||
tool.post(me.sets.post_url, postData, function(res){
|
||||
if (res.code == 0) {
|
||||
$.ajax({
|
||||
url: "/api/check/flow_check",
|
||||
type:'post',
|
||||
data:{
|
||||
action_id:action_id,
|
||||
check_name:me.sets.check_name,
|
||||
check_flow_id:check_flow_id,
|
||||
check_node:check_node,
|
||||
check_uids:check_uids,
|
||||
check:check_status,
|
||||
check_files:check_files,
|
||||
content:content
|
||||
},
|
||||
success: function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
if(e.data.check_status==2 && typeof me.sets.check_ok ==='function'){
|
||||
me.sets.check_ok(e);
|
||||
}
|
||||
if(e.data.check_status==3 && typeof me.sets.check_no ==='function'){
|
||||
me.sets.check_no(e);
|
||||
}
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: "/api/check/flow_check",
|
||||
type:'post',
|
||||
data:{
|
||||
action_id:action_id,
|
||||
check_name:me.sets.check_name,
|
||||
check_flow_id:check_flow_id,
|
||||
check_node:check_node,
|
||||
check_uids:check_uids,
|
||||
check:check_status,
|
||||
check_files:check_files,
|
||||
content:content
|
||||
},
|
||||
success: function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
if(e.data.check_status==2 && typeof me.sets.check_ok ==='function'){
|
||||
me.sets.check_ok(e);
|
||||
}
|
||||
if(e.data.check_status==3 && typeof me.sets.check_no ==='function'){
|
||||
me.sets.check_no(e);
|
||||
}
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
else if(check_status ==3){
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
title: '请输入撤回理由',
|
||||
area: ['480px', '120px'] //自定义文本域宽高
|
||||
}, function(value, index, elem){
|
||||
if(value==''){
|
||||
layer.msg('请输入撤回理由');
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/api/check/flow_check",
|
||||
type:'post',
|
||||
data:{
|
||||
action_id:action_id,
|
||||
check_name:me.sets.check_name,
|
||||
check_flow_id:check_flow_id,
|
||||
check:check_status,
|
||||
content:value
|
||||
},
|
||||
success: function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
if(e.data.check_status==4 && typeof me.sets.check_back ==='function'){
|
||||
me.sets.check_back(e);
|
||||
}
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
else if(check_status ==4){
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
title: '请输入反确认理由',
|
||||
area: ['480px', '120px'] //自定义文本域宽高
|
||||
}, function(value, index, elem){
|
||||
if(value==''){
|
||||
layer.msg('请输入反确认理由');
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/api/check/flow_check",
|
||||
type:'post',
|
||||
data:{
|
||||
action_id:action_id,
|
||||
check_name:me.sets.check_name,
|
||||
check_flow_id:check_flow_id,
|
||||
check:check_status,
|
||||
content:value
|
||||
},
|
||||
success: function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
if(e.data.check_status==0 && typeof me.sets.check_reversed ==='function'){
|
||||
me.sets.check_reversed(e);
|
||||
}
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
exports('oaCheck', obj);
|
||||
});
|
||||
@@ -0,0 +1,162 @@
|
||||
layui.define(['tool','oaPicker'], function (exports) {
|
||||
const layer = layui.layer, tool = layui.tool;
|
||||
const opts={
|
||||
"box":'commentBox',//容器id
|
||||
"input": 'commentInput',
|
||||
"total": 'commentTotal',
|
||||
"topic_id":0,
|
||||
"module": '',
|
||||
"callback":function(e){
|
||||
layer.msg(e.msg);
|
||||
if(e.code==0){
|
||||
setTimeout(function(){
|
||||
obj.load();
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
};
|
||||
const obj = {
|
||||
load: function () {
|
||||
let me = this;
|
||||
let topic_id = me.sets.topic_id, module = me.sets.module;
|
||||
let page=1;
|
||||
let callback = function (res) {
|
||||
layer.closeAll();
|
||||
me.template(res,page);
|
||||
}
|
||||
tool.get("/api/comment/datalist", {topic_id: topic_id,module: module,page:page}, callback);
|
||||
},
|
||||
template:function(res,page){
|
||||
let me = this;
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
let itemComment = '';
|
||||
$.each(res.data, function (index, item) {
|
||||
let to_names = '', ops = '' ,ptext='';
|
||||
if (item.to_names !='' && item.to_names !='-') {
|
||||
to_names = '<span class="blue">@' + item.to_names + '</span>';
|
||||
}
|
||||
if (item.admin_id == login_admin) {
|
||||
ops = `<a class="mr-4" data-event="edit" data-id="${item.id}">编辑</a><a class="mr-4" data-event="del" data-id="${item.id}">删除</a>`;
|
||||
}
|
||||
else{
|
||||
ops = `<a class="mr-4" data-event="replay" data-id="${item.id}" data-uid="${item.admin_id}" data-unames="${item.name}">回复</a>`;
|
||||
}
|
||||
if(item.pid>0){
|
||||
ptext=`<div style="padding-bottom:8px;"><fieldset style="border:1px solid #eeeeee; background-color:#f9f9f9;"><legend>回复『${item.padmin}』${item.ptimes}的评论</legend>${item.pcontent}</fieldset></div>`;
|
||||
}
|
||||
itemComment += `
|
||||
<div id="comment_${item.id}" class="comment-item py-3 border-t" data-content="${item.content}">
|
||||
<div class="comment-avatar" title="${item.name}">
|
||||
<img class="comment-image" src="${item.thumb}">
|
||||
</div>
|
||||
<div class="comment-body">
|
||||
<div class="comment-meta">
|
||||
<strong class="comment-name">${item.name}</strong><span class="ml-2 gray" title="${item.create_time}">${item.create_times}${item.update_times}</span>
|
||||
</div>
|
||||
<div class="comment-content py-2">${to_names} ${item.content}</div>
|
||||
${ptext}
|
||||
<div class="comment-actions">${ops}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
if(res.data.length>19){
|
||||
page++;
|
||||
itemComment+='<div class="py-3 log-more"><button class="layui-btn layui-btn-normal layui-btn-sm" type="button">查看更多</button></div>';
|
||||
}
|
||||
$('#'+me.sets.box).html(itemComment).data('page',page);
|
||||
$('#'+me.sets.total).html(res.totalRow.total);
|
||||
}
|
||||
else{
|
||||
if(page ==1){
|
||||
$('#'+me.sets.box).html('<div class="layui-data-none">暂无记录</div>');
|
||||
}
|
||||
}
|
||||
},
|
||||
add: function (id,content,pid,to_uids) {
|
||||
let me = this;
|
||||
if (content == '') {
|
||||
layer.msg('请完善评论内容');
|
||||
return false;
|
||||
}
|
||||
let postData = { id: id, topic_id: me.sets.topic_id, pid: pid, to_uids: to_uids, module: me.sets.module, content: content};
|
||||
tool.post("/api/comment/add", postData, me.sets.callback);
|
||||
},
|
||||
del: function (id) {
|
||||
let me = this;
|
||||
layer.confirm('确定删除该评论吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
tool.delete("/api/comment/del", { id: id }, me.sets.callback);
|
||||
layer.close(index);
|
||||
});
|
||||
},
|
||||
//文本
|
||||
textarea: function (id,txt, pid, to_uid, to_uname) {
|
||||
let that = this;
|
||||
let display='',usersInput='',height='286px';
|
||||
if(id==0){
|
||||
usersInput='<div class="layui-input-wrap" style="margin-bottom:5px;"><div class="layui-input-prefix"><i class="layui-icon layui-icon-at"></i></div><input type="text" placeholder="要提醒的员工" value="'+to_uname+'" readonly class="layui-input picker-admin" data-type="2" /><input type="hidden" id="to_uids" value="'+to_uid+'" /></div>';
|
||||
height='320px';
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '请输入评论内容',
|
||||
area: ['600px', height],
|
||||
content: '<div style="padding:5px;">'+usersInput+'<textarea class="layui-textarea" id="editTextarea" style="width: 100%; height: 160px;">'+txt+'</textarea></div>',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
btnAlign: 'c',
|
||||
btn: ['提交保存'],
|
||||
yes: function () {
|
||||
let to_uids = $("#to_uids").val();
|
||||
let newval = $("#editTextarea").val();
|
||||
if (newval != '') {
|
||||
that.add(id,newval,pid,to_uids);
|
||||
} else {
|
||||
layer.msg('请输入评论内容');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
init: function (options) {
|
||||
this.sets = $.extend({}, opts, options);
|
||||
let me = this;
|
||||
let commentBox = $('#'+me.sets.box);
|
||||
me.load();
|
||||
$('#'+me.sets.input).on('click', function () {
|
||||
me.textarea(0,'',0,0,'');
|
||||
})
|
||||
//回复
|
||||
commentBox.on('click', '[data-event="replay"]', function () {
|
||||
let pid = $(this).data('id');
|
||||
let to_uid = $(this).data('uid');
|
||||
let to_unames = $(this).data('unames');
|
||||
me.textarea(0,'',pid,to_uid,to_unames);
|
||||
})
|
||||
//编辑
|
||||
commentBox.on('click', '[data-event="edit"]', function () {
|
||||
let id = $(this).data('id');
|
||||
let content = commentBox.find('#comment_' + id).data('content');
|
||||
me.textarea(id,content,0,0,'');
|
||||
})
|
||||
//删除
|
||||
commentBox.on('click', '[data-event="del"]', function () {
|
||||
let id = $(this).data('id');
|
||||
me.del(id);
|
||||
})
|
||||
//加载更多
|
||||
commentBox.on('click','.log-more',function(){
|
||||
let page = commentBox.data(page);
|
||||
let callback = function (res) {
|
||||
me.template(res,page);
|
||||
}
|
||||
tool.get("/api/comment/datalist", {topic_id: me.sets.topic_id,module: me.sets.module,page:page}, callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
exports('oaComment', obj);
|
||||
});
|
||||
@@ -0,0 +1,390 @@
|
||||
layui.define(['tool','oaPicker','tinymce'],function(exports){
|
||||
let layer = layui.layer,tool=layui.tool,laydate = layui.laydate,dropdown = layui.dropdown,oaPicker = layui.oaPicker,tinymce = layui.tinymce;
|
||||
const opts={
|
||||
"box":'editBox',//编辑容器id
|
||||
"id":0,//编辑容器id
|
||||
"url": '',
|
||||
"dropdown":{},
|
||||
"callback":function(e){
|
||||
layer.msg(e.msg);
|
||||
if(e.code==0){
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const obj = {
|
||||
log: function (box,name,action_id) {
|
||||
let page=1;
|
||||
let callback = function (res) {
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
let itemLog = '',logTime='';
|
||||
$.each(res.data, function (index, item) {
|
||||
let detail = "";
|
||||
if(logTime != item.create_time){
|
||||
if(logTime==''){
|
||||
itemLog+='<dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||||
}
|
||||
else{
|
||||
itemLog+='</dl><dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||||
}
|
||||
logTime = item.create_time;
|
||||
}
|
||||
detail= `
|
||||
<span class="log-content gray">将<strong>${item.field_name}</strong>从 <span class="green">${item.old_content}</span> ${item.action}为 <span class="blue">${item.new_content}</span><span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
|
||||
if(item.field=='new'){
|
||||
detail= `
|
||||
<span class="log-content gray">创建了该数据记录<span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
|
||||
itemLog+= `
|
||||
<dd><img src="${item.thumb}" class="log-thumb" /><span class="log-name">${item.admin_name}</span>${detail}</dd>
|
||||
`;
|
||||
});
|
||||
itemLog+='</dl>';
|
||||
if(res.data.length>19){
|
||||
itemLog+='<div class="py-3 log-more"><button class="layui-btn layui-btn-normal layui-btn-sm" type="button">查看更多</button></div>';
|
||||
}
|
||||
$("#"+box).html(itemLog);
|
||||
$('#'+box+'Total').html(res.action.total);
|
||||
}
|
||||
else{
|
||||
if(page ==1){
|
||||
$("#"+box).html('<div class="layui-data-none">暂无记录</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
tool.get("/api/index/load_log", {name:name,action_id:action_id,page:page}, callback);
|
||||
$("#"+box).on('click','.log-more',function(){
|
||||
page++;
|
||||
tool.get("/api/index/load_log", {name:name,action_id:action_id,page:page}, callback);
|
||||
});
|
||||
},
|
||||
//短文本
|
||||
text: function (that) {
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let text = that.data('text');
|
||||
if (typeof(text) == "undefined") {
|
||||
text = that.text();
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '请输入内容',
|
||||
area: ['360px', '158px'],
|
||||
content: '<div style="padding:5px;"><input class="layui-input" id="oaEditText" value="' + text + '"/></div>',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
btnAlign: 'c',
|
||||
btn: ['提交保存'],
|
||||
yes: function () {
|
||||
let val = $("#oaEditText").val();
|
||||
if (val != '') {
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = val;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
} else {
|
||||
layer.msg('请输入内容');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//长文本
|
||||
textarea: function (that) {
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let target = that.data('target');
|
||||
let textarea='';
|
||||
if (typeof(target) == "undefined") {
|
||||
textarea = that.text();
|
||||
}
|
||||
else{
|
||||
textarea = $('#'+target).text();
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '请输入内容',
|
||||
area: ['600px', '320px'],
|
||||
content: '<div style="padding:5px;"><textarea class="layui-textarea" id="oaEditTextarea" style="width: 100%; height: 200px;">' + textarea + '</textarea></div>',
|
||||
btnAlign: 'c',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
btn: ['提交保存'],
|
||||
yes: function () {
|
||||
let val = $("#oaEditTextarea").val();
|
||||
if (val != '') {
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = val;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
} else {
|
||||
layer.msg('请输入内容');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//数字
|
||||
num: function (that) {
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let text = that.data('text');
|
||||
let min = that.data('min');
|
||||
let max = that.data('max');
|
||||
if (typeof(min) == "undefined") {
|
||||
min = '';
|
||||
}
|
||||
if (typeof(max) == "undefined") {
|
||||
max = '';
|
||||
}
|
||||
if (typeof(text) == "undefined") {
|
||||
text = that.text();
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '请输入数字',
|
||||
area: ['200px', '158px'],
|
||||
content: '<div style="padding:5px;"><input class="layui-input" oninput="this.value = this.value.replace(/[^0-9]/g,\'\')" id="oaEditNum" value="' + text + '"/></div>',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
btnAlign: 'c',
|
||||
btn: ['提交保存'],
|
||||
yes: function () {
|
||||
let val = $("#oaEditNum").val();
|
||||
if (val != '') {
|
||||
if(min !='' && val<min){
|
||||
layer.msg('输入数字不能小于'+min);
|
||||
return false;
|
||||
}
|
||||
if(max !='' && val>max){
|
||||
layer.msg('输入数字不能大于'+max);
|
||||
return false;
|
||||
}
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = val;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
} else {
|
||||
layer.msg('请输入内容');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
dropdown: function (that) {
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let text = that.data('text');
|
||||
let cancel = that.data('cancel');
|
||||
let arrayidx = that.data('array');
|
||||
if (typeof(text) == "undefined") {
|
||||
text = that.text();
|
||||
}
|
||||
if (typeof(cancel) == "undefined") {
|
||||
cancel = 0;
|
||||
}
|
||||
let data = me.sets.dropdown[arrayidx];
|
||||
let len = data.length;
|
||||
while (len--) {
|
||||
if (data[len].id == text) {
|
||||
data.splice(len, 1);
|
||||
}
|
||||
}
|
||||
if (data.length == 0) {
|
||||
layer.msg('无可关联的内容');
|
||||
return false;
|
||||
}
|
||||
if (cancel==1) {
|
||||
data.push({ id: 0, title: '<span style="color:#FF5722">取消关联</span>' });
|
||||
}
|
||||
dropdown.render({
|
||||
elem: that,
|
||||
show: true,
|
||||
data: data,
|
||||
click: function (data, othis) {
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = data.id;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
}
|
||||
});
|
||||
},
|
||||
oadate: function (that) {
|
||||
let me = this;
|
||||
let type = that.data('type');
|
||||
let range = that.data('range');
|
||||
let min = that.data('min');
|
||||
let max = that.data('max');
|
||||
if (typeof(type) == "undefined" || type === '') {
|
||||
type = 'date';
|
||||
}
|
||||
if (typeof(range) == "undefined" || type === '') {
|
||||
range = false;
|
||||
}
|
||||
if (typeof(min) == "undefined" || min === '') {
|
||||
min = '1900-1-1';
|
||||
}
|
||||
if (typeof(max) == "undefined" || max === '') {
|
||||
max = '2099-1-1';
|
||||
}
|
||||
let field = that.data('field');
|
||||
let text = that.data('text');
|
||||
if (typeof(text) == "undefined") {
|
||||
text = that.text();
|
||||
}
|
||||
layui.laydate.render({
|
||||
elem: that,
|
||||
show: true,
|
||||
type: type,
|
||||
range: range,
|
||||
min: min,
|
||||
max: max,
|
||||
fullPanel: true,
|
||||
done: function (val, date) {
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = val;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
}
|
||||
});
|
||||
},
|
||||
adminpicker: function (that){
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let ids = that.data('ids');
|
||||
let names = that.data('names');
|
||||
let type = that.data('type');
|
||||
if (typeof(type) == "undefined") {
|
||||
type = 1;
|
||||
}
|
||||
oaPicker.employeeInit({
|
||||
ids:ids.toString(),
|
||||
names:names.toString(),
|
||||
type:type,
|
||||
callback:function(seleted){
|
||||
let select_id=[],select_name=[];
|
||||
for(var a=0; a<seleted.length;a++){
|
||||
select_id.push(seleted[a].id);
|
||||
select_name.push(seleted[a].name);
|
||||
}
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = select_id.join(',');
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
}
|
||||
});
|
||||
},
|
||||
picker:function(that){
|
||||
let me = this;
|
||||
let field = that.data('field');
|
||||
let types = that.data('picker');
|
||||
let type = that.data('type');
|
||||
let where = that.data('where');
|
||||
let map = {}
|
||||
if (typeof(type) == "undefined") {
|
||||
type = 1;
|
||||
}
|
||||
if (typeof(where) == "undefined" || where == '') {
|
||||
map = {};
|
||||
}
|
||||
else{
|
||||
const jsonStr = where.replace(/(\w+):/g, '"$1":').replace(/'/g, '"');
|
||||
map = JSON.parse(jsonStr);
|
||||
}
|
||||
let callback = function(data){
|
||||
let ids = [],titles=[];
|
||||
for ( var i = 0; i <data.length; i++){
|
||||
ids.push(data[i].id);
|
||||
titles.push(data[i].title);
|
||||
}
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = ids.join(',');
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
}
|
||||
oaPicker.picker(types,type,callback,map);
|
||||
},
|
||||
editor:function(that){
|
||||
let me = this,index = Date.now();
|
||||
let field = that.data('field');
|
||||
let target = that.data('target');
|
||||
let content='';
|
||||
if (typeof(target) == "undefined") {
|
||||
content = that.html();
|
||||
}
|
||||
else{
|
||||
content = $('#'+target).html();
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '请输入内容',
|
||||
zIndex:20,
|
||||
area: ['900px', '600px'],
|
||||
content: '<div style="padding:5px;"><textarea class="layui-textarea" id="oaEditEditor'+index+'" style="width: 100%;">' + content + '</textarea></div>',
|
||||
btnAlign: 'c',
|
||||
btn: ['提交保存'],
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success:function(){
|
||||
var edit = tinymce.render({
|
||||
selector: "#oaEditEditor"+index,
|
||||
images_upload_url: '/api/index/upload/sourse/tinymce',//图片上传接口
|
||||
height: 480
|
||||
});
|
||||
},
|
||||
yes: function () {
|
||||
let val = tinyMCE.editors['oaEditEditor'+index].getContent();
|
||||
if (val != '') {
|
||||
let postData = {'id':me.sets.id,'scene':'oaedit'};
|
||||
postData[field] = val;
|
||||
tool.post(me.sets.url,postData,me.sets.callback);
|
||||
} else {
|
||||
layer.msg('请输入内容');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
init: function (options) {
|
||||
this.sets = $.extend({}, opts, options);
|
||||
let me = this;
|
||||
let editBox = $('#'+me.sets.box);
|
||||
editBox.find('.click-edit').addClass('on');
|
||||
editBox.on('click','.click-edit',function(){
|
||||
let that = $(this);
|
||||
let types = that.data('types');
|
||||
switch (types) {
|
||||
case "num":
|
||||
me.num(that);
|
||||
break;
|
||||
case "oadate":
|
||||
me.oadate(that);
|
||||
break;
|
||||
case "textarea":
|
||||
me.textarea(that);
|
||||
break;
|
||||
case "dropdown":
|
||||
me.dropdown(that);
|
||||
break;
|
||||
case "adminpicker":
|
||||
me.adminpicker(that);
|
||||
break;
|
||||
case "picker":
|
||||
me.picker(that);
|
||||
break;
|
||||
case "editor":
|
||||
me.editor(that);
|
||||
break;
|
||||
default:
|
||||
me.text(that);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
//输出接口
|
||||
exports('oaEdit', obj);
|
||||
});
|
||||
@@ -0,0 +1,247 @@
|
||||
layui.define(['tool'], function (exports) {
|
||||
const layer = layui.layer;
|
||||
const form = layui.form;
|
||||
const tool = layui.tool;
|
||||
const dropdown = layui.dropdown;
|
||||
const opts={
|
||||
"flowBox":'flowBox',
|
||||
"flowBar":'flowBar',
|
||||
"callback": null
|
||||
};
|
||||
const obj = {
|
||||
loading:false,
|
||||
size:1.0,
|
||||
//节点模版
|
||||
nodeApend: function (types,nodeId) {
|
||||
let nodeHtml = '';
|
||||
if(types == 1){
|
||||
//审核人
|
||||
nodeHtml = `<div><div class="node-wrap">
|
||||
<div class="node-wrap-box">
|
||||
<div class="node-title" style="background:#ffb800;">
|
||||
<span class="user-edit">审核人</span>
|
||||
<i class="remove-node" data-id="${nodeId}">✖</i>
|
||||
</div>
|
||||
<div>
|
||||
<span>请设置审核人</span>
|
||||
<i class="select-icon"><?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19 12L31 24L19 36" stroke="#333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><div>`;
|
||||
}
|
||||
else if(types == 2){
|
||||
//抄送人
|
||||
nodeHtml = `<div><div class="node-wrap">
|
||||
<div class="node-wrap-box">
|
||||
<div class="node-title" style="background:#1e9fff;">
|
||||
<span class="user-edit">抄送人</span>
|
||||
<i class="remove-node" data-id="${nodeId}">✖</i>
|
||||
</div>
|
||||
<div>
|
||||
<span>请设置抄送人</span>
|
||||
<i class="select-icon"><?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19 12L31 24L19 36" stroke="#333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><div>`;
|
||||
}
|
||||
else if(types==3){
|
||||
//条件分支
|
||||
nodeHtml = `<div class="branch-wrap">
|
||||
<div class="branch-box-wrap">
|
||||
<div class="branch-box">
|
||||
<span class="add-branch" title="添加条件">添加条件分支</span>
|
||||
<div class="col-box">
|
||||
<div class="condition-node">
|
||||
<div class="condition-node-box">
|
||||
<div class="condition-judge">
|
||||
<div class="condition-title">
|
||||
<input type="text" class="condition-input" placeholder="条件1">
|
||||
<span class="condition-priority">优先级1</span>
|
||||
<i class="remove-node" data-id="${nodeId}">✖</i>
|
||||
</div>
|
||||
<div>
|
||||
请设置条件
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-left-cover-line"></div>
|
||||
<div class="bottom-left-cover-line"></div>
|
||||
</div>
|
||||
<div class="col-box">
|
||||
<div class="condition-node">
|
||||
<div class="condition-node-box">
|
||||
<div class="condition-judge">
|
||||
<div class="condition-title">
|
||||
<input type="text" class="condition-input" placeholder="其他情况">
|
||||
<span class="condition-priority">优先级2</span>
|
||||
</div>
|
||||
<div>
|
||||
如存在未满足其他分支条件的情况,则进入此分支
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-right-cover-line"></div>
|
||||
<div class="bottom-right-cover-line"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
else{
|
||||
//条件内容
|
||||
nodeHtml = `<div class="col-box">
|
||||
<div class="condition-node">
|
||||
<div class="condition-node-box">
|
||||
<div class="condition-judge">
|
||||
<div class="condition-title">
|
||||
<input type="text" class="condition-input" placeholder="条件1">
|
||||
<span class="condition-priority">优先级1</span>
|
||||
<i class="remove-node" data-id="${nodeId}">✖</i>
|
||||
</div>
|
||||
<div>
|
||||
请设置条件
|
||||
</div>
|
||||
</div>
|
||||
<div class="node-add-btn-box">
|
||||
<div class="add-node-btn">
|
||||
<button class="add-node">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
return nodeHtml;
|
||||
},
|
||||
init: function (options) {
|
||||
this.settings = $.extend({}, opts, options);
|
||||
let me = this;
|
||||
let flowBox = $('#'+me.settings.flowBox);
|
||||
let flowBar = $('#'+me.settings.flowBar);
|
||||
//添加节点
|
||||
flowBox.on("click",".add-node",function(e){
|
||||
let that = $(this);
|
||||
dropdown.render({
|
||||
elem: that,
|
||||
show: true, // 外部事件触发即显示
|
||||
data: [{
|
||||
title: '审 核 人',
|
||||
id: '1',
|
||||
templet: function(d){
|
||||
return '<i style="vertical-align: sub; color:red"><?xml version="1.0" encoding="UTF-8"?><svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 36L8.00461 28.0426C8.00551 27.4906 8.45313 27.0432 9.00519 27.0426C12.3391 27.0426 15.6731 27.0426 19.0071 27.0426C19.9286 27.0426 19.9237 26.2252 19.9237 24.2792C19.9237 22.3332 15.0221 20.6941 15.0221 13.8528C15.0221 7.01151 20.0999 5 24.32 5C28.5401 5 33.1366 7.01151 33.1366 13.8528C33.1366 20.6941 28.2607 21.7818 28.2607 24.2792C28.2607 26.7765 28.2607 27.0426 29.0413 27.0426C32.3609 27.0426 35.6806 27.0426 39.0003 27.0426C39.5525 27.0426 40.0003 27.4904 40.0003 28.0426V36H8Z" fill="none" stroke="#ffb800" stroke-width="4" stroke-linejoin="round"/><path d="M8 42H40" stroke="#ffb800" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></i> ' + d.title;
|
||||
}
|
||||
}, {
|
||||
title: '抄 送 人',
|
||||
id: '2',
|
||||
templet: function(d){
|
||||
return '<i style="vertical-align: sub; color:red"><?xml version="1.0" encoding="UTF-8"?><svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M43 5L29.7 43L22.1 25.9L5 18.3L43 5Z" stroke="#1e9fff" stroke-width="4" stroke-linejoin="round"/><path d="M43.0001 5L22.1001 25.9" stroke="#1e9fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></i> ' + d.title;
|
||||
}
|
||||
}, {
|
||||
title: '条件分支',
|
||||
id: '3',
|
||||
templet: function(d){
|
||||
return '<i style="vertical-align: sub; color:red"><?xml version="1.0" encoding="UTF-8"?><svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 33V15" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><rect x="10" y="9" width="28" height="6" fill="none" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 32L14 25H33.9743L40 32" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><rect x="4" y="33" width="8" height="8" fill="none" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><rect x="20" y="33" width="8" height="8" fill="none" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><rect x="36" y="33" width="8" height="8" fill="none" stroke="#16b777" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></i> ' + d.title;
|
||||
}
|
||||
}],
|
||||
click: function(data, othis){
|
||||
let timestamp = new Date().getTime();
|
||||
that.parent().parent().parent().parent().after(me.nodeApend(data.id,timestamp));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//添加条件
|
||||
flowBox.on("click",".add-branch",function(e){
|
||||
let timestamp = new Date().getTime();
|
||||
$(this).parent().find(".col-box").first().after(me.nodeApend(4,timestamp));
|
||||
let branchWrap = $($(this).parents(".branch-wrap")[0]);
|
||||
let colBbox = branchWrap.find('.col-box');
|
||||
colBbox.each(function(index,item){
|
||||
$(item).find('.condition-priority').html('优先级'+(index+1));
|
||||
if(index<colBbox.length-1){
|
||||
$(item).find('.condition-input').attr('placeholder','条件'+(index+1));
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
//删除节点、条件
|
||||
flowBox.on("click",".remove-node",function(e){
|
||||
if($(this).parents().hasClass("condition-judge")){
|
||||
let idx =$(this).closest('.col-box').index();
|
||||
let branchWrap = $($(this).parents(".branch-wrap")[0]);
|
||||
let colBbox = branchWrap.find('.col-box');
|
||||
if(colBbox.length==2 || idx==1){
|
||||
layer.confirm('确定需要删除整个条件分支?', {icon: 3}, function(){
|
||||
branchWrap.remove();
|
||||
layer.closeAll();
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(this).closest(".col-box").remove();
|
||||
colBbox = branchWrap.find('.col-box');
|
||||
colBbox.each(function(index,item){
|
||||
$(item).find('.condition-priority').html('优先级'+(index+1));
|
||||
if(index<colBbox.length-1){
|
||||
$(item).find('.condition-input').attr('placeholder','条件'+(index+1));
|
||||
}
|
||||
});
|
||||
}
|
||||
}else if($(this).parents().hasClass("node-wrap")){
|
||||
$(this).closest(".node-wrap").parent().remove();
|
||||
}
|
||||
})
|
||||
|
||||
//放大、缩小
|
||||
flowBar.on("click",".zoom-ctrl",function(e){
|
||||
let type = $(this).data('type'),size=1;
|
||||
if(type==1){
|
||||
size = me.size - 0.25;
|
||||
}
|
||||
else{
|
||||
size = me.size + 0.25;
|
||||
}
|
||||
|
||||
if(size<=0){
|
||||
layer.msg('已经是最小了');
|
||||
return false;
|
||||
}
|
||||
else if(size>3){
|
||||
layer.msg('已经是最大了');
|
||||
return false;
|
||||
}
|
||||
me.size = size;
|
||||
flowBox.css("transform","scale("+size+")");
|
||||
flowBar.find('.zoom-num').html((size*100)+'%');
|
||||
})
|
||||
}
|
||||
};
|
||||
exports('oaFlow', obj);
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
layui.define([], function (exports) {
|
||||
let oaNumber = {
|
||||
// 加法函数
|
||||
accAdd:function(arg1, arg2) {
|
||||
var r1, r2, m;
|
||||
try {
|
||||
// 获取到小数点的位数
|
||||
r1 = arg1.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
// 取位数最大的 10^ n次方
|
||||
m = Math.pow(10, Math.max(r1, r2));
|
||||
return (arg1 * m + arg2 * m) / m;
|
||||
},
|
||||
//减法函数
|
||||
accSub:function(arg1, arg2) {
|
||||
var r1, r2, m, n;
|
||||
try {
|
||||
r1 = arg1.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2)); // 动态控制精度长度
|
||||
// 计算结果保留的位数
|
||||
n = (r1 >= r2) ? r1 : r2;
|
||||
return parseFloat(((arg1 * m - arg2 * m) / m).toFixed(n));
|
||||
},
|
||||
//乘法函数
|
||||
accMul:function(arg1, arg2) {
|
||||
var m = 0,
|
||||
s1 = arg1.toString(),
|
||||
s2 = arg2.toString();
|
||||
try {
|
||||
m += s1.split(".")[1].length;
|
||||
} catch (e) {
|
||||
}
|
||||
try {
|
||||
m += s2.split(".")[1].length;
|
||||
} catch (e) {
|
||||
}
|
||||
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
|
||||
},
|
||||
//除法函数
|
||||
accDiv(arg1, arg2) {
|
||||
var t1 = 0,
|
||||
t2 = 0,
|
||||
r1, r2;
|
||||
try {
|
||||
t1 = arg1.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
}
|
||||
try {
|
||||
t2 = arg2.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
}
|
||||
with (Math) {
|
||||
r1 = Number(arg1.toString().replace(".", ""));
|
||||
r2 = Number(arg2.toString().replace(".", ""));
|
||||
return (r1 / r2) * pow(10, t2 - t1);
|
||||
}
|
||||
},
|
||||
//千分号格式化金额
|
||||
accFormat:function (num) {
|
||||
if (typeof num !== 'number') {
|
||||
return '-';
|
||||
}
|
||||
if(num=='-'||num==''){
|
||||
return '-';
|
||||
}
|
||||
var res=num.toString().replace(/\d+/, function(n){ // 先提取整数部分
|
||||
return n.replace(/(\d)(?=(\d{3})+$)/g,function($1){
|
||||
return $1+",";
|
||||
});
|
||||
})
|
||||
return res;
|
||||
},
|
||||
//金额转人民币大写
|
||||
accCny:function(num){
|
||||
if (typeof num !== 'number') {
|
||||
return '-';
|
||||
}
|
||||
if (num === 0) {
|
||||
return '零元整';
|
||||
}
|
||||
const fraction = ['角', '分'];
|
||||
const digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
|
||||
const unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
|
||||
let head = num < 0 ? '欠' : '';
|
||||
num = Math.abs(num);
|
||||
let s = '';
|
||||
for (let i = 0; i < fraction.length; i++) {
|
||||
s += (digit[Math.floor(num * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
|
||||
}
|
||||
s = s || '整';
|
||||
num = Math.floor(num);
|
||||
for (let i = 0; i < unit[0].length && num > 0; i++) {
|
||||
let p = '';
|
||||
for (let j = 0; j < unit[1].length && num > 0; j++) {
|
||||
p = digit[num % 10] + unit[1][j] + p;
|
||||
num = Math.floor(num / 10);
|
||||
}
|
||||
s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
|
||||
}
|
||||
return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
|
||||
}
|
||||
};
|
||||
exports('oaNumber', oaNumber);
|
||||
});
|
||||
@@ -0,0 +1,539 @@
|
||||
layui.define(['tool'], function (exports) {
|
||||
const layer = layui.layer, tool = layui.tool,form=layui.form, table=layui.table,tree = layui.tree;
|
||||
|
||||
const dataPicker ={
|
||||
'department':{
|
||||
title:'选择部门',
|
||||
url:'/api/index/get_department',
|
||||
area: ['400px', '524px'],
|
||||
searchbar:'',
|
||||
page:false,
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'部门名称'}]
|
||||
},
|
||||
'position':{
|
||||
title:'选择岗位',
|
||||
url:'/api/index/get_position',
|
||||
area: ['400px', '524px'],
|
||||
searchbar:'',
|
||||
page:false,
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'岗位名称'}]
|
||||
},
|
||||
'services':{
|
||||
title:'选择服务类型',
|
||||
url:'/api/index/get_services',
|
||||
area: ['400px', '524px'],
|
||||
searchbar:'',
|
||||
page:false,
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'服务名称'},{field:'price',title:'服务单价'}]
|
||||
},
|
||||
'template':{
|
||||
title:'选择消息模板',
|
||||
url:'/api/index/get_template',
|
||||
area: ['600px', '568px'],
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'消息模板名称'}]
|
||||
},
|
||||
'workcate':{
|
||||
title:'选择工作类型',
|
||||
url:'/api/index/get_work_cate',
|
||||
area: ['400px', '524px'],
|
||||
searchbar:'',
|
||||
page:false,
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'工作类型名称'}]
|
||||
},
|
||||
'property':{
|
||||
title:'选择固定资产',
|
||||
url:'/adm/api/get_property',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'资产名称'}]
|
||||
},
|
||||
'car':{
|
||||
title:'选择车辆信息',
|
||||
url:'/adm/api/get_car',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'车辆名称'},{field:'name',width:100,title:'车牌号码',align:'center'}]
|
||||
},
|
||||
'room':{
|
||||
title:'选择会议室',
|
||||
url:'/adm/api/get_meeting_room',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'会议室名称'},{field:'num',width:100,title:'可容纳人数',align:'center'}]
|
||||
},
|
||||
'customer':{
|
||||
title:'选择客户',
|
||||
url:'/customer/api/get_customer',
|
||||
add:'/customer/customer/add',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'name',title:'客户名称'}]
|
||||
},
|
||||
'supplier':{
|
||||
title:'选择供应商',
|
||||
url:'/contract/api/get_supplier',
|
||||
add:'/contract/supplier/add',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'供应商名称'}]
|
||||
},
|
||||
'contract':{
|
||||
title:'选择销售合同',
|
||||
url:'/contract/api/get_contract',
|
||||
area: ['800px', '568px'],
|
||||
cols:[{ field: 'code',width:160,title:'合同编号',align:'center'},{field:'name',title:'合同名称'},{ field:'customer',title:'关联客户',width: 240}]
|
||||
},
|
||||
'product':{
|
||||
title:'选择产品',
|
||||
url:'/contract/api/get_product',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'产品名称'},{field:'sale_price',title:'销售单价',width: 120,align:'center'}]
|
||||
},
|
||||
'purchase':{
|
||||
title:'选择采购合同',
|
||||
url:'/contract/api/get_purchase',
|
||||
area: ['800px', '568px'],
|
||||
cols:[{ field: 'code',width:160,title:'合同编号',align:'center'},{field:'name',title:'合同名称'},{ field:'supplier',title:'关联供应商',width: 240}]
|
||||
},
|
||||
'purchased':{
|
||||
title:'选择采购物品',
|
||||
url:'/contract/api/get_purchased',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'采购物品名称'},{field:'purchase_price',title:'采购单价',width: 120,align:'center'}]
|
||||
},
|
||||
'project':{
|
||||
title:'选择项目',
|
||||
url:'/project/api/get_project',
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{field:'title',title:'项目名称'}]
|
||||
},
|
||||
'task':{
|
||||
title:'选择任务',
|
||||
url:'/project/api/get_task',
|
||||
area: ['800px', '568px'],
|
||||
cols:[{field:'id',width:90,title:'序号',align:'center'},{ field:'title',title:'任务主题'},{field:'project',width:240,title:'关联项目'}]
|
||||
},
|
||||
'loan':{
|
||||
title:'选择借支冲抵',
|
||||
url:'/finance/api/get_loan',
|
||||
area: ['800px', '568px'],
|
||||
cols:[{field: 'id',width: 80,title:'序号',align:'center'},{field:'cost',title:'借款金额(元)',width: 100},{field:'un_balance_cost',title:'未冲账金额(元)',width: 110},{field:'balance_cost',title:'已冲账金额(元)',width: 110},{field:'title',title:'借支主题',minWidth:200}]
|
||||
}
|
||||
}
|
||||
|
||||
let select_ids=[];select_names=[];select_array=[];
|
||||
const obj = {
|
||||
employeeRender:function(){
|
||||
var me=this,letterTem='';
|
||||
for(var i=0;i<26;i++){
|
||||
letterTem+='<span class="layui-letter-span" data-code="'+String.fromCharCode(97+i)+'">'+String.fromCharCode(65+i)+'</span>';
|
||||
}
|
||||
var tpl='<div style="width:210px; height:388px; border-right:1px solid #eee; overflow-x: hidden; overflow-y: auto; float:left;">\
|
||||
<div id="employeeDepament" style="padding:6px 0;"></div>\
|
||||
</div>\
|
||||
<div style="width:588px; height:388px; user-select:none; overflow-x: hidden; overflow-y: auto; float:left;">\
|
||||
<div style="padding:12px 10px 0;"><div style="color:#999; text-align:center;">⇐ 点击左边部门筛选员工,或者点击下面字母筛选</div><div id="letterBar" style="color:#999; text-align:center;">'+letterTem+'</div></div>\
|
||||
<div id="employee" style="padding:6px 12px"></div>\
|
||||
<div style="padding:10px 15px; border-top:1px solid #eee;;"><strong>已选择</strong><span class="layui-tags-all">全选</span></div>\
|
||||
<div id="selectTags" style="padding:10px 15px;">'+me.employeeSelect(0)+'</div>\
|
||||
</div>';
|
||||
return tpl;
|
||||
},
|
||||
employeeSelect:function(t){
|
||||
var me=this,select_tags='';
|
||||
if(me.settings.type == 0){
|
||||
select_tags+='<span style="color:#1E9FFF">'+me.settings.names+'</span>';
|
||||
}
|
||||
else{
|
||||
select_ids=[];
|
||||
select_names=[];
|
||||
for(var a=0;a<select_array.length;a++){
|
||||
if(me.settings.fixedid==select_array[a].id && me.settings.fixedid!=0){
|
||||
select_tags+='<span class="layui-tags-span">'+select_array[a].name+'</span>';
|
||||
}
|
||||
else{
|
||||
select_tags+='<span class="layui-tags-span">'+select_array[a].name+'<i data-id="'+select_array[a].id+'" class="layui-icon layui-tags-close">ဆ</i></span>';
|
||||
}
|
||||
if(t==1){
|
||||
$('#employee').find('[data-id="'+select_array[a].id+'"]').addClass('on');
|
||||
}
|
||||
select_ids.push(parseInt(select_array[a].id));
|
||||
select_names.push(select_array[a].name);
|
||||
}
|
||||
}
|
||||
//console.log(select_array);
|
||||
return select_tags;
|
||||
},
|
||||
employeeInit: function (options) {
|
||||
const opts={
|
||||
"title":"选择员工",
|
||||
"department_url": "/api/index/get_department_tree",
|
||||
"employee_url": "/api/index/get_employee",
|
||||
"type":1,//1单人,2多人
|
||||
"fixedid":0,
|
||||
"ids":"",
|
||||
"names":"",
|
||||
"ajax_data":[],
|
||||
"callback": function(){}
|
||||
};
|
||||
this.settings = $.extend({}, opts, options);
|
||||
var me=this;
|
||||
select_ids=[];
|
||||
select_names=[];
|
||||
select_array=[];
|
||||
if(me.settings.ids!='' && me.settings.names!=''){
|
||||
select_ids=me.settings.ids.split(',');
|
||||
select_names=me.settings.names.split(',');
|
||||
//select_ids.sort((a, b) => a - b);
|
||||
for(var m=0;m<select_ids.length;m++){
|
||||
select_array.push({id:select_ids[m],name:select_names[m]});
|
||||
}
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type:1,
|
||||
title:me.settings.title,
|
||||
area:['800px','500px'],
|
||||
resize:false,
|
||||
content:me.employeeRender(),
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success:function(obj,idx){
|
||||
var dataList=[],letterBar=$('#letterBar'),employee = $('#employee'),selectTags = $('#selectTags');
|
||||
$.ajax({
|
||||
url:me.settings.department_url,
|
||||
type:'get',
|
||||
success:function(res){
|
||||
//仅节点左侧图标控制收缩
|
||||
tree.render({
|
||||
elem: '#employeeDepament',
|
||||
data: res.trees,
|
||||
onlyIconControl: true, //是否仅允许节点左侧图标控制展开收缩
|
||||
click: function(obj){
|
||||
var tagsItem='<div style="color:#999; text-align:center;">暂无员工</div>';
|
||||
$("#employeeDepament").find('.layui-tree-main').removeClass('on');
|
||||
$(obj.elem).find('.layui-tree-main').eq(0).addClass('on');
|
||||
letterBar.find('span').removeClass('on');
|
||||
$.ajax({
|
||||
url:me.settings.employee_url,
|
||||
type:'get',
|
||||
data:{did:obj.data.id},
|
||||
success:function(res){
|
||||
me.ajax_data = res.data;
|
||||
dataList=me.ajax_data;
|
||||
if(dataList.length>1 && me.settings.type == 2){
|
||||
$('.layui-tags-all').show();
|
||||
}
|
||||
else{
|
||||
$('.layui-tags-all').hide();
|
||||
}
|
||||
if(dataList.length>0){
|
||||
tagsItem='';
|
||||
for(var i=0; i<dataList.length; i++){
|
||||
if(select_ids.indexOf(dataList[i].id) == -1){
|
||||
tagsItem+='<span class="layui-tags-span" data-idx="'+i+'" data-id="'+dataList[i].id+'">'+dataList[i].name+'</span>';
|
||||
}
|
||||
else{
|
||||
tagsItem+='<span class="layui-tags-span on" data-idx="'+i+'" data-id="'+dataList[i].id+'">'+dataList[i].name+'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
employee.html(tagsItem);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
letterBar.on("click" ,'span',function(){
|
||||
var code=$(this).data('code');
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
$.ajax({
|
||||
url:me.settings.employee_url,
|
||||
type:'get',
|
||||
data:{id:1},
|
||||
success:function(res){
|
||||
me.ajax_data = res.data;
|
||||
var letterData=[],tagsItem='<div style="color:#999; text-align:center;">暂无员工</div>';;
|
||||
if(me.ajax_data.length>0){
|
||||
var tagsItemCode='';
|
||||
for(var i=0; i<me.ajax_data.length; i++){
|
||||
if(me.ajax_data[i].username.slice(0,1)==code){
|
||||
if(select_ids.indexOf(me.ajax_data[i].id) == -1){
|
||||
tagsItemCode+='<span class="layui-tags-span" data-idx="'+i+'" data-id="'+me.ajax_data[i].id+'">'+me.ajax_data[i].name+'</span>';
|
||||
}
|
||||
else{
|
||||
tagsItemCode+='<span class="layui-tags-span on" data-idx="'+i+'" data-id="'+me.ajax_data[i].id+'">'+me.ajax_data[i].name+'</span>';
|
||||
}
|
||||
letterData.push(me.ajax_data[i]);
|
||||
}
|
||||
}
|
||||
dataList=letterData;
|
||||
if(dataList.length>2 && me.settings.type == 2){
|
||||
$('.layui-tags-all').show();
|
||||
}
|
||||
else{
|
||||
$('.layui-tags-all').hide();
|
||||
}
|
||||
if(tagsItemCode!=''){
|
||||
tagsItem = tagsItemCode;
|
||||
}
|
||||
}
|
||||
employee.html(tagsItem);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
if(me.settings.type == 2){
|
||||
$('.layui-tags-all').on('click',function(){
|
||||
for(var a=0; a<dataList.length;a++){
|
||||
if(select_ids.indexOf(dataList[a]['id']) == -1){
|
||||
select_array.push(dataList[a]);
|
||||
}
|
||||
}
|
||||
selectTags.html(me.employeeSelect(1));
|
||||
});
|
||||
}
|
||||
|
||||
employee.on('click','.layui-tags-span',function(){
|
||||
let item_idx=$(this).data('idx');
|
||||
let select_item = me.ajax_data[item_idx];
|
||||
if(me.settings.type == 1){
|
||||
me.settings.callback([select_item]);
|
||||
layer.close(idx);
|
||||
}
|
||||
else{
|
||||
if(select_ids.indexOf(select_item['id']) == -1){
|
||||
select_array.push(select_item);
|
||||
selectTags.html(me.employeeSelect(1));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
selectTags.on('click','.layui-tags-close',function(){
|
||||
let id=$(this).data('id');
|
||||
let new_slected=[];
|
||||
$('#employee').find('[data-id="'+id+'"]').removeClass('on');
|
||||
for(var i=0;i<select_array.length;i++){
|
||||
if(select_array[i].id!=id){
|
||||
new_slected.push(select_array[i]);
|
||||
}
|
||||
}
|
||||
select_array=new_slected;
|
||||
selectTags.html(me.employeeSelect(1));
|
||||
});
|
||||
if(me.settings.type == 1){
|
||||
$('#layui-layer'+idx).find('.layui-layer-btn0').hide();
|
||||
}
|
||||
},
|
||||
btn: ['确定添加', '清空已选'],
|
||||
btnAlign:'c',
|
||||
btn1: function(idx){
|
||||
me.settings.callback(select_array);
|
||||
layer.close(idx);
|
||||
},
|
||||
btn2: function(idx){
|
||||
let canceldata= {department:"",did:0,id:0,mobile:0,name:"",nickname:"",position_id:0,sex:0,status:0,thumb:"",username:""};
|
||||
me.settings.callback([canceldata]);
|
||||
layer.close(idx);
|
||||
}
|
||||
})
|
||||
},
|
||||
picker:function(types,type,callback,map){
|
||||
let pickerIndex = new Date().getTime();
|
||||
let pickerTable,options;
|
||||
const opts={
|
||||
"title":"选择",
|
||||
"url": "",
|
||||
"ids":"",
|
||||
"titles":"",
|
||||
"where":map,
|
||||
"area": ['600px', '568px'],
|
||||
"cols":[{field: 'id',width: 80,title:'序号',align:'center'},{field:'title',title:'名称'}],
|
||||
"searchbar":'<form class="layui-form pb-2"><div class="layui-input-inline" style="width:420px; margin-right:5px;"><input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off" /></div><button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="picker">提交搜索</button><button type="reset" class="layui-btn layui-btn-reset" lay-filter="picker-reset">清空</button></form>',
|
||||
"page":true,
|
||||
"type":type,//1单选择,2多选
|
||||
"btnno":true,
|
||||
"add": "",//新增url
|
||||
"callback": callback
|
||||
};
|
||||
if(Object.prototype.toString.call(types) === '[object Object]'){
|
||||
options = types;
|
||||
}
|
||||
else{
|
||||
options = dataPicker[types];
|
||||
}
|
||||
let settings = $.extend({},opts,options);
|
||||
//console.log(settings);
|
||||
let btn = ['确定选择'];
|
||||
if(settings.btnno==true){
|
||||
btn = ['确定选择','清空已选'];
|
||||
}
|
||||
if(settings.add!=''){
|
||||
btn = ['确定选择','清空已选','新增'];
|
||||
}
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
title: settings.title,
|
||||
area: settings.area,
|
||||
type: 1,
|
||||
skin: 'gougu-picker',
|
||||
content: '<div class="picker-table" id="pickerBox'+pickerIndex+'">'+settings.searchbar+'<div id="pickerTable'+pickerIndex+'"></div></div>',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success: function () {
|
||||
let cols=[];
|
||||
if(settings.type==1){
|
||||
cols = [{type: 'radio', title: '选择'}, ...settings.cols];
|
||||
}
|
||||
if(settings.type==2){
|
||||
cols = [{type: 'checkbox', title: '选择'}, ...settings.cols];
|
||||
}
|
||||
pickerTable = table.render({
|
||||
elem: '#pickerTable'+pickerIndex,
|
||||
url: settings.url,
|
||||
where:settings.where,
|
||||
page: settings.page, //开启分页
|
||||
limit: 10,
|
||||
height: '407',
|
||||
cols: [cols]
|
||||
});
|
||||
//请求分类
|
||||
if(settings.cate_url){
|
||||
tool.get(settings.cate_url,{},function(res){
|
||||
let cate='';
|
||||
for(let b=0; b<res.data.length;b++){
|
||||
cate+='<option value="'+res.data[b].id+'">'+res.data[b].title+'</option>';
|
||||
}
|
||||
$('#pickerBox'+pickerIndex).find('.table_cate_id').append(cate);
|
||||
form.render('select');
|
||||
})
|
||||
}
|
||||
form.render();
|
||||
//搜索提交
|
||||
form.on('submit(picker)', function (data) {
|
||||
let maps = $.extend({}, settings.where, data.field);
|
||||
pickerTable.reload({where:maps,page:{curr: 1}});
|
||||
return false;
|
||||
});
|
||||
//重置搜索提交
|
||||
$('#pickerBox'+pickerIndex).on('click', '[lay-filter="picker-reset"]', function () {
|
||||
let prev = $(this).prev();
|
||||
if (typeof(prev) != "undefined" ) {
|
||||
setTimeout(function () {
|
||||
prev.click();
|
||||
}, 10)
|
||||
}
|
||||
});
|
||||
},
|
||||
btn: btn,
|
||||
btnAlign: 'c',
|
||||
btn1: function (idx) {
|
||||
var checkStatus = table.checkStatus(pickerTable.config.id);
|
||||
var data = checkStatus.data;
|
||||
if (data.length > 0) {
|
||||
callback(data);
|
||||
layer.close(idx);
|
||||
}
|
||||
else {
|
||||
layer.msg('请先选择内容');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
btn2: function (idx) {
|
||||
callback([{'id':0,'title':'','name':''}]);
|
||||
layer.close(idx);
|
||||
},
|
||||
btn3: function (idx) {
|
||||
tool.side(settings.add);
|
||||
layer.close(idx);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//选择员工弹窗
|
||||
$('body').on('click','.picker-admin',function () {
|
||||
let that = $(this);
|
||||
let type = that.data('type');
|
||||
if (typeof(type) == "undefined" || type == '') {
|
||||
type = 1;
|
||||
}
|
||||
let ids=that.next().val()+'',names = that.val()+'';
|
||||
obj.employeeInit({
|
||||
ids:ids,
|
||||
names:names,
|
||||
type:type,
|
||||
callback:function(data){
|
||||
let select_id=[],select_name=[],select_did=[];
|
||||
for(var a=0; a<data.length;a++){
|
||||
select_id.push(data[a].id);
|
||||
select_name.push(data[a].name);
|
||||
select_did.push(data[a].did);
|
||||
}
|
||||
console.log(select_name);
|
||||
that.val(select_name.join(','));
|
||||
that.next().val(select_id.join(','));
|
||||
that.next().next().val(select_did.join(','));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//选择下属员工弹窗
|
||||
$('body').on('click','.picker-sub',function () {
|
||||
let that = $(this);
|
||||
let type = that.data('type');
|
||||
if (typeof(type) == "undefined" || type == '') {
|
||||
type = 1;
|
||||
}
|
||||
let ids=that.next().val()+'',names = that.val()+'';
|
||||
obj.employeeInit({
|
||||
title:"选择下属",
|
||||
department_url: "/api/index/get_department_tree_sub",
|
||||
employee_url: "/api/index/get_employee_sub",
|
||||
ids:ids,
|
||||
names:names,
|
||||
type:type,
|
||||
callback:function(data){
|
||||
let select_id=[],select_name=[],select_did=[];
|
||||
for(var a=0; a<data.length;a++){
|
||||
select_id.push(data[a].id);
|
||||
select_name.push(data[a].name);
|
||||
select_did.push(data[a].did);
|
||||
}
|
||||
console.log(select_name);
|
||||
that.val(select_name.join(','));
|
||||
that.next().val(select_id.join(','));
|
||||
that.next().next().val(select_did.join(','));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//选择OA数据弹层
|
||||
$('body').on('click','.picker-oa',function () {
|
||||
let that = $(this),ids = [],titles=[],map = {};
|
||||
let types = that.data('types');
|
||||
let type = that.data('type');
|
||||
let where = that.data('where');
|
||||
if (typeof(types) == "undefined" || types == '') {
|
||||
layer.msg('请设置【picker】的类型');
|
||||
return false;
|
||||
}
|
||||
if (typeof(type) == "undefined" || type == '') {
|
||||
type = 1;
|
||||
}
|
||||
if (typeof(where) == "undefined" || where == '') {
|
||||
map = {};
|
||||
}
|
||||
else{
|
||||
const jsonStr = where.replace(/(\w+):/g, '"$1":').replace(/'/g, '"');
|
||||
map = JSON.parse(jsonStr);
|
||||
}
|
||||
let callback = function(data){
|
||||
for ( var i = 0; i <data.length; i++){
|
||||
ids.push(data[i].id);
|
||||
if(!data[i].title){
|
||||
titles.push(data[i].name);
|
||||
}else{
|
||||
titles.push(data[i].title);
|
||||
}
|
||||
}
|
||||
that.val(titles.join(','));
|
||||
that.next().val(ids.join(','));
|
||||
}
|
||||
obj.picker(types,type,callback,map);
|
||||
});
|
||||
|
||||
//输出接口
|
||||
exports('oaPicker', obj);
|
||||
});
|
||||
@@ -0,0 +1,298 @@
|
||||
layui.define(['tool'], function (exports) {
|
||||
const tool = layui.tool,layer = layui.layer,form = layui.form,laydate = layui.laydate;
|
||||
const obj = {
|
||||
loading:false,
|
||||
load: function (tid) {
|
||||
let callback = function (res) {
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
let itemSchedule = '';
|
||||
$.each(res.data, function (index, item) {
|
||||
itemSchedule += `
|
||||
<div class="pt-2">
|
||||
<p class="gray">${item.start_time}~${item.end_time},${item.labor_time}工时</p>
|
||||
<p><span class="blue">${item.name}:</span>${item.title}</p>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
$("#schedule_" + tid).html(itemSchedule);
|
||||
layer.closeAll();
|
||||
}
|
||||
}
|
||||
tool.get("/project/api/task_schedule", { tid: tid }, callback);
|
||||
},
|
||||
//保存
|
||||
save: function (postData) {
|
||||
let callback = function (e) {
|
||||
if (e.code == 0) {
|
||||
layer.closeAll();
|
||||
layer.msg(e.msg);
|
||||
if(layui.scheduleTable){
|
||||
layui.scheduleTable.reload();
|
||||
}
|
||||
else{
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
},1000);
|
||||
}
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
tool.post("/oa/schedule/add", postData, callback);
|
||||
},
|
||||
//查看
|
||||
view: function (detail) {
|
||||
let project = '';
|
||||
if(detail.tid>0){
|
||||
project = `<table class="layui-table" style="margin:12px 12px 0;">
|
||||
<tr>
|
||||
<td class="layui-td-gray">关联项目</td>
|
||||
<td>${detail.project}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关联任务</td>
|
||||
<td>${detail.task}</td>
|
||||
</tr>
|
||||
</table>`;
|
||||
}
|
||||
let content = `<div style="width:696px">
|
||||
<table class="layui-table" style="margin:12px 12px 0;">
|
||||
<tr>
|
||||
<td class="layui-td-gray">执行员工</td>
|
||||
<td>${detail.name}</td>
|
||||
<td class="layui-td-gray">所在部门</td>
|
||||
<td>${detail.department}</td>
|
||||
<td class="layui-td-gray">工作类别</td>
|
||||
<td>${detail.work_cate}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">时间范围</td>
|
||||
<td colspan="3">${detail.start_time} 至 ${detail.end_time},共${detail.labor_time}工时</td>
|
||||
<td class="layui-td-gray">工作类型</td>
|
||||
<td>${detail.labor_type_string}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">工作内容</td>
|
||||
<td colspan="5">${detail.title}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">补充描述</td>
|
||||
<td colspan="5">${detail.remark}</td>
|
||||
</tr>
|
||||
</table>
|
||||
${project}
|
||||
</div>`;
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '工作记录详情',
|
||||
area: ['720px', '420px'],
|
||||
content: content,
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success: function () {
|
||||
|
||||
},
|
||||
btn: ['关闭'],
|
||||
btnAlign: 'c',
|
||||
yes: function (idx) {
|
||||
layer.close(idx);
|
||||
}
|
||||
})
|
||||
},
|
||||
add: function (tid, schedule) {
|
||||
let that = this, detail = {}, title = '添加工作记录';
|
||||
if(that.loading == true){
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
let html_time = '';
|
||||
if (schedule['id'] > 0) {
|
||||
if(schedule['admin_id'] != login_admin){
|
||||
layer.msg('不能编辑他人的工作记录');
|
||||
that.loading = false;
|
||||
return false;
|
||||
}
|
||||
title = '编辑工作记录';
|
||||
detail['id'] = schedule['id'];
|
||||
detail['cid'] = schedule['cid'];
|
||||
detail['tid'] = schedule['tid'];
|
||||
detail['title'] = schedule['title'];
|
||||
detail['labor_type'] = schedule['labor_type'];
|
||||
detail['start_time_a'] = schedule['start_time_a'];
|
||||
detail['start_time_b'] = schedule['start_time_b'];
|
||||
detail['end_time_a'] = schedule['end_time_a'];
|
||||
detail['end_time_b'] = schedule['end_time_b'];
|
||||
detail['remark'] = schedule['remark'];
|
||||
|
||||
html_time = detail.start_time_a+' '+detail.start_time_b+' 至 '+detail.end_time_b+',共'+schedule.labor_time+'工时';
|
||||
} else {
|
||||
detail['id'] = schedule['id'];
|
||||
detail['tid'] = tid;
|
||||
detail['cid'] = 1;
|
||||
detail['title'] = '';
|
||||
detail['labor_type'] = 0;
|
||||
detail['start_time_a'] = schedule['start_time_a']?schedule['start_time_a']:'';
|
||||
detail['start_time_b'] = '09:00';
|
||||
detail['end_time_a'] = schedule['end_time_a']?schedule['end_time_a']:'';
|
||||
detail['end_time_b'] = '09:30';
|
||||
detail['remark'] = '';
|
||||
|
||||
html_time = `<input id="start_time_a" name="start_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="${detail.start_time_a}" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="${detail.end_time_a}" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>`;
|
||||
}
|
||||
let callback = function(e){
|
||||
that.loading = false;
|
||||
if(e.code==0){
|
||||
let cate = e.data;
|
||||
let content = `<form class="layui-form" style="width:696px">
|
||||
<table class="layui-table" style="margin:12px 12px 0;">
|
||||
<tr>
|
||||
<td class="layui-td-gray">时间范围 <span style="color: red">*</span></td>
|
||||
<td>${html_time}</td>
|
||||
<td class="layui-td-gray">工作类别<font>*</font></td>
|
||||
<td style="width: 120px;"><select name="cid" lay-filter="work_cate" id="work_cate"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">工作类型<font>*</font></td>
|
||||
<td colspan="3"><input type="radio" name="labor_type" lay-filter="labor_type" value="1" title="案头工作"><input type="radio" name="labor_type" value="2" lay-filter="labor_type" title="外勤工作"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">工作内容 <span style="color: red">*</span></td>
|
||||
<td colspan="3"><input name="title" class="layui-input" value="${detail.title}" lay-verify="required" lay-reqText="请完成工作内容"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">补充描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;">${detail.remark}</textarea>
|
||||
<input name="tid" type="hidden" value="${detail.tid}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>`;
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
area: ['720px', '420px'],
|
||||
content: content,
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success: function () {
|
||||
if (detail['id'] == 0) {
|
||||
//日期时间范围
|
||||
laydate.render({
|
||||
elem: '#start_time_a',
|
||||
type: 'date',
|
||||
min: -7,
|
||||
max: 0,
|
||||
format: 'yyyy-MM-dd',
|
||||
showBottom: false,
|
||||
done: function (a, b, c) {
|
||||
$('#end_time_a').val(a);
|
||||
detail.start_time_a = a;
|
||||
detail.end_time_a = a;
|
||||
}
|
||||
});
|
||||
|
||||
//日期时间范围
|
||||
laydate.render({
|
||||
elem: '#end_time_a',
|
||||
type: 'date',
|
||||
min: -7,
|
||||
max: 0,
|
||||
format: 'yyyy-MM-dd',
|
||||
showBottom: false,
|
||||
done: function (a, b, c) {
|
||||
$('#start_time_a').val(a);
|
||||
detail.start_time_a = a;
|
||||
detail.end_time_a = a;
|
||||
}
|
||||
});
|
||||
$('#start_time_b,#end_time_b').empty();
|
||||
|
||||
var hourArray = [];
|
||||
for (var h = 0; h < 24; h++) {
|
||||
var t = h < 10 ? '0' + h : h
|
||||
var t_1 = t + ':00', t_2 = t + ':15', t_3 = t + ':30', t_4 = t + ':45';
|
||||
hourArray.push(t_1, t_2, t_3, t_4);
|
||||
}
|
||||
|
||||
var html_1 = '', html_2 = '', def_h1 = detail['start_time_b'], def_h2 = detail['end_time_b'];
|
||||
for (var s = 0; s < hourArray.length; s++) {
|
||||
var check_1 = '', check_2 = '';
|
||||
if (hourArray[s] == def_h1) {
|
||||
check_1 = 'selected';
|
||||
}
|
||||
if (hourArray[s] == def_h2) {
|
||||
check_2 = 'selected';
|
||||
}
|
||||
html_1 += '<option value="' + hourArray[s] + '" ' + check_1 + '>' + hourArray[s] + '</option>';
|
||||
html_2 += '<option value="' + hourArray[s] + '" ' + check_2 + '>' + hourArray[s] + '</option>';
|
||||
}
|
||||
|
||||
$('#start_time_b').append(html_1);
|
||||
$('#end_time_b').append(html_2);
|
||||
}
|
||||
$("input[name=labor_type][value="+detail.labor_type+"]").prop("checked","true");
|
||||
|
||||
var html_c='';
|
||||
for (var c = 0; c < cate.length; c++) {
|
||||
var check_c = '';
|
||||
if (cate[c].id == detail['cid']) {
|
||||
check_c = 'selected';
|
||||
}
|
||||
html_c += '<option value="' + cate[c].id + '" ' + check_c + '>' + cate[c].title + '</option>';
|
||||
}
|
||||
|
||||
$('#work_cate').append(html_c);
|
||||
|
||||
form.render();
|
||||
|
||||
form.on('select(start_time_b)', function (data) {
|
||||
detail.start_time_b = data.value;
|
||||
});
|
||||
form.on('select(end_time_b)', function (data) {
|
||||
detail.end_time_b = data.value;
|
||||
});
|
||||
$('[name="title"]').on('input', function () {
|
||||
var _val = $(this).val();
|
||||
detail.title = _val;
|
||||
});
|
||||
form.on('radio(labor_type)', function(data){
|
||||
detail.labor_type=data.value;
|
||||
})
|
||||
form.on('select(work_cate)', function(data){
|
||||
detail.cid=data.value;
|
||||
})
|
||||
$('[form-input="remark"]').on('input', function () {
|
||||
var _val = $(this).val();
|
||||
detail.remark = _val;
|
||||
});
|
||||
},
|
||||
btn: ['确定提交'],
|
||||
btnAlign: 'c',
|
||||
yes: function (idx) {
|
||||
if (detail.start_time_a == '' || detail.end_time_a == '') {
|
||||
layer.msg('请选择工作时间范围');
|
||||
return;
|
||||
}
|
||||
if(detail.labor_type==0){
|
||||
layer.msg('请选择工作类型');
|
||||
return;
|
||||
}
|
||||
if (detail.title == '') {
|
||||
layer.msg('请填写工作内容');
|
||||
return;
|
||||
}
|
||||
that.save(detail);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
tool.get("/api/index/get_work_cate", {}, callback);
|
||||
}
|
||||
};
|
||||
exports('oaSchedule', obj);
|
||||
});
|
||||
@@ -0,0 +1,359 @@
|
||||
layui.define(['tool','oaPicker'], function (exports) {
|
||||
const layer = layui.layer;
|
||||
const form = layui.form;
|
||||
const tool = layui.tool;
|
||||
const laydate = layui.laydate;
|
||||
const oaPicker = layui.oaPicker;
|
||||
// 定义工作时间段
|
||||
const workPeriods = [
|
||||
{ start: 8, end: 12 }, // 早上工作时间段
|
||||
{ start: 14, end: 18 } // 下午工作时间段
|
||||
];
|
||||
const obj = {
|
||||
//计算工时
|
||||
calculateWorkHours:function(startTimeStr, endTimeStr) {
|
||||
if(startTimeStr == '' || endTimeStr==''){
|
||||
return 0;
|
||||
}
|
||||
// 解析时间字符串为Date对象
|
||||
const startTime = new Date(startTimeStr);
|
||||
const endTime = new Date(endTimeStr);
|
||||
|
||||
// 确保结束时间晚于或等于开始时间
|
||||
if (endTime < startTime) {
|
||||
layer.msg('结束时间必须晚于或等于开始时间');
|
||||
return 0;
|
||||
}
|
||||
let totalWorkHours = 0;
|
||||
|
||||
// 遍历每一天
|
||||
let currentDay = new Date(startTime);
|
||||
let nextDay = new Date(currentDay);
|
||||
//nextDay.setDate(nextDay.getDate() + 1); // 设置为下一天的同一时间
|
||||
|
||||
while (currentDay <= endTime) {
|
||||
// 计算当前天的工作时间
|
||||
for (const period of workPeriods) {
|
||||
// 获取当前天的工作时间段开始和结束时间
|
||||
let dayStart = new Date(currentDay.getFullYear(), currentDay.getMonth(), currentDay.getDate(), period.start, 0, 0);
|
||||
let dayEnd = new Date(currentDay.getFullYear(), currentDay.getMonth(), currentDay.getDate(), period.end, 0, 0);
|
||||
|
||||
// 检查是否在当前天的工作时间段内
|
||||
if (currentDay <= dayEnd && (dayStart <= endTime || dayStart <= currentDay)) {
|
||||
// 计算重叠的时间段
|
||||
let overlapStart = Math.max(dayStart, Math.max(currentDay, startTime));
|
||||
let overlapEnd = Math.min(dayEnd, endTime);
|
||||
|
||||
// 计算重叠时间段的时长(以毫秒为单位)
|
||||
let overlapDuration = overlapEnd - overlapStart;
|
||||
|
||||
// 将时长转换为小时,并累加到总工时
|
||||
totalWorkHours += overlapDuration / (1000 * 60 * 60);
|
||||
}
|
||||
}
|
||||
|
||||
// 移到下一天
|
||||
currentDay = nextDay;
|
||||
nextDay.setDate(nextDay.getDate() + 1);
|
||||
}
|
||||
// 保留两位小数
|
||||
return totalWorkHours.toFixed(2);
|
||||
},
|
||||
count_total:function(detail){
|
||||
let amount=0,work_total=0;
|
||||
if(detail.fee==''){
|
||||
detail.fee=0;
|
||||
}
|
||||
if(detail.hours==0){
|
||||
amount = detail.fee;
|
||||
}
|
||||
else{
|
||||
work_total = detail.hours*detail.work_price;
|
||||
amount = (detail.fee*100+work_total*100)/100;
|
||||
}
|
||||
let total = {amount:amount.toFixed(2),work_total:work_total.toFixed(2)}
|
||||
return total;
|
||||
},
|
||||
//保存
|
||||
save: function (postData) {
|
||||
let callback = function (e) {
|
||||
if (e.code == 0) {
|
||||
layer.closeAll();
|
||||
layer.msg(e.msg);
|
||||
if(layui.workTable){
|
||||
layui.workTable.reload();
|
||||
}
|
||||
else{
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
},1000);
|
||||
}
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
tool.post("/task/work/add", postData, callback);
|
||||
},
|
||||
//查看
|
||||
view: function (detail) {
|
||||
let demand = '',problems = '',task = '';
|
||||
if(detail.demand_id>0){
|
||||
demand = `<tr><td class="layui-td-gray">关联请求</td><td colspan="3">${detail.demand}</td></tr>`;
|
||||
}
|
||||
if(detail.problems_id>0){
|
||||
problems = `<tr><td class="layui-td-gray">关联问题</td><td colspan="3">${detail.problems}</td></tr>`;
|
||||
}
|
||||
if(detail.task_id>0){
|
||||
task = `<tr><td class="layui-td-gray">关联任务</td><td colspan="3">${detail.task}</td></tr>`;
|
||||
}
|
||||
let content = `<div class="p-2">
|
||||
<table class="layui-table" style="margin:0">
|
||||
${demand}
|
||||
${problems}
|
||||
${task}
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">开始时间</td>
|
||||
<td>${detail.start_time}</td>
|
||||
<td class="layui-td-gray-2">结束时间</td>
|
||||
<td>${detail.end_time}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所有者</td>
|
||||
<td>${detail.director_name}</td>
|
||||
<td class="layui-td-gray">工时费用(元)</td>
|
||||
<td>${detail.work_price}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所用工时(小时)</td>
|
||||
<td>${detail.hours}</td>
|
||||
<td class="layui-td-gray">技术费用(元)</td>
|
||||
<td>${detail.work_total}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">其他费用(元)</td>
|
||||
<td>${detail.fee}</td>
|
||||
<td class="layui-td-gray">总费用(元)</td>
|
||||
<td>${detail.amount}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">工作内容</td>
|
||||
<td colspan="3">${detail.title}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">补充描述</td>
|
||||
<td colspan="3">${detail.remark}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>`;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '工作记录详情',
|
||||
area: ['692px', '432px'],
|
||||
content: content,
|
||||
success: function () {
|
||||
|
||||
},
|
||||
btn: ['关闭'],
|
||||
btnAlign: 'c',
|
||||
yes: function (idx) {
|
||||
layer.close(idx);
|
||||
}
|
||||
})
|
||||
},
|
||||
add: function (schedule) {
|
||||
let that = this, detail = {}, title = '添加工作记录',timestamp = new Date().getTime();;
|
||||
let html_time = '';
|
||||
if (schedule['id'] > 0) {
|
||||
title = '编辑工作记录';
|
||||
detail['id'] = schedule['id'];
|
||||
detail['title'] = schedule['title'];
|
||||
detail['start_time'] = schedule['start_time'];
|
||||
detail['end_time'] = schedule['end_time'];
|
||||
detail['director_name'] = schedule['director_name'];
|
||||
detail['director_id'] = schedule['director_id'];
|
||||
detail['hours'] = schedule['hours'];
|
||||
detail['work_price'] = schedule['work_price'];
|
||||
detail['fee'] = schedule['fee'];
|
||||
detail['work_total'] = schedule['work_total'];
|
||||
detail['amount'] = schedule['amount'];
|
||||
detail['remark'] = schedule['remark'];
|
||||
} else {
|
||||
detail['task_id'] = schedule['task_id'];
|
||||
detail['problems_id'] = schedule['problems_id'];
|
||||
detail['demand_id'] = schedule['demand_id'];
|
||||
detail['title'] = '';
|
||||
detail['start_time'] = '';
|
||||
detail['end_time'] = '';
|
||||
detail['director_name'] = '';
|
||||
detail['director_id'] = 0;
|
||||
detail['hours'] = 0;
|
||||
detail['work_price'] = 0;
|
||||
detail['fee'] = 0;
|
||||
detail['work_total'] = 0;
|
||||
detail['amount'] = 0;
|
||||
detail['remark'] = '';
|
||||
}
|
||||
let content = `<form class="layui-form p-2">
|
||||
<table class="layui-table" style="margin:0" id="table${timestamp}">
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">开始时间 <span style="color: red">*</span></td>
|
||||
<td><input id="start_time" name="start_time" class="layui-input" value="${detail.start_time}" readonly lay-verify="required" lay-reqText="请选择"></td>
|
||||
<td class="layui-td-gray-2">结束时间 <span style="color: red">*</span></td>
|
||||
<td><input id="end_time" name="end_time" class="layui-input" value="${detail.end_time}" readonly lay-verify="required" lay-reqText="请选择"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所有者<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="director_name" lay-verify="required" readonly placeholder="请选择" lay-reqText="请完善所有者" class="layui-input picker-diy" value="${detail.director_name}">
|
||||
<input type="hidden" name="director_id" value="${detail.director_id}">
|
||||
</td>
|
||||
<td class="layui-td-gray">工时费用(元)</td>
|
||||
<td><input name="work_price" class="layui-input layui-input-readonly" value="${detail.work_price}" readonly lay-verify="number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所用工时(小时)</td>
|
||||
<td><input name="hours" class="layui-input layui-input-readonly" readonly value="${detail.hours}" lay-verify="number"></td>
|
||||
<td class="layui-td-gray">技术费用(元)</td>
|
||||
<td><input name="work_total" class="layui-input layui-input-readonly" value="${detail.work_total}" readonly lay-verify="number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">其他费用(元)</td>
|
||||
<td><input name="fee" class="layui-input" value="${detail.fee}" lay-verify="number"></td>
|
||||
<td class="layui-td-gray">总费用(元)</td>
|
||||
<td><input name="amount" class="layui-input layui-input-readonly" value="${detail.amount}" readonly lay-verify="number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">工作内容 <span style="color: red">*</span></td>
|
||||
<td colspan="3"><input name="title" class="layui-input" value="${detail.title}" lay-verify="required" lay-reqText="请完成工作内容"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">补充描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:92px;">${detail.remark}</textarea>
|
||||
<input name="tid" type="hidden" value="${detail.tid}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>`;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
area: ['800px', '500px'],
|
||||
content: content,
|
||||
success: function () {
|
||||
//选择员工弹窗
|
||||
$('#table'+timestamp).on('click','.picker-diy',function () {
|
||||
let self = $(this);
|
||||
let ids=self.next().val()+'',names = self.val()+'';
|
||||
oaPicker.employeeInit({
|
||||
ids:ids,
|
||||
names:names,
|
||||
type:1,//1是单选,2是多选
|
||||
callback:function(data){
|
||||
self.val(data[0].name);
|
||||
self.next().val(data[0].id);
|
||||
detail.director_id = data[0].id;
|
||||
if(data[0].id==0){
|
||||
data[0].work_price=0.00;
|
||||
}
|
||||
detail.work_price = data[0].work_price;
|
||||
$('[name="work_price"]').val(data[0].work_price);
|
||||
let total = that.count_total(detail);
|
||||
$('[name="amount"]').val(total.amount);
|
||||
$('[name="work_total"]').val(total.work_total);
|
||||
detail.amount = total.amount;
|
||||
detail.work_total = total.work_total;
|
||||
}
|
||||
});
|
||||
});
|
||||
//日期时间范围
|
||||
laydate.render({
|
||||
elem: '#start_time',
|
||||
max: 0,
|
||||
type: 'datetime',
|
||||
format: 'yyyy-MM-dd HH:mm',
|
||||
fullPanel: true,
|
||||
done: function (a, b, c) {
|
||||
detail.start_time = a;
|
||||
detail.hours = that.calculateWorkHours(detail.start_time,detail.end_time);
|
||||
$('[name="hours"]').val(detail.hours);
|
||||
let total = that.count_total(detail);
|
||||
$('[name="amount"]').val(total.amount);
|
||||
$('[name="work_total"]').val(total.work_total);
|
||||
detail.amount = total.amount;
|
||||
detail.work_total = total.work_total;
|
||||
}
|
||||
});
|
||||
|
||||
//日期时间范围
|
||||
laydate.render({
|
||||
elem: '#end_time',
|
||||
max: 0,
|
||||
type: 'datetime',
|
||||
format: 'yyyy-MM-dd HH:mm',
|
||||
fullPanel: true,
|
||||
done: function (a, b, c) {
|
||||
detail.end_time = a;
|
||||
that.calculateWorkHours(detail.start_time,detail.end_time);
|
||||
detail.hours = that.calculateWorkHours(detail.start_time,detail.end_time);
|
||||
$('[name="hours"]').val(detail.hours);
|
||||
let total = that.count_total(detail);
|
||||
$('[name="amount"]').val(total.amount);
|
||||
$('[name="work_total"]').val(total.work_total);
|
||||
detail.amount = total.amount;
|
||||
detail.work_total = total.work_total;
|
||||
}
|
||||
});
|
||||
|
||||
form.render();
|
||||
|
||||
$('[name="title"]').on('input', function () {
|
||||
var _val = $(this).val();
|
||||
detail.title = _val;
|
||||
});
|
||||
$('[name="fee"]').on('input', function () {
|
||||
this.value = this.value.replace(/[^0-9]/g,'');
|
||||
var _val = $(this).val();
|
||||
detail.fee = _val;
|
||||
let total = that.count_total(detail);
|
||||
$('[name="amount"]').val(total.amount);
|
||||
$('[name="work_total"]').val(total.work_total);
|
||||
detail.amount = total.amount;
|
||||
detail.work_total = total.work_total;
|
||||
});
|
||||
$('[form-input="remark"]').on('input', function () {
|
||||
var _val = $(this).val();
|
||||
detail.remark = _val;
|
||||
});
|
||||
},
|
||||
btn: ['确定提交'],
|
||||
btnAlign: 'c',
|
||||
yes: function (idx) {
|
||||
if (detail.start_time == '') {
|
||||
layer.msg('请选择开始时间');
|
||||
return;
|
||||
}
|
||||
if (detail.end_time == '') {
|
||||
layer.msg('请选择结束时间');
|
||||
return;
|
||||
}
|
||||
if(detail.hours*100<=0){
|
||||
layer.msg('请选择工作时间有问题');
|
||||
return;
|
||||
}
|
||||
if(detail.director_id==0){
|
||||
layer.msg('请完善所有者');
|
||||
return;
|
||||
}
|
||||
if (detail.title == '') {
|
||||
layer.msg('请填写工作内容');
|
||||
return;
|
||||
}
|
||||
console.log(detail);
|
||||
that.save(detail);
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
exports('oaWork', obj);
|
||||
});
|
||||
@@ -0,0 +1,221 @@
|
||||
layui.define(function(exports) {
|
||||
//tablePlus在原来的table模块的基础上实现了批量数据导出功能,实现defaultToolbar中筛选列记忆功能,实现了外部搜索功能
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var MOD_NAME='tablePlus';
|
||||
var tablePlus=$.extend({},table);
|
||||
tablePlus._render = tablePlus.render;
|
||||
tablePlus.excel = function(total,options){
|
||||
//console.log(options);
|
||||
let _page = parseInt(total/options.excel_limit);
|
||||
let page = total%options.excel_limit>0?(_page+1):_page;
|
||||
let pageHtml='<p style="padding:16px 10px 0; text-align:center; color:red">由于导出数据比较消耗服务器资源,建议使用搜索功能筛选好数据再导出</p><p style="padding:5px 10px 10px; text-align:center; color:red">如果点击导出后,没有立即导出文件,请耐心等待一下,30秒内请勿重复点击。</p><p style="padding:0 10px; text-align:center;">共查询到<strong> '+total+' </strong>条数据,每次最多导出<strong>'+options.excel_limit+'</strong>条,共<strong>'+page+'</strong>页,请点击下面的页码导出</p><div id="exportPage" class="layui-box layui-laypage" style="padding:10px 0; width:100%;text-align:center;">';
|
||||
for (i = 1; i <= page; i++) {
|
||||
pageHtml += '<a href="javascript:;" data-page="'+i+'">'+i+'</a>';
|
||||
}
|
||||
pageHtml+='</div>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '导出数据',
|
||||
area:['580px','240px'],
|
||||
content: pageHtml,
|
||||
success:function(res){
|
||||
let tableWhere = JSON.parse(JSON.stringify(options.where));
|
||||
tableWhere.limit=options.excel_limit;
|
||||
$('#exportPage').on('click','a',function(){
|
||||
tableWhere.page=$(this).data('page');
|
||||
let msg = layer.msg('正在导出数据...', {time:3000});
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: tableWhere,
|
||||
success:function(res){
|
||||
table.exportFile(options.id, res.data,'csv');
|
||||
setTimeout(function(){
|
||||
layer.msg('导出完成');
|
||||
},2000)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
//重写渲染方法
|
||||
tablePlus.render=function(params){
|
||||
if(params.excel_auth === undefined){
|
||||
params.excel_auth = 1;
|
||||
}
|
||||
if(params.excel_limit === undefined){
|
||||
params.excel_limit = 10000;
|
||||
}
|
||||
if(params.cols_save === undefined){
|
||||
params.cols_save = false;
|
||||
}
|
||||
if(params.limit === undefined){
|
||||
params.limit = 20;
|
||||
}
|
||||
if(params.page === undefined){
|
||||
params.page = true;
|
||||
}
|
||||
if(params.cellMinWidth === undefined){
|
||||
params.cellMinWidth = 80;
|
||||
}
|
||||
if(params.help === undefined){
|
||||
params.help = '无帮助说明';
|
||||
}
|
||||
if(params.order_field === undefined){
|
||||
params.order_field = 'order_field';
|
||||
}
|
||||
if(params.order_type === undefined){
|
||||
params.order_type = 'order_type';
|
||||
}
|
||||
|
||||
let defaultToolbar = [
|
||||
'filter',
|
||||
{
|
||||
name: 'exports',
|
||||
onClick: function(obj) {
|
||||
// 当前示例配置项
|
||||
let options = obj.config;
|
||||
let total = obj.data.length;
|
||||
// 弹出面板
|
||||
obj.openPanel({
|
||||
list: [ // 列表
|
||||
'<li data-type="page">导出当前页</li>',
|
||||
'<li data-type="all">导出全部</li>'
|
||||
].join(''),
|
||||
done: function(panel, list) {
|
||||
list.on('click', function() {
|
||||
if(options.excel_auth==0){
|
||||
layer.msg('无权限导出');
|
||||
return false;
|
||||
}
|
||||
if(total==0){
|
||||
layer.msg('暂无数据');
|
||||
return false;
|
||||
}
|
||||
let type = $(this).data('type')
|
||||
if(type === 'page') {
|
||||
// 调用内置导出方法
|
||||
let msg = layer.msg('正在导出数据...', {time:1000});
|
||||
table.exportFile(options.id, null, 'csv');
|
||||
}else if(type === 'all') {
|
||||
let tableWhere = JSON.parse(JSON.stringify(options.where));
|
||||
tableWhere.limit=options.excel_limit;
|
||||
if(total<=tableWhere.limit){
|
||||
tableWhere.page=1;
|
||||
let msg = layer.msg('正在导出数据...', {time:3000});
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
data: tableWhere,
|
||||
success:function(res){
|
||||
table.exportFile(options.id, res.data,'csv');
|
||||
setTimeout(function(){
|
||||
layer.msg('导出完成');
|
||||
},3000)
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
tablePlus.excel(total,options)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},{
|
||||
title:'数据说明',
|
||||
icon: 'layui-icon-help',
|
||||
layEvent: 'LAYTABLE_HELP',
|
||||
onClick: function(obj) {
|
||||
layer.open({
|
||||
shadeClose: true,
|
||||
title:'帮助说明',
|
||||
type: 1,
|
||||
content: '<div style="padding:20px 15px; min-width:300px; line-height:1.8">'+obj.config.help+'</div>'
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
if(params.defaultToolbar != false){
|
||||
params.defaultToolbar = defaultToolbar;
|
||||
}
|
||||
if(params.cols_save == true){
|
||||
// 从本地存储获取用户保存的列显示设置
|
||||
let savedCols = localStorage.getItem('col-filter-'+params.url);
|
||||
let colsStatus = savedCols ? JSON.parse(savedCols) : {};
|
||||
let cols = params.cols;
|
||||
for (var i=0;i<cols[0].length;i++){
|
||||
if(cols[0][i].field!=undefined && colsStatus[cols[0][i].field] != undefined){
|
||||
cols[0][i].hide=colsStatus[cols[0][i].field];
|
||||
}
|
||||
}
|
||||
params.cols = cols;
|
||||
|
||||
if(typeof params.done === "function"){
|
||||
let _done = params.done;
|
||||
params.done = function(data, curr, count){
|
||||
let obj = this;
|
||||
_done(data, curr, count);
|
||||
obj.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
|
||||
var input = $(this).prev()[0];
|
||||
layui.data ('col-filter-'+params.url,{
|
||||
key: input.name,
|
||||
value: input.checked
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
params.done = function(data){
|
||||
let obj = this;
|
||||
obj.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
|
||||
var input = $(this).prev()[0];
|
||||
layui.data ('col-filter-'+params.url,{
|
||||
key: input.name,
|
||||
value: input.checked
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
var init = tablePlus._render(params);
|
||||
//监听搜索提交
|
||||
form.on('submit(table-search)', function(data) {
|
||||
init.reload({
|
||||
where: data.field,
|
||||
page: {curr: 1}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 触发排序事件
|
||||
let filter = $(params.elem).attr('lay-filter');
|
||||
table.on('sort('+filter+')', function(obj){
|
||||
$('[name="'+params.order_field+'"]').val(obj.field);
|
||||
$('[name="'+params.order_type+'"]').val(obj.type);
|
||||
var searchObject = form.val('barsearchform');
|
||||
layui.pageTable.reload({
|
||||
where:searchObject,
|
||||
page: {curr: 1}
|
||||
});
|
||||
});
|
||||
|
||||
//重置搜索提交
|
||||
$('body').on('click', '[lay-filter="table-reset"]', function () {
|
||||
let prev = $(this).prev();
|
||||
if (typeof(prev) != "undefined" ) {
|
||||
setTimeout(function () {
|
||||
prev.click();
|
||||
}, 20)
|
||||
}
|
||||
if(typeof params.searchreset === "function"){
|
||||
params.searchreset();
|
||||
}
|
||||
});
|
||||
return init;
|
||||
//console.log(params);
|
||||
};
|
||||
exports(MOD_NAME, tablePlus);
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
layui.define([], function (exports) {
|
||||
var MOD_NAME = 'tinymce';
|
||||
var modFile = layui.cache.modules['tinymce'];
|
||||
var modPath = modFile.substr(0, modFile.lastIndexOf('.'));
|
||||
var plugin_filename = 'tinymce.min.js'//插件名称
|
||||
var settings = {
|
||||
base_url:modPath,
|
||||
images_upload_url: '/admin/api/upload/sourse/tinymce',//图片上传接口
|
||||
images_upload_credentials:true,
|
||||
placeholder: '请输入内容...',
|
||||
language: 'zh_CN',//语言
|
||||
suffix: '.min',
|
||||
selector: '#gouguedit',
|
||||
quickbars_insert_toolbar:'',
|
||||
quickbars_selection_toolbar: 'cut copy | bold italic underline strikethrough ',
|
||||
plugins: 'code quickbars print preview searchreplace autolink fullscreen image link media codesample table charmap hr advlist lists wordcount imagetools paste',
|
||||
toolbar: 'code undo redo | forecolor backcolor bold italic underline strikethrough removeformat | alignleft aligncenter alignright alignjustify outdent indent | bullist numlist table blockquote link image media codesample | formatselect fontselect fontsizeselect',
|
||||
resize: false,
|
||||
elementpath: false,
|
||||
branding: false,
|
||||
statusbar: false,
|
||||
convert_urls: false,// 附件路径无需要转换为相对路径。
|
||||
contextmenu_never_use_native: true,
|
||||
paste_data_images: true,
|
||||
menubar: 'file edit insert format table',
|
||||
menu: {
|
||||
file: { title: '文件', items: 'preview fullscreen | wordcount' },
|
||||
edit: { title: '编辑', items: 'undo redo | cut copy paste pastetext selectall | searchreplace' },
|
||||
format: {
|
||||
title: '格式',
|
||||
items: 'bold italic underline strikethrough superscript subscript | formats | forecolor backcolor | removeformat'
|
||||
},
|
||||
table: { title: '表格', items: 'inserttable tableprops deletetable | cell row column' },
|
||||
},
|
||||
codesample_languages: [
|
||||
{text: 'HTML', value: 'html'},
|
||||
{text: 'JavaScript', value: 'javascript'},
|
||||
{text: 'CSS', value: 'css'},
|
||||
{text: 'PHP', value: 'php'},
|
||||
{text: 'Java', value: 'java'},
|
||||
{text: 'Shell', value: 'shell'},
|
||||
{text: 'SQL', value: 'sql'},
|
||||
{text: 'JOSN', value: 'json'},
|
||||
{text: 'Python', value: 'python'},
|
||||
{text: 'XML', value: 'xml'},
|
||||
{text: 'Golang', value: 'go'},
|
||||
{text: 'Objective-c', value: 'objective-c'},
|
||||
],
|
||||
fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
|
||||
font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats;知乎配置=BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;小米配置=Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif',
|
||||
setup: function(editor) {
|
||||
console.log("ID为: " + editor.id + " 的编辑器即将初始化.");
|
||||
},
|
||||
init_instance_callback : function(editor) {
|
||||
console.log("ID为: " + editor.id + " 的编辑器已初始化完成.");
|
||||
}
|
||||
};
|
||||
|
||||
var editor = {
|
||||
render: function (options) {
|
||||
loadScript();
|
||||
var opts = $.extend({}, settings, options), edit = this.get(opts.elem);
|
||||
if (edit) {
|
||||
edit.destroy();
|
||||
}
|
||||
tinymce.init(opts);
|
||||
return this.get(opts.elem);
|
||||
},
|
||||
// 获取ID对应的编辑器对象
|
||||
get: function (elem) {
|
||||
loadScript();
|
||||
if (elem && /^#|\./.test(elem)) {
|
||||
var id = elem.substr(1);
|
||||
var edit = tinymce.editors[id];
|
||||
return edit;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadScript() {
|
||||
if (typeof tinymce == 'undefined') {
|
||||
$.ajax({//获取插件
|
||||
url: modPath + '/' + plugin_filename,
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
async: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports(MOD_NAME, editor);
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
/**
|
||||
* Jquery integration plugin.
|
||||
*
|
||||
* @class tinymce.core.JqueryIntegration
|
||||
* @private
|
||||
*/
|
||||
!function(){function f(){
|
||||
// Reference to tinymce needs to be lazily evaluated since tinymce
|
||||
// might be loaded through the compressor or other means
|
||||
return d.tinymce}var p,c,u,s=[],d="undefined"!=typeof global?global:window,m=d.jQuery;m.fn.tinymce=function(o){var e,t,i,n,l=this,r="";
|
||||
// No match then just ignore the call
|
||||
return l.length?
|
||||
// Get editor instance
|
||||
o?(l.css("visibility","hidden"),
|
||||
// Load TinyMCE on demand, if we need to
|
||||
d.tinymce||c||!(e=o.script_url)?
|
||||
// Delay the init call until tinymce is loaded
|
||||
1===c?s.push(a):a():(c=1,t=e.substring(0,e.lastIndexOf("/")),
|
||||
// Check if it's a dev/src version they want to load then
|
||||
// make sure that all plugins, themes etc are loaded in source mode as well
|
||||
-1!=e.indexOf(".min")&&(r=".min"),
|
||||
// Setup tinyMCEPreInit object this will later be used by the TinyMCE
|
||||
// core script to locate other resources like CSS files, dialogs etc
|
||||
// You can also predefined a tinyMCEPreInit object and then it will use that instead
|
||||
d.tinymce=d.tinyMCEPreInit||{base:t,suffix:r},
|
||||
// url contains gzip then we assume it's a compressor
|
||||
-1!=e.indexOf("gzip")&&(i=o.language||"en",e=e+(/\?/.test(e)?"&":"?")+"js=true&core=true&suffix="+escape(r)+"&themes="+escape(o.theme||"modern")+"&plugins="+escape(o.plugins||"")+"&languages="+(i||""),
|
||||
// Check if compressor script is already loaded otherwise setup a basic one
|
||||
d.tinyMCE_GZ||(d.tinyMCE_GZ={start:function(){function n(e){f().ScriptLoader.markDone(f().baseURI.toAbsolute(e))}
|
||||
// Add core languages
|
||||
n("langs/"+i+".js"),
|
||||
// Add themes with languages
|
||||
n("themes/"+o.theme+"/theme"+r+".js"),n("themes/"+o.theme+"/langs/"+i+".js"),
|
||||
// Add plugins with languages
|
||||
m.each(o.plugins.split(","),function(e,t){t&&(n("plugins/"+t+"/plugin"+r+".js"),n("plugins/"+t+"/langs/"+i+".js"))})},end:function(){}})),(n=document.createElement("script")).type="text/javascript",n.onload=n.onreadystatechange=function(e){e=e||window.event,2===c||"load"!=e.type&&!/complete|loaded/.test(n.readyState)||(f().dom.Event.domLoaded=1,c=2,
|
||||
// Execute callback after mainscript has been loaded and before the initialization occurs
|
||||
o.script_loaded&&o.script_loaded(),a(),m.each(s,function(e,t){t()}))},n.src=e,document.body.appendChild(n)),l):f()?f().get(l[0].id):null:l;function a(){var a=[],c=0;
|
||||
// Apply patches to the jQuery object, only once
|
||||
u||(v(),u=!0),
|
||||
// Create an editor instance for each matched node
|
||||
l.each(function(e,t){var n,i=t.id,r=o.oninit;
|
||||
// Generate unique id for target element if needed
|
||||
i||(t.id=i=f().DOM.uniqueId()),
|
||||
// Only init the editor once
|
||||
f().get(i)||(
|
||||
// Create editor instance and render it
|
||||
n=f().createEditor(i,o),a.push(n),n.on("init",function(){var e,t=r;l.css("visibility",""),
|
||||
// Run this if the oninit setting is defined
|
||||
// this logic will fire the oninit callback ones each
|
||||
// matched editor instance is initialized
|
||||
r&&++c==a.length&&("string"==typeof t&&(e=-1===t.indexOf(".")?null:f().resolve(t.replace(/\.\w+$/,"")),t=f().resolve(t)),
|
||||
// Call the oninit function with the object
|
||||
t.apply(e||f(),a))}))}),
|
||||
// Render the editor instances in a separate loop since we
|
||||
// need to have the full editors array used in the onInit calls
|
||||
m.each(a,function(e,t){t.render()})}},
|
||||
// Add :tinymce pseudo selector this will select elements that has been converted into editor instances
|
||||
// it's now possible to use things like $('*:tinymce') to get all TinyMCE bound elements.
|
||||
m.extend(m.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in d&&(t=f().get(e.id))&&t.editorManager===f())}});
|
||||
// This function patches internal jQuery functions so that if
|
||||
// you for example remove an div element containing an editor it's
|
||||
// automatically destroyed by the TinyMCE API
|
||||
var v=function(){function r(e){
|
||||
// If the function is remove
|
||||
"remove"===e&&this.each(function(e,t){var n=u(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=f().get(t.id.replace(/_parent$/,""));n&&n.remove()})}function o(i){var e,t=this;
|
||||
// Handle set value
|
||||
/*jshint eqnull:true */if(null!=i)r.call(t),
|
||||
// Saves the contents before get/set value of textarea/div
|
||||
t.each(function(e,t){var n;(n=f().get(t.id))&&n.setContent(i)});else if(0<t.length&&(e=f().get(t[0].id)))return e.getContent()}function l(e){return e&&e.length&&d.tinymce&&e.is(":tinymce")}
|
||||
// Removes any child editor instances by looking for editor wrapper elements
|
||||
var u=function(e){var t=null;return e&&e.id&&d.tinymce?f().get(e.id):t},s={};
|
||||
// Loads or saves contents from/to textarea if the value
|
||||
// argument is defined it will set the TinyMCE internal contents
|
||||
// Patch some setter/getter functions these will
|
||||
// now be able to set/get the contents of editor instances for
|
||||
// example $('#editorid').html('Content'); will update the TinyMCE iframe instance
|
||||
m.each(["text","html","val"],function(e,t){var a=s[t]=m.fn[t],c="text"===t;m.fn[t]=function(e){var t=this;if(!l(t))return a.apply(t,arguments);if(e!==p)return o.call(t.filter(":tinymce"),e),a.apply(t.not(":tinymce"),arguments),t;// return original set for chaining
|
||||
var i="",r=arguments;return(c?t:t.eq(0)).each(function(e,t){var n=u(t);i+=n?c?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):a.apply(m(t),r)}),i}}),
|
||||
// Makes it possible to use $('#id').append("content"); to append contents to the TinyMCE editor iframe
|
||||
m.each(["append","prepend"],function(e,t){var n=s[t]=m.fn[t],r="prepend"===t;m.fn[t]=function(i){var e=this;return l(e)?i!==p?("string"==typeof i&&e.filter(":tinymce").each(function(e,t){var n=u(t);n&&n.setContent(r?i+n.getContent():n.getContent()+i)}),n.apply(e.not(":tinymce"),arguments),e):void 0:n.apply(e,arguments)}}),
|
||||
// Makes sure that the editor instance gets properly destroyed when the parent element is removed
|
||||
m.each(["remove","replaceWith","replaceAll","empty"],function(e,t){var n=s[t]=m.fn[t];m.fn[t]=function(){return r.call(this,t),n.apply(this,arguments)}}),s.attr=m.fn.attr,
|
||||
// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents
|
||||
m.fn.attr=function(e,t){var n=this,i=arguments;if(!e||"value"!==e||!l(n))return s.attr.apply(n,i);if(t!==p)return o.call(n.filter(":tinymce"),t),s.attr.apply(n.not(":tinymce"),i),n;// return original set for chaining
|
||||
var r=n[0],a=u(r);return a?a.getContent({save:!0}):s.attr.apply(m(r),i)}}}();
|
||||
@@ -0,0 +1,3 @@
|
||||
This is where language files should be placed.
|
||||
|
||||
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/
|
||||
@@ -0,0 +1,417 @@
|
||||
tinymce.addI18n('zh_CN',{
|
||||
"Redo": "恢复",
|
||||
"Undo": "撤销",
|
||||
"Cut": "剪切",
|
||||
"Copy": "复制",
|
||||
"Paste": "粘贴",
|
||||
"Select all": "全选",
|
||||
"New document": "新建文档",
|
||||
"Ok": "确定",
|
||||
"Cancel": "取消",
|
||||
"Visual aids": "网格线",
|
||||
"Bold": "粗体",
|
||||
"Italic": "斜体",
|
||||
"Underline": "下划线",
|
||||
"Strikethrough": "删除线",
|
||||
"Superscript": "上标",
|
||||
"Subscript": "下标",
|
||||
"Clear formatting": "清除格式",
|
||||
"Align left": "左对齐",
|
||||
"Align center": "居中",
|
||||
"Align right": "右对齐",
|
||||
"Justify": "两端对齐",
|
||||
"Bullet list": "符号列表",
|
||||
"Numbered list": "数字列表",
|
||||
"Decrease indent": "减少缩进",
|
||||
"Increase indent": "增加缩进",
|
||||
"Close": "关闭",
|
||||
"Formats": "格式",
|
||||
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "当前浏览器不支持访问剪贴板,请使用快捷键Ctrl+X/C/V复制粘贴",
|
||||
"Headers": "标题",
|
||||
"Header 1": "标题1",
|
||||
"Header 2": "标题2",
|
||||
"Header 3": "标题3",
|
||||
"Header 4": "标题4",
|
||||
"Header 5": "标题5",
|
||||
"Header 6": "标题6",
|
||||
"Headings": "标题",
|
||||
"Heading 1": "标题1",
|
||||
"Heading 2": "标题2",
|
||||
"Heading 3": "标题3",
|
||||
"Heading 4": "标题4",
|
||||
"Heading 5": "标题5",
|
||||
"Heading 6": "标题6",
|
||||
"Preformatted": "预格式化",
|
||||
"Div": "Div区块",
|
||||
"Pre": "预格式文本",
|
||||
"Code": "代码",
|
||||
"Paragraph": "段落",
|
||||
"Blockquote": "引用",
|
||||
"Inline": "文本",
|
||||
"Blocks": "区块",
|
||||
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "当前为纯文本粘贴模式,再次点击可以回到普通粘贴模式。",
|
||||
"Fonts": "字体",
|
||||
"Font Sizes": "字号",
|
||||
"Class": "Class",
|
||||
"Browse for an image": "浏览图像",
|
||||
"OR": "或",
|
||||
"Drop an image here": "拖放一张图片文件至此",
|
||||
"Upload": "上传",
|
||||
"Block": "块",
|
||||
"Align": "对齐",
|
||||
"Default": "默认",
|
||||
"Circle": "空心圆",
|
||||
"Disc": "实心圆",
|
||||
"Square": "方块",
|
||||
"Lower Alpha": "小写英文字母",
|
||||
"Lower Greek": "小写希腊字母",
|
||||
"Lower Roman": "小写罗马字母",
|
||||
"Upper Alpha": "大写英文字母",
|
||||
"Upper Roman": "大写罗马字母",
|
||||
"Anchor...": "锚点...",
|
||||
"Name": "名称",
|
||||
"Id": "id",
|
||||
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "id应该以字母开头,后跟字母、数字、横线、点、冒号或下划线。",
|
||||
"You have unsaved changes are you sure you want to navigate away?": "你对文档的修改尚未保存,确定离开吗?",
|
||||
"Restore last draft": "恢复上次的草稿",
|
||||
"Special characters...": "特殊字符...",
|
||||
"Source code": "HTML源码",
|
||||
"Insert\/Edit code sample": "插入/编辑代码示例",
|
||||
"Language": "语言",
|
||||
"Code sample...": "代码示例...",
|
||||
"Color Picker": "选取颜色",
|
||||
"R": "R",
|
||||
"G": "G",
|
||||
"B": "B",
|
||||
"Left to right": "从左到右",
|
||||
"Right to left": "从右到左",
|
||||
"Emoticons...": "表情符号...",
|
||||
"Metadata and Document Properties": "元数据和文档属性",
|
||||
"Title": "标题",
|
||||
"Keywords": "关键词",
|
||||
"Description": "描述",
|
||||
"Robots": "机器人",
|
||||
"Author": "作者",
|
||||
"Encoding": "编码",
|
||||
"Fullscreen": "全屏",
|
||||
"Action": "操作",
|
||||
"Shortcut": "快捷键",
|
||||
"Help": "帮助",
|
||||
"Address": "地址",
|
||||
"Focus to menubar": "移动焦点到菜单栏",
|
||||
"Focus to toolbar": "移动焦点到工具栏",
|
||||
"Focus to element path": "移动焦点到元素路径",
|
||||
"Focus to contextual toolbar": "移动焦点到上下文菜单",
|
||||
"Insert link (if link plugin activated)": "插入链接 (如果链接插件已激活)",
|
||||
"Save (if save plugin activated)": "保存(如果保存插件已激活)",
|
||||
"Find (if searchreplace plugin activated)": "查找(如果查找替换插件已激活)",
|
||||
"Plugins installed ({0}):": "已安装插件 ({0}):",
|
||||
"Premium plugins:": "优秀插件:",
|
||||
"Learn more...": "了解更多...",
|
||||
"You are using {0}": "你正在使用 {0}",
|
||||
"Plugins": "插件",
|
||||
"Handy Shortcuts": "快捷键",
|
||||
"Horizontal line": "水平分割线",
|
||||
"Insert\/edit image": "插入/编辑图片",
|
||||
"Image description": "图片描述",
|
||||
"Source": "地址",
|
||||
"Dimensions": "大小",
|
||||
"Constrain proportions": "保持宽高比",
|
||||
"General": "常规",
|
||||
"Advanced": "高级",
|
||||
"Style": "样式",
|
||||
"Vertical space": "垂直边距",
|
||||
"Horizontal space": "水平边距",
|
||||
"Border": "边框",
|
||||
"Insert image": "插入图片",
|
||||
"Image...": "图片...",
|
||||
"Image list": "图片列表",
|
||||
"Rotate counterclockwise": "逆时针旋转",
|
||||
"Rotate clockwise": "顺时针旋转",
|
||||
"Flip vertically": "垂直翻转",
|
||||
"Flip horizontally": "水平翻转",
|
||||
"Edit image": "编辑图片",
|
||||
"Image options": "图片选项",
|
||||
"Zoom in": "放大",
|
||||
"Zoom out": "缩小",
|
||||
"Crop": "裁剪",
|
||||
"Resize": "调整大小",
|
||||
"Orientation": "方向",
|
||||
"Brightness": "亮度",
|
||||
"Sharpen": "锐化",
|
||||
"Contrast": "对比度",
|
||||
"Color levels": "色阶",
|
||||
"Gamma": "伽马值",
|
||||
"Invert": "反转",
|
||||
"Apply": "应用",
|
||||
"Back": "后退",
|
||||
"Insert date\/time": "插入日期/时间",
|
||||
"Date\/time": "日期/时间",
|
||||
"Insert\/Edit Link": "插入/编辑链接",
|
||||
"Insert\/edit link": "插入/编辑链接",
|
||||
"Text to display": "显示文字",
|
||||
"Url": "地址",
|
||||
"Open link in...": "链接打开方式...",
|
||||
"Current window": "当前窗口打开",
|
||||
"None": "在当前窗口/框架打开",
|
||||
"New window": "在新窗口打开",
|
||||
"Remove link": "删除链接",
|
||||
"Anchors": "锚点",
|
||||
"Link...": "链接...",
|
||||
"Paste or type a link": "粘贴或输入链接",
|
||||
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "你所填写的URL地址为邮件地址,需要加上mailto:前缀吗?",
|
||||
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "你所填写的URL地址属于外部链接,需要加上http://:前缀吗?",
|
||||
"Link list": "链接列表",
|
||||
"Insert video": "插入视频",
|
||||
"Insert\/edit video": "插入/编辑视频",
|
||||
"Insert\/edit media": "插入/编辑媒体",
|
||||
"Alternative source": "替代资源",
|
||||
"Alternative image URL": "资源备用地址",
|
||||
"Media poster (Image URL)": "封面(图片地址)",
|
||||
"Paste your embed code below:": "将内嵌代码粘贴在下面:",
|
||||
"Embed": "内嵌",
|
||||
"Media...": "多媒体...",
|
||||
"Nonbreaking space": "不间断空格",
|
||||
"Page break": "分页符",
|
||||
"Paste as text": "粘贴为文本",
|
||||
"Preview": "预览",
|
||||
"Print...": "打印...",
|
||||
"Save": "保存",
|
||||
"Find": "查找",
|
||||
"Replace with": "替换为",
|
||||
"Replace": "替换",
|
||||
"Replace all": "替换全部",
|
||||
"Previous": "上一个",
|
||||
"Next": "下一个",
|
||||
"Find and replace...": "查找并替换...",
|
||||
"Could not find the specified string.": "未找到搜索内容。",
|
||||
"Match case": "区分大小写",
|
||||
"Find whole words only": "全单词匹配",
|
||||
"Spell check": "拼写检查",
|
||||
"Ignore": "忽略",
|
||||
"Ignore all": "忽略全部",
|
||||
"Finish": "完成",
|
||||
"Add to Dictionary": "添加到字典",
|
||||
"Insert table": "插入表格",
|
||||
"Table properties": "表格属性",
|
||||
"Delete table": "删除表格",
|
||||
"Cell": "单元格",
|
||||
"Row": "行",
|
||||
"Column": "列",
|
||||
"Cell properties": "单元格属性",
|
||||
"Merge cells": "合并单元格",
|
||||
"Split cell": "拆分单元格",
|
||||
"Insert row before": "在上方插入",
|
||||
"Insert row after": "在下方插入",
|
||||
"Delete row": "删除行",
|
||||
"Row properties": "行属性",
|
||||
"Cut row": "剪切行",
|
||||
"Copy row": "复制行",
|
||||
"Paste row before": "粘贴到上方",
|
||||
"Paste row after": "粘贴到下方",
|
||||
"Insert column before": "在左侧插入",
|
||||
"Insert column after": "在右侧插入",
|
||||
"Delete column": "删除列",
|
||||
"Cols": "列",
|
||||
"Rows": "行",
|
||||
"Width": "宽",
|
||||
"Height": "高",
|
||||
"Cell spacing": "单元格外间距",
|
||||
"Cell padding": "单元格内边距",
|
||||
"Show caption": "显示标题",
|
||||
"Left": "左对齐",
|
||||
"Center": "居中",
|
||||
"Right": "右对齐",
|
||||
"Cell type": "单元格类型",
|
||||
"Scope": "范围",
|
||||
"Alignment": "对齐方式",
|
||||
"H Align": "水平对齐",
|
||||
"V Align": "垂直对齐",
|
||||
"Top": "顶部对齐",
|
||||
"Middle": "垂直居中",
|
||||
"Bottom": "底部对齐",
|
||||
"Header cell": "表头单元格",
|
||||
"Row group": "行组",
|
||||
"Column group": "列组",
|
||||
"Row type": "行类型",
|
||||
"Header": "表头",
|
||||
"Body": "表体",
|
||||
"Footer": "表尾",
|
||||
"Border color": "边框颜色",
|
||||
"Insert template...": "插入模板...",
|
||||
"Templates": "模板",
|
||||
"Template": "模板",
|
||||
"Text color": "文字颜色",
|
||||
"Background color": "背景色",
|
||||
"Custom...": "自定义...",
|
||||
"Custom color": "自定义颜色",
|
||||
"No color": "无",
|
||||
"Remove color": "删除颜色",
|
||||
"Table of Contents": "目录",
|
||||
"Show blocks": "显示区块边框",
|
||||
"Show invisible characters": "显示不可见字符",
|
||||
"Word count": "字数统计",
|
||||
"Words: {0}": "字数:{0}",
|
||||
"{0} words": "{0} 个字",
|
||||
"File": "文件",
|
||||
"Edit": "编辑",
|
||||
"Insert": "插入",
|
||||
"View": "查看",
|
||||
"Format": "格式",
|
||||
"Table": "表格",
|
||||
"Tools": "工具",
|
||||
"Powered by {0}": "Powered by {0}",
|
||||
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "在编辑区按ALT+F9打开菜单,按ALT+F10打开工具栏,按ALT+0查看帮助",
|
||||
"Image title": "图片标题",
|
||||
"Border width": "边框宽度",
|
||||
"Border style": "边框样式",
|
||||
"Error": "错误",
|
||||
"Warn": "警告",
|
||||
"Valid": "有效",
|
||||
"To open the popup, press Shift+Enter": "此快捷为软回车(插入<br>)",
|
||||
"Rich Text Area. Press ALT-0 for help.": "编辑区. 按Alt+0键打开帮助",
|
||||
"System Font": "默认字体",
|
||||
"Failed to upload image: {0}": "图片上传失败: {0}",
|
||||
"Failed to load plugin: {0} from url {1}": "插件加载失败: {0} - {1}",
|
||||
"Failed to load plugin url: {0}": "插件加载失败: {0}",
|
||||
"Failed to initialize plugin: {0}": "插件初始化失败: {0}",
|
||||
"example": "示例",
|
||||
"Search": "查找",
|
||||
"All": "全部",
|
||||
"Currency": "货币",
|
||||
"Text": "文本",
|
||||
"Quotations": "引用",
|
||||
"Mathematical": "数学运算符",
|
||||
"Extended Latin": "拉丁语扩充",
|
||||
"Symbols": "符号",
|
||||
"Arrows": "箭头",
|
||||
"User Defined": "自定义",
|
||||
"dollar sign": "美元",
|
||||
"currency sign": "货币",
|
||||
"euro-currency sign": "欧元",
|
||||
"colon sign": "冒号",
|
||||
"cruzeiro sign": "克鲁赛罗币",
|
||||
"french franc sign": "法郎",
|
||||
"lira sign": "里拉",
|
||||
"mill sign": "密尔",
|
||||
"naira sign": "奈拉",
|
||||
"peseta sign": "比塞塔",
|
||||
"rupee sign": "卢比",
|
||||
"won sign": "韩元",
|
||||
"new sheqel sign": "新谢克尔",
|
||||
"dong sign": "越南盾",
|
||||
"kip sign": "老挝基普",
|
||||
"tugrik sign": "图格里克",
|
||||
"drachma sign": "德拉克马",
|
||||
"german penny symbol": "德国便士",
|
||||
"peso sign": "比索",
|
||||
"guarani sign": "瓜拉尼",
|
||||
"austral sign": "澳元",
|
||||
"hryvnia sign": "格里夫尼亚",
|
||||
"cedi sign": "塞地",
|
||||
"livre tournois sign": "里弗弗尔",
|
||||
"spesmilo sign": "一千spesoj的货币符号,该货币未使用",
|
||||
"tenge sign": "坚戈",
|
||||
"indian rupee sign": "印度卢比",
|
||||
"turkish lira sign": "土耳其里拉",
|
||||
"nordic mark sign": "北欧马克",
|
||||
"manat sign": "马纳特",
|
||||
"ruble sign": "卢布",
|
||||
"yen character": "日元",
|
||||
"yuan character": "人民币元",
|
||||
"yuan character, in hong kong and taiwan": "元的繁体字",
|
||||
"yen\/yuan character variant one": "元(大写)",
|
||||
"Loading emoticons...": "正在加载表情文字...",
|
||||
"Could not load emoticons": "不能加载表情文字",
|
||||
"People": "人类",
|
||||
"Animals and Nature": "动物和自然",
|
||||
"Food and Drink": "食物和饮品",
|
||||
"Activity": "活动",
|
||||
"Travel and Places": "旅游和地点",
|
||||
"Objects": "物件",
|
||||
"Flags": "旗帜",
|
||||
"Characters": "字数",
|
||||
"Characters (no spaces)": "字数(不含空格)",
|
||||
"Error: Form submit field collision.": "错误: 表单提交字段冲突.",
|
||||
"Error: No form element found.": "错误: 未找到可用的form.",
|
||||
"Update": "更新",
|
||||
"Color swatch": "颜色样本",
|
||||
"Turquoise": "青绿",
|
||||
"Green": "绿色",
|
||||
"Blue": "蓝色",
|
||||
"Purple": "紫色",
|
||||
"Navy Blue": "海军蓝",
|
||||
"Dark Turquoise": "深蓝绿色",
|
||||
"Dark Green": "暗绿",
|
||||
"Medium Blue": "中蓝",
|
||||
"Medium Purple": "中紫",
|
||||
"Midnight Blue": "深蓝",
|
||||
"Yellow": "黄色",
|
||||
"Orange": "橙色",
|
||||
"Red": "红色",
|
||||
"Light Gray": "浅灰",
|
||||
"Gray": "灰色",
|
||||
"Dark Yellow": "暗黄",
|
||||
"Dark Orange": "暗橙",
|
||||
"Dark Red": "暗红",
|
||||
"Medium Gray": "中灰",
|
||||
"Dark Gray": "深灰",
|
||||
"Black": "黑色",
|
||||
"White": "白色",
|
||||
"Switch to or from fullscreen mode": "切换全屏模式",
|
||||
"Open help dialog": "打开帮助对话框",
|
||||
"history": "历史",
|
||||
"styles": "样式",
|
||||
"formatting": "格式化",
|
||||
"alignment": "对齐",
|
||||
"indentation": "缩进",
|
||||
"permanent pen": "记号笔",
|
||||
"comments": "注释",
|
||||
"Anchor": "锚点",
|
||||
"Special character": "特殊字符",
|
||||
"Code sample": "代码示例",
|
||||
"Color": "颜色",
|
||||
"Emoticons": "表情",
|
||||
"Document properties": "文档属性",
|
||||
"Image": "图片",
|
||||
"Insert link": "插入链接",
|
||||
"Target": "目标",
|
||||
"Link": "链接",
|
||||
"Poster": "封面",
|
||||
"Media": "音视频",
|
||||
"Print": "打印",
|
||||
"Prev": "上一个",
|
||||
"Find and replace": "查找并替换",
|
||||
"Whole words": "全字匹配",
|
||||
"Spellcheck": "拼写检查",
|
||||
"Caption": "标题",
|
||||
"Insert template": "插入模板",
|
||||
//以下为补充汉化内容 by 莫若卿
|
||||
"Code view": "代码区域",
|
||||
"Select...": "选择...",
|
||||
"Format Painter": "格式刷",
|
||||
"No templates defined.": "无内置模板",
|
||||
"Special character...": "特殊字符...",
|
||||
"Open link": "打开链接",
|
||||
"None": "无",
|
||||
"Count": "统计",
|
||||
"Document": "整个文档",
|
||||
"Selection": "选取部分",
|
||||
"Words": "字词数",
|
||||
"{0} characters": "{0} 个字符",
|
||||
"Alternative source URL": "替代资源地址",
|
||||
"Alternative description": "替代说明文字",
|
||||
"Accessibility": "可访问性",
|
||||
"Image is decorative": "仅用于装饰",
|
||||
//5.6新增
|
||||
"Line height": "行高",
|
||||
"Cut column": "剪切列",
|
||||
"Copy column": "复制列",
|
||||
"Paste column before": "粘贴到前方",
|
||||
"Paste column after": "粘贴到后方",
|
||||
"Copy column": "复制列",
|
||||
//帮助窗口内的文字
|
||||
"Version": "版本",
|
||||
"Keyboard Navigation": "键盘导航",
|
||||
"Open popup menu for split buttons": "该组合键的作用是软回车(插入br)",
|
||||
});
|
||||
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function f(t,e,n){t.execCommand("UL"===e?"InsertUnorderedList":"InsertOrderedList",!1,!1===n?null:{"list-style-type":n})}function i(t){return function(){return t}}function t(t){return t}function e(){return s}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.util.Tools"),u=i(!1),l=i(!0),s={fold:function(t,e){return t()},isSome:u,isNone:l,getOr:t,getOrThunk:r,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(void 0),or:t,orThunk:r,map:e,each:function(){},bind:e,exists:u,forall:l,filter:function(){return s},toArray:function(){return[]},toString:i("none()")};function r(t){return t()}function d(t){return t&&/^(TH|TD)$/.test(t.nodeName)}function m(c,a){return function(s){function t(t){var e,n,r,o,i,u,l;s.setActive((e=c,r=a,i=-1!==(o=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}((n=t).parents,d))?n.parents.slice(0,o):n.parents,0<(u=g.grep(i,(l=e,function(t){return t&&/^(OL|UL|DL)$/.test(t.nodeName)&&(e=t,l.$.contains(l.getBody(),e));var e}))).length&&u[0].nodeName===r))}return c.on("NodeChange",t),function(){return c.off("NodeChange",t)}}}function c(t,e,n,r,o,i){var u,l,s,c,a,d;1<i.length?(c=r,a=o,d=i,(s=t).ui.registry.addSplitButton(e,{tooltip:n,icon:"OL"===a?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:function(t){t(g.map(d,function(t){return{type:"choiceitem",value:"default"===t?"":t,icon:"list-"+("OL"===a?"num":"bull")+"-"+("disc"===t||"decimal"===t?"default":t),text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})}}))},onAction:function(){return s.execCommand(c)},onItemAction:function(t,e){f(s,a,e)},select:function(e){var t,n=(t=s).dom.getParent(t.selection.getNode(),"ol,ul"),r=t.dom.getStyle(n,"listStyleType");return p(r).map(function(t){return e===t}).getOr(!1)},onSetup:m(s,a)})):(l=r,(u=t).ui.registry.addToggleButton(e,{active:!1,tooltip:n,icon:"OL"===o?"ordered-list":"unordered-list",onSetup:m(u,o),onAction:function(){return u.execCommand(l)}}))}var a=function(n){function t(){return o}function e(t){return t(n)}var r=i(n),o={fold:function(t,e){return e(n)},isSome:l,isNone:u,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:t,orThunk:t,map:function(t){return a(t(n))},each:function(t){t(n)},bind:e,exists:e,forall:e,filter:function(t){return t(n)?o:s},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},p=function(t){return null==t?s:a(t)};n.add("advlist",function(t){var n,e,r,o;t.hasPlugin("lists")?(c(e=t,"numlist","Numbered list","InsertOrderedList","OL",(r=e.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"))?r.split(/[ ,]/):[]),c(e,"bullist","Bullet list","InsertUnorderedList","UL",(o=e.getParam("advlist_bullet_styles","default,circle,square"))?o.split(/[ ,]/):[]),(n=t).addCommand("ApplyUnorderedListStyle",function(t,e){f(n,"UL",e["list-style-type"])}),n.addCommand("ApplyOrderedListStyle",function(t,e){f(n,"OL",e["list-style-type"])})):console.error("Please use the Lists plugin together with the Advanced List plugin.")})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function a(e){return e.getAttribute("id")||e.getAttribute("name")||""}function c(e){return e&&"a"===e.nodeName.toLowerCase()&&!e.getAttribute("href")&&""!==a(e)}function d(e){return e.dom.getParent(e.selection.getStart(),l)}function r(e,t){var o,a,n,r,i,l=d(e);l?(n=e,r=t,(i=l).removeAttribute("name"),i.id=r,n.addVisual(),n.undoManager.add()):(a=t,(o=e).undoManager.transact(function(){var e,n;o.getParam("allow_html_in_named_anchor",!1,"boolean")||o.selection.collapse(!0),o.selection.isCollapsed()?o.insertContent(o.dom.createHTML("a",{id:a})):(n=(e=o).dom,u(n).walk(e.selection.getRng(),function(e){s.each(e,function(e){var t;c(t=e)&&!t.firstChild&&n.remove(e,!1)})}),o.formatter.remove("namedAnchor",null,null,!0),o.formatter.apply("namedAnchor",{value:a}),o.addVisual())})),e.focus()}function i(r){return function(e){for(var t,n=0;n<e.length;n++){var o=e[n],a=void 0;!(a=t=o)||a.attr("href")||!a.attr("id")&&!a.attr("name")||t.firstChild||o.attr("contenteditable",r)}}}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),s=tinymce.util.Tools.resolve("tinymce.util.Tools"),l="a:not([href])";e.add("anchor",function(e){var t,n,o;(t=e).on("PreInit",function(){t.parser.addNodeFilter("a",i("false")),t.serializer.addNodeFilter("a",i(null))}),(n=e).addCommand("mceAnchor",function(){var o,e,t;t=(e=d(o=n))?a(e):"",o.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:function(e){var t=o,n=e.getData().id;(/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(n)?(r(t,n),0):(t.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))||e.close()}})}),(o=e).ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:function(){return o.execCommand("mceAnchor")},onSetup:function(e){return o.selection.selectorChangedWithUnbind("a:not([href])",e.setActive).unbind}}),o.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:function(){return o.execCommand("mceAnchor")}}),e.on("PreInit",function(){e.formatter.register("namedAnchor",{inline:"a",selector:l,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:c})})})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function o(e,t){var n;return t<0&&(t=0),3!==e.nodeType||(n=e.data.length)<t&&(t=n),t}function p(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)}function A(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)}function i(e,t,n){var o,i,r,a,d,s,l=e.getParam("autolink_pattern",v),f=e.getParam("default_link_target",!1);if("A"!==e.selection.getNode().tagName){var c=e.selection.getRng().cloneRange();if(c.startOffset<5){if(!(a=c.endContainer.previousSibling)){if(!c.endContainer.firstChild||!c.endContainer.firstChild.nextSibling)return;a=c.endContainer.firstChild.nextSibling}if(p(c,a,d=a.length),A(c,a,d),c.endOffset<5)return;o=c.endOffset,i=a}else{if(3!==(i=c.endContainer).nodeType&&i.firstChild){for(;3!==i.nodeType&&i.firstChild;)i=i.firstChild;3===i.nodeType&&(p(c,i,0),A(c,i,i.nodeValue.length))}o=1===c.endOffset?2:c.endOffset-1-t}for(var g,u=o;p(c,i,2<=o?o-2:0),A(c,i,1<=o?o-1:0),--o," "!==(s=c.toString())&&""!==s&&160!==s.charCodeAt(0)&&0<=o-2&&s!==n;);(g=c.toString())===n||" "===g||160===g.charCodeAt(0)?(p(c,i,o),A(c,i,u),o+=1):(0===c.startOffset?p(c,i,0):p(c,i,o),A(c,i,u)),h=c.toString(),/[?!,.;:]/.test(h.charAt(h.length-1))&&A(c,i,u-1);var h,C,m,y,k=(h=c.toString().trim()).match(l),w=e.getParam("link_default_protocol","http","string");k&&((m=C=k[0]).length>=(y="www.").length&&m.substr(0,0+y.length)===y?C=w+"://"+C:-1===C.indexOf("@")||/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(C)||(C="mailto:"+C),r=e.selection.getBookmark(),e.selection.setRng(c),e.execCommand("createlink",!1,C),!1!==f&&e.dom.setAttrib(e.selection.getNode(),"target",f),e.selection.moveToBookmark(r),e.nodeChanged())}}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.Env"),v=new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i");e.add("autolink",function(e){var t,n;(t=e).on("keydown",function(e){13===e.keyCode&&i(t,-1,"")}),r.browser.isIE()?t.on("focus",function(){if(!n){n=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(t.on("keypress",function(e){41===e.keyCode&&i(t,-1,"(")}),t.on("keyup",function(e){32===e.keyCode&&i(t,0,"")}))})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function y(e){return e.getParam("min_height",e.getElement().offsetHeight,"number")}function p(e,t){var n=e.getBody();n&&(n.style.overflowY=t?"":"hidden",t||(n.scrollTop=0))}function v(e,t,n,i){var o=parseInt(e.getStyle(t,n,i),10);return isNaN(o)?0:o}var l=Object.hasOwnProperty,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),b=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),u=function(e,t,n,i,o){r.setEditorTimeout(e,function(){C(e,t),n--?u(e,t,n,i,o):o&&o()},i)},C=function(e,t,n){var i,o,r,s,a,l,u,g,c,m,f,d=e.dom,h=e.getDoc();h&&(e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()?p(e,!0):(i=h.documentElement,o=e.getParam("autoresize_bottom_margin",50,"number"),r=y(e),s=v(d,i,"margin-top",!0),a=v(d,i,"margin-bottom",!0),(l=(l=i.offsetHeight+s+a+o)<0?0:l)+(u=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight)>y(e)&&(r=l+u),(g=e.getParam("max_height",0,"number"))&&g<r?(r=g,p(e,!0)):p(e,!1),r!==t.get()&&(c=r-t.get(),d.setStyle(e.getContainer(),"height",r+"px"),t.set(r),e.fire("ResizeEditor"),b.browser.isSafari()&&b.mac&&(m=e.getWin()).scrollTo(m.pageXOffset,m.pageYOffset),!e.hasFocus()||"setcontent"!==(null==(f=n)?void 0:f.type.toLowerCase())||!0!==f.selection&&!0!==f.paste||e.selection.scrollIntoView(),b.webkit&&c<0&&C(e,t,n))))};e.add("autoresize",function(e){var t,n,i,o,r,s,a=e.settings;l.call(a,"resize")||(e.settings.resize=!1),e.inline||(s=0,r=t={get:function(){return s},set:function(e){s=e}},(o=e).addCommand("mceAutoResize",function(){C(o,r)}),i=t,(n=e).on("init",function(){var e=n.getParam("autoresize_overflow_padding",1,"number"),t=n.dom;t.setStyles(n.getDoc().documentElement,{height:"auto"}),t.setStyles(n.getBody(),{paddingLeft:e,paddingRight:e,"min-height":0})}),n.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",function(e){C(n,i,e)}),n.getParam("autoresize_on_init",!0,"boolean")&&n.on("init",function(){u(n,i,20,100,function(){u(n,i,5,1e3)})}))})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function o(t,e){var r=t||e,n=/^(\d+)([ms]?)$/.exec(""+r);return(n[2]?{s:1e3,m:6e4}[n[2]]:1)*parseInt(r,10)}function n(t){var e=document.location;return t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)}function i(t,e){if(a(e))return t.dom.isEmpty(t.getBody());var r=d.trim(e);if(""===r)return!0;var n=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(n)}function u(t){var e=parseInt(v.getItem(n(t)+"time"),10)||0;return!((new Date).getTime()-e>o(t.getParam("autosave_retention"),"20m")&&(g(t,!1),1))}function s(t){var e=n(t);!i(t)&&t.isDirty()&&(v.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),v.setItem(e+"time",(new Date).getTime().toString()),t.fire("StoreDraft"))}function f(t){var e=n(t);u(t)&&(t.setContent(v.getItem(e+"draft"),{format:"raw"}),t.fire("RestoreDraft"))}function c(t){t.undoManager.transact(function(){f(t),g(t)}),t.focus()}function m(r){return function(t){function e(){return t.setDisabled(!u(r))}return t.setDisabled(!u(r)),r.on("StoreDraft RestoreDraft RemoveDraft",e),function(){return r.off("StoreDraft RestoreDraft RemoveDraft",e)}}}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return void 0===t},l=tinymce.util.Tools.resolve("tinymce.util.Delay"),v=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),d=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,e){var r=n(t);v.removeItem(r+"draft"),v.removeItem(r+"time"),!1!==e&&t.fire("RemoveDraft")},y=tinymce.util.Tools.resolve("tinymce.EditorManager");t.add("autosave",function(t){var e,r,n,a;return t.editorManager.on("BeforeUnload",function(t){var e;d.each(y.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)}),n=e=t,a=o(n.getParam("autosave_interval"),"30s"),l.setEditorInterval(n,function(){s(n)},a),e.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:function(){c(e)},onSetup:m(e)}),e.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:function(){c(e)},onSetup:m(e)}),t.on("init",function(){t.getParam("autosave_restore_when_empty",!1)&&t.dom.isEmpty(t.getBody())&&f(t)}),r=t,{hasDraft:function(){return u(r)},storeDraft:function(){return s(r)},restoreDraft:function(){return f(r)},removeDraft:function(t){return g(r,t)},isEmpty:function(t){return i(r,t)}}})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function i(t){function o(o,e){t=t.replace(o,e)}return t=n.trim(t),o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),t}var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");o.add("bbcode",function(o){o.on("BeforeSetContent",function(o){o.content=i(o.content)}),o.on("PostProcess",function(o){function e(o,e){t=t.replace(o,e)}var t;o.set&&(o.content=i(o.content)),o.get&&(o.content=(t=o.content,t=n.trim(t),e(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),e(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),e(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),e(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),e(/<font>(.*?)<\/font>/gi,"$1"),e(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),e(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),e(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),e(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),e(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),e(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),e(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),e(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),e(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),e(/<\/(strong|b)>/gi,"[/b]"),e(/<(strong|b)>/gi,"[b]"),e(/<\/(em|i)>/gi,"[/i]"),e(/<(em|i)>/gi,"[i]"),e(/<\/u>/gi,"[/u]"),e(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),e(/<u>/gi,"[u]"),e(/<blockquote[^>]*>/gi,"[quote]"),e(/<\/blockquote>/gi,"[/quote]"),e(/<br \/>/gi,"\n"),e(/<br\/>/gi,"\n"),e(/<br>/gi,"\n"),e(/<p>/gi,""),e(/<\/p>/gi,"\n"),e(/ |\u00a0/gi," "),e(/"/gi,'"'),e(/</gi,"<"),e(/>/gi,">"),e(/&/gi,"&"),t))})})}();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",function(e){var t,o;function n(){return o.execCommand("mceCodeEditor")}return(t=e).addCommand("mceCodeEditor",function(){var n,e;e=(n=t).getContent({source_view:!0}),n.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:e},onSubmit:function(e){var t=n,o=e.getData().code;t.focus(),t.undoManager.transact(function(){t.setContent(o)}),t.selection.setCursorLocation(),t.nodeChanged(),e.close()}})}),(o=e).ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:n}),o.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:n}),{}})}();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("colorpicker",function(){})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("contextmenu",function(){})}();
|
||||
+9
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+3
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("hr",function(n){var o,t;function e(){return t.execCommand("InsertHorizontalRule")}(o=n).addCommand("InsertHorizontalRule",function(){o.execCommand("mceInsertContent",!1,"<hr />")}),(t=n).ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:e}),t.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:e})})}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function t(n){return function(t){return r=typeof(e=t),(null===e?"null":"object"==r&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":r)===n;var e,r}}function y(t){return t.getParam("importcss_selector_converter")}function u(e){return l(e)?function(t){return-1!==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:e}function h(t,e){var r,n=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(n){var o=n[1],i=n[2].substr(1).split(".").join(" "),c=x.makeMap("a,img");return n[1]?(r={title:e},t.schema.getTextBlockElements()[o]?r.block=o:t.schema.getBlockElements()[o]||c[o.toLowerCase()]?r.selector=o:r.inline=o):n[2]&&(r={inline:"span",title:e.substr(1),classes:i}),!1!==t.getParam("importcss_merge_classes")?r.classes=i:r.attributes={class:i},r}}function d(t,e){return null===e||!1!==t.getParam("importcss_exclusive")}function r(v){v.on("init",function(){function o(t,e){if(f=t,p=g,!(d(v,m=e)?f in p:f in m.selectors)){a=t,l=g,d(v,u=e)?l[a]=!0:u.selectors[a]=!0;var r=(i=(o=v).plugins.importcss,c=t,((s=e)&&s.selector_converter?s.selector_converter:y(o)?y(o):function(){return h(o,c)}).call(i,c,s));if(r){var n=r.name||_.DOM.uniqueId();return v.formatter.register(n,r),{title:r.title,format:n}}}var o,i,c,s,a,u,l,f,m,p;return null}var e,r,n,t,i=(e=[],r=[],n={},{addItemToGroup:function(t,e){n[t]?n[t].push(e):(r.push(t),n[t]=[e])},addItem:function(t){e.push(t)},toFormats:function(){return function(t){for(var e=[],r=0,n=t.length;r<n;++r){if(!f(t[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+t);P.apply(e,t[r])}return e}(function(t,e){for(var r=t.length,n=new Array(r),o=0;o<r;o++){var i=t[o];n[o]=e(i,o)}return n}(r,function(t){var e=n[t];return 0===e.length?[]:[{title:t,items:e}]})).concat(e)}}),g={},c=u(v.getParam("importcss_selector_filter")),s=(t=v.getParam("importcss_groups"),x.map(t,function(t){return x.extend({},t,{original:t,selectors:{},filter:u(t.filter)})}));x.each(function(c,t,s){var a=[],r={},u=function(t,e){var r,n,o=n=t.href,i=p.cacheSuffix;if((n=o=l(o)?o.replace("?"+i,"").replace("&"+i,""):o)&&s(n,e)&&!function(t,e){var r,n=!1!==(r=t.getParam("skin"))&&(r||"oxide");if(n){var o=t.getParam("skin_url"),i=o?t.documentBaseURI.toAbsolute(o):m.baseURL+"/skins/ui/"+n,c=m.baseURL+"/skins/content/";return e===i+"/content"+(t.inline?".inline":"")+".min.css"||-1!==e.indexOf(c)}}(c,n)){x.each(t.imports,function(t){u(t,!0)});try{r=t.cssRules||t.rules}catch(t){}x.each(r,function(t){t.styleSheet?u(t.styleSheet,!0):t.selectorText&&x.each(t.selectorText.split(","),function(t){a.push(x.trim(t))})})}};x.each(c.contentCSS,function(t){r[t]=!0}),s=s||function(t,e){return e||r[t]};try{x.each(t.styleSheets,function(t){u(t)})}catch(t){}return a}(v,v.getDoc(),u(v.getParam("importcss_file_filter"))),function(r){var t,e,n;-1===r.indexOf(".mce-")&&(c&&!c(r)||(n=r,0<(t=x.grep(s,function(t){return!t.filter||t.filter(n)})).length?x.each(t,function(t){var e=o(r,t);e&&i.addItemToGroup(t.title,e)}):(e=o(r,null))&&i.addItem(e)))});var a=i.toFormats();v.fire("addStyleModifications",{items:a,replace:!v.getParam("importcss_append")})})}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=t("string"),f=t("array"),_=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),m=tinymce.util.Tools.resolve("tinymce.EditorManager"),p=tinymce.util.Tools.resolve("tinymce.Env"),x=tinymce.util.Tools.resolve("tinymce.util.Tools"),P=Array.prototype.push;e.add("importcss",function(t){return r(t),e=t,{convertSelectorToFormat:function(t){return h(e,t)}};var e})}();
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function l(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))}function s(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])}function r(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e}function d(e,t,n){return void 0===n&&(n=new Date),(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",r(n.getMonth()+1,2))).replace("%d",r(n.getDate(),2))).replace("%H",""+r(n.getHours(),2))).replace("%M",""+r(n.getMinutes(),2))).replace("%S",""+r(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(u[n.getMonth()]))).replace("%b",""+e.translate(o[n.getMonth()]))).replace("%A",""+e.translate(i[n.getDay()]))).replace("%a",""+e.translate(a[n.getDay()]))).replace("%%","%")}function p(e,t){var n,r,a,i,o,u;e.getParam("insertdatetime_element",!1)?(n=d(e,t),r=/%[HMSIp]/.test(t)?d(e,"%Y-%m-%dT%H:%M"):d(e,"%Y-%m-%d"),(a=e.dom.getParent(e.selection.getStart(),"time"))?(o=a,u=(i=e).dom.create("time",{datetime:r},n),o.parentNode.insertBefore(u,o),i.dom.remove(o),i.selection.select(u,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")):e.insertContent(d(e,t))}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),i="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),o="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),u="January February March April May June July August September October November December".split(" "),g=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("insertdatetime",function(e){var n,r,t,a,i,o,u,c;function m(e){return r.execCommand("mceInsertDate",!1,e)}(n=e).addCommand("mceInsertDate",function(e,t){p(n,null!=t?t:n.getParam("insertdatetime_dateformat",n.translate("%Y-%m-%d")))}),n.addCommand("mceInsertTime",function(e,t){p(n,null!=t?t:l(n))}),u=s(r=e),t=0<(o=s(i=r)).length?o[0]:l(i),a=t,c={get:function(){return a},set:function(e){a=e}},r.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===c.get()},fetch:function(e){e(g.map(u,function(e){return{type:"choiceitem",text:d(r,e),value:e}}))},onAction:function(e){m(c.get())},onItemAction:function(e,t){c.set(t),m(t)}}),r.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:function(){return g.map(u,function(e){return{type:"menuitem",text:d(r,e),onAction:(t=e,function(){c.set(t),m(t)})};var t})}})})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("legacyoutput",function(e){var s,t;(t=s=e).settings.inline_styles=!1,t.getParam("fontsize_formats")||(t.settings.fontsize_formats="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7"),t.getParam("font_formats")||(t.settings.font_formats="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"),s.on("PreInit",function(){var e=s,t="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table",i=l.explode(e.getParam("font_size_style_values","xx-small,x-small,small,medium,large,x-large,xx-large")),a=e.schema;e.formatter.register({alignleft:{selector:t,attributes:{align:"left"}},aligncenter:{selector:t,attributes:{align:"center"}},alignright:{selector:t,attributes:{align:"right"}},alignjustify:{selector:t,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all",preserve_attributes:["class","style"]},{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all",preserve_attributes:["class","style"]},{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",toggle:!1,attributes:{face:"%value"}},fontsize:{inline:"font",toggle:!1,attributes:{size:function(e){return String(l.inArray(i,e.value)+1)}}},forecolor:{inline:"font",attributes:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0}}),l.each("b,i,u,strike".split(","),function(e){a.addValidElements(e+"[*]")}),a.getElementRule("font")||a.addValidElements("font[face|size|color|style]"),l.each(t.split(","),function(e){var t=a.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})})}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function o(n,e){for(var a="",o=0;o<e;o++)a+=n;return a}function s(n,e){var a=n.getParam("nonbreaking_wrap",!0,"boolean")||n.plugins.visualchars?'<span class="'+(n.plugins.visualchars&&n.plugins.visualchars.isEnabled()?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap")+'" contenteditable="false">'+o(" ",e)+"</span>":o(" ",e);n.undoManager.transact(function(){return n.insertContent(a)})}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.VK");n.add("nonbreaking",function(n){var e,a,o,t,i;function r(){return a.execCommand("mceNonBreaking")}(e=n).addCommand("mceNonBreaking",function(){s(e,1)}),(a=n).ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:r}),a.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:r}),0<(i="boolean"==typeof(t=(o=n).getParam("nonbreaking_force_tab",0))?!0===t?3:0:t)&&o.on("keydown",function(n){n.keyCode!==c.TAB||n.isDefaultPrevented()||n.shiftKey||(n.preventDefault(),n.stopImmediatePropagation(),s(o,i))})})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function l(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")}function u(e){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(e)}}function e(e){var t,r="contenteditable",n=" "+f.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",a=" "+f.trim(l(e))+" ",i=u(n),o=u(a),c=(t=e.getParam("noneditable_regexp",[]))&&t.constructor===RegExp?[t]:t;e.on("PreInit",function(){0<c.length&&e.on("BeforeSetContent",function(t){!function(t,e,n){var r=e.length,a=n.content;if("raw"!==n.format){for(;r--;)a=a.replace(e[r],function(i,o,c){return function(t){var e=arguments,n=e[e.length-2],r=0<n?o.charAt(n-1):"";if('"'===r)return t;if(">"===r){var a=o.lastIndexOf("<",n);if(-1!==a&&-1!==o.substring(a,n).indexOf('contenteditable="false"'))return t}return'<span class="'+c+'" data-mce-content="'+i.dom.encode(e[0])+'">'+i.dom.encode("string"==typeof e[1]?e[1]:e[0])+"</span>"}}(t,a,l(t)));n.content=a}}(e,c,t)}),e.parser.addAttributeFilter("class",function(t){for(var e,n=t.length;n--;)e=t[n],i(e)?e.attr(r,"true"):o(e)&&e.attr(r,"false")}),e.serializer.addAttributeFilter(r,function(t){for(var e,n=t.length;n--;)e=t[n],(i(e)||o(e))&&(0<c.length&&e.attr("data-mce-content")?(e.name="#text",e.type=3,e.raw=!0,e.value=e.attr("data-mce-content")):e.attr(r,null))})})}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=tinymce.util.Tools.resolve("tinymce.util.Tools");t.add("noneditable",function(t){e(t)})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function u(e){return e.getParam("pagebreak_split_block",!1)}function l(e){var a='<img src="'+n.transparentSrc+'" class="'+m+'" data-mce-resize="false" data-mce-placeholder />';return e?"<p>"+a+"</p>":a}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.Env"),m="mce-pagebreak";e.add("pagebreak",function(e){var a,n,o,i,t,r;function c(){return n.execCommand("mcePageBreak")}function g(){return u(o)}(a=e).addCommand("mcePageBreak",function(){a.insertContent(l(u(a)))}),(n=e).ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:c}),n.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:c}),i=(o=e).getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e"),t=new RegExp(i.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),o.on("BeforeSetContent",function(e){e.content=e.content.replace(t,l(g()))}),o.on("PreInit",function(){o.serializer.addNodeFilter("img",function(e){for(var a,n,t,r=e.length;r--;)(t=(n=e[r]).attr("class"))&&-1!==t.indexOf(m)&&(a=n.parent,o.schema.getBlockElements()[a.name]&&g()?(a.type=3,a.value=i,a.raw=!0,n.remove()):(n.type=3,n.value=i,n.raw=!0))})}),(r=e).on("ResolveName",function(e){"IMG"===e.target.nodeName&&r.dom.hasClass(e.target,m)&&(e.name="pagebreak")})})}();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=tinymce.util.Tools.resolve("tinymce.Env"),w=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("preview",function(e){var n,t;function i(){return t.execCommand("mcePreview")}(n=e).addCommand("mcePreview",function(){var e,t;t=function(t){var n="",i=t.dom.encode,e=t.getParam("content_style","","string");n+='<base href="'+i(t.documentBaseURI.getURI())+'">';var o=t.getParam("content_css_cors",!1,"boolean")?' crossorigin="anonymous"':"";w.each(t.contentCSS,function(e){n+='<link type="text/css" rel="stylesheet" href="'+i(t.documentBaseURI.toAbsolute(e))+'"'+o+">"}),e&&(n+='<style type="text/css">'+e+"</style>");var a,r,s,c,d,l,m,y=-1===(c=(a=t).getParam("body_id","tinymce","string")).indexOf("=")?c:(s=(r=a).getParam("body_id","","hash"))[r.id]||s,u=-1===(m=(d=t).getParam("body_class","","string")).indexOf("=")?m:(l=d).getParam("body_class","","hash")[l.id]||"",v='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A" && !('+(f.mac?"e.metaKey":"e.ctrlKey && !e.altKey")+")) {e.preventDefault();}}}, false);<\/script> ",g=t.getBody().dir,p=g?' dir="'+i(g)+'"':"";return"<!DOCTYPE html><html><head>"+n+'</head><body id="'+i(y)+'" class="mce-content-body '+i(u)+'"'+p+">"+t.getContent()+v+"</body></html>"}(e=n),e.windowManager.open({title:"Preview",size:"large",body:{type:"panel",items:[{name:"preview",type:"iframe",sandboxed:!0}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{preview:t}}).focus("close")}),(t=e).ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:i}),t.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:i})})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.Env");n.add("print",function(n){var t,i;function e(){return i.execCommand("mcePrint")}(t=n).addCommand("mcePrint",function(){r.browser.isIE()?t.getDoc().execCommand("print",!1,null):t.getWin().print()}),(i=n).ui.registry.addButton("print",{icon:"print",tooltip:"Print",onAction:e}),i.ui.registry.addMenuItem("print",{text:"Print...",icon:"print",onAction:e}),n.addShortcut("Meta+P","","mcePrint")})}();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function o(e){return e.getParam("save_enablewhendirty",!0)}function a(e,n){e.notificationManager.open({text:n,type:"error"})}function t(t){t.addCommand("mceSave",function(){!function(e){var n=c.DOM.getParent(e.id,"form");if(!o(e)||e.isDirty()){if(e.save(),e.getParam("save_onsavecallback"))return e.execCallback("save_onsavecallback",e),e.nodeChanged();n?(e.setDirty(!1),n.onsubmit&&!n.onsubmit()||("function"==typeof n.submit?n.submit():a(e,"Error: Form submit field collision.")),e.nodeChanged()):a(e,"Error: No form element found.")}}(t)}),t.addCommand("mceCancel",function(){var e=t,n=r.trim(e.startContent);e.getParam("save_oncancelcallback")?e.execCallback("save_oncancelcallback",e):e.resetContent(n)})}function i(t){return function(e){function n(){e.setDisabled(o(t)&&!t.isDirty())}return n(),t.on("NodeChange dirty",n),function(){return t.off("NodeChange dirty",n)}}}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),r=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("save",function(e){var n;(n=e).ui.registry.addButton("save",{icon:"save",tooltip:"Save",disabled:!0,onAction:function(){return n.execCommand("mceSave")},onSetup:i(n)}),n.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",disabled:!0,onAction:function(){return n.execCommand("mceCancel")},onSetup:i(n)}),n.addShortcut("Meta+S","","mceSave"),t(e)})}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function n(e){e.keyCode!==y.TAB||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=tinymce.util.Tools.resolve("tinymce.EditorManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),a=tinymce.util.Tools.resolve("tinymce.util.Delay"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),y=tinymce.util.Tools.resolve("tinymce.util.VK"),d=t.DOM;e.add("tabfocus",function(e){function t(l){var r,e,t,n,i;l.keyCode!==y.TAB||l.ctrlKey||l.altKey||l.metaKey||l.isDefaultPrevented()||(e=function(e){function t(e){return/INPUT|TEXTAREA|BUTTON/.test(e.tagName)&&s.get(l.id)&&-1!==e.tabIndex&&i(e)}var n=d.select(":input:enabled,*[tabindex]:not(iframe)"),i=function(e){return"BODY"===e.nodeName||"hidden"!==e.type&&"none"!==e.style.display&&"hidden"!==e.style.visibility&&i(e.parentNode)};if(c.each(n,function(e,t){if(e.id===u.id)return r=t,!1}),0<e){for(var o=r+1;o<n.length;o++)if(t(n[o]))return n[o]}else for(o=r-1;0<=o;o--)if(t(n[o]))return n[o];return null},1===(t=c.explode(u.getParam("tab_focus",u.getParam("tabfocus_elements",":prev,:next")))).length&&(t[1]=t[0],t[0]=":prev"),(n=l.shiftKey?":prev"===t[0]?e(-1):d.get(t[0]):":next"===t[1]?e(1):d.get(t[1]))&&(i=s.get(n.id||n.name),n.id&&i?i.focus():a.setTimeout(function(){o.webkit||window.focus(),n.focus()},10),l.preventDefault()))}var u;(u=e).on("init",function(){u.inline&&d.setAttrib(u.getBody(),"tabIndex",null),u.on("keyup",n),o.gecko?u.on("keypress keydown",t):u.on("keydown",t)})})}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("textcolor",function(){})}();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function a(t){return t.getParam("toc_class","mce-toc")}function s(t){var e=t.getParam("toc_header","h2");return/^h[1-6]$/.test(e)?e:"h2"}function u(n){return function(t){function e(){return t.setDisabled(n.mode.isReadOnly()||!(0<g(n).length))}return e(),n.on("LoadContent SetContent change",e),function(){return n.on("LoadContent SetContent change",e)}}}function d(t){var e,n,o,r="",i=g(t),c=function(t){for(var e=9,n=0;n<t.length;n++)if(1===(e=t[n].level<e?t[n].level:e))return e;return e}(i)-1;if(!i.length)return"";r+=(e=s(t),n=v.translate("Table of Contents"),o="</"+e+">","<"+e+' contenteditable="true">'+m.DOM.encode(n)+o);for(var l=0;l<i.length;l++){var a=i[l];a.element.id=a.id;var u=i[l+1]&&i[l+1].level;if(c===a.level)r+="<li>";else for(var d=c;d<a.level;d++)r+="<ul><li>";if(r+='<a href="#'+a.id+'">'+a.title+"</a>",u!==a.level&&u)for(d=a.level;u<d;d--)r+="</li></ul><li>";else r+="</li>",u||(r+="</ul>");c=a.level}return r}function f(t){var e=a(t),n=t.$("."+e);n.length&&t.undoManager.transact(function(){n.html(d(t))})}var t,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),m=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.util.I18n"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=(t=0,function(){return"mcetoc_"+(new Date).getTime().toString(32)+(t++).toString(32)}),g=function(n){var t,o=a(n),e=s(n),r=function(t){for(var e=[],n=1;n<=t;n++)e.push("h"+n);return e.join(",")}(1<=(t=parseInt(n.getParam("toc_depth","3"),10))&&t<=9?t:3),i=n.$(r);return i.length&&/^h[1-9]$/i.test(e)&&(i=i.filter(function(t,e){return!n.dom.hasClass(e.parentNode,o)})),c.map(i,function(t){return{id:t.id||l(),level:parseInt(t.nodeName.replace(/^H/i,""),10),title:n.$.text(t),element:t}})};e.add("toc",function(t){var c,e,n,o,r,i;function l(){return r.execCommand("mceInsertToc")}(c=t).addCommand("mceInsertToc",function(){var t,e,n,o,r,i;o=a(t=c),r=t.$("."+o),i=t,!r.length||0<i.dom.getParents(r[0],".mce-offscreen-selection").length?t.insertContent((n=d(e=t),'<div class="'+e.dom.encode(a(e))+'" contenteditable="false">'+n+"</div>")):f(t)}),c.addCommand("mceUpdateToc",function(){f(c)}),(r=t).ui.registry.addButton("toc",{icon:"toc",tooltip:"Table of contents",onAction:l,onSetup:u(r)}),r.ui.registry.addButton("tocupdate",{icon:"reload",tooltip:"Update",onAction:function(){return r.execCommand("mceUpdateToc")}}),r.ui.registry.addMenuItem("toc",{icon:"toc",text:"Table of contents",onAction:l,onSetup:u(r)}),r.ui.registry.addContextToolbar("toc",{items:"tocupdate",predicate:(i=r,function(t){return t&&i.dom.is(t,"."+a(i))&&i.getBody().contains(t)}),scope:"node",position:"node"}),n=(e=t).$,o=a(e),e.on("PreProcess",function(t){var e=n("."+o,t.node);e.length&&(e.removeAttr("contentEditable"),e.find("[contenteditable]").removeAttr("contentEditable"))}),e.on("SetContent",function(){var t=n("."+o);t.length&&(t.attr("contentEditable",!1),t.children(":first-child").attr("contentEditable",!0))})})}();
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.10.0 (2021-10-11)
|
||||
*/
|
||||
!function(){"use strict";function f(t,o,e){var n,i;t.dom.toggleClass(t.getBody(),"mce-visualblocks"),e.set(!e.get()),n=t,i=e.get(),n.fire("VisualBlocks",{state:i})}function g(e,n){return function(o){function t(t){return o.setActive(t.state)}return o.setActive(n.get()),e.on("VisualBlocks",t),function(){return e.off("VisualBlocks",t)}}}tinymce.util.Tools.resolve("tinymce.PluginManager").add("visualblocks",function(t,o){var e,n,i,s,c,u,l,a=(e=!1,{get:function(){return e},set:function(t){e=t}});function r(){return s.execCommand("mceVisualBlocks")}i=a,(n=t).addCommand("mceVisualBlocks",function(){f(n,0,i)}),(s=t).ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:r,onSetup:g(s,c=a)}),s.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"visualblocks",onAction:r,onSetup:g(s,c)}),l=a,(u=t).on("PreviewFormats AfterPreviewFormats",function(t){l.get()&&u.dom.toggleClass(u.getBody(),"mce-visualblocks","afterpreviewformats"===t.type)}),u.on("init",function(){u.getParam("visualblocks_default_state",!1,"boolean")&&f(u,0,l)})})}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
body{background-color:#2f3742;color:#dfe0e4;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}a{color:#4099ff}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#6d737b}figure{display:table;margin:1rem auto}figure figcaption{color:#8a8f97;display:block;margin-top:.25rem;text-align:center}hr{border-color:#6d737b;border-style:solid;border-width:1px 0 0 0}code{background-color:#6d737b;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #6d737b;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #6d737b;margin-right:1.5rem;padding-right:1rem}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
@media screen{html{background:#f4f4f4;min-height:100%}}body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif}@media screen{body{background-color:#fff;box-shadow:0 0 4px rgba(0,0,0,.15);box-sizing:border-box;margin:1rem auto 0;max-width:820px;min-height:calc(100vh - 1rem);padding:4rem 6rem 6rem 6rem}}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure figcaption{color:#999;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem auto;max-width:900px}table{border-collapse:collapse}table:not([cellpadding]) td,table:not([cellpadding]) th{padding:.4rem}table[border]:not([border="0"]):not([style*=border-width]) td,table[border]:not([border="0"]):not([style*=border-width]) th{border-width:1px}table[border]:not([border="0"]):not([style*=border-style]) td,table[border]:not([border="0"]):not([style*=border-style]) th{border-style:solid}table[border]:not([border="0"]):not([style*=border-color]) td,table[border]:not([border="0"]):not([style*=border-color]) th{border-color:#ccc}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}
|
||||
+7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}
|
||||
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;-ms-scroll-chaining:none;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}
|
||||
+7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;-ms-scroll-chaining:none;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3036
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,717 @@
|
||||
layui.define(function (exports) {
|
||||
let MOD_NAME = 'tool',dropdown=layui.dropdown;
|
||||
let tool = {
|
||||
loading: false,
|
||||
expressClose:function(index){return '<div class="express-close" data-index="'+index+'" title="关闭">\
|
||||
<div class="express-container">\
|
||||
<div class="express-bar">\
|
||||
<svg viewBox="0 0 202.9 45.5" >\
|
||||
<clipPath id="menu" clipPathUnits="objectBoundingBox" transform="scale(0.0049285362247413 0.021978021978022)">\
|
||||
<path d="M6.7,45.5c5.7,0.1,14.1-0.4,23.3-4c5.7-2.3,9.9-5,18.1-10.5c10.7-7.1,11.8-9.2,20.6-14.3c5-2.9,9.2-5.2,15.2-7c7.1-2.1,13.3-2.3,17.6-2.1c4.2-0.2,10.5,0.1,17.6,2.1c6.1,1.8,10.2,4.1,15.2,7c8.8,5,9.9,7.1,20.6,14.3c8.3,5.5,12.4,8.2,18.1,10.5c9.2,3.6,17.6,4.2,23.3,4H6.7z"/>\
|
||||
</clipPath>\
|
||||
</svg>\
|
||||
</div>\
|
||||
<div class="express-btn">\
|
||||
<svg class="express-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M463.787 512l-253.44-253.44a34.133 34.133 0 0 1 48.213-48.213L512 463.787l253.44-253.44a34.133 34.133 0 1 1 48.213 48.213L560.213 512l253.44 253.44a34.133 34.133 0 1 1-48.213 48.213L512 560.213l-253.44 253.44a34.133 34.133 0 0 1-48.213-48.213z" fill="#ffffff"></path></svg>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>'
|
||||
},
|
||||
side: function (url, width) {
|
||||
let that = this;
|
||||
if (that.loading == true) {
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
sideWidth = '80%';
|
||||
if(window.innerWidth>1366 && window.innerWidth<=1600){
|
||||
sideWidth = '86%';
|
||||
}
|
||||
if(window.innerWidth>1000 && window.innerWidth<=1440){
|
||||
sideWidth = '93%';
|
||||
}
|
||||
if(window.innerWidth<=1000){
|
||||
sideWidth = '95%';
|
||||
}
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
offset: 'r',
|
||||
anim: 'slideLeft',
|
||||
closeBtn: 0,
|
||||
content: url,
|
||||
area: [sideWidth, '100%'],
|
||||
skin:'layui-layer-gougu-admin',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
$('body').removeClass('right-open');
|
||||
if (layui.pageTable && layui.pageTable.resize) {
|
||||
layui.pageTable.resize();
|
||||
}
|
||||
},
|
||||
success: function (obj, index) {
|
||||
$('body').addClass('right-open');
|
||||
obj.append(that.expressClose(index));
|
||||
that.loading = false;
|
||||
obj.on('click','.express-close', function () {
|
||||
layer.close(index);
|
||||
});
|
||||
setTimeout(function(){
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
},500)
|
||||
}
|
||||
})
|
||||
},
|
||||
box: function (url,title="内容", width=720,height=405) {
|
||||
let that = this;
|
||||
if (that.loading == true) {
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
content: url,
|
||||
area: [width+'px', height+'px'],
|
||||
maxmin: true,
|
||||
end: function(){
|
||||
if (layui.pageTable && layui.pageTable.resize) {
|
||||
layui.pageTable.resize();
|
||||
}
|
||||
},
|
||||
success: function (obj, index) {
|
||||
let btn = '<div data-index="'+index+'" class="express-close" style="display:none;" title="关闭">关闭</div>';
|
||||
obj.append(btn);
|
||||
that.loading = false;
|
||||
obj.on('click','.express-close', function () {
|
||||
layer.close(index);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//右侧ajax请求的方式打开页面参考勾股DEV
|
||||
open: function (url, width) {
|
||||
let that = this;
|
||||
if (that.loading == true) {
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
let countWidth = window.innerWidth-(window.innerWidth*0.5)+456;
|
||||
if(window.innerWidth<=1000){
|
||||
countWidth = 750;
|
||||
}
|
||||
if (width && width > 0) {
|
||||
sideWidth = width + 'px';
|
||||
}
|
||||
else{
|
||||
sideWidth = countWidth + 'px';
|
||||
}
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
timeout: 10000,
|
||||
success: function (res) {
|
||||
if (res['code'] && res['code'] > 0) {
|
||||
layer.msg(res.msg);
|
||||
return false;
|
||||
}
|
||||
let index = timestamp = new Date().getTime();
|
||||
let express = '<section id="expressLayer" class="express-box" style="width:' + sideWidth + '"><article id="articleLayer">' + res + '</article>'+that.expressClose(index)+'</section><div id="expressMask" class="express-mask"></div>';
|
||||
|
||||
$('body').append(express).addClass('right-open');
|
||||
$('#expressMask').fadeIn(200);
|
||||
$('#expressLayer').animate({ 'right': 0 }, 200, 'linear', function () {
|
||||
if (typeof (openInit) == "function") {
|
||||
openInit();
|
||||
}
|
||||
});
|
||||
that.loading = false;
|
||||
//关闭
|
||||
$('body').on('click','.express-close', function () {
|
||||
$('#expressMask').fadeOut(100);
|
||||
$('body').removeClass('right-open');
|
||||
let op_width = $('#expressLayer').outerWidth();
|
||||
$('#expressLayer').animate({ left: '+=' + op_width + 'px' }, 200, 'linear', function () {
|
||||
$('#expressLayer').remove();
|
||||
$('#expressMask').remove();
|
||||
if (layui.pageTable) {
|
||||
layui.pageTable.resize();
|
||||
}
|
||||
})
|
||||
})
|
||||
$(window).resize(function () {
|
||||
let resizeWidth = window.innerWidth-(window.innerWidth*0.5)+456;
|
||||
if(window.innerWidth<=1000){
|
||||
resizeWidth = 750;
|
||||
}
|
||||
$('#expressLayer').width(resizeWidth);
|
||||
})
|
||||
},
|
||||
error: function (xhr, textstatus, thrown) {
|
||||
console.log('错误');
|
||||
},
|
||||
complete: function () {
|
||||
that.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
load: function (url) {
|
||||
let that = this;
|
||||
if (that.loading == true) {
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
timeout: 10000,
|
||||
success: function (res) {
|
||||
if (res['code'] && res['code'] > 0) {
|
||||
layer.msg(res.msg);
|
||||
return false;
|
||||
}
|
||||
$('#articleLayer').html(res);
|
||||
openInit();
|
||||
}
|
||||
, error: function (xhr, textstatus, thrown) {
|
||||
console.log('错误');
|
||||
},
|
||||
complete: function () {
|
||||
that.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
page: function (url) {
|
||||
let that = this;
|
||||
if (that.loading == true) {
|
||||
return false;
|
||||
}
|
||||
that.loading = true;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
timeout: 10000,
|
||||
success: function (res) {
|
||||
if (res['code'] && res['code'] > 0) {
|
||||
layer.msg(res.msg);
|
||||
return false;
|
||||
}
|
||||
$('#pageBox').html(res);
|
||||
pageInit();
|
||||
},
|
||||
error: function (xhr, textstatus, thrown) {
|
||||
console.log('错误');
|
||||
},
|
||||
complete: function () {
|
||||
that.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
reload: function (delay) {
|
||||
//延迟刷新,一般是在编辑完页面数据后需要自动关闭页面用到
|
||||
if(delay && delay>0){
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, delay);
|
||||
}else{
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
ask:function(tips,yes,cancel){
|
||||
layer.confirm(tips, {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
success:function(){
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
},
|
||||
end:function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
}
|
||||
}, function (index) {
|
||||
if (yes && typeof yes === 'function') {
|
||||
yes();
|
||||
}
|
||||
layer.close(index);
|
||||
}, function (index) {
|
||||
if (cancel && typeof cancel === 'function') {
|
||||
cancel();
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
},
|
||||
close: function (delay,table,reload) {
|
||||
//延迟关闭,一般是在编辑完页面数据后需要自动关闭页面用到
|
||||
if (typeof(delay) === "undefined" || delay === '') {
|
||||
delay = 0;
|
||||
}
|
||||
if (typeof(table) === "undefined" || table === '') {
|
||||
table = 'pageTable';
|
||||
}
|
||||
if (typeof(reload) === "undefined" || reload === '') {
|
||||
reload = 1;
|
||||
}
|
||||
|
||||
if(delay>0){
|
||||
setTimeout(function () {
|
||||
$('.express-close').last().click();
|
||||
}, delay);
|
||||
}else{
|
||||
$('.express-close').last().click();
|
||||
}
|
||||
|
||||
if (layui[table]) {
|
||||
layui[table].reload();
|
||||
}
|
||||
else{
|
||||
if(reload==1){
|
||||
tool.reload(delay);
|
||||
}
|
||||
}
|
||||
},
|
||||
ajax: function (options, callback, clickbtn) {
|
||||
let format = 'json';
|
||||
if (options.hasOwnProperty('data')) {
|
||||
format = options.data.hasOwnProperty('format') ? options.data.format : 'json';
|
||||
}
|
||||
callback = callback || options.success;
|
||||
callback && delete options.success;
|
||||
let optsetting = { timeout: 10000 };
|
||||
if (format == 'jsonp') {
|
||||
optsetting = { timeout: 10000, dataType: 'jsonp', jsonp: 'callback' }
|
||||
}
|
||||
let opts = $.extend({}, optsetting, {
|
||||
success: function (res) {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback(res);
|
||||
}
|
||||
},
|
||||
beforeSend:function(){
|
||||
if (clickbtn && typeof clickbtn === 'object') {
|
||||
clickbtn.attr('disabled',true).html('提交中 ...');
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
if (clickbtn && typeof clickbtn === 'object') {
|
||||
setTimeout(function(){
|
||||
clickbtn.removeAttr('disabled').html('立即提交');
|
||||
},1000);
|
||||
}
|
||||
}
|
||||
}, options);
|
||||
$.ajax(opts);
|
||||
},
|
||||
get: function (url, data, callback) {
|
||||
this.ajax({url: url,type: "GET",data: data}, callback);
|
||||
},
|
||||
post: function (url, data, callback, clickbtn) {
|
||||
this.ajax({url: url,type: "POST",data: data}, callback, clickbtn);
|
||||
},
|
||||
put: function (url, data, callback) {
|
||||
this.ajax({url: url,type: "PUT",data: data}, callback);
|
||||
},
|
||||
delete: function (url, data, callback) {
|
||||
this.ajax({url: url,type: "DELETE",data: data}, callback);
|
||||
},
|
||||
parentAdmin:function () {
|
||||
if(parent.layui.admin){
|
||||
return parent.layui.admin;
|
||||
}
|
||||
else{
|
||||
if(parent.parent.layui.admin){
|
||||
return parent.parent.layui.admin;
|
||||
}
|
||||
else{
|
||||
if(parent.parent.parent.layui.admin){
|
||||
return parent.parent.parent.layui.admin;
|
||||
}
|
||||
else{
|
||||
if(parent.parent.parent.parent.layui.admin){
|
||||
return parent.parent.parent.parent.layui.admin;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sideClose(delay,table,reload){
|
||||
if(parent.layui.tool){
|
||||
parent.layui.tool.close(delay,table,reload);
|
||||
}
|
||||
else{
|
||||
console.log('父页面没引用tool模块');
|
||||
}
|
||||
},
|
||||
tabAdd:function(url,title,id){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.sonAdd(url,title,id);
|
||||
}
|
||||
},
|
||||
tabClose:function(){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.sonClose();
|
||||
}
|
||||
},
|
||||
tabDelete:function(id){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.tabDelete(id);
|
||||
}
|
||||
},
|
||||
tabChange:function(id){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.tabChange(id);
|
||||
}
|
||||
},
|
||||
tabRefresh:function(id){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.refresh(id);
|
||||
}
|
||||
},
|
||||
officeView:function(id,mode){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.officeView(id,mode);
|
||||
}
|
||||
},
|
||||
pdfView:function(href){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.pdfView(href);
|
||||
}
|
||||
},
|
||||
photoView:function(href){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.photoView(href);
|
||||
}
|
||||
},
|
||||
videoView:function(href){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.videoView(href);
|
||||
}
|
||||
},
|
||||
audioView:function(href){
|
||||
let parentAdmin = this.parentAdmin();
|
||||
if(parentAdmin){
|
||||
parentAdmin.audioView(href);
|
||||
}
|
||||
},
|
||||
articleView:function(fileid) {
|
||||
tool.side('/disk/index/view_article?id='+fileid);
|
||||
},
|
||||
articleEdit:function(fileid) {
|
||||
tool.side('/disk/index/add_article?id='+fileid);
|
||||
},
|
||||
downloadFile:function(url, fileName) {
|
||||
let link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
layer.msg('文件下载中...', {time: 2000});
|
||||
},
|
||||
copyCtrl:function(content) {
|
||||
var save = function(e){
|
||||
e.clipboardData.setData('text/plain', content);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener('copy', save);
|
||||
document.execCommand('copy');
|
||||
document.removeEventListener('copy',save);
|
||||
if (content != '') {
|
||||
layer.msg('复制成功');
|
||||
}
|
||||
},
|
||||
//格式化文件大小
|
||||
renderSize:function(val){
|
||||
if(null==val||val==''){
|
||||
return "0 Bytes";
|
||||
}
|
||||
var unitArr = new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");
|
||||
var index=0;
|
||||
var srcsize = parseFloat(val);
|
||||
index=Math.floor(Math.log(srcsize)/Math.log(1024));
|
||||
var size =srcsize/Math.pow(1024,index);
|
||||
size=size.toFixed(2);//保留的小数位数
|
||||
return size+unitArr[index];
|
||||
},
|
||||
//格式化附件展示
|
||||
fileCard:function(file,view){
|
||||
if(!file.hasOwnProperty('file_id')){
|
||||
file['file_id'] = file['id'];
|
||||
}
|
||||
let image=['jpg','jpeg','png','gif'];
|
||||
let office=['doc','docx','xls','xlsx','ppt','pptx'];
|
||||
let type_icon = 'icon-xiangmuguanli';
|
||||
let type = 0;//0下载+重命名+删除,1下载+查看+重命名+删除,2下载+查看+编辑+重命名+删除
|
||||
let ext = 'zip';
|
||||
let view_btn = '<a class="blue" href="'+file['filepath']+'" download="'+file['name']+'" target="_blank" title="下载"><i class="iconfont icon-xiazai"></i></a>';
|
||||
|
||||
if(file['fileext'] == 'pdf'){
|
||||
type_icon = 'icon-kejian';
|
||||
ext = 'pdf';
|
||||
type = 1;
|
||||
}
|
||||
if(image.includes(file['fileext'])){
|
||||
type_icon = 'icon-sucaiguanli';
|
||||
ext = 'image';
|
||||
type = 1;
|
||||
}
|
||||
if(office.includes(file['fileext'])){
|
||||
type_icon = 'icon-shenbao';
|
||||
ext = 'office';
|
||||
type = 1;
|
||||
}
|
||||
if(view == ''){
|
||||
view_btn = '<span class="file-ctrl blue" data-ctrl="edit" data-type="'+type+'" data-fileid="'+file['file_id']+'" data-ext="'+ext+'" data-filename="'+file['name']+'" data-href="'+file['filepath']+'" data-id="'+file['id']+'" data-uid="'+file['admin_id']+'" title="附件操作"><i class="iconfont icon-gengduo1"></i></span><span class="name-edit green" style="display:none;" data-id="'+file['id']+'" data-fileid="'+file['file_id']+'" id="fileEdit'+file['file_id']+'" data-name="'+file['name']+'" data-fileext="'+file['fileext']+'" title="重命名"></span><span class="file-delete red" style="display:none;" data-uid="'+file['admin_id']+'" data-id="'+file['id']+'" data-fileid="'+file['file_id']+'" id="fileDel'+file['file_id']+'" title="删除"></span>';
|
||||
}
|
||||
else{
|
||||
view_btn = '<span class="file-ctrl blue" data-ctrl="view" data-type="'+type+'" data-fileid="'+file['file_id']+'" data-ext="'+ext+'" data-filename="'+file['name']+'" data-href="'+file['filepath']+'" title="附件操作"><i class="iconfont icon-gengduo1"></i></span>';
|
||||
}
|
||||
let file_del='';
|
||||
if(file['delete_time'] > 0){
|
||||
file_del = 'file-hasdelete';
|
||||
}
|
||||
let item = '<div class="file-card '+file_del+'" id="fileItem'+file['file_id']+'">\
|
||||
<i class="file-icon iconfont '+type_icon+'"></i>\
|
||||
<div class="file-info">\
|
||||
<div class="file-title" title="'+file['name']+'">'+file['name']+'</div>\
|
||||
<div class="file-ops">'+this.renderSize(file['filesize'])+','+layui.util.toDateString(file['create_time']*1000, 'yyyy-MM-dd hh:mm:ss')+'</div>\
|
||||
</div>\
|
||||
<div class="file-tool">'+view_btn+'</div>\
|
||||
</div>';
|
||||
return item;
|
||||
}
|
||||
};
|
||||
//时间选择快捷操作
|
||||
$('body').on('click', '.tool-time', function () {
|
||||
let that = $(this);
|
||||
let type = that.data('type');
|
||||
let range = that.data('range');
|
||||
let min = that.data('min');
|
||||
let max = that.data('max');
|
||||
let format = that.data('format');
|
||||
if (typeof(type) == "undefined" || type === '') {
|
||||
type = 'date';
|
||||
}
|
||||
if (typeof(range) == "undefined" || type === '') {
|
||||
range = false;
|
||||
}
|
||||
if (typeof(min) == "undefined" || min === '') {
|
||||
min = '1900-1-1';
|
||||
}
|
||||
if (typeof(max) == "undefined" || max === '') {
|
||||
max = '2099-1-1';
|
||||
}
|
||||
if (typeof(format) == "undefined" || format === '') {
|
||||
layui.laydate.render({
|
||||
elem: that,
|
||||
show: true,
|
||||
type: type,
|
||||
range: range,
|
||||
min: min,
|
||||
max: max,
|
||||
fullPanel: true
|
||||
});
|
||||
}else{
|
||||
layui.laydate.render({
|
||||
elem: that,
|
||||
show: true,
|
||||
type: type,
|
||||
range: range,
|
||||
min: min,
|
||||
max: max,
|
||||
format:format,
|
||||
fullPanel: true
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//附件操作
|
||||
const ctrlBtn=function(ctrl){
|
||||
//操作按钮'0下载','1查看','2编辑','3重命名','4删除','5移动','6标星','7取消标星','8还原','9清除'
|
||||
let ctrl_types = ['下载','查看','编辑','重命名','删除','移动','标星','取消标星','还原','清除'];
|
||||
let ctrls=[];
|
||||
for(let i=0;i<ctrl.length;i++){
|
||||
ctrls.push({"id":ctrl[i]+'',"title":ctrl_types[ctrl[i]]});
|
||||
}
|
||||
return ctrls;
|
||||
}
|
||||
|
||||
$('body').on('click','.file-ctrl',function () {
|
||||
let that = $(this);
|
||||
let ctrl = $(this).data('ctrl');
|
||||
let fileid = $(this).data('fileid');
|
||||
let filename = $(this).data('filename');
|
||||
let type = $(this).data('type');
|
||||
let ext = $(this).data('ext');
|
||||
let href = $(this).data('href');
|
||||
let actionid=0;
|
||||
let file_menu = ctrlBtn([0]);
|
||||
//type:0下载+重命名+删除,1下载+查看+重命名+删除,2下载+查看+编辑+重命名+删除
|
||||
if(ctrl=='edit'){
|
||||
let types=[
|
||||
[0,1,3,4],//下载+查看+重命名+删除
|
||||
[0,1,3,4],//下载+查看+重命名+删除
|
||||
[0,1,2,3,4]//下载+查看+编辑+重命名+删除
|
||||
];
|
||||
file_menu = ctrlBtn(types[type]);
|
||||
}
|
||||
if(ctrl=='view'){
|
||||
if(type==0){
|
||||
file_menu = ctrlBtn([0]);
|
||||
}
|
||||
else{
|
||||
file_menu = ctrlBtn([0,1]);
|
||||
}
|
||||
}
|
||||
if(ctrl=='disk'){
|
||||
if(type!=''){
|
||||
actionid = $(this).data('actionid');
|
||||
file_menu = ctrlBtn((type+'').split(","));
|
||||
}
|
||||
}
|
||||
console.log(actionid);
|
||||
dropdown.render({
|
||||
elem: that,
|
||||
className:'file-menu',
|
||||
align: 'right',
|
||||
show: true, // 外部事件触发即显示
|
||||
data: file_menu,
|
||||
click: function(obj){
|
||||
let click_t = obj.id;
|
||||
switch (click_t) {
|
||||
case '0':
|
||||
tool.downloadFile(href,filename);
|
||||
break;
|
||||
case '1':
|
||||
if(ext=='image'){
|
||||
tool.photoView(href);
|
||||
}
|
||||
if(ext=='pdf'){
|
||||
tool.pdfView(href);
|
||||
}
|
||||
if(ext=='video'){
|
||||
tool.videoView(href);
|
||||
}
|
||||
if(ext=='audio'){
|
||||
tool.audioView(href);
|
||||
}
|
||||
if(ext=='office'){
|
||||
if(ctrl=='disk'){
|
||||
tool.officeView(actionid,'view');
|
||||
}
|
||||
else{
|
||||
tool.officeView(fileid,'view');
|
||||
}
|
||||
}
|
||||
if(ext=='article'){
|
||||
tool.articleView(fileid);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if(ext=='office'){
|
||||
if(ctrl=='disk'){
|
||||
tool.officeView(actionid,'view');
|
||||
}
|
||||
else{
|
||||
tool.officeView(fileid,'view');
|
||||
}
|
||||
}
|
||||
if(ext=='article'){
|
||||
tool.articleEdit(fileid);
|
||||
}
|
||||
break;
|
||||
case '3'://编辑
|
||||
$('#fileEdit'+fileid).click();
|
||||
break;
|
||||
case '4'://删除
|
||||
$('#fileDel'+fileid).click();
|
||||
break;
|
||||
case '5'://移动
|
||||
$('#fileMove'+fileid).click();
|
||||
break;
|
||||
case '6'://标星
|
||||
$('#fileStar'+fileid).click();
|
||||
break;
|
||||
case '7'://取消标星
|
||||
$('#fileStarno'+fileid).click();
|
||||
break;
|
||||
case '8'://还原
|
||||
$('#fileBack'+fileid).click();
|
||||
break;
|
||||
case '9'://清除
|
||||
$('#fileClear'+fileid).click();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//搜索表单重置快捷操作
|
||||
$('body').on('click', '[lay-filter="reset"]', function () {
|
||||
let that = $(this);
|
||||
let prev = that.prev();
|
||||
if (typeof(prev) != "undefined") {
|
||||
setTimeout(function () {
|
||||
prev.click();
|
||||
}, 10)
|
||||
}
|
||||
});
|
||||
|
||||
//新建按钮快捷操作
|
||||
$('body').on('click', '.tool-add', function () {
|
||||
let href = $(this).data('href');
|
||||
if (typeof(href) == "undefined" || href == '') {
|
||||
return false;
|
||||
}
|
||||
tool.side(href);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.tab-a', function () {
|
||||
let id = $(this).data('id');
|
||||
let url = $(this).data('href');
|
||||
let title = $(this).data('title');
|
||||
if (url && url !== '') {
|
||||
if (typeof(id) == "undefined" || id == '') {
|
||||
id = Date.now();
|
||||
}
|
||||
tool.tabAdd(url,title,id);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('body').on('click', '.side-a', function () {
|
||||
let url = $(this).data('href');
|
||||
if (url && url !== '') {
|
||||
tool.side(url);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('body').on('click', '.open-a', function () {
|
||||
let url = $(this).data('href');
|
||||
if (url && url !== '') {
|
||||
tool.open(url);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('body').on('click', '.link-a', function () {
|
||||
let url = $(this).data('href');
|
||||
if (url && url !== '') {
|
||||
window.location.href=url;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
exports(MOD_NAME, tool);
|
||||
});
|
||||
@@ -0,0 +1,577 @@
|
||||
layui.define(['tool'],function(exports){
|
||||
let layer = layui.layer,element = layui.element,tool=layui.tool,form = layui.form,upload = layui.upload,uploadIndex=0;
|
||||
// 查找指定的元素在数组中的位置
|
||||
Array.prototype.indexOf = function (val) {
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
if (this[i] == val) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
// 通过索引删除数组元素
|
||||
Array.prototype.remove = function (val) {
|
||||
var index = this.indexOf(val);
|
||||
if (index > -1) {
|
||||
this.splice(index, 1);
|
||||
}
|
||||
};
|
||||
//是否是对象
|
||||
function isObject(obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Object]';
|
||||
}
|
||||
//名称是否合法
|
||||
function isValidFileName(fileName) {
|
||||
const illegalChars = /[\\\/\*\:"<>|\?]/;
|
||||
return !illegalChars.test(fileName);
|
||||
}
|
||||
const opts={
|
||||
"title":'上传文件',
|
||||
"url":'/api/index/upload',
|
||||
"target":'uploadBtn',
|
||||
"targetBox":'uploadBox',
|
||||
"use":'attachment',//attachment(附件上传),shard(大文件分片上传),single(单图上传),multi(多图上传),import(excel导入上传)
|
||||
"attachment":{
|
||||
"type":0,//0ajax多文件模式,1ajax单文件单记录模式
|
||||
"exts": 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z|txt|wps|avi|wmv|mpg|mov|rm|flv|mp4|mp3|wav|wma|flac|midi|dwg|dxf|dwt|xmind', //只允许上传文件格式
|
||||
"colmd":4,
|
||||
"uidDelete":false,//是否开启只有上传人自己才能删除自己的附件
|
||||
"ajaxSave":null,
|
||||
"ajaxDelete":null
|
||||
},
|
||||
"shard":{
|
||||
"exts": 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z|txt|wps|avi|wmv|mpg|mov|rm|flv|mp4|mp3|wav|wma|flac|midi|dwg|dxf|dwt|xmind', //只允许上传文件格式
|
||||
},
|
||||
"single":{
|
||||
"exts": 'png|jpg|gif|jpeg',
|
||||
},
|
||||
"multi":{
|
||||
"exts": 'png|jpg|gif|jpeg',
|
||||
"type":1,
|
||||
"max":31,
|
||||
},
|
||||
"import":{
|
||||
"exts": 'xls|xlsx',
|
||||
"template":null,
|
||||
"tips":'如果导入失败,请根据提示注意检查表格数据。'
|
||||
},
|
||||
"callback": null
|
||||
};
|
||||
var uploadPlus = function(options){
|
||||
this.settings = $.extend(true,{},opts, options);
|
||||
this.settings.index = uploadIndex;
|
||||
uploadIndex++;
|
||||
let me=this;
|
||||
switch (me.settings.use) {
|
||||
case "shard":
|
||||
//分片上传
|
||||
me.shardUpload();
|
||||
break;
|
||||
case "single":
|
||||
me.singleImage();
|
||||
break;
|
||||
case "multi":
|
||||
if(isObject(me.settings.target)){
|
||||
me.multiImage();
|
||||
}
|
||||
else{
|
||||
$('#'+me.settings.target).click(function(){
|
||||
me.multiImage();
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "import":
|
||||
me.excelImport();
|
||||
break;
|
||||
default:
|
||||
me.attachment();
|
||||
}
|
||||
};
|
||||
uploadPlus.prototype = {
|
||||
attachment: function () {
|
||||
let me = this;
|
||||
let box = $('#'+me.settings.targetBox);
|
||||
let boxInput = box.find('[data-type="file"]');
|
||||
let attachment = me.settings.attachment;
|
||||
//删除附件
|
||||
box.on('click', '.file-delete', function () {
|
||||
let id = $(this).data('id'),file_id = $(this).data('fileid'),uid = $(this).data('uid');
|
||||
if (uid != login_admin && attachment.uidDelete==true) {
|
||||
layer.msg('你不是该文件的上传人,无权限删除');
|
||||
return false;
|
||||
}
|
||||
let idsStr = boxInput.val(),idsArray = [];
|
||||
if (typeof idsStr !== 'undefined' && idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
idsArray.remove(file_id);
|
||||
}
|
||||
tool.ask('确定删除该附件吗?', function(index) {
|
||||
if (typeof (attachment.ajaxDelete) === "function") {
|
||||
if(attachment.type==1){
|
||||
//单文件,单记录删除
|
||||
attachment.ajaxDelete(id,file_id);
|
||||
}
|
||||
else{
|
||||
attachment.ajaxDelete(idsArray.join(','));
|
||||
}
|
||||
}
|
||||
else{
|
||||
//虚拟删除
|
||||
boxInput.val(idsArray.join(','));
|
||||
$('#uploadFile' + id).remove();
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
|
||||
//重命名附件
|
||||
box.on('click','.name-edit',function(){
|
||||
let file_id = $(this).data('fileid');
|
||||
let uid = $(this).data('uid');
|
||||
if (uid != login_admin && me.settings.uidDelete==true) {
|
||||
layer.msg('你不是该文件的上传人,无权限修改');
|
||||
return false;
|
||||
}
|
||||
let name = $(this).data('name');
|
||||
let fileext = $(this).data('fileext');
|
||||
layer.prompt({
|
||||
title: '重命名',
|
||||
value: name.replace(/\.[^.]+$/, ""),
|
||||
yes: function(index, layero) {
|
||||
// 获取文本框输入的值
|
||||
var value = layero.find(".layui-layer-input").val();
|
||||
if (value!='') {
|
||||
if(isValidFileName(value)==false){
|
||||
layer.msg('文件名不能包含下列任何字符:\/:*?".<>|');
|
||||
return false;
|
||||
}
|
||||
let new_title = value+'.'+fileext;
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
$('#fileItem'+file_id).find('.file-title').html(new_title).attr('title',new_title);
|
||||
}
|
||||
tool.post("/api/index/file_edit", {id:file_id,title:new_title}, callback);
|
||||
layer.close(index);
|
||||
} else {
|
||||
layer.msg('请填写文件名称');
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//多附件上传
|
||||
upload.render({
|
||||
elem: '#'+me.settings.target,
|
||||
url: me.settings.url,
|
||||
accept: 'file',
|
||||
exts: attachment.exts,
|
||||
multiple: true,
|
||||
before: function(obj){
|
||||
layer.msg('上传中...', {icon: 16, time: 0});
|
||||
},
|
||||
done: function(res){
|
||||
if (res.code == 0) {
|
||||
//上传成功
|
||||
if(attachment.type==0){
|
||||
let image=['jpg','jpeg','png','gif'],office=['doc','docx','xls','xlsx','ppt','pptx'];
|
||||
let idsStr = boxInput.val(),idsArray = [];
|
||||
if (typeof idsStr !== 'undefined' && idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.push(res.data.id);
|
||||
let filesize = tool.renderSize(res.data.filesize),type=0,type_icon = 'icon-xiangmuguanli',ext = 'zip';
|
||||
if(res.data.fileext == 'pdf'){
|
||||
type=1;
|
||||
type_icon = 'icon-kejian';
|
||||
ext = 'pdf';
|
||||
}
|
||||
if (image.indexOf(res.data.fileext) !== -1) {
|
||||
type=1;
|
||||
type_icon = 'icon-sucaiguanli';
|
||||
ext = 'image';
|
||||
}
|
||||
if (office.indexOf(res.data.fileext) !== -1) {
|
||||
type=2;
|
||||
type_icon = 'icon-shenbao';
|
||||
ext = 'office';
|
||||
}
|
||||
|
||||
let view_btn = '<span class="file-ctrl blue" data-ctrl="edit" data-type="'+type+'" data-fileid="'+res.data.id+'" data-ext="'+ext+'" data-filename="'+res.data.name+'" data-href="'+res.data.filepath+'" data-id="'+res.data.id+'" data-uid="'+res.data.uid+'" title="附件操作"><i class="iconfont icon-gengduo1"></i></span>';
|
||||
|
||||
let temp = `<div class="layui-col-md${attachment.colmd}" id="uploadFile${res.data.id}">
|
||||
<div class="file-card" id="fileItem${res.data.id}">
|
||||
<i class="file-icon iconfont ${type_icon}"></i>
|
||||
<div class="file-info">
|
||||
<div class="file-title" title="${res.data.name}">${res.data.name}</div>
|
||||
<div class="file-ops">${filesize},一分钟前</div>
|
||||
</div>
|
||||
<div class="file-tool">${view_btn}<span class="name-edit green" style="display:none;" data-id="${res.data.id}" data-fileid="${res.data.id}" id="fileEdit${res.data.id}" data-name="${res.data.name}" data-fileext="${res.data.fileext}" title="重命名"></span><span class="file-delete red" style="display:none;" data-id="${res.data.id}" data-fileid="${res.data.id}" id="fileDel${res.data.id}" title="删除"><i class="iconfont icon-shanchu"></i></span></div>
|
||||
</div>
|
||||
</div>`;
|
||||
boxInput.val(idsArray.join(','));
|
||||
if (typeof (attachment.ajaxSave) === "function") {
|
||||
attachment.ajaxSave(idsArray.join(','));
|
||||
}
|
||||
else{
|
||||
box.append(temp);
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
if(attachment.type==1){
|
||||
//单文件,单记录保存
|
||||
if (typeof (attachment.ajaxSave) === "function") {
|
||||
attachment.ajaxSave(res);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//单图
|
||||
singleImage: function () {
|
||||
let me = this;
|
||||
let single = upload.render({
|
||||
elem: "#"+me.settings.target,
|
||||
url: me.settings.url,
|
||||
accept: 'images',
|
||||
acceptMime:'image/*',
|
||||
done: function (res) {
|
||||
me.settings.callback(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
//多图
|
||||
multiImage: function () {
|
||||
let me = this;
|
||||
let area =[[],['640px','360px'],['928px','610px']];
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
this.layerindex = layer.open({
|
||||
'title':me.settings.title,
|
||||
'area':area[me.settings.multi.type],
|
||||
'content':me.multiRender(),
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
'type':1,
|
||||
'success':function(){
|
||||
if(me.settings.multi.type==1){
|
||||
me.uploadOne();
|
||||
}else{
|
||||
me.uploadMore();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
multiRender: function (){
|
||||
let me = this;
|
||||
let template_one = '<div class="layui-form p-3">\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label">来源:</label>\
|
||||
<div class="layui-input-block">\
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="1" title="本地上传" checked>\
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="2" title="网络图片">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div id="uploadType1">\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label">文件:</label>\
|
||||
<div class="layui-input-block">\
|
||||
<span class="gougu-upload-files">.jpg、.jpeg、.gif、.png、.bmp</span><button type="button" class="layui-btn layui-btn-normal" id="gouguUploadBtn'+me.settings.index+'">选择文件</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block">\
|
||||
<span class="gougu-upload-tips">只能上传 .jpg、.jpeg、.gif、.png、.bmp 文件</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block" id="gouguUploadChoosed'+me.settings.index+'"></div>\
|
||||
</div>\
|
||||
<div class="layui-progress upload-progress" lay-showpercent="yes" lay-filter="upload-progress-'+me.settings.index+'" style="margin-bottom:12px; margin-left:100px; width:320px; display:none;">\
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent=""><span class="layui-progress-text"></span></div>\
|
||||
</div>\
|
||||
<div class="layui-form-item layui-form-item-sm">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block">\
|
||||
<button type="button" class="layui-btn" id="uploadNow'+me.settings.index+'">开始上传</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div id="uploadType2" style="display:none; width:480px;">\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label">URL地址:</label>\
|
||||
<div class="layui-input-block">\
|
||||
<input type="text" name="img_url" placeholder="" autocomplete="off" class="layui-input">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label">图片名称:</label>\
|
||||
<div class="layui-input-block">\
|
||||
<input type="text" name="img_name" placeholder="" autocomplete="off" class="layui-input">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item layui-form-item-sm">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block">\
|
||||
<span class="layui-btn" id="uploadSave'+me.settings.index+'">确定保存</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
let template_more = '<div class="layui-form p-3">\
|
||||
<div id="gouguUploadBox'+me.settings.index+'" class="gougu-upload-box select">\
|
||||
<div id="gouguUploadBtn'+me.settings.index+'" class="gougu-upload-btn"><div class="gougu-upload-btn-box"><i class="layui-icon layui-icon-addition"></i><br/>点击上传图片</div></div>\
|
||||
</div>\
|
||||
<div class="layui-progress upload-progress" lay-showpercent="yes" lay-filter="progress-'+me.settings.index+'" style="margin:12px 0; width:900px;">\
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent=""><span class="layui-progress-text"></span></div>\
|
||||
</div>\
|
||||
<div class="layui-form-item layui-form-item-sm">\
|
||||
<span class="gougu-upload-tips">注:只能上传 jpg、.jpeg、.gif、.png、.bmp 文件,单次最多上传 '+me.settings.max+' 张图片,单张图片最大不要超过10M。</span>\
|
||||
<button type="button" class="layui-btn" id="uploadNow'+me.settings.index+'">开始上传</button>\
|
||||
<button type="button" class="layui-btn layui-btn-primary" id="uploadClear'+me.settings.index+'">清空列表</button>\
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="uploadOk'+me.settings.index+'">提交</button>\
|
||||
</div>\
|
||||
</div>';
|
||||
return me.settings.multi.type==1?template_one:template_more;
|
||||
},
|
||||
uploadOne:function(){
|
||||
let me = this;
|
||||
form.render();
|
||||
form.on('radio(type)', function(data){
|
||||
if(data.value==1){
|
||||
$('#uploadType1').show();
|
||||
$('#uploadType2').hide();
|
||||
}
|
||||
else{
|
||||
$('#uploadType1').hide();
|
||||
$('#uploadType2').show();
|
||||
}
|
||||
});
|
||||
//选文件
|
||||
let uploadOne = upload.render({
|
||||
elem: '#gouguUploadBtn'+me.settings.index
|
||||
,url: me.settings.url
|
||||
,auto: false
|
||||
,accept: 'images'
|
||||
,acceptMime:'image/*'
|
||||
,bindAction: '#uploadNow'+me.settings.index
|
||||
,choose: function(obj){
|
||||
obj.preview(function(index, file, result){
|
||||
$('#gouguUploadChoosed'+me.settings.index).html('已选择:'+file.name);
|
||||
});
|
||||
}
|
||||
,before: function(obj){
|
||||
$('.upload-progress').show();
|
||||
element.progress('upload-progress-'+me.settings.index, '0%');
|
||||
}
|
||||
,progress: function(n, elem, e){
|
||||
console.log(n);
|
||||
element.progress('upload-progress-'+me.settings.index, n + '%');
|
||||
}
|
||||
,done: function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
me.settings.callback(res.data);
|
||||
layer.close(me.layerindex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#uploadSave'+me.settings.index).on('click',function(){
|
||||
let url=$('[name="img_url"]').val();
|
||||
let name=$('[name="img_name"]').val();
|
||||
if(url == ''){
|
||||
layer.msg('请输入图片URL');
|
||||
return false;
|
||||
}
|
||||
if(name == ''){
|
||||
layer.msg('请输入图片名称');
|
||||
return false;
|
||||
}
|
||||
let res={
|
||||
filepath:url,
|
||||
name:name,
|
||||
id:0
|
||||
}
|
||||
me.settings.callback(res);
|
||||
layer.close(me.layerindex);
|
||||
})
|
||||
},
|
||||
uploadMore:function(){
|
||||
let me = this,file_lists=[];
|
||||
console.log(file_lists);
|
||||
let uploadList = upload.render({
|
||||
elem: '#gouguUploadBtn'+me.settings.index
|
||||
,elemList: $('#gouguUploadBox'+me.settings.index) //列表元素对象
|
||||
,url: me.settings.url
|
||||
,accept: 'images'
|
||||
,acceptMime:'image/*'
|
||||
,multiple: true
|
||||
,number: me.settings.max
|
||||
,auto: false
|
||||
,bindAction: '#uploadNow'+me.settings.index
|
||||
,choose: function(obj){
|
||||
let that = this;
|
||||
let files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
||||
that.elemList.removeClass('select').addClass('selected');
|
||||
//读取本地文件
|
||||
obj.preview(function(index, file, result){
|
||||
let card = $('<div class="gougu-upload-card" id="gouguUploadCard'+index+'">\
|
||||
<div class="gougu-upload-card-box">\
|
||||
<img alt="'+ file.name +'" class="gougu-upload-card-img" src="'+ result +'">\
|
||||
<div class="gougu-upload-card-bar"><div class="layui-progress" lay-filter="progress-card-'+ index +'"><div class="layui-progress-bar" lay-percent=""></div></div></div>\
|
||||
<div class="gougu-upload-card-text">'+ file.name +'</div>\
|
||||
<div class="gougu-upload-card-reload"><button type="button" class="layui-btn layui-btn-xs">重新上传</button></div>\
|
||||
<div class="gougu-upload-card-del" data-index="'+index+'"><button type="button" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-danger"><i class="layui-icon layui-icon-close"></i></button></div>\
|
||||
</div>\
|
||||
</div>');
|
||||
//单个重传
|
||||
card.find('.gougu-upload-card-reload').on('click', function(){
|
||||
obj.upload(index, file);
|
||||
});
|
||||
|
||||
//删除
|
||||
card.find('.gougu-upload-card-del').on('click', function(){
|
||||
delete files[index]; //删除对应的文件
|
||||
card.remove();
|
||||
uploadList.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
|
||||
});
|
||||
|
||||
that.elemList.append(card);
|
||||
element.render('progress'); //渲染新加的进度条组件
|
||||
});
|
||||
}
|
||||
,done: function(res, index, upload){ //成功的回调
|
||||
let that = this;
|
||||
if(res.code==0){
|
||||
delete this.files[index]; //删除文件队列已经上传成功的文件
|
||||
that.elemList.find('#gouguUploadCard'+ index).addClass('uploadok');
|
||||
file_lists.push(res.data);
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
this.error(index, upload);
|
||||
}
|
||||
}
|
||||
,allDone: function(obj){ //多文件上传完毕后的状态回调
|
||||
//console.log(obj);
|
||||
layer.msg('上传成功');
|
||||
me.settings.callback(file_lists,obj);
|
||||
layer.close(me.layerindex);
|
||||
}
|
||||
,error: function(index, upload){ //错误回调
|
||||
let that = this;
|
||||
let tr = that.elemList.find('#gouguUploadCard'+ index).addClass('reload'); //显示重传
|
||||
}
|
||||
,progress: function(n, elem, e, index){
|
||||
element.progress('progress-card-'+ index, n + '%'); //执行进度条。n 即为返回的进度百分比
|
||||
}
|
||||
});
|
||||
|
||||
$('#uploadClear'+me.settings.index).click(function(){
|
||||
$('#gouguUploadBox'+me.settings.index).find('.gougu-upload-card-del').click();
|
||||
})
|
||||
$('#uploadOk'+me.settings.index).click(function(){
|
||||
if(me.settings.files.length>0){
|
||||
me.settings.callback(me.settings.files);
|
||||
layer.close(me.layerindex);
|
||||
}
|
||||
else{
|
||||
layer.msg('请先点击开始上传按钮上传');
|
||||
}
|
||||
})
|
||||
},
|
||||
//批量导入
|
||||
excelImport:function(){
|
||||
let me = this;
|
||||
$(parent.$('.express-close')).addClass('parent-colse');
|
||||
layer.open({
|
||||
'title':me.settings.title,
|
||||
'type':1,
|
||||
'area': ['640px', '320px'],
|
||||
'content':'<div class="layui-form layui-import">\
|
||||
<div class="mt-4">\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label">选择文件:</label>\
|
||||
<div class="layui-input-block">\
|
||||
<div class="layui-input-inline" style="width:286px;"><input type="text" id="inputImport'+me.settings.index+'" placeholder=".xls,.xlsx" class="layui-input" readonly></div><button type="button" class="layui-btn layui-btn-normal" id="importSelect'+me.settings.index+'">选择文件</button><a href="'+me.settings.import.template+'" target="_blank" class="layui-btn ml-2">Excel模板下载</a>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item py-2">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block gougu-import-tips">\
|
||||
1、只能上传 .xls、.xlsx文件,文件大小 3MB 以内,每次导入不能超过3000条;<br>2、Excel表格数据请勿放在合并的单元格中,格式务必按照模版样本填写;<br>3、'+me.settings.import.tips+'\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="layui-form-item">\
|
||||
<label class="layui-form-label"></label>\
|
||||
<div class="layui-input-block">\
|
||||
<button type="button" class="layui-btn layui-bg-red" id="btnImport'+me.settings.index+'">上传并导入</button>\
|
||||
<span class="red ml-3" id="noteImport'+me.settings.index+'"></span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>',
|
||||
end: function(){
|
||||
$(parent.$('.express-close')).removeClass('parent-colse');
|
||||
},
|
||||
success: function(layero, idx){
|
||||
form.render();
|
||||
let noteImport = $('#noteImport'+me.settings.index);
|
||||
//选文件
|
||||
let uploadImport = upload.render({
|
||||
elem: '#importSelect'+me.settings.index
|
||||
,url: me.settings.url
|
||||
,auto: false
|
||||
,accept: 'file' //普通文件
|
||||
,acceptMime: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' // 此处设置上传的文件格式
|
||||
,exts: 'xls|xlsx' //只允许上传文件格式
|
||||
,bindAction: '#btnImport'+me.settings.index
|
||||
,choose: function(obj){
|
||||
obj.preview(function(index, file, result){
|
||||
$('#importSelect'+me.settings.index).html('重新选择');
|
||||
$('#inputImport'+me.settings.index).val(file.name);
|
||||
});
|
||||
}
|
||||
,before: function(obj){
|
||||
if($('#inputImport'+me.settings.index).val()==''){
|
||||
layer.msg('请选择文件');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
,progress: function(n, elem, e){
|
||||
noteImport.html('文件上转中...');
|
||||
if(n==100){
|
||||
noteImport.html('数据导入中...');
|
||||
}
|
||||
}
|
||||
,error: function(index, upload){
|
||||
uploadImport.reload();
|
||||
$('#importSelect'+me.settings.index).html('选择文件');
|
||||
$('#inputImport'+me.settings.index).val('');
|
||||
noteImport.html('数据导入失败,请重新选择文件或关闭弹层重试');
|
||||
}
|
||||
,done: function(res, index, upload){
|
||||
uploadImport.reload();
|
||||
noteImport.html(res.msg);
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
layer.close(idx);
|
||||
me.settings.callback(res);
|
||||
}
|
||||
else{
|
||||
$('#importSelect'+me.settings.index).html('选择文件');
|
||||
$('#inputImport'+me.settings.index).val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//输出接口
|
||||
exports('uploadPlus', uploadPlus);
|
||||
});
|
||||
@@ -0,0 +1,263 @@
|
||||
layui.define(['jquery','layer','table'], function(exports) {
|
||||
var $ = layui.$,
|
||||
layer = layui.layer,
|
||||
table = layui.table;
|
||||
|
||||
var MOD_NAME = 'xlsx';
|
||||
var modFile = layui.cache.modules['xlsx'];
|
||||
var modPath = modFile.substr(0, modFile.lastIndexOf('.'));
|
||||
|
||||
var tableXlsx=$.extend({},table);
|
||||
|
||||
tableXlsx._render = tableXlsx.render;
|
||||
|
||||
tableXlsx.excel = function(data,page_size,obj,filter,merge){
|
||||
//表头工具栏导出按钮
|
||||
$('[lay-id="'+obj.id+'"]').find('[lay-event="LAYTABLE_EXCEL"]').off().on('click',function(){
|
||||
if(data.count==0){
|
||||
layer.msg('暂无数据');
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
let _page = parseInt(data.count/page_size);
|
||||
let page = data.count%page_size>0?(_page+1):_page;
|
||||
let pageHtml='<p style="padding:16px 10px 0; text-align:center; color:red">由于导出数据比较消耗服务器资源,建议使用搜索功能筛选好数据再导出</p><p style="padding:5px 10px 10px; text-align:center; color:red">如果点击导出后,没有立即导出文件,请耐心等待一下,30秒内请勿重复点击。</p><p style="padding:0 10px; text-align:center;">共查询到<strong> '+data.count+' </strong>条数据,每次最多导出<strong>'+page_size+'</strong>条,共<strong>'+page+'</strong>页,请点击下面的页码导出</p><div id="exportPage" class="layui-box layui-laypage" style="padding:10px 0; width:100%;text-align:center;">';
|
||||
for (i = 1; i <= page; i++) {
|
||||
pageHtml += '<a href="javascript:;" data-page="'+i+'">'+i+'</a>';
|
||||
}
|
||||
pageHtml+='</div>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '导出数据',
|
||||
area:['580px','240px'],
|
||||
content: pageHtml,
|
||||
success:function(res){
|
||||
var tableWhere = JSON.parse(JSON.stringify(obj.where));
|
||||
tableWhere.limit=page_size;
|
||||
$('#exportPage').on('click','a',function(){
|
||||
tableWhere.page=$(this).data('page');
|
||||
let msg = layer.msg('正在导出数据...', {time:5000});
|
||||
$.ajax({
|
||||
url: obj.url,
|
||||
data: tableWhere,
|
||||
success:function(res){
|
||||
//table.exportFile(obj.id, res.data,'xls');
|
||||
//console.log(res.data);
|
||||
tableXlsx.xsls(res.data,obj.cols[0],obj.title,filter,merge);
|
||||
layer.close(msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tableXlsx.xsls = function(jsonData,field,name,filter,merge){
|
||||
let new_jsonData;
|
||||
//数据过滤
|
||||
if(filter.length>0){
|
||||
new_jsonData = jsonData.map((item, index) => {
|
||||
const newProps = {}; // 创建一个空对象,用于存放新增的属性和对应的计算值
|
||||
filter.forEach((obj) => {
|
||||
for (const [key, func] of Object.entries(obj)) {
|
||||
newProps[key] = func(item); // 调用函数计算属性值,并赋给新的属性
|
||||
}
|
||||
});
|
||||
return { ...item, ...newProps }; // 创建新对象,将原有的属性展开并新增 newProps 中的属性
|
||||
});
|
||||
}
|
||||
else{
|
||||
new_jsonData = jsonData;
|
||||
}
|
||||
console.log("===========打印初始化后的json数据============");
|
||||
console.log(new_jsonData);
|
||||
|
||||
//需要显示的表格字段,及表头文字描述
|
||||
let field_array =[],customHeaders = [];
|
||||
for (var f=0; f<field.length;f++){
|
||||
if(!field[f]['ignoreExport']){
|
||||
field_array.push(field[f].field);
|
||||
customHeaders.push(field[f].title);
|
||||
}
|
||||
}
|
||||
console.log("===========打印需要显示的表格字段及表头文字描述============");
|
||||
console.log(field_array);
|
||||
console.log(customHeaders);
|
||||
|
||||
const desiredOrder = field_array; // 按照这个顺序重新排序
|
||||
const desiredProps = field_array; // 只保留这些属性
|
||||
|
||||
// 对 JSON 数据集进行排序和过滤
|
||||
const sortedAndFilteredData = new_jsonData.map(entry => {
|
||||
const sortedAndFilteredEntry = {};
|
||||
desiredOrder.forEach(key => {
|
||||
if (desiredProps.includes(key) && entry.hasOwnProperty(key)) {
|
||||
sortedAndFilteredEntry[key] = entry[key];
|
||||
}
|
||||
});
|
||||
return sortedAndFilteredEntry;
|
||||
});
|
||||
console.log("===========打印排序和过滤处理过的JSON 数据集============");
|
||||
console.log(sortedAndFilteredData);
|
||||
|
||||
//设置表头
|
||||
const worksheet = XLSX.utils.json_to_sheet(sortedAndFilteredData);
|
||||
const headerRowIndex = 0;
|
||||
customHeaders.forEach((header, columnIndex) => {
|
||||
const address = XLSX.utils.encode_cell({ r: headerRowIndex, c: columnIndex });
|
||||
if (worksheet[address]) {
|
||||
worksheet[address].v = header;
|
||||
}
|
||||
});
|
||||
|
||||
//设置需要合并的单元格
|
||||
var mergeCells = [];
|
||||
if(!isObjectEmpty(merge)){
|
||||
for (var i = 1; i < sortedAndFilteredData.length; i++) {
|
||||
if (sortedAndFilteredData[i][merge.target] === sortedAndFilteredData[i - 1][merge.target]) {
|
||||
// 数据相同,合并单元格
|
||||
let sons = getSonIndex(sortedAndFilteredData,merge);
|
||||
//console.log(sons);
|
||||
for(var m=0; m<sons.length;m++){
|
||||
mergeCells.push({
|
||||
s:{r: i, c: sons[m]},e:{r: i+1, c: sons[m]}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log("===========打印需要合并的单元格集合============");
|
||||
console.log(mergeCells);
|
||||
if (mergeCells.length > 0) {
|
||||
worksheet['!merges'] = mergeCells;
|
||||
}
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
setTimeout(function(){
|
||||
layer.msg('导出完成');
|
||||
},3000)
|
||||
// Export to Excel file
|
||||
XLSX.writeFile(workbook, name+'.xlsx');
|
||||
}
|
||||
|
||||
//重写渲染方法
|
||||
tableXlsx.render=function(params){
|
||||
let is_excel = params.is_excel||false;
|
||||
let excel_limit = params.excel_limit||1000;
|
||||
let filter = params.xlsx_filter||[];
|
||||
let merge = params.xlsx_merge||{};
|
||||
if(is_excel){
|
||||
let toolbar = ['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}];
|
||||
if(!params.defaultToolbar){
|
||||
params.defaultToolbar = toolbar;
|
||||
}
|
||||
else{
|
||||
let _toolbar = params.defaultToolbar;
|
||||
params.defaultToolbar = _toolbar.concat(toolbar);
|
||||
}
|
||||
if(typeof params.done === "function"){
|
||||
let _done = params.done;
|
||||
params.done = function(data, curr, count){
|
||||
let obj = this;
|
||||
_done(data, curr, count);
|
||||
if(!isObjectEmpty(merge)){
|
||||
tableMerge (obj);
|
||||
}
|
||||
tableXlsx.excel(data,excel_limit,obj,filter,merge);
|
||||
}
|
||||
}
|
||||
else{
|
||||
params.done = function(data){
|
||||
let obj = this;
|
||||
if(!isObjectEmpty(merge)){
|
||||
tableMerge (obj);
|
||||
}
|
||||
tableXlsx.excel(data,excel_limit,obj,filter,merge);
|
||||
}
|
||||
}
|
||||
}
|
||||
var init = tableXlsx._render(params);
|
||||
return init;
|
||||
//console.log(params);
|
||||
};
|
||||
|
||||
function tableMerge (myTable) {
|
||||
var tableBox = $(myTable.elem).next().children('.layui-table-box'),
|
||||
$main = $(tableBox.children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
|
||||
$fixLeft = $(tableBox.children('.layui-table-fixed-l').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
|
||||
$fixRight = $(tableBox.children('.layui-table-fixed-r').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
|
||||
mergeRecord = {},cols = myTable.cols[0];
|
||||
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
var item3 = cols[i], field=item3.field;
|
||||
if (item3.merge) {
|
||||
var mergeField = [field];
|
||||
if (item3.merge !== true) {
|
||||
if (typeof item3.merge == 'string') {
|
||||
mergeField = [item3.merge]
|
||||
} else {
|
||||
mergeField = item3.merge
|
||||
}
|
||||
}
|
||||
mergeRecord[i] = {mergeField: mergeField, rowspan:1}
|
||||
}
|
||||
}
|
||||
//console.log(myTable);
|
||||
$main.each(function (i) {
|
||||
for (var item in mergeRecord) {
|
||||
if (i==$main.length-1 || isMaster(i, item)) {
|
||||
$(this).children('[data-key$="-'+item+'"]').attr('rowspan', mergeRecord[item].rowspan).css('position','static');
|
||||
$fixLeft.eq(i).children('[data-key$="-'+item+'"]').attr('rowspan', mergeRecord[item].rowspan).css('position','static');
|
||||
$fixRight.eq(i).children('[data-key$="-'+item+'"]').attr('rowspan', mergeRecord[item].rowspan).css('position','static');
|
||||
mergeRecord[item].rowspan = 1;
|
||||
} else {
|
||||
$(this).children('[data-key$="-'+item+'"]').remove();
|
||||
$fixLeft.eq(i).children('[data-key$="-'+item+'"]').remove();
|
||||
$fixRight.eq(i).children('[data-key$="-'+item+'"]').remove();
|
||||
mergeRecord[item].rowspan +=1;
|
||||
}
|
||||
}
|
||||
})
|
||||
function isMaster (index, item) {
|
||||
var mergeField = mergeRecord[item].mergeField;
|
||||
var dataLength = layui.table.cache[myTable.id].length;
|
||||
for (var i=0; i<mergeField.length; i++) {
|
||||
|
||||
if (layui.table.cache[myTable.id][dataLength-2-index][mergeField[i]]
|
||||
!== layui.table.cache[myTable.id][dataLength-1-index][mergeField[i]]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getSonIndex(targetData,mergeField){
|
||||
let index=[];
|
||||
index.push(Object.keys(targetData[0]).indexOf(mergeField.target));
|
||||
if(mergeField.son.length>0){
|
||||
for(var a=0; a<mergeField.son.length;a++){
|
||||
index.push(Object.keys(targetData[0]).indexOf(mergeField.son[a]));
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
function isObjectEmpty(obj) {
|
||||
return JSON.stringify(obj) === '{}';
|
||||
}
|
||||
function loadScript() {
|
||||
if (typeof XLSX == 'undefined') {
|
||||
$.ajax({ //获取插件
|
||||
url: modPath + '/xlsx.full.min.js' ,
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
async: false
|
||||
});
|
||||
}
|
||||
}
|
||||
loadScript();
|
||||
exports(MOD_NAME, tableXlsx);
|
||||
});
|
||||
Reference in New Issue
Block a user