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

动态表单模块迁移到基础模块

上级 54ed26c9
...@@ -39,7 +39,12 @@ layui.config({ ...@@ -39,7 +39,12 @@ layui.config({
{ field: 'attrKey', title: '属性', align: 'left', width: 150 }, { field: 'attrKey', title: '属性', align: 'left', width: 150 },
{ field: 'name', title: '名称', align: 'left', width: 120 }, { field: 'name', title: '名称', align: 'left', width: 120 },
{ field: 'attrType', title: '类型', align: 'left', width: 120 }, { field: 'attrType', title: '类型', align: 'left', width: 120 },
{ field: 'remark', title: '备注', align: 'left', width: 150 }, { field: 'componentName', title: '关联组件', align: 'left', width: 140, templet: function (d) {
if (!isNull(d.dsFormComponent)) {
return d.dsFormComponent.name;
}
return '';
}},
{ field: 'required', title: '限制条件', align: 'left', width: 140 }, { field: 'required', title: '限制条件', align: 'left', width: 140 },
{ field: 'modelAttribute', title: '是否模型属性', align: 'center', width: 100, templet: function (d) { { field: 'modelAttribute', title: '是否模型属性', align: 'center', width: 100, templet: function (d) {
if (d.modelAttribute) { if (d.modelAttribute) {
...@@ -53,6 +58,7 @@ layui.config({ ...@@ -53,6 +58,7 @@ layui.config({
} }
return ''; return '';
}}, }},
{ field: 'remark', title: '备注', align: 'left', width: 150 },
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar' } { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar' }
]], ]],
done: function(json) { done: function(json) {
......
...@@ -4,7 +4,7 @@ layui.config({ ...@@ -4,7 +4,7 @@ layui.config({
version: skyeyeVersion version: skyeyeVersion
}).extend({ }).extend({
window: 'js/winui.window' window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'form', 'textool'], function (exports) { }).define(['window', 'jquery', 'winui', 'form', 'textool', 'eleTree'], function (exports) {
winui.renderColor(); winui.renderColor();
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$, var $ = layui.$,
...@@ -18,6 +18,19 @@ layui.config({ ...@@ -18,6 +18,19 @@ layui.config({
$("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), json)); $("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), json));
textool.init({eleId: 'remark', maxlength: 200}); textool.init({eleId: 'remark', maxlength: 200});
// 加载组件信息
treeSelectUtil.init({
eleTree: layui.eleTree,
elem: 'componentId',
url: reqBasePath + "queryAllDsFormComponentList",
defaultId: json.bean.componentId
});
// 如果不是入参属性,则不能设置特定的一些值
if (!json.bean.attrDefinition.whetherInputParams) {
$('.inputParams').hide();
}
var id = isNull(json.bean.id) ? '' : json.bean.id; var id = isNull(json.bean.id) ? '' : json.bean.id;
matchingLanguage(); matchingLanguage();
form.render(); form.render();
...@@ -27,6 +40,9 @@ layui.config({ ...@@ -27,6 +40,9 @@ layui.config({
className: className, className: className,
attrKey: attrKey, attrKey: attrKey,
name: $("#name").val(), name: $("#name").val(),
componentId: isNull($("#componentId").val()) ? "" : $("#componentId").attr("componentId"),
minLength: $("#minLength").val(),
maxLength: $("#maxLength").val(),
remark: $("#remark").val(), remark: $("#remark").val(),
id: id id: id
}; };
......
...@@ -27,7 +27,27 @@ ...@@ -27,7 +27,27 @@
<div class="layui-form-item layui-col-xs6"> <div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">名称<i class="red">*</i></label> <label class="layui-form-label">名称<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" id="name" name="name" win-verify="required" placeholder="请输入名称" class="layui-input" maxlength="10" value="{{name}}"/> <input type="text" id="name" name="name" win-verify="required" placeholder="请输入名称" class="layui-input" maxlength="100" value="{{name}}"/>
</div>
</div>
<div class="inputParams">
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">组件</label>
<div class="layui-input-block">
<input type="text" id="componentId" name="componentId" placeholder="请选择组件" class="layui-input" readonly="readonly" componentId=""/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">最小长度</label>
<div class="layui-input-block">
<input type="text" id="minLength" name="minLength" win-verify="number" placeholder="请输入最小长度" class="layui-input" value="{{minLength}}"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">最大长度</label>
<div class="layui-input-block">
<input type="text" id="maxLength" name="maxLength" win-verify="number" placeholder="请输入最大长度" class="layui-input" value="{{maxLength}}"/>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
......
...@@ -48,7 +48,7 @@ layui.config({ ...@@ -48,7 +48,7 @@ layui.config({
initDatatpl = true; initDatatpl = true;
showGrid({ showGrid({
id: "displayTemplateId", id: "displayTemplateId",
url: flowableBasePath + "dsformdisplaytemplate006", url: reqBasePath + "dsformdisplaytemplate006",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
...@@ -68,9 +68,9 @@ layui.config({ ...@@ -68,9 +68,9 @@ layui.config({
} else { } else {
$.each(jsonStr, function(i, item) { $.each(jsonStr, function(i, item) {
if (displayTemplateValue == item.id) { if (displayTemplateValue == item.id) {
var str = '<textarea class="layui-textarea" readonly>' + item.templateContent + '</textarea>'; var str = '<textarea class="layui-textarea" readonly>' + item.content + '</textarea>';
$("#templateContent").html(str); $("#templateContent").html(str);
tplContentVal = strMatchAllByTwo(item.templateContent, '{{','}}');//取出数据模板中用{{}}包裹的词 tplContentVal = strMatchAllByTwo(item.content, '{{','}}');//取出数据模板中用{{}}包裹的词
removeByValue(tplContentVal, "#each this"); removeByValue(tplContentVal, "#each this");
removeByValue(tplContentVal, "/each"); removeByValue(tplContentVal, "/each");
return false; return false;
...@@ -138,7 +138,7 @@ layui.config({ ...@@ -138,7 +138,7 @@ layui.config({
if (!params["iconChooseResult"]) { if (!params["iconChooseResult"]) {
return false; return false;
} }
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormComponent", params: params, type: 'json', method: 'POST', callback: function(json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormComponent", params: params, type: 'json', method: 'POST', callback: function(json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -16,7 +16,7 @@ layui.config({ ...@@ -16,7 +16,7 @@ layui.config({
showGrid({ showGrid({
id: "showForm", id: "showForm",
url: flowableBasePath + "queryDsFormComponentMationById", url: reqBasePath + "queryDsFormComponentMationById",
params: {id: parent.rowId}, params: {id: parent.rowId},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
...@@ -66,9 +66,9 @@ layui.config({ ...@@ -66,9 +66,9 @@ layui.config({
if (json.bean.linkedData == 1) { if (json.bean.linkedData == 1) {
$(".dataTpl").removeClass("layui-hide"); $(".dataTpl").removeClass("layui-hide");
initDisplayTemplate(json.bean.displayTemplateId);//初始化关联的数据类型 initDisplayTemplate(json.bean.displayTemplateId);//初始化关联的数据类型
var str = '<textarea class="layui-textarea" readonly>' + json.bean.templateContent + '</textarea>'; var str = '<textarea class="layui-textarea" readonly>' + json.bean.dsFormDisplayTemplate.content + '</textarea>';
$("#templateContent").html(str); $("#templateContent").html(str);
tplContentVal = strMatchAllByTwo(json.bean.templateContent, '{{', '}}');//取出数据模板中用{{}}包裹的词 tplContentVal = strMatchAllByTwo(json.bean.dsFormDisplayTemplate.content, '{{', '}}');//取出数据模板中用{{}}包裹的词
removeByValue(tplContentVal, "#each this"); removeByValue(tplContentVal, "#each this");
removeByValue(tplContentVal, "/each"); removeByValue(tplContentVal, "/each");
} }
...@@ -93,7 +93,7 @@ layui.config({ ...@@ -93,7 +93,7 @@ layui.config({
initDatatpl = true; initDatatpl = true;
showGrid({ showGrid({
id: "displayTemplateId", id: "displayTemplateId",
url: flowableBasePath + "dsformdisplaytemplate006", url: reqBasePath + "dsformdisplaytemplate006",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
...@@ -114,9 +114,9 @@ layui.config({ ...@@ -114,9 +114,9 @@ layui.config({
} else { } else {
$.each(jsonStr, function(i, item) { $.each(jsonStr, function(i, item) {
if (displayTemplateValue == item.id) { if (displayTemplateValue == item.id) {
var str = '<textarea class="layui-textarea" readonly>' + item.templateContent + '</textarea>'; var str = '<textarea class="layui-textarea" readonly>' + item.content + '</textarea>';
$("#templateContent").html(str); $("#templateContent").html(str);
tplContentVal = strMatchAllByTwo(item.templateContent, '{{','}}');//取出数据模板中用{{}}包裹的词 tplContentVal = strMatchAllByTwo(item.content, '{{','}}');//取出数据模板中用{{}}包裹的词
removeByValue(tplContentVal, "#each this"); removeByValue(tplContentVal, "#each this");
removeByValue(tplContentVal, "/each"); removeByValue(tplContentVal, "/each");
return false; return false;
...@@ -180,7 +180,7 @@ layui.config({ ...@@ -180,7 +180,7 @@ layui.config({
return false; return false;
} }
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormComponent", params: params, type: 'json', method: 'POST', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormComponent", params: params, type: 'json', method: 'POST', callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -18,7 +18,7 @@ layui.config({ ...@@ -18,7 +18,7 @@ layui.config({
id: 'messageTable', id: 'messageTable',
elem: '#messageTable', elem: '#messageTable',
method: 'post', method: 'post',
url: flowableBasePath + 'queryDsFormComponentList', url: reqBasePath + 'queryDsFormComponentList',
where: getTableParams(), where: getTableParams(),
even: true, even: true,
page: true, page: true,
...@@ -65,7 +65,7 @@ layui.config({ ...@@ -65,7 +65,7 @@ layui.config({
function del(data, obj) { function del(data, obj) {
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) { layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) {
layer.close(index); layer.close(index);
AjaxPostUtil.request({url: flowableBasePath + "deleteDsFormComponentMationById", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "deleteDsFormComponentMationById", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000}); winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable(); loadTable();
}}); }});
......
...@@ -39,7 +39,7 @@ layui.config({ ...@@ -39,7 +39,7 @@ layui.config({
name: $("#name").val(), name: $("#name").val(),
content: encodeURIComponent(content.getValue()) content: encodeURIComponent(content.getValue())
}; };
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormDisplayTemplate", params: params, type: 'json', method: 'POST', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormDisplayTemplate", params: params, type: 'json', method: 'POST', callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -13,7 +13,7 @@ layui.config({ ...@@ -13,7 +13,7 @@ layui.config({
showGrid({ showGrid({
id: "showForm", id: "showForm",
url: flowableBasePath + "dsformdisplaytemplate004", url: reqBasePath + "dsformdisplaytemplate004",
params: {id: parent.rowId}, params: {id: parent.rowId},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
...@@ -52,7 +52,7 @@ layui.config({ ...@@ -52,7 +52,7 @@ layui.config({
content: encodeURIComponent(content.getValue()), content: encodeURIComponent(content.getValue()),
id: parent.rowId id: parent.rowId
}; };
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormDisplayTemplate", params: params, type: 'json', method: 'POST', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormDisplayTemplate", params: params, type: 'json', method: 'POST', callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -31,7 +31,7 @@ layui.config({ ...@@ -31,7 +31,7 @@ layui.config({
id: 'messageTable', id: 'messageTable',
elem: '#messageTable', elem: '#messageTable',
method: 'post', method: 'post',
url: flowableBasePath + 'dsformdisplaytemplate001', url: reqBasePath + 'dsformdisplaytemplate001',
where: getTableParams(), where: getTableParams(),
even: true, even: true,
page: true, page: true,
...@@ -85,7 +85,7 @@ layui.config({ ...@@ -85,7 +85,7 @@ layui.config({
function del(data, obj) { function del(data, obj) {
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) { layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) {
layer.close(index); layer.close(index);
AjaxPostUtil.request({url: flowableBasePath + "dsformdisplaytemplate003", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "dsformdisplaytemplate003", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000}); winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable(); loadTable();
}}); }});
......
...@@ -19,7 +19,7 @@ layui.config({ ...@@ -19,7 +19,7 @@ layui.config({
authBtn('1567732055673');//保存控件 authBtn('1567732055673');//保存控件
AjaxPostUtil.request({url: flowableBasePath + "dsformpage004", params: {pageId: parent.rowId}, type: 'json', method: 'GET', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "dsformpage004", params: {pageId: parent.rowId}, type: 'json', method: 'GET', callback: function (json) {
// 加载表单控件 // 加载表单控件
loadLeftBoxItem(); loadLeftBoxItem();
// 加载拖拽 // 加载拖拽
...@@ -37,7 +37,7 @@ layui.config({ ...@@ -37,7 +37,7 @@ layui.config({
} }
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: reqBasePath + "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);
}, async: false}); }, async: false});
...@@ -83,7 +83,7 @@ layui.config({ ...@@ -83,7 +83,7 @@ layui.config({
function loadLeftBoxItem(){ function loadLeftBoxItem(){
showGrid({ showGrid({
id: "btnBox", id: "btnBox",
url: flowableBasePath + "queryDsFormComponentMationToShow", url: reqBasePath + "queryAllDsFormComponentList",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
...@@ -179,7 +179,7 @@ layui.config({ ...@@ -179,7 +179,7 @@ layui.config({
// 保存“新增控件” // 保存“新增控件”
function reqSaveData(params, templateContent){ function reqSaveData(params, templateContent){
AjaxPostUtil.request({url: flowableBasePath + "dsformpage003", params: params, type: 'json', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "dsformpage003", params: params, type: 'json', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadNewControl(json.bean); loadNewControl(json.bean);
loadFormItemDrop(); loadFormItemDrop();
...@@ -382,7 +382,7 @@ layui.config({ ...@@ -382,7 +382,7 @@ layui.config({
winui.window.msg('保存页面不能为空!', {icon: 2, time: 2000}); winui.window.msg('保存页面不能为空!', {icon: 2, time: 2000});
return; return;
} }
AjaxPostUtil.request({url: flowableBasePath + "dsformpage009", params: {formedit: JSON.stringify(jsonArray)}, type: 'json', callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "dsformpage009", params: {formedit: JSON.stringify(jsonArray)}, type: 'json', callback: function (json) {
winui.window.msg("保存成功", {icon: 1, time: 2000}); winui.window.msg("保存成功", {icon: 1, time: 2000});
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -39,7 +39,7 @@ layui.config({ ...@@ -39,7 +39,7 @@ layui.config({
id: 'messageTable', id: 'messageTable',
elem: '#messageTable', elem: '#messageTable',
method: 'post', method: 'post',
url: flowableBasePath + 'dsformpage001', url: reqBasePath + 'dsformpage001',
where: getTableParams(), where: getTableParams(),
even: true, even: true,
page: true, page: true,
......
...@@ -18,7 +18,7 @@ layui.config({ ...@@ -18,7 +18,7 @@ layui.config({
name: $("#name").val(), name: $("#name").val(),
remark: $("#remark").val() remark: $("#remark").val()
}; };
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormPage", params: params, type: 'json', method: "POST", callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormPage", params: params, type: 'json', method: "POST", callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -12,7 +12,7 @@ layui.config({ ...@@ -12,7 +12,7 @@ layui.config({
showGrid({ showGrid({
id: "showForm", id: "showForm",
url: flowableBasePath + "dsformpage006", url: reqBasePath + "dsformpage006",
params: {id: parent.rowId}, params: {id: parent.rowId},
pagination: false, pagination: false,
method: "GET", method: "GET",
...@@ -28,7 +28,7 @@ layui.config({ ...@@ -28,7 +28,7 @@ layui.config({
name: $("#name").val(), name: $("#name").val(),
remark: $("#remark").val() remark: $("#remark").val()
}; };
AjaxPostUtil.request({url: flowableBasePath + "writeDsFormPage", params: params, type: 'json', method: "POST", callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "writeDsFormPage", params: params, type: 'json', method: "POST", callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
......
...@@ -17,7 +17,7 @@ layui.config({ ...@@ -17,7 +17,7 @@ layui.config({
id: 'messageTable', id: 'messageTable',
elem: '#messageTable', elem: '#messageTable',
method: 'post', method: 'post',
url: flowableBasePath + 'dsformpage001', url: reqBasePath + 'dsformpage001',
where: getTableParams(), where: getTableParams(),
even: true, even: true,
page: true, page: true,
...@@ -83,7 +83,7 @@ layui.config({ ...@@ -83,7 +83,7 @@ layui.config({
function delet(data) { function delet(data) {
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) { layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) {
layer.close(index); layer.close(index);
AjaxPostUtil.request({url: flowableBasePath + "deleteDsFormPage", params: {id: data.id}, type: 'json', method: "DELETE", callback: function (json) { AjaxPostUtil.request({url: reqBasePath + "deleteDsFormPage", params: {id: data.id}, type: 'json', method: "DELETE", callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000}); winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable(); loadTable();
}}); }});
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<div class="layui-form-item layui-col-xs12 TypeIsTwo layui-hide"> <div class="layui-form-item layui-col-xs12 TypeIsTwo layui-hide">
<label class="layui-form-label">接口<i class="red">*</i></label> <label class="layui-form-label">接口<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" id="interfa" name="interfa" class="layui-input" placeholder="例如:http://localhost:8081/queryDsFormComponentMationToShow"/> <input type="text" id="interfa" name="interfa" class="layui-input" placeholder="例如:http://localhost:8081/queryAllDsFormComponentList"/>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -89,7 +89,7 @@ layui.config({ ...@@ -89,7 +89,7 @@ layui.config({
//展现形式 //展现形式
showGrid({ showGrid({
id: "dsFormContentId", id: "dsFormContentId",
url: flowableBasePath + "queryDsFormComponentMationToShow", url: reqBasePath + "queryAllDsFormComponentList",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
......
...@@ -140,7 +140,7 @@ layui.config({ ...@@ -140,7 +140,7 @@ layui.config({
//展现形式 //展现形式
showGrid({ showGrid({
id: "dsFormContentId", id: "dsFormContentId",
url: flowableBasePath + "queryDsFormComponentMationToShow", url: reqBasePath + "queryAllDsFormComponentList",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
......
...@@ -140,7 +140,7 @@ layui.config({ ...@@ -140,7 +140,7 @@ layui.config({
//展现形式 //展现形式
showGrid({ showGrid({
id: "dsFormContentId", id: "dsFormContentId",
url: flowableBasePath + "queryDsFormComponentMationToShow", url: reqBasePath + "queryAllDsFormComponentList",
params: {}, params: {},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
......
...@@ -967,3 +967,153 @@ var treeSelectUtil = { ...@@ -967,3 +967,153 @@ var treeSelectUtil = {
}; };
// 数据展示方式
var dataShowType = {
/**
* 展示数据
*
* @param json 数据
* @param showType 展示类型
* @param showBoxId 展示位置
* @param defaultId 默认回显值
* @param form form对象
* @param callback 回调函数
* @param chooseCallback 如果是提供选择的树插件类型,则具备点击节点的回调事件
*/
showData: function (json, showType, showBoxId, defaultId, form, callback, chooseCallback) {
if (showType == 'select') {
// 下拉框
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json));
if (!isNull(defaultId)) {
$("#" + showBoxId).val(defaultId);
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$("#" + showBoxId).val(item.id);
}
});
}
form.render('select');
} else if (showType == 'checkbox') {
// 多选框
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/checkbox-property.tpl'), json));
if (!isNull(defaultId)) {
var arr = defaultId.split(",");
for(var i = 0; i < arr.length; i++){
$('input:checkbox[rowId="' + arr[i] + '"]').attr("checked", true);
}
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$('input:checkbox[rowId="' + item.id + '"]').attr("checked", true);
}
});
}
form.render('checkbox');
} else if (showType == 'radio') {
// 单选框
$("#" + showBoxId).html(getDataUseHandlebars('{{#each rows}}<input type="radio" name="' + showBoxId + 'Name" value="{{id}}" title="{{name}}" />{{/each}}', json));
if (!isNull(defaultId)) {
$("#" + showBoxId + " input:radio[name=" + showBoxId + "Name][value=" + defaultId + "]").attr("checked", true);
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$("#" + showBoxId + " input:radio[name=" + showBoxId + "Name][value=" + item.id + "]").attr("checked", true);
}
});
}
form.render('radio');
} else if (showType == 'verificationSelect') {
// 多选下拉框
var str = `<option value="">全部</option>{{#each rows}}<option value="{{formerRequirement}}">{{name}}</option>{{/each}}`;
$("#" + showBoxId).html(getDataUseHandlebars(str, json));
if (!isNull(defaultId)) {
$("#" + showBoxId).val(defaultId.split(","));
}
form.render('select');
} else if (showType == 'radioTree') {
// 单选框树
var _html = sysDictDataUtil.getShowTteeHtml(showBoxId, '0');
var _js = `<script>
layui.define(["jquery", 'fsTree'], function(exports) {
var jQuery = layui.jquery,
fsTree = layui.fsTree;
(function($) {
var ${showBoxId}Object;
fsTree.render({
id: "${showBoxId}Tree",
simpleData: '` + JSON.stringify(json.treeRows) + `',
checkEnable: true,
loadEnable: false,
chkStyle: "radio",
showLine: false,
showIcon: true,
expandSpeed: 'fast',
onCheck: function (event, treeId, treeNode) {
$('#${showBoxId}').attr('chooseId', treeNode.id);
}
}, function(id) {
${showBoxId}Object = $.fn.zTree.getZTreeObj(id);
fuzzySearch(id, '#${showBoxId}Name', null, true);
});
if (` + !isNull(defaultId) + `) {
var zTree = ${showBoxId}Object.getCheckedNodes(false);
for (var i = 0; i < zTree.length; i++) {
if(zTree[i].id == '` + defaultId + `'){
${showBoxId}Object.checkNode(zTree[i], true, true);
$('#${showBoxId}').attr('chooseId', zTree[i].id);
}
}
}
})(jQuery);});
</script>`;
$("#" + showBoxId).append(_html + _js);
} else if (showType == 'selectTree') {
// 提供选择的树插件
var _html = sysDictDataUtil.getShowTteeHtml(showBoxId, '1');
_html += `<link href="../../assets/lib/winui/css/customer/ztree/common-tree.css" rel="stylesheet" />`;
var _js = `<script>
layui.define(["jquery", 'fsTree'], function(exports) {
var jQuery = layui.jquery,
fsTree = layui.fsTree;
(function($) {
fsTree.render({
id: "${showBoxId}Tree",
simpleData: '` + JSON.stringify(json.treeRows) + `',
checkEnable: false,
loadEnable: false,
showLine: false,
showIcon: true,
expandSpeed: 'fast',
addDiyDom: ztreeUtil.addDiyDom,
clickCallback: onClickTree,
onDblClick: onClickTree
}, function(id) {
fuzzySearch(id, '#${showBoxId}Name', null, true);
ztreeUtil.initEventListener(id);
});
function onClickTree(event, treeId, treeNode) {
var chooseId;
if (treeNode == undefined || treeNode.id == 0) {
chooseId = "";
} else {
chooseId = treeNode.id;
}
$('#${showBoxId}Choose').val(chooseId).change();
}
})(jQuery);});
</script>`;
$("#" + showBoxId).append(_html + _js);
$("#" + showBoxId + "Choose").on("change", function() {
if (typeof (chooseCallback) == "function") {
chooseCallback($(this).val());
}
});
}
if (typeof (callback) == "function") {
callback(json);
}
}
};
\ No newline at end of file
// 枚举类相关的工具类
var skyeyeClassEnumUtil = { var skyeyeClassEnumUtil = {
classEnumMap: {}, classEnumMap: {},
...@@ -15,56 +16,7 @@ var skyeyeClassEnumUtil = { ...@@ -15,56 +16,7 @@ var skyeyeClassEnumUtil = {
*/ */
showEnumDataListByClassName: function (code, showType, showBoxId, defaultId, form, callback) { showEnumDataListByClassName: function (code, showType, showBoxId, defaultId, form, callback) {
var json = skyeyeClassEnumUtil.getEnumDataListByClassName(code); var json = skyeyeClassEnumUtil.getEnumDataListByClassName(code);
if (showType == 'select') { dataShowType.showData(json, showType, showBoxId, defaultId, form, callback);
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json));
if (!isNull(defaultId)) {
$("#" + showBoxId).val(defaultId);
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$("#" + showBoxId).val(item.id);
}
});
}
form.render('select');
} else if (showType == 'checkbox') {
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/checkbox-property.tpl'), json));
if (!isNull(defaultId)) {
var arr = defaultId.split(",");
for(var i = 0; i < arr.length; i++){
$('input:checkbox[rowId="' + arr[i] + '"]').attr("checked", true);
}
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$('input:checkbox[rowId="' + item.id + '"]').attr("checked", true);
}
});
}
form.render('checkbox');
} else if (showType == 'radio') {
$("#" + showBoxId).html(getDataUseHandlebars('{{#each rows}}<input type="radio" name="' + showBoxId + 'Name" value="{{id}}" title="{{name}}" />{{/each}}', json));
if (!isNull(defaultId)) {
$("#" + showBoxId + " input:radio[name=" + showBoxId + "Name][value=" + defaultId + "]").attr("checked", true);
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault) {
$("#" + showBoxId + " input:radio[name=" + showBoxId + "Name][value=" + item.id + "]").attr("checked", true);
}
});
}
form.render('radio');
} else if (showType == 'verificationSelect') {
var str = `<option value="">全部</option>{{#each rows}}<option value="{{formerRequirement}}">{{name}}</option>{{/each}}`;
$("#" + showBoxId).html(getDataUseHandlebars(str, json));
if (!isNull(defaultId)) {
$("#" + showBoxId).val(defaultId.split(","));
}
form.render('select');
}
if (typeof (callback) == "function") {
callback(json);
}
}, },
getEnumDataNameByClassName: function (code, key, value, getKey) { getEnumDataNameByClassName: function (code, key, value, getKey) {
......
...@@ -29,113 +29,7 @@ var sysDictDataUtil = { ...@@ -29,113 +29,7 @@ var sysDictDataUtil = {
*/ */
showDictDataListByDictTypeCode: function (dictTypeCode, showType, showBoxId, defaultId, form, callback, chooseCallback) { showDictDataListByDictTypeCode: function (dictTypeCode, showType, showBoxId, defaultId, form, callback, chooseCallback) {
sysDictDataUtil.queryDictDataListByDictTypeCode(dictTypeCode, function (json) { sysDictDataUtil.queryDictDataListByDictTypeCode(dictTypeCode, function (json) {
if (showType == 'select') { dataShowType.showData(json, showType, showBoxId, defaultId, form, callback, chooseCallback);
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json));
if (!isNull(defaultId)) {
$("#" + showBoxId).val(defaultId);
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault == 1) {
$("#" + showBoxId).val(item.id);
}
});
}
form.render('select');
} else if (showType == 'checkbox') {
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/checkbox-property.tpl'), json));
if (!isNull(defaultId)) {
var arr = defaultId.split(",");
for(var i = 0; i < arr.length; i++) {
$('input:checkbox[rowId="' + arr[i] + '"]').attr("checked", true);
}
} else {
$.each(json.rows, function (i, item) {
if (item.isDefault == 1) {
$('input:checkbox[rowId="' + item.id + '"]').attr("checked", true);
}
});
}
form.render('checkbox');
} else if (showType == 'radioTree') {
var _html = sysDictDataUtil.getShowTteeHtml(showBoxId, '0');
var _js = `<script>
layui.define(["jquery", 'fsTree'], function(exports) {
var jQuery = layui.jquery,
fsTree = layui.fsTree;
(function($) {
var ${showBoxId}Object;
fsTree.render({
id: "${showBoxId}Tree",
simpleData: '` + JSON.stringify(json.treeRows) + `',
checkEnable: true,
loadEnable: false,
chkStyle: "radio",
showLine: false,
showIcon: true,
expandSpeed: 'fast',
onCheck: function (event, treeId, treeNode) {
$('#${showBoxId}').attr('chooseId', treeNode.id);
}
}, function(id) {
${showBoxId}Object = $.fn.zTree.getZTreeObj(id);
fuzzySearch(id, '#${showBoxId}Name', null, true);
});
if (` + !isNull(defaultId) + `) {
var zTree = ${showBoxId}Object.getCheckedNodes(false);
for (var i = 0; i < zTree.length; i++) {
if(zTree[i].id == '` + defaultId + `'){
${showBoxId}Object.checkNode(zTree[i], true, true);
$('#${showBoxId}').attr('chooseId', zTree[i].id);
}
}
}
})(jQuery);});
</script>`;
$("#" + showBoxId).append(_html + _js);
} else if (showType == 'selectTree') {
var _html = sysDictDataUtil.getShowTteeHtml(showBoxId, '1');
_html += `<link href="../../assets/lib/winui/css/customer/ztree/common-tree.css" rel="stylesheet" />`;
var _js = `<script>
layui.define(["jquery", 'fsTree'], function(exports) {
var jQuery = layui.jquery,
fsTree = layui.fsTree;
(function($) {
fsTree.render({
id: "${showBoxId}Tree",
simpleData: '` + JSON.stringify(json.treeRows) + `',
checkEnable: false,
loadEnable: false,
showLine: false,
showIcon: true,
expandSpeed: 'fast',
addDiyDom: ztreeUtil.addDiyDom,
clickCallback: onClickTree,
onDblClick: onClickTree
}, function(id) {
fuzzySearch(id, '#${showBoxId}Name', null, true);
ztreeUtil.initEventListener(id);
});
function onClickTree(event, treeId, treeNode) {
var chooseId;
if (treeNode == undefined || treeNode.id == 0) {
chooseId = "";
} else {
chooseId = treeNode.id;
}
$('#${showBoxId}Choose').val(chooseId).change();
}
})(jQuery);});
</script>`;
$("#" + showBoxId).append(_html + _js);
$("#" + showBoxId + "Choose").on("change", function() {
if (typeof (chooseCallback) == "function") {
chooseCallback($(this).val());
}
});
}
if (typeof (callback) == "function") {
callback(json);
}
}); });
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册