From 199b80a437a4ff55fe5899a053f7382493038d5d Mon Sep 17 00:00:00 2001
From: dyy <18335927079@163.com>
Date: Mon, 10 May 2021 17:54:38 +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=E5=8F=91=E8=B5=B7=E6=B5=81=E7=A8=8B-?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=8D=89=E7=A8=BF=EF=BC=9A=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE=E9=AA=8C=E8=AF=81=EF=BC=9B?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=AE=BE=E8=AE=A1-=E6=9F=A5=E7=9C=8B?=
=?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=EF=BC=9A=E9=A2=84=E8=A7=88?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BF=AE=E6=94=B9=E4=B8=BA=E9=A2=84=E8=A7=88?=
=?UTF-8?q?=E9=80=89=E4=B8=AD=E8=AE=B0=E5=BD=95=E7=9A=84=E8=A1=A8=E5=8D=95?=
=?UTF-8?q?=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Views/Custmerform/HistoryForm.js | 3 +-
.../Views/NWFProcess/NWFContainerForm.js | 10 +++
.../plugin/custmerform/lr-formcomponts.js | 80 +++++++++----------
.../plugin/custmerform/lr-formrender.js | 74 +++++++++++++----
.../Views/LR_Content/script/lr-validator.js | 12 ++-
5 files changed, 121 insertions(+), 58 deletions(-)
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js
index 53028304b..43920be07 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js
@@ -32,7 +32,8 @@ var bootstrap = function ($, learun) {
learun.layerForm({
id: 'custmerForm_PreviewForm',
title: '预览当前表单',
- url: top.$.rootUrl + '/LR_FormModule/Custmerform/PreviewForm?schemeInfoId=' + keyValue,
+ //url: top.$.rootUrl + '/LR_FormModule/Custmerform/PreviewForm?schemeInfoId=' + keyValue,//预览当前版本表单
+ url: top.$.rootUrl + '/LR_FormModule/Custmerform/PreviewForm?schemeId=' + schemeId,//预览选中表单
width: 800,
height: 600,
maxmin: true,
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.js
index 552159cb0..d340df4a9 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.js
@@ -309,6 +309,11 @@ var bootstrap = function ($, learun) {
//$('#savedraft').show();
$('#savedraft').showBtn();
$('#savedraft').on('click', function () {
+ // 验证表单数据完整性
+ if (!custmerForm.validForm('create'))// create创建流程
+ {
+ return false;
+ }
tabProcessId = nwflow.processId;
// 保存表单数据
custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () {
@@ -490,6 +495,11 @@ var bootstrap = function ($, learun) {
//$('#savedraft').show();
$('#savedraft').showBtn();
$('#savedraft').on('click', function () {
+ // 验证表单数据完整性
+ if (!custmerForm.validForm('create'))// create创建流程
+ {
+ return false;
+ }
tabProcessId = nwflow.processId;
// 保存表单数据
custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () {
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 58c2b2253..5df869b27 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
@@ -137,7 +137,7 @@
type: "html",
proportion: '1',
};
- $component.html(getComponentRowHtml({ name: "富文本" , text: "富文本" }));
+ $component.html(getComponentRowHtml({ name: "富文本", text: "富文本" }));
},
property: function ($component) {
var dfop = $component[0].dfop;
@@ -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', {
@@ -643,7 +645,7 @@
dataSource: '0', // 0数据字典1数据源
dataSourceId: '',
- itemCode:'',
+ itemCode: '',
dfvalue: '' // 默认值
};
$component.html(getComponentRowHtml({ name: $component[0].dfop.title, text: "下拉框" }));
@@ -1000,7 +1002,7 @@
_html += '单位组织控件级联-上一级
';
_html += '';
-
+
$html.append(_html);
// 设置多语言
$html.find('.lr-component-title').each(function () {
@@ -1024,11 +1026,11 @@
data: organizes,
value: 'id',
text: 'text',
- select: function (item,type) {
+ select: function (item, type) {
if (!!item) {
dfop.relation = item.id;
}
- else if (type !== 'refresh'){
+ else if (type !== 'refresh') {
dfop.relation = '';
}
}
@@ -1148,7 +1150,7 @@
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
param: {}
});
- }
+ }
break;
case "company"://公司
$compont.lrCompanySelect({});
@@ -1337,7 +1339,7 @@
}
}
-
+
if (compont.isHide == '1') {
$row.hide();
}
@@ -1350,18 +1352,18 @@
$row.append($compont);
switch (compont.dataType) {
- case 'company':
- $compont.lrCompanySelect({ type: 'multiple' })
- break;
- case 'department':
- $compont.lrDepartmentSelect();
- break;
- case 'user':
- $compont.lrUserSelect({ type: '1' })
- break;
- case 'role':
- $compont.lrPostSelect({ type: 'treemultiple' });
- break;
+ case 'company':
+ $compont.lrCompanySelect({ type: 'multiple' })
+ break;
+ case 'department':
+ $compont.lrDepartmentSelect();
+ break;
+ case 'user':
+ $compont.lrUserSelect({ type: '1' })
+ break;
+ case 'role':
+ $compont.lrPostSelect({ type: 'treemultiple' });
+ break;
}
if (compont.isHide == '1') {
$row.hide();
@@ -1633,7 +1635,7 @@
var $compont = $('');
$row.append($compont);
compont.hideData = [];
-
+
var headData = toGirdheadData(compont.fieldsData, compont.hideData, $compont);
if (!!compont.preloadDb && !!compont.preloadTable) {
$compont.jfGrid({
@@ -1783,8 +1785,7 @@
}
}
});
- if (!!designerDfop.dbTable && designerDfop.dbTable.length > 0)
- {
+ if (!!designerDfop.dbTable && designerDfop.dbTable.length > 0) {
$('#lr_component_table').lrselectSet(dfop.table || designerDfop.dbTable[0].name);
}
// 标题设置
@@ -1851,7 +1852,7 @@
};
// 数据字典选择初始化、数据源选择初始化
function setDatasource(dfop) {
- $('#lr_component_dfvalue').lrselect({
+ $('#lr_component_dfvalue').lrselect({
allowSearch: true,
select: function (item) {
if (!!item) {
@@ -1872,7 +1873,7 @@
allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree',
type: 'tree',
- value:'value',
+ value: 'value',
select: function (item) {
if (!!item) {
if (dfop.dataSourceId != item.id) {
@@ -1918,7 +1919,7 @@
vlist[1] = item.value;
dfop.dataSourceId = String(vlist);
if (vlist[2] != '') {
-
+
learun.clientdata.getAllAsync('sourceData', {
code: vlist[0],
callback: function (dataes) {
@@ -1972,12 +1973,12 @@
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetList',
value: 'F_Code',
text: 'F_Name',
- title:'F_Name',
+ title: 'F_Name',
select: function (item) {
if (item) {
if (dfop.dataSourceId != '') {
var vlist = dfop.dataSourceId.split(',');
- if (vlist.length <3 || vlist[0] != item.F_Code) {
+ if (vlist.length < 3 || vlist[0] != item.F_Code) {
vlist[1] = '';
vlist[2] = '';
dfop.dataSourceId = item.F_Code + ',,';
@@ -1989,7 +1990,7 @@
dfop.dfvalue = '';
}
//$('#lr_component_dfvalue').lrselectRefresh({ url: '', data: [] });
-
+
//获取字段数据
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataColName', { code: item.F_Code }, function (data) {
@@ -2009,7 +2010,7 @@
data: fieldData,
placeholder: false
});
- $('#lr_component_dataSourceId2').lrselectSet(vlist[2] ||fieldData[0].value);
+ $('#lr_component_dataSourceId2').lrselectSet(vlist[2] || fieldData[0].value);
});
}
else {
@@ -2034,7 +2035,7 @@
$('#lr_component_dataItemCode').lrselectSet(dfop.itemCode);
}
else {
- var valuelist = dfop.dataSourceId.split(',');
+ var valuelist = dfop.dataSourceId.split(',');
$('#lr_component_dataSourceId').lrselectSet(valuelist[0]);
}
@@ -2191,7 +2192,7 @@
delete pIds[item['id']];
}
}
-
+
});
for (var id in pIds) {
_fn(resdata, id);
@@ -2213,8 +2214,7 @@
return resdata;
}
// html编码
- function htmlEncode(text)
- {
+ function htmlEncode(text) {
text = text || "";
text = text.replace(/%/g, "{@bai@}");
text = text.replace(/ /g, "{@kong@}");
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..0fc925c5e 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
@@ -70,21 +70,21 @@
compontsMap[compont.table + compont.field.toLowerCase()] = compont.id;
}
//验证表单字段权限
- // if (compont.id in authorizeField || compont.type == 'guid') {
- var $row = $('');
- var $title = $(' ' + compont.title + getFontHtml(compont.verify) + '
');
- if (compont.title != '') {
- $row.append($title);
- }
- $content.append($row);
- var $compont = $.lrFormComponents[compont.type].renderTable(compont, $row);
- if (!!$compont && !!compont.verify && compont.verify != "") {
- $compont.attr('isvalid', 'yes').attr('checkexpession', compont.verify);
- }
- if (compont.type == 'girdtable') {
- girdCompontMap[compont.table] = compont;
- }
- // }
+ // if (compont.id in authorizeField || compont.type == 'guid') {
+ var $row = $('');
+ var $title = $(' ' + compont.title + getFontHtml(compont.verify) + '
');
+ if (compont.title != '') {
+ $row.append($title);
+ }
+ $content.append($row);
+ var $compont = $.lrFormComponents[compont.type].renderTable(compont, $row);
+ if (!!$compont && !!compont.verify && compont.verify != "") {
+ $compont.attr('isvalid', 'yes').attr('checkexpession', compont.verify);
+ }
+ if (compont.type == 'girdtable') {
+ girdCompontMap[compont.table] = compont;
+ }
+ // }
}
@@ -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);