From 9b1ae86bf97b44f1d72c7d219ad7f916010846f8 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sun, 5 Mar 2023 23:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=97=A5=E6=9C=9F=E7=BB=84=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/template/js/attr/writeAttr.js | 12 ++-- .../template/js/contacts/contactsList.js | 4 +- .../js/dsFormComponent/dsFormComponentAdd.js | 6 +- .../js/dsFormComponent/dsFormComponentEdit.js | 9 ++- .../js/dsFormPage/dsFormPageDesign.js | 7 ++- .../template/js/dsFormPage/editPageContent.js | 47 ++++++++++++++ .../dsFormComponent/dsFormComponentAdd.html | 7 +++ .../dsFormComponent/dsFormComponentEdit.html | 7 +++ .../tpl/dsFormPage/dsFormPageDesign.html | 2 +- .../js/crmContract/crmContractList.js | 6 +- .../js/crmContract/mycrmcontractadd.js | 5 +- .../template/assets/lib/layui/custom.js | 3 + .../layui/customer/common/systemCommonUtil.js | 6 +- .../lib/layui/customer/skyeye/dsFormUtil.js | 61 ++++++++++++++++++- .../template/json/skyeyeClassEnum.json | 1 + 15 files changed, 159 insertions(+), 24 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 381c1491f..125f324d0 100644 --- a/base-server/src/main/resources/template/js/attr/writeAttr.js +++ b/base-server/src/main/resources/template/js/attr/writeAttr.js @@ -58,10 +58,10 @@ layui.config({ } }); var value; - if (dataType == 4) { + if (json.bean.dataType == 4) { value = json.bean.businessApi; } else { - value = dataType == 1 ? json.bean.defaultData : json.bean.objectId; + value = json.bean.dataType == 1 ? json.bean.defaultData : json.bean.objectId; } loadLinkData(json.bean.componentId, json.bean.dataType, value); }, @@ -180,17 +180,17 @@ layui.config({ initDictData(); $("#objectId").val(value); } else if (dataType == 4) { - // 自定义 + // 自定义接口 $("#dataTypeObjectBox").html(commonHtml['businessApi']); $("#serviceStr").html(getDataUseHandlebars(selOption, {rows: serviceMap})); loadParamsTable('apiParams'); if (!isNull(value)) { $("#serviceStr").val(value.serviceStr); $("#api").val(value.api); - skyeyeClassEnumUtil.showEnumDataListByClassName("httpMethodEnum", 'select', "method", businessApi.method, form); + skyeyeClassEnumUtil.showEnumDataListByClassName("httpMethodEnum", 'select', "method", value.method, form); initTableChooseUtil.deleteAllRow('apiParams'); - $.each(operateOpenPage.params, function(key, value) { + $.each(value.params, function(key, value) { var params = { "key": key, "value": value @@ -212,7 +212,7 @@ layui.config({ id: id, cols: [ {id: 'key', title: '入参Key', formType: 'input', width: '150', verify: 'required'}, - {id: 'value', title: '值', formType: 'input', width: '150', verify: 'required'} + {id: 'value', title: '值(目前仅支持objectId和objectKey的传值)', formType: 'input', width: '150', verify: 'required'} ], deleteRowCallback: function (trcusid) { }, diff --git a/base-server/src/main/resources/template/js/contacts/contactsList.js b/base-server/src/main/resources/template/js/contacts/contactsList.js index 185ca6e58..30e8b4975 100644 --- a/base-server/src/main/resources/template/js/contacts/contactsList.js +++ b/base-server/src/main/resources/template/js/contacts/contactsList.js @@ -77,7 +77,7 @@ layui.config({ // 新增 $("body").on("click", "#addBean", function() { - _openNewWindows({ + parent._openNewWindows({ url: systemCommonUtil.getUrl('FP2023030400002&objectId=' + objectId + '&objectKey=' + objectKey, null), title: systemLanguage["com.skyeye.addPageTitle"][languageType], pageId: "contactsAdd", @@ -90,7 +90,7 @@ layui.config({ // 编辑 function edit(data) { - _openNewWindows({ + parent._openNewWindows({ url: systemCommonUtil.getUrl('FP2023030400003&objectId=' + objectId + '&objectKey=' + objectKey + '&id=' + data.id, null), title: systemLanguage["com.skyeye.editPageTitle"][languageType], pageId: "contactsEdit", diff --git a/common/src/main/resources/template/js/dsFormComponent/dsFormComponentAdd.js b/common/src/main/resources/template/js/dsFormComponent/dsFormComponentAdd.js index 5e72d1b95..b6dcd415e 100644 --- a/common/src/main/resources/template/js/dsFormComponent/dsFormComponentAdd.js +++ b/common/src/main/resources/template/js/dsFormComponent/dsFormComponentAdd.js @@ -4,12 +4,13 @@ layui.config({ version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui', 'eleTree'].concat(dsFormUtil.mastHaveImport), function (exports) { +}).define(['window', 'table', 'jquery', 'winui', 'eleTree', 'textool'].concat(dsFormUtil.mastHaveImport), function (exports) { winui.renderColor(); var index = parent.layer.getFrameIndex(window.name); var $ = layui.$, element = layui.element, colorpicker = layui.colorpicker, + textool = layui.textool, form = layui.form; // 加载图标信息 @@ -26,6 +27,8 @@ layui.config({ // 组件获取的值的合入接口入参的方式 skyeyeClassEnumUtil.showEnumDataListByClassName("componentValueMergType", 'radio', "valueMergType", '', form); + textool.init({eleId: 'remark', maxlength: 200}); + // 根据类型获取部分功能的使用说明 systemCommonUtil.queryExplainMationByType(2, function(json) { $(".layui-colla-title").html(json.bean.title); @@ -85,6 +88,7 @@ layui.config({ applyRange: $("#applyRange input:radio:checked").val(), applyObject: isNull($("#applyObject").attr("chooseId")) ? JSON.stringify([]) : $("#applyObject").attr("chooseId"), valueMergType: dataShowType.getData('valueMergType'), + remark: $("#remark").val(), linkedData: '2' }; if ($("#linkedData").val() == 'true') { diff --git a/common/src/main/resources/template/js/dsFormComponent/dsFormComponentEdit.js b/common/src/main/resources/template/js/dsFormComponent/dsFormComponentEdit.js index 5b0668aef..2ff366c9d 100644 --- a/common/src/main/resources/template/js/dsFormComponent/dsFormComponentEdit.js +++ b/common/src/main/resources/template/js/dsFormComponent/dsFormComponentEdit.js @@ -4,12 +4,13 @@ layui.config({ version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui'].concat(dsFormUtil.mastHaveImport), function (exports) { +}).define(['window', 'table', 'jquery', 'winui', 'textool'].concat(dsFormUtil.mastHaveImport), function (exports) { winui.renderColor(); var index = parent.layer.getFrameIndex(window.name); var $ = layui.$, element = layui.element, colorpicker = layui.colorpicker, + textool = layui.textool; form = layui.form; showGrid({ @@ -19,7 +20,7 @@ layui.config({ pagination: false, method: 'GET', template: $("#beanTemplate").html(), - ajaxSendLoadBefore: function(hdb) { + ajaxSendLoadBefore: function(hdb, json) { hdb.registerHelper("compare2", function (v1, options) { if (v1 == '1') { return 'checked'; @@ -38,6 +39,7 @@ layui.config({ return 'false'; } }); + json.bean.remark = stringManipulation.textAreaShow(json.bean.remark); }, ajaxSendAfter: function(json) { // 加载图标信息 @@ -54,6 +56,8 @@ layui.config({ // 组件获取的值的合入接口入参的方式 skyeyeClassEnumUtil.showEnumDataListByClassName("componentValueMergType", 'radio', "valueMergType", json.bean.valueMergType, form); + textool.init({eleId: 'remark', maxlength: 200}); + // 根据类型获取部分功能的使用说明 systemCommonUtil.queryExplainMationByType(2, function (json) { $(".layui-colla-title").html(json.bean.title); @@ -101,6 +105,7 @@ layui.config({ applyRange: $("#applyRange input:radio:checked").val(), applyObject: isNull($("#applyObject").attr("chooseId")) ? JSON.stringify([]) : $("#applyObject").attr("chooseId"), valueMergType: dataShowType.getData('valueMergType'), + remark: $("#remark").val(), id: parent.rowId }; if ($("#linkedData").val() == 'true') { diff --git a/common/src/main/resources/template/js/dsFormPage/dsFormPageDesign.js b/common/src/main/resources/template/js/dsFormPage/dsFormPageDesign.js index e8824ae6f..07c8707fd 100644 --- a/common/src/main/resources/template/js/dsFormPage/dsFormPageDesign.js +++ b/common/src/main/resources/template/js/dsFormPage/dsFormPageDesign.js @@ -11,6 +11,9 @@ var sortDataIn; // 业务对象的属性信息 var attrList = []; +// 这两个参数为开启团队权限的对象拥有,这里没有实际用处,用于加载组件时临时有用。 +var objectId = '', objectKey = ''; + layui.config({ base: basePath, version: skyeyeVersion @@ -226,13 +229,13 @@ layui.config({ } var tip_index; - $("body").on("mouseenter", ".attr-mation", function (e) { + $("body").on("mouseenter", ".attr-mation, .component", function (e) { var title = $(this).attr('title'); if (isNull(title)) { return false; } tip_index = layer.tips(title, this, {time: 0, tips: 3}); - }).on('mouseleave', ".attr-mation", function() { + }).on('mouseleave', ".attr-mation, .component", function() { layer.close(tip_index); }); diff --git a/common/src/main/resources/template/js/dsFormPage/editPageContent.js b/common/src/main/resources/template/js/dsFormPage/editPageContent.js index 94bbdad98..f6db8f17f 100644 --- a/common/src/main/resources/template/js/dsFormPage/editPageContent.js +++ b/common/src/main/resources/template/js/dsFormPage/editPageContent.js @@ -99,6 +99,41 @@ layui.config({ `, + 'dateTimeTypeBox': `
+ +
+
+
`, + 'userSelBox': `
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
`, }; // 详情类布局才展示的组件属性 var detailsPageAttr = ['attrKeyBox', 'titleBox', 'widthBox']; @@ -123,6 +158,10 @@ layui.config({ $("#defaultValue").val(data.defaultValue); $("#uploadNum").val(data.uploadNum); + $("#chooseOrNotMy").val(data.chooseOrNotMy); + $("#chooseOrNotEmail").val(data.chooseOrNotEmail); + $("#checkType").val(data.checkType); + // 属性信息 var attrs = []; $.each(parent.attrList, function (i, item) { @@ -173,6 +212,9 @@ layui.config({ // 是否可以编辑 skyeyeClassEnumUtil.showEnumDataListByClassName("whetherEnum", 'radio', "isEdit", data.isEdit, form); + // 日期类型 + skyeyeClassEnumUtil.showEnumDataListByClassName("dateTimeType", 'select', "dateTimeType", data.dateTimeType, form); + matchingLanguage(); form.render(); form.on('submit(formAddBean)', function (data) { @@ -203,6 +245,11 @@ layui.config({ newParams.attrKey = $("#attrKey").val(); newParams.teamObjectType = $("#teamObjectType").val(); newParams.isEdit = dataShowType.getData("isEdit"); + newParams.dateTimeType = dataShowType.getData("dateTimeType"); + + newParams.chooseOrNotMy = $("#chooseOrNotMy").val(); + newParams.chooseOrNotEmail = $("#chooseOrNotEmail").val(); + newParams.checkType = $("#checkType").val(); if (!isNull($("#attrKey").val())) { newParams.attrDefinition = getInPoingArr(parent.attrList, 'attrKey', $("#attrKey").val()); diff --git a/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentAdd.html b/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentAdd.html index 0b42da4e3..cbc67ca16 100644 --- a/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentAdd.html +++ b/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentAdd.html @@ -119,6 +119,13 @@ +
+ +
+ +
+
+
diff --git a/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentEdit.html b/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentEdit.html index 7054d37ba..3857a4a0b 100644 --- a/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentEdit.html +++ b/common/src/main/resources/template/tpl/dsFormComponent/dsFormComponentEdit.html @@ -125,6 +125,13 @@
+
+ +
+ +
+
+
diff --git a/common/src/main/resources/template/tpl/dsFormPage/dsFormPageDesign.html b/common/src/main/resources/template/tpl/dsFormPage/dsFormPageDesign.html index 5b8eb5bab..d08dc8613 100644 --- a/common/src/main/resources/template/tpl/dsFormPage/dsFormPageDesign.html +++ b/common/src/main/resources/template/tpl/dsFormPage/dsFormPageDesign.html @@ -41,7 +41,7 @@ {{@key}}
{{#each @this}} -
+
{{{logo}}}
diff --git a/crm/src/main/resources/template/js/crmContract/crmContractList.js b/crm/src/main/resources/template/js/crmContract/crmContractList.js index acbba2fb0..7c74267d4 100644 --- a/crm/src/main/resources/template/js/crmContract/crmContractList.js +++ b/crm/src/main/resources/template/js/crmContract/crmContractList.js @@ -134,8 +134,8 @@ layui.config({ // 新增 $("body").on("click", "#addBean", function() { - _openNewWindows({ - url: systemCommonUtil.getUrl('FP2023030400002&objectId=' + objectId + '&objectKey=' + objectKey, null), + parent._openNewWindows({ + url: systemCommonUtil.getUrl('FP2023030500001&objectId=' + objectId + '&objectKey=' + objectKey, null), title: systemLanguage["com.skyeye.addPageTitle"][languageType], pageId: "contactsAdd", area: ['90vw', '90vh'], @@ -147,7 +147,7 @@ layui.config({ // 编辑 function edit(data) { - _openNewWindows({ + parent._openNewWindows({ url: systemCommonUtil.getUrl('FP2023030400003&objectId=' + objectId + '&objectKey=' + objectKey + '&id=' + data.id, null), title: systemLanguage["com.skyeye.editPageTitle"][languageType], pageId: "contactsEdit", diff --git a/crm/src/main/resources/template/js/crmContract/mycrmcontractadd.js b/crm/src/main/resources/template/js/crmContract/mycrmcontractadd.js index bacc0d7ba..1cd591e18 100644 --- a/crm/src/main/resources/template/js/crmContract/mycrmcontractadd.js +++ b/crm/src/main/resources/template/js/crmContract/mycrmcontractadd.js @@ -44,7 +44,10 @@ layui.config({ placeholder: '请选择关联人员', editorTag: false, beforeTagDelete: function(field, editor, tags, val) { - userList = [].concat(arrayUtil.removeArrayPointName(userList, val)); + var listVal = $("#").attr('list'); + var list = isNull(listVal) ? [] : JSON.parse(listVal); + list = [].concat(arrayUtil.removeArrayPointName(list, val)); + $("#").attr('list', JSON.stringify(list)); } }); // 关联人员选择选择 diff --git a/web/src/main/resources/template/assets/lib/layui/custom.js b/web/src/main/resources/template/assets/lib/layui/custom.js index aa2815117..15a8bab45 100644 --- a/web/src/main/resources/template/assets/lib/layui/custom.js +++ b/web/src/main/resources/template/assets/lib/layui/custom.js @@ -829,6 +829,9 @@ function getUserStaffHtmlMationByStaffId(staffId){ */ var stringManipulation = { textAreaShow: function(str){ + if (isNull(str)) { + return ''; + } // IE7-8、IE9、FF、chrome。解决textarea中输入的文字,输出到div中文字不换自动换行的问题 return str.replace(/\r\n/g, '
').replace(/\n/g, '
'); } 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 e262e37c2..6c273c8ab 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 @@ -297,11 +297,11 @@ var systemCommonUtil = { tagEditorGetAllData: function (id, list) { var tags = $('#' + id).tagEditor('getTags')[0].tags; if (list.length == 0 || isNull(tags)) { - return ""; + return []; } else { - var ids = ""; + var ids = []; $.each(list, function (i, item) { - ids += item.id + ','; + ids.push(item.id); }); return ids; } 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 8a114c766..b2c81bb65 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 @@ -219,6 +219,10 @@ var dsFormUtil = { content.attrDefinition = {}; } + if (!isNull(content.require)) { + content.require = content.require.join('|'); + } + var jsonStr = {bean: content}; var html = getDataUseHandlebars('{{#bean}}' + component.htmlContent + '{{/bean}}', jsonStr); var html_js = getDataUseHandlebars('{{#bean}}' + component.jsContent + '{{/bean}}', jsonStr); @@ -324,6 +328,7 @@ var dsFormUtil = { return content.title; }, + // 获取属性关联的数据值来源信息 getContentLinkedData: function (content) { var json = {}; if (isNull(content.attrDefinition) || isNull(content.attrDefinition.attrDefinitionCustom)) { @@ -331,7 +336,7 @@ var dsFormUtil = { } var customAttr = content.attrDefinition.attrDefinitionCustom; var dataType = customAttr.dataType; - if (isNull(customAttr.objectId) && isNull(customAttr.defaultData)) { + if (isNull(customAttr.objectId) && isNull(customAttr.defaultData) && isNull(customAttr.businessApi) && $.isEmptyObject(customAttr.businessApi)) { return content; } if (dataType == 1) { @@ -349,6 +354,20 @@ var dsFormUtil = { sysDictDataUtil.queryDictDataListByDictTypeCode(customAttr.objectId, function (data) { json = data.rows; }); + } else if (dataType == 4) { + // 自定义接口 + var businessApi = customAttr.businessApi; + var params = {}; + $.each(businessApi.params, function (key, value) { + var realValue = ""; + eval('realValue = ' + value); + params[key] = realValue; + }); + var url = ""; + eval('url = ' + businessApi.serviceStr + ' + "' + businessApi.api + '"'); + AjaxPostUtil.request({url: url, params: params, type: 'json', method: businessApi.method, callback: function (data) { + json = data.rows; + }, async: false}); } if (!isNull(content.dsFormComponent.htmlDataFrom)) { content.context = getDataUseHandlebars(content.dsFormComponent.htmlDataFrom, json); @@ -356,6 +375,7 @@ var dsFormUtil = { return content; }, + // 获取显示值 getContentLinkedDataValue: function (content, value) { if (isNull(value)) { return null; @@ -371,7 +391,7 @@ var dsFormUtil = { } } - if (isNull(customAttr.objectId) && isNull(customAttr.defaultData)) { + if (isNull(customAttr.objectId) && isNull(customAttr.defaultData) && isNull(customAttr.businessApi) && $.isEmptyObject(customAttr.businessApi)) { return value; } @@ -389,6 +409,22 @@ var dsFormUtil = { } else if (dataType == 3) { // 数据字典 return sysDictDataUtil.getDictDataNameByCodeAndKey(customAttr.objectId, value); + } else if (dataType == 4) { + // 自定义接口 + var businessApi = customAttr.businessApi; + var params = {}; + $.each(businessApi.params, function (key, value) { + var realValue = ""; + eval('realValue = ' + value); + params[key] = realValue; + }); + var url = ""; + var obj = []; + eval('url = ' + businessApi.serviceStr + ' + "' + businessApi.api + '"'); + AjaxPostUtil.request({url: url, params: params, type: 'json', method: businessApi.method, callback: function (json) { + obj = json.beans; + }, async: false}); + return getInPoingArr(obj, "id", value, "name"); } return value; }, @@ -639,7 +675,7 @@ var dsFormTableUtil = { } var customAttr = item.attrDefinition.attrDefinitionCustom; var dataType = customAttr.dataType; - if (isNull(customAttr.objectId) && isNull(customAttr.defaultData)) { + if (isNull(customAttr.objectId) && isNull(customAttr.defaultData) && isNull(customAttr.businessApi) && $.isEmptyObject(customAttr.businessApi)) { return null; } if (dataType == 1) { @@ -658,6 +694,25 @@ var dsFormTableUtil = { } else if (dataType == 3) { // 数据字典 return `function (d) {return sysDictDataUtil.getDictDataNameByCodeAndKey('${customAttr.objectId}', d.${item.attrKey});}`; + } else if (dataType == 4) { + // 自定义接口 + var businessApi = customAttr.businessApi; + var params = {}; + $.each(businessApi.params, function (key, value) { + var realValue = ""; + eval('realValue = ' + value); + params[key] = realValue; + }); + var url = ""; + var obj = []; + eval('url = ' + businessApi.serviceStr + ' + "' + businessApi.api + '"'); + AjaxPostUtil.request({url: url, params: params, type: 'json', method: businessApi.method, callback: function (json) { + obj = json.beans; + }, async: false}); + return `function (d) { + var json = ${obj}; + return getInPoingArr(json, "id", d.${item.attrKey}, "name"); + }`; } } return null; diff --git a/web/src/main/resources/template/json/skyeyeClassEnum.json b/web/src/main/resources/template/json/skyeyeClassEnum.json index 0d259886a..f4ea12208 100644 --- a/web/src/main/resources/template/json/skyeyeClassEnum.json +++ b/web/src/main/resources/template/json/skyeyeClassEnum.json @@ -5,6 +5,7 @@ "verificationParams": {"name": "字段校验枚举", "className": "skyeye-pro#com.skyeye.common.enumeration.VerificationParamsEnum"}, "isUsed": {"name": "是否使用的枚举", "className": "skyeye-pro#com.skyeye.common.enumeration.IsUsedEnum"}, "whetherEnum": {"name": "是否的枚举", "className": "skyeye-pro#com.skyeye.common.enumeration.WhetherEnum"}, + "dateTimeType": {"name": "日期类型", "className": "skyeye-pro#com.skyeye.dsform.classenum.DateTimeType"}, "bossInterviewArrangementState": {"name": "面试安排状态枚举类", "className": "skyeye-flowable#com.skyeye.service.enumclass.BossInterviewArrangementState"}, "bossInterviewArrangementState1": { -- GitLab