From c3c67ee9e88c579e8ac784821ab41f58d0372ebb Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 11 六月 2024 15:46:34 +0800
Subject: [PATCH] 最新版本

---
 admin/src/components/business/OperaInterfaceLogWindow.vue |  113 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 83 insertions(+), 30 deletions(-)

diff --git a/admin/src/components/business/OperaInterfaceLogWindow.vue b/admin/src/components/business/OperaInterfaceLogWindow.vue
index 986f828..1533647 100644
--- a/admin/src/components/business/OperaInterfaceLogWindow.vue
+++ b/admin/src/components/business/OperaInterfaceLogWindow.vue
@@ -1,49 +1,102 @@
 <template>
-    <GlobalWindow
+    <el-dialog
         :title="title"
+        width="60%"
         :withFooter="false"
         :visible.sync="visible"
         :confirm-working="isWorking"
+        append-to-body
         @confirm="confirm"
     >
-        <div class="box">
-            {{form.content}}
-        </div>
-    </GlobalWindow>
+      <div class="codeEditBox">
+        <json-viewer
+            :value="form.formatContent"
+            :expand-depth="5"
+            copyable
+            boxed
+            :expanded="false"
+            @copied="copyText"
+            sort
+            :show-array-index="false"
+            class="w-100%">
+          <template slot="copy">
+            <i class="el-icon-document-copy" title="澶嶅埗">澶嶅埗浠g爜</i>
+          </template>
+        </json-viewer>
+      </div>
+    </el-dialog>
 </template>
 
 <script>
-  import BaseOpera from '@/components/base/BaseOpera'
-  import GlobalWindow from '@/components/common/GlobalWindow'
-  export default {
-    name: 'OperaInterfaceLogWindow',
-    extends: BaseOpera,
-    components: { GlobalWindow },
-    data () {
-      return {
-        // 琛ㄥ崟鏁版嵁
-        form: {
-          content: ''
-        },
-        // 楠岃瘉瑙勫垯
-        rules: {
-        }
-      }
+import BaseOpera from '@/components/base/BaseOpera'
+import JsonViewer from 'vue-json-viewer'
+
+export default {
+  name: 'OperaInterfaceLogWindow',
+  extends: BaseOpera,
+  components: { JsonViewer },
+  data () {
+    return {
+      // 琛ㄥ崟鏁版嵁
+      form: {
+        content: '',
+        formatContent: {}
+      },
+      // 楠岃瘉瑙勫垯
+      rules: {
+      },
+      copyable: { copyText: 'copy', copiedText: 'copied' }
+    }
+  },
+  created () {
+    this.config({
+      api: '/business/interfaceLog',
+      'field.id': 'id'
+    })
+  },
+  methods: {
+    copyText (val) {
+      this.$message.success('鍐呭宸叉垚鍔熷鍒跺埌鍓垏鏉匡紒')
     },
-    created () {
-      this.config({
-        api: '/business/interfaceLog',
-        'field.id': 'id'
+    open (title, target) {
+      this.title = title
+      this.visible = true
+      // 鏂板缓
+      if (target == null) {
+        this.$nextTick(() => {
+          this.$refs.form.resetFields()
+          this.form[this.configData['field.id']] = null
+        })
+        return
+      }
+      // 缂栬緫
+      this.$nextTick(() => {
+        for (const key in this.form) {
+          this.form[key] = target[key]
+        }
+        try {
+          this.form.formatContent = JSON.parse(this.form.content)
+        } catch (e) {
+          this.form.formatContent = this.form.content
+        }
       })
     }
   }
+}
 </script>
 
 <style lang="scss" scoped>
-    .box {
-        width: 100%;
-        font-size: 15px;
-        color: #222222;
-        word-wrap: break-word;
+    .codeEditBox {
+      width: 100%;
+      height: 90%;
+      overflow:auto;
+      display: block;
+      border: 1px solid #dcdee2;
+      overflow-y: auto;
+    }
+    ::v-deep .el-dialog__body{height:70vh;overflow-y: auto}
+    ::v-deep .el-dialog{height:78vh;overflow: hidden}
+    .jv-container {
+      //height: 60vh;
     }
 </style>

--
Gitblit v1.9.3