From 5e851678cc02257bbbd179446de36082430ca5bc Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 13 四月 2026 15:12:04 +0800
Subject: [PATCH] feat(MES): 添加Mes_Log扩展逻辑

---
 Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx b/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx
new file mode 100644
index 0000000..be25098
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx
@@ -0,0 +1,116 @@
+import { h, createApp } from 'vue';
+import { ElDrawer, ElIcon } from 'element-plus';
+
+let extension = {
+  components: {
+    // 鍔ㄦ�佹墿鍏呯粍浠舵垨缁勪欢璺緞
+    gridHeader: "",
+    gridBody: '',
+    gridFooter: "",
+    modelHeader: "",
+    modelBody: "",
+    modelFooter: ""
+  },
+  buttons: [], // 鎵╁睍鐨勬寜閽�
+  data: {
+    jsonDrawerVisible: false,
+    currentJson: '',
+    currentJsonTitle: ''
+  },
+  methods: {
+    // 浜嬩欢鎵╁睍
+    onInit() {
+      console.log("mes_log init");
+      this.setFiexdSearchForm(true);
+    },
+
+    onInited() {
+      this.height = this.height - 240; // 涓虹粺璁″崱鐗囬鐣欑┖闂�
+
+      // 娣诲姞棰勮鏂规硶
+      this.previewJson = (jsonStr) => {
+        if (!jsonStr) return '-';
+        try {
+          const obj = JSON.parse(jsonStr);
+          return JSON.stringify(obj, null, 2).substring(0, 200) + '...';
+        } catch {
+          return String(jsonStr).substring(0, 200) + '...';
+        }
+      };
+    },
+
+    // 琛岀偣鍑讳簨浠� - 鏄剧ず JSON 璇︽儏
+    rowClick({ row, column }) {
+      // 濡傛灉鐐瑰嚮鐨勬槸璇锋眰鎴栧搷搴斿垪锛屾樉绀鸿鎯呮娊灞�
+      if (column.property === 'requestJson' && row.requestJson) {
+        this.showJsonDetail(row, 'request');
+      } else if (column.property === 'responseJson' && row.responseJson) {
+        this.showJsonDetail(row, 'response');
+      }
+    },
+
+    // 鏄剧ず JSON 璇︽儏鎶藉眽
+    showJsonDetail(row, type = 'request') {
+      const jsonContent = type === 'request' ? row.requestJson : row.responseJson;
+      const title = type === 'request' ? '馃搵 璇锋眰 JSON' : '馃摜 鍝嶅簲 JSON';
+
+      // 鏍煎紡鍖� JSON
+      let formattedJson = '';
+      try {
+        const obj = typeof jsonContent === 'string' ? JSON.parse(jsonContent) : jsonContent;
+        formattedJson = JSON.stringify(obj, null, 2);
+      } catch (e) {
+        formattedJson = String(jsonContent);
+      }
+
+      // 鍒涘缓涓存椂瀹瑰櫒娓叉煋鎶藉眽
+      const container = document.createElement('div');
+      document.body.appendChild(container);
+
+      const app = createApp({
+        render() {
+          return h('div', [
+            h(ElDrawer, {
+              modelValue: true,
+              'onUpdate:modelValue': (val) => {
+                if (!val) {
+                  app.unmount();
+                  document.body.removeChild(container);
+                }
+              },
+              title: title,
+              size: '30%',
+              destroyOnClose: true,
+              closeOnClickModal: true
+            }, {
+              default: () => h('div', {
+                style: {
+                  height: '100%',
+                  backgroundColor: '#f5f5f5',
+                  padding: '16px',
+                  borderRadius: '4px'
+                }
+              }, [
+                h('pre', {
+                  style: {
+                    margin: '0',
+                    fontSize: '14px',
+                    lineHeight: '1.5',
+                    fontFamily: 'Consolas, Monaco, "Courier New", monospace',
+                    whiteSpace: 'pre-wrap',
+                    wordBreak: 'break-all'
+                  }
+                }, formattedJson)
+              ])
+            })
+          ]);
+        }
+      });
+
+      app.use(window.ElementPlus);
+      app.mount(container);
+    },
+  }
+};
+
+export default extension;

--
Gitblit v1.9.3