From c662666a4c7a1faee9feebb7784390ac70d9b384 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sun, 19 Feb 2023 23:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9E=9A=E4=B8=BE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8D=A1=E6=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/template/js/attr/writeAttr.js | 5 +- .../template/js/dsFormPage/editPageContent.js | 106 ++++++++++++++++-- .../tpl/dsFormPage/editPageContent.html | 61 ++-------- .../layui/customer/common/systemCommonUtil.js | 11 ++ .../lib/layui/customer/skyeye/dsFormUtil.js | 11 +- .../template/assets/lib/layui/layui.js | 43 +++++++ 6 files changed, 172 insertions(+), 65 deletions(-) diff --git a/base-server/src/main/resources/template/js/attr/writeAttr.js b/base-server/src/main/resources/template/js/attr/writeAttr.js index 085441722..fe2250274 100644 --- a/base-server/src/main/resources/template/js/attr/writeAttr.js +++ b/base-server/src/main/resources/template/js/attr/writeAttr.js @@ -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(""); } form.render('select'); } diff --git a/common/src/main/resources/template/js/dsFormPage/editPageContent.js b/common/src/main/resources/template/js/dsFormPage/editPageContent.js index 40aa58916..016639b25 100644 --- a/common/src/main/resources/template/js/dsFormPage/editPageContent.js +++ b/common/src/main/resources/template/js/dsFormPage/editPageContent.js @@ -15,7 +15,88 @@ layui.config({ } var selOption = getFileContent('tpl/template/select-option.tpl'); - $("#showForm").html(getDataUseHandlebars($("#controlItemEdit").html(), {bean: data})); + var html = { + 'attrKeyBox': `
+ +
+ +
+
`, + 'titleBox': `
+ +
+ +
+
`, + 'placeholderBox': `
+ +
+ +
+
`, + 'requireBox': `
+ +
+ +
+
`, + 'defaultValueBox': `
+ +
+ +
+
`, + 'widthBox': `
+ +
+ +
+
`, + 'uploadDataTypeBox': `
+ +
+ +
+
`, + 'uploadTypeBox': `
+ +
+ +
+
`, + 'uploadNumBox': `
+ +
+ +
+
`, + 'dataShowTypeBox': `
+ +
+ +
+
`, + }; + + // 加载组件关联的属性 + $.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(); diff --git a/common/src/main/resources/template/tpl/dsFormPage/editPageContent.html b/common/src/main/resources/template/tpl/dsFormPage/editPageContent.html index 88cc7be6b..0a96b8ece 100644 --- a/common/src/main/resources/template/tpl/dsFormPage/editPageContent.html +++ b/common/src/main/resources/template/tpl/dsFormPage/editPageContent.html @@ -10,62 +10,19 @@
- -
-
- - + + diff --git a/web/src/main/resources/template/assets/lib/layui/customer/common/systemCommonUtil.js b/web/src/main/resources/template/assets/lib/layui/customer/common/systemCommonUtil.js index a55c1c6d5..05fbe425b 100644 --- a/web/src/main/resources/template/assets/lib/layui/customer/common/systemCommonUtil.js +++ b/web/src/main/resources/template/assets/lib/layui/customer/common/systemCommonUtil.js @@ -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)); diff --git a/web/src/main/resources/template/assets/lib/layui/customer/skyeye/dsFormUtil.js b/web/src/main/resources/template/assets/lib/layui/customer/skyeye/dsFormUtil.js index 97896039e..558065e79 100644 --- a/web/src/main/resources/template/assets/lib/layui/customer/skyeye/dsFormUtil.js +++ b/web/src/main/resources/template/assets/lib/layui/customer/skyeye/dsFormUtil.js @@ -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 = ``; $("#" + 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('*'); } @@ -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 { diff --git a/web/src/main/resources/template/assets/lib/layui/layui.js b/web/src/main/resources/template/assets/lib/layui/layui.js index 3b70f3d4f..002b17559 100644 --- a/web/src/main/resources/template/assets/lib/layui/layui.js +++ b/web/src/main/resources/template/assets/lib/layui/layui.js @@ -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; -- GitLab