index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="view-statisticalAnalysisSailingMaterialSpareParts">
  3. <el-row>
  4. <el-col :span="12" style="margin-bottom: 15px">
  5. <Card title="历年任务">
  6. <template slot="content">
  7. <LTable ref="table" :defaultFetch="true" :columns="columns" :dataSource="tableData" :options="options" :fetch="fetchTableData" @handleRowClick="handleRowClick" class="tabl-box" />
  8. </template>
  9. </Card>
  10. </el-col>
  11. <el-col :span="12" style="margin-bottom: 15px">
  12. <Card title="任务基本信息">
  13. <template slot="content">
  14. <el-descriptions :column="2" class="desc-box">
  15. <el-descriptions-item label="任务名称">{{ row.taskName }}</el-descriptions-item>
  16. <el-descriptions-item label="任务时间">{{ row.taskTime }}</el-descriptions-item>
  17. <el-descriptions-item label="任务时长">{{ row.taskDuration }}</el-descriptions-item>
  18. <el-descriptions-item label="飞行环境">{{ row.env }}</el-descriptions-item>
  19. <el-descriptions-item label="任务类型">{{ row.taskType }}</el-descriptions-item>
  20. <el-descriptions-item label="任务飞机数量">{{ row.taskAircraftNum }}</el-descriptions-item>
  21. <el-descriptions-item label="任务地点" span="2">{{ row.taskSite }}</el-descriptions-item>
  22. <el-descriptions-item label="任务描述" span="2">{{ row.taskDescribe }}</el-descriptions-item>
  23. </el-descriptions>
  24. </template>
  25. </Card>
  26. </el-col>
  27. </el-row>
  28. <el-row>
  29. <el-col :span="12">
  30. <Card :title="`${model}装备完好率`">
  31. <template slot="content">
  32. <div class="baseBar-box" ref="echartElBarLeft"></div>
  33. </template>
  34. </Card>
  35. </el-col>
  36. <el-col :span="12">
  37. <Card :title="`${model}航材保障良好率`">
  38. <template slot="content">
  39. <div class="baseBar-box" ref="echartElBarRight"></div>
  40. </template>
  41. </Card>
  42. </el-col>
  43. </el-row>
  44. </div>
  45. </template>
  46. <script>
  47. import { getLastMission, getMilitaryIndicatorByTaskId } from '@/api/statisticalAnalysis/statisticalAnalysisSailingMaterialSpareParts'
  48. import * as echarts from 'echarts'
  49. import { leftOption, rightOption } from './index'
  50. import { columns, options } from './table.js'
  51. export default {
  52. name: 'statisticalAnalysisSailingMaterialSpareParts',
  53. components: {},
  54. data() {
  55. // 这里存放数据
  56. return {
  57. tableData: [],
  58. options,
  59. columns: columns(this),
  60. model: '',
  61. row: {},
  62. taskId: '',
  63. leftOption,
  64. rightOption
  65. }
  66. },
  67. mounted() {},
  68. methods: {
  69. async initChart() {
  70. const echartElBarLeft = echarts.init(this.$refs.echartElBarLeft)
  71. const echartElBarRight = echarts.init(this.$refs.echartElBarRight)
  72. const { data } = await getMilitaryIndicatorByTaskId({ taskId: this.taskId })
  73. let xAxisData = []
  74. let guaranteedRatioList = []
  75. let aircraftIntactRatioList = []
  76. data.map((item) => {
  77. xAxisData.push(item.aircaftCatalogCode)
  78. aircraftIntactRatioList.push(item.aircraftIntactRatio)
  79. guaranteedRatioList.push(item.guaranteedRatio)
  80. })
  81. this.leftOption.xAxis[0].data = xAxisData
  82. this.leftOption.series[0].data = aircraftIntactRatioList
  83. this.rightOption.xAxis[0].data = xAxisData
  84. this.rightOption.series[0].data = guaranteedRatioList
  85. echartElBarLeft.setOption(this.leftOption)
  86. echartElBarRight.setOption(this.rightOption)
  87. },
  88. async fetchTableData() {
  89. const { data } = await getLastMission()
  90. this.tableData = data
  91. this.row = this.tableData[0]
  92. this.handleRowClick(this.tableData[0])
  93. },
  94. handleRowClick(row) {
  95. this.row = row
  96. this.taskId = row.taskId
  97. this.model = row.taskName
  98. this.initChart()
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. @import './index.scss';
  105. </style>