diff --git a/src/views/system/jd-instruction/index.vue b/src/views/system/jd-instruction/index.vue index 98ddfcd..ee0011d 100644 --- a/src/views/system/jd-instruction/index.vue +++ b/src/views/system/jd-instruction/index.vue @@ -21,10 +21,23 @@ - -
- 复制响应 -
+ +
@@ -42,13 +55,26 @@ export default { return { form: { command: '' }, loading: false, - result: '' + result: '', + resultList: [] } }, methods: { + copyOne(text) { + if (!text) return + this.doCopy(text) + }, + copyAll() { + if (!this.resultList || this.resultList.length === 0) return + const text = this.resultList.join('\n\n') + this.doCopy(text) + }, copyResult() { if (!this.result) return const text = this.result + this.doCopy(text) + }, + doCopy(text) { if (navigator.clipboard) { navigator.clipboard.writeText(text).then(() => { this.$modal.msgSuccess('复制成功') @@ -74,7 +100,14 @@ export default { executeInstruction({ command: cmd }).then(res => { this.loading = false if (res && (res.code === 200 || res.msg === '操作成功')) { - this.result = res.data || res.msg || '' + const data = res.data + if (Array.isArray(data)) { + this.resultList = data + this.result = '' + } else { + this.result = data || res.msg || '' + this.resultList = [] + } } else { this.$modal.msgError(res && res.msg ? res.msg : '执行失败') } @@ -89,6 +122,7 @@ export default { clearAll() { this.form.command = '' this.result = '' + this.resultList = [] } } }