Selaa lähdekoodia

【修改】自定义表单设计:多选框、单选框增加条件验证选择;

中职版本
dyy 3 vuotta sitten
vanhempi
commit
c001f92154
3 muutettua tiedostoa jossa 63 lisäystä ja 9 poistoa
  1. +9
    -7
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js
  2. +43
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js
  3. +11
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js

+ 9
- 7
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js Näytä tiedosto

@@ -421,6 +421,7 @@
table: '',
field: "",
proportion: '1',
verify: '',

dataSource: '0', // 0数据字典1数据源
dataSourceId: '',
@@ -431,7 +432,7 @@
},
property: function ($component) {
var dfop = $component[0].dfop;
var $html = setComponentPropertyHtml($component);
var $html = setComponentPropertyHtml($component, verifyDatalist2);
var _html = '';
_html += '<div class="lr-component-title">数据来源</div>';
_html += '<div class="lr-component-control"><div id="lr_component_dataSource"></div></div>';
@@ -459,7 +460,7 @@
setDatasource(dfop);
},
renderTable: function (compont, $row) {//使用表单的时候渲染成table
var $compont = $('<div class="radio"></div>');
var $compont = $('<div id="' + compont.id + '" class="radio"></div>');
/*获取数据字典或者数据源数据*/
if (compont.dataSource == '0') {
learun.clientdata.getAllAsync('dataItem', {
@@ -488,7 +489,7 @@
return $compont;
},
renderQuery: function (compont, $row) {
var $compont = $('<div class="radio"></div>');
var $compont = $('<div id="' + compont.id + '" class="radio"></div>');
/*获取数据字典或者数据源数据*/
if (compont.dataSource == '0') {
learun.clientdata.getAllAsync('dataItem', {
@@ -530,17 +531,18 @@
table: '',
field: "",
proportion: '1',
verify: '',

dataSource: '0', // 0数据字典1数据源
dataSourceId: '',
itemCode:'',
itemCode: '',
dfvalue: '' // 默认值
};
$component.html(getComponentRowHtml({ name: $component[0].dfop.title, text: "多选项" }));
},
property: function ($component) {
var dfop = $component[0].dfop;
var $html = setComponentPropertyHtml($component);
var $html = setComponentPropertyHtml($component, verifyDatalist2);
var _html = '';
_html += '<div class="lr-component-title">数据来源</div>';
_html += '<div class="lr-component-control"><div id="lr_component_dataSource"></div></div>';
@@ -567,7 +569,7 @@
setDatasource(dfop);
},
renderTable: function (compont, $row) {//使用表单的时候渲染成table
var $compont = $('<div class="checkbox"></div>');
var $compont = $('<div id="' + compont.id + '" class="checkbox"></div>');
/*获取数据字典或者数据源数据*/
if (compont.dataSource == '0') {
learun.clientdata.getAllAsync('dataItem', {
@@ -597,7 +599,7 @@
return $compont;
},
renderQuery: function (compont, $row) {
var $compont = $('<div class="checkbox"></div>');
var $compont = $('<div id="' + compont.id + '" class="checkbox"></div>');
/*获取数据字典或者数据源数据*/
if (compont.dataSource == '0') {
learun.clientdata.getAllAsync('dataItem', {


+ 43
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js Näytä tiedosto

@@ -106,6 +106,7 @@
$.lrValidCustmerform = function () {
var validateflag = true;
var validHelper = learun.validator;

$('body').find("[isvalid=yes]").each(function () {
var $this = $(this);
if ($this.parent().find('.lr-field-error-info').length > 0) {
@@ -126,7 +127,27 @@
value = $this.lrformselectGet();
}
else {
value = $this.val();
if ($this.hasClass("checkbox")) {//多选框
var checkedList = $this.find("input[name='" + $this.attr('id') + "']:checked");
if (checkedList.length > 0) {
value = '';
$.each(checkedList, function (i, item) {
if (value != '' && value != undefined) {
value += ',';
}
value += $(item).val();
});
}
}
else if ($this.hasClass("radio")) {//单选框
var checkedList = $this.find("input[name='" + $this.attr('id') + "']:checked");
if (checkedList.length > 0) {
value = checkedList.val();
}
}
else {
value = $this.val();
}
}
var r = { code: true, msg: '' };
if (checkexpession == 'LenNum' || checkexpession == 'LenNumOrNull' || checkexpession == 'LenStr' || checkexpession == 'LenStrOrNull') {
@@ -236,6 +257,12 @@
if ($obj.hasClass("lr-input-wdatepicker")) {
type = "datepicker";
}
else if ($obj.hasClass("checkbox")) {
type = "checkbox";
}
else if ($obj.hasClass("radio")) {
type = "radio";
}
switch (type) {
case "lrselect":
$obj.lrselectSet(value);
@@ -243,6 +270,21 @@
case "formselect":
$obj.lrformselectSet(value);
break;
case "checkbox":
$obj.find('input[name="' + id + '"]:checked').trigger('click');
if (value != null && value != undefined && value != '') {
vs = value.split(',');
for (var i = 0; i < vs.length; i++) {
$obj.find('input[name="' + id + '"][value="' + vs[i] + '"]').trigger('click');
}
}
break;
case "radio":
$obj.find('input[name="' + id + '"]:checked').trigger('click');
if (value != null && value != undefined && value != '') {
$obj.find('input[name="' + id + '"][value="' + value + '"]').trigger('click');
}
break;
case "datepicker":
if ($obj.attr('dateformat') == "0") {
$obj.val(learun.formatDate(value, 'yyyy-MM-dd'));


+ 11
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js Näytä tiedosto

@@ -12,7 +12,7 @@
/*错误处理*/
$this.addClass('lr-field-error');
$this.parent().append('<div class="lr-field-error-info" title="' + errormsg + '!"><i class="fa fa-info-circle"></i></div>');
var validatemsg = $this.parent().find('.form-item-title').text() + ' ' + errormsg;
var validatemsg = $this.parent().find('.lr-form-item-title').text() + ' ' + errormsg;
learun.alert.error('表单信息输入有误,请检查!</br>' + validatemsg);
if ($this.attr('type') == 'lrselect') {
$this.on('change', function () {
@@ -32,6 +32,16 @@
}
});
}
else if ($this.hasClass('checkbox')) {
$this.on('change', function () {
removeErrorMessage($(this));
});
}
else if ($this.hasClass('radio')) {
$this.on('change', function () {
removeErrorMessage($(this));
});
}
else {
$this.on('input propertychange', function () {
var $input = $(this);


Ladataan…
Peruuta
Tallenna