fuyanting преди 1 година
родител
ревизия
ac9ab32080

+ 42 - 0
package-lock.json

@@ -4327,6 +4327,15 @@
         "node": ">=8"
       }
     },
+    "node_modules/bindings": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz",
+      "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+      "optional": true,
+      "dependencies": {
+        "file-uri-to-path": "1.0.0"
+      }
+    },
     "node_modules/bluebird": {
       "version": "3.7.2",
       "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz",
@@ -8607,6 +8616,12 @@
       "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
       "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
     },
+    "node_modules/file-uri-to-path": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+      "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+      "optional": true
+    },
     "node_modules/filesize": {
       "version": "3.6.1",
       "resolved": "https://registry.npmmirror.com/filesize/-/filesize-3.6.1.tgz",
@@ -12188,6 +12203,12 @@
       "resolved": "https://registry.npmmirror.com/namespace-emitter/-/namespace-emitter-2.0.1.tgz",
       "integrity": "sha512-N/sMKHniSDJBjfrkbS/tpkPj4RAbvW3mr8UAzvlMHyun93XEm83IAvhWtJVHo+RHn/oO8Job5YN4b+wRjSVp5g=="
     },
+    "node_modules/nan": {
+      "version": "2.18.0",
+      "resolved": "https://registry.npmmirror.com/nan/-/nan-2.18.0.tgz",
+      "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==",
+      "optional": true
+    },
     "node_modules/nanoid": {
       "version": "3.3.6",
       "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.6.tgz",
@@ -23370,6 +23391,15 @@
       "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
       "devOptional": true
     },
+    "bindings": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz",
+      "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+      "optional": true,
+      "requires": {
+        "file-uri-to-path": "1.0.0"
+      }
+    },
     "bluebird": {
       "version": "3.7.2",
       "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz",
@@ -26899,6 +26929,12 @@
       "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
       "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
     },
+    "file-uri-to-path": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+      "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+      "optional": true
+    },
     "filesize": {
       "version": "3.6.1",
       "resolved": "https://registry.npmmirror.com/filesize/-/filesize-3.6.1.tgz",
@@ -29818,6 +29854,12 @@
       "resolved": "https://registry.npmmirror.com/namespace-emitter/-/namespace-emitter-2.0.1.tgz",
       "integrity": "sha512-N/sMKHniSDJBjfrkbS/tpkPj4RAbvW3mr8UAzvlMHyun93XEm83IAvhWtJVHo+RHn/oO8Job5YN4b+wRjSVp5g=="
     },
+    "nan": {
+      "version": "2.18.0",
+      "resolved": "https://registry.npmmirror.com/nan/-/nan-2.18.0.tgz",
+      "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==",
+      "optional": true
+    },
     "nanoid": {
       "version": "3.3.6",
       "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.6.tgz",

+ 63 - 0
src/api/aircraft/management.js

@@ -0,0 +1,63 @@
+import request from '@/utils/request'
+
+// 查询飞参数据管理列表
+export function listManagement(query) {
+  return request({
+    url: '/aircraft/management/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询飞参数据管理详细
+export function getManagement(id) {
+  return request({
+    url: '/aircraft/management/' + id,
+    method: 'get'
+  })
+}
+
+// 新增飞参数据管理
+export function addManagement(data) {
+  return request({
+    url: '/aircraft/management',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改飞参数据管理
+export function updateManagement(data) {
+  return request({
+    url: '/aircraft/management',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除飞参数据管理
+export function delManagement(id) {
+  return request({
+    url: '/aircraft/management/' + id,
+    method: 'delete'
+  })
+}
+
+export function runairtopre(data) {
+  return request({
+    url: '/aircraft/management/runairtopre',
+    method: 'put',
+    data: data
+  })
+}
+
+export function getfilecontent(filepath) {
+  return request({
+    url: '/aircraft/management/getfilecontent',
+    method: 'get',
+    params: {
+      filepath: filepath // 将filepath作为查询参数传递给后端
+    }
+  })
+}
+

+ 44 - 0
src/api/system/management.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询飞参数据列表
+export function listManagement(query) {
+  return request({
+    url: '/system/management/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询飞参数据详细
+export function getManagement(id) {
+  return request({
+    url: '/system/management/' + id,
+    method: 'get'
+  })
+}
+
+// 新增飞参数据
+export function addManagement(data) {
+  return request({
+    url: '/system/management',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改飞参数据
+export function updateManagement(data) {
+  return request({
+    url: '/system/management',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除飞参数据
+export function delManagement(id) {
+  return request({
+    url: '/system/management/' + id,
+    method: 'delete'
+  })
+}

+ 22 - 0
src/components/FileUpload/index.vue

@@ -78,6 +78,9 @@ export default {
         Authorization: "Bearer " + getToken(),
       },
       fileList: [],
+     uploadStartTime: null, // 记录上传开始时间
+     uploadEndTime: null, // 记录上传结束时间
+     filestate:null,//记录是否上传失败,成功返回1,失败返回-1
     };
   },
   watch: {
@@ -128,6 +131,7 @@ export default {
           this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
           return false;
         }
+        this.uploadStartTime = this.formatDate(new Date()); // 记录上传开始时间并格式化
       }
       // 校检文件大小
       if (this.fileSize) {
@@ -147,15 +151,24 @@ export default {
     },
     // 上传失败
     handleUploadError(err) {
+      this.uploadEndTime=null;
+      this.uploadStartTime=null;
+      this.filestate="-1";
+      this.$emit('upload-error', this.uploadStartTime, this.uploadEndTime,this.filestate);
       this.$modal.msgError("上传文件失败,请重试");
       this.$modal.closeLoading()
     },
     // 上传成功回调
     handleUploadSuccess(res, file) {
       if (res.code === 200) {
+        this.uploadEndTime = this.formatDate(new Date()); // 记录上传结束时间并格式化
+        this.filestate="1";
+        this.$emit('success', this.uploadStartTime, this.uploadEndTime,this.filestate);
         this.uploadList.push({ name: res.fileName, url: res.fileName, originalFilename: res.originalFilename});
         this.uploadedSuccessfully();
       } else {
+        this.uploadEndTime=null;
+        this.uploadStartTime=null;
         this.number--;
         this.$modal.closeLoading();
         this.$modal.msgError(res.msg);
@@ -163,6 +176,15 @@ export default {
         this.uploadedSuccessfully();
       }
     },
+     formatDate(date) {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      const hours = String(date.getHours()).padStart(2, '0');
+      const minutes = String(date.getMinutes()).padStart(2, '0');
+      const seconds = String(date.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+   },
     // 删除文件
     handleDelete(index) {
       this.fileList.splice(index, 1);

+ 417 - 0
src/views/aircraft/management/index.vue

@@ -0,0 +1,417 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="型号" prop="typeId">
+        <el-input
+          v-model="queryParams.typeId"
+          placeholder="请输入型号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="机号" prop="aircraftId">
+        <el-input
+          v-model="queryParams.aircraftId"
+          placeholder="请输入机号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="架次" prop="sortie">
+        <el-input
+          v-model="queryParams.sortie"
+          placeholder="请输入架次"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['aircraft:management:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['aircraft:management:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['aircraft:management:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['aircraft:management:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="序号" align="center" prop="id" />
+      <el-table-column label="型号" align="center" prop="typeId" />
+      <el-table-column label="机号" align="center" prop="aircraftId" />
+      <el-table-column label="架次" align="center" prop="sortie" />
+      <el-table-column label="飞行日期" align="center" prop="flyDate" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.flyDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['aircraft:management:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['aircraft:management:remove']"
+          >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleView(scope.row)"
+            v-hasPermi="['aircraft:management:query']"
+          >详情</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改飞参数据管理对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="型号" prop="typeId">
+          <el-input v-model="form.typeId" placeholder="请输入型号" />
+        </el-form-item>
+        <el-form-item label="机号" prop="aircraftId">
+          <el-input v-model="form.aircraftId" placeholder="请输入机号" />
+        </el-form-item>
+        <el-form-item label="架次" prop="sortie">
+          <el-input v-model="form.sortie" placeholder="请输入架次" />
+        </el-form-item>
+        <el-form-item label="飞行日期" prop="flyDate">
+          <el-date-picker clearable
+            v-model="form.flyDate"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="请选择飞行日期">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="飞参数据文件">
+          <file-upload v-model="form.airparaPath" :fileType="uploadFileType" :limit='1' @success="handleUploadSuccess" @upload-error="handleUploadError"/>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="aircraftdetailOpenTitle" v-if="aircraftdetailOpen" :visible.sync="aircraftdetailOpen" width="80%" append-to-body destroy-on-close :close-on-click-modal="false" @close="closedaircraftdetailDialog">
+       <aircraftdetail :aircraft="aircraft" :aircraftdetailOpen.sync="aircraftdetailOpen"></aircraftdetail>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listManagement, getManagement, delManagement, addManagement, updateManagement } from "@/api/aircraft/management";
+import aircraftdetail from "@/views/aircraftdetail"
+export default {
+  name: "Management",
+  dicts: ['preprocessdata', 'system_health_data', 'health_factors', 'aircraftparameter_upload'],
+  components: { aircraftdetail},
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 飞参数据管理表格数据
+      managementList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      uploadFileType: ["csv"],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        typeId: null,
+        aircraftId: null,
+        sortie: null,
+      },
+      // 表单参数
+      form: {
+        id: null,
+        typeId: null,
+        aircraftId: null,
+        sortie: null,
+        flyDate: null,
+        airparaPath: null,
+        airparaState: "0",
+        airparaStarttime: null,
+        airparaEndtime: null,
+        uploadStartTime: null, 
+        uploadEndTime: null, // 用于显示文件上传成功的时间
+        filestate:null,//文件上传是否成功
+        airparaTime: null,
+        pretreatmentPath: null,
+        pretreatmentState: "0",
+        pretreatmentStarttime: null,
+        pretreatmentEndtime: null,
+        pretreatmentTime: null,
+        healthfactorsPath: null,
+        healthfactorsState: "0",
+        healthfactorsStarttime: null,
+        healthfactorsEndtime: null,
+        healthfactorsTime: null,
+        systemhealthPath: null,
+        systemhealthState: "0",
+        systemhealthStarttime: null,
+        systemhealthEndtime: null,
+        systemhealthTime: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null,
+        state:"-1",
+      },
+      // 表单校验
+      rules: {
+        airparaPath: [
+          { required: true, message: '飞参数据文件不能为空', trigger: 'blur'}
+        ],
+      },
+      aircraftdetailOpenTitle:"",
+      aircraftdetailOpen: false,
+      aircraft: {},
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询飞参数据管理列表 */
+    handleUploadSuccess(uploadStartTime, uploadEndTime,filestate) {
+      this.form.airparaStarttime = uploadStartTime;
+      this.form.airparaEndtime = uploadEndTime;
+      this.form.filestate=filestate;
+    },
+    handleUploadError(uploadStartTime,uploadEndTime,filestate) {
+      this.form.airparaStarttime = uploadStartTime;
+      this.form.airparaEndtime = uploadEndTime;
+      this.form.filestate=filestate;
+    },
+    getList() {
+      this.loading = true;
+      listManagement(this.queryParams).then(response => {
+        this.managementList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        typeId: null,
+        aircraftId: null,
+        sortie: null,
+        flyDate: null,
+        airparaPath: null,
+        airparaState: "0",
+        airparaStarttime: null,
+        airparaEndtime: null,
+        airparaTime: null,
+        pretreatmentPath: null,
+        pretreatmentState: "0",
+        pretreatmentStarttime: null,
+        pretreatmentEndtime: null,
+        pretreatmentTime: null,
+        healthfactorsPath: null,
+        healthfactorsState: "0",
+        healthfactorsStarttime: null,
+        healthfactorsEndtime: null,
+        healthfactorsTime: null,
+        systemhealthPath: null,
+        systemhealthState: "0",
+        systemhealthStarttime: null,
+        systemhealthEndtime: null,
+        systemhealthTime: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null,
+        state:"-1",
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加飞参数据";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getManagement(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改飞参数据";
+      });
+    },
+    handleView(row){
+      //todo view
+      this.aircraftdetailOpen = true;
+      this.aircraft = row;
+      this.aircraftdetailOpenTitle = row.id;
+      // alert("开发ing")
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if(this.form.filestate == "1"){
+           const startTime = new Date(this.form.airparaStarttime);
+          const endTime = new Date(this.form.airparaEndtime);
+          const timeDiff = Math.abs(endTime - startTime);
+          const airparaTime = Math.ceil(timeDiff / (1000 * 60)); // 计算耗费时间(分钟)
+        this.form.airparaTime=airparaTime;
+        if(this.form.airparaStarttime !=null && this.form.airparaEndtime != null){
+          this.form.state = '0';
+          this.form.airparaState = '2';
+        }else if(this.form.airparaStarttime !=null && this.form.airparaEndtime == null){
+          this.form.state = '0';
+          this.form.airparaState = '1';
+        }else if(this.form.airparaStarttime ==null && this.form.airparaEndtime == null){
+          this.form.state = '-1';
+          this.form.airparaState = '0';
+        }
+        }else if(this.form.filestate == "-1"){
+          this.form.state = '-1';
+          this.form.airparaState = '3';
+        }else if(this.form.filestate == null){
+          this.form.state = '0';
+          this.form.airparaState = '0';
+        }      
+        if (valid) {
+          if (this.form.id != null) {
+            updateManagement(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addManagement(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除飞参数据管理编号为"' + ids + '"的数据项?').then(function() {
+        return delManagement(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('aircraft/management/export', {
+        ...this.queryParams
+      }, `management_${new Date().getTime()}.xlsx`)
+    },
+    closedaircraftdetailDialog(){
+      // 暂时不处理任何事件
+    },
+  }
+};
+</script>

+ 449 - 0
src/views/aircraftdetail/index.vue

@@ -0,0 +1,449 @@
+<template>
+  <div>
+    <el-container>
+      <el-header>
+        <el-steps :active="parseInt(aircraft.state)" simple direction finish-status="wait" process-status="finish">
+          <el-step title="飞参数据"></el-step>
+          <el-step title="预处理"></el-step>
+          <el-step title="健康参数表征"></el-step>
+          <el-step title="综合健康状态"></el-step>
+        </el-steps>
+      </el-header>
+      <el-main>
+       <el-table v-loading="loading" :data="groupedData">
+  <el-table-column  prop="label" label="数据" align="center">
+    <template slot-scope="scope">{{ scope.row.label }}</template>
+  </el-table-column>
+  <el-table-column  prop="state" label="状态" align="center">
+    <template slot-scope="scope">
+      <dict-tag :options="getDictType(scope.row.label)" :value="scope.row.state"/> 
+    </template>
+  </el-table-column>
+  <el-table-column prop="starttime" label="开始时间" align="center" width="180">
+    <template slot-scope="scope">{{ scope.row.starttime }}</template>
+  </el-table-column>
+  <el-table-column prop="endtime" label="结束时间" align="center" width="180">
+    <template slot-scope="scope">{{ scope.row.endtime }}</template>
+  </el-table-column>
+  <el-table-column prop="time" label="花费时间(s)" align="center" width="180">
+    <template slot-scope="scope">{{ scope.row.time }}</template>
+  </el-table-column>
+  <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+    <template slot-scope="scope">
+     <!-- 可视化按钮 -->
+    <!-- <el-button v-if="scope.row.label === '飞参数据' && scope.row.state === '2'" type="primary" size="mini">可视化</el-button> -->
+     <el-button
+        v-show="scope.row.label === '飞参数据' && scope.row.state === '2'"
+        size="medium"
+        type="text"
+        icon="el-icon-monitor"
+        @click="viewResult(aircraftdetail.airparaPath)"
+     >可视化</el-button>
+     <el-button 
+        v-show="scope.$index > 0 && scope.row.state != '2' && scope.row.state != '1'&& scope.row.label === '预处理数据' && groupedData[scope.$index - 1].state === '2' && groupedData[scope.$index - 1].label === '飞参数据'"
+        size="medium"
+        type="text"
+        icon="el-icon-video-play"
+        @click="handlerun"
+    >开始运行</el-button>
+    </template>
+  </el-table-column>
+</el-table>
+      </el-main>
+    </el-container>
+<el-dialog :title="DatavisTitle" :visible.sync="openDatavis" width="1200px">
+  <template #title>
+    <div class="dialog-title">
+      <div class="title-text">{{ DatavisTitle }}</div>
+      <div class="button-container">
+        <el-button
+        size="medium"
+        type="text"
+        icon="el-icon-view"
+        @click="selectcolumn"
+     >数据可视化选择</el-button>
+      </div>
+    </div>
+  </template>
+  <Datavis :filepath="filepath" :dataOption="dataOption" v-if="openDatavis"></Datavis>
+</el-dialog>
+
+
+
+<el-dialog :title="datacolumntitle" :visible.sync="opendatacolumn" width="600px" @open="onOpen" @close="onClose">
+      <el-row :gutter="15">
+        <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
+          <el-col :span="12">
+            <el-row type="flex" justify="start" align="top">
+              <el-col :span="12">
+                <el-form-item label="数据项" prop="">
+                  <el-checkbox-group v-model="noOptions" size="medium">
+                   <el-checkbox v-for="item in filterOption" :key="item.id" :label="item.id"  :checked="item.checked" @change="checkedBoxChange">{{item.label}}</el-checkbox>
+                  </el-checkbox-group>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-col>
+          <el-col :span="12">
+            <el-row type="flex" justify="start" align="top">
+              <el-col :span="12">
+                <el-form-item label="展示数据项" prop="">
+                  <div>
+                   <el-checkbox-group v-model="checkedOptions" size="medium">
+                    <el-checkbox v-for="item in dataOption" :key="item.id" :label="item.id"  :checked="item.checked" @change="checkedBoxChange">{{item.label}}</el-checkbox>
+                  </el-checkbox-group>
+                  </div>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-col>
+        </el-form>
+      </el-row>
+      <div slot="footer">
+        <el-button @click="close">取消</el-button>
+        <el-button type="primary" @click="handleConfirm">确定</el-button>
+      </div>
+    </el-dialog>
+</div>
+</template>
+
+<script>
+import { listManagement, getManagement, delManagement, addManagement, updateManagement,runairtopre } from "@/api/aircraft/management";
+
+import Datavis from "@/views/maintenance/offLineDataAnalysis/Datavis"
+import axios from "axios";
+export default {
+  name: "aircraftdetail",
+  dicts: ['preprocessdata', 'system_health_data', 'health_factors', 'aircraftparameter_upload'],
+  components: { Datavis },
+  props: {
+    aircraft: {
+      type: Object,
+    },
+    aircraftdetailOpen: {
+      type: Boolean,
+    },
+  },
+
+  data() {
+    return {
+      data: [], // 初始化为空数组
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 知识抽取子任务表格数据
+      aircraftdetailList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 步骤
+      setp: 1,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        aircraftId: this.aircraft.id,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      },
+      checked:true,
+      aircraftdetail: {},
+      openDatavis: false,
+      DatavisTitle: "",
+      aircraftdataview:{},
+      filepath:null,
+      opendatacolumn:false,
+      datacolumntitle:"",
+      chartData:[],
+      dataOption: [],
+      allOption:[],
+      filteroption:[],
+      selectedItems: [],
+      isViewResultClicked: false,
+      checkedOptions: [],
+      noOptions:[],
+      noOption:[],
+      flag:1,
+      checkOption:[]
+    };
+  },
+  created() {
+     this.getListByaircraftId();
+      
+  },
+
+  computed: {
+  groupedData() {
+    const data1 = {
+      label: "飞参数据",
+      state: this.aircraftdetail.airparaState,
+      starttime: this.aircraftdetail.airparaStarttime,
+      endtime: this.aircraftdetail.airparaEndtime,
+      time: this.aircraftdetail.airparaTime,
+    };
+
+    const data2 = {
+      label: "预处理数据",
+      state: this.aircraftdetail.pretreatmentState,
+      starttime: this.aircraftdetail.pretreatmentStarttime,
+      endtime: this.aircraftdetail.pretreatmentEndtime,
+      time: this.aircraftdetail.pretreatmentTime,
+    };
+
+    const data3 = {
+      label: "健康因子",
+      state: this.aircraftdetail.healthfactorsState,
+      starttime: this.aircraftdetail.healthfactorsStarttime,
+      endtime: this.aircraftdetail.healthfactorsEndtime,
+      time: this.aircraftdetail.healthfactorsTime,
+    };
+
+    const data4 = {
+      label: "系统级健康数据",
+      state: this.aircraftdetail.systemhealthState,
+      starttime: this.aircraftdetail.systemhealthStarttime,
+      endtime: this.aircraftdetail.systemhealthEndtime,
+      time: this.aircraftdetail.systemhealthTime,
+    };
+
+    return [data1, data2, data3, data4];
+  },
+
+},
+  methods: {
+    getDictType(label) {
+    if (label === '飞参数据') {
+      return this.dict.type.aircraftparameter_upload;
+    } else if (label === '预处理数据') {
+      return this.dict.type.preprocessdata;
+    } else if(label =='健康因子'){
+      return this.dict.type.health_factors;
+    }else if(label =='系统级健康数据'){
+      return this.dict.type.system_health_data;
+    }else{
+      return [];
+    }
+  },
+
+  
+    /** 查询指定id的飞机参数 */
+    getListByaircraftId() {
+      this.loading = true;
+     getManagement(this.queryParams.aircraftId).then(response => {
+        this.aircraftdetail = response.data;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    handlerun(){
+      const startTime = this.formatDate(new Date());
+      this.aircraftdetail.pretreatmentStarttime = startTime;
+      this.aircraftdetail.state ='1';
+      this.aircraftdetail.pretreatmentState = '1';
+      runairtopre(this.aircraftdetail).then(response => {
+        this.getListByaircraftId()
+      });
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        taskId: null,
+        type: null,
+        status: "0",
+        log: null,
+        completedDate: null,
+        costTime: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    // handleSelectionChange(selection) {
+    //   this.ids = selection.map(item => item.id)
+    //   this.single = selection.length!==1
+    //   this.multiple = !selection.length
+    // },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加知识抽取子任务";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getSubTask(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改知识抽取子任务";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateSubTask(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addSubTask(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    closeaircraftdetail() {
+      this.aircraftdetailOpen = false;
+    },
+    async getresponse(filepath){
+      const response = await axios.get(process.env.VUE_APP_BASE_API + filepath, { responseType: 'text' });
+      const csvData = response.data;
+      const rows = csvData.split('\n');
+      this.chartData = rows.map(row => row.split(','));
+      const firstRow = this.chartData[0]; // 获取第一行数据
+      this.allOption = firstRow.map((label, id) => ({ id, label })); // 将第一行数据转换为allOption格式
+       this.dataOption = this.allOption
+      // 设置默认选中状态
+      this.filterOption = this.allOption.filter(option => option.id === this.dataOption.id);
+      this.dataOption = this.allOption.map(option => ({ ...option, checked: true }));
+      this.filterOption = this.filteroption.map(option => ({ ...option, checked: false }));
+
+  },
+    viewResult(filepath){
+      this.DatavisTitle = this.aircraftdetail.id + "---飞参数据可视化"
+      this.filepath = filepath
+      this.getresponse(filepath)
+      
+      this.openDatavis = true
+    },
+    selectcolumn(){
+      this.datacolumntitle = "数据可视化选择"
+      this.opendatacolumn = true;
+    },
+    cancel() {
+      this.opendatacolumn = false;
+    },
+     formatDate(date) {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      const hours = String(date.getHours()).padStart(2, '0');
+      const minutes = String(date.getMinutes()).padStart(2, '0');
+      const seconds = String(date.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+   },
+
+    onOpen() {
+      this.opendatacolumn = true;
+    },
+    onClose() {
+      this.opendatacolumn = false;
+    },
+    close() {
+      this.opendatacolumn = false;
+    },
+    handleConfirm() {
+      this.checkOption=[]
+      this.noOption = []
+      this.allOption = this.allOption.map(option => ({ ...option, checked: true }));
+      this.checkOption = this.allOption.map(option => ({ ...option, checked: true }));
+      this.noOption = this.allOption.map(option => ({ ...option, checked: true }));
+
+      this.checkOption = this.allOption.filter(option => this.checkedOptions.includes(option.id));
+      this.noOption = this.allOption.filter(option => this.noOptions.includes(option.id))
+      this.dataOption=[]
+      // 将checkOption数组中的元素合并到dataOption数组中
+      this.dataOption.push(...this.checkOption);
+
+      // 将noOption数组中的元素合并到dataOption数组中
+      this.dataOption.push(...this.noOption);
+      // console.log(this.checkOption)
+      // console.log(this.noOption)
+      // console.log(this.dataOption)
+      this.filterOption = [];
+      this.filterOption = [...this.allOption];
+      this.filterOption = this.filterOption.filter(option => !this.dataOption.includes(option));
+      this.filterOption = this.filterOption.map(option => ({ ...option, checked: false }));
+      this.opendatacolumn = false;
+      
+    },
+   checkedBoxChange(){
+     this.$forceUpdate();  //强制渲染多选框样式,否则值变了样式没有选中
+},
+
+  }
+};
+</script>
+<style scoped>
+.el-dialog__body {
+  padding: 0px
+}
+.custom-icon-button ::v-deep .el-icon-caret-left {
+  font-size: 2em; /* 将图标字体大小增加一倍 */
+}
+.dialog-title {
+  display: flex;
+  align-items: center;
+}
+
+.title-text {
+  flex: 1;
+}
+
+.button-container {
+  margin-right: 28px; /* 调整按钮与标题之间的间距 */
+}
+
+.dialog-content {
+  display: flex;
+  flex-direction: column;
+}
+
+.top-block {
+  display: flex;
+  justify-content: space-between;
+  padding: 10px;
+}
+
+.border-block {
+  border: 1px solid #ccc;
+  flex-grow: 1;
+
+  margin: 5px;
+}
+
+</style>

+ 125 - 0
src/views/maintenance/offLineDataAnalysis/Datavis.vue

@@ -0,0 +1,125 @@
+<template>
+    <div ref="Datavis" :style="{ width: '100%', height: '360px' }"></div>
+</template>
+
+<script>
+import * as echarts from 'echarts';
+import Papa from 'papaparse';
+import { listManagement, getManagement, delManagement, addManagement, updateManagement,runairtopre ,getfilecontent} from "@/api/aircraft/management";
+import axios from "axios";
+export default {
+ props: {
+    aircraftdataview: {
+      type: Object,
+    },
+    filepath:null,
+    dataOption:[],
+    openDatavis: {
+      type: Boolean,
+    },
+  },
+  data() {
+    return {
+      display: false,
+      Datavis: null,
+      chartData: [], // 定义空数组用于保存CSV数据
+    };
+  },
+  computed: {
+    selectedIds() {
+      return this.dataOption.map((item) => item.id);
+    },
+  },
+ 
+  methods: {
+createDatavis() {
+      const xAxisData = Array.from({ length: this.chartData.length - 1 }, (_, i) => i + 1); // 生成从1到chartData行数-1的数组作为横坐标数据
+      const option = {
+        animationDuration: 3000,
+        legend: {
+          textStyle: {
+            color: 'white',
+          },
+        },
+        yAxis: {
+          axisLabel: {
+            color: 'white',
+          },
+          nameTextStyle: {
+            color: 'white',
+          },
+        },
+        series: [],
+        xAxis: {
+          data: xAxisData,
+        },
+      };
+
+      const usedColors = []; // 用于存储已使用的颜色
+      // 将每一列数据都添加到折线图中
+      for (let i = 0; i < this.chartData[0].length; i++) {
+        const columnId = i; // 列id就是i
+        if (!this.selectedIds.includes(columnId)) { // 如果当前列的id不在selectedIds中,则跳过该列
+          continue;
+        }
+
+        const seriesData = this.chartData.slice(1).map((row) => parseFloat(row[columnId])); // 获取y轴数据,从第二行开始的第i列的数据
+        let color;
+        do {
+          color = this.getRandomColor(); // 随机生成颜色
+        } while (usedColors.includes(color)); // 如果生成的颜色已经被使用过,则重新生成
+        usedColors.push(color); // 将颜色添加到已使用的颜色数组中
+        
+        option.series.push({
+          name: this.dataOption.find((item) => item.id === columnId).label, // 使用对应列的名称作为折线的名称
+          data: seriesData,
+          type: 'line',
+          itemStyle: {
+            color: color, // 随机生成折线的颜色
+          },
+          animationEasing: 'linear',
+          animationDelay: (idx) => idx * 8,
+        });
+      }
+
+      this.Datavis.setOption(option);
+    },
+getRandomColor() {
+  const letters = '0123456789ABCDEF';
+  let color = '#';
+  for (let i = 0; i < 6; i++) {
+    color += letters[Math.floor(Math.random() * 16)];
+  }
+  return color;
+},
+  async getresponse(){
+    const response = await axios.get(process.env.VUE_APP_BASE_API + this.filepath, { responseType: 'text' });
+    const csvData = response.data;
+
+    const rows = csvData.split('\n');
+    this.chartData = rows.map(row => row.split(','));
+
+     this.createDatavis()
+  },
+},
+  mounted() {
+    
+    this.Datavis = echarts.init(this.$refs.Datavis);
+    this.getresponse()
+   
+  },
+  watch: {
+  dataOption(newValue) {
+    this.Datavis.dispose();
+    this.Datavis = echarts.init(this.$refs.Datavis);
+    this.createDatavis();
+  }
+},
+  beforeUnmount() {
+    if (this.Datavis) {
+      this.Datavis.dispose();
+      this.Datavis = null;
+    }
+  },
+};
+</script>