From 88f76548d7b16d4e099715fe0b38690887c1a0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Mon, 31 Jul 2023 14:05:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=AF=A6=E6=83=85json?= =?UTF-8?q?=E8=BD=AC=E4=B9=89=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/umyTable/index.vue | 97 +++++++++++++++---- 1 file changed, 80 insertions(+), 17 deletions(-) diff --git a/PC/InterFace.Dash/src/components/umyTable/index.vue b/PC/InterFace.Dash/src/components/umyTable/index.vue index 048ffc0..e5fb29a 100644 --- a/PC/InterFace.Dash/src/components/umyTable/index.vue +++ b/PC/InterFace.Dash/src/components/umyTable/index.vue @@ -90,24 +90,25 @@ @click="showDetailInfo(scope.row[item.prop],'time')" style="cursor: pointer;" :title="'点击查看详情'" - class="showDetailHover" + class="showDetailHover itemSpan" > {{ scope.row[item.prop] | formatDate }} - + {{ initApiEnumList(item,scope.row[item.prop]) }} - + {{ scope.row[item.prop] ? '是' : '否' }} - + {{ scope.row[item.prop] }} - {{ showDetailData ? showDetailData + "" : showDetailData }} + + + @@ -150,7 +158,7 @@ type="textarea" readonly autosize - placeholder="请输入内容" + resize="none" v-model="showJsonData_str"> @@ -164,12 +172,28 @@ :close-on-click-modal="true" :close-on-press-escape="true" :title="'内容详情'" + width="80%" > 复制JSON + {{scope.row.value}} - + style="width: 100%" + > + v-for="(head) in showJsonHeader" + min-width="120" + > + + + + @@ -326,6 +375,7 @@ export default { showDetailDialog:false,//点开查看全部弹窗 showDetailData:null,//点开查看全部内容 showJsonDialog:false,//点开查看Json转换后table弹窗 + showJsonHeader:null,//点开查看Json的header showJsonData:null,//点开查看Json的数据 showJsonData_str:null,//复制的Json字符串 showJsonCopy:false,//复制json的Dialog显隐控制 @@ -388,6 +438,10 @@ export default { let _height = height || this.setUTableHeight let _app_height = document.getElementsByClassName('app-main')[0].clientHeight this.uTableHeight = Number(_app_height) - Number(_height) + this.$nextTick(() => { + this.$refs.multipleTable.doLayout() + this.$refs.multipleTable.$forceUpdate() + }); }, // 获取表格高度 误删 业务当中有用 getTableHeight(){ @@ -604,6 +658,7 @@ export default { showJsonTable(row){ this.showJsonDialog = true let _json = eval('(' + row + ')') + this.showJsonData_str = JSON.stringify(_json, null, '\t')//复制使用 let _arr = [] let __initJson = (data) => { let _init = [] @@ -622,7 +677,12 @@ export default { // 如果是数组 if(Array.isArray(_json[item])){ // 如果是 DETAILS todo:DETAILS判断条件需要优化,使用传参的方式 - let _value = (item).toUpperCase() == 'DETAILS' ? __initJson(_json[item][0]) : (_json[item]).join(",") + // let _value = (item).toUpperCase() == 'DETAILS' ? __initJson(_json[item][0]) : (_json[item]).join(",") + this.showJsonHeader = [] + for(let h in _json[item][0]){ + this.showJsonHeader.push(h) + } + let _value = (item).toUpperCase() == 'DETAILS' ? _json[item] : (_json[item]).join(",") _arr.push({name:item,value:_value}) } // 如果是对象 @@ -639,7 +699,6 @@ export default { } } this.showJsonData = _arr - this.showJsonData_str = JSON.stringify(JSON.parse(JSON.stringify(this.showJsonData)), null, '\t') this.$emit("showJsonTable", row); }, // 复制Json按钮 @@ -798,4 +857,8 @@ span { .u-table::before { height: 0px; } + +.itemSpan{ + white-space: nowrap !important +} \ No newline at end of file