mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
升级至layui2.8.4;优化文件选择组件;清理tableselect
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
};
|
||||
</script>
|
||||
<script src="__STATIC__/common/js/app.js"></script>
|
||||
<script src="__STATIC__/plugs/layui-v2.8.1/layui.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/plugs/layui-v2.8.4/layui.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/plugs/require-2.3.6/require.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/config-admin.js?v={$version}" charset="utf-8"></script>
|
||||
</head>
|
||||
|
||||
@@ -16,12 +16,13 @@ class Version extends Command
|
||||
{
|
||||
public const VERSION = 'v2.0.27';
|
||||
|
||||
public const LAYUI_VERSION = '2.8.1';
|
||||
public const LAYUI_VERSION = '2.8.4';
|
||||
|
||||
public const COMMENT = [
|
||||
'升级layui2.8.1',
|
||||
'新增tableSelect组件支持where条件',
|
||||
'升级layui2.8.4',
|
||||
'优化特效皮肤的兼容性',
|
||||
'优化文件选择组件',
|
||||
'清理tableselect组件和技术债务',
|
||||
];
|
||||
|
||||
protected function configure()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import url("../../plugs/layui-v2.8.1/css/layui.css");
|
||||
@import url("../../plugs/layui-v2.8.4/css/layui.css");
|
||||
@import url("../../plugs/font-awesome-4.7.0/css/font-awesome.min.css");
|
||||
@import url("../css/iconfont.css");
|
||||
@import url('../../plugs/jq-module/city-picker/css/city-picker.css');
|
||||
|
||||
@@ -30,7 +30,17 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
{ field: 'mime_type', minWidth: 80, title: 'mime类型' },
|
||||
{ field: 'file_ext', minWidth: 80, title: '文件后缀' },
|
||||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||||
{ width: 250, title: '操作', templet: ea.table.tool, operat: ['delete'], fixed: 'right' }
|
||||
{
|
||||
width: 250, title: '操作', templet: ea.table.tool, operat: ['delete'], fixed: 'right', hide: function () {
|
||||
var selectMode = ea.getQueryVariable("select_mode");
|
||||
|
||||
console.log(selectMode);
|
||||
if (selectMode == 'radio' || selectMode == 'checkbox') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
]],
|
||||
});
|
||||
|
||||
|
||||
@@ -282,11 +282,17 @@ $box-shape: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%,
|
||||
|
||||
.layuimini-container .layui-form-switch {
|
||||
border-color: $less-main-color !important;
|
||||
|
||||
background-color: $black-color !important;
|
||||
|
||||
}
|
||||
|
||||
.layuimini-container .layui-form-onswitch {
|
||||
background-color: $main-color !important;
|
||||
}
|
||||
|
||||
.layuimini-container .layui-form-switch.layui-form-onswitch i {
|
||||
background-color: $black-color !important;
|
||||
}
|
||||
.layuimini-container .layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||
background-color: $main-color !important;
|
||||
}
|
||||
@@ -643,10 +649,7 @@ $box-shape: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%,
|
||||
color: $main-color !important;
|
||||
}
|
||||
|
||||
.tableSelect {
|
||||
background-color: $black-color !important;
|
||||
border-color: $less-main-color !important;
|
||||
}
|
||||
|
||||
|
||||
.layui-table td,
|
||||
.layui-table th,
|
||||
|
||||
@@ -270,6 +270,12 @@
|
||||
border-color: rgb(6, 216, 215) !important;
|
||||
background-color: rgb(2, 17, 20) !important;
|
||||
}
|
||||
.elem-style-sicfi .layuimini-container .layui-form-onswitch {
|
||||
background-color: rgb(126, 252, 246) !important;
|
||||
}
|
||||
.elem-style-sicfi .layuimini-container .layui-form-switch.layui-form-onswitch i {
|
||||
background-color: rgb(2, 17, 20) !important;
|
||||
}
|
||||
.elem-style-sicfi .layuimini-container .layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||
background-color: rgb(126, 252, 246) !important;
|
||||
}
|
||||
@@ -539,10 +545,6 @@
|
||||
background-color: rgb(0, 125, 124) !important;
|
||||
color: rgb(126, 252, 246) !important;
|
||||
}
|
||||
.elem-style-sicfi .tableSelect {
|
||||
background-color: rgb(2, 17, 20) !important;
|
||||
border-color: rgb(6, 216, 215) !important;
|
||||
}
|
||||
.elem-style-sicfi .layui-table td,
|
||||
.elem-style-sicfi .layui-table th,
|
||||
.elem-style-sicfi .layui-table-col-set,
|
||||
|
||||
@@ -9,14 +9,14 @@ require.config({
|
||||
"echarts": ["plugs/echarts/echarts.min"],
|
||||
"echarts-theme": ["plugs/echarts/echarts-theme"],
|
||||
"easy-admin": ["plugs/easy-admin/easy-admin"],
|
||||
"layui": ["plugs/layui-v2.8.1/layui"],
|
||||
"layui": ["plugs/layui-v2.8.4/layui"],
|
||||
"miniAdmin": ["plugs/lay-module/layuimini/miniAdmin"],
|
||||
"miniMenu": ["plugs/lay-module/layuimini/miniMenu"],
|
||||
"miniTab": ["plugs/lay-module/layuimini/miniTab"],
|
||||
"miniTheme": ["plugs/lay-module/layuimini/miniTheme"],
|
||||
"miniTongji": ["plugs/lay-module/layuimini/miniTongji"],
|
||||
"treetable": ["plugs/lay-module/treetable-lay/treetable"],
|
||||
"tableSelect": ["plugs/lay-module/tableSelect/tableSelect"],
|
||||
|
||||
"tableData": ["plugs/lay-module/tableData/tableData"],
|
||||
"tagInput": ["plugs/lay-module/tagInput/tagInput"],
|
||||
"propertyInput": ["plugs/lay-module/propertyInput/propertyInput"],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput', 'propertyInput', 'miniTab', 'clipboardjs'], function ($, tableSelect, undefined, miniTheme, tableData, citypicker, tagInput, propertyInput, miniTab, ClipboardJS) {
|
||||
define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput', 'propertyInput', 'miniTab', 'clipboardjs'], function ($, undefined, miniTheme, tableData, citypicker, tagInput, propertyInput, miniTab, ClipboardJS) {
|
||||
|
||||
window.onInitElemStyle = function () {
|
||||
miniTheme.renderElemStyle()
|
||||
@@ -24,7 +24,6 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
upload = layui.upload,
|
||||
element = layui.element,
|
||||
laytpl = layui.laytpl,
|
||||
tableSelect = layui.tableSelect,
|
||||
util = layui.util;
|
||||
|
||||
layer.config({
|
||||
@@ -476,7 +475,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-sm layui-btn-success easyadmin-export-btn" data-url="' + init.export_url + '" data-table-export="' + tableId + '"><i class="fa fa-file-excel-o"></i> 导出</button>\n';
|
||||
}
|
||||
} else if (v === 'selectConfirm') {
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-sm layui-btn-success easyadmin-export-btn select-confirm" data-table-target="' + tableId + '"> 确定选择</button>\n';
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-sm layui-btn-success select-confirm" data-table-target="' + tableId + '"> 确定选择</button>\n';
|
||||
} else if (typeof v === "object") {
|
||||
$.each(v, function (ii, vv) {
|
||||
vv.class = vv.class || '';
|
||||
@@ -822,6 +821,9 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
for (index in col) {
|
||||
var val = col[index];
|
||||
|
||||
if (typeof val.hide == 'function') {
|
||||
cols[i][index]['hide'] = val.hide(val, cols, init);
|
||||
}
|
||||
if (val['width'] == undefined && val['minWidth'] == undefined) {
|
||||
var width = null;
|
||||
if (val.title) {
|
||||
@@ -1153,11 +1155,11 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
|
||||
option.filter = option.filter || option.field || null;
|
||||
option.checked = option.checked || 1;
|
||||
option.tips = option.tips || '开|关';
|
||||
|
||||
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var checked = value === option.checked ? 'checked' : '';
|
||||
return laytpl('<input type="checkbox" name="' + option.field + '" value="' + data.id + '" lay-skin="switch" lay-text="' + option.tips + '" lay-filter="' + option.filter + '" ' + checked + ' >').render(data);
|
||||
return laytpl('<input type="checkbox" name="' + option.field + '" value="' + data.id + '" lay-skin="switch" lay-filter="' + option.filter + '" ' + checked + ' >').render(data);
|
||||
},
|
||||
price: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
@@ -2114,7 +2116,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
|
||||
if (extGroup.image.indexOf(ext) != -1) {
|
||||
// 是图片
|
||||
liHtml += '<li><a title="点击预览"><img src="' + v + '" data-images onerror="this.src=\'' + BASE_URL + 'admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="'+uploadFilenameField+'" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
liHtml += '<li><a title="点击预览"><img src="' + v + '" data-images onerror="this.src=\'' + BASE_URL + 'admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="' + uploadFilenameField + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
|
||||
} else {
|
||||
// 不是图片
|
||||
@@ -2122,7 +2124,7 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
|
||||
uploadIcon = admin.getExtGroupName(ext);
|
||||
|
||||
liHtml += '<li><a title="点击打开文件" target="_blank" href="' + v + '" ><img src="/static/admin/images/upload-icons/' + uploadIcon + '.png"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="'+uploadFilenameField+'" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
liHtml += '<li><a title="点击打开文件" target="_blank" href="' + v + '" ><img src="/static/admin/images/upload-icons/' + uploadIcon + '.png"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="' + uploadFilenameField + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
|
||||
}
|
||||
|
||||
@@ -2177,54 +2179,75 @@ define(["jquery", "tableSelect", "ckeditor", 'miniTheme', 'tableData', 'citypick
|
||||
$.each(uploadSelectList, function (i, v) {
|
||||
var uploadName = $(this).attr('data-upload-select'),
|
||||
uploadNumber = $(this).attr('data-upload-number') || 'one',
|
||||
uploadSign = $(this).attr('data-upload-sign') || '|';
|
||||
uploadFilenameField = $(this).attr('data-upload-filename-field') || '';
|
||||
uploadSign = $(this).attr('data-upload-sign') || '|',
|
||||
uploadFilenameField = $(this).attr('data-upload-filename-field') || '';
|
||||
|
||||
if (uploadFilenameField) {
|
||||
var elemFilenameField = "input[name='" + uploadFilenameField + "']";
|
||||
var elemFilename = $(elemFilenameField)
|
||||
}
|
||||
|
||||
var selectCheck = uploadNumber === 'one' ? 'radio' : 'checkbox';
|
||||
var elem = "input[name='" + uploadName + "']",
|
||||
uploadElem = $(this).attr('id');
|
||||
var elem = "input[name='" + uploadName + "']";
|
||||
var width = document.body.clientWidth,
|
||||
height = document.body.clientHeight;
|
||||
|
||||
tableSelect.render({
|
||||
elem: "#" + uploadElem,
|
||||
checkedKey: 'id',
|
||||
searchType: 'more',
|
||||
searchList: [
|
||||
{ searchKey: 'title', searchPlaceholder: '请输入文件名' },
|
||||
],
|
||||
table: {
|
||||
url: admin.url('ajax/getUploadFiles'),
|
||||
cols: [[
|
||||
{ type: selectCheck },
|
||||
{ field: 'id', title: 'ID' },
|
||||
{ field: 'url', minWidth: 80, search: false, title: '图片信息', imageHeight: 40, align: "center", templet: admin.table.filePreview },
|
||||
{ field: 'original_name', width: 150, title: '文件原名', align: "center" },
|
||||
{ field: 'mime_type', width: 120, title: 'mime类型', align: "center" },
|
||||
{ field: 'create_time', width: 200, title: '创建时间', align: "center", search: 'range' },
|
||||
]]
|
||||
},
|
||||
done: function (e, data) {
|
||||
var urlArray = [];
|
||||
var filenameArray = [];
|
||||
$.each(data.data, function (index, val) {
|
||||
urlArray.push(val.url)
|
||||
filenameArray.push(val.original_name)
|
||||
});
|
||||
var url = urlArray.join(uploadSign);
|
||||
var filename = filenameArray.join(uploadSign);
|
||||
admin.msg.success('选择成功', function () {
|
||||
$(elem).val(url);
|
||||
if (uploadFilenameField) {
|
||||
$(elemFilenameField).val(filename);
|
||||
if (width >= 800 && height >= 600) {
|
||||
clienWidth = '800px';
|
||||
clientHeight = '600px';
|
||||
} else {
|
||||
clienWidth = '100%';
|
||||
clientHeight = '100%';
|
||||
}
|
||||
|
||||
$(v).click(function () {
|
||||
|
||||
layer.open({
|
||||
title: '选择文件',
|
||||
type: 2,
|
||||
area: [clienWidth, clientHeight],
|
||||
content: admin.url('system.uploadfile/index') + '?select_mode=' + selectCheck,
|
||||
success(layero, index) {
|
||||
window.onTableDataConfirm = function (data) {
|
||||
var currentUrl = $(elem).val();
|
||||
var urlArray = currentUrl.split(uploadSign);
|
||||
if (currentUrl.length == 0 || selectCheck == 'radio') {
|
||||
urlArray = [];
|
||||
}
|
||||
if (uploadFilenameField) {
|
||||
var currentFilename = $(elemFilename).val();
|
||||
var filenameArray = currentFilename.split(uploadSign);
|
||||
if (currentFilename.length == 0 || selectCheck == 'radio') {
|
||||
filenameArray = []
|
||||
}
|
||||
}
|
||||
$.each(data, function (index, val) {
|
||||
if (urlArray.indexOf(val.url) == -1) {
|
||||
urlArray.push(val.url)
|
||||
}
|
||||
if (uploadFilenameField) {
|
||||
if (filenameArray.indexOf(val.original_name) == -1) {
|
||||
filenameArray.push(val.original_name)
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
var url = urlArray.join(uploadSign);
|
||||
|
||||
if (uploadFilenameField) {
|
||||
var filename = filenameArray.join(uploadSign);
|
||||
}
|
||||
$(elem).val(url);
|
||||
if (uploadFilenameField) {
|
||||
$(elemFilenameField).val(filename);
|
||||
}
|
||||
$(elem).trigger("input");
|
||||
layer.close(index);
|
||||
admin.msg.success('选择成功');
|
||||
}
|
||||
$(elem).trigger("input");
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
layui.define(['table', 'jquery', 'form'], function (exports) {
|
||||
"use strict";
|
||||
|
||||
var MOD_NAME = 'tableSelect',
|
||||
$ = layui.jquery,
|
||||
table = layui.table,
|
||||
form = layui.form;
|
||||
var tableSelect = function () {
|
||||
this.v = '1.1.0';
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化表格选择器
|
||||
*/
|
||||
tableSelect.prototype.render = function (opt) {
|
||||
var elem = $(opt.elem);
|
||||
var tableDone = opt.table.done || function () { };
|
||||
|
||||
//默认设置
|
||||
opt.searchKey = opt.searchKey || 'keyword';
|
||||
opt.searchPlaceholder = opt.searchPlaceholder || '关键词搜索';
|
||||
opt.checkedKey = opt.checkedKey || '';
|
||||
opt.table.page = opt.table.page || true;
|
||||
opt.table.height = opt.height || 315;
|
||||
|
||||
//最小宽度
|
||||
opt.width = opt.width || '530';
|
||||
|
||||
//多搜索条件
|
||||
opt.searchType = opt.searchType || 'one';
|
||||
opt.searchList = opt.searchList || [{ key: opt.searchKey, placeholder: opt.searchPlaceholder }];
|
||||
|
||||
elem.off('click').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
if ($('div.tableSelect').length >= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var t = elem.offset().top + elem.outerHeight() + "px";
|
||||
var l = elem.offset().left + "px";
|
||||
var tableName = "tableSelect_table_" + new Date().getTime();
|
||||
var tableBox = '<div class="tableSelect layui-anim layui-anim-upbit" style="left:' + l + ';top:' + t + ';border: 1px solid #d2d2d2;background-color: #fff;box-shadow: 0 2px 4px rgba(0,0,0,.12);padding:10px 10px 0 10px;position: fixed;z-index:666;margin: 5px 0;border-radius: 2px;min-width:' + opt.width + 'px;">';
|
||||
tableBox += '<div class="tableSelectBar">';
|
||||
tableBox += '<form class="layui-form" action="" style="display:inline-block;">';
|
||||
|
||||
//判断是否多搜索条件
|
||||
if (opt.searchType == 'more') {
|
||||
$.each(opt.searchList, function (index, item) {
|
||||
tableBox += '<input style="display:inline-block;width:190px;height:30px;vertical-align:middle;margin-right:-1px;border: 1px solid #C9C9C9;" type="text" name="' + item.searchKey + '" placeholder="' + item.searchPlaceholder + '" autocomplete="off" class="layui-input">';
|
||||
});
|
||||
} else {
|
||||
tableBox += '<input style="display:inline-block;width:190px;height:30px;vertical-align:middle;margin-right:-1px;border: 1px solid #C9C9C9;" type="text" name="' + opt.searchKey + '" placeholder="' + opt.searchPlaceholder + '" autocomplete="off" class="layui-input">';
|
||||
}
|
||||
|
||||
tableBox += '<button class="layui-btn layui-btn-sm layui-btn-primary tableSelect_btn_search" lay-submit lay-filter="tableSelect_btn_search"><i class="layui-icon layui-icon-search"></i></button>';
|
||||
tableBox += '</form>';
|
||||
tableBox += '<button style="float:right;" class="layui-btn layui-btn-sm tableSelect_btn_select">选择<span></span></button>';
|
||||
tableBox += '</div>';
|
||||
tableBox += '<table id="' + tableName + '" lay-filter="' + tableName + '"></table>';
|
||||
tableBox += '</div>';
|
||||
tableBox = $(tableBox);
|
||||
$('body').append(tableBox);
|
||||
|
||||
//数据缓存
|
||||
var checkedData = [];
|
||||
|
||||
//渲染TABLE
|
||||
opt.table.elem = "#" + tableName;
|
||||
opt.table.id = tableName;
|
||||
opt.table.done = function (res, curr, count) {
|
||||
defaultChecked(res, curr, count);
|
||||
setChecked(res, curr, count);
|
||||
tableDone(res, curr, count);
|
||||
};
|
||||
var tableSelect_table = table.render(opt.table);
|
||||
|
||||
//分页选中保存数组
|
||||
table.on('radio(' + tableName + ')', function (obj) {
|
||||
if (opt.checkedKey) {
|
||||
checkedData = table.checkStatus(tableName).data
|
||||
}
|
||||
updataButton(table.checkStatus(tableName).data.length)
|
||||
})
|
||||
table.on('checkbox(' + tableName + ')', function (obj) {
|
||||
if (opt.checkedKey) {
|
||||
if (obj.checked) {
|
||||
for (var i = 0; i < table.checkStatus(tableName).data.length; i++) {
|
||||
checkedData.push(table.checkStatus(tableName).data[i])
|
||||
}
|
||||
} else {
|
||||
if (obj.type == 'all') {
|
||||
for (var j = 0; j < table.cache[tableName].length; j++) {
|
||||
for (var i = 0; i < checkedData.length; i++) {
|
||||
if (checkedData[i][opt.checkedKey] == table.cache[tableName][j][opt.checkedKey]) {
|
||||
checkedData.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//因为LAYUI问题,操作到变化全选状态时获取到的obj为空,这里用函数获取未选中的项。
|
||||
var nu = function () {
|
||||
var noCheckedKey = '';
|
||||
for (var i = 0; i < table.cache[tableName].length; i++) {
|
||||
if (!table.cache[tableName][i].LAY_CHECKED) {
|
||||
noCheckedKey = table.cache[tableName][i][opt.checkedKey];
|
||||
}
|
||||
}
|
||||
return noCheckedKey
|
||||
};
|
||||
var noCheckedKey = obj.data[opt.checkedKey] || nu();
|
||||
for (var i = 0; i < checkedData.length; i++) {
|
||||
if (checkedData[i][opt.checkedKey] == noCheckedKey) {
|
||||
checkedData.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
checkedData = uniqueObjArray(checkedData, opt.checkedKey);
|
||||
updataButton(checkedData.length)
|
||||
} else {
|
||||
updataButton(table.checkStatus(tableName).data.length)
|
||||
}
|
||||
});
|
||||
|
||||
//渲染表格后选中
|
||||
function setChecked(res, curr, count) {
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
for (var j = 0; j < checkedData.length; j++) {
|
||||
if (res.data[i][opt.checkedKey] == checkedData[j][opt.checkedKey]) {
|
||||
res.data[i].LAY_CHECKED = true;
|
||||
var index = res.data[i]['LAY_INDEX'];
|
||||
var checkbox = $('#' + tableName + '').next().find('tr[data-index=' + index + '] input[type="checkbox"]');
|
||||
checkbox.prop('checked', true).next().addClass('layui-form-checked');
|
||||
var radio = $('#' + tableName + '').next().find('tr[data-index=' + index + '] input[type="radio"]');
|
||||
radio.prop('checked', true).next().addClass('layui-form-radioed').find("i").html('');
|
||||
}
|
||||
}
|
||||
}
|
||||
var checkStatus = table.checkStatus(tableName);
|
||||
if (checkStatus.isAll) {
|
||||
$('#' + tableName + '').next().find('.layui-table-header th[data-field="0"] input[type="checkbox"]').prop('checked', true);
|
||||
$('#' + tableName + '').next().find('.layui-table-header th[data-field="0"] input[type="checkbox"]').next().addClass('layui-form-checked');
|
||||
}
|
||||
updataButton(checkedData.length)
|
||||
}
|
||||
|
||||
//写入默认选中值(puash checkedData)
|
||||
function defaultChecked(res, curr, count) {
|
||||
if (opt.checkedKey && elem.attr('ts-selected')) {
|
||||
var selected = elem.attr('ts-selected').split(",");
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
for (var j = 0; j < selected.length; j++) {
|
||||
if (res.data[i][opt.checkedKey] == selected[j]) {
|
||||
checkedData.push(res.data[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
checkedData = uniqueObjArray(checkedData, opt.checkedKey);
|
||||
}
|
||||
}
|
||||
|
||||
//更新选中数量
|
||||
function updataButton(n) {
|
||||
tableBox.find('.tableSelect_btn_select span').html(n == 0 ? '' : '(' + n + ')')
|
||||
}
|
||||
|
||||
//数组去重
|
||||
function uniqueObjArray(arr, type) {
|
||||
var newArr = [];
|
||||
var tArr = [];
|
||||
if (arr.length == 0) {
|
||||
return arr;
|
||||
} else {
|
||||
if (type) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (!tArr[arr[i][type]]) {
|
||||
newArr.push(arr[i]);
|
||||
tArr[arr[i][type]] = true;
|
||||
}
|
||||
}
|
||||
return newArr;
|
||||
} else {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (!tArr[arr[i]]) {
|
||||
newArr.push(arr[i]);
|
||||
tArr[arr[i]] = true;
|
||||
}
|
||||
}
|
||||
return newArr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FIX位置
|
||||
var overHeight = (elem.offset().top + elem.outerHeight() + tableBox.outerHeight() - $(window).scrollTop()) > $(window).height();
|
||||
var overWidth = (elem.offset().left + tableBox.outerWidth()) > $(window).width();
|
||||
overHeight && tableBox.css({ 'top': 'auto', 'bottom': '0px' });
|
||||
overWidth && tableBox.css({ 'left': 'auto', 'right': '5px' })
|
||||
|
||||
//关键词搜索
|
||||
form.on('submit(tableSelect_btn_search)', function (data) {
|
||||
// 判断 table 中是否存在 where 搜索条件
|
||||
if (opt.table.where) {
|
||||
$.each(opt.table.where, function (index, item) {
|
||||
data.field[index] = item
|
||||
});
|
||||
}
|
||||
tableSelect_table.reload({
|
||||
where: data.field,
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//双击行选中
|
||||
table.on('rowDouble(' + tableName + ')', function (obj) {
|
||||
var checkStatus = { data: [obj.data] };
|
||||
selectDone(checkStatus);
|
||||
})
|
||||
|
||||
//按钮选中
|
||||
tableBox.find('.tableSelect_btn_select').on('click', function () {
|
||||
var checkStatus = table.checkStatus(tableName);
|
||||
if (checkedData.length > 1) {
|
||||
checkStatus.data = checkedData;
|
||||
}
|
||||
selectDone(checkStatus);
|
||||
})
|
||||
|
||||
//写值回调和关闭
|
||||
function selectDone(checkStatus) {
|
||||
if (opt.checkedKey) {
|
||||
var selected = [];
|
||||
for (var i = 0; i < checkStatus.data.length; i++) {
|
||||
selected.push(checkStatus.data[i][opt.checkedKey])
|
||||
}
|
||||
elem.attr("ts-selected", selected.join(","));
|
||||
}
|
||||
opt.done(elem, checkStatus);
|
||||
tableBox.remove();
|
||||
delete table.cache[tableName];
|
||||
checkedData = [];
|
||||
}
|
||||
|
||||
//点击其他区域关闭
|
||||
$(document).mouseup(function (e) {
|
||||
var userSet_con = $('' + opt.elem + ',.tableSelect');
|
||||
if (!userSet_con.is(e.target) && userSet_con.has(e.target).length === 0) {
|
||||
|
||||
if (
|
||||
$(e.target).hasClass('layui-layer-shade')
|
||||
|| $(e.target).closest('.layui-layer').length != 0
|
||||
|| $(e.target).hasClass('layui-layer-move')
|
||||
) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
tableBox.remove();
|
||||
delete table.cache[tableName];
|
||||
checkedData = [];
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏选择器
|
||||
*/
|
||||
tableSelect.prototype.hide = function (opt) {
|
||||
$('.tableSelect').remove();
|
||||
}
|
||||
|
||||
//自动完成渲染
|
||||
var tableSelect = new tableSelect();
|
||||
|
||||
//FIX 滚动时错位
|
||||
if (window.top == window.self) {
|
||||
$(window).scroll(function () {
|
||||
tableSelect.hide();
|
||||
});
|
||||
}
|
||||
|
||||
exports(MOD_NAME, tableSelect);
|
||||
})
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
1
public/static/plugs/layui-v2.8.4/css/layui.css
Normal file
1
public/static/plugs/layui-v2.8.4/css/layui.css
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -14,6 +14,8 @@
|
||||
/>
|
||||
<missing-glyph />
|
||||
|
||||
<glyph glyph-name="edge" unicode="" d="M240.185509 821.062741C322.180562 871.479699 415.37494 897.48813 509.969233 895.934224 845.948962 895.934224 1023.938224 648.353161 1023.938224 456.964708c-0.199988-65.396055-25.998431-127.79229-71.795669-174.389479-45.797237-46.397201-107.993485-72.995596-173.389539-73.995536-150.390927 0-182.98896 46.197213-182.98896 63.996139 0 7.599542 2.399855 12.399252 9.599421 18.798866l1.99988 2.399855 0.799951 3.199807c20.998733 22.998612 31.798082 52.396839 31.798082 83.194981 0 157.390504-164.390082 285.382782-367.977799 285.382782-75.075471 0.599964-149.071006-17.798926-215.027027-53.796754 53.996742 115.03306 165.430019 195.188224 182.628981 207.627473 1.599903 1.099934 0.599964 1.679899 0.599964 1.679899z m31.198118-636.081624c-2.799831-59.99638 9.199445-119.992761 32.798021-174.389479 27.198359-52.796815 65.396055-101.993847 112.993183-138.591638-118.992821 22.998612-222.966548 87.794703-298.781974 178.589225C42.237452 143.383627 0 259.176641 0 380.169341c0 102.393822 124.792471 188.78861 271.983591 188.78861 73.195584 1.199928 144.791264-21.798685 203.587717-65.396054l-7.199566-2.399856c-102.993786-35.197876-196.988115-181.389056-196.988115-316.180924zM939.543315 95.986486l-1.399915-0.199987c-23.598576-37.597732-51.796875-70.195765-84.394908-98.994028-61.596284-55.996622-136.191783-90.99451-217.586873-99.793979-37.197756-0.599964-73.59556 6.399614-107.593509 22.798624-51.196911 20.598757-94.194317 59.99638-123.192567 105.993605-28.798263 47.797116-42.197454 103.393762-37.997708 159.190396-1.199928 40.197575 10.799348 80.595138 29.99819 116.392978 27.798323-66.196006 74.995475-122.592604 135.191844-161.590251 60.196368-38.997647 130.992097-58.996441 202.787766-57.196549 61.99626-0.599964 124.192507 13.399192 180.389116 40.997526l3.799771 1.799892c7.799529 4.599722 15.399071 7.799529 23.1986 0 8.999457-9.799409 3.599783-18.39889-2.399855-27.998311-0.399976-0.399976-0.599964-0.99994-0.799952-1.399916z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="leaf" unicode="" d="M1017.948269 886.876437c-4.863707 5.785251-12.031275 9.113051-19.557222 9.113051l-26.110427 0c-258.032454 0.102394-461.847374 0.153591-611.905533-35.735447-80.635142-19.301237-142.992985-48.432282-190.606116-89.031436-51.401703-43.82456-86.420393-101.216302-107.155144-175.554223-13.77197-49.353826-20.222782-138.487656 6.96278-227.160714 10.034595-32.766026 25.700852-63.688963 46.589193-92.103251-62.255449-97.530124-116.063407-225.983185-116.063407-378.805977 0-14.130349 11.468109-25.598458 25.598458-25.598458s25.598458 11.468109 25.598458 25.598458c0 235.761795 139.665185 410.650458 222.91137 493.845446 59.7468 59.7468 127.275532 110.175762 195.367429 145.808815 63.381781 33.175601 123.947732 51.4529 170.536925 51.4529 14.130349 0 25.598458 11.468109 25.598458 25.598458s-11.468109 25.598458-25.598458 25.598458c-55.497456 0-122.667809-19.813206-194.241097-57.340545-72.597226-38.039308-144.477695-91.591282-207.80828-154.973063-26.72479-26.72479-58.876453-62.357843-90.823328-105.977615-12.389654 19.506025-22.014674 40.189579-28.619076 61.794677-25.598458 83.553366-16.178225 164.034917-6.604402 198.388047 73.211589 262.384191 351.313233 263.049751 855.858835 262.896161-60.156376-321.926204-172.328817-530.29765-333.599101-619.533873-149.597387-82.785412-297.966048-37.629733-354.845821-14.335136-11.980078 4.914904-24.06255 10.95614-35.786644 17.91892-12.133669 7.218765-27.851122 3.225406-35.069887-8.908263s-3.225406-27.851122 8.908263-35.069887c13.925561-8.2939 28.260697-15.461468 42.595834-21.349114 31.844481-13.004017 83.143791-29.694211 146.679163-35.172281 14.027955-1.228726 27.902319-1.791892 41.674289-1.791892 75.208269 0 145.860012 18.072511 210.675307 53.910352 82.375837 45.565255 153.641943 119.749585 211.904033 220.351524 68.296685 118.00889 119.698388 274.51786 152.720399 465.175173 1.279923 7.423553-0.767954 15.051893-5.631661 20.837145z" horiz-adv-x="1025" />
|
||||
|
||||
<glyph glyph-name="folder" unicode="" d="M970.666667 682.666667H542.173333L429.793333 795.046667A52.986667 52.986667 0 0 1 392.08 810.666667H96a53.393333 53.393333 0 0 1-53.333333-53.333334v-704a53.393333 53.393333 0 0 1 53.333333-53.333333h874.666667a53.393333 53.393333 0 0 1 53.333333 53.333333V629.333333a53.393333 53.393333 0 0 1-53.333333 53.333334zM96 768h296.08a10.573333 10.573333 0 0 0 7.54-3.126667L481.826667 682.666667H96a53.546667 53.546667 0 0 1-10.666667-1.073334V757.333333a10.666667 10.666667 0 0 0 10.666667 10.666667z m885.333333-714.666667a10.666667 10.666667 0 0 0-10.666666-10.666666H96a10.666667 10.666667 0 0 0-10.666667 10.666666V629.333333a10.666667 10.666667 0 0 0 10.666667 10.666667h874.666667a10.666667 10.666667 0 0 0 10.666666-10.666667z" horiz-adv-x="1024" />
|
||||
@@ -66,8 +68,6 @@
|
||||
|
||||
<glyph glyph-name="chrome" unicode="" d="M515.436 583.685H914.285C840.842 730.955 688.748 832.132 513 832.132c-141.284 0-267.274-65.395-349.42-167.546l151.66-262.682c8.535 102.325 95.704 181.781 200.196 181.781zM514.218 550.803c-91.476 0-165.631-74.155-165.631-165.631s74.155-165.631 165.631-165.631c52.7 0 99.615 24.642 129.95 62.999l1.428 2.474 0.355-0.205c21.252 27.852 33.898 62.624 33.898 100.363 0 84.774-63.702 154.626-145.841 164.413l-6.393 0.632c-4.424 0.354-8.882 0.586-13.397 0.586zM929.561 549.585H627.443c52.209-36.066 86.506-96.297 86.506-164.413 0-45.547-18.268-81.598-41.12-121.192L483.898-63.257c9.624-0.617 19.322-0.966 29.102-0.966 247.521 0 448.177 200.656 448.177 448.177 0 58.508-11.225 114.391-31.616 165.631zM514.218 185.441c-83.583 0-144.927 54.804-185.034 124.651l-0.235-0.136-187.482 324.727C93.081 563.124 64.823 476.84 64.823 383.954c0-225.02 165.839-411.288 381.958-443.298l152.278 263.752c-25.769-12.143-54.518-18.967-84.841-18.967z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="edge" unicode="" d="M854.794 669.297C797.923 743.783 683.626 823.59 548.62 830.822 136.707 852.889 85.742 435.448 85.742 435.448c55.449 53.038 58.01 97.116 163.936 154.293C673.983 818.768 676.394 476.432 676.394 476.432H346.111c-7.232 65.092 62.681 137.417 62.681 137.417-202.509-98.844-216.974-284.477-216.974-284.477s-28.93-279.655 219.385-364.034 452.029 42.189 452.029 42.189V193.16c-59.065-32.546-102.292-54.405-153.087-63.887-361.623-67.503-364.034 188.044-364.034 188.044h585.83c0 0.001 39.075 199.761-77.147 351.98z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="heart" unicode="" d="M512 4.100000000000023c-108.9 0-447.3 277.5-447.3 522.2 0 131 106.6 237.6 237.6 237.6 94.9 0 174.8-50.2 209.7-76.1 34.9 25.9 114.8 76.1 209.7 76.1 131 0 237.6-106.6 237.6-237.6 0-244.7-338.4-522.2-447.3-522.2zM302.3 708c-100.2 0-181.7-81.5-181.7-181.7 0-221 326.8-466.3 391.4-466.3s391.4 245.3 391.4 466.3c0 100.2-81.5 181.7-181.7 181.7-103.9 0-190.2-76-191.1-76.8-10.6-9.5-26.7-9.5-37.3 0-0.8 0.8-87.7 76.8-191 76.8z" horiz-adv-x="1024" />
|
||||
|
||||
<glyph glyph-name="key" unicode="" d="M819.2 588.8c0-172.8-140.8-307.2-307.2-307.2-172.8 0-307.2 140.8-307.2 307.2C204.8 755.2 339.2 896 512 896S819.2 755.2 819.2 588.8L819.2 588.8zM512 838.4c-140.8 0-249.6-115.2-249.6-249.6 0-134.4 108.8-256 249.6-256s256 115.2 256 249.6S652.8 838.4 512 838.4L512 838.4zM480 300.79999999999995l64 0L544-128l-64 0L480 300.79999999999995 480 300.79999999999995zM512 192l192 0 0-64L512 128 512 192 512 192zM512 64l192 0 0-64L512 0 512 64 512 64z" horiz-adv-x="1024" />
|
||||
|
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 322 KiB |
Binary file not shown.
BIN
public/static/plugs/layui-v2.8.4/font/iconfont.woff
Normal file
BIN
public/static/plugs/layui-v2.8.4/font/iconfont.woff
Normal file
Binary file not shown.
BIN
public/static/plugs/layui-v2.8.4/font/iconfont.woff2
Normal file
BIN
public/static/plugs/layui-v2.8.4/font/iconfont.woff2
Normal file
Binary file not shown.
1
public/static/plugs/layui-v2.8.4/layui.js
Normal file
1
public/static/plugs/layui-v2.8.4/layui.js
Normal file
File diff suppressed because one or more lines are too long
@@ -10,8 +10,8 @@
|
||||
<title>ulthon_admin | 一款基于ThinkPHP6.0和Layui的快速开发的后台管理框架系统</title>
|
||||
<link rel="stylesheet" href="//layui.ulthon.com/cdn/layui-ul.css">
|
||||
<link rel="stylesheet" href="__STATIC__/common/css/welcome.css?v={$version}">
|
||||
<link rel="stylesheet" href="/static/plugs/layui-v2.8.1/css/layui.css">
|
||||
<script src="/static/plugs/layui-v2.8.1/layui.js"></script>
|
||||
<link rel="stylesheet" href="/static/plugs/layui-v2.8.4/css/layui.css">
|
||||
<script src="/static/plugs/layui-v2.8.4/layui.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user