|
|
@ -16,6 +16,17 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="datax-model"> |
|
|
|
<div class="datax-model"> |
|
|
|
|
|
|
|
<m-list-box> |
|
|
|
|
|
|
|
<div slot="text">{{$t('Custom template')}}</div> |
|
|
|
|
|
|
|
<div slot="content"> |
|
|
|
|
|
|
|
<label class="label-box"> |
|
|
|
|
|
|
|
<div style="padding-top: 5px;"> |
|
|
|
|
|
|
|
<x-switch v-model="enable" @on-click="_onSwitch" :disabled="isDetails"></x-switch> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</m-list-box> |
|
|
|
|
|
|
|
<div v-if="!enable"> |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('Datasource')}}</div> |
|
|
|
<div slot="text">{{$t('Datasource')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
@ -102,6 +113,32 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</m-list-box> |
|
|
|
</m-list-box> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-else> |
|
|
|
|
|
|
|
<m-list-box> |
|
|
|
|
|
|
|
<div slot="text">json</div> |
|
|
|
|
|
|
|
<div slot="content"> |
|
|
|
|
|
|
|
<div class="from-mirror"> |
|
|
|
|
|
|
|
<textarea |
|
|
|
|
|
|
|
id="code-json-mirror" |
|
|
|
|
|
|
|
name="code-json-mirror" |
|
|
|
|
|
|
|
style="opacity: 0;"> |
|
|
|
|
|
|
|
</textarea> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</m-list-box> |
|
|
|
|
|
|
|
<m-list-box> |
|
|
|
|
|
|
|
<div slot="text">{{$t('Custom Parameters')}}</div> |
|
|
|
|
|
|
|
<div slot="content"> |
|
|
|
|
|
|
|
<m-local-params |
|
|
|
|
|
|
|
ref="refLocalParams" |
|
|
|
|
|
|
|
@on-local-params="_onLocalParams" |
|
|
|
|
|
|
|
:udp-list="localParams" |
|
|
|
|
|
|
|
:hide="false"> |
|
|
|
|
|
|
|
</m-local-params> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</m-list-box> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
@ -115,12 +152,16 @@ |
|
|
|
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' |
|
|
|
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' |
|
|
|
|
|
|
|
|
|
|
|
let editor |
|
|
|
let editor |
|
|
|
|
|
|
|
let jsonEditor |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'datax', |
|
|
|
name: 'datax', |
|
|
|
|
|
|
|
|
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
// Data Custom template |
|
|
|
|
|
|
|
enable: false, |
|
|
|
|
|
|
|
enables: false, |
|
|
|
// Data source type |
|
|
|
// Data source type |
|
|
|
dsType: '', |
|
|
|
dsType: '', |
|
|
|
// data source |
|
|
|
// data source |
|
|
@ -135,6 +176,7 @@ |
|
|
|
rtDatatarget: '', |
|
|
|
rtDatatarget: '', |
|
|
|
// Sql statement |
|
|
|
// Sql statement |
|
|
|
sql: '', |
|
|
|
sql: '', |
|
|
|
|
|
|
|
json: '', |
|
|
|
// target table |
|
|
|
// target table |
|
|
|
targetTable: '', |
|
|
|
targetTable: '', |
|
|
|
// Pre statements |
|
|
|
// Pre statements |
|
|
@ -145,6 +187,9 @@ |
|
|
|
jobSpeedByte: 0, |
|
|
|
jobSpeedByte: 0, |
|
|
|
// speed record |
|
|
|
// speed record |
|
|
|
jobSpeedRecord: 1000, |
|
|
|
jobSpeedRecord: 1000, |
|
|
|
|
|
|
|
// Custom parameter |
|
|
|
|
|
|
|
localParams: [], |
|
|
|
|
|
|
|
customConfig: 0, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mixins: [disabledState], |
|
|
|
mixins: [disabledState], |
|
|
@ -153,6 +198,14 @@ |
|
|
|
createNodeId: Number |
|
|
|
createNodeId: Number |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
_onSwitch (is) { |
|
|
|
|
|
|
|
console.log(is) |
|
|
|
|
|
|
|
this.enables = true |
|
|
|
|
|
|
|
this.customConfig = 1 |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this._handlerJsonEditor() |
|
|
|
|
|
|
|
}, 200) |
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* return data source |
|
|
|
* return data source |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -183,6 +236,16 @@ |
|
|
|
* verification |
|
|
|
* verification |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_verification () { |
|
|
|
_verification () { |
|
|
|
|
|
|
|
if(this.customConfig) { |
|
|
|
|
|
|
|
// storage |
|
|
|
|
|
|
|
this.$emit('on-params', { |
|
|
|
|
|
|
|
customConfig: this.customConfig, |
|
|
|
|
|
|
|
json: jsonEditor.getValue(), |
|
|
|
|
|
|
|
localParams: this.localParams |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
console.log(123) |
|
|
|
if (!editor.getValue()) { |
|
|
|
if (!editor.getValue()) { |
|
|
|
this.$message.warning(`${i18n.$t('Please enter a SQL Statement(required)')}`) |
|
|
|
this.$message.warning(`${i18n.$t('Please enter a SQL Statement(required)')}`) |
|
|
|
return false |
|
|
|
return false |
|
|
@ -215,6 +278,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
// storage |
|
|
|
// storage |
|
|
|
this.$emit('on-params', { |
|
|
|
this.$emit('on-params', { |
|
|
|
|
|
|
|
customConfig: this.customConfig, |
|
|
|
dsType: this.dsType, |
|
|
|
dsType: this.dsType, |
|
|
|
dataSource: this.rtDatasource, |
|
|
|
dataSource: this.rtDatasource, |
|
|
|
dtType: this.dtType, |
|
|
|
dtType: this.dtType, |
|
|
@ -227,6 +291,7 @@ |
|
|
|
postStatements: this.postStatements |
|
|
|
postStatements: this.postStatements |
|
|
|
}) |
|
|
|
}) |
|
|
|
return true |
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Processing code highlighting |
|
|
|
* Processing code highlighting |
|
|
@ -259,6 +324,34 @@ |
|
|
|
|
|
|
|
|
|
|
|
return editor |
|
|
|
return editor |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
_handlerJsonEditor () { |
|
|
|
|
|
|
|
this._destroyJsonEditor() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// jsonEditor |
|
|
|
|
|
|
|
jsonEditor = codemirror('code-json-mirror', { |
|
|
|
|
|
|
|
mode: 'json', |
|
|
|
|
|
|
|
readOnly: this.isDetails |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.keypress = () => { |
|
|
|
|
|
|
|
if (!jsonEditor.getOption('readOnly')) { |
|
|
|
|
|
|
|
jsonEditor.showHint({ |
|
|
|
|
|
|
|
completeSingle: false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Monitor keyboard |
|
|
|
|
|
|
|
jsonEditor.on('keypress', this.keypress) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonEditor.on('changes', () => { |
|
|
|
|
|
|
|
// this._cacheParams() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonEditor.setValue(this.json) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jsonEditor |
|
|
|
|
|
|
|
}, |
|
|
|
_cacheParams () { |
|
|
|
_cacheParams () { |
|
|
|
this.$emit('on-cache-params', { |
|
|
|
this.$emit('on-cache-params', { |
|
|
|
dsType: this.dsType, |
|
|
|
dsType: this.dsType, |
|
|
@ -279,6 +372,13 @@ |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
editor.off($('.code-sql-mirror'), 'changes', this.changes) |
|
|
|
editor.off($('.code-sql-mirror'), 'changes', this.changes) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_destroyJsonEditor () { |
|
|
|
|
|
|
|
if (jsonEditor) { |
|
|
|
|
|
|
|
jsonEditor.toTextArea() // Uninstall |
|
|
|
|
|
|
|
jsonEditor.off($('.code-json-mirror'), 'keypress', this.keypress) |
|
|
|
|
|
|
|
jsonEditor.off($('.code-json-mirror'), 'changes', this.changes) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
created () { |
|
|
|
created () { |
|
|
@ -303,6 +403,11 @@ |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this._handlerEditor() |
|
|
|
this._handlerEditor() |
|
|
|
}, 200) |
|
|
|
}, 200) |
|
|
|
|
|
|
|
// this._handlerJsonEditor() |
|
|
|
|
|
|
|
// setTimeout(() => { |
|
|
|
|
|
|
|
// this._handlerJsonEditor() |
|
|
|
|
|
|
|
// }, 200) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
destroyed () { |
|
|
|
destroyed () { |
|
|
|
/** |
|
|
|
/** |
|
|
@ -312,6 +417,10 @@ |
|
|
|
editor.toTextArea() // Uninstall |
|
|
|
editor.toTextArea() // Uninstall |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (jsonEditor) { |
|
|
|
|
|
|
|
jsonEditor.toTextArea() // Uninstall |
|
|
|
|
|
|
|
jsonEditor.off($('.code-json-mirror'), 'keypress', this.keypress) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
//Watch the cacheParams |
|
|
|
//Watch the cacheParams |
|
|
|