Browse Source

查看详情json转义更改

noToken
安虹睿 1 year ago
parent
commit
88f76548d7
  1. 97
      PC/InterFace.Dash/src/components/umyTable/index.vue

97
PC/InterFace.Dash/src/components/umyTable/index.vue

@ -90,24 +90,25 @@
@click="showDetailInfo(scope.row[item.prop],'time')" @click="showDetailInfo(scope.row[item.prop],'time')"
style="cursor: pointer;" style="cursor: pointer;"
:title="'点击查看详情'" :title="'点击查看详情'"
class="showDetailHover" class="showDetailHover itemSpan"
> >
{{ scope.row[item.prop] | formatDate }} {{ scope.row[item.prop] | formatDate }}
</span> </span>
<!-- 枚举 --> <!-- 枚举 -->
<span v-else-if="item.isEnums"> <span v-else-if="item.isEnums" class="itemSpan">
{{ initApiEnumList(item,scope.row[item.prop]) }} {{ initApiEnumList(item,scope.row[item.prop]) }}
</span> </span>
<!-- 布尔 --> <!-- 布尔 -->
<span v-else-if="item.apiBaseType == 'boolean'"> <span v-else-if="item.apiBaseType == 'boolean'" class="itemSpan">
{{ scope.row[item.prop] ? '是' : '否' }} {{ scope.row[item.prop] ? '是' : '否' }}
</span> </span>
<!-- 数值 --> <!-- 数值 -->
<span v-else-if="item.apiBaseType == 'number'"> <span v-else-if="item.apiBaseType == 'number'" class="itemSpan">
{{ scope.row[item.prop] }} {{ scope.row[item.prop] }}
</span> </span>
<!-- 点击可出详情 | 点击可点出json 目前已知String|Guid--> <!-- 点击可出详情 | 点击可点出json 目前已知String|Guid-->
<span v-else <span v-else
class="itemSpan"
@click="showTypeHandle(initApiOtherType(scope.row[item.prop])[1],scope.row[item.prop])" @click="showTypeHandle(initApiOtherType(scope.row[item.prop])[1],scope.row[item.prop])"
:style="initApiOtherType(scope.row[item.prop])[1] != 'show' ? 'cursor: pointer' : ''" :style="initApiOtherType(scope.row[item.prop])[1] != 'show' ? 'cursor: pointer' : ''"
:title="'点击查看详情'" :title="'点击查看详情'"
@ -131,7 +132,14 @@
:close-on-click-modal="true" :close-on-click-modal="true"
:close-on-press-escape="true" :close-on-press-escape="true"
> >
{{ showDetailData ? showDetailData + "" : showDetailData }} <el-input
type="textarea"
readonly
autosize
resize="none"
v-model="showDetailData">
</el-input>
<!-- {{ showDetailData ? showDetailData + "" : showDetailData }} -->
</el-dialog> </el-dialog>
<!-- json弹窗 --> <!-- json弹窗 -->
@ -150,7 +158,7 @@
type="textarea" type="textarea"
readonly readonly
autosize autosize
placeholder="请输入内容" resize="none"
v-model="showJsonData_str"> v-model="showJsonData_str">
</el-input> </el-input>
</el-dialog> </el-dialog>
@ -164,12 +172,28 @@
:close-on-click-modal="true" :close-on-click-modal="true"
:close-on-press-escape="true" :close-on-press-escape="true"
:title="'内容详情'" :title="'内容详情'"
width="80%"
> >
<el-button <el-button
@click="copyJsonHandle()" @click="copyJsonHandle()"
type="primary" type="primary"
style="margin-bottom: 10px;float: right;" style="margin-bottom: 10px;float: right;"
>复制JSON</el-button> >复制JSON</el-button>
<!-- <el-table
:data="showJsonData_str"
stripe
style="width: 100%"
>
<el-table-column
v-for="(item,key) in showJsonHeader"
>
<template #header>
<span>{{ item }}</span>
</template>
<template slot-scope="scope">
</template>
</el-table-column>
</el-table> -->
<el-table <el-table
:data="showJsonData" :data="showJsonData"
:border="true" :border="true"
@ -187,19 +211,44 @@
<span v-if="(scope.row.name).toUpperCase() != 'DETAILS'">{{scope.row.value}}</span> <span v-if="(scope.row.name).toUpperCase() != 'DETAILS'">{{scope.row.value}}</span>
<el-table <el-table
v-else v-else
height="300"
:data="scope.row.value" :data="scope.row.value"
stripe
:border="true" :border="true"
style="width: 100%"> style="width: 100%"
<el-table-column >
prop="name"
label="子属性"
></el-table-column>
<el-table-column <el-table-column
label="子值" v-for="(head) in showJsonHeader"
prop="value" min-width="120"
></el-table-column> >
<template #header>
<span :title="head">{{ head }}</span>
</template>
<template slot-scope="scope" v-for="item in scope.row.value">
<div v-if="typeof item[head] == 'object'">
<div v-for="(o,o_key) in item[head]">
{{ o_key }}{{ o }}
<div style="border-bottom: dashed 1px #ddd;"></div>
</div>
</div>
<div v-else>{{ item[head] }}</div>
</template>
</el-table-column>
</el-table> </el-table>
<!-- <el-table
v-else
height="300"
:data="scope.row.value"
:border="true"
style="width: 100%">
<el-table-column
prop="name"
label="子属性"
></el-table-column>
<el-table-column
label="子值"
prop="value"
></el-table-column>
</el-table> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -326,6 +375,7 @@ export default {
showDetailDialog:false,// showDetailDialog:false,//
showDetailData:null,// showDetailData:null,//
showJsonDialog:false,//Jsontable showJsonDialog:false,//Jsontable
showJsonHeader:null,//Jsonheader
showJsonData:null,//Json showJsonData:null,//Json
showJsonData_str:null,//Json showJsonData_str:null,//Json
showJsonCopy:false,//jsonDialog showJsonCopy:false,//jsonDialog
@ -388,6 +438,10 @@ export default {
let _height = height || this.setUTableHeight let _height = height || this.setUTableHeight
let _app_height = document.getElementsByClassName('app-main')[0].clientHeight let _app_height = document.getElementsByClassName('app-main')[0].clientHeight
this.uTableHeight = Number(_app_height) - Number(_height) this.uTableHeight = Number(_app_height) - Number(_height)
this.$nextTick(() => {
this.$refs.multipleTable.doLayout()
this.$refs.multipleTable.$forceUpdate()
});
}, },
// //
getTableHeight(){ getTableHeight(){
@ -604,6 +658,7 @@ export default {
showJsonTable(row){ showJsonTable(row){
this.showJsonDialog = true this.showJsonDialog = true
let _json = eval('(' + row + ')') let _json = eval('(' + row + ')')
this.showJsonData_str = JSON.stringify(_json, null, '\t')//使
let _arr = [] let _arr = []
let __initJson = (data) => { let __initJson = (data) => {
let _init = [] let _init = []
@ -622,7 +677,12 @@ export default {
// //
if(Array.isArray(_json[item])){ if(Array.isArray(_json[item])){
// DETAILS todo:DETAILS使 // 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}) _arr.push({name:item,value:_value})
} }
// //
@ -639,7 +699,6 @@ export default {
} }
} }
this.showJsonData = _arr this.showJsonData = _arr
this.showJsonData_str = JSON.stringify(JSON.parse(JSON.stringify(this.showJsonData)), null, '\t')
this.$emit("showJsonTable", row); this.$emit("showJsonTable", row);
}, },
// Json // Json
@ -798,4 +857,8 @@ span {
.u-table::before { .u-table::before {
height: 0px; height: 0px;
} }
.itemSpan{
white-space: nowrap !important
}
</style> </style>
Loading…
Cancel
Save