dongyukun
2025-05-26 555b01ab4b5f4bcae9b3a75b28b9d2c99fefc9ea
调度建议快照配置
已删除1个文件
已修改5个文件
已添加1个文件
366 ■■■■■ 文件已修改
src/api/model/sche/suggest/snapshotConfig.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/sche/suggest/snapshotConfigDet.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/sche/snapshotConf/configForm.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/sche/snapshotConf/det/ChartParamForm.vue 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/sche/snapshotConf/det/configDetForm.vue 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/sche/snapshotConf/det/index.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/sche/snapshotConf/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/sche/suggest/snapshotConfig.ts
@@ -22,5 +22,5 @@
// 删除
export const del = (id) => {
  return request.delete({ url: '/model/suggest/snapshot/conf-main?id=' + id })
  return request.delete({ url: '/model/suggest/snapshot/conf-main/delete?id=' + id })
}
src/api/model/sche/suggest/snapshotConfigDet.ts
@@ -22,5 +22,5 @@
// 删除
export const del = (id) => {
  return request.delete({ url: '/model/suggest/snapshot/conf-det?id=' + id })
  return request.delete({ url: '/model/suggest/snapshot/conf-det/delete?id=' + id })
}
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()
}
src/views/model/sche/snapshotConf/det/ChartParamForm.vue
文件已删除
src/views/model/sche/snapshotConf/det/configDetForm.vue
对比新文件
@@ -0,0 +1,174 @@
<template>
  <Dialog v-model="dialogVisible" :title="dialogTitle">
    <el-form
      ref="formRef"
      v-loading="formLoading"
      :model="formData"
      :rules="formRules"
      label-width="80px"
    >
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="数据类型" prop="dataType">
            <el-input v-model="formData.dataType" placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="数据编号" prop="dataNo">
            <el-input v-model="formData.dataNo" placeholder=""/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="左侧长度" prop="leftLength">
            <el-input v-model="formData.leftLength" placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="右侧长度" prop="rightLength">
            <el-input v-model="formData.rightLength" placeholder=""/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="排序" prop="sort">
            <el-input v-model="formData.sort" placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="拓展字段1" prop="ext1">
            <el-input v-model="formData.ext1" placeholder=""/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="拓展字段2" prop="ext2">
            <el-input v-model="formData.ext2" placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="拓展字段3" prop="ext3">
            <el-input v-model="formData.ext3" placeholder=""/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="拓展字段4" prop="ext4">
            <el-input v-model="formData.ext4" placeholder=""/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="拓展字段5" prop="ext5">
            <el-input v-model="formData.ext5" placeholder=""/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="dialogVisible = false">取 消</el-button>
    </template>
  </Dialog>
</template>
<script lang="ts" setup>
  import * as ConfigDetApi from '@/api/model/sche/suggest/snapshotConfigDet'
import {deleteIcon} from "@/api/model/mpk/icon";
defineOptions({ name: 'ConfigDetForm' })
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
const formData = ref({
  id: undefined,
  confId: undefined,
  dataType: undefined,
  dataNo: undefined,
  leftLength: undefined,
  rightLength: undefined,
  sort: undefined,
  ext1: undefined,
  ext2: undefined,
  ext3: undefined,
  ext4: undefined,
  ext5: undefined,
})
const formRules = reactive({
  dataType: [{ required: true, message: '不能为空', trigger: 'blur' }],
  dataNo: [{ required: true, message: '不能为空', trigger: 'blur' }],
})
const formRef = ref() // 表单 Ref
  /** 打开弹窗 */
  const open = async (type: string, id?: string, confId?: string) => {
    dialogVisible.value = true
    dialogTitle.value = t('action.' + type)
    formType.value = type
    resetForm()
    formData.confId = confId
    // 修改时,设置数据
    if (id) {
      formLoading.value = true
      try {
        formData.value = await ConfigDetApi.get(id)
      } finally {
        formLoading.value = false
      }
    }
  }
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
  // 校验表单
  if (!formRef) return
  const valid = await formRef.value.validate()
  if (!valid) return
  // 提交请求
  formLoading.value = true
  try {
    const data = formData.value
    if (formType.value === 'create') {
      await ConfigDetApi.create(data)
      message.success(t('common.createSuccess'))
    } else {
      await ConfigDetApi.update(data)
      message.success(t('common.updateSuccess'))
    }
    dialogVisible.value = false
    // 发送操作成功的事件
    emit('success')
  } finally {
    formLoading.value = false
  }
}
/** 重置表单 */
const resetForm = () => {
  formData.value = {
    id: undefined,
    confId: undefined,
    dataType: undefined,
    dataNo: undefined,
    leftLength: undefined,
    rightLength: undefined,
    sort: undefined,
    ext1: undefined,
    ext2: undefined,
    ext3: undefined,
    ext4: undefined,
    ext5: undefined,
  }
  formRef.value?.resetFields()
}
</script>
src/views/model/sche/snapshotConf/det/index.vue
@@ -15,10 +15,10 @@
        :inline="true"
        label-width="68px"
      >
        <el-form-item label="参数名称" prop="paramName">
        <el-form-item label="数据编号" prop="dataNo">
          <el-input
            v-model="queryParams.paramName"
            placeholder="请输入参数名称"
            v-model="queryParams.dataNo"
            placeholder="请输入数据编号"
            clearable
            class="!w-240px"
          />
@@ -97,17 +97,17 @@
    </ContentWrap>
    <!-- 表单弹窗:添加/修改 -->
    <ChartParamForm ref="formRef" @success="getList" />
    <ConfigDetForm ref="formRef" @success="getList" />
  </el-drawer>
</template>
<script lang="ts" setup>
import {dateFormatter} from '@/utils/formatTime'
import * as ChartParamApi from '@/api/model/mpk/chartParam'
import ChartParamForm from './ChartParamForm.vue'
import * as configDetApi from '@/api/model/sche/suggest/snapshotConfigDet'
import ConfigDetForm from './configDetForm.vue'
import type {DrawerProps} from "element-plus";
defineOptions({name: 'ChartParam'})
defineOptions({name: 'ConfigDet'})
const message = useMessage() // 消息弹窗
const {t} = useI18n() // 国际化
@@ -119,13 +119,14 @@
const queryParams = reactive({
  page: 1,
  limit: 10,
  confId: '',
})
const queryFormRef = ref() // 搜索的表单
const getList = async () => {
  loading.value = true
  try {
    const data = await ChartParamApi.getPage(queryParams)
    const data = await configDetApi.getPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
@@ -147,7 +148,7 @@
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: string) => {
  formRef.value.open(type, id, queryParams.chartId)
  formRef.value.open(type, id, queryParams.confId)
}
/** 删除按钮操作 */
@@ -156,7 +157,7 @@
    // 删除的二次确认
    await message.delConfirm()
    // 发起删除
    await ChartParamApi.del(id)
    await configDetApi.del(id)
    message.success(t('common.delSuccess'))
    // 刷新列表
    await getList()
@@ -165,11 +166,11 @@
}
/** 打开弹窗 */
const open = async (chartId?: string) => {
const open = async (confId?: string) => {
  resetForm()
  drawer.value = true
  queryParams.chartId = chartId
  if (chartId) {
  queryParams.confId = confId
  if (confId) {
    getList()
  }
}
@@ -177,8 +178,7 @@
/** 重置表单 */
const resetForm = () => {
  queryParams.chartId = ''
  queryParams.name = ''
  queryParams.confId = ''
}
const handleClose = (done: () => void) => {
src/views/model/sche/snapshotConf/index.vue
@@ -37,6 +37,7 @@
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['suggest:snapshot:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
@@ -63,6 +64,7 @@
              link
              type="primary"
              @click="openForm('update', scope.row.id)"
              v-hasPermi="['suggest:snapshot:update']"
            >
              编辑
            </el-button>
@@ -73,7 +75,7 @@
            >
              参数
            </el-button>
            <el-button link type="danger" @click="handleDelete(scope.row.id)">
            <el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['suggest:snapshot:delete']">
              删除
            </el-button>
          </div>