提交 365c450d 编写于 作者: Skyeye云's avatar Skyeye云

表单布局新增提交完成

上级 fbd02af4
...@@ -19,6 +19,7 @@ layui.config({ ...@@ -19,6 +19,7 @@ layui.config({
// 组件分类 // 组件分类
sysDictDataUtil.showDictDataListByDictTypeCode(sysDictData["dsFormContentType"]["key"], 'select', "dsFormContentType", '', form); sysDictDataUtil.showDictDataListByDictTypeCode(sysDictData["dsFormContentType"]["key"], 'select', "dsFormContentType", '', form);
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", '', form);
// 根据类型获取部分功能的使用说明 // 根据类型获取部分功能的使用说明
systemCommonUtil.queryExplainMationByType(2, function(json) { systemCommonUtil.queryExplainMationByType(2, function(json) {
...@@ -101,6 +102,7 @@ layui.config({ ...@@ -101,6 +102,7 @@ layui.config({
jsDisplayValue: encodeURIComponent(jsDisplayValue.getValue()), jsDisplayValue: encodeURIComponent(jsDisplayValue.getValue()),
jsFitValue: encodeURIComponent(jsFitValue.getValue()), jsFitValue: encodeURIComponent(jsFitValue.getValue()),
typeId: $("#dsFormContentType").val(), typeId: $("#dsFormContentType").val(),
showType: $("#showType").val(),
linkedData: '2', linkedData: '2',
displayTemplateId: '', displayTemplateId: '',
defaultData: '', defaultData: '',
......
...@@ -47,6 +47,7 @@ layui.config({ ...@@ -47,6 +47,7 @@ layui.config({
// 组件分类 // 组件分类
sysDictDataUtil.showDictDataListByDictTypeCode(sysDictData["dsFormContentType"]["key"], 'select', "dsFormContentType", json.bean.typeId, form); sysDictDataUtil.showDictDataListByDictTypeCode(sysDictData["dsFormContentType"]["key"], 'select', "dsFormContentType", json.bean.typeId, form);
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", json.bean.showType, form);
// 根据类型获取部分功能的使用说明 // 根据类型获取部分功能的使用说明
systemCommonUtil.queryExplainMationByType(2, function (json) { systemCommonUtil.queryExplainMationByType(2, function (json) {
...@@ -140,6 +141,7 @@ layui.config({ ...@@ -140,6 +141,7 @@ layui.config({
jsDisplayValue: encodeURIComponent(jsDisplayValue.getValue()), jsDisplayValue: encodeURIComponent(jsDisplayValue.getValue()),
jsFitValue: encodeURIComponent(jsFitValue.getValue()), jsFitValue: encodeURIComponent(jsFitValue.getValue()),
typeId: $("#dsFormContentType").val(), typeId: $("#dsFormContentType").val(),
showType: $("#showType").val(),
linkedData: '2', linkedData: '2',
displayTemplateId: '', displayTemplateId: '',
defaultData: '', defaultData: '',
......
...@@ -29,6 +29,9 @@ layui.config({ ...@@ -29,6 +29,9 @@ layui.config({
{ field: 'numCode', title: '编码', width: 120 }, { field: 'numCode', title: '编码', width: 120 },
{ field: 'name', title: '名称', width: 120 }, { field: 'name', title: '名称', width: 120 },
{ field: 'typeName', title: '分类', width: 120 }, { field: 'typeName', title: '分类', width: 120 },
{ field: 'showType', title: '显示类型', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', d.showType, 'name');
}},
{ field: 'id', title: '图标', align: 'center', width: 60, templet: function (d) { { field: 'id', title: '图标', align: 'center', width: 60, templet: function (d) {
return systemCommonUtil.initIconShow(d); return systemCommonUtil.initIconShow(d);
}}, }},
......
...@@ -25,7 +25,7 @@ layui.config({ ...@@ -25,7 +25,7 @@ layui.config({
if (!isNull(json.bean.dsFormPageMations)) { if (!isNull(json.bean.dsFormPageMations)) {
$.each(json.bean.dsFormPageMations, function (i, item) { $.each(json.bean.dsFormPageMations, function (i, item) {
addRow(); addRow();
$("#dsFormChooseList" + (rowNum - 1)).val(item.pageNum); $("#dsFormChooseList" + (rowNum - 1)).val(item.numCode);
$("#dsFormChooseList" + (rowNum - 1)).attr("dataId", item.id); $("#dsFormChooseList" + (rowNum - 1)).attr("dataId", item.id);
$("#name" + (rowNum - 1)).html(item.name); $("#name" + (rowNum - 1)).html(item.name);
}) })
...@@ -85,7 +85,7 @@ layui.config({ ...@@ -85,7 +85,7 @@ layui.config({
var btnId = par.dsFormChooseList + "Btn"; var btnId = par.dsFormChooseList + "Btn";
$("body").on("click", "#" + btnId, function (e) { $("body").on("click", "#" + btnId, function (e) {
dsFormUtil.chooseType = false; // 单选 dsFormUtil.chooseType = false; // 单选
dsFormUtil.openDsFormPageChoosePage(function (){ dsFormUtil.openDsFormPageChoosePage(function () {
$("#" + par.dsFormChooseList).val(dsFormUtil.dsFormChooseMation.numCode); $("#" + par.dsFormChooseList).val(dsFormUtil.dsFormChooseMation.numCode);
$("#" + par.dsFormChooseList).attr("dataId", dsFormUtil.dsFormChooseMation.id); $("#" + par.dsFormChooseList).attr("dataId", dsFormUtil.dsFormChooseMation.id);
$("#" + par.name).html(dsFormUtil.dsFormChooseMation.name); $("#" + par.name).html(dsFormUtil.dsFormChooseMation.name);
......
...@@ -30,13 +30,13 @@ layui.config({ ...@@ -30,13 +30,13 @@ layui.config({
// 加载新增加的控件信息 // 加载新增加的控件信息
function loadNewControl(item) { function loadNewControl(item) {
if(item.associatedDataTypes == 1){//json串 if (item.associatedDataTypes == 1) {//json串
var obj = item.aData; var obj = item.aData;
if(typeof item.aData == 'string'){ if(typeof item.aData == 'string'){
obj = JSON.parse(item.aData); obj = JSON.parse(item.aData);
} }
item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj); item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj);
} else if (item.associatedDataTypes == 2){//接口 } else if (item.associatedDataTypes == 2) {//接口
AjaxPostUtil.request({url: flowableBasePath + "dsformpage011", params: {interfa: item.aData}, type: 'json', callback: function(j){ AjaxPostUtil.request({url: flowableBasePath + "dsformpage011", params: {interfa: item.aData}, type: 'json', callback: function(j){
var obj = JSON.parse(j.bean.aData); var obj = JSON.parse(j.bean.aData);
item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj); item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj);
......
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">显示类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="showType" lay-search="" id="showType" win-verify="required">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">HTML脚本<i class="red">*</i></label> <label class="layui-form-label">HTML脚本<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
......
...@@ -47,6 +47,14 @@ ...@@ -47,6 +47,14 @@
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">显示类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="showType" lay-search="" id="showType" win-verify="required">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">HTML脚本<i class="red">*</i></label> <label class="layui-form-label">HTML脚本<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<input type="text" id="{{dsFormChooseList}}" name="{{dsFormChooseList}}" placeholder="请选择表单" class="layui-input" win-verify="required" readonly="readonly"/> <input type="text" id="{{dsFormChooseList}}" name="{{dsFormChooseList}}" placeholder="请选择表单" class="layui-input" win-verify="required" readonly="readonly"/>
<i class="fa fa-plus-circle input-icon" id="{{dsFormChooseList}}Btn" style="top: 12px;"></i> <i class="fa fa-plus-circle input-icon" id="{{dsFormChooseList}}Btn" style="top: 12px;"></i>
</td> </td>
<td id="{{pageName}}"></td> <td id="{{name}}"></td>
</tr> </tr>
</script> </script>
......
...@@ -78,9 +78,9 @@ layui.config({ ...@@ -78,9 +78,9 @@ layui.config({
initTableChooseUtil.deleteAllRow('productList'); initTableChooseUtil.deleteAllRow('productList');
$.each(json.bean.norms, function(i, item) { $.each(json.bean.norms, function(i, item) {
var params = { var params = {
"materialId": item.product.materialName + "(" + item.product.materialModel + ")", "materialId": item.materialName + "(" + item.materialModel + ")",
"mUnitId": { "mUnitId": {
"html": getDataUseHandlebars(selOption, {rows: item.product.unitList}), "html": getDataUseHandlebars(selOption, {rows: item.unitList}),
"value": item.mUnitId "value": item.mUnitId
}, },
"allStock": item.allStock, "allStock": item.allStock,
...@@ -95,7 +95,7 @@ layui.config({ ...@@ -95,7 +95,7 @@ layui.config({
}; };
var trcusid = initTableChooseUtil.resetData('productList', params); var trcusid = initTableChooseUtil.resetData('productList', params);
// 将规格所属的商品信息加入到对象中存储 // 将规格所属的商品信息加入到对象中存储
allChooseProduct[trcusid] = item.product; allChooseProduct[trcusid] = item;
}); });
textool.init({eleId: 'remark', maxlength: 200}); textool.init({eleId: 'remark', maxlength: 200});
......
...@@ -9,6 +9,7 @@ var dsFormUtil = { ...@@ -9,6 +9,7 @@ var dsFormUtil = {
dsFormDataKey: "initData", dsFormDataKey: "initData",
dsFormBtnTemplate: '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" id="{{btnId}}">表单选择</button>', dsFormBtnTemplate: '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" id="{{btnId}}">表单选择</button>',
customDsFormBox: '<div class="layui-form-item layui-col-xs12"><span class="hr-title">{{dsFormPage.name}}</span><hr></div><div id="{{dsFormPage.id}}" class="ds-form-page layui-col-xs12"></div>', customDsFormBox: '<div class="layui-form-item layui-col-xs12"><span class="hr-title">{{dsFormPage.name}}</span><hr></div><div id="{{dsFormPage.id}}" class="ds-form-page layui-col-xs12"></div>',
customWriteDsFormBox: '<div class="layui-form-item layui-col-xs12"><span class="hr-title">{{name}}</span><hr></div><div id="{{id}}" class="ds-form-page layui-col-xs12"></div>',
// 必须包含的包 // 必须包含的包
mastHaveImport: ['laydate', 'layedit', 'colorpicker', 'slider', 'fileUpload', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx', 'solr', 'sql', 'vue', mastHaveImport: ['laydate', 'layedit', 'colorpicker', 'slider', 'fileUpload', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx', 'solr', 'sql', 'vue',
'matchbrackets', 'closebrackets', 'showHint', 'anywordHint', 'lint', 'jsonLint', 'foldcode', 'foldgutter', 'braceFold', 'commentFold', 'form'], 'matchbrackets', 'closebrackets', 'showHint', 'anywordHint', 'lint', 'jsonLint', 'foldcode', 'foldgutter', 'braceFold', 'commentFold', 'form'],
...@@ -97,90 +98,116 @@ var dsFormUtil = { ...@@ -97,90 +98,116 @@ var dsFormUtil = {
dsFormObjectRelationId: isNull(dsFormObjectRelationId) ? "" : dsFormObjectRelationId dsFormObjectRelationId: isNull(dsFormObjectRelationId) ? "" : dsFormObjectRelationId
}; };
AjaxPostUtil.request({url: reqBasePath + "dsFormObjectRelation006", params: params, method: "GET", type: 'json', callback: function(json) { AjaxPostUtil.request({url: reqBasePath + "dsFormObjectRelation006", params: params, method: "GET", type: 'json', callback: function(json) {
dsFormUtil.loadDsFormItem(showBoxId, json); dsFormUtil.loadAddDsFormItem(showBoxId, json);
}, async: false}); }, async: false});
}, },
loadDsFormItem: function(showBoxId, json) { loadAddDsFormItem: function(showBoxId, json) {
$.each(json.rows, function(j, bean){ $.each(json.rows, function(j, bean) {
var customBoxId = bean.dsFormPage.id; var customBoxId = bean.id;
$("#" + showBoxId).append(getDataUseHandlebars(dsFormUtil.customDsFormBox, bean)); $("#" + showBoxId).append(getDataUseHandlebars(dsFormUtil.customWriteDsFormBox, bean));
dsFormUtil.loadDsFormItemToEdit(customBoxId, bean.content); dsFormUtil.loadDsFormItemToAdd(customBoxId, bean.content);
});
form.render();
},
loadDsFormItemToAdd: function (customBoxId, rows) {
$.each(rows, function(i, item) {
item.value = item.defaultValue;
dsFormUtil.setValue(customBoxId, item, i);
});
},
loadEditDsFormItem: function(showBoxId, json) {
$.each(json.rows, function(j, bean) {
var customBoxId = bean.pageId;
$("#" + showBoxId).append(getDataUseHandlebars(dsFormUtil.customWriteDsFormBox, bean.dsFormPage));
dsFormUtil.loadDsFormItemToEdit(customBoxId, bean.dsFormPageDataList);
}); });
form.render(); form.render();
}, },
loadDsFormItemToEdit: function (customBoxId, rows) { loadDsFormItemToEdit: function (customBoxId, rows) {
$.each(rows, function(i, item) { $.each(rows, function(i, item) {
if (item.associatedDataTypes == 1) {//json串 var pageComponent = item.dsFormPageContent;
var obj = item.aData; pageComponent.value = item.value;
if(typeof item.aData == 'string'){ dsFormUtil.setValue(customBoxId, pageComponent, i);
obj = JSON.parse(item.aData); });
} },
item.context = getDataUseHandlebars(item.templateContent, obj);
} else if (item.associatedDataTypes == 2) {//接口 setValue: function (customBoxId, item, i) {
AjaxPostUtil.request({url: flowableBasePath + "dsformpage011", params: {interfa: item.aData}, type: 'json', callback: function(j) { if (item.associatedDataTypes == 1) {//json串
var obj = JSON.parse(j.bean.aData); var obj = item.aData;
item.context = getDataUseHandlebars(item.templateContent, obj); if(typeof item.aData == 'string'){
}, async: false}); obj = JSON.parse(item.aData);
} }
var jsonStr = {bean: item}; item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj);
var html = getDataUseHandlebars('{{#bean}}' + item.htmlContent + '{{/bean}}', jsonStr); } else if (item.associatedDataTypes == 2) {//接口
var html_js = getDataUseHandlebars('{{#bean}}' + item.jsContent + '{{/bean}}', jsonStr); AjaxPostUtil.request({url: flowableBasePath + "dsformpage011", params: {interfa: item.aData}, type: 'json', callback: function(j) {
var jsCon = '<script>layui.define(["jquery"], function(exports) {var jQuery = layui.jquery;(function($) {' + html_js + '})(jQuery);});</script>'; var obj = JSON.parse(j.bean.aData);
$("#" + customBoxId).append(html + jsCon); item.context = getDataUseHandlebars(item.dsFormComponent.templateContent, obj);
}, async: false});
}
var jsonStr = {bean: item};
var html = getDataUseHandlebars('{{#bean}}' + item.dsFormComponent.htmlContent + '{{/bean}}', jsonStr);
var html_js = getDataUseHandlebars('{{#bean}}' + item.dsFormComponent.jsContent + '{{/bean}}', jsonStr);
var jsCon = '<script>layui.define(["jquery"], function(exports) {var jQuery = layui.jquery;(function($) {' + html_js + '})(jQuery);});</script>';
$("#" + customBoxId).append(html + jsCon);
// 给能通过id赋值的控件赋值 // 给能通过id赋值的控件赋值
$("#" + item.id).val(item.value); $("#" + item.id).val(item.value);
var _this = $("#" + customBoxId + " .layui-form-item").eq(i);//当前控件 var _this = $("#" + customBoxId + " .layui-form-item").eq(i);
if (!isNull(item.require) && item.require.indexOf("required") >= 0){ if (!isNull(item.require) && item.require.indexOf("required") >= 0){
_this.find(".layui-form-label").append('<i class="red">*</i>'); _this.find(".layui-form-label").append('<i class="red">*</i>');
}
_this.attr("controId", item.id);
var vid = _this.attr("controlType");//控件类型
if (vid === 'color') {//类型为颜色选择器
_this.find("input").val(item.value);
_this.find('div[id="' + item.id + '"]').find("span .layui-colorpicker-trigger-span").attr("style", "background:" + item.value);
} else if (vid === 'switchedradio') {//类型为开关式单选框
_this.find("input").val(item.value);
if (item.value === 'true' || item.value == true) {
_this.find("input").prop("checked", true);
} }
_this.attr("controId", item.id); _this.find("input").attr('id', item.id);
var vid = _this.attr("controlType");//控件类型 _this.find("input").attr('name', item.id);
if (vid === 'color') {//类型为颜色选择器 _this.find("input").attr('lay-filter', item.id);
_this.find("input").val(item.value); } else if (vid === 'radio') {//类型为单选框
_this.find('div[id="' + item.id + '"]').find("span .layui-colorpicker-trigger-span").attr("style", "background:" + item.value); _this.find("input:radio").attr("name", item.id);
} else if (vid === 'switchedradio') {//类型为开关式单选框 if (!isNull(item.value))
_this.find("input").val(item.value); _this.find("input:radio[value=" + item.value + "]").attr("checked", true);
if (item.value === 'true' || item.value == true) { } else if (vid === 'richtextarea') {//类型为富文本框
_this.find("input").prop("checked", true); _this.find('iframe[textarea="' + item.id + '"]').contents().find("body").html(item.value);
} } else if (vid === 'checkbox') {//类型为多选框
_this.find("input").attr('id', item.id); var checkArray = item.value.split(",");
_this.find("input").attr('name', item.id); var checkBoxAll = _this.find("input:checkbox");
_this.find("input").attr('lay-filter', item.id); checkBoxAll.attr("name", item.id);
} else if (vid === 'radio') {//类型为单选框 for (var k = 0; k < checkArray.length; k++) {
_this.find("input:radio").attr("name", item.id); $.each(checkBoxAll, function (j, item) {
if (!isNull(item.value)) if (checkArray[k] == $(this).val()) {
_this.find("input:radio[value=" + item.value + "]").attr("checked", true); $(this).prop("checked", true);
} else if (vid === 'richtextarea') {//类型为富文本框 }
_this.find('iframe[textarea="' + item.id + '"]').contents().find("body").html(item.value); });
} else if (vid === 'checkbox') {//类型为多选框
var checkArray = item.value.split(",");
var checkBoxAll = _this.find("input:checkbox");
checkBoxAll.attr("name", item.id);
for (var k = 0; k < checkArray.length; k++) {
$.each(checkBoxAll, function (j, item) {
if (checkArray[k] == $(this).val()) {
$(this).prop("checked", true);
}
});
}
} }
}); }
}, },
/** /**
* 获取保存的数据 * 获取保存的数据
*/ */
savePageData: function (showBoxId, objectId) { savePageData: function (showBoxId, objectId) {
var result = {}; var result = [];
$.each($("#" + showBoxId + " .ds-form-page"), function (i, item) { $.each($("#" + showBoxId + " .ds-form-page"), function (i, item) {
var _item = $(item); var _item = $(item);
result[_item.attr("id")] = dsFormUtil.getPageData(_item); result.push({
pageId: _item.attr("id"),
dsFormPageDataList: dsFormUtil.getPageData(_item)
});
}); });
var params = { var params = {
dataJson: JSON.stringify(result), dsFormPageSequenceList: JSON.stringify(result),
objectId: objectId objectId: objectId
} }
AjaxPostUtil.request({url: flowableBasePath + "dsformpage014", params: params, type: 'json', method: "POST", callback: function(json) { AjaxPostUtil.request({url: flowableBasePath + "dsformpage014", params: params, type: 'json', method: "POST", callback: function(json) {
...@@ -192,18 +219,16 @@ var dsFormUtil = { ...@@ -192,18 +219,16 @@ var dsFormUtil = {
for(var i = 0; i < _item.find(".layui-form-item").length; i++){ for(var i = 0; i < _item.find(".layui-form-item").length; i++){
var _this = _item.find(".layui-form-item").eq(i); var _this = _item.find(".layui-form-item").eq(i);
var vid = _this.attr("controlType"),//控件类型 var vid = _this.attr("controlType"),//控件类型
showType = "", text = "", value = ""; text = "", value = "";
if (isNull(vid)) { if (isNull(vid)) {
continue; continue;
} }
if (vid === 'textarea') {//类型为文本框 if (vid === 'textarea') {//类型为文本框
text = _this.find("textarea").val(); text = _this.find("textarea").val();
value = _this.find("textarea").val(); value = _this.find("textarea").val();
showType = "1";
} else if (vid === 'select') {//类型为下拉框 } else if (vid === 'select') {//类型为下拉框
text = _this.find("select").find("option:selected").text(); text = _this.find("select").find("option:selected").text();
value = _this.find("select").val(); value = _this.find("select").val();
showType = "1";
} else if (vid === 'checkbox') {//类型为多选框 } else if (vid === 'checkbox') {//类型为多选框
var checkName = _this.find("input:first").attr("name"); var checkName = _this.find("input:first").attr("name");
var texts = [], values = []; var texts = [], values = [];
...@@ -214,11 +239,9 @@ var dsFormUtil = { ...@@ -214,11 +239,9 @@ var dsFormUtil = {
}); });
text = texts.join(","); text = texts.join(",");
value = values.join(","); value = values.join(",");
showType = "1";
} else if (vid === 'radio') {//类型为单选框 } else if (vid === 'radio') {//类型为单选框
text = _this.find("input:radio:checked").attr("title"); text = _this.find("input:radio:checked").attr("title");
value = _this.find("input:radio:checked").val(); value = _this.find("input:radio:checked").val();
showType = "1";
} else if (vid === 'upload') {//类型为图片上传 } else if (vid === 'upload') {//类型为图片上传
var uploadId = _this.find(".upload").attr("id"); var uploadId = _this.find(".upload").attr("id");
text = $("#" + uploadId).find("input[type='hidden'][name='upload']").attr("oldurl"); text = $("#" + uploadId).find("input[type='hidden'][name='upload']").attr("oldurl");
...@@ -227,17 +250,14 @@ var dsFormUtil = { ...@@ -227,17 +250,14 @@ var dsFormUtil = {
text = ""; text = "";
if (isNull(value)) if (isNull(value))
value = ""; value = "";
showType = "4";
} else if (vid === 'range') {//类型为滑块 } else if (vid === 'range') {//类型为滑块
text = _this.find(".layui-slider-tips").html(); text = _this.find(".layui-slider-tips").html();
value = _this.find(".layui-slider-tips").html(); value = _this.find(".layui-slider-tips").html();
showType = "1";
} else if (vid === 'richtextarea') {//类型为富文本框 } else if (vid === 'richtextarea') {//类型为富文本框
var textareaId = _this.find("textarea").attr("id"); var textareaId = _this.find("textarea").attr("id");
var content = encodeURIComponent(_this.find('iframe[textarea="' + textareaId + '"]').contents().find("body").html()); var content = encodeURIComponent(_this.find('iframe[textarea="' + textareaId + '"]').contents().find("body").html());
text = content; text = content;
value = content; value = content;
showType = "3";
} else if (vid === 'switchedradio') {//类型为开关式单选框 } else if (vid === 'switchedradio') {//类型为开关式单选框
value = _this.find("input").val(); value = _this.find("input").val();
var layText = _this.find("input").attr('lay-text'); var layText = _this.find("input").attr('lay-text');
...@@ -246,18 +266,14 @@ var dsFormUtil = { ...@@ -246,18 +266,14 @@ var dsFormUtil = {
} else { } else {
text = layText.split('|')[1]; text = layText.split('|')[1];
} }
showType = "1";
} else { } else {
text = _this.find("input").val(); text = _this.find("input").val();
value = _this.find("input").val(); value = _this.find("input").val();
showType = "1";
} }
list.push({ list.push({
value: value, value: value,
text: text, displayValue: text,
showType: showType, contentId: _this.attr("controId")
controlType: vid,
rowId: _this.attr("controId")
}); });
} }
return list; return list;
...@@ -274,11 +290,64 @@ var dsFormUtil = { ...@@ -274,11 +290,64 @@ var dsFormUtil = {
$.each(json.rows, function(j, bean) { $.each(json.rows, function(j, bean) {
var customBoxId = bean.dsFormPage.id; var customBoxId = bean.dsFormPage.id;
$("#" + showBoxId).append(getDataUseHandlebars(dsFormUtil.customDsFormBox, bean)); $("#" + showBoxId).append(getDataUseHandlebars(dsFormUtil.customDsFormBox, bean));
dsFormUtil.initSequenceDataDetails(customBoxId, bean.content); dsFormUtil.initSequencePageDataDetails(customBoxId, bean.dsFormPageDataList);
}); });
}, async: false}); }, async: false});
}, },
/**
* 表单布局的详情展示
*
* @param customBoxId
* @param rows
*/
initSequencePageDataDetails: function (customBoxId, rows) {
$.each(rows, function (i, item) {
item.label = item.dsFormPageContent.title;
item.proportion = item.dsFormPageContent.width;
var jsonStr = {
bean: item
};
var showType = item.dsFormPageContent.dsFormComponent.showType;
if (showType == 4) { // 图片展示
var photoValue = [];
if (!isNull(jsonStr.bean.displayValue)) {
photoValue = item.displayValue.split(",");
}
var rows = [];
$.each(photoValue, function(j, row){
rows.push({photoValue: row});
});
jsonStr.bean.photo = rows;
}
// 加载html
var str = getDataUseHandlebars(dsFormUtil.showType[showType], jsonStr);
$("#" + customBoxId).append(str);
if (showType == 5) { // 表格展示
var table = layui.table;
table.render({
id: "messageTable" + item.orderBy,
elem: "#messageTable" + item.orderBy,
data: item.displayValue,
page: false,
cols: dsFormUtil.getTableHead(item.attrTransformTableList)
});
} else if (showType == 6) { // 凭证展示
var boxId = "showVoucher" + item.orderBy;
// 初始化凭证
voucherUtil.initDataDetails(boxId, item.value);
}
});
},
/**
* 目前用于工作流详情展示
*
* @param customBoxId
* @param rows
*/
initSequenceDataDetails: function (customBoxId, rows) { initSequenceDataDetails: function (customBoxId, rows) {
$.each(rows, function (i, item) { $.each(rows, function (i, item) {
var jsonStr = { var jsonStr = {
...@@ -286,7 +355,7 @@ var dsFormUtil = { ...@@ -286,7 +355,7 @@ var dsFormUtil = {
}; };
if (item.showType == 4) { // 图片展示 if (item.showType == 4) { // 图片展示
var photoValue = []; var photoValue = [];
if (!isNull(jsonStr.bean.displayValue)){ if (!isNull(jsonStr.bean.displayValue)) {
photoValue = item.displayValue.split(","); photoValue = item.displayValue.split(",");
} }
var rows = []; var rows = [];
...@@ -343,7 +412,7 @@ var dsFormUtil = { ...@@ -343,7 +412,7 @@ var dsFormUtil = {
*/ */
loadPageToEditByObjectId: function(showBoxId, objectId) { loadPageToEditByObjectId: function(showBoxId, objectId) {
AjaxPostUtil.request({url: flowableBasePath + "dsformpage015", params: {objectId: objectId}, method: "GET", type: 'json', callback: function (json) { AjaxPostUtil.request({url: flowableBasePath + "dsformpage015", params: {objectId: objectId}, method: "GET", type: 'json', callback: function (json) {
dsFormUtil.loadDsFormItem(showBoxId, json); dsFormUtil.loadEditDsFormItem(showBoxId, json);
}, async: false}); }, async: false});
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册