优化tableData;新增dataGet;

This commit is contained in:
2024-04-11 10:27:24 +08:00
parent 1c9560cff8
commit 84e879f8f0
5 changed files with 18 additions and 16 deletions

View File

@@ -12,12 +12,12 @@ use think\console\Output;
class VersionBase extends Command class VersionBase extends Command
{ {
public const VERSION = 'v2.0.98'; public const VERSION = 'v2.0.99';
public const LAYUI_VERSION = '2.8.17'; public const LAYUI_VERSION = '2.8.17';
public const COMMENT = [ public const COMMENT = [
'修复表格选择字段渲染', '优化tableData;新增dataGet',
'发布新版本', '发布新版本',
]; ];

View File

@@ -4,15 +4,15 @@
justify-content: left; justify-content: left;
flex-wrap: wrap; flex-wrap: wrap;
} }
.table-data-container .layui-input .placeholder {
color: #808080;
}
.table-data-container .layui-input .layui-btn { .table-data-container .layui-input .layui-btn {
pointer-events: none; pointer-events: none;
} }
.table-data-container .layui-input .layui-btn i { .table-data-container .layui-input .layui-btn i {
pointer-events: all; pointer-events: all;
} }
.table-data-container .placeholder {
color: #808080;
}
.table-data-container .layui-form-danger + .layui-input { .table-data-container .layui-form-danger + .layui-input {
border-color: #ff5722 !important; border-color: #ff5722 !important;
} }

View File

@@ -40,8 +40,8 @@
height: clientHeight, height: clientHeight,
placeholder: '请选择', placeholder: '请选择',
selectConfirmCallback: 'onTableDataConfirm', selectConfirmCallback: 'onTableDataConfirm',
type:'input', type: 'input',
className:'layui-input', className: 'layui-input',
}; };
var options = $.extend(defaultOption, data); var options = $.extend(defaultOption, data);
@@ -56,7 +56,7 @@
options.index += 'select_mode=' + options.selectType; options.index += 'select_mode=' + options.selectType;
if(options.type == 'textarea'){ if (options.type == 'textarea') {
options.className = 'layui-textarea'; options.className = 'layui-textarea';
} }
@@ -82,7 +82,7 @@
if (this.setting.fieldName.indexOf('|') < 0) { if (this.setting.fieldName.indexOf('|') < 0) {
return this.listSelected.map( return this.listSelected.map(
(item) => { (item) => {
item['_select_show'] = item[this.setting.fieldName]; item['_select_show'] = ua.dataGet(item, this.setting.fieldName);
return item; return item;
} }
); );
@@ -92,7 +92,7 @@
return this.listSelected.map(item => { return this.listSelected.map(item => {
var showText = ''; var showText = '';
fieldNameList.forEach(fieldName => { fieldNameList.forEach(fieldName => {
showText += item[fieldName] + ' '; showText += ua.dataGet(item, fieldName) + ' ';
}); });
item['_select_show'] = showText; item['_select_show'] = showText;

View File

@@ -5,10 +5,6 @@
justify-content: left; justify-content: left;
flex-wrap: wrap; flex-wrap: wrap;
.placeholder {
color: #808080
}
.layui-btn { .layui-btn {
pointer-events: none; pointer-events: none;
@@ -18,6 +14,10 @@
} }
} }
.placeholder {
color: #808080
}
.layui-form-danger+.layui-input { .layui-form-danger+.layui-input {
border-color: #ff5722 !important; border-color: #ff5722 !important;
} }

View File

@@ -2433,13 +2433,15 @@
defaultValue = undefined; defaultValue = undefined;
} }
return admin.dataGet(this.dataBrage, keys, defaultValue);
},
dataGet(data, keys, defaultValue) {
return ( return (
(!Array.isArray(keys) (!Array.isArray(keys)
? keys.replace(/\[/g, '.').replace(/\]/g, '').split('.') ? keys.replace(/\[/g, '.').replace(/\]/g, '').split('.')
: keys : keys
).reduce((o, k) => (o || {})[k], this.dataBrage) || defaultValue ).reduce((o, k) => (o || {})[k], data) || defaultValue
); );
}, },
getExtGroupName(ext) { getExtGroupName(ext) {
var groupName = 'file'; var groupName = 'file';