File tree Expand file tree Collapse file tree 6 files changed +54
-4
lines changed
src/views/datax/json-build Expand file tree Collapse file tree 6 files changed +54
-4
lines changed Original file line number Diff line number Diff line change
1
+ // 公共的组件,来做为中间传达的工具
2
+ import Vue from 'vue'
3
+ export default new Vue ( {
4
+ data ( ) {
5
+ return {
6
+ dataSourceId : ''
7
+ }
8
+ }
9
+ } )
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" app-container" >
3
- <RDBMSWriter v-if =" dataSource!=='hive' && dataSource!=='hbase' && dataSource!=='mongodb'" ref =" rdbmswriter" @selectDataSource =" showDataSource" />
4
- <HiveWriter v-if =" dataSource==='hive'" ref =" hivewriter" @selectDataSource =" showDataSource" />
5
- <HBaseWriter v-if =" dataSource==='hbase'" ref =" hbasewriter" @selectDataSource =" showDataSource" />
6
- <MongoDBWriter v-if =" dataSource==='mongodb'" ref =" mongodbwriter" @selectDataSource =" showDataSource" />
3
+ <RDBMSWriter v-show =" dataSource!=='hive' && dataSource!=='hbase' && dataSource!=='mongodb'" ref =" rdbmswriter" @selectDataSource =" showDataSource" />
4
+ <HiveWriter v-show =" dataSource==='hive'" ref =" hivewriter" @selectDataSource =" showDataSource" />
5
+ <HBaseWriter v-show =" dataSource==='hbase'" ref =" hbasewriter" @selectDataSource =" showDataSource" />
6
+ <MongoDBWriter v-show =" dataSource==='mongodb'" ref =" mongodbwriter" @selectDataSource =" showDataSource" />
7
7
8
8
</div >
9
9
</template >
@@ -49,6 +49,7 @@ export default {
49
49
},
50
50
showDataSource (data ) {
51
51
this .dataSource = data
52
+ this .getData ()
52
53
},
53
54
sendTableNameAndColumns (fromTableName , fromColumnList ) {
54
55
this .$refs .hivewriter .fromTableName = fromTableName
Original file line number Diff line number Diff line change 63
63
<script >
64
64
import * as dsQueryApi from ' @/api/ds-query'
65
65
import { list as jdbcDsList } from ' @/api/datax-jdbcDatasource'
66
+ import Bus from ' ../busWriter'
66
67
export default {
67
68
name: ' HBaseWriter' ,
68
69
data () {
@@ -121,6 +122,11 @@ export default {
121
122
readerForm: this .getReaderData ()
122
123
}
123
124
},
125
+ watch: {
126
+ ' writerForm.datasourceId ' : function (oldVal , newVal ) {
127
+ this .getTables (' reader' )
128
+ }
129
+ },
124
130
created () {
125
131
this .getJdbcDs ()
126
132
},
@@ -153,6 +159,7 @@ export default {
153
159
this .dataSource = item .datasource
154
160
}
155
161
})
162
+ Bus .dataSourceId = e
156
163
this .$emit (' selectDataSource' , this .dataSource )
157
164
// 获取可用表
158
165
this .getTables ()
@@ -194,6 +201,9 @@ export default {
194
201
this .writerForm .isIndeterminate = false
195
202
},
196
203
getData () {
204
+ if (Bus .dataSourceId ) {
205
+ this .writerForm .datasourceId = Bus .dataSourceId
206
+ }
197
207
return this .writerForm
198
208
},
199
209
getReaderData () {
Original file line number Diff line number Diff line change 76
76
<script >
77
77
import * as dsQueryApi from ' @/api/ds-query'
78
78
import { list as jdbcDsList } from ' @/api/datax-jdbcDatasource'
79
+ import Bus from ' ../busWriter'
79
80
export default {
80
81
name: ' HiveWriter' ,
81
82
data () {
@@ -120,6 +121,11 @@ export default {
120
121
]
121
122
}
122
123
},
124
+ watch: {
125
+ ' writerForm.datasourceId ' : function (oldVal , newVal ) {
126
+ this .getTables (' reader' )
127
+ }
128
+ },
123
129
created () {
124
130
this .getJdbcDs ()
125
131
},
@@ -152,6 +158,7 @@ export default {
152
158
this .dataSource = item .datasource
153
159
}
154
160
})
161
+ Bus .dataSourceId = e
155
162
this .$emit (' selectDataSource' , this .dataSource )
156
163
// 获取可用表
157
164
this .getTables ()
@@ -193,6 +200,9 @@ export default {
193
200
this .writerForm .isIndeterminate = false
194
201
},
195
202
getData () {
203
+ if (Bus .dataSourceId ) {
204
+ this .writerForm .datasourceId = Bus .dataSourceId
205
+ }
196
206
return this .writerForm
197
207
},
198
208
getReaderData () {
Original file line number Diff line number Diff line change 57
57
<script >
58
58
import * as dsQueryApi from ' @/api/ds-query'
59
59
import { list as jdbcDsList } from ' @/api/datax-jdbcDatasource'
60
+ import Bus from ' ../busWriter'
60
61
export default {
61
62
name: ' MongoDBWriter' ,
62
63
data () {
@@ -90,6 +91,11 @@ export default {
90
91
readerForm: this .getReaderData ()
91
92
}
92
93
},
94
+ watch: {
95
+ ' writerForm.datasourceId ' : function (oldVal , newVal ) {
96
+ this .getTables ()
97
+ }
98
+ },
93
99
created () {
94
100
this .getJdbcDs ()
95
101
},
@@ -122,6 +128,7 @@ export default {
122
128
this .dataSource = item .datasource
123
129
}
124
130
})
131
+ Bus .dataSourceId = e
125
132
this .$emit (' selectDataSource' , this .dataSource )
126
133
// 获取可用表
127
134
this .getTables ()
@@ -163,6 +170,9 @@ export default {
163
170
this .writerForm .isIndeterminate = false
164
171
},
165
172
getData () {
173
+ if (Bus .dataSourceId ) {
174
+ this .writerForm .datasourceId = Bus .dataSourceId
175
+ }
166
176
return this .writerForm
167
177
},
168
178
getReaderData () {
Original file line number Diff line number Diff line change 51
51
<script >
52
52
import * as dsQueryApi from ' @/api/ds-query'
53
53
import { list as jdbcDsList } from ' @/api/datax-jdbcDatasource'
54
+ import Bus from ' ../busWriter'
54
55
export default {
55
56
name: ' RDBMSWriter' ,
56
57
data () {
@@ -76,6 +77,11 @@ export default {
76
77
}
77
78
}
78
79
},
80
+ watch: {
81
+ ' writerForm.datasourceId ' : function (oldVal , newVal ) {
82
+ this .getTables (' reader' )
83
+ }
84
+ },
79
85
created () {
80
86
this .getJdbcDs ()
81
87
},
@@ -108,6 +114,7 @@ export default {
108
114
this .dataSource = item .datasource
109
115
}
110
116
})
117
+ Bus .dataSourceId = e
111
118
this .$emit (' selectDataSource' , this .dataSource )
112
119
// 获取可用表
113
120
this .getTables ()
@@ -149,6 +156,9 @@ export default {
149
156
this .writerForm .isIndeterminate = false
150
157
},
151
158
getData () {
159
+ if (Bus .dataSourceId ) {
160
+ this .writerForm .datasourceId = Bus .dataSourceId
161
+ }
152
162
return this .writerForm
153
163
},
154
164
getReaderData () {
You can’t perform that action at this time.
0 commit comments