123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <template>
- <div class="view-carrierFlightMission">
- <div class="view-carrierFlightMission-FlightMission-btn">
- <div class="view-carrierFlightMission-FlightMission-btn-right">
- <div class="input-with-select">
- <span>日期</span>
- <el-date-picker type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" v-model="statisticsDate" placeholder="选择日期"> </el-date-picker>
- </div>
- <div class="input-with-select">
- <span>地区</span>
- <el-select v-model="select.groups" placeholder="请选择">
- <el-option v-for="item in groupsList" :key="item.groups" :label="item.groups" :value="item.groups"> </el-option>
- </el-select>
- </div>
- <div class="input-with-select">
- <span>专业</span>
- <el-select v-model="select.major" placeholder="请选择">
- <el-option v-for="item in majorList" :key="item.major" :label="item.major" :value="item.major"> </el-option>
- </el-select>
- </div>
- <div class="input-with-select">
- <span>机型</span>
- <el-select v-model="select.aircraftModel" placeholder="请选择" @change="getFaultStatisticsListAll({ distinctField: 'aircraft_num' })">
- <el-option v-for="item in aircraftModelList" :key="item.aircraftModel" :label="item.aircraftModel" :value="item.aircraftModel"> </el-option>
- </el-select>
- </div>
- <div class="input-with-select">
- <span>机号</span>
- <el-select v-model="select.aircraftNum" placeholder="请选择">
- <el-option v-for="item in aircraftNumList" :key="item.aircraftNum" :label="item.aircraftNum" :value="item.aircraftNum"> </el-option>
- </el-select>
- </div>
- <div class="input-with-select">
- <span>部件</span>
- <el-select v-model="select.faultyPartsName" placeholder="请选择">
- <el-option v-for="item in faultyPartsNameList" :key="item.faultyPartsName" :label="item.faultyPartsName" :value="item.faultyPartsName"> </el-option>
- </el-select>
- </div>
- <el-button @click="searchClick" style="border-color: rgb(13, 128, 164); background-color: rgb(13, 128, 164); color: #fff">查询</el-button>
- </div>
- </div>
- <div class="view-dataType-table">
- <el-row>
- <el-col :span="12">
- <Card title="故障件数量统计图">
- <template slot="content">
- <div class="baseBar-box" ref="echartLeft"></div>
- </template>
- </Card>
- </el-col>
- <el-col :span="12">
- <Card title="故障件数量统计图">
- <template slot="content">
- <div class="baseBar-box" ref="echartRight"></div>
- </template>
- </Card>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <script>
- import { getFaultStatisticsListAll, getAircaftTypeAndModelTree, removeFaultStatistics, getFaultStatisticsEcharts } from '@/api/als/faultStatistics'
- import { debounce } from '@/utils/index'
- import * as echarts from 'echarts'
- export default {
- name: 'FaultStatistics',
- data() {
- // 这里存放数据
- return {
- keyWord: '',
- aircaftModelIdList: [],
- currentNodeKey: null,
- currentNode: null,
- menuTreeData: [],
- treeObj: {
- title: '所属机种',
- activityheight: '275px',
- searchIcon: false,
- configure: {
- children: 'children',
- label: 'label'
- }
- },
- groupsList: [],
- majorList: [],
- aircraftModelList: [],
- aircraftNumList: [],
- faultyPartsNameList: [],
- statisticsDate: [],
- select: {
- startStatisticsDate: '',
- endStatisticsDate: '',
- major: '特设',
- aircraftModel: 'J-11'
- },
- typeTree: {
- children: 'children',
- label: 'label'
- },
- searchValue: '',
- options: {
- stripe: true, // 斑马纹
- mutiSelect: true, // 多选框
- index: false, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: 'calc(100vh - 300px)'
- },
- tableCheckItems: [],
- form: {
- id: '',
- statisticsDate: '',
- warZone: '',
- army: '',
- division: '',
- groups: '',
- squadron: '',
- aircraftNum: '',
- aircraftModel: '',
- factoryNum: '',
- machineType: '',
- machineNum: '',
- machineModel: '',
- machineName: '',
- landingGear: '',
- major: '',
- faultyPartsName: '',
- faultyPartsModel: '',
- faultyPartsNum: '',
- engineModel: '',
- engineNum: '',
- engineSerialNum: '',
- faultyPartsPosition: '',
- faultyPhenomenon: '',
- faultyPlace: '',
- findOpportunity: '',
- systems: '',
- timingType: '',
- faultyPartsManufacturer: '',
- faultyPartsRenovate: '',
- installationTime: '',
- totalWorkTime: '',
- repairTime: '',
- replacementPartsModel: '',
- replacementPartsNum: '',
- replacementPartsManufacturer: '',
- replacementTotalWorkTime: '',
- replacementPartsRenovate: '',
- replacementRepairTime: '',
- faultyAbnormalCode: '',
- faultyPartsInstallDate: '',
- faultyReason: '',
- faultyNature: '',
- faultyResponsibility: '',
- faultyConsequence: '',
- handlingSuggestions: '',
- influenceFrequency: '',
- errorFlyFrequency: '',
- identificationMethod: '',
- discoveredPeople: '',
- exclusionMethod: '',
- exclusionPeople: '',
- examinePeople: '',
- examineTime: '',
- exclusionDate: '',
- exclusionWorkTime: '',
- exclusionPeopleNum: '',
- exclusionTime: '',
- isAchievement: '',
- needTestFly: '',
- repairStatus: '',
- remarks: '',
- tenantId: '',
- delFlag: '',
- version: '',
- createBy: '',
- createTime: '',
- updateBy: '',
- updateTime: ''
- },
- debounceFn: debounce(this.fetch, 500)
- }
- },
- watch: {
- keyWord() {
- this.debounceFn()
- }
- },
- mounted() {
- this.getFaultStatisticsAPI()
- // this.getAircaftTypeAndModelTreeAPI()
- },
- methods: {
- async getFaultStatisticsListAll(params) {
- if (params.distinctField == 'aircraft_num') {
- params.aircraftModel = this.select.aircraftModel
- }
- const { data } = await getFaultStatisticsListAll({ ...params })
- if (params.distinctField == 'groups') {
- this.groupsList = data
- } else if (params.distinctField == 'major') {
- this.majorList = data
- } else if (params.distinctField == 'aircraft_model') {
- this.aircraftModelList = data
- } else if (params.distinctField == 'aircraft_num') {
- this.aircraftNumList = data
- } else if (params.distinctField == 'faulty_parts_name') {
- this.faultyPartsNameList = data
- }
- },
- async getAircaftTypeAndModelTreeAPI(params) {
- const { data } = await getAircaftTypeAndModelTree(params)
- this.menuTreeData = data
- if (data.length) {
- this.currentNodeKey = data[0].value
- this.currentNode = data[0]
- this.aircaftModelIdList = this.getTreeLeafData(data[0]?.children).map((e) => e.id)
- this.getFaultStatisticsAPI({ aircaftModelIdList: this.aircaftModelIdList })
- }
- },
- getTreeLeafData(list) {
- const newArr = []
- function getLeaf(data, arr) {
- data.forEach((e) => {
- if (e.type === 1) {
- arr.push(e)
- }
- if (e.children.length) {
- getLeaf(e.children, arr)
- }
- })
- }
- getLeaf(list, newArr)
- return newArr
- },
- echartsLeft(names, values) {
- const echartLeft = echarts.init(this.$refs.echartLeft)
- const option = {
- tooltip: {
- trigger: 'item'
- },
- xAxis: {
- axisLabel: {
- color: '#fff'
- },
- type: 'category',
- data: names
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- color: '#fff'
- }
- },
- series: [
- {
- data: values,
- type: 'bar'
- }
- ]
- }
- echartLeft.setOption(option)
- },
- echartsRight(values) {
- const echartRight = echarts.init(this.$refs.echartRight)
- const option = {
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left',
- textStyle: {
- color: '#fff'
- }
- },
- series: [
- {
- name: 'Access From',
- type: 'pie',
- radius: '50%',
- label: {
- color: '#fff'
- },
- data: values,
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- }
- echartRight.setOption(option)
- },
- async getFaultStatisticsAPI(params) {
- const { keyWord } = this
- const res = await getFaultStatisticsEcharts({ keyWord, ...params })
- this.getFaultStatisticsListAll({ distinctField: 'groups' })
- this.getFaultStatisticsListAll({ distinctField: 'major' })
- this.getFaultStatisticsListAll({ distinctField: 'aircraft_model' })
- this.getFaultStatisticsListAll({ distinctField: 'aircraft_num' })
- this.getFaultStatisticsListAll({ distinctField: 'faulty_parts_name' })
- const names = []
- const values = []
- const data = []
- res.data.forEach((e) => {
- names.push(e.faultyPartsName)
- values.push(e.nameCount)
- data.push({
- name: e.faultyPartsName,
- value: e.nameCount
- })
- })
- this.echartsLeft(names, values)
- this.echartsRight(data)
- },
- fetch() {
- this.getFaultStatisticsAPI()
- },
- searchClick() {
- console.log(this.statisticsDate)
- if (this.statisticsDate != null) {
- this.select.startStatisticsDate = this.statisticsDate[0]
- this.select.endStatisticsDate = this.statisticsDate[1]
- }
- this.getFaultStatisticsAPI(this.select)
- },
- handleClose() {
- this.dialogVisible = false
- this.form = {
- id: '',
- statisticsDate: '',
- warZone: '',
- army: '',
- division: '',
- groups: '',
- squadron: '',
- aircraftNum: '',
- aircraftModel: '',
- factoryNum: '',
- machineType: '',
- machineNum: '',
- machineModel: '',
- machineName: '',
- landingGear: '',
- major: '',
- faultyPartsName: '',
- faultyPartsModel: '',
- faultyPartsNum: '',
- engineModel: '',
- engineNum: '',
- engineSerialNum: '',
- faultyPartsPosition: '',
- faultyPhenomenon: '',
- faultyPlace: '',
- findOpportunity: '',
- systems: '',
- timingType: '',
- faultyPartsManufacturer: '',
- faultyPartsRenovate: '',
- installationTime: '',
- totalWorkTime: '',
- repairTime: '',
- replacementPartsModel: '',
- replacementPartsNum: '',
- replacementPartsManufacturer: '',
- replacementTotalWorkTime: '',
- replacementPartsRenovate: '',
- replacementRepairTime: '',
- faultyAbnormalCode: '',
- faultyPartsInstallDate: '',
- faultyReason: '',
- faultyNature: '',
- faultyResponsibility: '',
- faultyConsequence: '',
- handlingSuggestions: '',
- influenceFrequency: '',
- errorFlyFrequency: '',
- identificationMethod: '',
- discoveredPeople: '',
- exclusionMethod: '',
- exclusionPeople: '',
- examinePeople: '',
- examineTime: '',
- exclusionDate: '',
- exclusionWorkTime: '',
- exclusionPeopleNum: '',
- exclusionTime: '',
- isAchievement: '',
- needTestFly: '',
- repairStatus: '',
- remarks: '',
- tenantId: '',
- delFlag: '',
- version: '',
- createBy: '',
- createTime: '',
- updateBy: '',
- updateTime: ''
- }
- }
- }
- }
- </script>
- <style lang="scss">
- @import '../index.scss';
- </style>
|