diff --git a/base-server/src/main/resources/template/js/processAttr/processAttrEdit.js b/base-server/src/main/resources/template/js/processAttr/processAttrEdit.js new file mode 100644 index 0000000000000000000000000000000000000000..f1ee1ecdaa95b99c63279d8db8d2684e823794c2 --- /dev/null +++ b/base-server/src/main/resources/template/js/processAttr/processAttrEdit.js @@ -0,0 +1,220 @@ + +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 alignmentData; + var rowNum = 1; + AjaxPostUtil.request({url: reqBasePath + "queryAttrTransformById", params: {id: parent.rowId}, type: 'json', method: "GET", callback: function (json) { + $("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), json)); + + AjaxPostUtil.request({url: reqBasePath + "queryAttrDefinitionList", params: {className: parent.objectId}, type: 'json', method: "POST", callback: function (data) { + $("#attrKey").html(getDataUseHandlebars(`{{#each rows}}{{/each}}`, data)); + $("#attrKey").val(json.bean.attrKey); + }, async: false}); + + skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", json.bean.showType, form); + skyeyeClassEnumUtil.showEnumDataListByClassName("widthScale", 'select', "proportion", json.bean.proportion, form); + alignmentData = skyeyeClassEnumUtil.getEnumDataListByClassName("alignment"); + + if (json.bean.showType == 5) { + $("#tableBox").show(); + $.each(json.bean.attrTransformTableList, function(j, item) { + item.id = rowNum; + tableDataList.push(item); + rowNum++; + }); + buildTable(); + } else { + $("#tableBox").hide(); + } + + matchingLanguage(); + form.render(); + form.on('submit(formEditBean)', 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(), + id: parent.rowId + }; + AjaxPostUtil.request({url: reqBasePath + "writeAttrTransform", params: params, type: 'json', method: "POST", callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); + } + return false; + }); + }, async: false}); + + form.on('select(attrKey)', function(data) { + tableDataList = new Array(); + buildTable(); + }); + form.on('select(showType)', function(data) { + var value = data.value; + if (value == 5) { + $("#tableBox").show(); + } else { + $("#tableBox").hide(); + } + tableDataList = new Array(); + buildTable(); + }); + + function buildTable() { + if ($("#showType").val() == 5 && !isNull($("#attrKey").val())) { + 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 { + 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(); + } + }); + } + + $("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 index 3db964f86253c6ff57f6edf35a1a506183406be3..8ccc381f01310ec107e90b90d26d30d0f15c03a5 100644 --- a/base-server/src/main/resources/template/js/processAttr/processAttrList.js +++ b/base-server/src/main/resources/template/js/processAttr/processAttrList.js @@ -86,9 +86,9 @@ layui.config({ return false; } _openNewWindows({ - url: "../../tpl/processAttr/teamTemplateEdit.html", + url: "../../tpl/processAttr/processAttrEdit.html", title: systemLanguage["com.skyeye.editPageTitle"][languageType], - pageId: "teamTemplateEdit", + pageId: "processAttrEdit", area: ['90vw', '90vh'], callBack: function (refreshCode) { winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); diff --git a/base-server/src/main/resources/template/tpl/processAttr/processAttrEdit.html b/base-server/src/main/resources/template/tpl/processAttr/processAttrEdit.html new file mode 100644 index 0000000000000000000000000000000000000000..a951e43807050fb92c7295f132d284f9311a4545 --- /dev/null +++ b/base-server/src/main/resources/template/tpl/processAttr/processAttrEdit.html @@ -0,0 +1,101 @@ + + + + + + + + + + +
+
+ +
+
+ + + + + + + + \ No newline at end of file