Browse Source

feat: 警告信息

wanggaokun 11 tháng trước cách đây
mục cha
commit
2196628f05

+ 121 - 0
src/api/interface/als/warning.ts

@@ -0,0 +1,121 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface WarningVO extends BaseEntity {
+  /**
+   * 架次号
+   */
+  sortieNo: number
+
+  /**
+   * 机号
+   */
+  aircraftNo: number
+
+  /**
+   * 警告代码
+   */
+  code: string
+
+  /**
+   * 警告名称
+   */
+  name: string
+
+  /**
+   * 警告描述
+   */
+  describe: string
+
+  /**
+   * 状态
+   */
+  status: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface WarningForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 架次号
+   */
+  sortieNo?: number
+
+  /**
+   * 机号
+   */
+  aircraftNo?: number
+
+  /**
+   * 警告代码
+   */
+  code?: string
+
+  /**
+   * 警告名称
+   */
+  name?: string
+
+  /**
+   * 警告描述
+   */
+  describe?: string
+
+  /**
+   * 状态
+   */
+  status?: string
+}
+
+export interface WarningQuery extends PageQuery {
+  /**
+   * 架次号
+   */
+  sortieNo?: number
+
+  /**
+   * 机号
+   */
+  aircraftNo?: number
+
+  /**
+   * 警告代码
+   */
+  code?: string
+
+  /**
+   * 警告名称
+   */
+  name?: string
+
+  /**
+   * 警告描述
+   */
+  describe?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

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

@@ -0,0 +1,70 @@
+import http from '@/api'
+import { WarningVO, WarningForm, WarningQuery } from '@/api/interface/als/warning'
+/**
+ * @name 查询警告信息列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listWarningApi = (query: WarningQuery) => {
+  return http.get<WarningVO[]>('/als/warning/list', query, { loading: false })
+}
+
+/**
+ * @name 查询警告信息详细
+ * @param id id
+ * @returns returns
+ */
+export const getWarningApi = (id: string | number) => {
+  return http.get<WarningVO>(`/als/warning/${id}`)
+}
+
+/**
+ * @name 新增警告信息
+ * @param data data
+ * @returns returns
+ */
+export const addWarningApi = (data: WarningForm) => {
+  return http.post<any>('/als/warning', data, { loading: false })
+}
+
+/**
+ * @name 修改警告信息
+ * @param data data
+ * @returns returns
+ */
+export const updateWarningApi = (data: WarningForm) => {
+  return http.put<any>('/als/warning', data, { loading: false })
+}
+
+/**
+ * @name 删除警告信息
+ * @param id id
+ * @returns returns
+ */
+export const delWarningApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/warning/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/als/warning/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importWarningDataApi = (data: any) => {
+  return http.post('/als/warning/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportWarningApi = (data: any) => {
+  return http.post('/als/warning/export', data)
+}

+ 3 - 9
src/views/als/preProcessing/index.vue

@@ -121,24 +121,18 @@ const columns = reactive<ColumnProps<any>[]>([
     label: '架次号',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'aircraftNo',
     label: '机号',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'ossId',
-    label: '文件Id',
-    search: {
-      el: 'input'
-    },
-    width: 120
+    label: '文件编号'
   },
   {
     prop: 'status',

+ 239 - 0
src/views/als/warning/index.vue

@@ -0,0 +1,239 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listWarningApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:warning:add']" icon="CirclePlus" @click="openDialog(1, '警告信息新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:warning:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['als:warning:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:warning: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:warning:query']" @click="openDialog(3, '警告信息查看', scope.row)"> 查看 </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:warning:edit']" @click="openDialog(2, '警告信息编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:warning:remove']" @click="deleteWarning(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="Warning">
+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 {
+  listWarningApi,
+  delWarningApi,
+  addWarningApi,
+  updateWarningApi,
+  importTemplateApi,
+  importWarningDataApi,
+  exportWarningApi,
+  getWarningApi
+} from '@/api/modules/als/warning'
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
+const { common_type } = toRefs<any>(proxy?.useDict('common_type'))
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除警告信息信息
+const deleteWarning = async (params: any) => {
+  await useHandleData(delWarningApi, params.id, '删除【' + params.id + '】警告信息')
+  proTable.value?.getTableList()
+}
+
+// 批量删除警告信息信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delWarningApi, ids, '删除所选警告信息信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出警告信息列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出警告信息数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportWarningApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+// 批量添加警告信息
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '警告信息',
+    tempApi: importTemplateApi,
+    importApi: importWarningDataApi,
+    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 getWarningApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addWarningApi : updateWarningApi,
+    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: 'code',
+    label: '警告代码',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'name',
+    label: '警告名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'describe',
+    label: '警告描述',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'status',
+    label: '状态',
+    tag: true,
+    enum: common_type
+  },
+  {
+    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: 'sortieNo',
+      rules: [{ required: true, message: '架次号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入架次号'
+      }
+    },
+    {
+      label: '机号',
+      prop: 'aircraftNo',
+      rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入机号'
+      }
+    },
+    {
+      label: '警告代码',
+      prop: 'code',
+      rules: [{ required: true, message: '警告代码不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入警告代码'
+      }
+    },
+    {
+      label: '警告名称',
+      prop: 'name',
+      rules: [{ required: true, message: '警告名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入警告名称'
+      }
+    },
+    {
+      label: '警告描述',
+      prop: 'describe',
+      compOptions: {
+        placeholder: '请输入警告描述'
+      }
+    },
+    {
+      label: '状态',
+      prop: 'status',
+      compOptions: {
+        elTagName: 'select',
+        enum: common_type.value,
+        placeholder: '请选择状态'
+      }
+    }
+  ]
+}
+</script>