dongyukun
2025-05-26 555b01ab4b5f4bcae9b3a75b28b9d2c99fefc9ea
src/views/model/sche/snapshotConf/configForm.vue
@@ -36,9 +36,9 @@
  </Dialog>
</template>
<script lang="ts" setup>
  import * as ChartApi from '@/api/model/mpk/chart'
  import * as SnapshotConfigApi from '@/api/model/sche/suggest/snapshotConfig'
defineOptions({ name: 'ChartForm' })
defineOptions({ name: 'SnapshotConfigForm' })
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
@@ -49,8 +49,9 @@
const formType = ref('') // 表单的类型:create - 新增;update - 修改
const formData = ref({
  id: undefined,
  chartName: undefined,
  chartCode: undefined,
  title: undefined,
  modelId: undefined,
  scheduleObj: undefined,
})
const formRules = reactive({
  chartName: [{ required: true, message: '不能为空', trigger: 'blur' }],
@@ -68,7 +69,7 @@
  if (id) {
    formLoading.value = true
    try {
      formData.value = await ChartApi.get(id)
      formData.value = await SnapshotConfigApi.get(id)
    } finally {
      formLoading.value = false
    }
@@ -88,10 +89,10 @@
  try {
    const data = formData.value
    if (formType.value === 'create') {
      await ChartApi.create(data)
      await SnapshotConfigApi.create(data)
      message.success(t('common.createSuccess'))
    } else {
      await ChartApi.update(data)
      await SnapshotConfigApi.update(data)
      message.success(t('common.updateSuccess'))
    }
    dialogVisible.value = false
@@ -106,12 +107,9 @@
const resetForm = () => {
  formData.value = {
    id: undefined,
    chartName: undefined,
    chartCode: undefined,
    paramName: undefined,
    paramCode: undefined,
    paramValue: undefined,
    remark: undefined,
    title: undefined,
    modelId: undefined,
    scheduleObj: undefined,
  }
  formRef.value?.resetFields()
}