Răsfoiți Sursa

feat: 寿命预测/寿命预测结果

wanggaokun 11 luni în urmă
părinte
comite
d8f6764790

+ 126 - 0
src/api/interface/als/lifePrediction.ts

@@ -0,0 +1,126 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface LifePredictionVO extends BaseEntity {
+  /**
+   * 机号
+   */
+  aircraftNo: string
+
+  /**
+   * 部件名称
+   */
+  name: string
+
+  /**
+   * 型号
+   */
+  model: string
+
+  /**
+   * 所属系统
+   */
+  system: string
+
+  /**
+   * 处理方式
+   */
+  methodType: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface LifePredictionForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  system?: string
+
+  /**
+   * 处理方式
+   */
+  methodType?: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem?: string
+}
+
+export interface LifePredictionQuery extends PageQuery {
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  system?: string
+
+  /**
+   * 处理方式
+   */
+  methodType?: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

+ 141 - 0
src/api/interface/als/lifePredictionResult.ts

@@ -0,0 +1,141 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface LifePredictionResultVO extends BaseEntity {
+  /**
+   * 寿命预测编号
+   */
+  lifeId: string | number
+
+  /**
+   * 机号
+   */
+  aircraftNo: string
+
+  /**
+   * 部件名称
+   */
+  name: string
+
+  /**
+   * 型号
+   */
+  model: string
+
+  /**
+   * 所属系统
+   */
+  system: string
+
+  /**
+   * 处理方式
+   */
+  methodType: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface LifePredictionResultForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 寿命预测编号
+   */
+  lifeId?: string | number
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  system?: string
+
+  /**
+   * 处理方式
+   */
+  methodType?: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem?: string
+}
+
+export interface LifePredictionResultQuery extends PageQuery {
+  /**
+   * 寿命预测编号
+   */
+  lifeId?: string | number
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  system?: string
+
+  /**
+   * 处理方式
+   */
+  methodType?: string
+
+  /**
+   * 剩余时长(h)
+   */
+  remainTiem?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

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

@@ -0,0 +1,54 @@
+import http from '@/api'
+import { LifePredictionVO, LifePredictionForm, LifePredictionQuery } from '@/api/interface/als/lifePrediction'
+/**
+ * @name 查询寿命预测列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listLifePredictionApi = (query: LifePredictionQuery) => {
+  return http.get<LifePredictionVO[]>('/als/lifePrediction/list', query, { loading: true })
+}
+
+/**
+ * @name 查询寿命预测详细
+ * @param id id
+ * @returns returns
+ */
+export const getLifePredictionApi = (id: string | number) => {
+  return http.get<LifePredictionVO>(`/als/lifePrediction/${id}`)
+}
+
+/**
+ * @name 新增寿命预测
+ * @param data data
+ * @returns returns
+ */
+export const addLifePredictionApi = (data: LifePredictionForm) => {
+  return http.post<any>('/als/lifePrediction', data, { loading: false })
+}
+
+/**
+ * @name 修改寿命预测
+ * @param data data
+ * @returns returns
+ */
+export const updateLifePredictionApi = (data: LifePredictionForm) => {
+  return http.put<any>('/als/lifePrediction', data, { loading: false })
+}
+
+/**
+ * @name 删除寿命预测
+ * @param id id
+ * @returns returns
+ */
+export const delLifePredictionApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/lifePrediction/${id}`)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportLifePredictionApi = (data: any) => {
+  return http.post('/als/lifePrediction/export', data)
+}

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

@@ -0,0 +1,54 @@
+import http from '@/api'
+import { LifePredictionResultVO, LifePredictionResultForm, LifePredictionResultQuery } from '@/api/interface/als/lifePredictionResult'
+/**
+ * @name 查询寿命预测结果列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listLifePredictionResultApi = (query: LifePredictionResultQuery) => {
+  return http.get<LifePredictionResultVO[]>('/als/lifePredictionResult/list', query, { loading: true })
+}
+
+/**
+ * @name 查询寿命预测结果详细
+ * @param id id
+ * @returns returns
+ */
+export const getLifePredictionResultApi = (id: string | number) => {
+  return http.get<LifePredictionResultVO>(`/als/lifePredictionResult/${id}`)
+}
+
+/**
+ * @name 新增寿命预测结果
+ * @param data data
+ * @returns returns
+ */
+export const addLifePredictionResultApi = (data: LifePredictionResultForm) => {
+  return http.post<any>('/als/lifePredictionResult', data, { loading: false })
+}
+
+/**
+ * @name 修改寿命预测结果
+ * @param data data
+ * @returns returns
+ */
+export const updateLifePredictionResultApi = (data: LifePredictionResultForm) => {
+  return http.put<any>('/als/lifePredictionResult', data, { loading: false })
+}
+
+/**
+ * @name 删除寿命预测结果
+ * @param id id
+ * @returns returns
+ */
+export const delLifePredictionResultApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/lifePredictionResult/${id}`)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportLifePredictionResultApi = (data: any) => {
+  return http.post('/als/lifePredictionResult/export', data)
+}

+ 228 - 0
src/views/als/lifePrediction/index.vue

@@ -0,0 +1,228 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listLifePredictionApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:lifePrediction:add']" icon="CirclePlus" @click="openDialog(1, '寿命预测新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:lifePrediction:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:lifePrediction: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:lifePrediction:query']" @click="openDialog(3, '寿命预测查看', scope.row)">
+          查看
+        </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:lifePrediction:edit']" @click="openDialog(2, '寿命预测编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:lifePrediction:remove']" @click="deleteLifePrediction(scope.row)">
+          删除
+        </el-button>
+      </template>
+    </ProTable>
+    <FormDialog ref="formDialogRef" :items-options="itemsOptions" :model="model" />
+    <TaskDialog ref="taskDialogRef" />
+  </div>
+</template>
+
+<script setup lang="tsx" name="LifePrediction">
+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 {
+  listLifePredictionApi,
+  delLifePredictionApi,
+  addLifePredictionApi,
+  updateLifePredictionApi,
+  exportLifePredictionApi,
+  getLifePredictionApi
+} from '@/api/modules/als/lifePrediction'
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
+const { common_type } = toRefs<any>(proxy?.useDict('common_type'))
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除寿命预测信息
+const deleteLifePrediction = async (params: any) => {
+  await useHandleData(delLifePredictionApi, params.id, '删除【' + params.id + '】寿命预测')
+  proTable.value?.getTableList()
+}
+
+// 批量删除寿命预测信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delLifePredictionApi, ids, '删除所选寿命预测信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出寿命预测列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出寿命预测数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportLifePredictionApi(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 getLifePredictionApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addLifePredictionApi : updateLifePredictionApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+  { prop: 'id', label: '编号' },
+  {
+    prop: 'aircraftNo',
+    label: '机号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'name',
+    label: '部件名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'model',
+    label: '型号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'system',
+    label: '所属系统',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'methodType',
+    label: '处理方式',
+    tag: true,
+    enum: common_type,
+    search: {
+      el: 'tree-select'
+    }
+  },
+  {
+    prop: 'remainTiem',
+    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: 'aircraftNo',
+      rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入机号'
+      }
+    },
+    {
+      label: '部件名称',
+      prop: 'name',
+      rules: [{ required: true, message: '部件名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入部件名称'
+      }
+    },
+    {
+      label: '型号',
+      prop: 'model',
+      rules: [{ required: true, message: '型号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入型号'
+      }
+    },
+    {
+      label: '所属系统',
+      prop: 'system',
+      compOptions: {
+        placeholder: '请输入所属系统'
+      }
+    },
+    {
+      label: '处理方式',
+      prop: 'methodType',
+      compOptions: {
+        elTagName: 'select',
+        enum: common_type.value,
+        placeholder: '请选择处理方式'
+      }
+    },
+    {
+      label: '剩余时长',
+      prop: 'remainTiem',
+      compOptions: {
+        placeholder: '请输入剩余时长'
+      }
+    }
+  ]
+}
+</script>

+ 251 - 0
src/views/als/lifePredictionResult/index.vue

@@ -0,0 +1,251 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listLifePredictionResultApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:lifePredictionResult:add']" icon="CirclePlus" @click="openDialog(1, '寿命预测结果新增')">
+          新增
+        </el-button>
+        <el-button type="primary" v-auth="['als:lifePredictionResult:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:lifePredictionResult: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:lifePredictionResult:query']" @click="openDialog(3, '寿命预测结果查看', scope.row)">
+          查看
+        </el-button>
+        <el-button
+          type="primary"
+          link
+          icon="EditPen"
+          v-auth="['als:lifePredictionResult:edit']"
+          @click="openDialog(2, '寿命预测结果编辑', scope.row)"
+        >
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:lifePredictionResult:remove']" @click="deleteLifePredictionResult(scope.row)">
+          删除
+        </el-button>
+      </template>
+    </ProTable>
+    <FormDialog ref="formDialogRef" :items-options="itemsOptions" :model="model" />
+    <TaskDialog ref="taskDialogRef" />
+  </div>
+</template>
+
+<script setup lang="tsx" name="LifePredictionResult">
+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 {
+  listLifePredictionResultApi,
+  delLifePredictionResultApi,
+  addLifePredictionResultApi,
+  updateLifePredictionResultApi,
+  exportLifePredictionResultApi,
+  getLifePredictionResultApi
+} from '@/api/modules/als/lifePredictionResult'
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
+const { common_type } = toRefs<any>(proxy?.useDict('common_type'))
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除寿命预测结果信息
+const deleteLifePredictionResult = async (params: any) => {
+  await useHandleData(delLifePredictionResultApi, params.id, '删除【' + params.id + '】寿命预测结果')
+  proTable.value?.getTableList()
+}
+
+// 批量删除寿命预测结果信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delLifePredictionResultApi, ids, '删除所选寿命预测结果信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出寿命预测结果列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出寿命预测结果数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportLifePredictionResultApi(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 getLifePredictionResultApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addLifePredictionResultApi : updateLifePredictionResultApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+  { prop: 'id', label: '编号' },
+  {
+    prop: 'lifeId',
+    label: '寿命预测编号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'aircraftNo',
+    label: '机号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'name',
+    label: '部件名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'model',
+    label: '型号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'system',
+    label: '所属系统',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'methodType',
+    label: '处理方式',
+    tag: true,
+    enum: common_type,
+    search: {
+      el: 'tree-select'
+    }
+  },
+  {
+    prop: 'remainTiem',
+    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: 'lifeId',
+      rules: [{ required: true, message: '寿命预测编号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入寿命预测编号'
+      }
+    },
+    {
+      label: '机号',
+      prop: 'aircraftNo',
+      rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入机号'
+      }
+    },
+    {
+      label: '部件名称',
+      prop: 'name',
+      rules: [{ required: true, message: '部件名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入部件名称'
+      }
+    },
+    {
+      label: '型号',
+      prop: 'model',
+      compOptions: {
+        placeholder: '请输入型号'
+      }
+    },
+    {
+      label: '所属系统',
+      prop: 'system',
+      compOptions: {
+        placeholder: '请输入所属系统'
+      }
+    },
+    {
+      label: '处理方式',
+      prop: 'methodType',
+      compOptions: {
+        elTagName: 'select',
+        enum: common_type.value,
+        placeholder: '请选择处理方式'
+      }
+    },
+    {
+      label: '剩余时长',
+      prop: 'remainTiem',
+      compOptions: {
+        placeholder: '请输入剩余时长'
+      }
+    }
+  ]
+}
+</script>