wanggaokun 11 сар өмнө
parent
commit
d9c8f1b969

+ 91 - 0
src/api/interface/als/preProcessing.ts

@@ -0,0 +1,91 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface PreProcessingVO extends BaseEntity {
+  /**
+   * 架次号
+   */
+  sortieNo: string
+
+  /**
+   * 机号
+   */
+  aircraftNo: string
+
+  /**
+   * 文件Id
+   */
+  ossId: string | number
+
+  /**
+   * 状态
+   */
+  status: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface PreProcessingForm {
+  /**
+   * 架次号
+   */
+  sortieNo?: string
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 文件Id
+   */
+  ossId?: string | number
+
+  /**
+   * 状态
+   */
+  status?: string
+}
+
+export interface PreProcessingQuery extends PageQuery {
+  /**
+   * 架次号
+   */
+  sortieNo?: string
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 文件Id
+   */
+  ossId?: string | number
+
+  /**
+   * 状态
+   */
+  status?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

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

@@ -0,0 +1,70 @@
+import http from '@/api'
+import { PreProcessingVO, PreProcessingForm, PreProcessingQuery } from '@/api/interface/als/preProcessing'
+/**
+ * @name 查询预处理列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listPreProcessingApi = (query: PreProcessingQuery) => {
+  return http.get<PreProcessingVO[]>('/als/preProcessing/list', query, { loading: true })
+}
+
+/**
+ * @name 查询预处理详细
+ * @param id id
+ * @returns returns
+ */
+export const getPreProcessingApi = (id: string | number) => {
+  return http.get<PreProcessingVO>(`/als/preProcessing/${id}`)
+}
+
+/**
+ * @name 新增预处理
+ * @param data data
+ * @returns returns
+ */
+export const addPreProcessingApi = (data: PreProcessingForm) => {
+  return http.post<any>('/als/preProcessing', data, { loading: false })
+}
+
+/**
+ * @name 修改预处理
+ * @param data data
+ * @returns returns
+ */
+export const updatePreProcessingApi = (data: PreProcessingForm) => {
+  return http.put<any>('/als/preProcessing', data, { loading: false })
+}
+
+/**
+ * @name 删除预处理
+ * @param id id
+ * @returns returns
+ */
+export const delPreProcessingApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/preProcessing/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/als/preProcessing/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importPreProcessingDataApi = (data: any) => {
+  return http.post('/als/preProcessing/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportPreProcessingApi = (data: any) => {
+  return http.post('/als/preProcessing/export', data)
+}

+ 9 - 0
src/views/als/dataImport/index.vue

@@ -180,6 +180,15 @@ const setItemsOptions = () => {
       compOptions: {
         placeholder: '请输入机号'
       }
+    },
+    {
+      label: '数据导入',
+      prop: 'ossId',
+      rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'file-upload-s3',
+        placeholder: '请输入机号'
+      }
     }
   ]
 }

+ 205 - 0
src/views/als/preProcessing/index.vue

@@ -0,0 +1,205 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listPreProcessingApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:preProcessing:add']" icon="CirclePlus" @click="openDialog(1, '预处理新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:preProcessing:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['als:preProcessing:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:preProcessing: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:preProcessing:query']" @click="openDialog(3, '预处理查看', scope.row)">
+          查看
+        </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:preProcessing:edit']" @click="openDialog(2, '预处理编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:preProcessing:remove']" @click="deletePreProcessing(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="PreProcessing">
+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 {
+  listPreProcessingApi,
+  delPreProcessingApi,
+  addPreProcessingApi,
+  updatePreProcessingApi,
+  importTemplateApi,
+  importPreProcessingDataApi,
+  exportPreProcessingApi,
+  getPreProcessingApi
+} from '@/api/modules/als/preProcessing'
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
+const { sys_common_status } = toRefs<any>(proxy?.useDict('sys_common_status'))
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除预处理信息
+const deletePreProcessing = async (params: any) => {
+  await useHandleData(delPreProcessingApi, params.id, '删除【' + params.id + '】预处理')
+  proTable.value?.getTableList()
+}
+
+// 批量删除预处理信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delPreProcessingApi, ids, '删除所选预处理信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出预处理列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出预处理数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportPreProcessingApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+// 批量添加预处理
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '预处理',
+    tempApi: importTemplateApi,
+    importApi: importPreProcessingDataApi,
+    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 getPreProcessingApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addPreProcessingApi : updatePreProcessingApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+  { prop: 'id', label: '编号' },
+  {
+    prop: 'sortieNo',
+    label: '架次号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'aircraftNo',
+    label: '机号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'ossId',
+    label: '文件Id',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'status',
+    label: '状态',
+    tag: true,
+    enum: sys_common_status,
+    search: {
+      el: 'tree-select'
+    }
+  },
+  {
+    prop: 'createByName',
+    label: '创建人',
+    width: 120
+  },
+  {
+    prop: 'createTime',
+    label: '创建时间',
+    width: 120
+  },
+  {
+    prop: 'updateByName',
+    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: 'sortieNo',
+      rules: [{ required: true, message: '架次号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入架次号'
+      }
+    },
+    {
+      label: '机号',
+      prop: 'aircraftNo',
+      rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入机号'
+      }
+    },
+    {
+      label: '文件',
+      prop: 'ossId',
+      rules: [{ required: true, message: '文件Id不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'file-upload-s3',
+        placeholder: '请输入文件Id'
+      }
+    }
+  ]
+}
+</script>