main
黄海 1 year ago
parent 0f857c4542
commit 32d6fffc84

@ -4148,6 +4148,7 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
$('#columnProperty').append(_html); $('#columnProperty').append(_html);
} }
/* 给字段属性绑定事件 实现双向绑定*/ /* 给字段属性绑定事件 实现双向绑定*/
Class.prototype.bindPropertyEvent = function (_json) { Class.prototype.bindPropertyEvent = function (_json) {
var that = this var that = this
@ -4406,41 +4407,39 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
}); });
form.on('radio', function (data) { form.on('radio', function (data) {
console.log(data); var _json = options.selectItem;
var _json = options.selectItem; switch (_json.tag) {
switch (_json.tag) { case 'radio':
case 'radio': var _index = parseInt($("#" + _json.id + " .layui-input-block div.layui-form-radio").index(data.othis[0]));
var _index = parseInt($("#" + _json.id + " .layui-input-block div.layui-form-radio").index(data.othis[0])); if ($(data.othis[0]).parent().parent().parent().attr("id") === 'radio') {
if ($(data.othis[0]).parent().parent().parent().attr("id") === 'radio') { _index = parseInt($(data.othis[0]).parent().parent().attr("data-index"));
_index = parseInt($(data.othis[0]).parent().parent().attr("data-index"));
}
for (var i = 0; i < _json.options.length; i++) {
if (i === _index) {
_json.options[i].checked = true;
continue;
} }
_json.options[i].checked = false; for (var i = 0; i < _json.options.length; i++) {
} if (i === _index) {
console.log(_json); _json.options[i].checked = true;
that.components[_json.tag].update(_json, that); continue;
break; }
case 'select': _json.options[i].checked = false;
case 'carousel':
var _index = parseInt(data.elem.closest('.layui-form-item').dataset.index);
for (var i = 0; i < _json.options.length; i++) {
if (i === _index) {
_json.options[i].checked = true;
_json.startIndex = i;
continue;
} }
_json.options[i].checked = false; that.components[_json.tag].update(_json, that);
} break;
that.components[_json.tag].update(_json, that); case 'select':
break; case 'carousel':
default: var _index = parseInt(data.elem.closest('.layui-form-item').dataset.index);
break; for (var i = 0; i < _json.options.length; i++) {
} if (i === _index) {
}); _json.options[i].checked = true;
_json.startIndex = i;
continue;
}
_json.options[i].checked = false;
}
that.components[_json.tag].update(_json, that);
break;
default:
break;
}
})
form.on('checkbox', function (data) { form.on('checkbox', function (data) {
var _json = options.selectItem; var _json = options.selectItem;
@ -4515,6 +4514,15 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
Class.prototype.render = function () { Class.prototype.render = function () {
var that = this var that = this
, options = that.config; , options = that.config;
//增加于2024-02-02 黄海
options.data.forEach(function (item, index) {
if (index === 0) {
options.selectItem = item;
}
that.bindPropertyEvent(item);
});
if (options.viewOrDesign) { if (options.viewOrDesign) {
var that = this var that = this
, options = that.config; , options = that.config;
@ -5168,9 +5176,7 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
//显示当前的属性 //显示当前的属性
that.components[tag].property(options.selectItem, that); that.components[tag].property(options.selectItem, that);
that.bindPropertyEvent(options.selectItem);
alert("点击!");
//移除 #formDesignerForm .layui-form-item 下所有的 active //移除 #formDesignerForm .layui-form-item 下所有的 active
$('#formDesignerForm .layui-form-item').removeClass('active'); $('#formDesignerForm .layui-form-item').removeClass('active');

Loading…
Cancel
Save