From 08850f318aaad645a494b06c4ab19b24697487eb Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Wed, 21 Dec 2022 22:24:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=B1=9E=E6=80=A7=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attrList.js} | 2 +- .../template/js/classServer/classServer.js | 4 +- .../classServer/classServerProcessAttrList.js | 59 ----- .../template/js/processAttr/processAttrAdd.js | 204 ++++++++++++++++++ .../js/processAttr/processAttrList.js | 132 ++++++++++++ .../attrList.html} | 2 +- .../classServerProcessAttrList.html | 19 -- .../tpl/processAttr/processAttrAdd.html | 95 ++++++++ .../tpl/processAttr/processAttrList.html | 34 +++ .../layui/customer/common/systemCommonUtil.js | 35 +-- .../template/json/skyeyeClassEnum.json | 5 +- 11 files changed, 493 insertions(+), 98 deletions(-) rename base-server/src/main/resources/template/js/{classServer/classServerAttrList.js => attr/attrList.js} (97%) delete mode 100644 base-server/src/main/resources/template/js/classServer/classServerProcessAttrList.js create mode 100644 base-server/src/main/resources/template/js/processAttr/processAttrAdd.js create mode 100644 base-server/src/main/resources/template/js/processAttr/processAttrList.js rename base-server/src/main/resources/template/tpl/{classServer/classServerAttrList.html => attr/attrList.html} (85%) delete mode 100644 base-server/src/main/resources/template/tpl/classServer/classServerProcessAttrList.html create mode 100644 base-server/src/main/resources/template/tpl/processAttr/processAttrAdd.html create mode 100644 base-server/src/main/resources/template/tpl/processAttr/processAttrList.html diff --git a/base-server/src/main/resources/template/js/classServer/classServerAttrList.js b/base-server/src/main/resources/template/js/attr/attrList.js similarity index 97% rename from base-server/src/main/resources/template/js/classServer/classServerAttrList.js rename to base-server/src/main/resources/template/js/attr/attrList.js index 990ccf6f2..12dc05443 100644 --- a/base-server/src/main/resources/template/js/classServer/classServerAttrList.js +++ b/base-server/src/main/resources/template/js/attr/attrList.js @@ -55,5 +55,5 @@ layui.config({ form.render(); - exports('classServerAttrList', {}); + exports('attrList', {}); }); \ No newline at end of file diff --git a/base-server/src/main/resources/template/js/classServer/classServer.js b/base-server/src/main/resources/template/js/classServer/classServer.js index 7df90b7fe..adf315772 100644 --- a/base-server/src/main/resources/template/js/classServer/classServer.js +++ b/base-server/src/main/resources/template/js/classServer/classServer.js @@ -38,7 +38,7 @@ layui.config({ pageUrl: '../../tpl/classServer/classServerDetails.html' }, { title: '属性信息', - pageUrl: '../../tpl/classServer/classServerAttrList.html' + pageUrl: '../../tpl/attr/attrList.html' }]; if (chooseTreeNode.classMation.flowable) { @@ -48,7 +48,7 @@ layui.config({ }); defaultList.push({ title: '流程属性信息', - pageUrl: '../../tpl/classServer/classServerProcessAttrList.html' + pageUrl: '../../tpl/processAttr/processAttrList.html' }); } diff --git a/base-server/src/main/resources/template/js/classServer/classServerProcessAttrList.js b/base-server/src/main/resources/template/js/classServer/classServerProcessAttrList.js deleted file mode 100644 index 4c25dcbe5..000000000 --- a/base-server/src/main/resources/template/js/classServer/classServerProcessAttrList.js +++ /dev/null @@ -1,59 +0,0 @@ - -var objectId = ""; - -layui.config({ - base: basePath, - version: skyeyeVersion -}).extend({ - window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) { - winui.renderColor(); - var $ = layui.$, - form = layui.form, - table = layui.table; - - objectId = GetUrlParam("objectId"); - if (isNull(objectId)) { - winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000}); - return false; - } - - table.render({ - id: 'messageTable', - elem: '#messageTable', - method: 'post', - url: reqBasePath + '', - where: {className: objectId}, - even: true, - page: false, - limits: getLimits(), - limit: getLimit(), - cols: [[ - { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, - { field: 'attrKey', title: '属性', align: 'left', width: 150 }, - { field: 'name', title: '名称', align: 'left', width: 120 }, - { field: 'attrType', title: '类型', align: 'left', width: 120 }, - { field: 'remark', title: '备注', align: 'left', width: 150 }, - { field: 'required', title: '限制条件', align: 'left', width: 140 }, - { field: 'modelAttribute', title: '是否模型属性', align: 'center', width: 100, templet: function (d) { - if (d.modelAttribute) { - return '是'; - } - return '否'; - }}, - { field: 'whetherInputParams', title: '是否作为入参', align: 'center', width: 100, templet: function (d) { - if (d.whetherInputParams) { - return '是'; - } - return '否'; - }} - ]], - done: function(json) { - matchingLanguage(); - } - }); - - form.render(); - - exports('classServerProcessAttrList', {}); -}); \ No newline at end of file diff --git a/base-server/src/main/resources/template/js/processAttr/processAttrAdd.js b/base-server/src/main/resources/template/js/processAttr/processAttrAdd.js new file mode 100644 index 000000000..32e61f6ed --- /dev/null +++ b/base-server/src/main/resources/template/js/processAttr/processAttrAdd.js @@ -0,0 +1,204 @@ + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'jquery', 'winui', 'form', 'soulTable', 'table'], function (exports) { + winui.renderColor(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form, + table = layui.table, + soulTable = layui.soulTable; + var tableDataList = new Array(); + var rowNum = 1; + $("#tableBox").hide(); + + AjaxPostUtil.request({url: reqBasePath + "queryAttrDefinitionList", params: {className: parent.objectId}, type: 'json', method: "POST", callback: function (json) { + $("#attrKey").html(getDataUseHandlebars(`{{#each rows}}{{/each}}`, json)); + }, async: false}); + + skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", '', form); + skyeyeClassEnumUtil.showEnumDataListByClassName("widthScale", 'select', "proportion", '', form); + + var alignmentData = skyeyeClassEnumUtil.getEnumDataListByClassName("alignment"); + + form.on('select(attrKey)', function(data) { + buildTable(); + }); + form.on('select(showType)', function(data) { + var value = data.value; + if (value == 5) { + $("#tableBox").show(); + } else { + $("#tableBox").hide(); + } + buildTable(); + }); + + function buildTable() { + if ($("#showType").val() == 5 && !isNull($("#attrKey").val())) { + tableDataList = new Array(); + var params = { + className: parent.objectId, + attrKey: $("#attrKey").val() + }; + var childAttr = []; + AjaxPostUtil.request({url: reqBasePath + "queryChildAttrDefinitionList", params: params, type: 'json', method: "POST", callback: function (json) { + childAttr = [].concat(json.rows); + }, async: false}); + table.render({ + id: 'messageTable', + elem: '#messageTable', + method: 'get', + data: tableDataList, + even: true, + page: false, + rowDrag: { + trigger: 'row', + done: function(obj) {} + }, + cols: [[ + { type: 'checkbox', align: 'center' }, + { field: 'attrKey', title: '属性', align: 'left', width: 150, templet: function (d) { + var _html = ``; + return _html; + }}, + { field: 'align', title: '对齐方式', align: 'left', width: 120, templet: function (d) { + var _html = ``; + return _html; + }}, + { field: 'width', title: '宽度', align: 'left', width: 120, templet: function (d) { + return ``; + }}, + { field: 'templet', title: '脚本', align: 'left', width: 240, templet: function (d) { + return ``; + }}, + ]], + done: function(json) { + matchingLanguage(); + if ($(`div[lay-id='messageTable']`).find('.place-holder').length == 0) { + $(`div[lay-id='messageTable']`).find('.layui-table-body').append('
'); + } + soulTable.render(this); + } + }); + } else { + tableDataList = new Array(); + table.reloadData("messageTable", {data: tableDataList}); + } + } + + form.on('select(tableSelect)', function(data) { + var id = data.elem.id; + buildData($(`#${id}`)) + }); + $("body").on("input", ".tableInput", function () { + buildData($(this)) + }); + $("body").on("change", ".tableInput", function () { + buildData($(this)) + }); + + function buildData(_this) { + var id = _this.attr('cus-id'); + var key = _this.attr('id').replace(id, ''); + $.each(tableDataList, function (j, item) { + if (item.id == id) { + item[key] = _this.val(); + } + }); + } + + matchingLanguage(); + form.render(); + form.on('submit(formAddBean)', function (data) { + if (winui.verifyForm(data.elem)) { + if ($("#showType").val() == 5) { + if (tableDataList.length == 0) { + winui.window.msg('请选择表格属性.', {icon: 2, time: 2000}); + return false; + } + $.each(tableDataList, function (i, item) { + item.id = null; + item.className = parent.objectId; + item.parentAttrKey = $("#attrKey").val(); + item.orderBy = i + 1; + item.actFlowId = parent.$("#actFlowId").val(); + }); + } else { + tableDataList = new Array(); + } + + var params = { + className: parent.objectId, + attrKey: $("#attrKey").val(), + orderBy: $("#orderBy").val(), + showType: $("#showType").val(), + attrTransformTableList: JSON.stringify(tableDataList), + proportion: $("#proportion").val(), + actFlowId: parent.$("#actFlowId").val(), + }; + AjaxPostUtil.request({url: reqBasePath + "writeAttrTransform", params: params, type: 'json', method: "POST", callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); + } + return false; + }); + + $("body").on("click", "#addRow", function() { + addRow(); + }); + + $("body").on("click", "#deleteRow", function() { + deleteRow(); + }); + + // 新增行 + function addRow() { + tableDataList = [].concat(table.cache.messageTable); + tableDataList.push({id: rowNum}); + table.reloadData("messageTable", {data: tableDataList}); + rowNum++; + } + + // 删除行 + function deleteRow() { + tableDataList = [].concat(table.cache.messageTable); + var check_box = table.checkStatus('messageTable').data; + for (var i = 0; i < check_box.length; i++){ + var list = []; + $.each(tableDataList, function(j, item) { + if(item.id != check_box[i].id){ + list.push(item); + } + }); + tableDataList = [].concat(list); + } + table.reloadData("messageTable", {data: tableDataList}); + } + + $("body").on("click", "#cancle", function() { + parent.layer.close(index); + }); +}); \ No newline at end of file diff --git a/base-server/src/main/resources/template/js/processAttr/processAttrList.js b/base-server/src/main/resources/template/js/processAttr/processAttrList.js new file mode 100644 index 000000000..6bbbc3d1e --- /dev/null +++ b/base-server/src/main/resources/template/js/processAttr/processAttrList.js @@ -0,0 +1,132 @@ + +var objectId = ""; + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) { + winui.renderColor(); + var $ = layui.$, + form = layui.form, + table = layui.table; + + objectId = GetUrlParam("objectId"); + if (isNull(objectId)) { + winui.window.msg("请传入适用对象信息", {icon: 2, time: 2000}); + return false; + } + + AjaxPostUtil.request({url: flowableBasePath + 'queryActFlowListByClassName', params: {className: objectId}, type: 'json', method: "POST", callback: function (json) { + $("#actFlowId").html(getDataUseHandlebars(`{{#each rows}}{{/each}}`, json)); + }, async: false}); + + form.on('select(actFlowId)', function(data) { + loadTable(); + }); + + table.render({ + id: 'messageTable', + elem: '#messageTable', + method: 'post', + url: reqBasePath + 'queryAttrTransformList', + where: getTableParams(), + even: true, + page: false, + limits: getLimits(), + limit: getLimit(), + cols: [[ + { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, + { field: 'attrKey', title: '属性', align: 'left', width: 150 }, + { field: 'proportion', title: '宽度比例', align: 'left', width: 120, templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("widthScale", 'id', d.proportion, 'name'); + }}, + { field: 'showType', title: '显示类型', align: 'left', width: 120, templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', d.showType, 'name'); + }}, + { field: 'orderBy', title: '排序', align: 'left', width: 100 }, + { field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 }, + { 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: 'lastUpdateTime', title: systemLanguage["com.skyeye.lastUpdateTime"][languageType], align: 'center', width: 150 }, + { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 180, toolbar: '#tableBar' } + ]], + done: function(json) { + matchingLanguage(); + } + }); + + table.on('tool(messageTable)', function (obj) { + var data = obj.data; + var layEvent = obj.event; + if (layEvent === 'del') { // 删除 + del(data, obj); + } else if (layEvent === 'edit') { // 编辑 + edit(data); + } + }); + + // 删除 + function del(data, obj) { + layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) { + layer.close(index); + AjaxPostUtil.request({url: reqBasePath + "deleteTeamTemplateById", params: {id: data.id}, type: 'json', method: "DELETE", callback: function (json) { + winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000}); + loadTable(); + }}); + }); + } + + // 编辑 + function edit(data) { + rowId = data.id; + if (isNull($("#actFlowId"))) { + winui.window.msg('请先绑定流程.', {icon: 2, time: 2000}); + return false; + } + _openNewWindows({ + url: "../../tpl/processAttr/teamTemplateEdit.html", + title: systemLanguage["com.skyeye.editPageTitle"][languageType], + pageId: "teamTemplateEdit", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + loadTable(); + }}); + } + + // 新增 + $("body").on("click", "#addBean", function() { + if (isNull($("#actFlowId"))) { + winui.window.msg('请先绑定流程.', {icon: 2, time: 2000}); + return false; + } + _openNewWindows({ + url: "../../tpl/processAttr/processAttrAdd.html", + title: systemLanguage["com.skyeye.addPageTitle"][languageType], + pageId: "processAttrAdd", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + loadTable(); + }}); + }); + + form.render(); + $("body").on("click", "#reloadTable", function() { + loadTable(); + }); + function loadTable() { + table.reloadData("messageTable", {where: getTableParams()}); + } + + function getTableParams() { + return { + className: objectId, + actFlowId: $('#actFlowId').val() + }; + } + + exports('processAttrList', {}); +}); \ No newline at end of file diff --git a/base-server/src/main/resources/template/tpl/classServer/classServerAttrList.html b/base-server/src/main/resources/template/tpl/attr/attrList.html similarity index 85% rename from base-server/src/main/resources/template/tpl/classServer/classServerAttrList.html rename to base-server/src/main/resources/template/tpl/attr/attrList.html index 13edcdcb9..3360f95de 100644 --- a/base-server/src/main/resources/template/tpl/classServer/classServerAttrList.html +++ b/base-server/src/main/resources/template/tpl/attr/attrList.html @@ -13,7 +13,7 @@ \ No newline at end of file diff --git a/base-server/src/main/resources/template/tpl/classServer/classServerProcessAttrList.html b/base-server/src/main/resources/template/tpl/classServer/classServerProcessAttrList.html deleted file mode 100644 index b67a3c303..000000000 --- a/base-server/src/main/resources/template/tpl/classServer/classServerProcessAttrList.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - -
-
-
- - - - - \ No newline at end of file diff --git a/base-server/src/main/resources/template/tpl/processAttr/processAttrAdd.html b/base-server/src/main/resources/template/tpl/processAttr/processAttrAdd.html new file mode 100644 index 000000000..5c77207c6 --- /dev/null +++ b/base-server/src/main/resources/template/tpl/processAttr/processAttrAdd.html @@ -0,0 +1,95 @@ + + + + + + + + + + +
+
+
+ 基本信息
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
序号越大越往后。
+
+
+
+ +
+ +
+
+
+ +
+
+ 拖拽表格行可修改顺序。 +
+
+ + +
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/base-server/src/main/resources/template/tpl/processAttr/processAttrList.html b/base-server/src/main/resources/template/tpl/processAttr/processAttrList.html new file mode 100644 index 000000000..588624a16 --- /dev/null +++ b/base-server/src/main/resources/template/tpl/processAttr/processAttrList.html @@ -0,0 +1,34 @@ + + + + + + + + + +
+
+
+ +
+ + +
+
+
+
+ +
+ + + + + \ No newline at end of file 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 9492f01d5..7fc8249df 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 @@ -763,23 +763,10 @@ var tabPageUtil = { {{/rows}}`, - config: { - id: '', // 展示位置 - prefixData: [], // 集合前面追加的其他需要加载的数据 例如:{title: '详情', pageUrl: '../../tpl/customerManage/customerDetails.html'} - suffixData: [{ - title: '团队', - pageUrl: '../../tpl/teamBusiness/teamBusinessDetails.html' - }], // 集合后面追加的其他需要加载的数据 例如:{title: '详情', pageUrl: '../../tpl/customerManage/customerDetails.html'} - element: null, // element对象 - objectType: '', // 适用对象 例如:客户,项目等 - pageList: [], // 页面信息 - object: { - objectId: '', // 业务对象id - objectKey: '', // 业务对象key - } - }, + config: null, init: function (_config) { + tabPageUtil.initialization(); tabPageUtil.config = $.extend(true, tabPageUtil.config, _config); if (_config.suffixData == null) { tabPageUtil.config.suffixData = []; @@ -803,6 +790,24 @@ var tabPageUtil = { tabPageUtil.initEvent(); }, + initialization: function () { + tabPageUtil.config = { + id: '', // 展示位置 + prefixData: [], // 集合前面追加的其他需要加载的数据 例如:{title: '详情', pageUrl: '../../tpl/customerManage/customerDetails.html'} + suffixData: [{ + title: '团队', + pageUrl: '../../tpl/teamBusiness/teamBusinessDetails.html' + }], // 集合后面追加的其他需要加载的数据 例如:{title: '详情', pageUrl: '../../tpl/customerManage/customerDetails.html'} + element: null, // element对象 + objectType: '', // 适用对象 例如:客户,项目等 + pageList: [], // 页面信息 + object: { + objectId: '', // 业务对象id + objectKey: '', // 业务对象key + } + }; + }, + initEvent: function () { tabPageUtil.config.element.on('tab(manageTab)', function (obj) { var mation = tabPageUtil.config.pageList[obj.index]; diff --git a/web/src/main/resources/template/json/skyeyeClassEnum.json b/web/src/main/resources/template/json/skyeyeClassEnum.json index 5dbcf7636..91a9d64e2 100644 --- a/web/src/main/resources/template/json/skyeyeClassEnum.json +++ b/web/src/main/resources/template/json/skyeyeClassEnum.json @@ -22,6 +22,9 @@ "materialType": {"name": "商品类型枚举类", "className": "skyeye-flowable#com.skyeye.material.enumclass.MaterialType"}, "skyeyeView": {"name": "视图枚举", "className": "skyeye-pro#com.skyeye.common.SkyeyeViewEnum"}, + "widthScale": {"name": "宽度比例枚举", "className": "skyeye-pro#com.skyeye.attr.classenum.WidthScale"}, + "dsFormShowType": {"name": "组件展示类型枚举", "className": "skyeye-pro#com.skyeye.attr.classenum.DsFormShowType"}, + "alignment": {"name": "对齐方式枚举", "className": "skyeye-pro#com.skyeye.attr.classenum.Alignment"}, "tenantEnum": {"name": "租户枚举", "className": "skyeye-pro#com.skyeye.common.enumeration.TenantEnum"}, @@ -29,6 +32,6 @@ "contactsAuthEnum": {"name": "联系人权限", "className": "skyeye-pro#com.skyeye.contacts.classenum.ContactsAuthEnum", "pageUrl": "../../tpl/contacts/contactsList.html"}, "catalogAuthEnum": {"name": "目录权限", "className": "skyeye-pro#com.skyeye.catalog.classenum.CatalogAuthEnum"}, "documentAuthEnum": {"name": "文档权限", "className": "skyeye-pro#com.skyeye.document.classenum.DocumentAuthEnum"}, - "documentAuthEnum": {"name": "讨论帖权限", "className": "skyeye-pro#com.skyeye.discussion.classenum.DisCussionAuthEnum"} + "disCussionAuthEnum": {"name": "讨论帖权限", "className": "skyeye-pro#com.skyeye.discussion.classenum.DisCussionAuthEnum"} } \ No newline at end of file -- GitLab