|
@@ -0,0 +1,200 @@
|
|
|
+<template>
|
|
|
+ <div class="table-box">
|
|
|
+ <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listFaultDiagnosisResultApi">
|
|
|
+ <!-- 表格 header 按钮 -->
|
|
|
+ <template #tableHeader="scope">
|
|
|
+ <el-button type="primary" v-auth="['als:faultDiagnosisResult:add']" icon="CirclePlus" @click="openDialog(1, '故障诊断结果新增')">
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" v-auth="['als:faultDiagnosisResult:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ v-auth="['als:faultDiagnosisResult: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:faultDiagnosisResult:query']" @click="openDialog(3, '故障诊断结果查看', scope.row)">
|
|
|
+ 查看
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ icon="EditPen"
|
|
|
+ v-auth="['als:faultDiagnosisResult:edit']"
|
|
|
+ @click="openDialog(2, '故障诊断结果编辑', scope.row)"
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" link icon="Delete" v-auth="['als:faultDiagnosisResult:remove']" @click="deleteFaultDiagnosisResult(scope.row)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </ProTable>
|
|
|
+ <FormDialog ref="formDialogRef" :items-options="itemsOptions" :model="model" />
|
|
|
+ <TaskDialog ref="taskDialogRef" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="tsx" name="FaultDiagnosisResult">
|
|
|
+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 {
|
|
|
+ listFaultDiagnosisResultApi,
|
|
|
+ delFaultDiagnosisResultApi,
|
|
|
+ addFaultDiagnosisResultApi,
|
|
|
+ updateFaultDiagnosisResultApi,
|
|
|
+ exportFaultDiagnosisResultApi,
|
|
|
+ getFaultDiagnosisResultApi
|
|
|
+} from '@/api/modules/als/faultDiagnosisResult'
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
+const { common_type } = toRefs<any>(proxy?.useDict('common_type'))
|
|
|
+
|
|
|
+// ProTable 实例
|
|
|
+const proTable = ref<ProTableInstance>()
|
|
|
+// 表单model
|
|
|
+const model = ref({})
|
|
|
+// 删除故障诊断结果信息
|
|
|
+const deleteFaultDiagnosisResult = async (params: any) => {
|
|
|
+ await useHandleData(delFaultDiagnosisResultApi, params.id, '删除【' + params.id + '】故障诊断结果')
|
|
|
+ proTable.value?.getTableList()
|
|
|
+}
|
|
|
+
|
|
|
+// 批量删除故障诊断结果信息
|
|
|
+const batchDelete = async (ids: string[]) => {
|
|
|
+ await useHandleData(delFaultDiagnosisResultApi, ids, '删除所选故障诊断结果信息')
|
|
|
+ proTable.value?.clearSelection()
|
|
|
+ proTable.value?.getTableList()
|
|
|
+}
|
|
|
+
|
|
|
+const taskDialogRef = ref<InstanceType<typeof TaskDialog> | null>(null)
|
|
|
+// 导出故障诊断结果列表
|
|
|
+const downloadFile = async () => {
|
|
|
+ ElMessageBox.confirm('确认导出故障诊断结果数据?', '温馨提示', { type: 'warning' }).then(async () => {
|
|
|
+ exportFaultDiagnosisResultApi(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 getFaultDiagnosisResultApi(row?.id || null)
|
|
|
+ }
|
|
|
+ model.value = type == 1 ? {} : res.data
|
|
|
+ // 重置表单
|
|
|
+ setItemsOptions()
|
|
|
+ const params = {
|
|
|
+ title,
|
|
|
+ width: 580,
|
|
|
+ isEdit: type !== 3,
|
|
|
+ api: type == 1 ? addFaultDiagnosisResultApi : updateFaultDiagnosisResultApi,
|
|
|
+ getTableList: proTable.value?.getTableList
|
|
|
+ }
|
|
|
+ formDialogRef.value?.openDialog(params)
|
|
|
+}
|
|
|
+
|
|
|
+// 表格配置项
|
|
|
+const columns = reactive<ColumnProps<any>[]>([
|
|
|
+ { type: 'selection', fixed: 'left', width: 70 },
|
|
|
+ { prop: 'id', label: '编号' },
|
|
|
+ {
|
|
|
+ prop: 'diagnosisId',
|
|
|
+ label: '故障诊断编号',
|
|
|
+ search: {
|
|
|
+ el: 'input'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'sortieNo',
|
|
|
+ label: '架次号',
|
|
|
+ search: {
|
|
|
+ el: 'input'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'aircraftNo',
|
|
|
+ label: '机号',
|
|
|
+ search: {
|
|
|
+ el: 'input'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'status',
|
|
|
+ label: '状态',
|
|
|
+ tag: true,
|
|
|
+ enum: common_type,
|
|
|
+ search: {
|
|
|
+ el: 'tree-select'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createByName',
|
|
|
+ label: '创建人'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'updateByName',
|
|
|
+ label: '更新人'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'updateTime',
|
|
|
+ label: '更新时间'
|
|
|
+ },
|
|
|
+ { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
|
|
|
+])
|
|
|
+// 表单配置项
|
|
|
+let itemsOptions = reactive<ProForm.ItemsOptions[]>([])
|
|
|
+const setItemsOptions = () => {
|
|
|
+ itemsOptions = [
|
|
|
+ {
|
|
|
+ label: '故障诊断编号',
|
|
|
+ prop: 'diagnosisId',
|
|
|
+ rules: [{ required: true, message: '故障诊断编号不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入故障诊断编号'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '架次号',
|
|
|
+ prop: 'sortieNo',
|
|
|
+ rules: [{ required: true, message: '架次号不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入架次号'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '机号',
|
|
|
+ prop: 'aircraftNo',
|
|
|
+ rules: [{ required: true, message: '机号不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入机号'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '状态',
|
|
|
+ prop: 'status',
|
|
|
+ rules: [{ required: true, message: '状态不能为空', trigger: 'change' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'radio-group',
|
|
|
+ enum: common_type.value,
|
|
|
+ placeholder: '请选择状态'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}
|
|
|
+</script>
|