| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <template>
- <m-dialog title="创建任务" :visible.sync="show" @submit="handleSubmit">
- <MForm ref="form" :items="formItems" v-model="formValues" v-loading="loading"></MForm>
- </m-dialog>
- </template>
- <script>
- import MDialog from '@/components/Dialog'
- import MForm from '@/components/MForm'
- import {
- createDataTasks
- } from '@/api/dataChart'
- export default {
- name: 'modelTrainEdit',
- components: { MDialog, MForm },
- data () {
- return {
- show: false,
- formValues: {},
- formItems: [
- {
- label: '任务名称',
- key: 'task_name',
- type: 'text',
- rules: [v => !!v || '请输入任务名称']
- },
- {
- label: 'PostgreSQL连接字符串',
- key: 'db_connection',
- type: 'text',
- rules: [v => !!v || '请输入PostgreSQL连接字符串']
- },
- {
- label: '数据库名称',
- key: 'db_name',
- type: 'text',
- rules: [v => !!v || '请输入数据库名称']
- },
- {
- label: '业务上下文描述',
- key: 'business_context',
- type: 'textarea',
- rules: [v => !!v || '请输入业务上下文描述']
- }
- ],
- loading: false
- }
- },
- methods: {
- open (item) {
- this.show = true
- },
- async handleSubmit () {
- const check = this.$refs.form.validate()
- if (!check) {
- return
- }
- this.loading = true
- try {
- await createDataTasks({
- ...this.formValues,
- enable_sql_validation: true,
- enable_llm_repair: true,
- modify_original_file: true,
- enable_training_data_load: true
- })
- this.$snackbar.success('创建成功')
- this.show = false
- this.$emit('success')
- } catch (error) {
- this.$snackbar.error(error)
- } finally {
- this.loading = false
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|