From 906da13b74826f590de443b035778b4be5b67973 Mon Sep 17 00:00:00 2001 From: y505174330 <505174330@qq.com> Date: 星期六, 18 五月 2024 15:40:52 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary --- src/pages/character/detail.vue | 58 +++++++++++++++++++++++++---- src/api/index.js | 8 ++++ src/pages/fileDetail/index.vue | 41 +++++++++++++------- src/pages/inherit/index.vue | 1 4 files changed, 85 insertions(+), 23 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 a7dd262..857b0fa 100644 --- a/src/pages/character/detail.vue +++ b/src/pages/character/detail.vue @@ -20,7 +20,8 @@ class="flex" style="line-height: 1.2; margin: 0.15rem 0" > - <li style=" + <li + style=" background-color: #fff; padding: 0 0.08rem; border: 0.01rem solid #000; @@ -28,10 +29,13 @@ font-size: 0.12rem; text-align: center; margin-right: 0.15rem; - "> + " + @click="openFileClick(1)" + > RDF </li> - <li style=" + <li + style=" background-color: #fff; padding: 0 0.08rem; border: 0.01rem solid #000; @@ -39,10 +43,14 @@ font-size: 0.12rem; text-align: center; margin-right: 0.15rem; - "> + cursor: pointer; + " + @click="openFileClick(2)" + > NT </li> - <li style=" + <li + style=" background-color: #fff; padding: 0 0.08rem; border: 0.01rem solid #000; @@ -50,10 +58,14 @@ font-size: 0.12rem; text-align: center; margin-right: 0.15rem; - "> + cursor: pointer; + " + @click="openFileClick(3)" + > XML </li> - <li style=" + <li + style=" background-color: #fff; padding: 0 0.08rem; border: 0.01rem solid #000; @@ -61,7 +73,10 @@ font-size: 0.12rem; text-align: center; margin-right: 0.15rem; - "> + cursor: pointer; + " + @click="openFileClick(4)" + > JSON </li> </ul> @@ -73,6 +88,7 @@ font-weight: normal; line-height: 0.2rem; letter-spacing: 0.03rem; + cursor: pointer; " > {{ biogData.length ? biogData[0].content : "-" }} @@ -826,6 +842,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