From 76ef266068b240c93ebb174733c068d15829f310 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 11 四月 2024 10:54:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/ProjectWeb/src/actions/base/AddAction.js                        |    0 
 /dev/null                                                              |   52 ----------
 Source/ProjectWeb/src/actions/base/BaseAction.js                       |  175 +++++++++++++++++++++++++++++++++++
 Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue           |    2 
 Source/ProjectWeb/src/router/avue-router.js                            |   16 +-
 Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue |   39 ++++---
 Source/ProjectWeb/src/page/index/top/index.vue                         |    4 
 Source/ProjectWeb/src/store/modules/user.js                            |    4 
 Source/ProjectWeb/src/views/base/UIContentViewer.vue                   |    2 
 Source/ProjectWeb/src/permission.js                                    |    1 
 10 files changed, 213 insertions(+), 82 deletions(-)

diff --git a/Source/ProjectWeb/src/actions/BaseAction.js b/Source/ProjectWeb/src/actions/BaseAction.js
deleted file mode 100644
index a0005bc..0000000
--- a/Source/ProjectWeb/src/actions/BaseAction.js
+++ /dev/null
@@ -1,52 +0,0 @@
-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;
-};
diff --git a/Source/ProjectWeb/src/actions/AddAction.js b/Source/ProjectWeb/src/actions/base/AddAction.js
similarity index 100%
rename from Source/ProjectWeb/src/actions/AddAction.js
rename to Source/ProjectWeb/src/actions/base/AddAction.js
diff --git a/Source/ProjectWeb/src/actions/base/BaseAction.js b/Source/ProjectWeb/src/actions/base/BaseAction.js
new file mode 100644
index 0000000..528dbe4
--- /dev/null
+++ b/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 鍓嶇疆浜嬩欢鍚嶇О锛岄粯璁eforeevent
+ */
+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 璺緞,鏍煎紡濡俲sPath#methodName?param=aaa&param1=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
+  };
+};
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
index c15d92f..9a1a0cf 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
+++ b/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="杩欎釜鑷畾涔夐〉闈㈢殑鍦板潃鏍煎紡涓嶆纭�傛帹鑽愪娇鐢╞s=缁勪欢name?type=xxx&context=yyy&pparam=zzz杩欑褰㈠紡">
+      description="杩欎釜鑷畾涔夐〉闈㈢殑鍦板潃鏍煎紡涓嶆纭�傛帹鑽愪娇鐢ㄢ�滅粍浠秐ame?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&param=zzz  鎴栬�� bs=缁勪欢name?type=xxx&context=yyy&param=zzz
+      customClass: '', //?type=xxx&context=yyy&param=zzz  鎴栬�� 缁勪欢name?type=xxx&context=yyy&param=zzz
       isError: false, //璺緞瑙f瀽澶辫触
       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);
diff --git a/Source/ProjectWeb/src/page/index/top/index.vue b/Source/ProjectWeb/src/page/index/top/index.vue
index 6b99b79..8430d37 100644
--- a/Source/ProjectWeb/src/page/index/top/index.vue
+++ b/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"});
-          });
+          //});
         });
       }
     }
diff --git a/Source/ProjectWeb/src/permission.js b/Source/ProjectWeb/src/permission.js
index 116b150..3af463c 100644
--- a/Source/ProjectWeb/src/permission.js
+++ b/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);
diff --git a/Source/ProjectWeb/src/router/avue-router.js b/Source/ProjectWeb/src/router/avue-router.js
index fb9f9e2..dd431b5 100644
--- a/Source/ProjectWeb/src/router/avue-router.js
+++ b/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銆乽i 鍒欎负UI寮曟搸
         if (['UI', 'ui'].includes(parts)) {
           component = 'views/base/UIContentViewer';
         }
-
         let name = oMenu[propsDefault.label],
           icon = oMenu[propsDefault.icon],
           children = oMenu[propsDefault.children],
diff --git a/Source/ProjectWeb/src/store/modules/user.js b/Source/ProjectWeb/src/store/modules/user.js
index a5bf964..3b04ff9 100644
--- a/Source/ProjectWeb/src/store/modules/user.js
+++ b/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);
     }
diff --git a/Source/ProjectWeb/src/views/base/UIContentViewer.vue b/Source/ProjectWeb/src/views/base/UIContentViewer.vue
index a963086..c987860 100644
--- a/Source/ProjectWeb/src/views/base/UIContentViewer.vue
+++ b/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("閰嶇疆鐨勪俊鎭敊璇紝璇峰弬鑰僢s=缁勪欢name?type=xxx&context=yyy&param=zzz杩欑褰㈠紡銆傚叾涓璽ype鏄笟鍔$被鍨嬶紙鎴栭摼鎺ョ被鍨嬶級锛宑ontext鏄疷I涓婁笅鏂囩殑鍚嶇О");
+      this.$message.error("閰嶇疆鐨勪俊鎭敊璇紝璇峰弬鑰冣��?type=xxx&context=yyy&param=zzz鈥濊繖绉嶅舰寮忋�傚叾涓璽ype鏄笟鍔$被鍨嬶紙鎴栭摼鎺ョ被鍨嬶級锛宑ontext鏄疷I涓婁笅鏂囩殑鍚嶇О");
       return false;
     }
     this.getTheParameters()
diff --git a/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue b/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
index 86c330a..cfb67d8 100644
--- a/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
+++ b/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
@@ -115,7 +115,7 @@
   },
   created() {
     if (verifyNull(this.btmType) || verifyNull(this.content) ) {
-      this.$message.error("鑷畾涔夌粍浠堕厤缃殑淇℃伅閿欒锛岃鍙傝�僢s=name?type=xxx&context=yyy&param=zzz杩欑褰㈠紡銆傚叾涓璽ype鏄笟鍔$被鍨嬶紙鎴栭摼鎺ョ被鍨嬶級锛宑ontext鏄疷I涓婁笅鏂囩殑鍚嶇О,name涓虹粍浠跺悕绉帮紝绌哄�兼椂榛樿灞曠ずUI寮曟搸");
+      this.$message.error("鑷畾涔夌粍浠堕厤缃殑淇℃伅閿欒锛岃鍙傝�冣��?type=xxx&context=yyy&param=zzz鈥滆繖绉嶅舰寮忋�傚叾涓璽ype鏄笟鍔$被鍨嬶紙鎴栭摼鎺ョ被鍨嬶級锛宑ontext鏄疷I涓婁笅鏂囩殑鍚嶇О");
       return false;
     }
   },

--
Gitblit v1.9.3