ソースを参照

【修改】自定义表单设计:多选框、单选框增加条件验证选择;发起流程-保存草稿:增加表单数据验证;表单设计-查看历史记录:预览模板修改为预览选中记录的表单;

金隅分支
dyy 3年前
コミット
199b80a437
5個のファイルの変更121行の追加58行の削除
  1. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js
  2. +10
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.js
  3. +40
    -40
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js
  4. +58
    -16
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formrender.js
  5. +11
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js

+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_FormModule/Views/Custmerform/HistoryForm.js ファイルの表示

@@ -32,7 +32,8 @@ var bootstrap = function ($, learun) {
learun.layerForm({ learun.layerForm({
id: 'custmerForm_PreviewForm', id: 'custmerForm_PreviewForm',
title: '预览当前表单', 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, width: 800,
height: 600, height: 600,
maxmin: true, maxmin: true,


+ 10
- 0
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').show();
$('#savedraft').showBtn(); $('#savedraft').showBtn();
$('#savedraft').on('click', function () { $('#savedraft').on('click', function () {
// 验证表单数据完整性
if (!custmerForm.validForm('create'))// create创建流程
{
return false;
}
tabProcessId = nwflow.processId; tabProcessId = nwflow.processId;
// 保存表单数据 // 保存表单数据
custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () { custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () {
@@ -490,6 +495,11 @@ var bootstrap = function ($, learun) {
//$('#savedraft').show(); //$('#savedraft').show();
$('#savedraft').showBtn(); $('#savedraft').showBtn();
$('#savedraft').on('click', function () { $('#savedraft').on('click', function () {
// 验证表单数据完整性
if (!custmerForm.validForm('create'))// create创建流程
{
return false;
}
tabProcessId = nwflow.processId; tabProcessId = nwflow.processId;
// 保存表单数据 // 保存表单数据
custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () { custmerForm.save(nwflow.processId, nwflow.currentNode.wfForms, function () {


+ 40
- 40
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/custmerform/lr-formcomponts.js ファイルの表示

@@ -137,7 +137,7 @@
type: "html", type: "html",
proportion: '1', proportion: '1',
}; };
$component.html(getComponentRowHtml({ name: "富文本" , text: "富文本" }));
$component.html(getComponentRowHtml({ name: "富文本", text: "富文本" }));
}, },
property: function ($component) { property: function ($component) {
var dfop = $component[0].dfop; var dfop = $component[0].dfop;
@@ -421,6 +421,7 @@
table: '', table: '',
field: "", field: "",
proportion: '1', proportion: '1',
verify: '',


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


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


dataSource: '0', // 0数据字典1数据源 dataSource: '0', // 0数据字典1数据源
dataSourceId: '', dataSourceId: '',
itemCode:'',
itemCode: '',
dfvalue: '' // 默认值 dfvalue: '' // 默认值
}; };
$component.html(getComponentRowHtml({ name: $component[0].dfop.title, text: "下拉框" })); $component.html(getComponentRowHtml({ name: $component[0].dfop.title, text: "下拉框" }));
@@ -1000,7 +1002,7 @@


_html += '<div class="lr-component-title lrrelation">单位组织控件级联-上一级</div>'; _html += '<div class="lr-component-title lrrelation">单位组织控件级联-上一级</div>';
_html += '<div class="lr-component-control lrrelation"><div id="lr_component_relation"></div></div>'; _html += '<div class="lr-component-control lrrelation"><div id="lr_component_relation"></div></div>';
$html.append(_html); $html.append(_html);
// 设置多语言 // 设置多语言
$html.find('.lr-component-title').each(function () { $html.find('.lr-component-title').each(function () {
@@ -1024,11 +1026,11 @@
data: organizes, data: organizes,
value: 'id', value: 'id',
text: 'text', text: 'text',
select: function (item,type) {
select: function (item, type) {
if (!!item) { if (!!item) {
dfop.relation = item.id; dfop.relation = item.id;
} }
else if (type !== 'refresh'){
else if (type !== 'refresh') {
dfop.relation = ''; dfop.relation = '';
} }
} }
@@ -1148,7 +1150,7 @@
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
param: {} param: {}
}); });
}
}
break; break;
case "company"://公司 case "company"://公司
$compont.lrCompanySelect({}); $compont.lrCompanySelect({});
@@ -1337,7 +1339,7 @@
} }
} }


if (compont.isHide == '1') { if (compont.isHide == '1') {
$row.hide(); $row.hide();
} }
@@ -1350,18 +1352,18 @@
$row.append($compont); $row.append($compont);


switch (compont.dataType) { 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') { if (compont.isHide == '1') {
$row.hide(); $row.hide();
@@ -1633,7 +1635,7 @@
var $compont = $('<div id="' + compont.id + '"></div>'); var $compont = $('<div id="' + compont.id + '"></div>');
$row.append($compont); $row.append($compont);
compont.hideData = []; compont.hideData = [];
var headData = toGirdheadData(compont.fieldsData, compont.hideData, $compont); var headData = toGirdheadData(compont.fieldsData, compont.hideData, $compont);
if (!!compont.preloadDb && !!compont.preloadTable) { if (!!compont.preloadDb && !!compont.preloadTable) {
$compont.jfGrid({ $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); $('#lr_component_table').lrselectSet(dfop.table || designerDfop.dbTable[0].name);
} }
// 标题设置 // 标题设置
@@ -1851,7 +1852,7 @@
}; };
// 数据字典选择初始化、数据源选择初始化 // 数据字典选择初始化、数据源选择初始化
function setDatasource(dfop) { function setDatasource(dfop) {
$('#lr_component_dfvalue').lrselect({
$('#lr_component_dfvalue').lrselect({
allowSearch: true, allowSearch: true,
select: function (item) { select: function (item) {
if (!!item) { if (!!item) {
@@ -1872,7 +1873,7 @@
allowSearch: true, allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree', url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree',
type: 'tree', type: 'tree',
value:'value',
value: 'value',
select: function (item) { select: function (item) {
if (!!item) { if (!!item) {
if (dfop.dataSourceId != item.id) { if (dfop.dataSourceId != item.id) {
@@ -1918,7 +1919,7 @@
vlist[1] = item.value; vlist[1] = item.value;
dfop.dataSourceId = String(vlist); dfop.dataSourceId = String(vlist);
if (vlist[2] != '') { if (vlist[2] != '') {
learun.clientdata.getAllAsync('sourceData', { learun.clientdata.getAllAsync('sourceData', {
code: vlist[0], code: vlist[0],
callback: function (dataes) { callback: function (dataes) {
@@ -1972,12 +1973,12 @@
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetList', url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetList',
value: 'F_Code', value: 'F_Code',
text: 'F_Name', text: 'F_Name',
title:'F_Name',
title: 'F_Name',
select: function (item) { select: function (item) {
if (item) { if (item) {
if (dfop.dataSourceId != '') { if (dfop.dataSourceId != '') {
var vlist = dfop.dataSourceId.split(','); 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[1] = '';
vlist[2] = ''; vlist[2] = '';
dfop.dataSourceId = item.F_Code + ',,'; dfop.dataSourceId = item.F_Code + ',,';
@@ -1989,7 +1990,7 @@
dfop.dfvalue = ''; dfop.dfvalue = '';
} }
//$('#lr_component_dfvalue').lrselectRefresh({ url: '', data: [] }); //$('#lr_component_dfvalue').lrselectRefresh({ url: '', data: [] });


//获取字段数据 //获取字段数据
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataColName', { code: item.F_Code }, function (data) { learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataColName', { code: item.F_Code }, function (data) {
@@ -2009,7 +2010,7 @@
data: fieldData, data: fieldData,
placeholder: false placeholder: false
}); });
$('#lr_component_dataSourceId2').lrselectSet(vlist[2] ||fieldData[0].value);
$('#lr_component_dataSourceId2').lrselectSet(vlist[2] || fieldData[0].value);
}); });
} }
else { else {
@@ -2034,7 +2035,7 @@
$('#lr_component_dataItemCode').lrselectSet(dfop.itemCode); $('#lr_component_dataItemCode').lrselectSet(dfop.itemCode);
} }
else { else {
var valuelist = dfop.dataSourceId.split(',');
var valuelist = dfop.dataSourceId.split(',');
$('#lr_component_dataSourceId').lrselectSet(valuelist[0]); $('#lr_component_dataSourceId').lrselectSet(valuelist[0]);
} }


@@ -2191,7 +2192,7 @@
delete pIds[item['id']]; delete pIds[item['id']];
} }
} }
}); });
for (var id in pIds) { for (var id in pIds) {
_fn(resdata, id); _fn(resdata, id);
@@ -2213,8 +2214,7 @@
return resdata; return resdata;
} }
// html编码 // html编码
function htmlEncode(text)
{
function htmlEncode(text) {
text = text || ""; text = text || "";
text = text.replace(/%/g, "{@bai@}"); text = text.replace(/%/g, "{@bai@}");
text = text.replace(/ /g, "{@kong@}"); text = text.replace(/ /g, "{@kong@}");


+ 58
- 16
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; compontsMap[compont.table + compont.field.toLowerCase()] = compont.id;
} }
//验证表单字段权限 //验证表单字段权限
// if (compont.id in authorizeField || compont.type == 'guid') {
var $row = $('<div class="col-xs-' + (12 / parseInt(compont.proportion)) + ' lr-form-item" ></div>');
var $title = $(' <div class="lr-form-item-title">' + compont.title + getFontHtml(compont.verify) + '</div>');
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 = $('<div class="col-xs-' + (12 / parseInt(compont.proportion)) + ' lr-form-item" ></div>');
var $title = $(' <div class="lr-form-item-title">' + compont.title + getFontHtml(compont.verify) + '</div>');
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 () { $.lrValidCustmerform = function () {
var validateflag = true; var validateflag = true;
var validHelper = learun.validator; var validHelper = learun.validator;
$('body').find("[isvalid=yes]").each(function () { $('body').find("[isvalid=yes]").each(function () {
var $this = $(this); var $this = $(this);
if ($this.parent().find('.lr-field-error-info').length > 0) { if ($this.parent().find('.lr-field-error-info').length > 0) {
@@ -126,7 +127,27 @@
value = $this.lrformselectGet(); value = $this.lrformselectGet();
} }
else { 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: '' }; var r = { code: true, msg: '' };
if (checkexpession == 'LenNum' || checkexpession == 'LenNumOrNull' || checkexpession == 'LenStr' || checkexpession == 'LenStrOrNull') { if (checkexpession == 'LenNum' || checkexpession == 'LenNumOrNull' || checkexpession == 'LenStr' || checkexpession == 'LenStrOrNull') {
@@ -236,6 +257,12 @@
if ($obj.hasClass("lr-input-wdatepicker")) { if ($obj.hasClass("lr-input-wdatepicker")) {
type = "datepicker"; type = "datepicker";
} }
else if ($obj.hasClass("checkbox")) {
type = "checkbox";
}
else if ($obj.hasClass("radio")) {
type = "radio";
}
switch (type) { switch (type) {
case "lrselect": case "lrselect":
$obj.lrselectSet(value); $obj.lrselectSet(value);
@@ -243,6 +270,21 @@
case "formselect": case "formselect":
$obj.lrformselectSet(value); $obj.lrformselectSet(value);
break; 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": case "datepicker":
if ($obj.attr('dateformat') == "0") { if ($obj.attr('dateformat') == "0") {
$obj.val(learun.formatDate(value, 'yyyy-MM-dd')); $obj.val(learun.formatDate(value, 'yyyy-MM-dd'));


+ 11
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-validator.js ファイルの表示

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


読み込み中…
キャンセル
保存