|
@ -4,22 +4,27 @@ |
|
|
|
|
|
|
|
|
<!-- 点开查看Json转换后table弹窗 --> |
|
|
<!-- 点开查看Json转换后table弹窗 --> |
|
|
<el-dialog |
|
|
<el-dialog |
|
|
|
|
|
top="50px" |
|
|
:visible.sync="JsonTableShow" |
|
|
:visible.sync="JsonTableShow" |
|
|
:modal-append-to-body="true" |
|
|
:modal-append-to-body="true" |
|
|
:append-to-body="true" |
|
|
:append-to-body="true" |
|
|
:show-close="true" |
|
|
:show-close="true" |
|
|
:close-on-click-modal="true" |
|
|
:close-on-click-modal="true" |
|
|
:close-on-press-escape="true" |
|
|
:close-on-press-escape="true" |
|
|
:title="'内容详情'" |
|
|
|
|
|
width="90%" |
|
|
width="90%" |
|
|
@close="closePop" |
|
|
@close="closePop" |
|
|
> |
|
|
> |
|
|
|
|
|
<template #title> |
|
|
|
|
|
内容详情 |
|
|
<el-button |
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
@click="copyJsonHandle()" |
|
|
@click="copyJsonHandle()" |
|
|
type="primary" |
|
|
type="primary" |
|
|
style="margin-bottom: 10px;float: right;" |
|
|
style="margin-right: 30px;float: right;" |
|
|
>复制JSON</el-button> |
|
|
>复制JSON</el-button> |
|
|
|
|
|
</template> |
|
|
<el-table |
|
|
<el-table |
|
|
|
|
|
height="calc(100vh - 220px)" |
|
|
:data="JsonTableData" |
|
|
:data="JsonTableData" |
|
|
:border="true" |
|
|
:border="true" |
|
|
style="width: 100%"> |
|
|
style="width: 100%"> |
|
@ -85,7 +90,7 @@ |
|
|
|
|
|
|
|
|
<!-- json复制内容弹窗 --> |
|
|
<!-- json复制内容弹窗 --> |
|
|
<el-dialog |
|
|
<el-dialog |
|
|
id="copyJsonTextarea_dialog_ref" |
|
|
top="50px" |
|
|
:visible.sync="JsonCopyShow" |
|
|
:visible.sync="JsonCopyShow" |
|
|
:modal-append-to-body="false" |
|
|
:modal-append-to-body="false" |
|
|
:append-to-body="true" |
|
|
:append-to-body="true" |
|
@ -95,6 +100,7 @@ |
|
|
:title="'JSON详情'" |
|
|
:title="'JSON详情'" |
|
|
> |
|
|
> |
|
|
<el-input |
|
|
<el-input |
|
|
|
|
|
class="copyJsonTextarea" |
|
|
ref="copyJsonTextarea_ref" |
|
|
ref="copyJsonTextarea_ref" |
|
|
type="textarea" |
|
|
type="textarea" |
|
|
readonly |
|
|
readonly |
|
@ -119,6 +125,7 @@ |
|
|
<umyTable |
|
|
<umyTable |
|
|
:isShowIndex="true" |
|
|
:isShowIndex="true" |
|
|
:tableBorder="true" |
|
|
:tableBorder="true" |
|
|
|
|
|
:setUTableHeight="240" |
|
|
:tableData="detailTableRow.value" |
|
|
:tableData="detailTableRow.value" |
|
|
:tableColumns="detailTableColumns" |
|
|
:tableColumns="detailTableColumns" |
|
|
:selectionTable="false" |
|
|
:selectionTable="false" |
|
@ -207,20 +214,25 @@ export default { |
|
|
this.JsonTableData = _arr |
|
|
this.JsonTableData = _arr |
|
|
this.JsonCopyData = JSON.stringify(_json, null, '\t')//复制使用 |
|
|
this.JsonCopyData = JSON.stringify(_json, null, '\t')//复制使用 |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 复制后选择框处理 |
|
|
|
|
|
copyJsonInputHandle(type){ |
|
|
|
|
|
if(type == 'error')this.$message.error('复制失败'); |
|
|
|
|
|
if(type == 'success')this.$message.success('复制成功'); |
|
|
|
|
|
if(this.$refs.copyJsonTextarea_ref){ |
|
|
|
|
|
this.$refs.copyJsonTextarea_ref.focus() |
|
|
|
|
|
this.$refs.copyJsonTextarea_ref.$refs.textarea.scrollTop = 0 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 复制Json按钮 |
|
|
// 复制Json按钮 |
|
|
copyJsonHandle(){ |
|
|
copyJsonHandle(){ |
|
|
this.JsonCopyShow = true |
|
|
this.JsonCopyShow = true |
|
|
if (navigator.clipboard && window.isSecureContext) { |
|
|
if (navigator.clipboard && window.isSecureContext) { |
|
|
navigator.clipboard.writeText(this.JsonCopyData) |
|
|
navigator.clipboard.writeText(this.JsonCopyData) |
|
|
.then(() => { |
|
|
.then(() => { |
|
|
this.$message.success('复制成功'); |
|
|
this.copyJsonInputHandle('success') |
|
|
this.$refs.copyJsonTextarea_ref.focus() |
|
|
|
|
|
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 |
|
|
|
|
|
}) |
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
this.$message.error('复制失败'); |
|
|
this.copyJsonInputHandle('error') |
|
|
this.$refs.copyJsonTextarea_ref.focus() |
|
|
|
|
|
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 |
|
|
|
|
|
}); |
|
|
}); |
|
|
}else { |
|
|
}else { |
|
|
// 创建text area |
|
|
// 创建text area |
|
@ -236,16 +248,10 @@ export default { |
|
|
textArea.remove() |
|
|
textArea.remove() |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.$nextTick(()=>{ |
|
|
this.$nextTick(()=>{ |
|
|
if(this.$refs.copyJsonTextarea_ref){ |
|
|
this.copyJsonInputHandle('success') |
|
|
this.$message.success('复制成功'); |
|
|
|
|
|
this.$refs.copyJsonTextarea_ref.focus() |
|
|
|
|
|
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
},() => { |
|
|
},() => { |
|
|
this.$message.error('复制失败'); |
|
|
this.copyJsonInputHandle('error') |
|
|
this.$refs.copyJsonTextarea_ref.focus() |
|
|
|
|
|
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0 |
|
|
|
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -265,3 +271,11 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
|
.copyJsonTextarea{ |
|
|
|
|
|
textarea{ |
|
|
|
|
|
max-height: calc(100vh - 220px) !important; |
|
|
|
|
|
overflow: auto !important; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
</style> |