|
@@ -9,29 +9,26 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item prop="algorithmtype" label="类型">
|
|
|
- <el-select v-model="tableForm.algorithmtype" @change="changeSelect('algorithmtype')" placeholder="请选择">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ <el-select v-model="tableForm.algorithmtype" @change="changeSelect('algorithmtype',tableForm.algorithmtype)" placeholder="请选择">
|
|
|
+ <el-option v-for="(item,index) in selectType" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col v-if="tableForm.algorithmtype == 'JAVA' || tableForm.algorithmtype == 'DB' || tableForm.algorithmtype == 'Kafka' || tableForm.algorithmtype == 'ES'" :span="24">
|
|
|
+ <el-col v-if="tableForm.algorithmtype == 1 || tableForm.algorithmtype == 2 || tableForm.algorithmtype == 3 || tableForm.algorithmtype == 6" :span="24">
|
|
|
<el-form-item prop="executionnumber" label="算法">
|
|
|
- <el-select v-model="tableForm.executionnumber" placeholder="请选择">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ <el-select v-model="tableForm.executionnumber" @change="changeSelect('executionnumber',tableForm.executionnumber)" placeholder="请选择">
|
|
|
+ <el-option v-for="(item,index) in selectAlgorithm" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col v-if=" tableForm.executionnumber == 'DB' || tableForm.algorithmtype == 'Kafka' || tableForm.algorithmtype == 'ES'" :span="24">
|
|
|
+ <el-col v-if=" tableForm.executionnumber == 2 || tableForm.algorithmtype == 3 || tableForm.algorithmtype == 6" :span="24">
|
|
|
<el-form-item prop="datasourceid" label="数据源">
|
|
|
- <el-select v-model="tableForm.datasourceid" placeholder="请选择">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ <el-select v-model="tableForm.datasourceid" @change="changeSelect('datasourceid',tableForm.datasourceid)" placeholder="请选择">
|
|
|
+ <el-option v-for="(item,index) in selectSource" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col v-if="tableForm.algorithmtype == 'JS'" :span="24">
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item prop="computingexpression" label="表达式">
|
|
|
<el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
|
|
|
</el-form-item>
|
|
@@ -49,7 +46,11 @@ export default {
|
|
|
labelWidth: {
|
|
|
type: String,
|
|
|
default: '80px'
|
|
|
- }
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => new Object()
|
|
|
+ },
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
@@ -67,10 +68,17 @@ export default {
|
|
|
selectSource: []
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ formData: {
|
|
|
+ handler (obj) {
|
|
|
+ this.tableForm = obj
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted () {
|
|
|
- this.getSelectData('algorithmtype', 20, {
|
|
|
- type: '0'
|
|
|
- })
|
|
|
+ this.getSelectData('algorithmtype', 20, { type: '0' })
|
|
|
},
|
|
|
methods: {
|
|
|
//获取表单下拉数据
|
|
@@ -85,21 +93,53 @@ export default {
|
|
|
this.loading = true
|
|
|
if (allResult.length && allResultKey.length) {
|
|
|
const results = await Promise.allSettled(allResult)
|
|
|
- results.map((item) => {
|
|
|
+ results.map((item, index) => {
|
|
|
const { status, value } = item
|
|
|
if (status == 'fulfilled') {
|
|
|
const { code, returnData } = value
|
|
|
- console.log(code, returnData)
|
|
|
+ if (code == 0) {
|
|
|
+ this.setFormSelectData(allResultKey[index], returnData)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
this.loading = false
|
|
|
},
|
|
|
+ setFormSelectData (name, returnData) {
|
|
|
+ switch (name) {
|
|
|
+ case 'algorithmtype':
|
|
|
+ this.selectType = [...returnData]
|
|
|
+ break;
|
|
|
+ case 'executionnumber':
|
|
|
+ this.selectAlgorithm = [...returnData]
|
|
|
+ break;
|
|
|
+ case 'datasourceid':
|
|
|
+ console.log(returnData)
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
formatData (returnData) {
|
|
|
return typeof returnData == 'string' ? JSON.parse(returnData) : returnData
|
|
|
},
|
|
|
//获取表单下拉数据
|
|
|
- changeSelect (code) { },
|
|
|
+ changeSelect (name, code) {
|
|
|
+ switch (name) {
|
|
|
+ case 'algorithmtype':
|
|
|
+ if (code == 1 || code == 2 || code == 3 || code == 6) {
|
|
|
+ this.getSelectData('executionnumber', 20, { superiorid: code })
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'executionnumber':
|
|
|
+ if (code == 2 || code == 3 || code == 6) {
|
|
|
+ this.getSelectData('datasourceid', 20, { superiorid: code })
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
restForm () {
|
|
|
this.$refs['ruleForm'].resetFields()
|
|
|
},
|