diff --git a/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/style1.css b/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/style1.css index 82e4e16ea55d2f39e85c8b04f5489edf1cf85aa1..249ad022a63c2913c8d45a045a9e8f593cd3ea71 100644 --- a/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/style1.css +++ b/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/style1.css @@ -720,7 +720,7 @@ div.pq-toolbar { } .box1>.layui-side-scroll>div>.layui-tab-title>.layui-tab-bar { - display: none; + display: none !important; } .box1 .layui-tab { diff --git a/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/tab.css b/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/tab.css index 68f73deadf3cb3be117198063ba80ab4d99bae60..cf04a675a82a95517d147c0af0ba9b2218430871 100644 --- a/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/tab.css +++ b/fast-develop-web/fast-develop-editor/src/fast-develop/src/css/tab.css @@ -9,7 +9,7 @@ } .pear-tab .layui-tab-content .layui-tab-item { - height: 100%; + height: calc(100% - 33px); } .pear-tab-menu{ diff --git a/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/editor/resource_tree.js b/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/editor/resource_tree.js index 7fa80d25f78513c366ba0ac484fa3afcd01a8312..216fafc0960f514287e519ef15211f9ce0ac2518 100644 --- a/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/editor/resource_tree.js +++ b/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/editor/resource_tree.js @@ -302,36 +302,33 @@ layui.define(['element', 'api', 'amis', 'schema', 'listener', 'api', 'jqgrid', ' } function selectedNode(data){ + debugger //1、刷新树,渲染追加新增的节点 reloadResource(data); refreshTabContentData(); // 2、根据参数获取树节点 var tree = getTree() - // if(data && data.id){ - const treeNode = JSON.parse(sessionStorage.getItem('content-pear-current-treeNode')) - if(!!treeNode && treeNode !== null){ - // 再次激活当前tab页面的树id - var id = treeNode.id - - let node = selectedPath(tree, id); + if(data && data.id){ + let node = selectedPath(tree, data.id); // let node = tree.getNodeByParam("id", data.id, null); //3、选择目标节点 tree.selectNode(node); //单击事件 tree.setting.callback.onClick(event,getTreeId(),node); + } + + // const treeNode = JSON.parse(sessionStorage.getItem('content-pear-current-treeNode')) + // if(!!treeNode && treeNode !== null){ + // // 再次激活当前tab页面的树id + // var id = treeNode.id + + // let node = selectedPath(tree, id); + // //3、选择目标节点 + // tree.selectNode(node); + // //单击事件 + // tree.setting.callback.onClick(event,getTreeId(),node); // } - } - // // 再次激活当前tab页面的树id - // var id = JSON.parse(sessionStorage.getItem('content-pear-current-treeNode')).id - - // let node = selectedPath(tree, id); - // // let node = tree.getNodeByParam("id", data.id, null); - // //3、选择目标节点 - // tree.selectNode(node); - // //单击事件 - // tree.setting.callback.onClick(event,getTreeId(),node); - // // } } diff --git a/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/utils.js b/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/utils.js index 059fee2ba7a3ce2842ce88f7e68662701f8cc9f5..d99c47ae2372681db579812a353c7a6a85ce185c 100644 --- a/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/utils.js +++ b/fast-develop-web/fast-develop-editor/src/fast-develop/src/js/module/utils.js @@ -1,53 +1,51 @@ - -layui.define(['element','api','schema','fast_config'], function(exports) { - "use strict"; +layui.define(['element', 'api', 'schema', 'fast_config'], function (exports) { + "use strict"; /** - * Button component - * */ - var MOD_NAME = 'utils', + * Button component + * */ + var MOD_NAME = 'utils', api = layui.api, fast_config = layui.fast_config, schema = layui.schema, - $ = layui.jquery, + $ = layui.jquery, treeNodeData, - globalEnv - ; - - - Date.prototype.format = function (format) { - var args = { - "M+": this.getMonth() + 1, - "d+": this.getDate(), - "h+": this.getHours(), - "m+": this.getMinutes(), - "s+": this.getSeconds(), - }; - if (/(y+)/.test(format)) - format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); - for (var i in args) { - var n = args[i]; - if (new RegExp("(" + i + ")").test(format)) - format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length)); - } - return format; + globalEnv; + + + Date.prototype.format = function (format) { + var args = { + "M+": this.getMonth() + 1, + "d+": this.getDate(), + "h+": this.getHours(), + "m+": this.getMinutes(), + "s+": this.getSeconds(), + }; + if (/(y+)/.test(format)) + format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var i in args) { + var n = args[i]; + if (new RegExp("(" + i + ")").test(format)) + format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length)); + } + return format; }; - String.prototype.format = function() { - if(arguments.length == 0) return this; + String.prototype.format = function () { + if (arguments.length == 0) return this; var obj = utils.getGlobalEnv(arguments[0]); var s = this; - for(var key in obj) { + for (var key in obj) { var value = JSON.stringify(obj[key]); - if( typeof(obj[key])=='object'){ + if (typeof (obj[key]) == 'object') { s = s.replace(new RegExp("\"\\$\\{" + key + "\\}\"", "g"), value); var sobj = obj[key]; - for(var sk in sobj){ - s = s.replace(new RegExp("\\$\\{" + key+"\\."+sk + "\\}", "g"), sobj[sk]); + for (var sk in sobj) { + s = s.replace(new RegExp("\\$\\{" + key + "\\." + sk + "\\}", "g"), sobj[sk]); } } s = s.replace(new RegExp("\\$\\{" + key + "\\}", "g"), obj[key]); @@ -55,60 +53,63 @@ layui.define(['element','api','schema','fast_config'], function(exports) { return s; } - var utils = { + var utils = { /** * 获取服务环境变量 */ - setGlobalEnv:function (appId){ + setGlobalEnv: function (appId) { // if(!globalEnv && fast_config.enableEnv){ - if(!globalEnv && fast_config.enableEnv){ + if (!globalEnv && fast_config.enableEnv) { api.get({ enableRootPath: false, - url: envPath+"/api/v1/env/getAppEnvironment?appId="+appId, + url: envPath + "/api/v1/env/getAppEnvironment?appId=" + appId, async: false, - success: function(data){ + success: function (data) { globalEnv = data schema['env'] = data; } }); } }, - getGlobalEnv:function (obj){ + getGlobalEnv: function (obj) { let data = obj; - // if(obj != undefined && obj.mid != undefined){ - // let amisData={}; - // amisData["mid"] = obj.mid; - // amisData["type"] = obj.type; - // - // data = amisData; - // } + // if(obj != undefined && obj.mid != undefined){ + // let amisData={}; + // amisData["mid"] = obj.mid; + // amisData["type"] = obj.type; + // + // data = amisData; + // } let env = schema['env']; - data = {...data,...env} + data = { + ...data, + ...env + } return data; }, - contentDomIsExist : function(elem){ + contentDomIsExist: function (elem) { var bool = false; - if($(elem).html()){ + if ($(elem).html()) { bool = true } return bool }, - stringformat: function (str,data){ + stringformat: function (str, data) { return str.format(data); }, - setTreeNodeData : function (data){ + setTreeNodeData: function (data) { treeNodeData = data; }, - getTreeNodeData : function (){ - return treeNodeData; + getTreeNodeData: function () { + return treeNodeData; }, - getTabElem: function(id){ + getTabElem: function (id) { var elem; var domId = "treenode_" + id; elem = '#' + domId; @@ -116,42 +117,50 @@ layui.define(['element','api','schema','fast_config'], function(exports) { return elem; }, - formatSchema: function (schema, data){ - var postFormatSchema = JSON.parse(utils.stringformat(JSON.stringify(schema),data)); + formatSchema: function (schema, data) { + var postFormatSchema = JSON.parse(utils.stringformat(JSON.stringify(schema), data)); return postFormatSchema }, //执行表达式 - evalExpression: function(expression, data){ - var {...__} = data; - let str = expression + evalExpression: function (expression, data) { + var { + ...__ + } = data; + let str = expression const reg = /\$\{(.+?)\}/; const result = str.match(reg); - - if(result.length == 2){ + + if (result.length == 2) { str = result[1]; try { return eval(str); - }catch (e) { + } catch (e) { return false; } - }else{ + } else { return false; } }, // 通过激活的id缓存当前的node数据 - setTreeNode:function(nodeTId){ + setTreeNode: function (nodeTId) { + var currentTreeId = sessionStorage.getItem("currentTreeId") - var treeNode = $.fn.zTree.getZTreeObj(currentTreeId).getNodeByTId(nodeTId) - sessionStorage.setItem('content-pear-current-treeNode',JSON.stringify(treeNode)) + // 设置定时器, 异步获取根节点, + setTimeout(() => { + var treeNode = $.fn.zTree.getZTreeObj(currentTreeId).getNodeByTId(nodeTId) + sessionStorage.setItem('content-pear-current-treeNode', JSON.stringify(treeNode)) + }, 200) + // var treeNode = $.fn.zTree.getZTreeObj(currentTreeId).getNodeByTId(nodeTId) + // sessionStorage.setItem('content-pear-current-treeNode', JSON.stringify(treeNode)) }, - contextData : { + contextData: { contextmenuData: {}, - trees_settings:{}, + trees_settings: {}, currentTreeId: null }, - schemas : schema.schems, + schemas: schema.schems, treeConst: null, @@ -160,4 +169,4 @@ layui.define(['element','api','schema','fast_config'], function(exports) { exports(MOD_NAME, utils); -}); +}); \ No newline at end of file