Ver código fonte

feat: 执行任务管理

wanggaokun 10 meses atrás
pai
commit
775c0c265b
3 arquivos alterados com 358 adições e 0 exclusões
  1. 111 0
      src/api/interface/als/task.ts
  2. 54 0
      src/api/modules/als/task.ts
  3. 193 0
      src/views/als/task/index.vue

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

@@ -0,0 +1,111 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface TaskVO extends BaseEntity {
+  /**
+   * 任务名称
+   */
+  name: string
+
+  /**
+   * 数据源
+   */
+  source: string
+
+  /**
+   * 架次号
+   */
+  sortieNo: number
+
+  /**
+   * 机号
+   */
+  aircraftId: string | number
+
+  /**
+   * 数据编号
+   */
+  dataId: string | number
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface TaskForm {
+  /**
+   * 任务编号
+   */
+  id?: string | number
+
+  /**
+   * 任务名称
+   */
+  name?: string
+
+  /**
+   * 数据源
+   */
+  source?: string
+
+  /**
+   * 架次号
+   */
+  sortieNo?: number
+
+  /**
+   * 机号
+   */
+  aircraftId?: string | number
+
+  /**
+   * 数据编号
+   */
+  dataId?: string | number
+}
+
+export interface TaskQuery extends PageQuery {
+  /**
+   * 任务名称
+   */
+  name?: string
+
+  /**
+   * 数据源
+   */
+  source?: string
+
+  /**
+   * 架次号
+   */
+  sortieNo?: number
+
+  /**
+   * 机号
+   */
+  aircraftId?: string | number
+
+  /**
+   * 数据编号
+   */
+  dataId?: string | number
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

+ 54 - 0
src/api/modules/als/task.ts

@@ -0,0 +1,54 @@
+import http from '@/api'
+import { TaskVO, TaskForm, TaskQuery } from '@/api/interface/als/task'
+/**
+ * @name 查询任务管理列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listTaskApi = (query: TaskQuery) => {
+  return http.get<TaskVO[]>('/als/task/list', query, { loading: true })
+}
+
+/**
+ * @name 查询任务管理详细
+ * @param id id
+ * @returns returns
+ */
+export const getTaskApi = (id: string | number) => {
+  return http.get<TaskVO>(`/als/task/${id}`)
+}
+
+/**
+ * @name 新增任务管理
+ * @param data data
+ * @returns returns
+ */
+export const addTaskApi = (data: TaskForm) => {
+  return http.post<any>('/als/task', data, { loading: false })
+}
+
+/**
+ * @name 修改任务管理
+ * @param data data
+ * @returns returns
+ */
+export const updateTaskApi = (data: TaskForm) => {
+  return http.put<any>('/als/task', data, { loading: false })
+}
+
+/**
+ * @name 删除任务管理
+ * @param id id
+ * @returns returns
+ */
+export const delTaskApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/task/${id}`)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportTaskApi = (data: any) => {
+  return http.post('/als/task/export', data)
+}

+ 193 - 0
src/views/als/task/index.vue

@@ -0,0 +1,193 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listTaskApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:task:add']" icon="CirclePlus" @click="openDialog(1, '任务管理新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:task:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:task: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:task:query']" @click="openDialog(3, '任务管理查看', scope.row)"> 查看 </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:task:edit']" @click="openDialog(2, '任务管理编辑', scope.row)"> 编辑 </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:task:remove']" @click="deleteTask(scope.row)"> 删除 </el-button>
+      </template>
+    </ProTable>
+    <FormDialog ref="formDialogRef" :items-options="itemsOptions" :model="model" />
+    <TaskDialog ref="taskDialogRef" />
+  </div>
+</template>
+
+<script setup lang="tsx" name="Task">
+import { useHandleData } from '@/hooks/useHandleData'
+import { ElMessageBox } from 'element-plus'
+import TaskDialog from '@/components/TaskDialog/index.vue'
+import FormDialog from '@/components/FormDialog/index.vue'
+import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
+import { listTaskApi, delTaskApi, addTaskApi, updateTaskApi, exportTaskApi, getTaskApi } from '@/api/modules/als/task'
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除任务管理信息
+const deleteTask = async (params: any) => {
+  await useHandleData(delTaskApi, params.id, '删除【' + params.id + '】任务管理')
+  proTable.value?.getTableList()
+}
+
+// 批量删除任务管理信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delTaskApi, ids, '删除所选任务管理信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出任务管理列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出任务管理数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportTaskApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+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 getTaskApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addTaskApi : updateTaskApi,
+    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: 'source',
+    label: '数据源',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'sortieNo',
+    label: '架次号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'aircraftId',
+    label: '机号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'dataId',
+    label: '数据编号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    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: 'source',
+      compOptions: {
+        placeholder: '请输入数据源'
+      }
+    },
+    {
+      label: '架次号',
+      prop: 'sortieNo',
+      compOptions: {
+        placeholder: '请输入架次号'
+      }
+    },
+    {
+      label: '机号',
+      prop: 'aircraftId',
+      compOptions: {
+        placeholder: '请输入机号'
+      }
+    },
+    {
+      label: '数据编号',
+      prop: 'dataId',
+      compOptions: {
+        placeholder: '请输入数据编号'
+      }
+    }
+  ]
+}
+</script>