提交 c662666a 编写于 作者: doc_wei's avatar doc_wei

新增枚举数据卡槽

上级 ef6b7c67
......@@ -49,7 +49,7 @@ layui.config({
treeSelectUtil.init({
eleTree: layui.eleTree,
elem: 'componentId',
url: reqBasePath + "queryAllDsFormComponentList",
url: reqBasePath + "queryAllDsFormComponentList?serviceClassName=" + className,
defaultId: json.bean.componentId,
ajaxCallback: function (data) {
$.each(data.rows, function (i, item) {
......@@ -159,6 +159,9 @@ layui.config({
// 数据字典
initDictData();
$("#objectId").val(value);
} else {
$("#dataTypeObjectBox").html(dataTypeObject["2"]);
$("#objectId").html("<option value=''>请选择</option>");
}
form.render('select');
}
......
......@@ -15,7 +15,88 @@ layui.config({
}
var selOption = getFileContent('tpl/template/select-option.tpl');
$("#showForm").html(getDataUseHandlebars($("#controlItemEdit").html(), {bean: data}));
var html = {
'attrKeyBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">关联属性<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="attrKey" lay-search="" id="attrKey" name="attrKey" win-verify="required">
</select>
</div>
</div>`,
'titleBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="title" name="title" placeholder="请输入标题" class="layui-input" />
</div>
</div>`,
'placeholderBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">提示语</label>
<div class="layui-input-block winui-radio">
<input type="text" id="placeholder" name="placeholder" placeholder="请输入控件提示语" class="layui-input" />
</div>
</div>`,
'requireBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">限制条件</label>
<div class="layui-input-block" id="require">
</div>
</div>`,
'defaultValueBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">默认值</label>
<div class="layui-input-block">
<input type="text" id="defaultValue" name="defaultValue" placeholder="请输入默认值" class="layui-input" />
</div>
</div>`,
'widthBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">宽度<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="width" lay-search="" id="width" name="width" win-verify="required">
</select>
</div>
</div>`,
'uploadDataTypeBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">文件后缀类型<i class="red">*</i></label>
<div class="layui-input-block" id="uploadDataType">
</div>
</div>`,
'uploadTypeBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">文件上传类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="uploadType" lay-search="" id="uploadType" name="uploadType" win-verify="required">
</select>
</div>
</div>`,
'uploadNumBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">文件数量<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="uploadNum" name="uploadNum" placeholder="请输入文件数量" class="layui-input" win-verify="required" />
</div>
</div>`,
'dataShowTypeBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">数据展示类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="dataShowType" lay-search="" id="dataShowType" name="dataShowType" win-verify="required">
</select>
</div>
</div>`,
};
// 加载组件关联的属性
$.each(html, function (key, value) {
if (data.dsFormComponent.attrKeys.indexOf(key) >= 0) {
$("#contentBox").append(value);
}
});
$("#title").val(data.title);
$("#placeholder").val(data.placeholder);
$("#defaultValue").val(data.defaultValue);
$("#uploadNum").val(data.uploadNum);
// 属性信息
var attrs = [];
......@@ -47,17 +128,20 @@ layui.config({
// 宽度
skyeyeClassEnumUtil.showEnumDataListByClassName("widthScale", 'select', "width", data.width, form);
// 加载组件关联的属性
$.each(data.dsFormComponent.attrKeys, function (i, item) {
$("#" + item).removeClass("layui-hide");
});
$("#width").val(data.width);
// 属性的限制条件
var require = isNull(data.require) ? '' : data.require.toString();
skyeyeClassEnumUtil.showEnumDataListByClassName("verificationParams", 'verificationSelect', "require", require, form, null, 'formerRequirement');
// 文件后缀类型
var uploadDataType = isNull(data.uploadDataType) ? '' : data.uploadDataType.toString();
dataShowType.showData({rows: fileTypeList}, 'verificationSelect', "uploadDataType", uploadDataType, form, null, null, null);
// 文件上传类型
dataShowType.showData({rows: dataTypeList}, 'select', "uploadType", data.uploadType, form, null, null, null);
// 数据展示类型
dataShowType.showData({rows: dataShowType.showDataType}, 'select', "dataShowType", data.dataShowType, form, null, null, null);
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
......@@ -74,11 +158,15 @@ layui.config({
inDataIndex = i;
}
});
console.log($('#require').attr('value'))
var newParams = parent.contentList[inDataIndex];
newParams.title = $("#title").val();
newParams.placeholder = $("#placeholder").val();
newParams.require = isNull($('#require').attr('value')) ? [] : JSON.parse($('#require').attr('value'));
newParams.uploadDataType = isNull($('#uploadDataType').attr('value')) ? [] : JSON.parse($('#uploadDataType').attr('value'));
newParams.uploadNum = $("#uploadNum").val();
newParams.uploadType = $("#uploadType").val();
newParams.dataShowType = $("#dataShowType").val();
newParams.defaultValue = $("#defaultValue").val();
newParams.width = $("#width").val();
newParams.attrKey = $("#attrKey").val();
......
......@@ -10,62 +10,19 @@
<body>
<div style="margin:0 auto;padding:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
</form>
</div>
<script type="text/html" id="controlItemEdit">
{{#bean}}
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="attrKeyBox">
<label class="layui-form-label">关联属性<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="attrKey" lay-search="" id="attrKey" name="attrKey">
</select>
</div>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="titleBox">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="title" name="title" placeholder="请输入标题" class="layui-input" maxlength="18" value="{{title}}"/>
</div>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="placeholderBox">
<label class="layui-form-label">提示语</label>
<div class="layui-input-block winui-radio">
<input type="text" id="placeholder" name="placeholder" win-verify="" placeholder="请输入控件提示语" class="layui-input" maxlength="30" value="{{placeholder}}"/>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="requireBox">
<label class="layui-form-label">限制条件</label>
<div class="layui-input-block" id="require">
<div id="contentBox">
</div>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="defaultValueBox">
<label class="layui-form-label">默认值</label>
<div class="layui-input-block">
<input type="text" id="defaultValue" name="defaultValue" win-verify="" placeholder="请输入默认值" class="layui-input" maxlength="50" value="{{value}}"/>
<div class="layui-form-item layui-col-xs12">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddBean"><language showName="com.skyeye.save"></language></button>
</div>
</div>
</div>
<div class="layui-form-item layui-hide layui-col-xs12" id="widthBox">
<label class="layui-form-label">宽度<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="width" lay-search="" id="width" name="width">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddBean"><language showName="com.skyeye.save"></language></button>
</div>
</div>
{{/bean}}
</script>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
......
......@@ -982,6 +982,16 @@ var treeSelectUtil = {
// 数据展示方式
var dataShowType = {
showDataType: [
{id: 'select', name: '下拉框'},
{id: 'checkbox', name: '多选框'},
{id: 'radio', name: '单选框'},
{id: 'verificationSelect', name: '多选下拉框'},
{id: 'radioTree', name: '单选框树'},
{id: 'checkboxTree', name: '多选框树'},
{id: 'selectTree', name: '树结构展示'}
],
/**
* 展示数据
*
......@@ -995,6 +1005,7 @@ var dataShowType = {
* @param valueKey value展示的key
*/
showData: function (json, showType, showBoxId, defaultId, form, callback, chooseCallback, valueKey) {
$("#" + showBoxId).html('');
if (showType == 'select') {
// 下拉框
$("#" + showBoxId).html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json));
......
......@@ -140,14 +140,19 @@ var dsFormUtil = {
content = dsFormUtil.getContentLinkedData(content);
}
content.title = dsFormUtil.getLable(content);
if (isNull(content.attrDefinition)) {
content.attrDefinition = {};
}
var jsonStr = {bean: content};
// 对象的传递转换,用于组件使用,组件中需要使用 {{{attrDefinitionJson}}} 接收
jsonStr.bean.attrDefinitionJson = JSON.stringify(jsonStr.bean.attrDefinition);
var html = getDataUseHandlebars('{{#bean}}' + component.htmlContent + '{{/bean}}', jsonStr);
var html_js = getDataUseHandlebars('{{#bean}}' + component.jsContent + '{{/bean}}', jsonStr);
var jsCon = `<script>${html_js}</script>`;
$("#" + boxId).append(html + jsCon);
console.log(content);
if (content.require.indexOf('required') >= 0) {
if (!isNull(content.require) && content.require.indexOf('required') >= 0) {
$(`div[contentId='${content.id}']`).find('label').append('<i class="red">*</i>');
}
......@@ -156,7 +161,7 @@ var dsFormUtil = {
getLable: function (content) {
var attr = content.attrDefinition;
if (!isNull(attr)) {
if (!isNull(attr) && !$.isEmptyObject(attr)) {
if (!isNull(attr.attrDefinitionCustom)) {
return attr.attrDefinitionCustom.name;
} else {
......
......@@ -17,6 +17,49 @@ var packageType = ["zip", "rar"];
var epubType = ["epub"];
var aceType = ["txt", "sql", "java", "css", "html", "htm", "json", "js", "tpl"];
var fileTypeList = [
{id: "imageType", name: "图片资源", value: imageType},
{id: "officeType", name: "OFFICE办公文件", value: officeType},
{id: "vedioType", name: "视频资源", value: vedioType},
{id: "audioType", name: "音频资源", value: audioType},
{id: "packageType", name: "压缩包", value: packageType},
{id: "epubType", name: "epub小说资源", value: epubType},
{id: "aceType", name: "其他文件", value: aceType},
];
var dataTypeList = [
{id: 1, name: "小程序资源"},
{id: 2, name: "系统桌面背景自定义图片-1"},
{id: 3, name: "系统桌面锁屏背景自定义图片-1"},
{id: 4, name: "系统桌面背景自定义图片-2"},
{id: 5, name: "系统桌面锁屏背景自定义图片-2"},
{id: 6, name: "用户头像"},
{id: 7, name: "聊天群组头像"},
{id: 8, name: "系统图片"},
{id: 9, name: "聊天图片"},
{id: 10, name: "聊天附件"},
{id: 11, name: "富文本内容图片"},
{id: 12, name: "菜单/桌面logo图片"},
{id: 13, name: "富文本编辑图片"},
{id: 14, name: "工单图片"},
{id: 15, name: "学生照图片"},
{id: 16, name: "考试题库文件"},
{id: 17, name: "流程配置图片"},
{id: 18, name: "报表基础设置背景图"},
{id: 19, name: "报表文字模型logo"},
{id: 20, name: "编辑器素材logo图片"},
{id: 21, name: "财务模块-凭证文件"},
{id: 22, name: "商城模块-套餐文件"},
{id: 23, name: "代码生成器"},
{id: 24, name: "网盘--文件管理"},
{id: 25, name: "报表管理--echarts模型图片"},
{id: 26, name: "ERP--生产模块获取条形码"},
{id: 27, name: "资产文件保存路径"},
{id: 28, name: "资产条形码"},
{id: 29, name: "ERP商品规格图片"},
{id: 30, name: "附件"},
];
//系统cookies从哪里获取, true:从用户登陆获取;false:跨域获取
var getCookiesByUrl = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册