From c001f9215402429f1863d9bee59fcfd5e34a29a6 Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Tue, 11 May 2021 14:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E8=A1=A8=E5=8D=95=E8=AE=BE=E8=AE=A1=EF=BC=9A?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E6=A1=86=E3=80=81=E5=8D=95=E9=80=89=E6=A1=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=A1=E4=BB=B6=E9=AA=8C=E8=AF=81=E9=80=89?= =?UTF-8?q?=E6=8B=A9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/custmerform/lr-formcomponts.js | 16 ++++--- .../plugin/custmerform/lr-formrender.js | 44 ++++++++++++++++++- .../Views/LR_Content/script/lr-validator.js | 12 ++++- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js index d5e4da00f..30a47cd73 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js @@ -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 += '
数据来源
'; _html += '
'; @@ -459,7 +460,7 @@ setDatasource(dfop); }, renderTable: function (compont, $row) {//使用表单的时候渲染成table - var $compont = $('
'); + var $compont = $('
'); /*获取数据字典或者数据源数据*/ if (compont.dataSource == '0') { learun.clientdata.getAllAsync('dataItem', { @@ -488,7 +489,7 @@ return $compont; }, renderQuery: function (compont, $row) { - var $compont = $('
'); + var $compont = $('
'); /*获取数据字典或者数据源数据*/ 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 += '
数据来源
'; _html += '
'; @@ -567,7 +569,7 @@ setDatasource(dfop); }, renderTable: function (compont, $row) {//使用表单的时候渲染成table - var $compont = $('
'); + var $compont = $('
'); /*获取数据字典或者数据源数据*/ if (compont.dataSource == '0') { learun.clientdata.getAllAsync('dataItem', { @@ -597,7 +599,7 @@ return $compont; }, renderQuery: function (compont, $row) { - var $compont = $('
'); + var $compont = $('
'); /*获取数据字典或者数据源数据*/ if (compont.dataSource == '0') { learun.clientdata.getAllAsync('dataItem', { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js index 964d76f57..b69fbaa5b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js @@ -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')); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js index 290b9ad5e..42737faf6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js @@ -12,7 +12,7 @@ /*错误处理*/ $this.addClass('lr-field-error'); $this.parent().append('
'); - var validatemsg = $this.parent().find('.form-item-title').text() + ' ' + errormsg; + var validatemsg = $this.parent().find('.lr-form-item-title').text() + ' ' + errormsg; learun.alert.error('表单信息输入有误,请检查!
' + 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);