<template>
  <div class="app-container">
    <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
      <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
      <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
    </div>
    <el-tabs v-model="tabName" @tab-click="handleTabClick">
      <el-tab-pane v-if="isBasic" label="设备基础信息" name="first">
        <div class="filter-container">
          <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 120px;" @change="changePastureName">
            <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
          </el-select>
          <tree-select
            v-model="getdataListParm.parammaps.eqClassId"
            :height="150"
            :width="250"
            class="typeSelect"
            size="small"
            :data="parentClass"
            :default-props="defaultProps"
            :node-key="nodeKey"
            clearable
            :disabled="disabled"
            placeholder="请选择设备类别"
            :checked-keys="defaultCheckedKeys"
            style="display: inline-block;"
            @popoverHide="popoverHide"
          />
          <el-input v-model="getdataListParm.parammaps.eqName" placeholder="设备名称" clearable style="width: 120px;" class="filter-item" />
          <el-input v-model="getdataListParm.parammaps.eqCode" placeholder="设备内部编号" clearable style="width: 150px;" class="filter-item" />
          <el-input v-model="getdataListParm.parammaps.financeCode" placeholder="财务编号" clearable style="width: 120px;" class="filter-item" />
          <el-select v-model="getdataListParm.parammaps.departmentId" clearable placeholder="部门" class="filter-item" style="width: 120px;">
            <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-select v-model="getdataListParm.parammaps.status" clearable placeholder="状态" class="filter-item" style="width: 120px;">
            <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.id" />
          </el-select>
          <el-select v-model="getdataListParm.parammaps.warning" clearable placeholder="折旧预警" class="filter-item" style="width: 120px;">
            <el-option v-for="item in depreciationAlertList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <!-- <el-date-picker ref="inputDatetime1" v-model="getdataListParm.parammaps.inputDatetime1" class="inputDatetime" type="daterange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="审批日期" end-placeholder="审批日期" /> -->
          <el-date-picker ref="inputDatetime2" v-model="getdataListParm.parammaps.inputDatetime2" class="inputDatetime" type="daterange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="购置日期" end-placeholder="购置日期" />
          <!-- <el-date-picker ref="inputDatetime3" v-model="getdataListParm.parammaps.inputDatetime3" class="inputDatetime" type="daterange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="报废日期" end-placeholder="报废日期" /> -->

          <el-input v-model="getdataListParm.parammaps.assetCode" placeholder="资产编号" clearable style="width: 120px;" class="filter-item" />
          <el-input v-model="getdataListParm.parammaps.brand" placeholder="品牌" clearable style="width: 120px;" class="filter-item" />
          <!-- <el-input v-model="getdataListParm.parammaps.proName" placeholder="供应商" clearable style="width: 120px;" class="filter-item" /> -->


          <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
          <div>
            <el-button v-if="isBasicsAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>


            <el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
              <el-button  v-waves class="filter-item" type="warning" icon="el-icon-upload2">导入</el-button>
            </el-upload>

            <el-button class="filter-item" type="success" icon="el-icon-download" style="" @click="handleDownload">导出</el-button>
            <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleBatchChange">批量变更</el-button>
          </div>
          <el-table
            :key="tableKey"
            v-loading="listLoading"
            element-loading-text="给我一点时间"
            :data="list"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable"
            @selection-change="handleSelectionChange"
            @sort-change="tableSort2"
            :max-height="myHeight"
          >
            <el-table-column type="selection" width="55" />
            <el-table-column label="序号" align="center" type="index" width="50px">
              <template slot-scope="scope">
                <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column label="牧场" align="center" prop="pastureName" />
            <el-table-column label="设备类别" align="center" prop="eqClassName" />
            <el-table-column label="设备名称" align="center" prop="eqName" />
            <el-table-column label="设备内部编号" align="center" prop="eqCode" />
           <el-table-column label="财务编号" align="center" prop="financeCode" />
            <el-table-column label="规格" align="center" prop="specification" />
            <el-table-column label="品牌" align="center" prop="brandName" />
            <el-table-column label="状态" align="center" prop="status">
              <template slot-scope="{row}">
                <div v-if="row.status == '正常'">
                  <div v-if="row.warning == 1" style="background:#EC808D;display:block;line-height: 50px;">{{ row.status }}</div>
                  <div v-else-if="row.warning == 2" style="background:#FACD91;display:block;line-height: 50px;">{{ row.status }}</div>
                  <div v-else>{{ row.status }}</div>
                </div>
                <div v-else>
                  <div style="background:#D7D7D7;display:block;line-height: 50px;">{{ row.status }}</div>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="用途"   align="center" prop="purpose" />
            <el-table-column label="部门" align="center" prop="deptName" />
            <el-table-column label="责任人" align="center" prop="employeName" />
            <el-table-column label="审批日期" sortable align="center" prop="spDate" />
            <el-table-column label="购置日期" sortable align="center" prop="purchaseDate" />
            <el-table-column label="入场日期" sortable align="center" prop="entranceDate" />
            <el-table-column label="报废日期" sortable align="center" prop="bfDate" />
            <el-table-column label="设备图片" prop="picpath" align="center" min-width="110px">
              <template slot-scope="scope">
                <el-popover placement="right" title="" trigger="hover">
                  <img v-if="scope.row.picpath !== '' && scope.row.srcpath !== ''" :src="scope.row.picpath">
                  <img v-if="scope.row.picpath !== '' && scope.row.srcpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
                </el-popover>
              </template>
            </el-table-column>
            <el-table-column label="折旧年限" sortable align="center" prop="depreciation" />
            <el-table-column label="使用时长(年)" sortable align="center" prop="serviceDuration" />
            <el-table-column label="使用率(%)" sortable align="center" prop="utilizationRate" />

            <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
              <template slot-scope="{row}">
                <el-button v-if="isBasicsCard" type="primary" size="mini" @click="form_see(row)">查看</el-button>
                <el-button type="success" size="mini" v-if="roleSet1(row)"  @click="form_edit(row)">编辑</el-button>
                <el-button v-if="roleSet2(row)" style="display:inline-block" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
                <!-- <el-button v-if="isBasicsDel2" style="display:inline-block" type="danger" size="mini" @click="form_delete(row)">删除</el-button> -->
                <el-button v-else style="display:none" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="total>=0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
        </div>
      </el-tab-pane>
      <el-tab-pane v-if="isBasicSH" label="审核设备" name="second">
        <div class="filter-container">
          <el-select v-model="getdataListParmSH.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 120px;">
            <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
          </el-select>
          <el-input v-model="getdataListParmSH.parammaps.assetCode" placeholder="资产编号" clearable style="width: 180px;" class="filter-item" />
          <el-input v-model="getdataListParmSH.parammaps.eqName" placeholder="设备名称" clearable style="width: 120px;" class="filter-item" />
          <el-input v-model="getdataListParmSH.parammaps.eqCode" placeholder="设备内部编号" clearable style="width: 150px;" class="filter-item" />
          <el-input v-model="getdataListParmSH.parammaps.financeCode" placeholder="财务编码" clearable style="width: 120px;" class="filter-item" />
          <el-select v-model="getdataListParmSH.parammaps.departmentId" clearable placeholder="部门" class="filter-item" style="width: 120px;">
            <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-select v-model="getdataListParmSH.parammaps.status" clearable placeholder="状态" class="filter-item" style="width: 120px;">
            <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.id" />
          </el-select>
          <el-select v-model="getdataListParmSH.parammaps.SHStatus" clearable placeholder="审核状态" class="filter-item" style="width: 120px;">
            <el-option v-for="item in statues" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-date-picker ref="inputDatetime1" v-model="getdataListParmSH.parammaps.inputDatetime1" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
          <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchSH">搜索</el-button>
          <div>
            <el-button class="filter-item" type="success" icon="el-icon-download" style="" @click="handleDownloadSH">导出</el-button>
          </div>
          <el-table
            :key="tableKey"
            v-loading="listLoadingSH"
            element-loading-text="给我一点时间"
            :data="listSH"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable"
            :max-height="myHeight"
          >
            <el-table-column label="序号" align="center" type="index" width="50px">
              <template slot-scope="scope">
                <span>{{ scope.$index + (pageNumSH-1) * pageSizeSH + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column label="牧场" align="center" prop="pastureName" />
            <el-table-column label="资产编号" align="center" prop="assetCode" />
            <el-table-column label="设备名称" align="center" prop="eqName" />
            <el-table-column label="设备内部编号" align="center" prop="eqCode" />
            <el-table-column label="财务编号" align="center" prop="financeCode" />
            <el-table-column label="规格" align="center" prop="specification" />
            <el-table-column label="品牌" align="center" prop="brandName" />
            <el-table-column label="状态" align="center" prop="status" />
            <el-table-column label="部门" align="center" prop="deptName" />
            <el-table-column label="责任人" align="center" prop="employeName" />
            <el-table-column label="录入日期" sortable align="center" prop="lrTime" />
            <el-table-column label="审核状态" min-width="110px" align="center" :formatter="SHStatus" />
            <el-table-column label="设备图片" prop="specifications" align="center" min-width="110px">
              <template slot-scope="scope">
                <el-popover placement="right" title="" trigger="hover">
                  <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
                  <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
                </el-popover>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
              <template slot-scope="{row}">
                <el-button v-if="isBasicsCard" type="primary" size="mini" @click="form_see(row)">查看</el-button>
                <el-button v-if="isBasicsUpdate && row.SHStatus == 2" style="display:inline-block" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
                <el-button v-else style="display:none" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
                <el-button v-if="isBasicExamine && row.SHStatus == 0" style="display:inline-block" type="success" size="mini" @click="handleExamine(row)">审核</el-button>
                <el-button v-else style="display:none" type="success" size="mini" @click="handleExamine(row)">审核</el-button>
                <el-button v-if="isBasicsDel && row.SHStatus == 2" style="display:inline-block" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
                <el-button v-else style="display:none" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="totalSH>=0" :total="totalSH" :page.sync="getdataListParmSH.offset" :limit.sync="getdataListParmSH.pagecount" @pagination="get_table_dataSH" />
        </div>
      </el-tab-pane>
    </el-tabs>

    <!-- 新增 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"  v-show = "dialogFormVisible" :close-on-click-modal="false" width="90%">
      <div class="app-add">
        <el-form ref="createTemp" :rules="rulesCreate" :model="createTemp" label-position="right" label-width="115px" style="width: 90%;margin:0 auto 30px">
          <el-row>
            <el-col :span="10">
              <el-form-item label="设备类别:" prop="eqClassId">
                <tree-select
                  v-model="createTemp.eqClassId"
                  :height="200"
                  :width="300"
                  size="small"
                  :data="parentClass"
                  :default-props="defaultProps"
                  :node-key="nodeKey"
                  :disabled="disabled"
                  :placeholder="placeholder"
                  :checked-keys="defaultCheckedKeys"
                  @popoverHide="popoverHide"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="资产编号:" prop="assetCode">
                <el-input ref="assetCode" v-model="createTemp.assetCode" placeholder="请输入编号" disabled   />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="设备名称:" prop="eqName">
                <el-input ref="eqName" v-model="createTemp.eqName" placeholder="请输入设备名称"  disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="设备内部编号:" prop="eqCode">
                <el-input ref="eqCode" v-model="createTemp.eqCode" placeholder="请输入设备内部编号" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="财务编号:" prop="financeCode">
                <el-input ref="financeCode" v-model="createTemp.financeCode" placeholder="请输入财务编号" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="设备规格:" prop="specification">
                <el-input ref="specification" v-model="createTemp.specification" placeholder="请输入设备规格" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="品牌:" prop="brandName">
                <el-autocomplete v-model="createTemp.brandName" value-key="brandName" class="inline-input" :fetch-suggestions="brandSearch" placeholder="请输入品牌" style="width:100%;" @select="(value)=> {handleSelectBrand(value)}" />
              </el-form-item>
            </el-col>
            <!-- <el-col :span="6">
              <el-form-item label="供应商:" prop="providerId">
                <el-select v-model="createTemp.providerId" filterable placeholder="请选择供应商" style="width:100%">
                  <el-option v-for="item in findAllProvider" :key="item.id" clearable :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col> -->
            <el-col :span="6">
              <el-form-item label="用途:" prop="purpose">
                <el-input ref="purpose" v-model="createTemp.purpose" placeholder="请输入用途" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="状态:" prop="status">
                <el-select v-model="createTemp.status" placeholder="状态" class="filter-item">
                  <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="购置日期:" prop="purchaseDate">
                <el-date-picker v-model="createTemp.purchaseDate" type="date" placeholder="选择日期" style="width:170px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="入场日期:" prop="entranceDate">
                <el-date-picker v-model="createTemp.entranceDate" type="date" placeholder="选择日期" style="width:170px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="折旧年限:" prop="depreciation">
                <el-input ref="depreciation" v-model="createTemp.depreciation" placeholder="请输入折旧年限" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="原值:" prop="yuanzhi">
                <el-input ref="yuanzhi" v-model="createTemp.yuanzhi" placeholder="请输入原值" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="残值:" prop="salvage">
                <el-input ref="salvage" v-model="createTemp.salvage" placeholder="请输入残值" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="月核减值:" prop="subtractvalue">
                <el-input ref="subtractvalue" v-model="createTemp.subtractvalue" placeholder="请输入月核减值" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="保养级别:" prop="upkeepgrade">
                <el-select ref="upkeepgrade" v-model="createTemp.upkeepgrade" placeholder="保养级别" class="filter-item" @visible-change="upkeepgradeChange" @change="changeUpkeepgrade">
                  <el-option v-for="item in upkeepgrades" :key="item.id" :label="item.label" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="保养费用:" prop="yearUpkeepCost">
                <el-input ref="yearUpkeepCost" v-model="createTemp.yearUpkeepCost" placeholder="请输入近一年保养费用" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="维修费用:" prop="yearMaintainCost">
                <el-input ref="yearMaintainCost" v-model="createTemp.yearMaintainCost" placeholder="请输入近一年维修费用" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="基数(小时):" prop="baseHours">
                <el-input ref="baseHours" v-model="createTemp.baseHours" placeholder="请输入基数" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="牧场:" prop="pastureId">
                <el-select v-model="createTemp.pastureId" placeholder="牧场" class="filter-item" @change="changePasture">
                  <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="部门:" prop="deptId">
                <el-select v-model="createTemp.deptId" :disabled="disabled" placeholder="部门" class="filter-item" style="width: 100%;" @change="changeDepart">
                  <el-option v-for="item in createDepartList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="责任人:" prop="employeName">
                <el-autocomplete v-model="createTemp.employeName" value-key="empname" class="inline-input" :fetch-suggestions="employeSearch" placeholder="请输入责任人" style="width:100%;" @select="handleSelectEmploye">
                  <template slot-scope="{ item }">
                    <div class="name" style="display: inline;">{{ item.name }}</div>
                  </template>
                </el-autocomplete>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="录入人:" prop="inputUser">
                <el-select v-model="createTemp.inputUser" placeholder="录入人" class="filter-item">
                  <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="录入时间:" prop="inputDatetime">
                <el-date-picker v-model="createTemp.inputDatetime" :picker-options="pickerOptions1" type="date" placeholder="录入时间" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:170px;" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="指定维修人:" prop="maintenance">
                <el-select v-model="createTemp.maintenance" multiple  filterable placeholder="指定维修人" class="filter-item" style="width: 100%;" >
                  <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="6">
              <el-form-item label="间隔时间:" prop="pushTime">
                <el-select v-model="createTemp.pushTime" placeholder="间隔时间" class="filter-item">
                  <el-option v-for="item in pushNameList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col> -->
            <el-col :span="6">
              <el-form-item label="一级督办:" prop="levelone">
                <el-select v-model="createTemp.levelone" filterable placeholder="设备主管" class="filter-item">
                  <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="一级间隔时间(小时)" prop="leveloneTime">
                <el-select v-model="createTemp.leveloneTime" placeholder="间隔时间" class="filter-item">
                  <el-option v-for="item in pushNameList2" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="二级督办:" prop="leveltwo">
                <el-select v-model="createTemp.leveltwo"  filterable placeholder="设备助理" class="filter-item">
                  <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="二级间隔时间(小时)" prop="leveltwoTime">
                <el-select v-model="createTemp.leveltwoTime" placeholder="间隔时间" class="filter-item">
                  <el-option v-for="item in pushNameList2" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="三级督办:" prop="levelthree">
                <el-select v-model="createTemp.levelthree"  filterable placeholder="场长" class="filter-item">
                  <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="三级间隔时间(小时)" prop="levelthreeTime">
                <el-select v-model="createTemp.levelthreeTime" placeholder="间隔时间" class="filter-item">
                  <el-option v-for="item in pushNameList2" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="设备图片:">
                <el-upload
                  id="uploadPic"
                  ref="upload"
                  :limit="1"
                  list-type="picture-card"
                  :file-list="createTemp.fileList"
                  :headers="headers"
                  :action="uploadImageUrl"
                  :auto-upload="true"
                  :on-preview="handlePicPreview"
                  :before-remove="beforeRemove"
                  :class="{hide:showUpload}"
                  :on-change="(file,fileList)=>{ return handlePicChange(file, fileList) }"
                  :on-success="(response,file, fileList)=>{ return handlePicSuccess(response,file, fileList) }"
                  :on-remove="(file, fileList)=>{ return handlePicRemove(file, fileList) }"
                >
                  <i class="el-icon-plus" />
                </el-upload>
                <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
                  <img :src="dialogImageUrl" alt="" @load="onLoad">
                </el-dialog>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
          <el-button v-if="dialogStatus==='create'" ref="createb" type="success" :disabled="isokDisable" @click="add_dialog_save_again()">保存并新增</el-button>
          <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">保存并关闭</el-button>
          <el-button @click="dialogFormVisible = false; getdataListParm.parammaps.inputDatetime = ''">取消并关闭</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 查看 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_See" :close-on-click-modal="false" width="90%">
      <div class="app-contentcard">
        <div style="position: absolute;top:20px;left:150px;font:18px/24px '' ;color:#303133;">
          <span style="margin:0 10px;">设备名称:{{ seeTemp.eqName }}</span>
          <span>内部编号:{{ seeTemp.eqCode }}</span>
        </div>
        <div class="card">
          <el-tabs v-model="activeName" @tab-click="form_seeTabClick">
            <el-tab-pane label="基础信息" name="first">
              <el-form ref="seeTemp" :rules="rules" :model="seeTemp" label-position="right" label-width="115px" style="width: 100%;margin-bottom:30px">
                <el-row>
                  <el-form-item label="设备类别:" prop="eqClassName">
                    <el-input ref="eqClassName" v-model="seeTemp.eqClassName" placeholder="请输入设备类别" disabled />
                  </el-form-item>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="资产编号:" prop="assetCode">
                      <el-input ref="assetCode" v-model="seeTemp.assetCode" placeholder="请输入资产编号" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="设备名称:" prop="eqName">
                      <el-input ref="eqName" v-model="seeTemp.eqName" placeholder="请输入设备名称" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="设备内部编号:" prop="eqCode">
                      <el-input ref="eqCode" v-model="seeTemp.eqCode" placeholder="请输入设备内部编号" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="财务编号:" prop="financeCode">
                      <el-input ref="financeCode" v-model="seeTemp.financeCode" placeholder="请输入财务编号" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="设备规格:" prop="specification">
                      <el-input ref="specification" v-model="seeTemp.specification" placeholder="请输入设备规格" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="品牌:" prop="brandName">
                      <el-input ref="brandName" v-model="seeTemp.brandName" placeholder="请输入品牌" disabled />
                    </el-form-item>
                  </el-col>
                  <!-- <el-col :span="6">
                    <el-form-item label="供应商:" prop="providerName">
                      <el-input ref="providerName" v-model="seeTemp.providerName" placeholder="请输入供应商" disabled />
                    </el-form-item>
                  </el-col> -->
                  <el-col :span="6">
                    <el-form-item label="用途:" prop="purpose">
                      <el-input ref="purpose" v-model="seeTemp.purpose" placeholder="请输入用途" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="状态:" prop="status">
                      <el-input ref="status" v-model="seeTemp.status" placeholder="请输入状态" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="购置日期:" prop="purchaseDate">
                      <el-input ref="purchaseDate" v-model="seeTemp.purchaseDate" placeholder="请输入购置日期" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="入场日期:" prop="entranceDate">
                      <el-input ref="entranceDate" v-model="seeTemp.entranceDate" placeholder="请输入入场日期" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="折旧年限:" prop="depreciation">
                      <el-input ref="depreciation" v-model="seeTemp.depreciation" placeholder="请输入折旧年限" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="原值:" prop="yuanzhi">
                      <el-input ref="yuanzhi" v-model="seeTemp.yuanzhi" placeholder="请输入原值" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="残值:" prop="salvage">
                      <el-input ref="salvage" v-model="seeTemp.salvage" placeholder="请输入残值" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="月核减值:" prop="subtractvalue">
                      <el-input ref="subtractvalue" v-model="seeTemp.subtractvalue" placeholder="请输入月核减值" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="保养级别:" prop="upkeepgrade">
                      <el-input ref="upkeepgrade" v-model="seeTemp.upkeepgrade" placeholder="请输入保养级别" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="保养费用:" prop="yearUpkeepCost">
                      <el-input ref="yearUpkeepCost" v-model="seeTemp.yearUpkeepCost" placeholder="请输入近一年保养费用" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="维修费用:" prop="yearMaintainCost">
                      <el-input ref="yearMaintainCost" v-model="seeTemp.yearMaintainCost" placeholder="请输入近一年维修费用" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="基数(小时):" prop="baseHours">
                      <el-input ref="baseHours" v-model="seeTemp.baseHours" placeholder="请输入基数" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="牧场:" prop="pastureName">
                      <el-input ref="pastureName" v-model="seeTemp.pastureName" placeholder="请输入牧场" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="部门:" prop="deptName">
                      <el-input ref="deptName" v-model="seeTemp.deptName" placeholder="请输入部门" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="责任人:" prop="employeName">
                      <el-input ref="employeName" v-model="seeTemp.employeName" placeholder="请输入责任人" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="录入人:" prop="inputUserName">
                      <el-input ref="inputUserName" v-model="seeTemp.inputUserName" placeholder="请输入录入人" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="录入时间:" prop="inputDatetime">
                      <el-input ref="inputDatetime" v-model="seeTemp.inputDatetime" placeholder="请输入录入时间" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>

                <el-row>
                <el-col :span="6">
                  <el-form-item label="指定维修人:" prop="maintenanceName">
                    <el-input ref="maintenanceName" v-model="seeTemp.maintenanceName" placeholder="" disabled />
                  </el-form-item>
                </el-col>


                <el-col :span="6">
                  <el-form-item label="一级督办:" prop="leveloneName">
                    <el-input ref="leveloneName" v-model="seeTemp.leveloneName" placeholder="" disabled />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="一级间隔时间(小时):" prop="leveloneTime">
                    <el-input ref="leveloneTime" v-model="seeTemp.leveloneTime" placeholder="" disabled />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="二级督办:" prop="leveltwoName">
                    <el-input ref="leveltwoName" v-model="seeTemp.leveltwoName" placeholder="" disabled />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="6">
                  <el-form-item label="二级间隔时间(小时):" prop="leveltwoTime">
                    <el-input ref="leveltwoTime" v-model="seeTemp.leveltwoTime" placeholder="" disabled />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="三级督办:" prop="levelthreeName">
                    <el-input ref="levelthreeName" v-model="seeTemp.levelthreeName" placeholder="" disabled />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="三级间隔时间(小时):" prop="levelthreeTime">
                    <el-input ref="levelthreeTime" v-model="seeTemp.levelthreeTime" placeholder="" disabled />
                  </el-form-item>
                </el-col>
               </el-row>
                <el-row>
                  <el-col>
                    <el-form-item label="设备图片:">
                      <el-popover placement="right" title="" trigger="hover">
                        <img v-if="seeTemp.picpath !== '' && seeTemp.srcpath !== ''" :src="seeTemp.picpath">
                        <img v-if="seeTemp.picpath !== '' && seeTemp.srcpath !== ''" slot="reference" :src="seeTemp.picpath" :alt="seeTemp.srcpath" style="height: 100px;width:100px;">
                      </el-popover>
                    </el-form-item>
                  </el-col>
                </el-row>
                <div v-if="isFlowChart">
                  <el-row>
                    <el-col>
                      <el-form-item label="流程进度" />
                      <el-steps :active="active" align-center finish-status="success">
                        <el-step
                          v-for="(item,index) in activeList"
                          :key="index"
                          :title="item.title"
                          :status="item.status"
                        >
                          <template slot="description">
                            <div class="step-row">
                              <div>{{ item.name }}&nbsp;&nbsp;{{ item.date }}</div>
                              <div>{{ item.reason }}</div>
                            </div>
                          </template>
                        </el-step>
                      </el-steps>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col>
                      <el-form-item label="操作:">
                        <el-button v-if="isBasicExamine && seeTemp.SHStatus == 0" type="success" style="display:inline-block" @click="handleExamine()">审核</el-button>
                        <el-button v-else type="success" style="display:none" @click="handleExamine()">审核</el-button>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
              </el-form>
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="点检记录" name="second">
              <el-date-picker ref="inputDatetimeCheck1" v-model="getAssetBigSpotCheckListParm.parammaps.inputDatetimeSpotCheck1" class="inputDatetime" type="datetimerange" style="width: 250px;margin-bottom:10px" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
              <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchSportCheck">搜索</el-button>
              <el-table
                :key="tableKey"
                v-loading="listLoadingSpotCheck1"
                element-loading-text="给我一点时间"
                :data="listSpotCheck1"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumSpotCheck1-1) * pageSizeSpotCheck1 + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="点检结果" sortable prop="inspectionResults" min-width="110px" align="center" />
                <el-table-column label="点检日期" sortable prop="date" min-width="110px" align="center" />
                <el-table-column label="点检人" sortable prop="empname" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalSpotCheck1" :page.sync="getAssetBigSpotCheckListParm.offset" :limit.sync="getAssetBigSpotCheckListParm.pagecount" @pagination="getAssetBigSpotCheckList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="保养记录" name="third">
              <el-input v-model="getBigupkeepbyeqParm.parammaps.upkeepCode" placeholder="保养单号" style="width: 140px;" class="filter-item" />
              <el-select v-model="getBigupkeepbyeqParm.parammaps.upkeepType" clearable placeholder="保养类型" class="filter-item" style="width: 120px;">
                <el-option v-for="item in maintainTypes" :key="item.id" :label="item.name" :value="item.name" />
              </el-select>
              <el-date-picker ref="inputDatetimeUpkeepbyeq" v-model="getBigupkeepbyeqParm.parammaps.inputDatetimeUpkeepbyeq" class="inputDatetime" type="datetimerange" style="width: 250px;margin-bottom:10px" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
              <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchUpkeepbyeq">搜索</el-button>
              <el-table
                :key="tableKey"
                v-loading="listLoadingUpkeepbyeq"
                element-loading-text="给我一点时间"
                :data="listUpkeepbyeq"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
                @sort-change="tableSort"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumUpkeepbyeq-1) * pageSizeUpkeepbyeq + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="保养单号" prop="upkeepCode" min-width="110px" align="center" />
                <el-table-column label="保养日期" sortable prop="plantime" min-width="110px" align="center" />
                <el-table-column label="保养名称" prop="upkeepName" min-width="110px" align="center" />
                <el-table-column label="保养类型" prop="upkeepType" min-width="110px" align="center" />
                <el-table-column label="保养级别" prop="upkeepLevel" min-width="110px" align="center" />
                <el-table-column label="保养人" prop="upkeepPerson" min-width="110px" align="center" />
                <el-table-column label="保养费用" prop="upkeepCost" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalUpkeepbyeq" :page.sync="getBigupkeepbyeqParm.offset" :limit.sync="getBigupkeepbyeqParm.pagecount" @pagination="getBigupkeepbyeqList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="维修记录" name="fouth">
              <el-input v-model="getAssetMaintainParm.parammaps.repairCode" placeholder="维修单号" style="width: 140px;" class="filter-item" />
              <el-date-picker ref="inputDatetimeAssetMaintain" v-model="getAssetMaintainParm.parammaps.inputDatetimeAssetMaintain" class="inputDatetime" type="datetimerange" style="width: 250px;margin-bottom:10px" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
              <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchAssetMaintain">搜索</el-button>
              <el-table
                :key="tableKey"
                v-loading="listLoadingAssetMaintain"
                element-loading-text="给我一点时间"
                :data="listAssetMaintain"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
                @sort-change="tableSort"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumAssetMaintain-1) * pageSizeAssetMaintain + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="维修单号" prop="repairCode" min-width="110px" align="center" />
                <el-table-column label="报修人" prop="requestName" min-width="110px" align="center" />
                <el-table-column label="报修时间" sortable prop="requestTime" min-width="110px" align="center" />
                <el-table-column label="维修人" prop="empname" min-width="110px" align="center" />
                <el-table-column label="维修时间" sortable prop="stopTime" min-width="110px" align="center" />
                <el-table-column label="诊断故障" prop="details" min-width="110px" align="center" />
                <el-table-column label="维修费用" sortable prop="maintenanceCost" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalAssetMaintain" :page.sync="getAssetMaintainParm.offset" :limit.sync="getAssetMaintainParm.pagecount" @pagination="getAssetMaintainList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="启停记录" name="fifth">
              <div class="filter-container">
                <el-date-picker v-model="getAssetSTTParm.parammaps.startTime" type="date" placeholder="开启日期" style="width:170px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
                <el-date-picker v-model="getAssetSTTParm.parammaps.stopTime" type="date" placeholder="关闭日期" style="width:170px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
                <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchAssetSTT">搜索</el-button>
              </div>
              <el-table
                :key="tableKey"
                v-loading="listLoadingAssetSTT"
                element-loading-text="给我一点时间"
                :data="listAssetSTT"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
              >
                <el-table-column label="序号" align="center" type="index" width="50">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumAssetSTT-1) * pageSizeAssetSTT + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="开启时间" sortable prop="enabledTime" min-width="110px" align="center" />
                <el-table-column label="关闭时间" sortable prop="blockTime" min-width="110px" align="center" />
                <el-table-column label="运行时间(分钟)" sortable prop="runTime" min-width="110px" align="center" />
                <el-table-column label="关闭人" prop="blockName" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalAssetSTT" :page.sync="getAssetSTTParm.offset" :limit.sync="getAssetSTTParm.pagecount" @pagination="getAssetSTTList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="变更记录" name="sixth">
              <div class="filter-container">
                <el-select v-model="getAssetChangeParm.parammaps.changeStatue" clearable placeholder="变更状态" class="filter-item" style="width: 120px;">
                  <el-option v-for="item in changeStates" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
                <el-date-picker ref="inputDatetimeAssetChange" v-model="getAssetChangeParm.parammaps.inputDatetimeAssetChange" class="inputDatetime" type="datetimerange" style="width: 250px;margin-bottom:10px" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchAssetChange">搜索</el-button>
              </div>
              <el-table
                :key="tableKey"
                v-loading="listLoadingAssetChange"
                element-loading-text="给我一点时间"
                :data="listAssetChange"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumAssetChange-1) * pageSizeAssetChange + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="变更时间" sortable prop="changeTime" min-width="110px" align="center" />
                <el-table-column label="变更状态" :formatter="changeStatue" prop="blockTime" min-width="110px" align="center" />
                <el-table-column label="变更人" prop="changeName" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalAssetChange" :page.sync="getAssetChangeParm.offset" :limit.sync="getAssetChangeParm.pagecount" @pagination="getAssetChangeList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="备件领用记录" name="seventh">
              <el-input v-model="getAssetPartApplyParm.parammaps.useCode" placeholder="出库单号" style="width: 140px;" class="filter-item" />
              <el-input v-model="getAssetPartApplyParm.parammaps.partCode" placeholder="备件编号" style="width: 140px;" class="filter-item" />
              <el-input v-model="getAssetPartApplyParm.parammaps.partName" placeholder="备件名称" style="width: 140px;" class="filter-item" />
              <el-date-picker ref="inputDatetimeAssetPartApply" v-model="getAssetPartApplyParm.parammaps.inputDatetimeAssetPartApply" class="inputDatetime" type="datetimerange" style="width: 250px;margin-bottom:10px" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
              <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchAssetPartApply">搜索</el-button>
              <el-table
                :key="tableKey"
                v-loading="listLoadingAssetPartApply"
                element-loading-text="给我一点时间"
                :data="listAssetPartApply"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
                @sort-change="tableSort"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (pageNumAssetPartApply-1) * pageSizeAssetPartApply + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="出库单号" prop="useForm" min-width="110px" align="center" />
                <el-table-column label="备件编号" sortable prop="partCode" min-width="110px" align="center" />
                <el-table-column label="备件名称" prop="partName" min-width="110px" align="center" />
                <el-table-column label="备件规格" prop="specification" min-width="110px" align="center" />
                <el-table-column label="备件品牌" prop="brandName" min-width="110px" align="center" />
                <el-table-column label="计量单位" prop="unit" min-width="110px" align="center" />
                <el-table-column label="领用数量" sortable prop="useNumber" min-width="110px" align="center" />
                <el-table-column label="实际出库数量" sortable prop="checkoutNumber" min-width="110px" align="center" />
                <el-table-column label="单价" sortable prop="price" min-width="110px" align="center" />
                <el-table-column label="总价" sortable prop="sumPrice" min-width="110px" align="center" />
                <el-table-column label="领用部门" prop="departmentName" min-width="110px" align="center" />
                <el-table-column label="领用时间" sortable prop="receiveTime" min-width="110px" align="center" />
                <el-table-column label="距离上次时间(天)" sortable prop="dif" min-width="110px" align="center" />
              </el-table>
              <pagination v-show="total>=0" :total="totalAssetPartApply" :page.sync="getAssetPartApplyParm.offset" :limit.sync="getAssetPartApplyParm.pagecount" @pagination="getAssetPartApplyList" />
            </el-tab-pane>
            <el-tab-pane v-if="isDisplayRecord" label="费用统计" name="eighth">
              <el-row>
                <el-col :span="12">
                  <div v-if="activeName==='eighth'" id="barChart1" style="width: 100%;height:400px;" />
                </el-col>
                <el-col :span="12">
                  <div v-if="activeName==='eighth'" id="barChart2" style="width: 100%;height:400px;" />
                </el-col>
              </el-row>
              <el-dialog :title="textMap[dialogStatus]" append-to-body :visible.sync="dialogFormVisible_ChartSee" :close-on-click-modal="false" width="80%">
                <div class="app-contentSee">
                  <div class="filter-container">
                    <el-select v-model="getChartSeeParm.parammaps.useTypeV" placeholder="类型" clearable class="filter-item" style="width: 120px;">
                      <el-option v-for="item in useTypes" :key="item.id" :label="item.name" :value="item.name" />
                    </el-select>
                    <el-date-picker ref="inputDatetime2" v-model="getChartSeeParm.parammaps.inputDatetime2" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                    <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchChartSee">搜索</el-button>
                    <el-button class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-edit" @click="handleDownloadChartSee">导出</el-button>
                  </div>
                  <el-table
                    :key="tableKey"
                    v-loading="listLoadingChartSee"
                    element-loading-text="给我一点时间"
                    :data="listChartSee"
                    border
                    fit
                    highlight-current-row
                    style="width: 100%;"
                    :row-style="rowStyle"
                    :cell-style="cellStyle"
                    class="elTable"
                  >
                    <el-table-column label="序号" align="center" type="index" width="50px">
                      <template slot-scope="scope">
                        <span>{{ scope.$index + (pageNumChartSee-1) * pageSizeChartSee + 1 }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="1" label="类型" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.useTypeV }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="2" label="单号" width="140px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.RUcode }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="3" label="领用日期" min-width="80px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.creatTime }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="4" label="领用部门" min-width="100px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.departmentName }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="5" label="备件编号" min-width="80px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.partCode }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="6" label="备件名称" min-width="80px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.partName }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="7" label="备件规格" min-width="80px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.specification }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="8" label="备件品牌" min-width="100px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.brandName }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="9" label="计量单位" min-width="80px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.unit }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="10" label="出库数量" min-width="110px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.checkoutNumber }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="11" label="退库数量" min-width="100px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.quitNumber }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="12" label="单价" min-width="110px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.price }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column :key="13" label="总价" min-width="110px" align="center">
                      <template slot-scope="scope">
                        <span>{{ scope.row.sumPrice }}</span>
                      </template>
                    </el-table-column>
                  </el-table>
                  <pagination v-show="totalChartSee>=0" :total="totalChartSee" :page.sync="getChartSeeParm.offset" :limit.sync="getChartSeeParm.pagecount" @pagination="getChartSeeList" />
                </div>
              </el-dialog>
            </el-tab-pane>
          </el-tabs>
        </div>
        <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
          <el-button @click="dialogFormVisible_See = false">关闭</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 审核 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examine" :close-on-click-modal="false" width="30%">
      <div class="app-examine">
        <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请确认审核结果:</h3>
        <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 50%;margin:0 auto;">
          <el-row style="width:88%;height:150px;margin:0 auto;">
            <el-col :span="20">
              <el-form-item>
                <el-radio-group v-model="examineTemp.SHstatue" @change="changeSHStatue">
                  <el-radio :label="1" checked>通过</el-radio>
                  <el-radio :label="2">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col v-if="statueReason" :span="22">
              <el-input v-model="examineTemp.workflowNote" type="textarea" :autosize="{ minRows: 2, maxRows: 3}" placeholder="请输入不通过原因" />
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='examine'?createExamineData():createExamineData()">确认</el-button>
        <el-button @click="dialogFormVisible_Examine = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 变更 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_change" :close-on-click-modal="false" width="30%">
      <div class="app-change">
        <el-form ref="batchChangeTemp" :rules="rules" :model="batchChange.temp" label-position="right" label-width="115px" style="width: 90%;margin:0 auto 30px" @click.native.prevent @submit.native.prevent>
          <el-row>
            <el-col :span="24">
              <el-form-item label="变更部门:" prop="departmentId">
                <el-select v-model="batchChange.temp.departmentId" placeholder="变更部门" class="filter-item" style="width: 100%;" @change="changeBatchDept">
                  <el-option v-for="item in batchChange.deptList" :key="item.deptid" :label="item.departmentName" :value="item.deptid" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="变更责任人:" prop="employeeId">
                <el-select v-model="batchChange.temp.employeeId" placeholder="变更责任人" class="filter-item" style="width: 100%;" @change="changeBatchPerson">
                  <el-option v-for="item in batchChange.personList" :key="item.id" :label="item.empname" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
          <el-button type="primary" :disabled="isokDisable" @click="changeData()">保存并关闭</el-button>
          <el-button @click="dialogFormVisible_change = false;">取消并关闭</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import echarts from 'echarts'

require('echarts/theme/macarons')
// 引入
import { GetDataByName, GetDataByNames, PostDataByName, PostDataByNames, getRecuData, checkButtons, ExecDataByConfig, failproccess, GetAccount, GetReportform } from '@/api/common'
import waves from '@/directive/waves'
import { parseTime, sortChange, json2excel } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { MessageBox } from 'element-ui'
import TreeSelect from '@/components/TreeSelect'
import Cookies from 'js-cookie'
import { getToken } from '@/utils/auth'
export default {
  inject: ['reload'],
  name: 'Basics',
  components: { Pagination, TreeSelect },
  directives: { waves },
  data() {
    return {
      isBasicsAdd: [], isBasicsCard: [], isBasicsUpdate: [], isBasicsDel: [], isBasicsDel2: [], isBasic: [], isBasicSH: [], isBasicExamine: [],
      rules: {
        // assetCode: [{ required: true, message: '必填', trigger: 'blur' }],
        //eqName: [{ required: true, message: '必填', trigger: 'blur' }],
        eqCode: [{ required: true, message: '必填', trigger: 'blur' }],
        financeCode: [{ required: true, message: '必填', trigger: 'blur' }],
        departmentId: [{ required: true, message: '必填', trigger: 'blur' }],
        employeeId: [{ required: true, message: '必填', trigger: 'blur' }],
        depreciation: [{ type: 'number', required: true, validator: (rule, value, callback) => {
          if (!value) {
            callback(new Error('不能为空'))
          }
          setTimeout(() => {
            const re = /^[0-9]*[1-9][0-9]*$/ // /^[0-9]*[1-9][0-9]*$/
            const rsCheck = re.test(value)
            if (!rsCheck) {
              callback(new Error('请输入正整数'))
            } else {
              callback()
            }
          }, 0)
        }, trigger: 'blur' }]
      },
      rulesCreate: {
        // assetCode: [{ required: true, message: '必填', trigger: 'blur' }],
        //eqName: [{ required: true, message: '必填', trigger: 'blur' }],
        eqCode: [{ required: true, message: '必填', trigger: 'blur' }],
        financeCode: [{ required: true, message: '必填', trigger: 'blur' }],
        departmentId: [{ required: true, message: '必填', trigger: 'blur' }],
        employeeId: [{ required: true, message: '必填', trigger: 'blur' }],

        deptId: [{ required: true, message: '必填', trigger: 'blur' }],
        employeName: [{ required: true, message: '必填', trigger: 'blur' }],
        pastureId: [{ required: true, message: '必填', trigger: 'blur' }],
        maintenance: [{ required: true, message: '必填', trigger: 'blur' }],
        leveloneTime: [{ required: true, message: '必填', trigger: 'blur' }],
        leveltwoTime: [{ required: true, message: '必填', trigger: 'blur' }],
        levelthreeTime: [{ required: true, message: '必填', trigger: 'blur' }],


        levelone: [{ required: true, message: '必填', trigger: 'blur' }],
        leveltwo: [{ required: true, message: '必填', trigger: 'blur' }],
        levelthree: [{ required: true, message: '必填', trigger: 'blur' }],


        depreciation: [{ type: 'number', required: true, validator: (rule, value, callback) => {
          if (!value) {
            callback(new Error('不能为空'))
          }
          setTimeout(() => {
            const re = /^[0-9]*[1-9][0-9]*$/ // /^[0-9]*[1-9][0-9]*$/
            const rsCheck = re.test(value)
            if (!rsCheck) {
              callback(new Error('请输入正整数'))
            } else {
              callback()
            }
          }, 0)
        }, trigger: 'blur' }]
      },
      placeholder:"请选择设备类别",
      findAllBrand: [], findAllProvider: [],
      findAllAssetType: [], findAllPasture: [], findAllDepart: [], findAllEmploye: [],
      getDictByName: [], upkeepgrades: [], createDepartList: [],
      statues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
      pushNameList: [{ id: '60', name: '60' }, { id: '120', name: '120' }, { id: '180', name: '180' }],
      pushNameList2: [{ id: '1', name: '1' }, { id: '2', name: '2' }, { id: '3', name: '3' }, { id: '5', name: '5' }, { id: '8', name: '8' }, { id: '12', name: '12' }, { id: '18', name: '18' }],
      depreciationAlertList: [{ id: '0', name: '正常' }, { id: '1', name: '到期预警' }, { id: '2', name: '超期使用' }],
      requestParams: [
        { name: 'findAllBrand', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
        { name: 'findAlllAssetProvider', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': "18" }},
        // { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
        { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
        { name: 'getDictByName', offset: 0, pagecount: 0, params: ['资产状态'] },
        { name: 'getdictbyname', offset: 0, pagecount: 0, params: ['保养级别'] }
      ],
      getDepartParam: { name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }},
      disabled: false,
      nodeKey: 'id',
      defaultCheckedKeys: [],
      parentClass: [],
      defaultProps: { children: 'children', label: 'typeName' },
      getRecuListParm: { name: 'getAssetTypeList', idname: 'id', params: [-1] },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      getdataListParm: {
        name: 'getAssetList', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
        parammaps: {proId:'',brandId:'', assetCode:'',eqCode: '', eqName: '', departmentId: '', pastureId: Cookies.get('pastureid'), pastureName: Cookies.get('pasturename'), status: '', inputDatetime1: '', startTime: '', stopTime: '', inputDatetime2: '', startTime2: '', stopTime2: '', inputDatetime3: '', startTime3: '', stopTime3: '', warning: '', eqClassId: '' }
      },
      listSH: [], totalSH: 0, listLoadingSH: true, tabName: '',
      getdataListParmSH: {
        name: 'getAssetListSH', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
        parammaps: { eqCode: '', eqName: '', pastureName: Cookies.get('pasturename'), status: '', inputDatetime1: '', startTime: '', stopTime: '', SHStatus: '' }
      },
      textMap: { update: '编辑', create: '新增', card: '查看设备信息', examine: '审核', change: '批量变更' },
      dialogFormVisible: false,
      dialogStatus: '',
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now()// 当天之前的时间可选
        }
      },

      dialogImageUrl: '', dialogVisible: false,
      fileList: [], showUpload: false,
      headers: { optname: 'insertcustompic', id: 1, token: getToken() },
      uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
      width: '',

      createTemp: { inputDatetime: parseTime(new Date(), '{y}-{m}-{d}'), employeId: this.$store.state.user.employeid, inputUser: this.$store.state.user.employeid, deptId: this.$store.state.user.departmentid, departmentName: Cookies.get('departmentname'), pastureId: this.$store.state.user.pastureid, assetCode: '', eqClassName: '', eqClassId: '', eqCode: '', eqName: '', specification: '', providerName: '', brandName: '', financeCode: '', status: '正常', purpose: '', purchaseDate: parseTime(new Date(), '{y}-{m}-{d}'), entranceDate: parseTime(new Date(), '{y}-{m}-{d}'), yearUpkeepCost: '', yearMaintainDost: '', yuanzhi: '', baseHours: '', upkeepgrade: '', salvage: '', subtractvalue: '', yearMaintainCost: '', brandId: '', providerId: '', inputUserName: '', employeName: this.$store.state.user.employename, depreciation: '5', maintenance: '', levelone: '', leveltwo: '', levelthree: '', pushTime: '', leveloneTime: '', leveltwoTime: '', levelthreeTime: '' },
      requestParam: { name: 'insertAsset', offset: 0, pagecount: 0, parammaps: {}},
      seeTemp: {},
      dialogFormVisible_Examine: false,
      dialogFormVisible_See: false,
      activeName: 'first',

      maintainTypes: [{ id: '0', name: '周保养' }, { id: '1', name: '月保养' }, { id: '2', name: '间隔保养' }],
      changeStates: [{ id: '17', name: '正常' }, { id: '18', name: '闲置' }, { id: '19', name: '报废' }, { id: '20', name: '封存' }],

      getdataEQNumber: { name: 'cerateEQNumber', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: {}},

      dialoFormVisible_Examine: false,
      examineTemp: { SHstatue: 1 },
      statueReason: false,
      activeList: [],
      active: 3,
      isFlowChart: false,
      isDisplayRecord: false,
      buttons: [],
      // 查看-点检记录
      getAssetBigSpotCheckListParm: { name: 'getAssetBigSpotCheck1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeSpotCheck1: '', startTime: '', stopTime: '' }},
      listLoadingSpotCheck1: false,
      listSpotCheck1: [],
      totalSpotCheck1: 0,
      // 查看-保养记录
      getBigupkeepbyeqParm: { name: 'getBigupkeepbyeq', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeUpkeepbyeq: '', startTime: '', stopTime: '', upkeepType: '', upkeepCode: '' }},
      listLoadingUpkeepbyeq: false,
      listUpkeepbyeq: [],
      totalUpkeepbyeq: 0,
      // 查看-维修记录
      getAssetMaintainParm: { name: 'getAssetMaintain1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeAssetMaintain: '', startTime: '', stopTime: '', repairCode: '' }},
      listLoadingAssetMaintain: false,
      listAssetMaintain: [],
      totalAssetMaintain: 0,
      // 查看-启停记录
      getAssetSTTParm: { name: 'getAssetSTT1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '' }},
      listLoadingAssetSTT: false,
      listAssetSTT: [],
      totalAssetSTT: 0,
      // 查看-变更记录
      getAssetChangeParm: { name: 'getAssetChange1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '', changeStatue: '', inputDatetimeAssetChange: '' }},
      listLoadingAssetChange: false,
      listAssetChange: [],
      totalAssetChange: 0,
      // 查看-备件领用记录
      getAssetPartApplyParm: { name: 'getAssetPartApply', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '', inputDatetimeAssetPartApply: '' }},
      listLoadingAssetPartApply: false,
      listAssetPartApply: [],
      totalAssetPartApply: 0,
      downLoadParm: {},
      downLoadList: [],
      requestBrand: {
        name: 'getBrandByPartCode',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {}
      },
      BrandList: [],
      requestEmploye: {
        name: 'findAllEmployeV2',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },
      employeList: [],
      totaltitle: 0,
      getBarChart1Parm: {
        name: 'getReportEqCostYear',
        parammaps: {}
      },
      barChart1: null,
      chart_data1: {},
      getBarChart2Parm: {
        name: 'getReportEqCostMonth',
        parammaps: {
          receiveTime: new Date().getFullYear()
        }
      },
      barChart2: null,
      chart_data2: {},
      dialogFormVisible_ChartSee: false,
      getChartSeeParm: {
        name: 'getEqPartuseDetailList',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          receiveTime: '',
          eqId: '',
          useTypeV: '',
          inputDatetime2: '',
          stopTime: '',
          startTime: ''
        }
      },
      listLoadingChartSee: false,
      totalChartSee: 0,
      listChartSee: [],
      pageNum: 0,
      pageSize: 0,
      pageNumSH: 0,
      pageSizeSH: 0,
      useTypes: [{ id: 0, name: '维修' }, { id: 1, name: '保养' }],
      downLoadParm2: {},
      downLoadList2: [],
      isPercentage: false,
      percentage: 1,
      isokDisable: false,
      edit: 0,
      selectionList: [],
      dialogFormVisible_change: false,
      batchChange: {
        temp: { departmentId: '', employeeId: '' },
        getdataListParmDept: { name: 'getAssetAndEmpList', offset: 0, pagecount: 0, parammaps: {}},
        deptList: [],
        getdataListParmPerson: { name: 'getAllEmp', offset: 0, pagecount: 0, parammaps: {}},
        personList: []
      },
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' },
      myHeight:document.documentElement.clientHeight - 85- 250
    }
  },
  computed: {
    // 设置请求头
    // headers() {
    //   return {
    //     // 设置token
    //     // eslint-disable-next-line no-undef
    //     token: getToken()
    //   }
    // },
    uploadData() {
      return {
        name: 'importStockUse',
        pastureId: Cookies.get('pastureid'),
        importParams: '牧场,设备类别,资产编号,设备名称,设备内部编号,设备规格,品牌,供应商,用途,状态,购置日期,入场日期,折旧年限,财务编号,原值,残值,月核减值,保养级别,保养费用,维修费用,维修费用,基数(小时),部门,责任人,录入人,录入时间,使用时长(年),使用率(%),SignColumn',
        sheetname: 'SheetJS'
      }
    },

    // 设置上传地址
    uploadExcelUrl() {
      // process.env.VUE_APP_BASE_API是服务器的路径，也是axios的基本路径
      return process.env.VUE_APP_BASE_API + 'authdata/equipment'
    }
  },



  created() {






    const gshebquanx = Cookies.get('gshebquanx')
    console.log("gshebquanx===================",gshebquanx)

    //不是设备处长，没有所有权限
    if(gshebquanx == '0'){
      this.requestParams[4].parammaps.id = Cookies.get('pastureid')
    } else {
      this.requestParams[4].parammaps.id = "18"
    }

    const that = this
    GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
      that.buttons = response.data.list
      that.get_auto_buttons()
    })
    this.get_table_dataSH()
    this.getDownClassList()
    if (this.$route.query.tabName == undefined) {
      this.tabName = 'first'
    } else {
      this.tabName = this.$route.query.tabName
    }
    if (this.isBasic === false) {
      this.tabName = 'second'
    }
    if (this.tabName == 'first') {
      this.isDisplayRecord = true
      this.isFlowChart = false
    } else {
      this.isDisplayRecord = false
      this.isFlowChart = true
    }
    if (this.$route.query.myPath !== undefined && this.$route.query.myPath == 'AssetStandardManagement') {
      setTimeout(() => {
        if (this.$route.query.pastureName !== undefined && this.$route.query.pastureId !== undefined && this.$route.query.departmentId !== undefined) {
          this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
          this.getdataListParm.parammaps.pastureId = this.$route.query.pastureId
          // console.log(isNaN(this.$route.query.departmentId), '9999')
          this.getdataListParm.parammaps.eqClassId = this.$route.query.eqClassId
          this.getdataListParm.parammaps.eqClassName = this.$route.query.eqClassName
          this.defaultCheckedKeys = [this.getdataListParm.parammaps.eqClassId]
          this.getDepartParam.parammaps.pastureId = this.$route.query.pastureId
          if (isNaN(this.$route.query.departmentId)) {
            this.getdataListParm.parammaps.departmentId = ''
          } else {
            this.getdataListParm.parammaps.departmentId = parseInt(this.$route.query.departmentId)
          }
          this.getDepartDownList()
          this.$forceUpdate()
        } else {
          this.getdataListParm.parammaps.pastureName = Cookies.get('pasturename')
          this.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
          this.getdataListParm.parammaps.departmentId = ''
        }
        this.get_table_data()
      }, 5000)
    } else {
      if (this.$route.query.pastureName !== undefined && this.$route.query.pastureId !== undefined && this.$route.query.departmentId !== undefined) {
        this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
        this.getdataListParm.parammaps.pastureId = this.$route.query.pastureId
        this.getdataListParm.parammaps.departmentId = parseInt(this.$route.query.departmentId)
      } else {
        this.getdataListParm.parammaps.pastureName = Cookies.get('pasturename')
        this.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
        this.getdataListParm.parammaps.departmentId = ''
      }
      this.get_table_data()
    }
    if (this.$route.query.myPath !== undefined && this.$route.query.myPath == 'equipmentOverview') {
      this.getDepartParam.parammaps.pastureId = this.$route.query.pastureId
    }
    if (this.$route.query.myPath !== undefined && this.$route.query.myPath == 'equipmentOverview2') {
      setTimeout(() => {
        if (this.$route.query.pastureName !== undefined && this.$route.query.pastureId !== undefined && this.$route.query.eqClassId !== undefined) {
          this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
          this.getdataListParm.parammaps.pastureId = this.$route.query.pastureId
          this.getdataListParm.parammaps.eqClassId = this.$route.query.eqClassId
          this.getdataListParm.parammaps.eqClassName = this.$route.query.eqClassName
          this.defaultCheckedKeys = [this.getdataListParm.parammaps.eqClassId]
          this.getDepartParam.parammaps.pastureId = this.$route.query.pastureId
          this.getDepartDownList()
          this.$forceUpdate()
        } else {
          this.getdataListParm.parammaps.pastureName = Cookies.get('pasturename')
          this.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
          this.getdataListParm.parammaps.eqClassId = ''
        }
        this.get_table_data()
      }, 5000)
    } else {
      if (this.$route.query.pastureName !== undefined && this.$route.query.pastureId !== undefined && this.$route.query.departmentId !== undefined) {
        this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
        this.getdataListParm.parammaps.pastureId = this.$route.query.pastureId
        this.getdataListParm.parammaps.departmentId = parseInt(this.$route.query.departmentId)
      } else {
        this.getdataListParm.parammaps.pastureName = Cookies.get('pasturename')
        this.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
        this.getdataListParm.parammaps.departmentId = ''
      }
      this.get_table_data()
    }
    // 设备购置报废统计
    if (this.$route.query.myPath !== undefined && this.$route.query.myPath == 'PurchaseScrap') {
      if (this.$route.query.project == '新购设备数') {
        this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
        this.getdataListParm.parammaps.inputDatetime2 = [parseTime(new Date(), '{y}') + '-01-01', parseTime(new Date(), '{y}') + '-12-31']
        this.getDepartParam.parammaps.pastureId = this.$route.query.pastureId
        this.getDepartDownList()
      } else {
        this.getdataListParm.parammaps.pastureName = this.$route.query.pastureName
        this.getdataListParm.parammaps.inputDatetime3 = [parseTime(new Date(), '{y}') + '-01-01', parseTime(new Date(), '{y}') + '-12-31']
        this.getDepartParam.parammaps.pastureId = this.$route.query.pastureId
        this.getDepartDownList()
      }
    }

    this.get_table_data()
    // Window.addEventListener('keyup', )
    this.keyupSubmit()
  },
  methods: {

    roleSet1(row){
      var result = true
      if(row.pastureId == "18" || row.pastureId  ==  Cookies.get('pastureid') || row.pastureId == "0"){
        result = true
      } else {
        result = false
      }

      return result
    },

    roleSet2(row){

      var result = true
      if( (row.pastureId == "18" || row.pastureId == "0" ) && this.isBasicsDel2 ){
        result = true
      } else if( (row.pastureId  ==  Cookies.get('pastureid') || row.pastureId == "0" )  && this.isBasicsDel2 ){
        result = true
      } else {
        result = false
      }

      return result
    },



     // 导入
     beforeImportExcel(file) {
      const isLt2M = file.size / 1024 / 1024 < 10
      if (!isLt2M) {
        this.$message.error('上传文件大小不能超过 10MB!')
      }
      return isLt2M
    },
    handleImportExcelSuccess(res, file) {
      if (res.msg === 'ok') {
        this.$message({
          title: '成功',
          message: '导入成功:' + res.data.success + '条!',
          type: 'success',
          duration: 2000
        })
        if (res.data.err_count > 0) {
          this.$notify({
            title: '失败',
            message: '导入失败:' + res.data.err_count + '条!',
            type: 'danger',
            duration: 2000
          })


        }
      } else {
        this.$notify({
          title: '失败',
          message: '上传失败',
          type: 'danger',
          duration: 2000
        })
      }
    },
    formatJsonTemp(filterVal, jsonData) {
      return jsonData.map(v =>
        filterVal.map(j => {
          if (j === 'timestamp') {
            return parseTime(v[j])
          } else {
            return v[j]
          }
        })
      )
    },
    tableSort2(column) {
      sortChange(column, this.list)
    },
    tableSort(column) {
      if (this.activeName == 'third') {
        sortChange(column, this.listUpkeepbyeq)
      } else if (this.activeName == 'fouth') {
        sortChange(column, this.listAssetMaintain)
      } else if (this.activeName == 'seventh') {
        sortChange(column, this.listAssetPartApply)
      }
    },
    get_auto_buttons() {
      // 新增
      const BasicsAdd = 'asset:basics:add'
      const isBasicsAdd = checkButtons(this.$store.state.user.buttons, BasicsAdd)
      this.isBasicsAdd = isBasicsAdd
      // 卡片
      const BasicsCard = 'asset:basics:kapian'
      const isBasicsCard = checkButtons(this.$store.state.user.buttons, BasicsCard)
      this.isBasicsCard = isBasicsCard
      // 编辑
      const BasicsUpdate = 'asset:basics:update'
      const isBasicsUpdate = checkButtons(this.$store.state.user.buttons, BasicsUpdate)
      this.isBasicsUpdate = isBasicsUpdate
      // 删除
      const BasicsDel = 'asset:basics:del'
      const isBasicsDel = checkButtons(this.$store.state.user.buttons, BasicsDel)
      this.isBasicsDel = isBasicsDel
      // 设备基础信息-删除
      const BasicsDel2 = 'asset:basics:del2'
      const isBasicsDel2 = checkButtons(this.$store.state.user.buttons, BasicsDel2)
      this.isBasicsDel2 = isBasicsDel2
      // 设备基础信息
      const Basic = 'asset:basic:basic'
      const isBasic = checkButtons(this.$store.state.user.buttons, Basic)
      this.isBasic = isBasic
      // 设备审核
      const BasicSH = 'asset:basic:shjm'
      const isBasicSH = checkButtons(this.$store.state.user.buttons, BasicSH)
      this.isBasicSH = isBasicSH
      // 审核
      const BasicExamine = 'asset:basic:shenhe'
      const isBasicExamine = checkButtons(this.$store.state.user.buttons, BasicExamine)
      this.isBasicExamine = isBasicExamine
    },
    // 2-2:下拉框
    get_select_list() {
      GetDataByNames(this.requestParams).then(response => {
        if (response.data.list !== null) {
          this.findAllBrand = response.data.findAllBrand.list
          this.findAllProvider = response.data.findAllProvider.list
          this.findAllAssetType = response.data.findAllAssetType.list
          this.findAllPasture = response.data.findAllPasture.list
          this.findAllEmploye = response.data.findAllEmploye.list
          this.getDictByName = response.data.getDictByName.list
          this.upkeepgrades = response.data.getdictbyname.list
          this.getDepartDownList()
        }
      })
    },
    getDepartDownList() {
      GetDataByName(this.getDepartParam).then(response => {
        this.findAllDepart = response.data.list
      })
    },
    changePastureName(item) {
      this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
      this.getdataListParm.parammaps.departmentId = ''
      this.getDepartDownList()
    },
    getCreateDepartDownList() {
      GetDataByName(this.getDepartParam).then(response => {
        this.createDepartList = response.data.list
        if (this.edit == 1) {
          if (this.createDepartList.find(obj => obj.id == Cookies.get('departmentid'))) {
            this.createTemp.departmentId = parseInt(Cookies.get('departmentid'))
            this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == Cookies.get('departmentid')).name
            this.createTemp.deptId = parseInt(Cookies.get('departmentid'))
          } else {
            this.createTemp.departmentId = response.data.list[0].id
            this.createTemp.departmentId = response.data.list[0].id
            this.createTemp.deptId = response.data.list[0].name
          }
        }
      })
    },
    changePasture(item) {
      this.getDepartParam.parammaps.pastureId = item
      this.edit = 1
      this.getCreateDepartDownList()
    },
    changeDepart(item) {
      this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == item).name
    },
    get_table_data() {
      this.listLoading = true
      if (this.getdataListParm.parammaps.inputDatetime1 == null) {
        this.getdataListParm.parammaps.inputDatetime1 = ''
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      } else {
        this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime1[0]
        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime1[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime2 == null || this.getdataListParm.parammaps.inputDatetime2 == '') {
        this.getdataListParm.parammaps.inputDatetime2 = ''
        this.getdataListParm.parammaps.startTime2 = ''
        this.getdataListParm.parammaps.stopTime2 = ''
      } else {
        this.getdataListParm.parammaps.startTime2 = this.getdataListParm.parammaps.inputDatetime2[0]
        this.getdataListParm.parammaps.stopTime2 = this.getdataListParm.parammaps.inputDatetime2[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime3 == null || this.getdataListParm.parammaps.inputDatetime3 == '') {
        this.getdataListParm.parammaps.inputDatetime3 = ''
        this.getdataListParm.parammaps.startTime3 = ''
        this.getdataListParm.parammaps.stopTime3 = ''
      } else {
        this.getdataListParm.parammaps.startTime3 = this.getdataListParm.parammaps.inputDatetime3[0]
        this.getdataListParm.parammaps.stopTime3 = this.getdataListParm.parammaps.inputDatetime3[1]
      }
      GetDataByName(this.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.list = response.data.list
          for (let i = 0; i < response.data.list.length; i++) {
            if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
              this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
              this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
            } else {
              this.list[i].srcpath = ''
              this.list[i].picpath = ''
            }
          }
          this.pageNum = response.data.pageNum
          this.pageSize = response.data.pageSize
        } else {
          this.list = []
        }
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 100)
        this.get_select_list()
      })
    },
    get_table_dataSH() {
      this.listLoadingSH = true
      console.log(this.$refs)
      console.log(this.$refs['inputDatetime1'])
      if (this.getdataListParmSH.parammaps.inputDatetime1 == null) {
        this.getdataListParmSH.parammaps.inputDatetime1 = ''
      } else {
        this.getdataListParmSH.parammaps.startTime = this.getdataListParmSH.parammaps.inputDatetime1[0]
        this.getdataListParmSH.parammaps.stopTime = this.getdataListParmSH.parammaps.inputDatetime1[1]
      }
      GetDataByName(this.getdataListParmSH).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.listSH = response.data.list
          for (let i = 0; i < response.data.list.length; i++) {
            if (response.data.list[i].srcpath !== null && response.data.list[i].picpath) {
              this.listSH[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
              this.listSH[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
            } else {
              this.listSH[i].srcpath = ''
              this.listSH[i].picpath = ''
            }
          }
          this.pageNumSH = response.data.pageNum
          this.pageSizeSH = response.data.pageSize
        } else {
          this.listSH = []
        }
        this.totalSH = response.data.total
        setTimeout(() => {
          this.listLoadingSH = false
        }, 100)
      })
    },
    SHStatus: function(cellValue) {
      if (cellValue.SHStatus == 0) {
        return '审核中'
      } else if (cellValue.SHStatus == 1) {
        return '已通过'
      } else if (cellValue.SHStatus == 2) {
        return '未通过'
      } else if (cellValue.SHStatus == 3) {
        return '历史数据'
      }
    },
    form_search() {
      this.listLoading = true
      this.getdataListParm.parammaps.pastureId = ''
      if (this.getdataListParm.parammaps.warning !== '') {
        this.getdataListParm.parammaps.d1 = 1
      } else {
        this.getdataListParm.parammaps.d1 = ''
      }
      if (this.getdataListParm.parammaps.inputDatetime1 == null) {
        this.getdataListParm.parammaps.inputDatetime1 = ''
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      } else {
        this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime1[0]
        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime1[1]
      }
      console.log(this.getdataListParm.parammaps.inputDatetime2)
      if (this.getdataListParm.parammaps.inputDatetime2 == null) {
        this.getdataListParm.parammaps.inputDatetime2 = ''
        this.getdataListParm.parammaps.startTime2 = ''
        this.getdataListParm.parammaps.stopTime2 = ''
      } else {
        this.getdataListParm.parammaps.startTime2 = this.getdataListParm.parammaps.inputDatetime2[0]
        this.getdataListParm.parammaps.stopTime2 = this.getdataListParm.parammaps.inputDatetime2[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime3 == null) {
        this.getdataListParm.parammaps.inputDatetime3 = ''
        this.getdataListParm.parammaps.startTime3 = ''
        this.getdataListParm.parammaps.stopTime3 = ''
      } else {
        this.getdataListParm.parammaps.startTime3 = this.getdataListParm.parammaps.inputDatetime3[0]
        this.getdataListParm.parammaps.stopTime3 = this.getdataListParm.parammaps.inputDatetime3[1]
      }
      this.getdataListParm.offset = 1
      this.get_table_data()
    },
    form_searchSH() {
      this.listLoadingSH = true
      if (this.getdataListParmSH.parammaps.inputDatetime1 == null) {
        this.getdataListParmSH.parammaps.inputDatetime1 = ''
      } else {
        this.getdataListParmSH.parammaps.startTime = this.getdataListParmSH.parammaps.inputDatetime1[0]
        this.getdataListParmSH.parammaps.stopTime = this.getdataListParmSH.parammaps.inputDatetime1[1]
      }
      this.getdataListParmSH.offset = 1
      this.get_table_dataSH()
    },
    handlePicChange(file, fileList) {
      if (fileList.length > 0) {
        this.$nextTick(() => {
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      console.log(this.createTemp)
    },
    handlePicSuccess(response, file, fileList) {
      if (fileList.length > 0) {
        this.$nextTick(() => {
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      if (this.createTemp.picpath === undefined || this.createTemp.picpath === '' || this.createTemp.picpath == -1) {
        this.$set(this.createTemp, 'picpath', response.execresult.LastInsertId)
      }
    },
    handlePicRemove(file, fileList) {
      if (this.dialogStatus === 'create') {
        if (fileList.length < 1) {
          this.showUpload = false
        }
        for (const key in this.createTemp) {
          if (this.createTemp[key] === file.response.execresult.LastInsertId) {
            this.$delete(this.createTemp, key)
          }
        }
      } else {
        if (fileList.length < 1) {
          this.$nextTick(() => {
            this.showUpload = false
          })
        }
        const url = file.url
        console.log(url, 'url')
        for (const key in this.createTemp) {
          console.log(this.createTemp[key], 'createTemp[key]')
          if (this.createTemp[key] === url) {
            console.log(key)
            if (key === 'picpath') {
              this.$delete(this.createTemp, 'picpath')
              this.$delete(this.createTemp, 'picId')
            }
          }
        }
      }
      console.log(this.createTemp, '文件列表移除文件时的钩子row')
    },
    handlePicPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    onLoad(e) {
      const img = e.target
      let width = 0
      if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
        width = img.width + 40
      }
      this.width = width + 'px'
    },
    add_dialog_saveAdd() {
      console.log('点击了保存',this.createTemp.maintenance)
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          for (var i = 0; i < this.listAdd.length; i++) {
            if (this.listAdd[i].score == null) {
              this.$message({ type: 'warning', message: '请检查检查结果是否为空', duration: 2000 })
              return false
            }
            if (this.listAdd[i].pic1 == undefined) {
              this.listAdd[i].pic1 = -1
            }
            if (this.listAdd[i].pic2 == undefined) {
              this.listAdd[i].pic2 = -1
            }
            if (this.listAdd[i].pic3 == undefined) {
              this.listAdd[i].pic3 = -1
            }
          }
          this.postDataPramas.common = { 'returnmap': '0' }
          this.postDataPramas.data = []
          this.postDataPramas.data[0] = { 'name': 'insertBigjudge', 'type': 'e', 'parammaps': {
            pastureId: this.createTemp.pastureId,
            batime: this.createTemp.batime,
            empId: this.createTemp.empId
          }}
          this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
          this.postDataPramas.data[1].children = []
          this.postDataPramas.data[1].children[0] = { 'name': 'insertjudge', 'type': 'e', 'parammaps': {
            bigId: '@insertBigjudge.LastInsertId',
            statue: '@insertSpotList.statue',
            score: '@insertSpotList.score',
            note: '@insertSpotList.note',
            pic1: '@insertSpotList.pic1',
            pic2: '@insertSpotList.pic2',
            pic3: '@insertSpotList.pic3'
          }}
          ExecDataByConfig(this.postDataPramas).then(response => {
            console.log('新增保存发送参数', this.postDataPramas)
            if (response.msg === 'fail') {
              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
            } else {
              this.getdataListParm.parammaps.inputDatetime = ''
              this.get_table_data()
              this.dialogFormVisibleAdd = false
              this.createTemp.providerName = ''
              this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
            }
          })
        }
      })
    },
    beforeRemove(file, fileList) {
      console.log(file.response, '删除文件之前的钩子，参数为上传的文件和文件列表')
      return this.$confirm('删除当前图片, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
    },
    resetCreateTemp() {
      this.defaultCheckedKeys = []
      this.createTemp.defaultCheckedKeys = []
      this.createTemp.brandId = ''
      this.createTemp.providerId = ''
      this.createTemp.inputDatetime = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.eqClassName = ''
      this.createTemp.eqClassId = ''
      this.createTemp.employeName = Cookies.get('employename')
      this.createTemp.employeId = Cookies.get('employeid')
      this.createTemp.inputUser = Cookies.get('employeid')
      this.createTemp.deptId = parseInt(Cookies.get('departmentid'))
      this.createTemp.departmentName = Cookies.get('departmentname')
      this.createTemp.pastureId = parseInt(Cookies.get('pastureid'))
      this.createTemp.eqCode = ''
      this.createTemp.eqName = ''
      this.createTemp.specification = ''
      this.createTemp.providerName = ''
      this.createTemp.financeCode = ''
      this.createTemp.status = '正常'
      this.createTemp.providerName = ''
      this.createTemp.brandName = ''
      this.createTemp.purpose = ''
      this.createTemp.purchaseDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.entranceDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.assetCode = ''
      this.createTemp.yearUpkeepCost = ''
      this.createTemp.yearMaintainDost = ''
      this.createTemp.yuanzhi = ''

      this.createTemp.baseHours = ''
      this.createTemp.upkeepgrade = 113
      this.createTemp.salvage = ''
      this.createTemp.subtractvalue = ''
      this.createTemp.yearMaintainCost = ''
      this.createTemp.inputUserName = ''
      this.createTemp.picpath = ''
      this.fileList = []
      this.showUpload = false
      this.createTemp.fileList = []
      this.createTemp.depreciation = '5'
    },


    form_add() {
      this.resetCreateTemp()
      this.edit = 1
      this.getDepartParam.parammaps.pastureId = this.createTemp.pastureId
      this.getCreateDepartDownList()
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.$nextTick(() => {
        this.$refs['createTemp'].clearValidate()
      })
    },
    changeBrand(item) {
      this.createTemp.brandName = this.findAllBrand.find(obj => obj.id === item).name
    },
    changeUpkeepgrade(item) {
      console.log(item)
    },
    upkeepgradeChange(e) {
      if (!e) {
        this.$refs['upkeepgrade'].blur()
      }
    },
    popoverHide(checkedIds, checkedData) {
      console.log(checkedIds, checkedData)
      if (checkedIds !== null) {
        this.getdataEQNumber.parammaps.eqCode = checkedData.typeCode
        // if (checkedData.children === undefined) {
        //   this.createTemp.eqClassId = checkedData.eqClassId
        //   this.createTemp.eqName = checkedData.NewName
        //   this.getdataListParm.parammaps.eqClassId = checkedData.eqClassId
        //   this.getEQNumber()
        // } else {
        //   this.defaultCheckedKeys = []
        //   this.createTemp.eqClassId = ''
        //   this.getdataListParm.parammaps.eqClassId = ''
        //   this.$message({ type: 'warning', message: '请选择具体设备类型' })
        // }
        this.createTemp.eqClassId = checkedData.eqClassId
          this.createTemp.eqName = checkedData.NewName
          this.getdataListParm.parammaps.eqClassId = checkedData.eqClassId
          this.getEQNumber()
      } else {
        this.defaultCheckedKeys = []
        this.createTemp.eqClassId = ''
        this.getdataListParm.parammaps.eqClassId = ''
      }
    },
    add_dialog_save() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          console.log(this.createTemp)
          this.requestParam.name = 'insertAsset'
          if (this.createTemp.status == '正常') { this.createTemp.status = 17 }
          if (this.createTemp.providerId == '') { this.createTemp.providerId = 0 }
          if (this.createTemp.brandId == '') { this.createTemp.brandId = 0 }
          if (this.createTemp.yuanzhi == '') { this.createTemp.yuanzhi = 0 }
          if (this.createTemp.salvage == '') { this.createTemp.salvage = 0 }
          if (this.createTemp.subtractvalue == '') { this.createTemp.subtractvalue = 0 }
          if (this.createTemp.yearUpkeepCost == '') { this.createTemp.yearUpkeepCost = 0 }
          if (this.createTemp.yearMaintainCost == '') { this.createTemp.yearMaintainCost = 0 }
          if (this.createTemp.baseHours == '') { this.createTemp.baseHours = 0 }
          // 原值yuanzhi残值salvage月核减值subtractvalue保养费用yearUpkeepCost维修费用yearMaintainCost
          var rulesValue = /^\d+(\.\d{1,3})?$/
          this.requestParam.parammaps = this.createTemp
          this.requestParam.parammaps.picpath = this.createTemp.picpath
          if (this.createTemp.yuanzhi !== '' || this.createTemp.salvage !== '' || this.createTemp.subtractvalue !== '' || this.createTemp.yearUpkeepCost !== '' || this.createTemp.yearMaintainCost !== '') {
            this.requestParam.parammaps.yuanzhi = parseFloat(this.createTemp.yuanzhi)
            if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi))) {
              this.$message({ type: 'error', message: '原值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.salvage))) {
              this.$message({ type: 'error', message: '残值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.subtractvalue))) {
              this.$message({ type: 'error', message: '月核减值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost))) {
              this.$message({ type: 'error', message: '保养费用输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
              this.$message({ type: 'error', message: '维修费用请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
          }


          if(this.requestParam.parammaps.maintenance.length != 0 && this.requestParam.parammaps.maintenance){
              if(this.requestParam.parammaps.maintenance.length > 4){
                this.$notify({ title: '提示', message: '指定维修人最多4个人！', type: 'success', duration: 2000 })
                return false
              }

             this.requestParam.parammaps.maintenance = this.requestParam.parammaps.maintenance.toString()
          }
          PostDataByName(this.requestParam).then(response => {
            console.log('新增保存发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              if (this.getdataListParm.parammaps.inputDatetime1 === null) {
                this.getdataListParm.parammaps.inputDatetime1 = ''
              }
              this.dialogFormVisible = false
              this.get_table_data()
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
              // this.reload()
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    // 继续新增
    add_dialog_save_again() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'insertAsset'
          if (this.createTemp.status == '正常') { this.createTemp.status = 17 }
          if (this.createTemp.providerId == '') { this.createTemp.providerId = 0 }
          if (this.createTemp.brandId == '') { this.createTemp.brandId = 0 }
          if (this.createTemp.yuanzhi == '') { this.createTemp.yuanzhi = 0 }
          if (this.createTemp.salvage == '') { this.createTemp.salvage = 0 }
          if (this.createTemp.subtractvalue == '') { this.createTemp.subtractvalue = 0 }
          if (this.createTemp.yearUpkeepCost == '') { this.createTemp.yearUpkeepCost = 0 }
          if (this.createTemp.yearMaintainCost == '') { this.createTemp.yearMaintainCost = 0 }
          if (this.createTemp.baseHours == '') { this.createTemp.baseHours = 0 }
          // 原值yuanzhi残值salvage月核减值subtractvalue保养费用yearUpkeepCost维修费用yearMaintainCost
          var rulesValue = /^\d+(\.\d{1,3})?$/
          this.requestParam.parammaps = this.createTemp
          this.requestParam.parammaps.picpath = this.createTemp.picpath
          if (this.createTemp.yuanzhi !== '' || this.createTemp.salvage !== '' || this.createTemp.subtractvalue !== '' || this.createTemp.yearUpkeepCost !== '' || this.createTemp.yearMaintainCost !== '') {
            this.requestParam.parammaps.yuanzhi = parseFloat(this.createTemp.yuanzhi)
            // if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi)) || !rulesValue.test(parseFloat(this.createTemp.salvage)) || !rulesValue.test(parseFloat(this.createTemp.subtractvalue)) || !rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost)) || !rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
            if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi))) {
              this.$message({ type: 'error', message: '原值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.salvage))) {
              this.$message({ type: 'error', message: '残值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.subtractvalue))) {
              this.$message({ type: 'error', message: '月核减值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost))) {
              this.$message({ type: 'error', message: '保养费用输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
              this.$message({ type: 'error', message: '维修费用请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
          }

          if(this.requestParam.parammaps.maintenance.length != 0 && this.requestParam.parammaps.maintenance){
              if(this.requestParam.parammaps.maintenance.length > 4){
              this.$notify({ title: '提示', message: '指定维修人最多4个人！', type: 'success', duration: 2000 })
              return false
            }
             this.requestParam.parammaps.maintenance = this.requestParam.parammaps.maintenance.toString()
          }
          PostDataByName(this.requestParam).then(response => {
            console.log('新增保存发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              if (this.getdataListParm.parammaps.inputDatetime === null) {
                this.getdataListParm.parammaps.inputDatetime = ''
              }
              this.resetCreateTemp()
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    form_edit(row) {
      if (this.dialogFormVisible) {
        return
      }
      this.edit = 0
      this.getDepartParam.parammaps.pastureId = row.pastureId
      this.getCreateDepartDownList()
      this.createTemp = Object.assign({}, row) // copy obj
      if (row.inputUser !== undefined) {
        this.createTemp.inputUser = parseInt(row.inputUser)
      }


      if (row.levelone !== undefined) {
        this.createTemp.levelone = parseInt(row.levelone)
      }
      if (row.leveltwo !== undefined) {
        this.createTemp.leveltwo = parseInt(row.leveltwo)
      }
      if (row.levelthree !== undefined) {
        this.createTemp.levelthree = parseInt(row.levelthree)
      }
      if (row.leveloneTime !== undefined) {
        this.createTemp.leveloneTime = parseInt(row.leveloneTime)
      }

      if (row.leveltwoTime !== undefined) {
        this.createTemp.leveltwoTime = parseInt(row.leveltwoTime)
      }
      if (row.levelthreeTime !== undefined) {
        this.createTemp.levelthreeTime = parseInt(row.levelthreeTime)
      }


      if (row.maintenance !== undefined) {
        var newArr = row.maintenance.split(",")
        var arr2 = []
        newArr.forEach(function(item){
          arr2.push(parseInt(item))
        })
        console.log('arr2',arr2)
        this.createTemp.maintenance = arr2
      }


      if (this.createTemp.eqClassId !== undefined) {
        this.defaultCheckedKeys = [this.createTemp.eqClassId]
      } else {
        this.createTemp.eqClassId = ''
        this.defaultCheckedKeys = []
      }
      this.dialogStatus = 'update'
      this.dialogFormVisible = true
      this.$nextTick(() => {
        this.$refs['createTemp'].clearValidate()
      })
      const urlArray = []
      const fileList = []
      if (row.picpath == undefined) {
        urlArray.push()
      } else if (row.picpath == '') {
        urlArray.push()
      } else {
        urlArray.push(row.picpath)
      }
      for (let i = 0; i < urlArray.length; i++) {
        const urlObj = {}
        this.$set(urlObj, 'url', urlArray[i])
        fileList.push(urlObj)
      }
      this.$set(this.createTemp, 'fileList', fileList)
      console.log(this.createTemp)
      if (this.createTemp.fileList.length >= 1) {
        this.showUpload = true
      } else {
        this.showUpload = false
      }



    },
    edit_dialog_save() {
      console.log(this.createTemp.maintenance)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          console.log('-----------', this.createTemp)
          console.log(this.createTemp.providerId)
          if (this.createTemp.eqClassId == '' || this.createTemp.eqClassId == undefined || this.createTemp.eqClassId == null) {
            this.$message({ type: 'warning', message: '请选择设备类别' })
          } else {
            this.requestParam.name = 'updateAsset'
            this.requestParam.parammaps = this.createTemp
            if (this.createTemp.status === '正常') { this.createTemp.status = 17 }
            if (this.createTemp.status === '闲置') { this.createTemp.status = 18 }
            if (this.createTemp.status === '报废') { this.createTemp.status = 19 }
            if (this.createTemp.status === '封存') { this.createTemp.status = 20 }
            if (this.createTemp.providerId === '' || this.createTemp.providerId === undefined) { this.createTemp.providerId = 0 }
            if (this.createTemp.brandId === '' || this.createTemp.brandId == undefined) { this.createTemp.brandId = 0 }
            if (this.createTemp.yuanzhi === '') { this.createTemp.yuanzhi = 0 }
            if (this.createTemp.salvage === '') { this.createTemp.salvage = 0 }
            if (this.createTemp.subtractvalue === '') { this.createTemp.subtractvalue = 0 }
            if (this.createTemp.yearUpkeepCost === '') { this.createTemp.yearUpkeepCost = 0 }
            if (this.createTemp.yearMaintainCost === '') { this.createTemp.yearMaintainCost = 0 }
            if (this.createTemp.baseHours === '') { this.createTemp.baseHours = 0 }
            if (this.createTemp.upkeepgrade === 'A' || this.createTemp.upkeepgrade === 'B' || this.createTemp.upkeepgrade === 'C') {
              this.createTemp.upkeepgrade = this.createTemp.upkeepgradeId
              this.createTemp.upkeepgradeId = ''
            }
            this.createTemp.deptId = this.createTemp.deptId
            this.createTemp.departmentName = this.createTemp.departmentName
            this.createTemp.employeeId = this.createTemp.employeId
            // var rulesValue = /^\d+(\.\d{1,3})?$/
            this.requestParam.parammaps = this.createTemp
            if (this.tabName === 'first') {
              this.requestParam.parammaps.SHStatus = this.createTemp.SHStatus
            } else if (this.tabName === 'second') {
              this.requestParam.parammaps.SHStatus = 0
            }
            const picpath = parseInt(this.createTemp.picpath)
            if (isNaN(picpath) == false) {
              this.requestParam.parammaps.picpath = this.createTemp.picpath
            } else {
              this.requestParam.parammaps.picpath = this.createTemp.picId
            }


          if(this.requestParam.parammaps.maintenance.length != 0 && this.requestParam.parammaps.maintenance){

            if(this.requestParam.parammaps.maintenance.length > 4){
              this.$notify({ title: '提示', message: '指定维修人最多4个人！', type: 'success', duration: 2000 })
              return false
            }

            this.requestParam.parammaps.maintenance = this.requestParam.parammaps.maintenance.toString()
          }


            PostDataByName(this.requestParam).then(response => {
              console.log(response)
              if (response.msg !== 'fail') {
                if (this.getdataListParm.parammaps.inputDatetime1 === null) {
                  this.getdataListParm.parammaps.inputDatetime1 = ''
                }
                this.get_table_data()
                this.get_table_dataSH()
                this.dialogFormVisible = false
                this.$notify({ title: '成功', message: '保存成功-', type: 'success', duration: 2000 })
                // this.reload()
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        }
      })
    },
    brandSearch(queryString, cb) {
      console.log('品牌模糊查询输入值', queryString)
      this.requestBrand.parammaps['brandName'] = queryString
      GetDataByName(this.requestBrand).then(response => {
        console.log('品牌模糊查询搜索data', response.data.list)
        this.BrandList = response.data.list
        cb(this.BrandList)
      })
    },
    handleSelectBrand(item) {
      console.log('品牌模糊查询选中值', item)
      this.$set(this.createTemp, 'brandName', item.brandName)
      this.$set(this.createTemp, 'brandId', item.brandId)
      this.$forceUpdate()
    },
    employeSearch(queryString, cb) {
      console.log('责任人模糊查询输入值', queryString)
      this.requestEmploye.parammaps['empname'] = queryString
      GetDataByName(this.requestEmploye).then(response => {
        console.log('责任人模糊查询搜索data', response.data.list)
        this.employeList = response.data.list
        cb(this.employeList)
      })
    },
    handleSelectEmploye(item) {
      console.log('责任人模糊查询选中值', item)
      this.$set(this.createTemp, 'employeId', item.id)
      this.$set(this.createTemp, 'employeName', item.name)
      this.$forceUpdate()
    },
    form_see(row) {
      console.log(row)
      this.seeTemp = Object.assign({}, row) // copy obj
      this.activeName = 'first'
      this.dialogStatus = 'card'
      this.dialogFormVisible_See = true
      // 流程图
      var reason = '未通过原因:' + this.seeTemp.workflowNote
      if (this.seeTemp.SHStatus === 0) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核' }]
        this.active = 1
      } else if (this.seeTemp.SHStatus === 1) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
        this.active = 2
      } else if (this.seeTemp.SHStatus === 2) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
        this.active = 2
      }
      // 查看-点检记录
    },
    form_seeTabClick(val) {
      console.log(val)
      if (val.name == 'second') {
        this.getAssetBigSpotCheckList()
      } else if (val.name == 'third') {
        this.getBigupkeepbyeqList()
      } else if (val.name == 'fouth') {
        this.getAssetMaintainList()
      } else if (val.name == 'fifth') {
        this.getAssetSTTList()
      } else if (val.name == 'sixth') {
        this.getAssetChangeList()
      } else if (val.name == 'seventh') {
        this.getAssetPartApplyList()
      } else if (val.name == 'eighth') {
        this.getBarChart1Parm.parammaps.eqId = this.seeTemp.id
        this.getBarChart2Parm.parammaps.eqId = this.seeTemp.id
        this.getChartSeeParm.parammaps.eqId = this.seeTemp.id

        this.getBarChart1()
        this.getBarChart2()
      }
    },
    // 点检记录
    getAssetBigSpotCheckList() {
      this.listLoadingSpotCheck1 = true
      if (this.$refs['inputDatetimeCheck1'] !== undefined && this.$refs['inputDatetimeCheck1'].value !== null) {
        this.getAssetBigSpotCheckListParm.parammaps.startTime = this.$refs['inputDatetimeCheck1'].value[0]
        this.getAssetBigSpotCheckListParm.parammaps.stopTime = this.$refs['inputDatetimeCheck1'].value[1]
      } else {
        this.getAssetBigSpotCheckListParm.parammaps.startTime = ''
        this.getAssetBigSpotCheckListParm.parammaps.stopTime = ''
      }
      this.getAssetBigSpotCheckListParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetBigSpotCheckListParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetBigSpotCheckListParm).then(response => {
        console.log('点检记录-table数据', response.data.list)
        if (response.data.list !== null) {
          this.listSpotCheck1 = response.data.list
          this.pageNumSpotCheck1 = response.data.pageNum
          this.pageSizeSpotCheck1 = response.data.pageSize
        } else {
          this.listSpotCheck1 = []
        }
        this.totalSpotCheck1 = response.data.total
        setTimeout(() => {
          this.listLoadingSpotCheck1 = false
        }, 100)
      })
    },
    form_searchSportCheck() {
      if (this.getAssetBigSpotCheckListParm.parammaps.inputDatetimeCheck1 == null) {
        this.getAssetBigSpotCheckListParm.parammaps.inputDatetimeCheck1 = ''
      }
      this.getAssetBigSpotCheckListParm.offset = 1
      this.getAssetBigSpotCheckList()
    },
    // 保养记录
    getBigupkeepbyeqList() {
      this.listLoadingSpotCheck1 = true
      if (this.$refs['inputDatetimeUpkeepbyeq'] !== undefined && this.$refs['inputDatetimeUpkeepbyeq'].value !== null) {
        this.getBigupkeepbyeqParm.parammaps.startTime = this.$refs['inputDatetimeUpkeepbyeq'].value[0]
        this.getBigupkeepbyeqParm.parammaps.stopTime = this.$refs['inputDatetimeUpkeepbyeq'].value[1]
      } else {
        this.getBigupkeepbyeqParm.parammaps.startTime = ''
        this.getBigupkeepbyeqParm.parammaps.stopTime = ''
      }
      this.getBigupkeepbyeqParm.parammaps.assetId = this.seeTemp.assetId
      this.getBigupkeepbyeqParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getBigupkeepbyeqParm).then(response => {
        console.log('保养记录-table数据', response.data.list)
        if (response.data.list !== null) {
          this.listUpkeepbyeq = response.data.list
          this.pageNumUpkeepbyeq = response.data.pageNum
          this.pageSizeUpkeepbyeq = response.data.pageSize
        } else {
          this.listUpkeepbyeq = []
        }
        this.totalUpkeepbyeq = response.data.total
        setTimeout(() => {
          this.listLoadingSpotCheck1 = false
        }, 100)
      })
    },
    form_searchUpkeepbyeq() {
      if (this.getBigupkeepbyeqParm.parammaps.inputDatetimeUpkeepbyeq === null) {
        this.getBigupkeepbyeqParm.parammaps.inputDatetimeUpkeepbyeq = ''
      }
      this.getBigupkeepbyeqParm.offset = 1
      this.getBigupkeepbyeqList()
    },
    // 维修记录
    getAssetMaintainList() {
      this.listLoadingAssetMaintain = true
      if (this.$refs['inputDatetimeAssetMaintain'] !== undefined && this.$refs['inputDatetimeAssetMaintain'].value !== null) {
        this.getAssetMaintainParm.parammaps.startTime = this.$refs['inputDatetimeAssetMaintain'].value[0]
        this.getAssetMaintainParm.parammaps.stopTime = this.$refs['inputDatetimeAssetMaintain'].value[1]
      } else {
        this.getAssetMaintainParm.parammaps.startTime = ''
        this.getAssetMaintainParm.parammaps.stopTime = ''
      }
      this.getAssetMaintainParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetMaintainParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetMaintainParm).then(response => {
        console.log('维修记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetMaintain = response.data.list
          this.pageNumAssetMaintain = response.data.pageNum
          this.pageSizeAssetMaintain = response.data.pageSize
        } else {
          this.listAssetMaintain = []
        }

        this.totalAssetMaintain = response.data.total

        setTimeout(() => {
          this.listLoadingAssetMaintain = false
        }, 100)
      })
    },
    form_searchAssetMaintain() {
      if (this.getBigupkeepbyeqParm.parammaps.inputDatetimeAssetMaintan === null) {
        this.getBigupkeepbyeqParm.parammaps.inputDatetimeAssetMaintan = ''
      }
      this.getBigupkeepbyeqParm.offset = 1
      this.getAssetMaintainList()
    },
    // 启停记录
    getAssetSTTList() {
      this.listLoadingAssetSTT = true
      this.getAssetSTTParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetSTTParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetSTTParm).then(response => {
        console.log('启停记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetSTT = response.data.list
          this.pageNumAssetSTT = response.data.pageNum
          this.pageSizeAssetSTT = response.data.pageSize
        } else {
          this.listAssetSTT = []
        }
        this.totalAssetSTT = response.data.total
        setTimeout(() => {
          this.listLoadingAssetSTT = false
        }, 100)
      })
    },
    form_searchAssetSTT() {
      if (this.getAssetSTTParm.parammaps.startTime == null) {
        this.getAssetSTTParm.parammaps.startTime = ''
      }
      if (this.getAssetSTTParm.parammaps.stopTime == null) {
        this.getAssetSTTParm.parammaps.stopTime = ''
      }
      this.getAssetSTTParm.offset = 1
      this.getAssetSTTList()
    },
    // 变更记录
    getAssetChangeList() {
      this.listLoadingAssetChange = true
      console.log(this.$refs['inputDatetimeAssetChange'])
      if (this.$refs['inputDatetimeAssetChange'] !== undefined && this.$refs['inputDatetimeAssetChange'].value !== null) {
        this.getAssetChangeParm.parammaps.startTime = this.$refs['inputDatetimeAssetChange'].value[0]
        this.getAssetChangeParm.parammaps.stopTime = this.$refs['inputDatetimeAssetChange'].value[1]
      } else {
        this.getAssetChangeParm.parammaps.startTime = ''
        this.getAssetChangeParm.parammaps.stopTime = ''
      }
      this.getAssetChangeParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetChangeParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetChangeParm).then(response => {
        console.log('变更记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetChange = response.data.list
          this.pageNumAssetChange = response.data.pageNum
          this.pageSizeAssetChange = response.data.pageSize
        } else {
          this.listAssetChange = []
        }
        this.totalAssetChange = response.data.total
        setTimeout(() => {
          this.listLoadingAssetChange = false
        }, 100)
      })
    },
    form_searchAssetChange() {
      if (this.getAssetChangeParm.parammaps.inputDatetimeAssetChange === null) {
        this.getAssetChangeParm.parammaps.inputDatetimeAssetChange = ''
      }
      this.getAssetChangeParm.offset = 1
      this.getAssetChangeList()
    },
    changeStatue: function(cellValue) {
      if (cellValue.changeStatue == 17) {
        return '正常'
      } else if (cellValue.changeStatue == 18) {
        return '闲置'
      } else if (cellValue.changeStatue == 19) {
        return '报废'
      } else if (cellValue.changeStatue == 20) {
        return '封存'
      }
    },
    // 备件领用记录
    getAssetPartApplyList() {
      this.listLoadingAssetChange = true
      console.log(this.$refs['inputDatetimeAssetPartApply'].value)
      if (this.$refs['inputDatetimeAssetPartApply'] !== undefined && this.$refs['inputDatetimeAssetPartApply'].value !== null && this.$refs['inputDatetimeAssetPartApply'].value !== '') {
        this.getAssetPartApplyParm.parammaps.startTime = this.$refs['inputDatetimeAssetPartApply'].value[0]
        this.getAssetPartApplyParm.parammaps.stopTime = this.$refs['inputDatetimeAssetPartApply'].value[1]
      } else {
        this.getAssetPartApplyParm.parammaps.startTime = ''
        this.getAssetPartApplyParm.parammaps.stopTime = ''
      }
      this.getAssetPartApplyParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetPartApplyParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetPartApplyParm).then(response => {
        console.log('备件领用记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetPartApply = response.data.list
          this.pageNumAssetPartApply = response.data.pageNum
          this.pageSizeAssetPartApply = response.data.pageSize
        } else {
          this.listAssetPartApply = []
        }
        this.totalAssetPartApply = response.data.total
        setTimeout(() => {
          this.listLoadingAssetPartApply = false
        }, 100)
      })
    },
    form_searchAssetPartApply() {
      this.listLoadingAssetChange = true
      if (this.getAssetPartApplyParm.parammaps.inputDatetimeAssetChange == null) {
        this.getAssetPartApplyParm.parammaps.inputDatetimeAssetChange = ''
      }
      this.getAssetPartApplyParm.offset = 1
      this.getAssetPartApplyList()
    },
    getBarChart1() {
      GetReportform(this.getBarChart1Parm).then(response => {
        console.log('图1', response)
        this.chart_data1 = response.data.chart_data
        var repireCost = response.data.chart_data.repireCost
        var upkeepCost = response.data.chart_data.upkeepCost
        var totaltitle1 = 0
        if (repireCost !== null || repireCost !== undefined) {
          repireCost.forEach(function(item, index) {
            console.log(parseFloat(item))
            totaltitle1 = totaltitle1 + parseFloat(item)
          })
        }
        var totaltitle2 = 0
        if (upkeepCost !== null || upkeepCost !== undefined) {
          upkeepCost.forEach(function(item, index) {
            console.log(parseFloat(item))
            totaltitle2 = totaltitle2 + parseFloat(item)
          })
        }
        this.totaltitle = totaltitle1 + totaltitle2
        this.roadBarChart1(this.chart_data1, this.totaltitle.toFixed(2))
      })
    },
    roadBarChart1(chart_data1, totaltitle) {
      console.log(chart_data1, totaltitle)
      if (this.barChart1 != null) {
        this.barChart1.dispose()
      }
      this.barChart1 = echarts.init(document.getElementById('barChart1'))
      var option = {
        title: { text: '年度费用统计（总费用:' + totaltitle + '元）', textStyle: { color: '#769cfc' }},
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为:'line' | 'shadow'
          },
          formatter: function(data) {
            console.log(data.length)
            var value = 0
            let val = ''
            if (data.length == 1) {
              val += data[0].seriesName + ':' + data[0].data + '元<br/>'
            } else {
              value = (parseFloat(data[0].value) + parseFloat(data[1].value)).toFixed(2)
              // eslint-disable-next-line no-unused-vars
              val = data[0].name + '年设备总费用:' + value + '元' + '<br/>'
              val += '维修费用:' + data[0].data + '元<br/>'
              val += '保养费用:' + data[1].data + '元<br/>'
            }
            return val
          }
        },
        legend: {
          data: ['维修费用', '保养费用'],
          x: 'right'
        },
        color: ['#769cfc', '#42b983'],
        grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
        xAxis: [
          { type: 'category', data: this.chart_data1.year }
        ],
        yAxis: [
          { type: 'value', name: '费用(元)' }
        ],
        series: [
          { name: '维修费用', type: 'bar', barWidth: 60, stack: '广告', data: this.chart_data1.repireCost },
          { name: '保养费用', type: 'bar', barWidth: 60, stack: '广告', data: this.chart_data1.upkeepCost }
        ]
      }
      this.barChart1.setOption(option)
      var that = this
      window.onresize = function() {
        that.barChart1.resize()
      }
      this.barChart1.on('click', function(param, i) {
        console.log(param)
        that.getBarChart2Parm.parammaps.receiveTime = param.name
        that.getBarChart2()
        that.getBarChart1()
      })
    },
    getBarChart2() {
      GetReportform(this.getBarChart2Parm).then(response => {
        console.log('图2', response)
        this.chart_data2 = response.data.chart_data
        this.roadBarChart2(this.chart_data2)
      })
    },
    roadBarChart2(chart_data1) {
      if (this.barChart2 != null) {
        this.barChart2.dispose()
      }
      this.barChart2 = echarts.init(document.getElementById('barChart2'))
      var option = {
        title: { text: this.getBarChart2Parm.parammaps.receiveTime + '年月度费用统计', textStyle: { color: '#769cfc' }},
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为:'line' | 'shadow'
          },
          formatter: function(data) {
            console.log(data)
            var value = 0
            var val = ''
            if (data.length == 1) {
              val += data[0].seriesName + ':' + data[0].data + '元<br/>'
            } else {
              value = (parseFloat(data[0].value) + parseFloat(data[1].value)).toFixed(2)
              val = data[0].name + '月设备总费用:' + value + '元' + '<br/>'
              val += '维修费用:' + data[0].data + '元<br/>'
              val += '保养费用:' + data[1].data + '元<br/>'
            }
            return val
          }
        },
        legend: {
          data: ['维修费用', '保养费用'],
          x: 'right'
        },
        color: ['#769cfc', '#42b983'],
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          { type: 'category', data: this.chart_data2.months }
        ],
        yAxis: [
          { type: 'value', name: '费用(元)' }
        ],
        series: [
          { name: '维修费用', type: 'bar', stack: '广告', data: this.chart_data2.repireCost },
          { name: '保养费用', type: 'bar', stack: '广告', data: this.chart_data2.upkeepCost }
        ]
      }
      this.barChart2.setOption(option)
      var that = this
      window.onresize = function() {
        that.barChart2.resize()
      }
      this.barChart2.on('click', function(param, i) {
        console.log(param)
        that.dialogFormVisible_ChartSee = true
        that.dialogStatus = 'card'
        that.getChartSeeParm.parammaps.receiveTime = param.name
        that.getChartSeeList()
        that.getBarChart1()
        that.getBarChart2()
      })
    },
    getChartSeeList() {
      this.listLoadingChartSee = true
      if (this.$refs['inputDatetime2'] !== undefined && this.$refs['inputDatetime2'].value !== null) {
        this.getChartSeeParm.parammaps.startTime = this.$refs['inputDatetime2'].value[0]
        this.getChartSeeParm.parammaps.stopTime = this.$refs['inputDatetime2'].value[1]
      } else {
        this.getChartSeeParm.parammaps.startTime = ''
        this.getChartSeeParm.parammaps.stopTime = ''
      }
      GetDataByName(this.getChartSeeParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.listChartSee = response.data.list
          this.pageNumChartSee = response.data.pageNum
          this.pageSizeChartSee = response.data.pageSize
          if (response.data.total) {
            this.totalChartSee = response.data.total
          }
        } else {
          this.listChartSee = []
        }
        setTimeout(() => {
          this.listLoadingChartSee = false
        }, 100)
      })
    },
    form_searchChartSee() {
      this.listLoadingChartSee = true
      if (this.getChartSeeParm.parammaps.inputDatetime2 === null) {
        this.getChartSeeParm.parammaps.inputDatetime2 = ''
      }
      this.getChartSeeParm.offset = 1
      this.getChartSeeList()
    },
    handleDownloadChartSee() {
      this.$alert('正在导出中，请勿刷新或离开本页面，若导出时间过长，建议缩小导出数据范围重新导出', {})
      this.isPercentage = true
      this.percentage = 1
      var timer = setInterval(() => {
        this.percentage += 5
        if (this.percentage > 95) {
          this.percentage = 99
          clearInterval(timer)
        }
        this.percentage = this.percentage
      }, 1000)
      this.downLoadParm2.name = 'getEqPartuseDetailList'
      this.downLoadParm2.returntype = 'Map'
      this.downLoadParm2.parammaps = this.getChartSeeParm.parammaps
      GetAccount(this.downLoadParm2).then(response => {
        this.$nextTick(() => {
          this.downLoadList2 = response.data.list
          if (response.data.list !== '') {
            this.percentage = 99
            setTimeout(() => {
              this.isPercentage = false
            }, 2000)
          }
          console.log(this.downLoadList2)




          const ExcelDatas = [
            {
              tHeader: ['类型', '单号', '领用日期', '领用部门', '备件编号', '备件名称', '备件规格', '备件品牌', '计量单位', '出库数量', '退库数量', '单价', '总价'],
              filterVal: ['useTypeV', 'RUcode', 'creatTime', 'departmentName', 'partCode', 'partName', 'specification', 'brandName', 'unit', 'checkoutNumber', 'quitNumber', 'price', 'sumPrice'],
              tableDatas: this.downLoadList2,
              sheetName: '费用统计'
            }
          ]
          json2excel(ExcelDatas, '费用统计', true, 'xlsx')
        })
      })
    },
    form_delete(row) {
      MessageBox.confirm('确认删除此信息?', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.requestParam.name = 'deleteAsset'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps['id'] = row.id
        PostDataByName(this.requestParam).then(() => {
          if (this.getdataListParm.parammaps.inputDatetime1 === null) {
            this.getdataListParm.parammaps.inputDatetime1 = ''
          }
          this.get_table_data()
          this.get_table_dataSH()
          this.dialogFormVisible = false
          this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消删除' })
      })
    },
    getDownClassList() {
      getRecuData(this.getRecuListParm).then(response => {
        this.parentClass = response.data
      })
    },

    getEQNumber() {
      this.getdataEQNumber.parammaps.pastureId = Cookies.get('pastureid')
      GetDataByName(this.getdataEQNumber).then(response => {


        this.createTemp.assetCode = response.data.list[0].createNumber
        console.log(response.data.list[0].createNumber)
        console.log(this.createTemp.assetCode)
        this.$forceUpdate()

      })
    },

    handleTabClick(val) {
      console.log('点击了基础信息/审核设备tab', val)
      if (val.name == 'first') {
        this.isFlowChart = false
        this.isDisplayRecord = true
      } else {
        this.isFlowChart = true
        this.isDisplayRecord = false
      }
      this.get_table_data()
      this.get_table_dataSH()
    },
    handleExamine(row) {
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'SHstatue', 1)
        this.$set(this.seeTemp, 'workflowNote', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'SHstatue', 1)
        this.$set(this.examineTemp, 'workflowNote', '')
      }
      this.dialogStatus = 'examine'
      this.dialogFormVisible_Examine = true
      this.statueReason = false
      this.keyupSubmit()
    },
    changeSHStatue(val) {
      if (val == 2) {
        this.statueReason = true
      } else {
        this.statueReason = false
      }
    },
    keyupSubmit() {
      document.onkeydown = e => {
        const _key = window.event.keyCode
        if (_key === 13) {
          this.createExamineData()
        }
      }
    },
    createExamineData() {
      if (this.dialogStatus !== 'update' && this.dialogStatus !== 'create') {
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'eqCharge'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            if (this.examineTemp.SHstatue == 1) {
              this.requestParam.parammaps.statue = 1
            } else {
              this.requestParam.parammaps.statue = 2
            }
            this.requestParam.parammaps.empId	 = Cookies.get('employeid')
            this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
            PostDataByName(this.requestParam).then(response => {
              console.log('审核确认发送参数', this.requestParam)
              if (response.msg !== 'fail') {
                this.dialogFormVisible_Examine = false
                this.dialogFormVisible_See = false
                this.statueReason = false
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
                this.get_table_dataSH()
                this.get_table_data()
                this.activeName == 'second'
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      }
    },
    handleDownload() {
      this.$alert('设备基础信息正在导出中，请勿刷新或离开本页面，若导出时间过长，建议缩小导出数据范围重新导出', {})
      this.isPercentage = true
      this.percentage = 1
      var timer = setInterval(() => {
        this.percentage += 5
        if (this.percentage > 95) {
          this.percentage = 99
          clearInterval(timer)
        }
        this.percentage = this.percentage
      }, 1000)
      this.downLoadParm.name = 'getAssetList'
      this.downLoadParm.parammaps = this.getdataListParm.parammaps
      GetAccount(this.downLoadParm).then(response => {
        this.downLoadList = response.data.list
        if (response.data.list !== '') {
          this.percentage = 99
          setTimeout(() => {
            this.isPercentage = false
          }, 2000)
        }
        console.log(this.downLoadList)



        const elecExcelDatas = [
          {
            tHeader: ['牧场','设备类别', '资产编号', '设备名称', '设备内部编号', '设备规格', '品牌', '供应商', '用途', '状态', '购置日期', '入场日期', '折旧年限', '财务编号', '原值', '残值', '月核减值', '保养级别', '保养费用', '维修费用', '基数(小时)',  '部门', '责任人', '录入人', '录入时间', '使用时长(年)', '使用率(%)', '指定维修人', '一级督办', '一级间隔时间', '二级督办', '二级间隔时间', '三级督办', '三级间隔时间',],
            filterVal: ['pastureName','eqClassName', 'assetCode', 'eqName', 'eqCode', 'specification', 'brandName', 'providerName', 'purpose', 'status', 'purchaseDate', 'entranceDate', 'depreciation', 'financeCode', 'yuanzhi', 'salvage', 'subtractvalue', 'upkeepgrade', 'yearUpkeepCost', 'yearMaintainCost', 'baseHours', 'deptName', 'employeName', 'inputUserName', 'inputDatetime', 'serviceDuration', 'utilizationRate', 'maintenanceName',  'leveloneName', 'leveloneTime','leveltwoName', 'leveltwoTime','levelthreeName','levelthreeTime' ],
            tableDatas: this.downLoadList,
            sheetName: '设备基础信息'
          }





        ]
        json2excel(elecExcelDatas, '设备基础信息', true, 'xlsx')
      })
    },
    handleDownloadSH() {
      this.$alert('设备基础信息正在导出中，请勿刷新或离开本页面，若导出时间过长，建议缩小导出数据范围重新导出', {})
      this.isPercentage = true
      this.percentage = 1
      var timer = setInterval(() => {
        this.percentage += 5
        if (this.percentage > 95) {
          this.percentage = 99
          clearInterval(timer)
        }
        this.percentage = this.percentage
      }, 1000)
      this.downLoadParm.name = 'getAssetListSH'
      this.downLoadParm.parammaps = this.getdataListParmSH.parammaps
      GetAccount(this.downLoadParm).then(response => {
        this.downLoadList = response.data.list
        if (response.data.list !== '') {
          this.percentage = 99
          setTimeout(() => {
            this.isPercentage = false
          }, 2000)
        }
        console.log(this.downLoadList)
        const elecExcelDatas = [
          {
            tHeader: ['设备类别', '资产编号', '设备名称', '设备内部编号', '设备规格', '品牌', '供应商', '用途', '状态', '购置日期', '入场日期', '折旧年限', '财务编号', '原值', '残值', '月核减值', '保养级别', '保养费用', '维修费用', '基数(小时)', '牧场', '部门', '责任人', '录入人', '录入时间'],
            filterVal: ['eqClassName', 'assetCode', 'eqName', 'eqCode', 'specification', 'brandName', 'providerName', 'purpose', 'status', 'purchaseDate', 'entranceDate', 'depreciation', 'financeCode', 'yuanzhi', 'salvage', 'subtractvalue', 'upkeepgrade', 'yearUpkeepCost', 'yearMaintainCost', 'baseHours', 'pastureName', 'deptName', 'employeName', 'inputUserName', 'inputDatetime'],
            tableDatas: this.downLoadList,
            sheetName: '设备基础信息'
          }
        ]
        json2excel(elecExcelDatas, '设备基础信息', true, 'xlsx')
      })
    },
    handleSelectionChange(item) {
      this.selectionList = item
    },
    handleBatchChange() {
      if (this.selectionList.length > 0) {
        for (let i = 0; i < this.selectionList.length; i++) {
          if (this.selectionList[i].pastureId !== this.selectionList[0].pastureId) {
            this.$message({ type: 'error', message: '请检测变更牧场是否一致！', duration: 2000 })
            return false
          }
        }
        console.log('批量变更')
        this.batchChange.temp.departmentId = ''
        this.batchChange.temp.employeeId = ''
        this.batchChange.deptList = []
        this.batchChange.personList = []
        this.dialogFormVisible_change = true
        this.dialogStatus = 'change'
        this.batchChange.getdataListParmDept.parammaps.pastureId = this.selectionList[0].pastureId
        this.getBatchChangeDeptDownList()
      } else {
        this.$message({ type: 'error', message: '请选择变更牧场', duration: 2000 })
      }
    },
    getBatchChangeDeptDownList() {
      GetDataByName(this.batchChange.getdataListParmDept).then(response => {
        if (response.data.list !== null) {
          this.batchChange.deptList = response.data.list
        } else {
          this.batchChange.deptList = []
        }
      })
    },
    changeBatchDept(item) {
      console.log(item)
      this.batchChange.getdataListParmPerson.parammaps.deptId = item
      this.batchChange.temp.employeeId = ''
      this.batchChange.getdataListParmPerson.parammaps.pastureId = this.batchChange.deptList.find(obj => obj.deptid == item).pastureId
      this.getBatchChangePersonDownList()
    },
    getBatchChangePersonDownList() {
      GetDataByName(this.batchChange.getdataListParmPerson).then(response => {
        if (response.data.list !== null) {
          this.batchChange.personList = response.data.list
        } else {
          this.batchChange.personList = []
        }
      })
    },
    changeBatchPerson(item) {
      console.log(item)
      this.batchChange.temp.employeeId = item
      this.batchChange.temp.employeName = this.batchChange.personList.find(obj => obj.id == item).empname
      this.$forceUpdate()
    },
    changeData() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['batchChangeTemp'].validate(valid => {
        if (valid) {
          this.requestParam = {}
          var array = []
          for (let i = 0; i < this.selectionList.length; i++) {
            var obj = {}
            var parammaps = {}
            obj.name = 'updateEquipmentALL'
            obj.offset = 0
            obj.pagecount = 0
            parammaps.departmentId = this.batchChange.temp.departmentId
            parammaps.employeeId = this.batchChange.temp.employeeId
            parammaps.employeName = this.batchChange.temp.employeName
            parammaps.id = this.selectionList[i].id
            obj.parammaps = parammaps
            array.push(obj)
          }
          this.requestParam.array = array
          PostDataByNames(this.requestParam).then(response => {
            if (response.msg !== 'fail') {
              this.dialogFormVisible_change = false
              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
              this.get_table_data()
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  .el-autocomplete-suggestion li{
    padding:0 3px!important;
  }
  .el-table .warning-row {
      background: oldlace;
  }
  .el-table .success-row {
      background: #f0f9eb;
  }
</style>
<style lang="scss">
  .upkeepgrade .el-form-item__label{
    line-height: 20px;
  }
  .inputDatetime .el-range-separator{
   padding: 0;
   margin: 0 10px;
  }
  .el-radio__label{
    padding-left: 2px !important;
  }
</style>
<style>
  .el-table .goBeyond { background: #F47C7C ; }
  .el-table .warning { background: #989DF0; }
  .el-table .scrap { background: #D7D7D7; }
</style>
