mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 04:08:44 +08:00 
			
		
		
		
	重构:微调【数据源菜单】的重构
This commit is contained in:
		@@ -31,8 +31,6 @@
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
import * as DataSourceConfigApi from '@/api/infra/dataSourceConfig'
 | 
			
		||||
import { DataSourceConfigVO } from '@/api/infra/dataSourceConfig'
 | 
			
		||||
import { isNullOrUnDef } from '@/utils/is'
 | 
			
		||||
import { omit } from 'lodash-es'
 | 
			
		||||
 | 
			
		||||
const { t } = useI18n() // 国际化
 | 
			
		||||
const message = useMessage() // 消息弹窗
 | 
			
		||||
@@ -63,7 +61,7 @@ const openModal = async (type: string, id?: number) => {
 | 
			
		||||
  formType.value = type
 | 
			
		||||
  resetForm()
 | 
			
		||||
  // 修改时,设置数据
 | 
			
		||||
  if (!isNullOrUnDef(id)) {
 | 
			
		||||
  if (id) {
 | 
			
		||||
    formLoading.value = true
 | 
			
		||||
    try {
 | 
			
		||||
      formData.value = await DataSourceConfigApi.getDataSourceConfig(id)
 | 
			
		||||
@@ -84,7 +82,7 @@ const submitForm = async () => {
 | 
			
		||||
  // 提交请求
 | 
			
		||||
  formLoading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    const data = omit(unref(formData), 'createTime')
 | 
			
		||||
    const data = formData.value as DataSourceConfigApi.DataSourceConfigVO
 | 
			
		||||
    if (formType.value === 'create') {
 | 
			
		||||
      await DataSourceConfigApi.createDataSourceConfig(data)
 | 
			
		||||
      message.success(t('common.createSuccess'))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <el-form :inline="true" label-width="68px">
 | 
			
		||||
    <el-form class="-mb-15px" :inline="true">
 | 
			
		||||
      <el-form-item>
 | 
			
		||||
        <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
@@ -12,8 +12,10 @@
 | 
			
		||||
        </el-button>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
  </content-wrap>
 | 
			
		||||
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
  <!-- 列表 -->
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <el-table v-loading="loading" :data="list" align="center">
 | 
			
		||||
      <el-table-column label="主键编号" align="center" prop="id" />
 | 
			
		||||
      <el-table-column label="数据源名称" align="center" prop="name" />
 | 
			
		||||
@@ -33,6 +35,7 @@
 | 
			
		||||
            type="primary"
 | 
			
		||||
            @click="openModal('update', scope.row.id)"
 | 
			
		||||
            v-hasPermi="['infra:data-source-config:update']"
 | 
			
		||||
            :disabled="scope.row.id === 0"
 | 
			
		||||
          >
 | 
			
		||||
            编辑
 | 
			
		||||
          </el-button>
 | 
			
		||||
@@ -41,6 +44,7 @@
 | 
			
		||||
            type="danger"
 | 
			
		||||
            @click="handleDelete(scope.row.id)"
 | 
			
		||||
            v-hasPermi="['infra:data-source-config:delete']"
 | 
			
		||||
            :disabled="scope.row.id === 0"
 | 
			
		||||
          >
 | 
			
		||||
            删除
 | 
			
		||||
          </el-button>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user