save
This commit is contained in:
parent
226058de04
commit
a24e00e086
@ -211,7 +211,7 @@ EOF;
|
|||||||
// 字段 {$options['label']} $field
|
// 字段 {$options['label']} $field
|
||||||
layui.use(['upload', 'layer', 'jquery', 'popup', 'util'], function() {
|
layui.use(['upload', 'layer', 'jquery', 'popup', 'util'], function() {
|
||||||
let input = layui.jquery('#$id').prev();
|
let input = layui.jquery('#$id').prev();
|
||||||
input.prev().html(input.val());
|
input.prev().html(layui.util.escape(input.val()));
|
||||||
layui.upload.render({
|
layui.upload.render({
|
||||||
elem: '#$id',$options_string
|
elem: '#$id',$options_string
|
||||||
done: function (res) {
|
done: function (res) {
|
||||||
@ -745,7 +745,7 @@ EOF;
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
let checked = d[field] === 1 ? 'checked' : '';
|
let checked = d[field] === 1 ? 'checked' : '';
|
||||||
return '<input type="checkbox" value="'+d[PRIMARY_KEY]+'" lay-filter="'+field+'" lay-skin="switch" lay-text="$lay_text" '+checked+'/>';
|
return '<input type="checkbox" value="'+util.escape(d[PRIMARY_KEY])+'" lay-filter="'+util.escape(field)+'" lay-skin="switch" lay-text="'+util.escape('$lay_text')+'" '+checked+'/>';
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
break;
|
break;
|
||||||
@ -754,7 +754,7 @@ EOF;
|
|||||||
$templet = <<<EOF
|
$templet = <<<EOF
|
||||||
|
|
||||||
templet: function (d) {
|
templet: function (d) {
|
||||||
return '<i class="layui-icon ' + d['$field'] + '"></i>';
|
return '<i class="layui-icon ' + util.escape(d['$field']) + '"></i>';
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
break;
|
break;
|
||||||
@ -762,7 +762,7 @@ EOF;
|
|||||||
$templet = <<<EOF
|
$templet = <<<EOF
|
||||||
|
|
||||||
templet: function (d) {
|
templet: function (d) {
|
||||||
return '<a href="' + d['$field'] + '" target="_blank">' + d['$field'] + '</a>';
|
return '<a href="' + encodeURI(d['$field']) + '" target="_blank">' + util.escape(d['$field']) + '</a>';
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
break;
|
break;
|
||||||
@ -770,7 +770,7 @@ EOF;
|
|||||||
$templet = <<<EOF
|
$templet = <<<EOF
|
||||||
|
|
||||||
templet: function (d) {
|
templet: function (d) {
|
||||||
return '<img src="'+d.avatar+'" style="max-width:32px;max-height:32px;" alt="" />';
|
return '<img src="'+encodeURI(d['$field'])+'" style="max-width:32px;max-height:32px;" alt="" />'
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
break;
|
break;
|
||||||
@ -802,7 +802,7 @@ EOF;
|
|||||||
layui.each((d[field] + '').split(','), function (k , v) {
|
layui.each((d[field] + '').split(','), function (k , v) {
|
||||||
items.push(apiResults[field][v] || v);
|
items.push(apiResults[field][v] || v);
|
||||||
});
|
});
|
||||||
return items.join(',');
|
return util.escape(items.join(','));
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
|
@ -783,11 +783,12 @@ EOF
|
|||||||
const UPDATE_URL = "$url_path_base/$template_path/update";
|
const UPDATE_URL = "$url_path_base/$template_path/update";
|
||||||
$js
|
$js
|
||||||
// 表格渲染
|
// 表格渲染
|
||||||
layui.use(['table', 'form', 'jquery', 'common', 'popup'], function() {
|
layui.use(['table', 'form', 'jquery', 'common', 'popup', 'util'], function() {
|
||||||
let table = layui.table;
|
let table = layui.table;
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery;
|
||||||
let common = layui.common;
|
let common = layui.common;
|
||||||
|
let util = layui.util;
|
||||||
$table_js
|
$table_js
|
||||||
// 编辑或删除行事件
|
// 编辑或删除行事件
|
||||||
table.on('tool(data-table)', function(obj) {
|
table.on('tool(data-table)', function(obj) {
|
||||||
@ -1050,7 +1051,7 @@ EOF;
|
|||||||
}
|
}
|
||||||
if (typeof obj[0] === 'undefined' || !obj[0].nodeName) return;
|
if (typeof obj[0] === 'undefined' || !obj[0].nodeName) return;
|
||||||
if (obj[0].nodeName.toLowerCase() === 'textarea') {
|
if (obj[0].nodeName.toLowerCase() === 'textarea') {
|
||||||
obj.html(layui.util.escape(value));
|
obj.val(layui.util.escape(value));
|
||||||
} else {
|
} else {
|
||||||
obj.attr('value', value);
|
obj.attr('value', value);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
layui.use(['form', 'jquery', 'util'], function () {
|
layui.use(['form', 'jquery', 'util'], function () {
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery;
|
||||||
|
let util = layui.util;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: SELECT_API,
|
url: SELECT_API,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
@ -55,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
if (typeof obj[0] === 'undefined' || !obj[0].nodeName) return;
|
if (typeof obj[0] === 'undefined' || !obj[0].nodeName) return;
|
||||||
if (obj[0].nodeName.toLowerCase() === 'textarea') {
|
if (obj[0].nodeName.toLowerCase() === 'textarea') {
|
||||||
obj.html(layui.util.escape(value));
|
obj.html(util.escape(value));
|
||||||
} else {
|
} else {
|
||||||
obj.attr('value', value);
|
obj.attr('value', value);
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const TABLE_NAME = '<?=htmlspecialchars($table)?>';
|
const TABLE_NAME = "<?=htmlspecialchars($table)?>";
|
||||||
const PRIMARY_KEY = '<?=htmlspecialchars($primary_key)?>';
|
const PRIMARY_KEY = "<?=htmlspecialchars($primary_key)?>";
|
||||||
const SELECT_API = "/app/admin/table/select?table=" + TABLE_NAME;
|
const SELECT_API = "/app/admin/table/select?table=" + TABLE_NAME;
|
||||||
const UPDATE_API = "/app/admin/table/update";
|
const UPDATE_API = "/app/admin/table/update";
|
||||||
const DELETE_API = "/app/admin/table/delete";
|
const DELETE_API = "/app/admin/table/delete";
|
||||||
@ -130,7 +130,7 @@
|
|||||||
};
|
};
|
||||||
} else if (control === 'uploadimage') {
|
} else if (control === 'uploadimage') {
|
||||||
schema.templet = function (d) {
|
schema.templet = function (d) {
|
||||||
return '<img src="'+encodeURI(d[field])+'" style="max-width:32px;max-height:32px;" />'
|
return '<img src="'+encodeURI(d[field])+'" style="max-width:32px;max-height:32px;" />';
|
||||||
};
|
};
|
||||||
} else if (['select', 'selectmulti', 'treeselect', 'treeselectmulti'].indexOf(control) !== -1) {
|
} else if (['select', 'selectmulti', 'treeselect', 'treeselectmulti'].indexOf(control) !== -1) {
|
||||||
let props = getProps(item.control_args);
|
let props = getProps(item.control_args);
|
||||||
|
@ -125,7 +125,7 @@ button {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.top-search-from .layui-input, .layui-select, .layui-textarea {
|
.top-search-from .layui-input, .top-search-from .layui-select, .top-search-from .layui-textarea {
|
||||||
width: 270px;
|
width: 270px;
|
||||||
}
|
}
|
||||||
.top-search-from .item-inline .layui-form-item .layui-input-block {
|
.top-search-from .item-inline .layui-form-item .layui-input-block {
|
||||||
|
Loading…
Reference in New Issue
Block a user