<!-- <template>
  <div class="view-table-content">
    <div style="width: 100%">
      <div class="view-dataType-title">
        <div class="view-dataType-title-btn">
          <el-button type="success" @click="openDialog()" :disabled="currentNode && currentNode.type == 0">新增</el-button>
          <el-button type="warning" @click="remove(tableCheckItems)" :disabled="tableCheckItems.length == 0">删除</el-button>
          <el-dropdown split-button type="primary" style="margin-left: 10px" trigger="click" @command="handleExport">
            更多
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="importOperation">导入</el-dropdown-item>
              <el-dropdown-item command="allExport" :disabled="tableData.length == 0">导出</el-dropdown-item>
              <el-dropdown-item command="downloadTemplate">下载数据模板</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
        <div class="view-dataType-title-search">
          <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-input placeholder="请输入关键字" v-model="keyWord" class="input1">
            <el-button slot="append" icon="el-icon-search" @click="searchClick"></el-button>
          </el-input>
        </div>
      </div>
      <div class="view-dataType-table">
        <LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options" :pagination="tableRequset"></LTable>
      </div>
      <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="1200px" :before-close="handleClose">
        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
          <el-row>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="日期" prop="statisticsDate">
                <el-date-picker clearable v-model="form.statisticsDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择日期"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="战区" prop="warZone">
                <el-input v-model="form.warZone" placeholder="请输入战区" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="军" prop="army">
                <el-input v-model="form.army" placeholder="请输入军" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="师" prop="division">
                <el-input v-model="form.division" placeholder="请输入师" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="团" prop="groups">
                <el-input v-model="form.groups" placeholder="请输入团" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="中队" prop="squadron">
                <el-input v-model="form.squadron" placeholder="请输入中队" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="飞机号" prop="aircraftNum">
                <el-input v-model="form.aircraftNum" placeholder="请输入飞机号" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="机型" prop="aircraftModel">
                <el-input v-model="form.aircraftModel" placeholder="请输入机型" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="出厂号码" prop="factoryNum">
                <el-input v-model="form.factoryNum" placeholder="请输入出厂号码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="机件号" prop="machineNum">
                <el-input v-model="form.machineNum" placeholder="请输入机件号" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="机件型别" prop="machineModel">
                <el-input v-model="form.machineModel" placeholder="请输入机件型别" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="机件名称" prop="machineName">
                <el-input v-model="form.machineName" placeholder="请输入机件名称" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="起落" prop="landingGear">
                <el-input v-model="form.landingGear" placeholder="请输入起落" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="专业" prop="major">
                <el-input v-model="form.major" placeholder="请输入专业" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件名称" prop="faultyPartsName">
                <el-input v-model="form.faultyPartsName" placeholder="请输入故障件名称" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件型别" prop="faultyPartsModel">
                <el-input v-model="form.faultyPartsModel" placeholder="请输入故障件型别" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件号码" prop="faultyPartsNum">
                <el-input v-model="form.faultyPartsNum" placeholder="请输入故障件号码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件所属发动机型别" prop="engineModel">
                <el-input v-model="form.engineModel" placeholder="请输入故障件所属发动机型别" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件所属发动机号码" prop="engineNum">
                <el-input v-model="form.engineNum" placeholder="请输入故障件所属发动机号码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件所属发动机号码" prop="engineSerialNum">
                <el-input v-model="form.engineSerialNum" placeholder="请输入故障件所属发动机号码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件位置" prop="faultyPartsPosition">
                <el-input v-model="form.faultyPartsPosition" placeholder="请输入故障件位置" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障现象" prop="faultyPhenomenon">
                <el-input v-model="form.faultyPhenomenon" placeholder="请输入故障现象" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障发生地点" prop="faultyPlace">
                <el-input v-model="form.faultyPlace" placeholder="请输入故障发生地点" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="发现时机" prop="findOpportunity">
                <el-input v-model="form.findOpportunity" placeholder="请输入发现时机" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="系统" prop="systems">
                <el-input v-model="form.systems" placeholder="请输入系统" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件制造厂" prop="faultyPartsManufacturer">
                <el-input v-model="form.faultyPartsManufacturer" placeholder="请输入故障件制造厂" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件翻修厂" prop="faultyPartsRenovate">
                <el-input v-model="form.faultyPartsRenovate" placeholder="请输入故障件翻修厂" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件装本机工作时次" prop="installationTime">
                <el-input v-model="form.installationTime" placeholder="请输入故障件装本机工作时次" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件总工作时次" prop="totalWorkTime">
                <el-input v-model="form.totalWorkTime" placeholder="请输入故障件总工作时次" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件修后时次" prop="repairTime">
                <el-input v-model="form.repairTime" placeholder="请输入故障件修后时次" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件型别" prop="replacementPartsModel">
                <el-input v-model="form.replacementPartsModel" placeholder="请输入故换件型别" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件号码" prop="replacementPartsNum">
                <el-input v-model="form.replacementPartsNum" placeholder="请输入故换件号码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件制造厂" prop="replacementPartsManufacturer">
                <el-input v-model="form.replacementPartsManufacturer" placeholder="请输入故换件制造厂" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件总工作时次" prop="replacementTotalWorkTime">
                <el-input v-model="form.replacementTotalWorkTime" placeholder="请输入故换件总工作时次" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件翻修厂" prop="replacementPartsRenovate">
                <el-input v-model="form.replacementPartsRenovate" placeholder="请输入故换件翻修厂" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故换件修后时次" prop="replacementRepairTime">
                <el-input v-model="form.replacementRepairTime" placeholder="请输入故换件修后时次" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障失常码" prop="faultyAbnormalCode">
                <el-input v-model="form.faultyAbnormalCode" placeholder="请输入故障失常码" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障件装机日期" prop="faultyPartsInstallDate">
                <el-date-picker clearable v-model="form.faultyPartsInstallDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择故障件装机日期"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障原因" prop="faultyReason">
                <el-input v-model="form.faultyReason" placeholder="请输入故障原因" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障性质" prop="faultyNature">
                <el-input v-model="form.faultyNature" placeholder="请输入故障性质" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障责任" prop="faultyResponsibility">
                <el-input v-model="form.faultyResponsibility" placeholder="请输入故障责任" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="故障后果" prop="faultyConsequence">
                <el-input v-model="form.faultyConsequence" placeholder="请输入故障后果" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="处理意见" prop="handlingSuggestions">
                <el-input v-model="form.handlingSuggestions" placeholder="请输入处理意见" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="影响次数" prop="influenceFrequency">
                <el-input v-model="form.influenceFrequency" placeholder="请输入影响次数" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="误飞次数" prop="errorFlyFrequency">
                <el-input v-model="form.errorFlyFrequency" placeholder="请输入误飞次数" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="判明方法" prop="identificationMethod">
                <el-input v-model="form.identificationMethod" placeholder="请输入判明方法" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="发现人" prop="discoveredPeople">
                <el-input v-model="form.discoveredPeople" placeholder="请输入发现人" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排除方法" prop="exclusionMethod">
                <el-input v-model="form.exclusionMethod" placeholder="请输入排除方法" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排故人" prop="exclusionPeople">
                <el-input v-model="form.exclusionPeople" placeholder="请输入排故人" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="审核人" prop="examinePeople">
                <el-input v-model="form.examinePeople" placeholder="请输入审核人" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="审核时间" prop="examineTime">
                <el-date-picker clearable v-model="form.examineTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择审核时间"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排除日期" prop="exclusionDate">
                <el-date-picker clearable v-model="form.exclusionDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择排除日期"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排故工时" prop="exclusionWorkTime">
                <el-input v-model="form.exclusionWorkTime" placeholder="请输入排故工时" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排故人数" prop="exclusionPeopleNum">
                <el-input v-model="form.exclusionPeopleNum" placeholder="请输入排故人数" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="排故时间" prop="exclusionTime">
                <el-input v-model="form.exclusionTime" placeholder="请输入排故时间" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="是否立功" prop="isAchievement">
                <el-input v-model="form.isAchievement" placeholder="请输入是否立功" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="需要试飞" prop="needTestFly">
                <el-input v-model="form.needTestFly" placeholder="请输入需要试飞" />
              </el-form-item>
            </el-col>
            <el-col v-bind="{ span: 12 }">
              <el-form-item label="备注" prop="remarks">
                <el-input v-model="form.remarks" placeholder="请输入备注" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>

        <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="submit">确 定</el-button>
        </span>
      </el-dialog>
      <ImportDialog ref="ImportDialog" @submitCallBack="ImportDialogCallBack" />
    </div>
  </div>
</template> -->

<template>
  <div class="view-carrierFlightMission">
    <div class="view-carrierFlightMission-FlightMission-btn">
      <div class="view-carrierFlightMission-FlightMission-btn-box" style="width: 24%">
        <el-button type="success" @click="openDialog()" :disabled="currentNode && currentNode.type == 0">新增</el-button>
        <el-button type="warning" @click="remove(tableCheckItems)" :disabled="tableCheckItems.length == 0">删除</el-button>
        <el-dropdown split-button type="primary" style="margin-left: 10px" trigger="click" @command="handleExport">
          更多
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="importOperation">导入</el-dropdown-item>
            <el-dropdown-item command="allExport" :disabled="tableData.length == 0">导出</el-dropdown-item>
            <el-dropdown-item command="downloadTemplate">下载数据模板</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <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>
        <!-- <el-input placeholder="请输入关键字" v-model="keyWord" class="input1">
          <el-button slot="append" icon="el-icon-search" @click="searchClick"></el-button>
        </el-input> -->
      </div>
    </div>
    <div class="view-dataType-table">
      <LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options" :pagination="tableRequset"></LTable>
    </div>
    <!-- 添加或修改故障统计对话框 -->
    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="1200px" :before-close="handleClose">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="日期" prop="statisticsDate">
              <el-date-picker clearable v-model="form.statisticsDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择日期"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="战区" prop="warZone">
              <el-input v-model="form.warZone" placeholder="请输入战区" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="军" prop="army">
              <el-input v-model="form.army" placeholder="请输入军" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="师" prop="division">
              <el-input v-model="form.division" placeholder="请输入师" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="团" prop="groups">
              <el-input v-model="form.groups" placeholder="请输入团" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="中队" prop="squadron">
              <el-input v-model="form.squadron" placeholder="请输入中队" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="飞机号" prop="aircraftNum">
              <el-input v-model="form.aircraftNum" placeholder="请输入飞机号" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="机型" prop="aircraftModel">
              <el-input v-model="form.aircraftModel" placeholder="请输入机型" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="出厂号码" prop="factoryNum">
              <el-input v-model="form.factoryNum" placeholder="请输入出厂号码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="机件号" prop="machineNum">
              <el-input v-model="form.machineNum" placeholder="请输入机件号" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="机件型别" prop="machineModel">
              <el-input v-model="form.machineModel" placeholder="请输入机件型别" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="机件名称" prop="machineName">
              <el-input v-model="form.machineName" placeholder="请输入机件名称" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="起落" prop="landingGear">
              <el-input v-model="form.landingGear" placeholder="请输入起落" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="专业" prop="major">
              <el-input v-model="form.major" placeholder="请输入专业" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件名称" prop="faultyPartsName">
              <el-input v-model="form.faultyPartsName" placeholder="请输入故障件名称" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件型别" prop="faultyPartsModel">
              <el-input v-model="form.faultyPartsModel" placeholder="请输入故障件型别" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件号码" prop="faultyPartsNum">
              <el-input v-model="form.faultyPartsNum" placeholder="请输入故障件号码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件所属发动机型别" prop="engineModel">
              <el-input v-model="form.engineModel" placeholder="请输入故障件所属发动机型别" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件所属发动机号码" prop="engineNum">
              <el-input v-model="form.engineNum" placeholder="请输入故障件所属发动机号码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件所属发动机号码" prop="engineSerialNum">
              <el-input v-model="form.engineSerialNum" placeholder="请输入故障件所属发动机号码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件位置" prop="faultyPartsPosition">
              <el-input v-model="form.faultyPartsPosition" placeholder="请输入故障件位置" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障现象" prop="faultyPhenomenon">
              <el-input v-model="form.faultyPhenomenon" placeholder="请输入故障现象" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障发生地点" prop="faultyPlace">
              <el-input v-model="form.faultyPlace" placeholder="请输入故障发生地点" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="发现时机" prop="findOpportunity">
              <el-input v-model="form.findOpportunity" placeholder="请输入发现时机" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="系统" prop="systems">
              <el-input v-model="form.systems" placeholder="请输入系统" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件制造厂" prop="faultyPartsManufacturer">
              <el-input v-model="form.faultyPartsManufacturer" placeholder="请输入故障件制造厂" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件翻修厂" prop="faultyPartsRenovate">
              <el-input v-model="form.faultyPartsRenovate" placeholder="请输入故障件翻修厂" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件装本机工作时次" prop="installationTime">
              <el-input v-model="form.installationTime" placeholder="请输入故障件装本机工作时次" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件总工作时次" prop="totalWorkTime">
              <el-input v-model="form.totalWorkTime" placeholder="请输入故障件总工作时次" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件修后时次" prop="repairTime">
              <el-input v-model="form.repairTime" placeholder="请输入故障件修后时次" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件型别" prop="replacementPartsModel">
              <el-input v-model="form.replacementPartsModel" placeholder="请输入故换件型别" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件号码" prop="replacementPartsNum">
              <el-input v-model="form.replacementPartsNum" placeholder="请输入故换件号码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件制造厂" prop="replacementPartsManufacturer">
              <el-input v-model="form.replacementPartsManufacturer" placeholder="请输入故换件制造厂" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件总工作时次" prop="replacementTotalWorkTime">
              <el-input v-model="form.replacementTotalWorkTime" placeholder="请输入故换件总工作时次" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件翻修厂" prop="replacementPartsRenovate">
              <el-input v-model="form.replacementPartsRenovate" placeholder="请输入故换件翻修厂" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故换件修后时次" prop="replacementRepairTime">
              <el-input v-model="form.replacementRepairTime" placeholder="请输入故换件修后时次" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障失常码" prop="faultyAbnormalCode">
              <el-input v-model="form.faultyAbnormalCode" placeholder="请输入故障失常码" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障件装机日期" prop="faultyPartsInstallDate">
              <el-date-picker clearable v-model="form.faultyPartsInstallDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择故障件装机日期"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障原因" prop="faultyReason">
              <el-input v-model="form.faultyReason" placeholder="请输入故障原因" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障性质" prop="faultyNature">
              <el-input v-model="form.faultyNature" placeholder="请输入故障性质" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障责任" prop="faultyResponsibility">
              <el-input v-model="form.faultyResponsibility" placeholder="请输入故障责任" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="故障后果" prop="faultyConsequence">
              <el-input v-model="form.faultyConsequence" placeholder="请输入故障后果" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="处理意见" prop="handlingSuggestions">
              <el-input v-model="form.handlingSuggestions" placeholder="请输入处理意见" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="影响次数" prop="influenceFrequency">
              <el-input v-model="form.influenceFrequency" placeholder="请输入影响次数" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="误飞次数" prop="errorFlyFrequency">
              <el-input v-model="form.errorFlyFrequency" placeholder="请输入误飞次数" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="判明方法" prop="identificationMethod">
              <el-input v-model="form.identificationMethod" placeholder="请输入判明方法" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="发现人" prop="discoveredPeople">
              <el-input v-model="form.discoveredPeople" placeholder="请输入发现人" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排除方法" prop="exclusionMethod">
              <el-input v-model="form.exclusionMethod" placeholder="请输入排除方法" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排故人" prop="exclusionPeople">
              <el-input v-model="form.exclusionPeople" placeholder="请输入排故人" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="审核人" prop="examinePeople">
              <el-input v-model="form.examinePeople" placeholder="请输入审核人" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="审核时间" prop="examineTime">
              <el-date-picker clearable v-model="form.examineTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择审核时间"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排除日期" prop="exclusionDate">
              <el-date-picker clearable v-model="form.exclusionDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择排除日期"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排故工时" prop="exclusionWorkTime">
              <el-input v-model="form.exclusionWorkTime" placeholder="请输入排故工时" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排故人数" prop="exclusionPeopleNum">
              <el-input v-model="form.exclusionPeopleNum" placeholder="请输入排故人数" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="排故时间" prop="exclusionTime">
              <el-input v-model="form.exclusionTime" placeholder="请输入排故时间" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="是否立功" prop="isAchievement">
              <el-input v-model="form.isAchievement" placeholder="请输入是否立功" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="需要试飞" prop="needTestFly">
              <el-input v-model="form.needTestFly" placeholder="请输入需要试飞" />
            </el-form-item>
          </el-col>
          <el-col v-bind="{ span: 12 }">
            <el-form-item label="备注" prop="remarks">
              <el-input v-model="form.remarks" placeholder="请输入备注" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 导入 -->
    <ImportDialog ref="ImportDialog" @submitCallBack="ImportDialogCallBack" />
  </div>
</template>

<script>
import { getFaultStatistics, getFaultStatisticsListAll, getAircaftTypeAndModelTree, addFaultStatistics, updateFaultStatistics, removeFaultStatistics, downLoadFaultStatistics, exportFaultStatisticsExcel } from '@/api/als/faultStatistics'
import { deepClone, debounce } from '@/utils/index'
import ImportDialog from './importDialog/index.vue'
export default {
  name: 'FaultStatistics',
  components: { ImportDialog },
  data() {
    // 这里存放数据
    return {
      dialogTitle: '新增',
      dialogVisible: false,
      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: '',
      columns: [
        { prop: 'id', label: '编号' },
        {
          prop: 'statisticsDate',
          label: '日期'
        },
        {
          prop: 'warZone',
          label: '战区'
        },
        {
          prop: 'army',
          label: '军'
        },
        {
          prop: 'division',
          label: '师'
        },
        {
          prop: 'groups',
          label: '团'
        },
        {
          prop: 'squadron',
          label: '中队'
        },
        {
          prop: 'aircraftNum',
          label: '飞机号'
        },
        {
          prop: 'aircraftModel',
          label: '机型'
        },
        {
          prop: 'factoryNum',
          label: '出厂号码'
        },
        {
          prop: 'machineType',
          label: '机件类型'
        },
        {
          prop: 'machineNum',
          label: '机件号'
        },
        {
          prop: 'machineModel',
          label: '机件型别'
        },
        {
          prop: 'machineName',
          label: '机件名称'
        },
        {
          prop: 'landingGear',
          label: '起落'
        },
        {
          prop: 'major',
          label: '专业'
        },
        {
          prop: 'faultyPartsName',
          label: '故障件名称'
        },
        {
          prop: 'faultyPartsModel',
          label: '故障件型别'
        },
        {
          prop: 'faultyPartsNum',
          label: '故障件号码'
        },
        {
          prop: 'engineModel',
          label: '故障件所属发动机型别'
        },
        {
          prop: 'engineNum',
          label: '故障件所属发动机号码'
        },
        {
          prop: 'engineSerialNum',
          label: '故障件所属发动机号码'
        },
        {
          prop: 'faultyPartsPosition',
          label: '故障件位置'
        },
        {
          prop: 'faultyPhenomenon',
          label: '故障现象'
        },
        {
          prop: 'faultyPlace',
          label: '故障发生地点'
        },
        {
          prop: 'findOpportunity',
          label: '发现时机'
        },
        {
          prop: 'systems',
          label: '系统'
        },
        {
          prop: 'timingType',
          label: '计时类型'
        },
        {
          prop: 'faultyPartsManufacturer',
          label: '故障件制造厂'
        },
        {
          prop: 'faultyPartsRenovate',
          label: '故障件翻修厂'
        },
        {
          prop: 'installationTime',
          label: '故障件装本机工作时次'
        },
        {
          prop: 'totalWorkTime',
          label: '故障件总工作时次'
        },
        {
          prop: 'repairTime',
          label: '故障件修后时次'
        },
        {
          prop: 'replacementPartsModel',
          label: '故换件型别'
        },
        {
          prop: 'replacementPartsNum',
          label: '故换件号码'
        },
        {
          prop: 'replacementPartsManufacturer',
          label: '故换件制造厂'
        },
        {
          prop: 'replacementTotalWorkTime',
          label: '故换件总工作时次'
        },
        {
          prop: 'replacementPartsRenovate',
          label: '故换件翻修厂'
        },
        {
          prop: 'replacementRepairTime',
          label: '故换件修后时次'
        },
        {
          prop: 'faultyAbnormalCode',
          label: '故障失常码'
        },
        {
          prop: 'faultyPartsInstallDate',
          label: '故障件装机日期'
        },
        {
          prop: 'faultyReason',
          label: '故障原因'
        },
        {
          prop: 'faultyNature',
          label: '故障性质'
        },
        {
          prop: 'faultyResponsibility',
          label: '故障责任'
        },
        {
          prop: 'faultyConsequence',
          label: '故障后果'
        },
        {
          prop: 'handlingSuggestions',
          label: '处理意见'
        },
        {
          prop: 'influenceFrequency',
          label: '影响次数'
        },
        {
          prop: 'errorFlyFrequency',
          label: '误飞次数'
        },
        {
          prop: 'identificationMethod',
          label: '判明方法'
        },
        {
          prop: 'discoveredPeople',
          label: '发现人'
        },
        {
          prop: 'exclusionMethod',
          label: '排除方法'
        },
        {
          prop: 'exclusionPeople',
          label: '排故人'
        },
        {
          prop: 'examinePeople',
          label: '审核人'
        },
        {
          prop: 'examineTime',
          label: '审核时间'
        },
        {
          prop: 'exclusionDate',
          label: '排除日期'
        },
        {
          prop: 'exclusionWorkTime',
          label: '排故工时'
        },
        {
          prop: 'exclusionPeopleNum',
          label: '排故人数'
        },
        {
          prop: 'exclusionTime',
          label: '排故时间'
        },
        {
          prop: 'isAchievement',
          label: '是否立功'
        },
        {
          prop: 'needTestFly',
          label: '需要试飞'
        },
        {
          button: true,
          label: '操作',
          width: '240px',
          group: [
            {
              name: '编辑',
              type: 'text',
              round: false,
              plain: false,
              onClick: (row, index, scope) => {
                this.handUpdate(row)
              }
            },
            {
              name: '删除',
              type: 'text',
              round: false,
              plain: false,
              onClick: (row, index, scope) => {
                this.remove([row])
              }
            }
          ]
        }
      ],
      options: {
        stripe: true, // 斑马纹
        mutiSelect: true, // 多选框
        index: false, // 显示序号， 多选则 mutiSelect
        loading: false, // 表格动画
        initTable: false, // 是否一挂载就加载数据
        border: true,
        height: 'calc(100vh - 300px)'
      },
      tableCheckItems: [],
      tableData: [],
      tableRequset: {
        total: 0,
        pageIndex: 1,
        pageSize: 10,
        searchValue: ''
      },
      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: ''
      },
      rules: {
        statisticsDate: [{ required: true, message: '日期不能为空', trigger: 'blur' }],
        installationTime: [{ required: true, message: '故障件装本机工作时次不能为空', trigger: 'blur' }],
        totalWorkTime: [{ required: true, message: '故障件总工作时次不能为空', trigger: 'blur' }]
      },
      debounceFn: debounce(this.fetch, 500)
    }
  },
  watch: {
    keyWord() {
      this.tableRequset.pageIndex = 1
      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 })
      }
    },

    async removeFaultStatisticsAPI(params) {
      try {
        const { code } = await removeFaultStatistics(params)
        if (code === 200) {
          this.$message({
            type: 'success',
            message: '操作成功!'
          })
          await this.getFaultStatisticsAPI()
          this.handleClose()
        }
      } catch (error) {}
    },

    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
    },

    async getFaultStatisticsAPI(params) {
      if (this.$refs.table) this.$refs.table.clearSelection()
      const { keyWord } = this
      const { pageSize, pageIndex } = this.tableRequset
      const {
        data: { list, total }
      } = await getFaultStatistics({ pageSize, pageNum: pageIndex, keyWord, ...params })
      this.tableData = list
      this.tableRequset.total = total
      this.getFaultStatisticsListAll({ distinctField: 'groups' })
      this.getFaultStatisticsListAll({ distinctField: 'major' })
      this.getFaultStatisticsListAll({ distinctField: 'aircraft_model' })
      this.getFaultStatisticsListAll({ distinctField: 'aircraft_num' })
      this.getFaultStatisticsListAll({ distinctField: 'faulty_parts_name' })
    },

    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)
    },

    async addFaultStatisticsAPI() {
      this.$refs['form'].validate(async (valid) => {
        if (valid) {
          try {
            delete this.form.aircaftModelName
            const { code } = await addFaultStatistics({ ...this.form })
            if (code === 200) {
              this.$message({
                type: 'success',
                message: '操作成功!'
              })
              this.getFaultStatisticsAPI()
              this.handleClose()
            }
          } catch (error) {}
        }
      })
    },

    async updateFaultStatisticsAPI() {
      this.$refs['form'].validate(async (valid) => {
        if (valid) {
          try {
            const { code } = await updateFaultStatistics({ ...this.form })
            if (code === 200) {
              this.$message({
                type: 'success',
                message: '操作成功!'
              })
              this.getFaultStatisticsAPI()
              this.handleClose()
            }
          } catch (error) {}
        }
      })
    },

    treeNodeClick(data) {
      this.$refs.table.clearSelection()
      this.currentNodeKey = data.id
      this.currentNode = data
      this.aircaftModelIdList = this.getTreeLeafData(data.children.length ? data.children : [data]).map((e) => e.id)
      this.getFaultStatisticsAPI()
    },

    openDialog() {
      this.dialogTitle = '新增'
      this.dialogVisible = true
      this.form.aircaftModelName = this.currentNode.label
      this.form.aircaftModelId = this.currentNode.id
    },

    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: ''
      }
    },

    handUpdate(row) {
      this.dialogTitle = '编辑'
      this.form = deepClone(row)
      this.dialogVisible = true
    },

    submit() {
      switch (this.dialogTitle) {
        case '编辑':
          this.updateFaultStatisticsAPI()
          // this.handleClose()
          break
        case '新增':
          this.addFaultStatisticsAPI()
          // this.handleClose()
          break
      }
    },

    selection(val) {
      this.tableCheckItems = val
    },

    remove(row) {
      this.$confirm('是否删除该机种', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.removeFaultStatisticsAPI(row.map((e) => e.id))
        })
        .catch(() => {})
    },
    //更多按钮
    handleExport(type) {
      this[type]()
    },
    //导入
    importOperation() {
      this.$refs.ImportDialog.triggerDialog()
    },
    //导入回写
    ImportDialogCallBack() {
      this.getFaultStatisticsAPI()
    },
    //导出全部
    async allExport() {
      // const params = {
      //   queryParam: this.searchValue
      // }
      await exportFaultStatisticsExcel({})
    },
    //下载模板
    async downloadTemplate() {
      await downLoadFaultStatistics()
    }
  }
}
</script>

<style lang="scss">
@import '../index.scss';
</style>
