Source/ProjectWeb/src/actions/BaseAction.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/actions/base/AddAction.js | 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/actions/base/BaseAction.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/page/index/top/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/permission.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/router/avue-router.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/store/modules/user.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/views/base/UIContentViewer.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Source/ProjectWeb/src/actions/BaseAction.js
ÎļþÒÑɾ³ý Source/ProjectWeb/src/actions/base/AddAction.js
Source/ProjectWeb/src/actions/base/BaseAction.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,175 @@ import {validatenull} from "@/util/validate"; import {findArray} from "@/util/util"; /** * æé®çåºç¡æå¡ */ /** * æ¿æ¢ææ¬ä¸ç${xxx} * @param text ææ¬ * @param dataStore éæ©çæ°æ® * @param sourceData æ¥æºæ°æ® * @returns æ¿æ¢åçå¼,å符串 */ export const replaceFreeMarker = (text,dataStore,sourceData) => { //æ¿æ¢è¡¨è¾¾å¼ if (!sourceData) { sourceData = {}; } if (!dataStore) { dataStore = []; } let replaceData = dataStore.length > 0 ? dataStore[0] : {}; if (text && text.indexOf("${") > -1 && text.indexOf("}")) { //jsåªè½ä½¿ç¨${xxx}è¿ç§çæ¹å¼ let reg = "root.${"; while (text.indexOf(reg) > -1) { let temp = text.substring(0, text.indexOf(reg)); let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}")); let end = text.substring(text.indexOf("}") + 1); field = replaceData[field] || sourceData[field] || ''; text = temp + field + end; } reg = "sourceData.${"; while (text.indexOf(reg) > -1) { let temp = text.substring(0, text.indexOf(reg)); let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}")); let end = text.substring(text.indexOf("}") + 1); field = replaceData[field] || sourceData[field] || ''; text = temp + field + end; } reg = "${"; while (text.indexOf(reg) > -1) { let temp = text.substring(0, text.indexOf(reg)); let field = text.substring(text.indexOf(reg) + reg.length, text.indexOf("}")); let end = text.substring(text.indexOf("}") + 1); field = replaceData[field] || sourceData[field] || ''; text = temp + field + end; } } return text; }; /** * åæ°è½¬æ¢ä¸ºå°å * @param paramsVOs åæ° * @returns å°ååçåæ°å¯¹è±¡ */ export const paramLow = (paramsVOs) => { // if (!paramsVOs) { paramsVOs = {}; } var params = {}; for (var key in paramsVOs) { params[key.toLowerCase()] = paramsVOs[key]; } return params; }; /** * æ§è¡åç½®äºä»¶ * @param options æé®çé 置信æ¯ï¼åç½®äºä»¶éé ç½®ç忰伿¿æ¢è¿ä¸ªéçåæ°çä¿¡æ¯ * @param buttonTarget æé®jsæå¨ç对象 * @param callback åè°ï¼å¦æåå¨åç½®äºä»¶ï¼ä¼å¨æ§è¡å®æåæ§è¡åè°ï¼å¦åç´æ¥åè° * @param preEventName åç½®äºä»¶åç§°ï¼é»è®¤beforeevent */ export const callPreEvent = (options,buttonTarget,callback,preEventName) => { const params = paramLow(options.paramVOS); options.paramVOS = params; let beforeEvent = params[preEventName || 'beforeevent']; if(beforeEvent) { let buttonParse = parseEventByUrl(beforeEvent,options,true); buttonParse.options.callback = callback; if(validatenull(buttonParse)){ buttonTarget[buttonParse.methodName](buttonParse); }else{ layui.use(buttonParse.jsPath,function () { layui[buttonParse.jsPath][buttonParse.methodName](options); }); } }else{ if(callback){ callback(options); } } }; /** * æ§è¡åç½®æ¶é´ * @param options æé®çé 置信æ¯ï¼åç½®äºä»¶éé ç½®ç忰伿¿æ¢è¿ä¸ªéçåæ°çä¿¡æ¯ * @param buttonTarget æé®Jsæå¨ç对象 */ export const callPostEvent = (options,buttonTarget,callback,postEventName)=>{ const params = paramLow(options.paramVOS); options.paramVOS = params; var afterEvent = params[postEventName || 'afterevent']; if(afterEvent) { var buttonParse = parseEventByUrl(afterEvent,options,false); if(validatenull(buttonParse)){ buttonTarget[buttonParse.methodName](buttonParse); }else{ layui.use(buttonParse.jsPath,function () { layui[buttonParse.jsPath][buttonParse.methodName](options); }); } }else{ if(callback){ callback(options); } } }; /** * 使ç¨urlè·åäºä»¶çä¿¡æ¯ * @param url è·¯å¾,æ ¼å¼å¦jsPath#methodName?param=aaa¶m1=bbb * @param options æé®çé 置信æ¯ï¼ä¼èªå¨è¦çç¸å屿§çåæ° * @param isBefore æ¯å¦ä¸ºåç½®äºä»¶ï¼å¦å为åç½® * @returns {{jsPath: jsçè·¯å¾, options: æé®çé 置信æ¯, methodName: (string)æ¹æ³çåå}} */ export const parseEventByUrl = (url,options,isBefore) => { //æ ¹æ®é ç½®æ ¼å¼åäºä»¶ var jsPath = url; var methodName = isBefore?"doBefore":"doAfter"; var params = {}; if (url.indexOf("?")) { var temp = url.substring(0, url.indexOf("?")); if (temp.indexOf("#") > -1) { var array = temp.split("#"); if(array.length == 1){ jsPath = array[0]; }else{ jsPath = array[0]; methodName = array[1]; } }else{ jsPath = temp; } var paramArray = url.substring(url.indexOf("?") + 1).split("&"); layui.each(paramArray, function (_index, _item) { if (_item.indexOf("=") < 0) { this.$message.error(isBefore?"åç½®äºä»¶":"åç½®äºä»¶" + "çåæ°é ç½®é误ï¼éè¦è¦xxx=yyy&zzz=açæ¹å¼"); return true; } params[_item.split("=")[0]] = _item.split("=")[1]; }); }else{ if (url.indexOf("#") > -1) { var array = url.split("#"); if(array.length == 1){ jsPath = array[0]; }else{ jsPath = array[0]; methodName = array[1]; } }else{ jsPath = url; } } for (var key in params) { options.paramVOS[key.toLowerCase()] = params[key]; } return { jsPath:jsPath, methodName:methodName, options:options }; }; Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
@@ -2,11 +2,12 @@ <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid"> <el-alert class="alert" :closable="false" v-if="isError" title="èªå®ä¹ç»ä»¶é 置信æ¯é误ï¼" type="error" show-icon description="è¿ä¸ªèªå®ä¹é¡µé¢çå°åæ ¼å¼ä¸æ£ç¡®ãæ¨è使ç¨bs=ç»ä»¶name?type=xxx&context=yyy&pparam=zzzè¿ç§å½¢å¼"> description="è¿ä¸ªèªå®ä¹é¡µé¢çå°åæ ¼å¼ä¸æ£ç¡®ãæ¨è使ç¨âç»ä»¶name?param=xxxâï¼èªå®ä¹ç»ä»¶ï¼æè â?type=xxx&context=yyy&pparam=zzzâï¼UI弿ï¼è¿2ç§å½¢å¼"> </el-alert> <component v-else :is="currentComponent" :btmType="btmType" @@ -23,6 +24,7 @@ <script> import {queryStringToObject} from '@/util/util' import {validatenull} from "@/util/validate"; export default { name: "dynamic-custom", components: { @@ -69,7 +71,7 @@ content: '', urlParams: {}, height: '300px', customClass: this.componentVO.customClass, //bs=?type=xxx&context=yyy¶m=zzz æè bs=ç»ä»¶name?type=xxx&context=yyy¶m=zzz customClass: '', //?type=xxx&context=yyy¶m=zzz æè ç»ä»¶name?type=xxx&context=yyy¶m=zzz isError: false, //è·¯å¾è§£æå¤±è´¥ currentComponent: 'UI',//ç»ä»¶name } @@ -88,24 +90,31 @@ }, mounted() { if (this.customClass.indexOf("bs=") < 0) { this.componentVO.customClass.split(';').forEach(item=>{ if(item.indexOf('web=')==0){ this.customClass=item.split('web=')[1]; } }) // å¦æè·¯å¾ä¸åå¨ '?'ï¼ååé®å·åé¢é¨åç» parts if (this.customClass.includes('?')) { this.currentComponent = this.customClass.split("?")[0]; } else { this.currentComponent = this.customClass; // ä¸åå¨ '?' æ´æ¡è·¯å¾å°±æ¯ parts } if(validatenull(this.currentComponent)){ this.currentComponent='UI'; } if (['UI', 'ui'].includes(this.currentComponent) && (this.customClass.indexOf("type=") < 0 || this.customClass.indexOf("context=") < 0)) { this.isError = true; return; } this.customClass = this.componentVO.customClass.split("bs=")[1]; if (this.customClass.indexOf("?") < 0 || this.customClass.indexOf("type=") < 0 || this.customClass.indexOf("context=") < 0) { this.isError = true; return; let urlParams = {}; if(this.customClass.includes('?')) { urlParams = queryStringToObject(this.customClass); } if (this.customClass.split('?')[0] != '' && this.customClass.split('?')[0] != 'UI' && this.customClass.split('?')[0] != 'ui') { this.currentComponent = this.customClass.split('?')[0]; } let urlParams = queryStringToObject(this.customClass); let btmType = urlParams.type; let content = urlParams.context; this.btmType = btmType; this.content = content; this.btmType = urlParams.type; this.content = urlParams.context; this.urlParams = Object.assign(this.paramVOS, urlParams) //this.getHeight(this.$parent); Source/ProjectWeb/src/page/index/top/index.vue
@@ -242,10 +242,10 @@ cancelButtonText: this.$t("cancelText"), type: "warning" }).then(() => { this.$store.dispatch("LogOut").then(() => { //this.$store.dispatch("LogOut").then(() => { resetRouter(); this.$router.push({path: "/login"}); }); //}); }); } } Source/ProjectWeb/src/permission.js
@@ -11,7 +11,6 @@ NProgress.configure({showSpinner: false}); const lockPage = store.getters.website.lockPage; //éå±é¡µ router.beforeEach((to, from, next) => { // debugger; const meta = to.meta || {}; const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; store.commit('SET_IS_MENU', isMenu === undefined); Source/ProjectWeb/src/router/avue-router.js
@@ -1,3 +1,5 @@ import {validatenull} from "@/util/validate"; let RouterPlugin = function () { this.$router = null; this.$store = null; @@ -131,22 +133,18 @@ } else { parts = path; // ä¸åå¨ '?' æ´æ¡è·¯å¾å°±æ¯ parts } // 妿é®å·åé¢é¨åä¸å¨ ['ui', 'UI', 'base'] ä¸ï¼åæ¯èªå®ä¹ç»ä»¶ if (!['ui', 'UI', 'base'].includes(parts)) { component = `views/custom-ui/${parts}`; if(validatenull(parts)){ parts='UI'; } // 妿é®å·åé¢çäºç©ºï¼åé»è®¤ä¸ºUI弿 if (!parts) { component = 'views/base/UIContentViewer'; // 妿é®å·åé¢é¨åä¸å¨ ['ui', 'UI', 'base'] ä¸ï¼åæ¯èªå®ä¹ç»ä»¶ if (!['ui', 'UI', 'base','bs'].includes(parts)) { component = `views/custom-ui/${parts}`; } // 妿é®å·åé¢çäº UIãui å为UI弿 if (['UI', 'ui'].includes(parts)) { component = 'views/base/UIContentViewer'; } let name = oMenu[propsDefault.label], icon = oMenu[propsDefault.icon], children = oMenu[propsDefault.children], Source/ProjectWeb/src/store/modules/user.js
@@ -37,7 +37,9 @@ item.pathValue = item.path; item.path = '/' + item.code; item.query = {}; // åå§å item.query item.query = queryStringToObject(item.pathValue) if(item.pathValue.indexOf('?')!=-1) { item.query = queryStringToObject(item.pathValue) } if (item.children && item.children.length > 0) { updateCode(item.children); } Source/ProjectWeb/src/views/base/UIContentViewer.vue
@@ -90,7 +90,7 @@ }, created() { if (verifyNull(this.$route.query.type) || (verifyNull(this.$route.query.context) && verifyNull(this.$route.query.content))) { this.$message.error("é ç½®çä¿¡æ¯é误ï¼è¯·åèbs=ç»ä»¶name?type=xxx&context=yyy¶m=zzzè¿ç§å½¢å¼ãå ¶ä¸typeæ¯ä¸å¡ç±»åï¼æé¾æ¥ç±»åï¼ï¼contextæ¯UIä¸ä¸æçåç§°"); this.$message.error("é ç½®çä¿¡æ¯é误ï¼è¯·åèâ?type=xxx&context=yyy¶m=zzzâè¿ç§å½¢å¼ãå ¶ä¸typeæ¯ä¸å¡ç±»åï¼æé¾æ¥ç±»åï¼ï¼contextæ¯UIä¸ä¸æçåç§°"); return false; } this.getTheParameters() Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
@@ -115,7 +115,7 @@ }, created() { if (verifyNull(this.btmType) || verifyNull(this.content) ) { this.$message.error("èªå®ä¹ç»ä»¶é ç½®çä¿¡æ¯é误ï¼è¯·åèbs=name?type=xxx&context=yyy¶m=zzzè¿ç§å½¢å¼ãå ¶ä¸typeæ¯ä¸å¡ç±»åï¼æé¾æ¥ç±»åï¼ï¼contextæ¯UIä¸ä¸æçåç§°,name为ç»ä»¶åç§°ï¼ç©ºå¼æ¶é»è®¤å±ç¤ºUI弿"); this.$message.error("èªå®ä¹ç»ä»¶é ç½®çä¿¡æ¯é误ï¼è¯·åèâ?type=xxx&context=yyy¶m=zzzâè¿ç§å½¢å¼ãå ¶ä¸typeæ¯ä¸å¡ç±»åï¼æé¾æ¥ç±»åï¼ï¼contextæ¯UIä¸ä¸æçåç§°"); return false; } },