|
|
@ -17,90 +17,127 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="datax-model"> |
|
|
|
<div class="datax-model"> |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('Datasource')}}</div> |
|
|
|
<div slot="text">{{$t('Custom template')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<m-datasource |
|
|
|
<label class="label-box"> |
|
|
|
ref="refDs" |
|
|
|
<div style="padding-top: 5px;"> |
|
|
|
@on-dsData="_onDsData" |
|
|
|
<x-switch v-model="enable" @on-click="_onSwitch" :disabled="isDetails"></x-switch> |
|
|
|
:supportType="['MYSQL','POSTGRESQL', 'ORACLE', 'SQLSERVER']" |
|
|
|
</div> |
|
|
|
:data="{ type:dsType,datasource:datasource }"> |
|
|
|
</label> |
|
|
|
</m-datasource> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div v-if="!enable"> |
|
|
|
<div slot="text">{{$t('SQL Statement')}}</div> |
|
|
|
<m-list-box> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="text">{{$t('Datasource')}}</div> |
|
|
|
<div class="from-mirror"> |
|
|
|
<div slot="content"> |
|
|
|
<textarea |
|
|
|
<m-datasource |
|
|
|
id="code-sql-mirror" |
|
|
|
ref="refDs" |
|
|
|
name="code-sql-mirror" |
|
|
|
@on-dsData="_onDsData" |
|
|
|
style="opacity: 0;"> |
|
|
|
:supportType="['MYSQL','POSTGRESQL', 'ORACLE', 'SQLSERVER']" |
|
|
|
</textarea> |
|
|
|
:data="{ type:dsType,datasource:datasource }"> |
|
|
|
|
|
|
|
</m-datasource> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('SQL Statement')}}</div> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<div class="from-mirror"> |
|
|
|
<m-datasource |
|
|
|
<textarea |
|
|
|
ref="refDt" |
|
|
|
id="code-sql-mirror" |
|
|
|
@on-dsData="_onDtData" |
|
|
|
name="code-sql-mirror" |
|
|
|
:supportType="['MYSQL','POSTGRESQL', 'ORACLE', 'SQLSERVER']" |
|
|
|
style="opacity: 0;"> |
|
|
|
:data="{ type:dtType,datasource:datatarget }"> |
|
|
|
</textarea> |
|
|
|
</m-datasource> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('TargetTable')}}</div> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<x-input |
|
|
|
<m-datasource |
|
|
|
type="input" |
|
|
|
ref="refDt" |
|
|
|
v-model="targetTable" |
|
|
|
@on-dsData="_onDtData" |
|
|
|
:placeholder="$t('Please enter the table of target')" |
|
|
|
:supportType="['MYSQL','POSTGRESQL', 'ORACLE', 'SQLSERVER']" |
|
|
|
autocomplete="off"> |
|
|
|
:data="{ type:dtType,datasource:datatarget }"> |
|
|
|
</x-input> |
|
|
|
</m-datasource> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}{{$t('Pre Statement')}}</div> |
|
|
|
<div slot="text">{{$t('TargetTable')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<m-statement-list |
|
|
|
<x-input |
|
|
|
ref="refPreStatements" |
|
|
|
type="input" |
|
|
|
@on-statement-list="_onPreStatements" |
|
|
|
v-model="targetTable" |
|
|
|
:statement-list="preStatements"> |
|
|
|
:placeholder="$t('Please enter the table of target')" |
|
|
|
</m-statement-list> |
|
|
|
autocomplete="off"> |
|
|
|
</div> |
|
|
|
</x-input> |
|
|
|
</m-list-box> |
|
|
|
</div> |
|
|
|
<m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}{{$t('Post Statement')}}</div> |
|
|
|
<m-list-box> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}{{$t('Pre Statement')}}</div> |
|
|
|
<m-statement-list |
|
|
|
<div slot="content"> |
|
|
|
ref="refPostStatements" |
|
|
|
<m-statement-list |
|
|
|
@on-statement-list="_onPostStatements" |
|
|
|
ref="refPreStatements" |
|
|
|
:statement-list="postStatements"> |
|
|
|
@on-statement-list="_onPreStatements" |
|
|
|
</m-statement-list> |
|
|
|
:statement-list="preStatements"> |
|
|
|
</div> |
|
|
|
</m-statement-list> |
|
|
|
</m-list-box> |
|
|
|
</div> |
|
|
|
<m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<div slot="text"> |
|
|
|
<m-list-box> |
|
|
|
<span>{{$t('SpeedByte')}}</span> |
|
|
|
<div slot="text">{{$t('TargetDataBase')}}{{$t('Post Statement')}}</div> |
|
|
|
</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<m-statement-list |
|
|
|
<m-select-input v-model="jobSpeedByte" :list="[0,1,10,50,100,512]"> |
|
|
|
ref="refPostStatements" |
|
|
|
</m-select-input> |
|
|
|
@on-statement-list="_onPostStatements" |
|
|
|
<span>({{$t('0 means unlimited by byte')}})</span> |
|
|
|
:statement-list="postStatements"> |
|
|
|
</div> |
|
|
|
</m-statement-list> |
|
|
|
</m-list-box> |
|
|
|
</div> |
|
|
|
<m-list-box> |
|
|
|
</m-list-box> |
|
|
|
<div slot="text"> |
|
|
|
<m-list-box> |
|
|
|
<span>{{$t('SpeedRecord')}}</span> |
|
|
|
<div slot="text"> |
|
|
|
</div> |
|
|
|
<span>{{$t('SpeedByte')}}</span> |
|
|
|
<div slot="content"> |
|
|
|
</div> |
|
|
|
<m-select-input v-model="jobSpeedRecord" :list="[0,500,1000,1500,2000,2500,3000]"> |
|
|
|
<div slot="content"> |
|
|
|
</m-select-input> |
|
|
|
<m-select-input v-model="jobSpeedByte" :list="[0,1,10,50,100,512]"> |
|
|
|
<span>({{$t('0 means unlimited by count')}})</span> |
|
|
|
</m-select-input> |
|
|
|
</div> |
|
|
|
<span>({{$t('0 means unlimited by byte')}})</span> |
|
|
|
</m-list-box> |
|
|
|
</div> |
|
|
|
|
|
|
|
</m-list-box> |
|
|
|
|
|
|
|
<m-list-box> |
|
|
|
|
|
|
|
<div slot="text"> |
|
|
|
|
|
|
|
<span>{{$t('SpeedRecord')}}</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div slot="content"> |
|
|
|
|
|
|
|
<m-select-input v-model="jobSpeedRecord" :list="[0,500,1000,1500,2000,2500,3000]"> |
|
|
|
|
|
|
|
</m-select-input> |
|
|
|
|
|
|
|
<span>({{$t('0 means unlimited by count')}})</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</m-list-box> |
|
|
|
|
|
|
|
</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> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
@ -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,50 +236,62 @@ |
|
|
|
* verification |
|
|
|
* verification |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_verification () { |
|
|
|
_verification () { |
|
|
|
if (!editor.getValue()) { |
|
|
|
if(this.customConfig) { |
|
|
|
this.$message.warning(`${i18n.$t('Please enter a SQL Statement(required)')}`) |
|
|
|
// storage |
|
|
|
return false |
|
|
|
this.$emit('on-params', { |
|
|
|
} |
|
|
|
customConfig: this.customConfig, |
|
|
|
|
|
|
|
json: jsonEditor.getValue(), |
|
|
|
|
|
|
|
localParams: this.localParams |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
console.log(123) |
|
|
|
|
|
|
|
if (!editor.getValue()) { |
|
|
|
|
|
|
|
this.$message.warning(`${i18n.$t('Please enter a SQL Statement(required)')}`) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// datasource Subcomponent verification |
|
|
|
// datasource Subcomponent verification |
|
|
|
if (!this.$refs.refDs._verifDatasource()) { |
|
|
|
if (!this.$refs.refDs._verifDatasource()) { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// datasource Subcomponent verification |
|
|
|
// datasource Subcomponent verification |
|
|
|
if (!this.$refs.refDt._verifDatasource()) { |
|
|
|
if (!this.$refs.refDt._verifDatasource()) { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.targetTable) { |
|
|
|
if (!this.targetTable) { |
|
|
|
this.$message.warning(`${i18n.$t('Please enter a Target Table(required)')}`) |
|
|
|
this.$message.warning(`${i18n.$t('Please enter a Target Table(required)')}`) |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// preStatements Subcomponent verification |
|
|
|
// preStatements Subcomponent verification |
|
|
|
if (!this.$refs.refPreStatements._verifProp()) { |
|
|
|
if (!this.$refs.refPreStatements._verifProp()) { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// postStatements Subcomponent verification |
|
|
|
// postStatements Subcomponent verification |
|
|
|
if (!this.$refs.refPostStatements._verifProp()) { |
|
|
|
if (!this.$refs.refPostStatements._verifProp()) { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// storage |
|
|
|
// storage |
|
|
|
this.$emit('on-params', { |
|
|
|
this.$emit('on-params', { |
|
|
|
dsType: this.dsType, |
|
|
|
customConfig: this.customConfig, |
|
|
|
dataSource: this.rtDatasource, |
|
|
|
dsType: this.dsType, |
|
|
|
dtType: this.dtType, |
|
|
|
dataSource: this.rtDatasource, |
|
|
|
dataTarget: this.rtDatatarget, |
|
|
|
dtType: this.dtType, |
|
|
|
sql: editor.getValue(), |
|
|
|
dataTarget: this.rtDatatarget, |
|
|
|
targetTable: this.targetTable, |
|
|
|
sql: editor.getValue(), |
|
|
|
jobSpeedByte: this.jobSpeedByte * 1024, |
|
|
|
targetTable: this.targetTable, |
|
|
|
jobSpeedRecord: this.jobSpeedRecord, |
|
|
|
jobSpeedByte: this.jobSpeedByte * 1024, |
|
|
|
preStatements: this.preStatements, |
|
|
|
jobSpeedRecord: this.jobSpeedRecord, |
|
|
|
postStatements: this.postStatements |
|
|
|
preStatements: this.preStatements, |
|
|
|
}) |
|
|
|
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 |
|
|
|