Browse Source

feat: 备品备件/携行任务定制

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

+ 136 - 0
src/api/interface/als/carryChecklist.ts

@@ -0,0 +1,136 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface CarryChecklistVO extends BaseEntity {
+  /**
+   * 机型
+   */
+  aircraftModel: string
+
+  /**
+   * 机号
+   */
+  aircraftNo: string
+
+  /**
+   * 成品名称
+   */
+  name: string
+
+  /**
+   * 型号
+   */
+  model: string
+
+  /**
+   * 厂家名称
+   */
+  factory: string
+
+  /**
+   * 需求数量
+   */
+  quantity: number
+
+  /**
+   * 备注
+   */
+  remark: string
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface CarryChecklistForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 机型
+   */
+  aircraftModel?: string
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 成品名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 厂家名称
+   */
+  factory?: string
+
+  /**
+   * 需求数量
+   */
+  quantity?: number
+
+  /**
+   * 备注
+   */
+  remark?: string
+}
+
+export interface CarryChecklistQuery extends PageQuery {
+  /**
+   * 机型
+   */
+  aircraftModel?: string
+
+  /**
+   * 机号
+   */
+  aircraftNo?: string
+
+  /**
+   * 成品名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 厂家名称
+   */
+  factory?: string
+
+  /**
+   * 需求数量
+   */
+  quantity?: number
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

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

@@ -0,0 +1,111 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface SparePartsVO extends BaseEntity {
+  /**
+   * 部件名称
+   */
+  name: string
+
+  /**
+   * 型号
+   */
+  model: string
+
+  /**
+   * 所属系统
+   */
+  systemName: string
+
+  /**
+   * 制造厂
+   */
+  factory: string
+
+  /**
+   * 数量
+   */
+  quantity: number
+
+  /**
+   * 创建人
+   */
+  createBy: number
+
+  /**
+   * 创建时间
+   */
+  createTime: string
+
+  /**
+   * 更新人
+   */
+  updateBy: number
+
+  /**
+   * 更新时间
+   */
+  updateTime: string
+}
+
+export interface SparePartsForm {
+  /**
+   * 编号
+   */
+  id?: string | number
+
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  systemName?: string
+
+  /**
+   * 制造厂
+   */
+  factory?: string
+
+  /**
+   * 数量
+   */
+  quantity?: number
+}
+
+export interface SparePartsQuery extends PageQuery {
+  /**
+   * 部件名称
+   */
+  name?: string
+
+  /**
+   * 型号
+   */
+  model?: string
+
+  /**
+   * 所属系统
+   */
+  systemName?: string
+
+  /**
+   * 制造厂
+   */
+  factory?: string
+
+  /**
+   * 数量
+   */
+  quantity?: number
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

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

@@ -0,0 +1,70 @@
+import http from '@/api'
+import { CarryChecklistVO, CarryChecklistForm, CarryChecklistQuery } from '@/api/interface/als/carryChecklist'
+/**
+ * @name 查询任务携行列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listCarryChecklistApi = (query: CarryChecklistQuery) => {
+  return http.get<CarryChecklistVO[]>('/als/carryChecklist/list', query, { loading: true })
+}
+
+/**
+ * @name 查询任务携行详细
+ * @param id id
+ * @returns returns
+ */
+export const getCarryChecklistApi = (id: string | number) => {
+  return http.get<CarryChecklistVO>(`/als/carryChecklist/${id}`)
+}
+
+/**
+ * @name 新增任务携行
+ * @param data data
+ * @returns returns
+ */
+export const addCarryChecklistApi = (data: CarryChecklistForm) => {
+  return http.post<any>('/als/carryChecklist', data, { loading: false })
+}
+
+/**
+ * @name 修改任务携行
+ * @param data data
+ * @returns returns
+ */
+export const updateCarryChecklistApi = (data: CarryChecklistForm) => {
+  return http.put<any>('/als/carryChecklist', data, { loading: false })
+}
+
+/**
+ * @name 删除任务携行
+ * @param id id
+ * @returns returns
+ */
+export const delCarryChecklistApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/carryChecklist/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/als/carryChecklist/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importCarryChecklistDataApi = (data: any) => {
+  return http.post('/als/carryChecklist/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportCarryChecklistApi = (data: any) => {
+  return http.post('/als/carryChecklist/export', data)
+}

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

@@ -0,0 +1,70 @@
+import http from '@/api'
+import { SparePartsVO, SparePartsForm, SparePartsQuery } from '@/api/interface/als/spareParts'
+/**
+ * @name 查询部件列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listSparePartsApi = (query: SparePartsQuery) => {
+  return http.get<SparePartsVO[]>('/als/spareParts/list', query, { loading: true })
+}
+
+/**
+ * @name 查询部件详细
+ * @param id id
+ * @returns returns
+ */
+export const getSparePartsApi = (id: string | number) => {
+  return http.get<SparePartsVO>(`/als/spareParts/${id}`)
+}
+
+/**
+ * @name 新增部件
+ * @param data data
+ * @returns returns
+ */
+export const addSparePartsApi = (data: SparePartsForm) => {
+  return http.post<any>('/als/spareParts', data, { loading: false })
+}
+
+/**
+ * @name 修改部件
+ * @param data data
+ * @returns returns
+ */
+export const updateSparePartsApi = (data: SparePartsForm) => {
+  return http.put<any>('/als/spareParts', data, { loading: false })
+}
+
+/**
+ * @name 删除部件
+ * @param id id
+ * @returns returns
+ */
+export const delSparePartsApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/als/spareParts/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/als/spareParts/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importSparePartsDataApi = (data: any) => {
+  return http.post('/als/spareParts/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportSparePartsApi = (data: any) => {
+  return http.post('/als/spareParts/export', data)
+}

+ 254 - 0
src/views/als/carryChecklist/index.vue

@@ -0,0 +1,254 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listCarryChecklistApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:carryChecklist:add']" icon="CirclePlus" @click="openDialog(1, '任务携行新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:carryChecklist:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['als:carryChecklist:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:carryChecklist: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:carryChecklist:query']" @click="openDialog(3, '任务携行查看', scope.row)">
+          查看
+        </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:carryChecklist:edit']" @click="openDialog(2, '任务携行编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:carryChecklist:remove']" @click="deleteCarryChecklist(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="CarryChecklist">
+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 {
+  listCarryChecklistApi,
+  delCarryChecklistApi,
+  addCarryChecklistApi,
+  updateCarryChecklistApi,
+  importTemplateApi,
+  importCarryChecklistDataApi,
+  exportCarryChecklistApi,
+  getCarryChecklistApi
+} from '@/api/modules/als/carryChecklist'
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除任务携行信息
+const deleteCarryChecklist = async (params: any) => {
+  await useHandleData(delCarryChecklistApi, params.id, '删除【' + params.id + '】任务携行')
+  proTable.value?.getTableList()
+}
+
+// 批量删除任务携行信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delCarryChecklistApi, ids, '删除所选任务携行信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出任务携行列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出任务携行数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportCarryChecklistApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+// 批量添加任务携行
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '任务携行',
+    tempApi: importTemplateApi,
+    importApi: importCarryChecklistDataApi,
+    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 getCarryChecklistApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addCarryChecklistApi : updateCarryChecklistApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+  { prop: 'id', label: '编号' },
+  {
+    prop: 'aircraftModel',
+    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: 'factory',
+    label: '厂家名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'quantity',
+    label: '需求数量',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'remark',
+    label: '备注',
+    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: 'aircraftModel',
+      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',
+      rules: [{ required: true, message: '型号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入型号'
+      }
+    },
+    {
+      label: '厂家名称',
+      prop: 'factory',
+      rules: [{ required: true, message: '厂家名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入厂家名称'
+      }
+    },
+    {
+      label: '需求数量',
+      prop: 'quantity',
+      rules: [{ required: true, message: '需求数量不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入需求数量'
+      }
+    },
+    {
+      label: '备注',
+      prop: 'remark',
+      compOptions: {
+        placeholder: '请输入备注'
+      }
+    }
+  ]
+}
+</script>

+ 3 - 3
src/views/als/model/index.vue

@@ -48,7 +48,7 @@ import {
   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'))
+const { sys_common_status, common_type } = toRefs<any>(proxy?.useDict('sys_common_status', 'common_type'))
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
@@ -124,7 +124,7 @@ const columns = reactive<ColumnProps<any>[]>([
     prop: 'type',
     label: '模型类型',
     tag: true,
-    enum: sys_app_type,
+    enum: common_type,
     search: {
       el: 'tree-select'
     }
@@ -190,7 +190,7 @@ const setItemsOptions = () => {
       rules: [{ required: true, message: '模型类型不能为空', trigger: 'change' }],
       compOptions: {
         elTagName: 'select',
-        enum: sys_app_type.value,
+        enum: common_type.value,
         placeholder: '请选择模型类型'
       }
     },

+ 223 - 0
src/views/als/spareParts/index.vue

@@ -0,0 +1,223 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listSparePartsApi">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['als:spareParts:add']" icon="CirclePlus" @click="openDialog(1, '部件新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['als:spareParts:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['als:spareParts:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['als:spareParts: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:spareParts:query']" @click="openDialog(3, '部件查看', scope.row)"> 查看 </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['als:spareParts:edit']" @click="openDialog(2, '部件编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link icon="Delete" v-auth="['als:spareParts:remove']" @click="deleteSpareParts(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="SpareParts">
+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 {
+  listSparePartsApi,
+  delSparePartsApi,
+  addSparePartsApi,
+  updateSparePartsApi,
+  importTemplateApi,
+  importSparePartsDataApi,
+  exportSparePartsApi,
+  getSparePartsApi
+} from '@/api/modules/als/spareParts'
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+// 表单model
+const model = ref({})
+// 删除部件信息
+const deleteSpareParts = async (params: any) => {
+  await useHandleData(delSparePartsApi, params.id, '删除【' + params.id + '】部件')
+  proTable.value?.getTableList()
+}
+
+// 批量删除部件信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delSparePartsApi, ids, '删除所选部件信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
+// 导出部件列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出部件数据?', '温馨提示', { type: 'warning' }).then(async () => {
+    exportSparePartsApi(proTable.value?.searchParam)
+    taskDialogRef.value?.openExportDialog()
+  })
+}
+
+// 批量添加部件
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '部件',
+    tempApi: importTemplateApi,
+    importApi: importSparePartsDataApi,
+    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 getSparePartsApi(row?.id || null)
+  }
+  model.value = type == 1 ? {} : res.data
+  // 重置表单
+  setItemsOptions()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    api: type == 1 ? addSparePartsApi : updateSparePartsApi,
+    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: 'model',
+    label: '型号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'systemName',
+    label: '所属系统',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'factory',
+    label: '制造厂',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'quantity',
+    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: 'model',
+      rules: [{ required: true, message: '型号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入型号'
+      }
+    },
+    {
+      label: '所属系统',
+      prop: 'systemName',
+      rules: [{ required: true, message: '所属系统不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入所属系统'
+      }
+    },
+    {
+      label: '制造厂',
+      prop: 'factory',
+      rules: [{ required: true, message: '制造厂不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入制造厂'
+      }
+    },
+    {
+      label: '数量',
+      prop: 'quantity',
+      rules: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入数量'
+      }
+    }
+  ]
+}
+</script>