| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <div>
- <page-header :title="headerTitle" />
- <page-body needMarginBottom>
- <llm-sku-create-form
- ref="createForm"
- mode="create"
- hide-footer
- @success="onFormSuccess"
- @cancel="onFormCancel" />
- </page-body>
- <page-footer>
- <template v-slot:right>
- <a-button type="primary" :loading="submitLoading" @click="handleConfirm">{{ $t('common.create') }}</a-button>
- <a-button class="ml-2" @click="handleCancel">{{ $t('common.cancel') }}</a-button>
- </template>
- </page-footer>
- </div>
- </template>
- <script>
- import LlmSkuCreateForm from './Form.vue'
- export default {
- name: 'LlmSkuCreate',
- components: {
- LlmSkuCreateForm,
- },
- data () {
- return {
- submitLoading: false,
- }
- },
- computed: {
- isApplyType () {
- return this.$route.path.includes('app-llm')
- },
- headerTitle () {
- return this.$t('common.create') + ' - ' + (this.isApplyType ? this.$t('aice.app_llm_sku') : this.$t('aice.llm_sku'))
- },
- },
- methods: {
- async handleConfirm () {
- const form = this.$refs.createForm
- if (!form) return
- this.submitLoading = true
- try {
- await form.handleConfirm()
- } catch (e) {
- // 校验失败等由表单处理
- } finally {
- this.submitLoading = false
- }
- },
- handleCancel () {
- this.$refs.createForm && this.$refs.createForm.handleCancel()
- },
- onFormSuccess () {
- this.$router.push(this.isApplyType ? '/app-llm-sku' : '/llm-sku')
- },
- onFormCancel () {
- this.$router.push(this.isApplyType ? '/app-llm-sku' : '/llm-sku')
- },
- },
- }
- </script>
|