72 lines
1.6 KiB
Vue
72 lines
1.6 KiB
Vue
<template>
|
|
<component
|
|
v-if="hasApp && configLoaded"
|
|
:is="componentName"
|
|
:params="params"
|
|
:backType="backType"
|
|
:instance="instance"
|
|
:dict="dict"
|
|
:appType="appType"
|
|
:appId="appId"
|
|
:configs="configs"
|
|
@change="changePage" />
|
|
<ai-empty v-else-if="hasApp">应用配置加载中...</ai-empty>
|
|
<ai-empty v-else>读取应用失败</ai-empty>
|
|
</template>
|
|
|
|
<script>
|
|
import Add from './components/Add.vue'
|
|
import Detail from './components/Detail.vue'
|
|
import List from './components/List.vue'
|
|
|
|
export default {
|
|
label: '代码生成',
|
|
name: 'AppCodeGeneration',
|
|
props: {
|
|
instance: Function,
|
|
dict: Object
|
|
},
|
|
components: {Add, Detail, List},
|
|
computed: {
|
|
appId() {
|
|
return this.$route.query.app
|
|
},
|
|
hasApp() {
|
|
return !!this.appId
|
|
},
|
|
configLoaded() {
|
|
return !!this.configs.id
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
componentName: 'list',
|
|
params: {},
|
|
backType: '',
|
|
configs: {},
|
|
appType: ''
|
|
}
|
|
},
|
|
methods: {
|
|
changePage(data) {
|
|
this.componentName = data.type
|
|
this.params = data.params
|
|
this.backType = data.backType || ''
|
|
},
|
|
getConfigs() {
|
|
this.instance.post(`/app/appapplicationinfo/queryApplicationInfo`, null, {
|
|
params: {appId: this.appId}
|
|
}).then((res) => {
|
|
if (res?.data) {
|
|
this.appType = res.data.appType
|
|
this.configs = res.data
|
|
}
|
|
})
|
|
}
|
|
},
|
|
created() {
|
|
this.getConfigs()
|
|
}
|
|
}
|
|
</script>
|