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

表单组件添加适用对象

上级 9657a0f0
...@@ -23,6 +23,8 @@ layui.config({ ...@@ -23,6 +23,8 @@ layui.config({
skyeyeClassEnumUtil.showEnumDataListByClassName("componentAttr", 'verificationSelect', "attrKeys", '', form); skyeyeClassEnumUtil.showEnumDataListByClassName("componentAttr", 'verificationSelect', "attrKeys", '', form);
// 组件适用范围 // 组件适用范围
skyeyeClassEnumUtil.showEnumDataListByClassName("componentApplyRange", 'radio', "applyRange", '', form); skyeyeClassEnumUtil.showEnumDataListByClassName("componentApplyRange", 'radio', "applyRange", '', form);
// 适用表单布局
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormPageType", 'verificationSelect', "applyFormType", '', form);
// 根据类型获取部分功能的使用说明 // 根据类型获取部分功能的使用说明
systemCommonUtil.queryExplainMationByType(2, function(json) { systemCommonUtil.queryExplainMationByType(2, function(json) {
...@@ -37,15 +39,19 @@ layui.config({ ...@@ -37,15 +39,19 @@ layui.config({
}); });
$("#applyObjectBox").hide(); $("#applyObjectBox").hide();
var loadApplyObject = false;
form.on('radio(applyRangeFilter)', function (data) { form.on('radio(applyRangeFilter)', function (data) {
if (data.value == 1) { if (data.value == 1) {
$("#applyObjectBox").hide(); $("#applyObjectBox").hide();
} else { } else {
$("#applyObjectBox").show(); $("#applyObjectBox").show();
AjaxPostUtil.request({url: reqBasePath + "queryServiceClassForTree", params: {}, type: 'json', method: 'GET', callback: function(json) { if (!loadApplyObject) {
json.treeRows = json.rows; AjaxPostUtil.request({url: reqBasePath + "queryServiceClassForTree", params: {}, type: 'json', method: 'GET', callback: function(json) {
dataShowType.showData(json, 'checkboxTree', 'applyObject', '', form); loadApplyObject = true;
}}); json.treeRows = json.rows;
dataShowType.showData(json, 'checkboxTree', 'applyObject', '', form);
}});
}
} }
}); });
...@@ -77,7 +83,8 @@ layui.config({ ...@@ -77,7 +83,8 @@ layui.config({
showType: $("#showType").val(), showType: $("#showType").val(),
attrKeys: $('#attrKeys').attr('value'), attrKeys: $('#attrKeys').attr('value'),
applyRange: $("#applyRange input:radio:checked").val(), applyRange: $("#applyRange input:radio:checked").val(),
applyObject: $("#applyObject").attr("chooseId"), applyObject: isNull($("#applyObject").attr("chooseId")) ? JSON.stringify([]) : $("#applyObject").attr("chooseId"),
applyFormType: $('#applyFormType').attr('value'),
linkedData: '2' linkedData: '2'
}; };
if ($("#linkedData").val() == 'true') { if ($("#linkedData").val() == 'true') {
......
...@@ -51,6 +51,9 @@ layui.config({ ...@@ -51,6 +51,9 @@ layui.config({
skyeyeClassEnumUtil.showEnumDataListByClassName("componentAttr", 'verificationSelect', "attrKeys", attrKeys, form); skyeyeClassEnumUtil.showEnumDataListByClassName("componentAttr", 'verificationSelect', "attrKeys", attrKeys, form);
// 组件适用范围 // 组件适用范围
skyeyeClassEnumUtil.showEnumDataListByClassName("componentApplyRange", 'radio', "applyRange", json.bean.applyRange, form); skyeyeClassEnumUtil.showEnumDataListByClassName("componentApplyRange", 'radio', "applyRange", json.bean.applyRange, form);
// 适用表单布局
var applyFormType = isNull(json.bean.applyFormType) ? '' : json.bean.applyFormType.toString();
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormPageType", 'verificationSelect', "applyFormType", applyFormType, form);
// 根据类型获取部分功能的使用说明 // 根据类型获取部分功能的使用说明
systemCommonUtil.queryExplainMationByType(2, function (json) { systemCommonUtil.queryExplainMationByType(2, function (json) {
...@@ -97,7 +100,8 @@ layui.config({ ...@@ -97,7 +100,8 @@ layui.config({
linkedData: '2', linkedData: '2',
attrKeys: $('#attrKeys').attr('value'), attrKeys: $('#attrKeys').attr('value'),
applyRange: $("#applyRange input:radio:checked").val(), applyRange: $("#applyRange input:radio:checked").val(),
applyObject: $("#applyObject").attr("chooseId"), applyObject: isNull($("#applyObject").attr("chooseId")) ? JSON.stringify([]) : $("#applyObject").attr("chooseId"),
applyFormType: $('#applyFormType').attr('value'),
id: parent.rowId id: parent.rowId
}; };
if ($("#linkedData").val() == 'true') { if ($("#linkedData").val() == 'true') {
...@@ -122,15 +126,19 @@ layui.config({ ...@@ -122,15 +126,19 @@ layui.config({
} }
}); });
var loadApplyObject = false;
function loadRange(type, defaultValue) { function loadRange(type, defaultValue) {
if (type == 1) { if (type == 1) {
$("#applyObjectBox").hide(); $("#applyObjectBox").hide();
} else { } else {
$("#applyObjectBox").show(); $("#applyObjectBox").show();
AjaxPostUtil.request({url: reqBasePath + "queryServiceClassForTree", params: {}, type: 'json', method: 'GET', callback: function(json) { if (!loadApplyObject) {
json.treeRows = json.rows; AjaxPostUtil.request({url: reqBasePath + "queryServiceClassForTree", params: {}, type: 'json', method: 'GET', callback: function(json) {
dataShowType.showData(json, 'checkboxTree', 'applyObject', JSON.stringify(defaultValue), form); loadApplyObject = true;
}}); json.treeRows = json.rows;
dataShowType.showData(json, 'checkboxTree', 'applyObject', JSON.stringify(defaultValue), form);
}});
}
} }
} }
......
...@@ -32,6 +32,9 @@ layui.config({ ...@@ -32,6 +32,9 @@ layui.config({
{ field: 'showType', title: '显示类型', width: 120, templet: function (d) { { field: 'showType', title: '显示类型', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', d.showType, 'name'); return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', d.showType, 'name');
}}, }},
{ field: 'applyRange', title: '适用对象范围', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("componentApplyRange", 'id', d.applyRange, '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);
}}, }},
......
...@@ -28,6 +28,7 @@ layui.config({ ...@@ -28,6 +28,7 @@ layui.config({
var componentList = []; var componentList = [];
var className = GetUrlParam("className"); var className = GetUrlParam("className");
var pageType = GetUrlParam("pageType");
if (isNull(className)) { if (isNull(className)) {
winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000}); winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000});
return false; return false;
...@@ -89,7 +90,7 @@ layui.config({ ...@@ -89,7 +90,7 @@ layui.config({
showGrid({ showGrid({
id: "btnBox", id: "btnBox",
url: reqBasePath + "queryAllDsFormComponentList", url: reqBasePath + "queryAllDsFormComponentList",
params: {}, params: {serviceClassName: className, dsFormPageType: pageType},
pagination: false, pagination: false,
method: 'GET', method: 'GET',
template: $("#leftBoxItem").html(), template: $("#leftBoxItem").html(),
......
...@@ -55,7 +55,8 @@ layui.config({ ...@@ -55,7 +55,8 @@ layui.config({
$("#width").val(data.width); $("#width").val(data.width);
// 属性的限制条件 // 属性的限制条件
skyeyeClassEnumUtil.showEnumDataListByClassName("verificationParams", 'verificationSelect', "require", data.require, form, null, 'formerRequirement'); var require = isNull(data.require) ? '' : data.require.toString();
skyeyeClassEnumUtil.showEnumDataListByClassName("verificationParams", 'verificationSelect', "require", require, form, null, 'formerRequirement');
matchingLanguage(); matchingLanguage();
form.render(); form.render();
...@@ -73,10 +74,11 @@ layui.config({ ...@@ -73,10 +74,11 @@ layui.config({
inDataIndex = i; inDataIndex = i;
} }
}); });
console.log($('#require').attr('value'))
var newParams = parent.contentList[inDataIndex]; var newParams = parent.contentList[inDataIndex];
newParams.title = $("#title").val(); newParams.title = $("#title").val();
newParams.placeholder = $("#placeholder").val(); newParams.placeholder = $("#placeholder").val();
newParams.require = isNull($('#require').attr('value')) ? [] : $('#require').attr('value'); newParams.require = isNull($('#require').attr('value')) ? [] : JSON.parse($('#require').attr('value'));
newParams.defaultValue = $("#defaultValue").val(); newParams.defaultValue = $("#defaultValue").val();
newParams.width = $("#width").val(); newParams.width = $("#width").val();
newParams.attrKey = $("#attrKey").val(); newParams.attrKey = $("#attrKey").val();
......
...@@ -38,11 +38,11 @@ layui.config({ ...@@ -38,11 +38,11 @@ layui.config({
cols: [[ cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' },
{ field: 'name', title: '名称', align: 'left', width: 120 }, { field: 'name', title: '名称', align: 'left', width: 120 },
{ field: 'remark', title: '简介', align: 'left', width: 200 }, { field: 'numCode', title: '编号', width: 150 },
{ field: 'numCode', title: '编号', width: 150 },
{ field: 'type', title: '类型', align: 'left', width: 120, templet: function (d) { { field: 'type', title: '类型', align: 'left', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormPageType", 'id', d.type, 'name'); return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormPageType", 'id', d.type, 'name');
}}, }},
{ field: 'remark', title: '简介', align: 'left', width: 200 },
{ field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 }, { field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 },
{ field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 }, { field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 },
{ field: 'lastUpdateName', title: systemLanguage["com.skyeye.lastUpdateName"][languageType], align: 'left', width: 120 }, { field: 'lastUpdateName', title: systemLanguage["com.skyeye.lastUpdateName"][languageType], align: 'left', width: 120 },
...@@ -80,7 +80,7 @@ layui.config({ ...@@ -80,7 +80,7 @@ layui.config({
if (data.type == 'simpleTable') { if (data.type == 'simpleTable') {
url = '../../tpl/dsFormPage/simpleTableDesign.html'; url = '../../tpl/dsFormPage/simpleTableDesign.html';
} }
url += '?className=' + objectId + '&pageId=' + data.id; url += '?className=' + objectId + '&pageId=' + data.id + '&pageType=' + data.type;
parent.parent._openNewWindows({ parent.parent._openNewWindows({
url: url, url: url,
title: "布局设计", title: "布局设计",
......
...@@ -32,6 +32,7 @@ layui.config({ ...@@ -32,6 +32,7 @@ layui.config({
$("#name").val(json.bean.name); $("#name").val(json.bean.name);
$("#remark").val(json.bean.remark); $("#remark").val(json.bean.remark);
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormPageType", 'select', "type", json.bean.type, form); skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormPageType", 'select', "type", json.bean.type, form);
$("#type").attr("disabled", true);
var businessApi = json.bean.businessApi; var businessApi = json.bean.businessApi;
$("#serviceStr").val(businessApi.serviceStr); $("#serviceStr").val(businessApi.serviceStr);
......
...@@ -56,7 +56,13 @@ ...@@ -56,7 +56,13 @@
</div> </div>
</div> </div>
<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" id="applyFormType">
</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" id="applyRange"> <div class="layui-input-block" id="applyRange">
</div> </div>
......
...@@ -62,7 +62,13 @@ ...@@ -62,7 +62,13 @@
</div> </div>
</div> </div>
<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" id="applyFormType">
</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" id="applyRange"> <div class="layui-input-block" id="applyRange">
</div> </div>
......
...@@ -146,6 +146,11 @@ var dsFormUtil = { ...@@ -146,6 +146,11 @@ var dsFormUtil = {
var html_js = getDataUseHandlebars('{{#bean}}' + component.jsContent + '{{/bean}}', jsonStr); var html_js = getDataUseHandlebars('{{#bean}}' + component.jsContent + '{{/bean}}', jsonStr);
var jsCon = `<script>${html_js}</script>`; var jsCon = `<script>${html_js}</script>`;
$("#" + boxId).append(html + jsCon); $("#" + boxId).append(html + jsCon);
console.log(content);
if (content.require.indexOf('required') >= 0) {
$(`div[contentId='${content.id}']`).find('label').append('<i class="red">*</i>');
}
return content; return content;
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册