ソースを参照

fix: 关闭加载

wanggaokun 11 ヶ月 前
コミット
a6f52673d8

+ 111 - 0
src/api/interface/als/model.ts

@@ -0,0 +1,111 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface ModelVO extends BaseEntity {
+  /**
+   * 模型名称
+   */
+  name: string
+
+  /**
+   * 模型类型
+   */
+  type: string
+
+  /**
+   * 模型链接
+   */
+  url: string
+
+  /**
+   * 参数
+   */
+  param: string
+
+  /**
+   * 数据列
+   */
+  columnData: string
+
+  /**
+   * 状态
+   */
+  status: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface ModelForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 模型名称
+   */
+  name?: string
+
+  /**
+   * 模型类型
+   */
+  type?: string
+
+  /**
+   * 模型链接
+   */
+  url?: string
+
+  /**
+   * 参数
+   */
+  param?: string
+
+  /**
+   * 数据列
+   */
+  columnData?: string
+
+  /**
+   * 状态
+   */
+  status?: string
+
+  /**
+   * 备注
+   */
+  remark?: string
+}
+
+export interface ModelQuery extends PageQuery {
+  /**
+   * 模型名称
+   */
+  name?: string
+
+  /**
+   * 模型类型
+   */
+  type?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

+ 1 - 1
src/api/modules/als/aircraft.ts

@@ -6,7 +6,7 @@ import { AircraftVO, AircraftForm, AircraftQuery } from '@/api/interface/als/air
  * @returns 返回列表
  */
 export const listAircraftApi = (query: AircraftQuery) => {
-  return http.get<AircraftVO[]>('/als/aircraft/list', query, { loading: true })
+  return http.get<AircraftVO[]>('/als/aircraft/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/als/faultCase.ts

@@ -6,7 +6,7 @@ import { FaultCaseVO, FaultCaseForm, FaultCaseQuery } from '@/api/interface/als/
  * @returns 返回列表
  */
 export const listFaultCaseApi = (query: FaultCaseQuery) => {
-  return http.get<FaultCaseVO[]>('/als/faultCase/list', query, { loading: true })
+  return http.get<FaultCaseVO[]>('/als/faultCase/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/als/maintenanceRecord.ts

@@ -6,7 +6,7 @@ import { MaintenanceRecordVO, MaintenanceRecordForm, MaintenanceRecordQuery } fr
  * @returns 返回列表
  */
 export const listMaintenanceRecordApi = (query: MaintenanceRecordQuery) => {
-  return http.get<MaintenanceRecordVO[]>('/als/maintenanceRecord/list', query, { loading: true })
+  return http.get<MaintenanceRecordVO[]>('/als/maintenanceRecord/list', query, { loading: false })
 }
 
 /**

+ 70 - 0
src/api/modules/als/model.ts

@@ -0,0 +1,70 @@
+import http from '@/api'
+import { ModelVO, ModelForm, ModelQuery } from '@/api/interface/als/model'
+/**
+ * @name 查询模型信息列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listModelApi = (query: ModelQuery) => {
+  return http.get<ModelVO[]>('/als/model/list', query, { loading: false })
+}
+
+/**
+ * @name 查询模型信息详细
+ * @param id id
+ * @returns returns
+ */
+export const getModelApi = (id: string | number) => {
+  return http.get<ModelVO>(`/als/model/${id}`)
+}
+
+/**
+ * @name 新增模型信息
+ * @param data data
+ * @returns returns
+ */
+export const addModelApi = (data: ModelForm) => {
+  return http.post<any>('/als/model', data, { loading: false })
+}
+
+/**
+ * @name 修改模型信息
+ * @param data data
+ * @returns returns
+ */
+export const updateModelApi = (data: ModelForm) => {
+  return http.put<any>('/als/model', data, { loading: false })
+}
+
+/**
+ * @name 删除模型信息
+ * @param id id
+ * @returns returns
+ */
+export const delModelApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/model/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/als/model/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importModelDataApi = (data: any) => {
+  return http.post('/als/model/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportModelApi = (data: any) => {
+  return http.post('/als/model/export', data)
+}

+ 1 - 1
src/api/modules/als/product.ts

@@ -6,7 +6,7 @@ import { ProductVO, ProductForm, ProductQuery } from '@/api/interface/als/produc
  * @returns 返回列表
  */
 export const listProductApi = (query: ProductQuery) => {
-  return http.get<ProductVO[]>('/als/product/list', query, { loading: true })
+  return http.get<ProductVO[]>('/als/product/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/als/sortie.ts

@@ -6,7 +6,7 @@ import { SortieVO, SortieForm, SortieQuery } from '@/api/interface/als/sortie'
  * @returns 返回列表
  */
 export const listSortieApi = (query: SortieQuery) => {
-  return http.get<SortieVO[]>('/als/sortie/list', query, { loading: true })
+  return http.get<SortieVO[]>('/als/sortie/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/als/technicalDoc.ts

@@ -6,7 +6,7 @@ import { TechnicalDocVO, TechnicalDocForm, TechnicalDocQuery } from '@/api/inter
  * @returns 返回列表
  */
 export const listTechnicalDocApi = (query: TechnicalDocQuery) => {
-  return http.get<TechnicalDocVO[]>('/als/technicalDoc/list', query, { loading: true })
+  return http.get<TechnicalDocVO[]>('/als/technicalDoc/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/monitor/logininfor.ts

@@ -6,7 +6,7 @@ import { LogininforVO, LogininforQuery } from '@/api/interface/monitor/logininfo
  * @returns 返回列表
  */
 export const listLogininforApi = (query: LogininforQuery) => {
-  return http.get<LogininforVO[]>('/monitor/logininfor/list', query, { loading: true })
+  return http.get<LogininforVO[]>('/monitor/logininfor/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/monitor/operlog.ts

@@ -6,7 +6,7 @@ import { OperLogVO, OperLogQuery } from '@/api/interface/monitor/operlog'
  * @returns 返回列表
  */
 export const listOperLogApi = (query: OperLogQuery) => {
-  return http.get<OperLogVO[]>('/monitor/operlog/list', query, { loading: true })
+  return http.get<OperLogVO[]>('/monitor/operlog/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/config.ts

@@ -14,7 +14,7 @@ export const getConfigKeyApi = (configKey: string) => {
  * @returns 返回列表
  */
 export const listConfigApi = (query: any) => {
-  return http.get<any>('/system/config/list', query, { loading: true })
+  return http.get<any>('/system/config/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/dept.ts

@@ -6,7 +6,7 @@ import { DeptForm, DeptQuery, DeptVO } from '@/api/interface/system/dept'
  * @returns 返回列表
  */
 export const listDeptApi = (query: DeptQuery) => {
-  return http.get<any>('/system/dept/list', query, { loading: true })
+  return http.get<any>('/system/dept/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/dictData.ts

@@ -6,7 +6,7 @@ import { DictDataForm, DictDataQuery, DictDataVO } from '@/api/interface/system/
  * @returns 返回列表
  */
 export const listDataApi = (query: DictDataQuery) => {
-  return http.get<DictDataVO[]>('/system/dict/data/list', query, { loading: true })
+  return http.get<DictDataVO[]>('/system/dict/data/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/importExport.ts

@@ -6,7 +6,7 @@ import { ImportExportVO, ImportExportQuery } from '@/api/interface/system/import
  * @returns 返回列表
  */
 export const listImportExportApi = (query: ImportExportQuery) => {
-  return http.get<ImportExportVO[]>('/system/importExport/list', query, { loading: true })
+  return http.get<ImportExportVO[]>('/system/importExport/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/menu.ts

@@ -12,7 +12,7 @@ export const getRoutersApi = () => {
  * @returns 返回列表
  */
 export const listMenuApi = (query?: MenuQuery) => {
-  return http.get<MenuVO[]>('/system/menu/list', query, { loading: true })
+  return http.get<MenuVO[]>('/system/menu/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/oss.ts

@@ -6,7 +6,7 @@ import { OssQuery, OssVO } from '@/api/interface/system/oss'
  * @returns 返回列表
  */
 export const listOssApi = (query: OssQuery) => {
-  return http.get<OssVO[]>('/resource/oss/list', query, { loading: true })
+  return http.get<OssVO[]>('/resource/oss/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/ossConfig.ts

@@ -6,7 +6,7 @@ import { OssConfigForm, OssConfigQuery, OssConfigVO } from '@/api/interface/syst
  * @returns 返回列表
  */
 export const listOssConfigApi = (query: OssConfigQuery) => {
-  return http.get<OssConfigVO[]>('/resource/oss/config/list', query, { loading: true })
+  return http.get<OssConfigVO[]>('/resource/oss/config/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/post.ts

@@ -7,7 +7,7 @@ import { PostForm, PostQuery, PostVO } from '@/api/interface/system/post'
  * @returns 返回列表
  */
 export const listPostApi = (query: PostQuery) => {
-  return http.get<PostVO[]>('/system/post/list', query, { loading: true })
+  return http.get<PostVO[]>('/system/post/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/role.ts

@@ -8,7 +8,7 @@ import { RoleMenuTree } from '@/api/interface/system/menu'
  * @returns 返回列表
  */
 export const listRoleApi = (query: RoleQuery) => {
-  return http.get<RoleVO[]>('/system/role/list', query, { loading: true })
+  return http.get<RoleVO[]>('/system/role/list', query, { loading: false })
 }
 
 /**

+ 1 - 1
src/api/modules/system/user.ts

@@ -8,7 +8,7 @@ import { DeptVO } from '@/api/interface/system/dept'
  * @returns 返回列表
  */
 export const listUserApi = (query: UserQuery) => {
-  return http.get<UserVO[]>('/system/user/list', query, { loading: true })
+  return http.get<UserVO[]>('/system/user/list', query, { loading: false })
 }
 
 /**

+ 2 - 2
src/api/modules/tool/gen.ts

@@ -6,7 +6,7 @@ import { DbTableQuery, DbTableVO, TableQuery, TableVO, GenTableVO, DbTableForm }
  * @returns 返回列表
  */
 export const listTableApi = (query: TableQuery) => {
-  return http.get<TableVO[]>('/tool/gen/list', query, { loading: true })
+  return http.get<TableVO[]>('/tool/gen/list', query, { loading: false })
 }
 
 /**
@@ -15,7 +15,7 @@ export const listTableApi = (query: TableQuery) => {
  * @returns 返回列表
  */
 export const listDbTableApi = (query: DbTableQuery) => {
-  return http.get<DbTableVO[]>('/tool/gen/db/list', query, { loading: true })
+  return http.get<DbTableVO[]>('/tool/gen/db/list', query, { loading: false })
 }
 
 /**

+ 241 - 0
src/views/als/model/index.vue

@@ -0,0 +1,241 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listModelApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:model:add']" icon="CirclePlus" @click="openDialog(1, '模型信息新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:model:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['als:model:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:model:remove']"
+          icon="Delete"
+          plain
+          :disabled="!scope.isSelected"
+          @click="batchDelete(scope.selectedListIds)"
+        >
+          批量删除
+        </el-button>
+      </template>
+      <!-- 表格操作 -->
+      <template #operation="scope">
+        <el-button type="primary" link icon="View" v-auth="['als:model:query']" @click="openDialog(3, '模型信息查看', scope.row)"> 查看 </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:model:edit']" @click="openDialog(2, '模型信息编辑', scope.row)"> 编辑 </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:model:remove']" @click="deleteModel(scope.row)"> 删除 </el-button>
+      </template>
+    </ProTable>
+    <FormDialog ref="formDialogRef" :items-options="itemsOptions" :model="model" />
+    <ImportExcel ref="dialogRef" />
+    <TaskDialog ref="taskDialogRef" />
+  </div>
+</template>
+
+<script setup lang="tsx" name="Model">
+import { useHandleData } from '@/hooks/useHandleData'
+import { ElMessageBox } from 'element-plus'
+import ImportExcel from '@/components/ImportExcel/index.vue'
+import TaskDialog from '@/components/TaskDialog/index.vue'
+import FormDialog from '@/components/FormDialog/index.vue'
+import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
+import {
+  listModelApi,
+  delModelApi,
+  addModelApi,
+  updateModelApi,
+  importTemplateApi,
+  importModelDataApi,
+  exportModelApi,
+  getModelApi
+} from '@/api/modules/als/model'
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
+const { sys_common_status, sys_app_type } = toRefs<any>(proxy?.useDict('sys_common_status', 'sys_app_type'))
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除模型信息信息
+const deleteModel = async (params: any) => {
+  await useHandleData(delModelApi, params.id, '删除【' + params.id + '】模型信息')
+  proTable.value?.getTableList()
+}
+
+// 批量删除模型信息信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delModelApi, ids, '删除所选模型信息信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出模型信息列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出模型信息数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportModelApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+// 批量添加模型信息
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '模型信息',
+    tempApi: importTemplateApi,
+    importApi: importModelDataApi,
+    getTableList: proTable.value?.getTableList
+  }
+  dialogRef.value?.acceptParams(params)
+}
+
+const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
+// 打开弹框的功能
+const openDialog = async (type: number, title: string, row?: any) => {
+  let res = { data: {} }
+  if (row?.id) {
+    res = await getModelApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addModelApi : updateModelApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+  { prop: 'id', label: '编号' },
+  {
+    prop: 'name',
+    label: '模型名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'type',
+    label: '模型类型',
+    tag: true,
+    enum: sys_app_type,
+    search: {
+      el: 'tree-select'
+    }
+  },
+  {
+    prop: 'url',
+    label: '模型链接',
+    width: 120
+  },
+  {
+    prop: 'param',
+    label: '参数',
+    width: 120
+  },
+  {
+    prop: 'columnData',
+    label: '数据列',
+    width: 120
+  },
+  {
+    prop: 'status',
+    label: '状态',
+    tag: true,
+    enum: sys_common_status
+  },
+  {
+    prop: 'createBy',
+    label: '创建人',
+    width: 120
+  },
+  {
+    prop: 'createTime',
+    label: '创建时间',
+    width: 120
+  },
+  {
+    prop: 'updateBy',
+    label: '更新人',
+    width: 120
+  },
+  {
+    prop: 'updateTime',
+    label: '更新时间',
+    width: 120
+  },
+  { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
+])
+// 表单配置项
+let itemsOptions = reactive<ProForm.ItemsOptions[]>([])
+const setItemsOptions = () => {
+  itemsOptions = [
+    {
+      label: '模型名称',
+      prop: 'name',
+      rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入模型名称'
+      }
+    },
+    {
+      label: '模型类型',
+      prop: 'type',
+      rules: [{ required: true, message: '模型类型不能为空', trigger: 'change' }],
+      compOptions: {
+        elTagName: 'select',
+        enum: sys_app_type.value,
+        placeholder: '请选择模型类型'
+      }
+    },
+    {
+      label: '模型链接',
+      prop: 'url',
+      rules: [{ required: true, message: '模型链接不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入模型链接'
+      }
+    },
+    {
+      label: '参数',
+      prop: 'param',
+      rules: [{ required: true, message: '参数不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入参数'
+      }
+    },
+    {
+      label: '数据列',
+      prop: 'columnData',
+      rules: [{ required: true, message: '数据列不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入数据列'
+      }
+    },
+    {
+      label: '状态',
+      prop: 'status',
+      rules: [{ required: true, message: '状态不能为空', trigger: 'change' }],
+      compOptions: {
+        elTagName: 'select',
+        enum: sys_common_status.value,
+        placeholder: '请选择状态'
+      }
+    },
+    {
+      label: '备注',
+      prop: 'remark',
+      rules: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入备注'
+      }
+    }
+  ]
+}
+</script>