fix: Create playbook job form error

This commit is contained in:
w940853815
2025-02-18 11:16:39 +08:00
committed by w940853815
parent fa2faecb7c
commit 27e2d34171
3 changed files with 41 additions and 38 deletions

View File

@@ -158,37 +158,33 @@ export default {
}
},
mounted() {
if (this.$route.query && this.$route.query.type) {
this.initial.type = 'adhoc'
switch (this.$route.query.type) {
case 'adhoc':
this.initial.type = 'adhoc'
if (this.$route.query.id) {
this.$axios.get(`/api/v1/ops/adhocs/${this.$route.query.id}`).then((data) => {
this.initial.module = data.module
this.initial.args = data.args
this.initial.instant = true
this.initial.runAfterSave = true
this.instantTask = true
this.createSuccessNextRoute = { name: 'Adhoc' }
this.ready = true
})
} else {
const type = this.$route.query['_type']
switch (type) {
case 'adhoc':
this.initial.type = 'adhoc'
if (this.$route.query.id) {
this.$axios.get(`/api/v1/ops/adhocs/${this.$route.query.id}`).then((data) => {
this.initial.module = data.module
this.initial.args = data.args
this.initial.instant = true
this.initial.runAfterSave = true
this.instantTask = true
this.createSuccessNextRoute = { name: 'Adhoc' }
this.ready = true
}
break
case 'playbook':
this.initial.type = 'playbook'
if (this.$route.query.id) {
this.initial.playbook = this.$route.query.id
this.ready = true
} else {
this.ready = true
}
break
}
} else {
this.ready = true
})
} else {
this.ready = true
}
break
case 'playbook':
this.initial.type = 'playbook'
if (this.$route.query.id) {
this.initial.playbook = this.$route.query.id
this.ready = true
} else {
this.ready = true
}
break
}
},
methods: {}

View File

@@ -1,6 +1,7 @@
<template>
<div>
<GenericListTable
ref="ListTable"
:create-drawer="createDrawer"
:detail-drawer="detailDrawer"
:header-actions="headerActions"
@@ -22,6 +23,7 @@ export default {
JobRunDialog
},
data() {
const vm = this
return {
item: {},
createDrawer: () => import('@/views/ops/Job/JobUpdateCreate.vue'),
@@ -113,7 +115,12 @@ export default {
}
},
headerActions: {
createRoute: 'JobCreate',
onCreate: () => {
vm.$router.push({
query: { _type: 'adhoc' }
})
vm.$refs.ListTable.onCreate()
},
hasRefresh: true,
hasExport: false,
hasImport: false

View File

@@ -1,6 +1,7 @@
<template>
<div>
<GenericListTable
ref="ListTable"
:create-drawer="createDrawer"
:detail-drawer="detailDrawer"
:header-actions="headerActions"
@@ -23,6 +24,7 @@ export default {
JobRunDialog
},
data() {
const vm = this
return {
createDrawer: () => import('@/views/ops/Job/JobUpdateCreate.vue'),
detailDrawer: () => import('@/views/ops/Job/JobDetail/index.vue'),
@@ -117,13 +119,11 @@ export default {
hasRefresh: true,
hasExport: false,
hasImport: false,
createRoute: () => {
return {
name: 'JobCreate',
query: {
type: 'playbook'
}
}
onCreate: () => {
vm.$router.push({
query: { _type: 'playbook' }
})
vm.$refs.ListTable.onCreate()
}
},
showJobRunDialog: false