|
|
@ -318,6 +318,8 @@ |
|
|
|
* Processing code highlighting |
|
|
|
* Processing code highlighting |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_handlerEditor () { |
|
|
|
_handlerEditor () { |
|
|
|
|
|
|
|
this._destroyEditor() |
|
|
|
|
|
|
|
|
|
|
|
// editor |
|
|
|
// editor |
|
|
|
editor = codemirror('code-sql-mirror', { |
|
|
|
editor = codemirror('code-sql-mirror', { |
|
|
|
mode: 'sql', |
|
|
|
mode: 'sql', |
|
|
@ -332,9 +334,15 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.changes = () => { |
|
|
|
|
|
|
|
this._cacheParams() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Monitor keyboard |
|
|
|
// Monitor keyboard |
|
|
|
editor.on('keypress', this.keypress) |
|
|
|
editor.on('keypress', this.keypress) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editor.on('changes', this.changes) |
|
|
|
|
|
|
|
|
|
|
|
editor.setValue(this.sql) |
|
|
|
editor.setValue(this.sql) |
|
|
|
|
|
|
|
|
|
|
|
return editor |
|
|
|
return editor |
|
|
@ -351,6 +359,38 @@ |
|
|
|
this.receivers = res.receivers && res.receivers.split(',') || [] |
|
|
|
this.receivers = res.receivers && res.receivers.split(',') || [] |
|
|
|
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || [] |
|
|
|
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_cacheParams () { |
|
|
|
|
|
|
|
this.$emit('on-cache-params', { |
|
|
|
|
|
|
|
type: this.type, |
|
|
|
|
|
|
|
datasource: this.rtDatasource, |
|
|
|
|
|
|
|
sql: editor ? editor.getValue() : '', |
|
|
|
|
|
|
|
udfs: this.udfs, |
|
|
|
|
|
|
|
sqlType: this.sqlType, |
|
|
|
|
|
|
|
title: this.title, |
|
|
|
|
|
|
|
receivers: this.receivers.join(','), |
|
|
|
|
|
|
|
receiversCc: this.receiversCc.join(','), |
|
|
|
|
|
|
|
showType: (() => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let showType = this.showType |
|
|
|
|
|
|
|
if (showType.length === 2 && showType[0] === 'ATTACHMENT') { |
|
|
|
|
|
|
|
return [showType[1], showType[0]].join(',') |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return showType.join(',') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(), |
|
|
|
|
|
|
|
localParams: this.localParams, |
|
|
|
|
|
|
|
connParams: this.connParams, |
|
|
|
|
|
|
|
preStatements: this.preStatements, |
|
|
|
|
|
|
|
postStatements: this.postStatements |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_destroyEditor () { |
|
|
|
|
|
|
|
if (editor) { |
|
|
|
|
|
|
|
editor.toTextArea() // Uninstall |
|
|
|
|
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
|
|
|
|
editor.off($('.code-sql-mirror'), 'changes', this.changes) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -373,7 +413,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
//Watch the cacheParams |
|
|
|
//Watch the cacheParams |
|
|
|
cacheParams (val) { |
|
|
|
cacheParams (val) { |
|
|
|
this.$emit('on-cache-params', val); |
|
|
|
this._cacheParams() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
created () { |
|
|
|
created () { |
|
|
@ -418,6 +458,7 @@ |
|
|
|
if (editor) { |
|
|
|
if (editor) { |
|
|
|
editor.toTextArea() // Uninstall |
|
|
|
editor.toTextArea() // Uninstall |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
|
|
|
|
editor.off($('.code-sql-mirror'), 'changes', this.changes) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -425,7 +466,6 @@ |
|
|
|
return { |
|
|
|
return { |
|
|
|
type: this.type, |
|
|
|
type: this.type, |
|
|
|
datasource: this.rtDatasource, |
|
|
|
datasource: this.rtDatasource, |
|
|
|
sql: editor ? editor.getValue() : '', |
|
|
|
|
|
|
|
udfs: this.udfs, |
|
|
|
udfs: this.udfs, |
|
|
|
sqlType: this.sqlType, |
|
|
|
sqlType: this.sqlType, |
|
|
|
title: this.title, |
|
|
|
title: this.title, |
|
|
|