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

Loading…
Cancel
Save