开始多模版

This commit is contained in:
augushong
2024-11-12 13:57:50 +08:00
parent 3baaf4747d
commit cbcb839cb9
3 changed files with 121 additions and 25 deletions

View File

@@ -585,6 +585,18 @@ table样式
.layuimini-form.multiple-columns .layui-form-item.full-line {
width: calc(100% - 0px);
}
.layui-table-tool-temp{
padding-right: unset;
padding-bottom: 40px;
}
.layuimini-container .layui-table-tool-self{
right: 0;
bottom: 10px;
top: unset;
}
}
.w-e-text-container,

View File

@@ -517,9 +517,6 @@
background-color: rgb(126, 252, 246);
color: rgb(2, 17, 20);
}
.elem-style-sicfi .layui-layout-admin .layui-header .layuimini-tool i {
color: rgb(126, 252, 246);
}
.elem-style-sicfi .color-red {
color: rgb(255, 0, 0) !important;
}

View File

@@ -12,7 +12,7 @@
};
window.onInitElemStyle();
const { createEditor, createToolbar } = window.wangEditor;
var lastTableWhere = {};
@@ -41,11 +41,8 @@
var table;
if (tools.checkMobile()) {
table = window.uaTable;
} else {
table = layui.table;
}
table = layui.table;
var extGroup = {
// 图片扩展名数组
@@ -174,11 +171,11 @@
},
error: function (xhr, textstatus, thrown) {
var errorMsg = '';
if(xhr.responseJSON.message){
if (xhr.responseJSON.message) {
errorMsg = xhr.responseJSON.message;
}
loading.hide();
admin.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!<br/>'+errorMsg, function () {
admin.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!<br/>' + errorMsg, function () {
ex(this);
});
return false;
@@ -275,6 +272,33 @@
options.headers = admin.headers();
options.page = admin.parame(options.page, true);
options.search = admin.parame(options.search, true);
options.layout = admin.parame(options.layout, true);
options.layoutList = admin.parame(options.layoutList,
[
'table',
'card',
{
name: 'usercard',
// 优先级1
tplFunction() {
},
// 优先级3
tplVue() {
},
// 优先级2
tplLay() {
},
// 优先级4
tplLayId: '',
// 优先级5
tplVueId: ''
}
]
);
options.layoutDefault = admin.parame(options.layoutDefault, true);
options.skin = options.skin || 'line';
options.autoSort = options.autoSort || false;
options.limit = options.limit || 15;
@@ -282,6 +306,14 @@
options.cols = options.cols || [];
var defaultToolbar = ['filter', 'print'];
if (options.layout === true) {
defaultToolbar.push({
title: '视图',
layEvent: 'TABLE_LAYOUT',
icon: 'layui-icon-template-1',
extend: 'data-table-id="' + options.id + '"'
});
}
if (options.search) {
defaultToolbar.push({
@@ -304,6 +336,7 @@
}
options.done = function (res, curr, count) {
optionDone(res, curr, count);
console.log(res, curr, count);
// 监听表格内的复制组件
admin.api.copyText('[lay-id=' + options.id + ']');
@@ -315,21 +348,8 @@
selectConfirmCallback = admin.getQueryVariable('select_confirm_callback', 'onTableDataConfirm');
// 判断是否为移动端
if (admin.checkMobile()) {
options.defaultToolbar = !options.search ? ['filter'] : ['filter', {
title: '搜索',
layEvent: 'TABLE_SEARCH',
icon: 'layui-icon-search',
extend: 'data-table-id="' + options.id + '"'
}];
options.page = {
layout: ['first', 'prev', 'page', 'next', 'last', 'count']
};
}
if (selectMode == 'checkbox') {
if (options.cols[0][0].type == 'radio') {
@@ -362,6 +382,12 @@
options = admin.table.renderSearch(options.cols, options.elem, options.id, options);
}
// 初始化模板切换
if (options.layout === true) {
options = admin.table.renderLayout(options);
}
// 初始化表格左上方工具栏
options.toolbar = options.toolbar || ['refresh', 'add', 'delete', 'export'];
@@ -685,6 +711,58 @@
return options;
},
renderLayout: function (options) {
if (!options.layoutList) {
return options;
}
var tableId = options.id;
var elem = options.elem;
console.log(tableId);
// 初始化参数
options.labelList = options.layoutList.map((item) => {
if (item == 'table') {
return {
name: 'table',
title: '默认表格',
};
}
if (item == 'card') {
return {
name: 'card',
title: '默认卡片',
'tplFunction': function (data) {
return '';
}
};
}
return item;
});
var optionDone = options.done;
options.done = function (res, curr, count) {
optionDone(res, curr, count);
};
// 生成html
var layoutElemId = 'layout-list-option-' + tableId;
// 构建下拉选择
var layoutHtml = '<div id="' + layoutElemId + '" class="">';
layoutHtml += '</div>';
$(elem).before(layoutHtml);
return options;
},
renderSwitch: function (cols, tableInit, tableId, modifyReload) {
tableInit.modifyUrl = tableInit.modifyUrl || false;
cols = cols[0] || {};
@@ -1347,6 +1425,15 @@
_that.addClass('layui-hide');
}
break;
case 'TABLE_LAYOUT':
var searchFieldsetId = 'searchFieldset_' + tableId;
var _that = $("#" + searchFieldsetId);
if (_that.hasClass("layui-hide")) {
_that.removeClass('layui-hide');
} else {
_that.addClass('layui-hide');
}
break;
}
});
},
@@ -2477,7 +2564,7 @@
var targetElemName = $(v).data('paste-target');
$(v).on('click', function () {
if(!navigator.clipboard){
if (!navigator.clipboard) {
admin.msg.error('您的当前不支持粘贴操作');
return;
}