This commit is contained in:
ann 2024-09-11 16:58:30 +08:00
parent 0993375d23
commit ff74cae8c3
1 changed files with 28 additions and 8 deletions

View File

@ -51,8 +51,13 @@
<el-option v-for="item in instanceList" :key="item.Id" :label="item.Name" :value="item.Id" />
</el-select>
</el-form-item>
<el-form-item :label="$t('page.selectSubInstance')" prop="instanceIds">
<el-select v-model="formData.instanceIds" style="margin-right: 10px;" :multiple="formData.modelType.indexOf('image') === 0">
<el-form-item v-if="formData.modelType.indexOf('image') !== 0" :label="$t('page.selectSubInstance')" prop="instanceId">
<el-select v-model="formData.instanceId" style="margin-right: 10px;">
<el-option v-for="item in subInstanceList" :key="item.id" :label="'名称:'+item.instanceName+',驱动器:'+item.adapterName+',集群:'+item.clusterName" :value="Number(item.id)" />
</el-select>
</el-form-item>
<el-form-item v-else :label="$t('page.selectSubInstance')" prop="instanceIds">
<el-select v-model="formData.instanceIds" style="margin-right: 10px;" multiple>
<el-option v-for="item in subInstanceList" :key="item.id" :label="'名称:'+item.instanceName+',驱动器:'+item.adapterName+',集群:'+item.clusterName" :value="Number(item.id)" />
</el-select>
</el-form-item>
@ -172,7 +177,8 @@ export default {
'staticWeightMap': [],
'strategy': 'staticWeight',
'aiClusterIds': '',
'instanceIds': []
'instanceIds': [],
'instanceId': ''
},
fileList: [],
modelTypeList: [],
@ -204,10 +210,7 @@ export default {
'adapterId'() {
const query = { 'type': '1', 'adapterId': this.formData.adapterId, pageNum: 1, pageSize: 1000 }
getClusterList(query).then(e => {
// this.currentClusterList =
(e.data.list || []).forEach(e => {
this.formData.staticWeightMap.push({ key: e.name, id: e.id, value: 0 })
})
this.currentClusterList = e.data.list || []
})
},
'formData.modelType'(val) {
@ -221,10 +224,27 @@ export default {
'formData.deployTaskId'(val) {
if (val && this.adapterId) {
this.formData.instanceIds = []
this.formData.instanceId = ''
getSubInstanceList({ deployTaskId: val, adapterId: this.adapterId }).then(e => {
this.subInstanceList = e.data.list
})
}
},
'formData.instanceIds'(val) {
if (val && this.adapterId) {
this.formData.staticWeightMap = []
const clusterIds = []
this.subInstanceList.forEach(e => {
if (val.includes(Number(e.id))) {
clusterIds.push(e.clusterId)
}
})
this.currentClusterList.forEach(e => {
if (clusterIds.includes(e.id)) {
this.formData.staticWeightMap.push({ key: e.name, id: e.id, value: 0 })
}
})
}
}
},
mounted() {
@ -278,7 +298,7 @@ export default {
} else {
// const arr = this.formData.aiClusterIds.split()
// form.set('aiClusterIds', JSON.stringify(arr))
form.set('instanceId', this.formData.instanceIds)
form.set('instanceId', this.formData.instanceId)
}
form.set('taskName', this.formData.taskName)
form.set('taskDesc', this.formData.taskDesc)