From c6e1ec7df70b351fc3a367f386b694dfc3388202 Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期六, 18 五月 2024 15:09:42 +0800
Subject: [PATCH] 1

---
 src/pages/character/detail.vue |   34 +++++++++++++++++
 src/api/index.js               |    8 ++++
 src/pages/fileDetail/index.vue |   41 +++++++++++++-------
 src/pages/inherit/index.vue    |    1 
 4 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index df88f58..bc821c5 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -296,6 +296,14 @@
   });
 };
 
+export const getPersonDataOutput = (Obj) => {
+  return req1({
+    url: "/person/dataOutput",
+    method: "post",
+    params: Obj
+  });
+};
+
 // -----------
 
 // 涓浗鍖诲浜虹墿鐭ヨ瘑搴�
diff --git a/src/pages/character/detail.vue b/src/pages/character/detail.vue
index 73265c0..87da4d3 100644
--- a/src/pages/character/detail.vue
+++ b/src/pages/character/detail.vue
@@ -20,6 +20,7 @@
               text-align: center;
               margin-right: 0.15rem;
             "
+            @click="openFileClick(1)"
           >
             RDF
           </li>
@@ -32,7 +33,9 @@
               font-size: 0.12rem;
               text-align: center;
               margin-right: 0.15rem;
+              cursor: pointer;
             "
+            @click="openFileClick(2)"
           >
             NT
           </li>
@@ -45,7 +48,9 @@
               font-size: 0.12rem;
               text-align: center;
               margin-right: 0.15rem;
+              cursor: pointer;
             "
+            @click="openFileClick(3)"
           >
             XML
           </li>
@@ -58,7 +63,9 @@
               font-size: 0.12rem;
               text-align: center;
               margin-right: 0.15rem;
+              cursor: pointer;
             "
+            @click="openFileClick(4)"
           >
             JSON
           </li>
@@ -71,6 +78,7 @@
             font-weight: normal;
             line-height: 0.2rem;
             letter-spacing: 0.03rem;
+            cursor: pointer;
           "
         >
           {{ biogData.length ? biogData[0].content : "-" }}
@@ -773,6 +781,32 @@
         behavior: "smooth" // 浣跨敤骞虫粦婊氬姩
       });
     },
+    openFileClick(index) {
+      let obj = {
+        id: this.detailId,
+        type: "Person"
+      };
+      switch (index) {
+        case 1:
+          obj.outputType = "RDF";
+          break;
+        case 2:
+          obj.outputType = "NT";
+          break;
+        case 3:
+          obj.outputType = "XML";
+          break;
+        case 4:
+          obj.outputType = "JSON";
+          break;
+      }
+      let queryString = Object.keys(obj)
+        .map(
+          (key) => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`
+        )
+        .join("&");
+      window.open(`#/pages/fileDetail/index?${queryString}`);
+    },
     handleClick(tab) {
       let index = tab.$attrs["data-id"] - 1;
       this.$nextTick(() => {
diff --git a/src/pages/fileDetail/index.vue b/src/pages/fileDetail/index.vue
index ad77e4c..c099b5d 100644
--- a/src/pages/fileDetail/index.vue
+++ b/src/pages/fileDetail/index.vue
@@ -1,38 +1,51 @@
 <template>
   <view id="box">
-    <!-- RDF瀵瑰簲鐨勫弬鏁� -->
-    {{data}}
+    <pre v-if="options.outputType == 'XML' || options.outputType == 'JSON'">
+      <code>
+        {{ data }}
+      </code>
+    </pre>
+    <div v-else v-html="data"></div>
   </view>
 </template>
 
 <script>
-import { getMedicalDataOutput } from "@/api/index.js";
+import { getMedicalDataOutput, getPersonDataOutput } from "@/api/index.js";
+
 export default {
   data() {
     return {
-      Obj: {},
+      options: {},
       data: ""
     };
   },
   onLoad(options) {
-    this.Obj = options;
-  },
-  mounted() {
+    this.options = options;
     this.innt();
   },
   methods: {
     innt() {
-      getMedicalDataOutput(this.Obj).then((res) => {
-        console.log(res);
-        this.data = res;
-      });
+      if (this.options.type == "Person") {
+        getPersonDataOutput({
+          personId: this.options.id,
+          dataTypeEO: this.options.outputType
+        }).then((res) => {
+          console.log(res);
+          this.data = res;
+        });
+      } else {
+        getMedicalDataOutput(this.options).then((res) => {
+          console.log(res);
+          this.data = res;
+        });
+      }
     }
   }
 };
 </script>
 
 <style>
-  #box{
-    font-size: 14px;
-  }
+#box {
+  font-size: 14px;
+}
 </style>
diff --git a/src/pages/inherit/index.vue b/src/pages/inherit/index.vue
index 44f026c..fcb2093 100644
--- a/src/pages/inherit/index.vue
+++ b/src/pages/inherit/index.vue
@@ -131,7 +131,6 @@
         searchType: this.searchType,
         path: this.conditionId,
       }).then((res) => {
-        console.log(res);
         for (let i = 0; i < res.object.nodeList.length; i++) {
           const node = res.object.nodeList[i];
           if (

--
Gitblit v1.9.1