<template>
  <div class="app-container">
    <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>
      <el-input v-model="getdataListParm.parammaps.upkeepCode" placeholder="保养单号" clearable style="width: 180px;" class="filter-item" />
      <el-input v-model="getdataListParm.parammaps.eqName" placeholder="设备名称" clearable style="width: 180px;" class="filter-item" />
      <el-input v-model="getdataListParm.parammaps.eqCode" placeholder="设备内部编号" clearable style="width: 180px;" 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.statue" 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-select v-model="getdataListParm.parammaps.SHStatue" clearable placeholder="审核状态" class="filter-item" style="width: 120px;">
        <el-option v-for="item in SHStatues" :key="item.id" :label="item.name" :value="item.id" />
      </el-select>
      <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" 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_search">搜索</el-button>
      <div>
        <el-radio-group v-model="radioAll" style="margin-top:-9px" @change="changeAll()">
          <el-radio-button label="全部" />
          <el-badge :value="pending.total" class="item">
            <el-radio-button label="待处理" />
          </el-badge>
          <el-radio-button label="已处理" />
        </el-radio-group>
      </div>
    </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="tableCellStyle"
      class="elTable table-fixed"
    >
      <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="保养单号" min-width="140px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.upkeepCode }}</span>
        </template>
      </el-table-column>
      <el-table-column label="牧场" min-width="140px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.pastureName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="设备内部编号" min-width="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.eqCode }}</span>
        </template>
      </el-table-column>
      <el-table-column label="设备名称" min-width="100px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.eqName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="规格型号" min-width="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.specification }}</span>
        </template>
      </el-table-column>
      <el-table-column label="部门" min-width="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.departmentName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="责任人" min-width="100px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.employeName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="保养人" min-width="100px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.upkeepPerson }}</span>
        </template>
      </el-table-column>
      <el-table-column label="保养日期" sortable prop="plantime" min-width="80px" align="center" />
      <el-table-column label="处理状态" min-width="100px" align="center" :formatter="statue" />
      <el-table-column label="领用单状态" min-width="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.LYStatue }}</span>
        </template>
      </el-table-column>
      <el-table-column label="旧品录入状态" min-width="110px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.LRStatue }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" min-width="80px" align="center" :formatter="SHStatue" />
		<el-table-column prop="img" label="保养过程" width="180" align="center">
        <template slot-scope="scope">
          <!-- <el-link @click="preview(scope.row)" v-if="scope.row.videoTxt == '已录制'">{{ scope.row.videoTxt }} </el-link> -->
           <a style="border-bottom: 1px solid #333;" @click="preview(scope.row)" v-if="scope.row.videoTxt == '已录制'">{{ scope.row.videoTxt }}</a>
          <el-link  v-if="scope.row.videoTxt == '未录制'">未录制 </el-link>
          <el-link  v-if="scope.row.videoTxt == '已录制未上传'">已录制未上传 </el-link>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" min-width="300" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="{row}">
          <el-button v-if="isSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
          <!-- 保养及领用-->
          <el-button v-if="(row.SHStatue == 1 || row.SHStatue== 4 || row.SHStatue== 6 || row.SHStatue== 8 ) && row.LYStatue == '未领用' && row.statue !== 0 && isLingYong && row.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" size="mini" style="width:80px;display:inline-block" @click="handleReceivingSpareParts(row)">保养及领用</el-button>
          <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleReceivingSpareParts(row)">保养及领用</el-button>
          <!-- 完成保养 -->
          <el-button v-if="(row.SHStatue == 1 || row.SHStatue== 4 || row.SHStatue== 6 || row.SHStatue== 8) && row.statue !== 0 && isComplete && row.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" size="mini" style="width:70px;display:inline-block" @click="handleCompleteMaintenance(row)">完成保养</el-button>
          <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleCompleteMaintenance(row)">完成保养</el-button>
          <!-- 保养审核 -->
          <el-button v-if="(row.SHStatue == 2 ) && isCharge && row.useEmpId == getdataListParm.parammaps.loginId" type="success" size="mini" style="width:70px;display:inline-block" @click="handleExamine(row)">保养审核</el-button>
          <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleExamine(row)">保养审核</el-button>
          <!-- 保养审核3 -->
          <el-button v-if="(row.SHStatue == 5) && isLeaderCharge" type="success" size="mini" style="width:70px;display:inline-block" @click="handleExamine2(row)">保养审核3</el-button>
          <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleExamine2(row)">保养审核3</el-button>
          <!-- 保养审核2 -->
          <el-button v-if="(row.SHStatue == 3) && isDepartmentCharge && (row.departmentId ==getdataListParm.parammaps.logindeptId)" type="success" size="mini" style="width:70px;display:inline-block" @click="handleExamine3(row)">保养审核2</el-button>
          <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleExamine3(row)">保养审核2</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="getList" />
    <!-- 查看 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_See" :close-on-click-modal="false"  v-if ="dialogFormVisible_See" width="90%">
      <div class="app-see">
        <div v-if="statue1" class="see">
          <el-form
            ref="seeTemp"
            :rules="rules"
            :model="seeTemp"
            label-position="right"
            label-width="120px"
            style="width: 90%;margin:0 auto;"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="保养单号：" prop="upkeepCode">
                  <el-input ref="upkeepCode" v-model="seeTemp.upkeepCode" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="设备名称：" prop="eqName">
                  <el-input ref="eqName" v-model="seeTemp.eqName" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="设备内部编号：" prop="eqCode">
                  <el-input ref="eqCode" v-model="seeTemp.eqCode" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="牧场：" prop="pastureName">
                  <el-input ref="pastureName" v-model="seeTemp.pastureName" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="部门：" prop="departmentName">
                  <el-input ref="departmentName" v-model="seeTemp.departmentName" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="责任人：" prop="employeName">
                  <el-input ref="employeName" v-model="seeTemp.employeName" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="保养人：" prop="upkeepPerson">
                  <el-input ref="upkeepPerson" v-model="seeTemp.upkeepPerson" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="保养日期：" prop="plantime">
                  <el-input ref="plantime" v-model="seeTemp.plantime" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="使用人：" prop="useEmpName">
                  <el-input ref="useEmpName" v-model="seeTemp.useEmpName" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="保养内容：" prop="upNameLevel">
                  <el-input ref="upNameLevel" v-model="seeTemp.upNameLevel" disabled />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-table
            :key="tableKey"
            v-loading="listLoadingMaintenanceContent"
            element-loading-text="给我一点时间"
            :data="listMaintenanceContent"
            border
            fit
            highlight-current-row
            style="width: 90%;margin:0 auto;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <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="部位" min-width="140px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.positionName }}</span>
              </template>
            </el-table-column>
            <el-table-column label="项目" min-width="140px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.program }}</span>
              </template>
            </el-table-column>
            <el-table-column label="标准" min-width="80px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.standard }}</span>
              </template>
            </el-table-column>
            <el-table-column label="执行动作" min-width="80px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.active }}</span>
              </template>
            </el-table-column>
          </el-table>
          <el-form
            ref="seeTemp"
            :rules="rules"
            :model="seeTemp"
            label-position="right"
            label-width="120px"
            style="width: 90%;margin:0 auto;"
          >
            <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>{{ item.scores }}</div>
                      </div>
                    </template>
                  </el-step>
                </el-steps>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="操作：">
                  <el-button v-if="(seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6 || seeTemp.SHStatue== 8) && seeTemp.LYStatue == '未领用' && seeTemp.statue !== 0 && isLingYong && seeTemp.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleReceivingSpareParts()">保养及领用</el-button>
                  <el-button v-else type="success" style="display:none" @click="handleReceivingSpareParts()">保养及领用</el-button>
                  <!-- 完成保养 -->
                  <el-button v-if="(seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6 || seeTemp.SHStatue== 8) && seeTemp.statue !== 0 && isComplete && seeTemp.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleCompleteMaintenance()">完成保养</el-button>
                  <el-button v-else type="success" style="display:none" @click="handleCompleteMaintenance()">完成保养</el-button>
                  <!-- 保养审核 -->
                  <el-button v-if="seeTemp.SHStatue == 2 && isCharge && seeTemp.useEmpId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleExamine()">保养审核</el-button>
                  <el-button v-else type="success" style="display:none" @click="handleExamine()">保养审核</el-button>
                  <!-- 保养审核3 -->
                  <el-button v-if="(seeTemp.SHStatue == 5) && isLeaderCharge" type="success" style="display:inline-block" @click="handleExamine2()">保养审核3</el-button>
                  <el-button v-else type="success" style="display:none" @click="handleExamine2()">保养审核3</el-button>
                  <!-- 保养审核2 -->
                  <el-button v-if="(seeTemp.SHStatue == 3) && isDepartmentCharge && (seeTemp.departmentId ==getdataListParm.parammaps.logindeptId)" type="success" style="width:70px;display:inline-block" @click="handleExamine3()">保养审核2</el-button>
                  <el-button v-else type="success" style="width:70px;display:none" @click="handleExamine3()">保养审核2</el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div v-if="statue2" class="see">
          <el-tabs v-model="activeName">
            <el-tab-pane label="保养信息" name="first">
              <el-form
                ref="seeTemp"
                :rules="rules"
                :model="seeTemp"
                label-position="right"
                label-width="120px"
                style="width: 90%;margin:0 auto;"
              >
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="保养单号：" prop="upkeepCode">
                      <el-input ref="upkeepCode" v-model="seeTemp.upkeepCode" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备名称：" prop="eqName">
                      <el-input ref="eqName" v-model="seeTemp.eqName" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备内部编号：" prop="eqCode">
                      <el-input ref="eqCode" v-model="seeTemp.eqCode" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="牧场：" prop="pastureName">
                      <el-input ref="pastureName" v-model="seeTemp.pastureName" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="部门：" prop="departmentName">
                      <el-input ref="departmentName" v-model="seeTemp.departmentName" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="责任人：" prop="employeName">
                      <el-input ref="employeName" v-model="seeTemp.employeName" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="保养人：" prop="upkeepPerson">
                      <el-input ref="upkeepPerson" v-model="seeTemp.upkeepPerson" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保养日期：" prop="plantime">
                      <el-input ref="plantime" v-model="seeTemp.plantime" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="使用人：" prop="useEmpName">
                      <el-input ref="useEmpName" v-model="seeTemp.useEmpName" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="保养内容：" prop="upNameLevel">
                      <el-input ref="upNameLevel" v-model="seeTemp.upNameLevel" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
              <el-table
                :key="tableKey"
                v-loading="listLoadingMaintenanceContent"
                element-loading-text="给我一点时间"
                :data="listMaintenanceContent"
                border
                fit
                highlight-current-row
                style="width: 90%;margin:0 auto;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <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="部位" min-width="140px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.positionName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="项目" min-width="140px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.program }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="标准" min-width="80px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.standard }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="执行动作" min-width="80px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.active }}</span>
                  </template>
                </el-table-column>
              </el-table>
              <el-form
                ref="seeTemp"
                :rules="rules"
                :model="seeTemp"
                label-position="right"
                label-width="120px"
                style="width: 90%;margin:0 auto;"
              >
                <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>{{ item.scores }}</div>
                          </div>
                        </template>
                      </el-step>
                    </el-steps>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col>
                    <el-form-item label="操作：">
                      <el-button v-if="(seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6 || seeTemp.SHStatue== 8) && seeTemp.LYStatue == '未领用' && seeTemp.statue !== 0 && isLingYong && seeTemp.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleReceivingSpareParts()">保养及领用</el-button>
                      <el-button v-else type="success" style="width:70px;display:none" @click="handleReceivingSpareParts()">保养及领用</el-button>
                      <!-- 完成保养 -->
                      <el-button v-if="(seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6 || seeTemp.SHStatue== 8) && seeTemp.statue !== 0 && isComplete && seeTemp.upkeepPersonId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleCompleteMaintenance()">完成保养</el-button>
                      <el-button v-else type="success" style="width:70px;display:none" @click="handleCompleteMaintenance()">完成保养</el-button>
                      <!-- 保养审核 -->
                      <el-button v-if="seeTemp.SHStatue == 2 && isCharge && seeTemp.useEmpId == getdataListParm.parammaps.loginId" type="success" style="display:inline-block" @click="handleExamine()">保养审核</el-button>
                      <el-button v-else type="success" style="width:70px;display:none" @click="handleExamine()">保养审核</el-button>
                      <!-- 保养审核3 -->
                      <el-button v-if="(seeTemp.SHStatue == 5) && isLeaderCharge" type="success" style="display:inline-block" @click="handleExamine2()">保养审核3</el-button>
                      <el-button v-else type="success" style="width:70px;display:none" @click="handleExamine2()">保养审核3</el-button>
                      <!-- 保养审核2 -->
                      <el-button v-if="(seeTemp.SHStatue == 3) && isDepartmentCharge && (seeTemp.departmentId ==getdataListParm.parammaps.logindeptId)" type="success" style="display:inline-block" @click="handleExamine3()">保养审核2</el-button>
                      <el-button v-else type="success" style="width:70px;display:none" @click="handleExamine3()">保养审核2</el-button>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
            <el-tab-pane label="领用记录" name="second">
              <el-form ref="collarUseTemp" :rules="rules" :model="collarUseTemp" label-position="right" label-width="120px" style="width: 90%;margin:0 auto;">
                <el-row>
                  <el-col :span="6">
                    <el-form-item label="领用单号：" prop="applyCode">
                      <span>{{ collarUseTemp.applyCode }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="领用部门：" prop="departmentName">
                      <span>{{ collarUseTemp.departmentName }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="领用日期：" prop="createDate">
                      <span>{{ collarUseTemp.createDate }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="领用状态：" prop="statueName">
                      <span>{{ collarUseTemp.statueName }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
              <el-table
                :key="tableKey"
                v-loading="listLoadingCollarUse"
                element-loading-text="给我一点时间"
                :data="listCollarUse"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
                @cell-click="openDetails"
                @sort-change="tableSort"
              >
                <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="备件编号" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.partCode }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="备件名称" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.partName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="备件规格" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.specification }}</span>
                  </template>
                </el-table-column>
                <el-table-column sortable prop="reportery" label="库存数" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.reportery }}</span>
                  </template>
                </el-table-column>
                <el-table-column sortable prop="amount" label="领用数量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.amount }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="用途" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.note }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-tab-pane>
            <el-tab-pane label="旧品录入记录" name="third">
              <el-table
                :key="tableKey"
                v-loading="listLoadingOldProducts"
                element-loading-text="给我一点时间"
                :data="listOldProducts"
                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 + (pageNum-1) * pageSize + 1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="备件编号" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.partCode }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="备件名称" prop="id" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.partName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="备件规格" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.specification }}</span>
                  </template>
                </el-table-column>
                <el-table-column sortable prop="acturalAmount" label="录入数量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.acturalAmount }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom:5px;">
        <el-button @click="close_diago()">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 保养及领用 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_ReceivingSpareParts" :close-on-click-modal="false" width="90%">
      <el-tabs v-model="activeName2">
        <el-tab-pane label="保养" name="first">
          <el-form
            ref="maintainTemp"
            :rules="rules"
            :model="maintainTemp"
            label-position="right"
            label-width="120px"
            style="width: 90%;margin:0 auto;"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="使用人：" prop="employeeId">
                  <el-select v-model="maintainTemp.employeeId" placeholder="使用人" class="filter-item" style="width: 120px;">
                    <el-option v-for="item in empdeptList" :key="item.id" :label="item.empname" :value="item.id" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="保养内容：" prop="upNameLevel">
                  <el-input ref="upNameLevel" v-model="maintainTemp.upNameLevel" disabled />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-table
            :key="tableKey"
            v-loading="listLoadingMaintenanceContent"
            element-loading-text="给我一点时间"
            :data="listMaintenanceContent"
            border
            fit
            highlight-current-row
            style="width: 90%;margin:0 auto;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <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="部位" min-width="140px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.positionName }}</span>
              </template>
            </el-table-column>
            <el-table-column label="项目" min-width="140px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.program }}</span>
              </template>
            </el-table-column>
            <el-table-column label="标准" min-width="80px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.standard }}</span>
              </template>
            </el-table-column>
            <el-table-column label="执行动作" min-width="80px" align="center">
              <template slot-scope="scope">
                <el-select v-model="scope.row.active" class="filter-item" style="width: 80%;">
                  <el-option v-for="item in getDictByName" :key="item.id" :label="item. label" :value="item.value" />
                </el-select>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="备件领用" name="second">
          <div class="app-receivingSpareParts">
            <el-form
              ref="receivingTemp"
              :rules="rules"
              :model="receivingTemp"
              label-position="right"
              label-width="120px"
              style="width: 90%;margin:0 auto;"
            >
              <el-row>
                <el-col :span="8">
                  <el-form-item label="领用单号：" prop="applyCode">
                    <span>{{ receivingTemp.applyCode }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="领用部门：" prop="departmentName">
                    <span>{{ receivingTemp.departmentName }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="领用日期：" prop="createDate">
                    <span>{{ receivingTemp.createDate }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-form-item label="所需备件:" prop="partCode">
                  <el-autocomplete
                    v-model="receivingTemp.partCode"
                    value-key="name"
                    class="inline-input"
                    :fetch-suggestions="sparePartSearch"
                    placeholder="请输入备件编号或备件名称或备件规格"
                    style="width:100%"
                    @select="handleSelectSparePart"
                  >
                    <template slot-scope="{ item }">
                      <b>备件编号：</b><span class="name">{{ item.partCode }}</span>
                      |<b>备件名称：</b><span class="addr">{{ item.partName }}</span>
                      |<b style="padding-left:3em;">备件规格：</b><span class="addr">{{ item.specification }}</span>
                    </template>
                  </el-autocomplete>
                </el-form-item>
              </el-row>
            </el-form>
            <el-table
              :key="tableKey"
              v-loading="listLoadingCollarUse"
              element-loading-text="给我一点时间"
              :data="listCollarUse"
              border
              fit
              highlight-current-row
              style="width: 100%;"
              :row-style="rowStyle"
              :cell-style="cellStyle"
              class="elTable"
            >
              <!-- table表格 -->
              <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="备件编号" min-width="110px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.partCode }}</span>
                </template>
              </el-table-column>
              <el-table-column label="备件名称" min-width="110px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.partName }}</span>
                </template>
              </el-table-column>
              <el-table-column label="备件规格" min-width="110px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.specification }}</span>
                </template>
              </el-table-column>
              <el-table-column label="库存数" min-width="110px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.reportery }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用数量" min-width="110px" align="center">
                <template slot-scope="scope">
                  <el-form :model="scope.row">
                    <el-form-item prop="amount">
                      <el-input ref="amount" v-model="scope.row.amount" style="margin-top:15px" />
                    </el-form-item>
                  </el-form>
                </template>
              </el-table-column>
              <el-table-column label="用途" prop="note" align="center" min-width="60">
                <template slot-scope="scope">
                  <el-form :model="scope.row">
                    <el-form-item prop="note">
                      <el-input ref="note" v-model="scope.row.note" style="margin-top:15px" />
                    </el-form-item>
                  </el-form>
                </template>
              </el-table-column>
              <el-table-column label="操作" align="center" width="60" class-name="small-padding fixed-width" fixed="right">
                <template slot-scope="{row}">
                  <a class="del" @click="sparePartsDelete(row)">删除</a>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer" style="bottom: 5px">
        <el-button v-if="activeName2=='first'" type="primary" :disabled="isokDisable" @click="createReceivingSparePartseData1()">确认</el-button>
        <el-button v-if="activeName2=='second'" type="primary" :disabled="isokDisable" @click="createReceivingSparePartseData2()">确认</el-button>
        <el-button @click="dialogFormVisible_ReceivingSpareParts = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 完成保养 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_maintainComplete" :close-on-click-modal="false" width="50%">
      <div class="maintainComplete">
        <el-form ref="maintainCompleteTemp" :rules="rules" :model="maintainCompleteTemp" label-position="right" label-width="120px" style="width: 90%;margin:0 auto;">
          <el-row>
            <el-col :span="20">
              <el-form-item label="是否录入旧品：" prop="isOldProducts">
                <el-radio-group v-model="maintainCompleteTemp.isOldProducts" @change="changeIsOldProducts">
                  <el-radio :label="0" checked>否</el-radio>
                  <el-radio :label="1">是</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="No2">
            <el-col :span="24">
              <el-form-item label="旧品录入：" prop="partCode">
                <el-autocomplete
                  v-model="maintainCompleteTemp.partCode"
                  value-key="name"
                  class="inline-input"
                  :fetch-suggestions="oldProductsSearch"
                  placeholder="请输入备件编号或备件名称或备件规格 "
                  style="width:100%"
                  @select="handleSelectOldProducts"
                >
                  <template slot-scope="{ item }">
                    <b>备件编号：</b><span class="name">{{ item.partCode }}</span>
                    |<b>备件名称：</b><span class="addr">{{ item.partName }}</span>
                    |<b style="padding-left:3em;">备件规格：</b><span class="addr">{{ item.specification }}</span>
                  </template>
                </el-autocomplete>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-table
          v-if="No2"
          :key="tableKey"
          v-loading="listLoading"
          element-loading-text="给我一点时间"
          :data="listAdd"
          border
          fit
          highlight-current-row
          style="width: 100%;margin-bottom:30px"
          :cell-style="cellStyle"
          class="elTable"
          :row-style="rowStyle"
        >
          <!-- table表格 -->
          <el-table-column type="index" label="序号" align="center" width="50px" />
          <el-table-column label="备件编号" min-width="90px" prop="partCode" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partCode }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件名称" min-width="60px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partName }}</span><br>
            </template>
          </el-table-column>
          <el-table-column label="备件规格" prop="specification" align="center" min-width="90">
            <template slot-scope="scope">
              <span>{{ scope.row.specification }}</span>
            </template>
          </el-table-column>
          <el-table-column label="录入数量" prop="brand" align="center" min-width="60">
            <template slot-scope="scope">
              <el-form :model="scope.row" :rules="rules">
                <el-form-item prop="acturalAmount">
                  <el-input ref="acturalAmount" v-model="scope.row.acturalAmount" style="margin-top:15px" />
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column label="用途" prop="note" align="center" min-width="60">
            <template slot-scope="scope">
              <el-form :model="scope.row">
                <el-form-item prop="note">
                  <el-input ref="note" v-model="scope.row.note" style="margin-top:15px" />
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="60" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <a class="del" @click="partDelete(row)">删除</a>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='maintainComplete'?createMaintainCompleteData():createMaintainCompleteData()">确认</el-button>
        <el-button @click="dialogFormVisible_maintainComplete = false;">关闭</el-button>
      </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 auto;line-height:50px">请确认保养审核结果:</h3>
        <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 60%;height:150px;margin:0 auto;">
          <el-row style="width:88%;margin:0 auto;">
            <el-col :span="20">
              <el-form-item>
                <el-radio-group v-model="examineTemp.isStatue" @change="changeIsStatue">
                  <el-radio :label="3">通过</el-radio>
                  <el-radio :label="4">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col v-if="isStatueReason" :span="20">
              <el-input v-model="examineTemp.workflowNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入保养不通过的原因" />
            </el-col>
          </el-row>
          <el-row v-if="examineTemp.SHStatue == 2 && examineTemp.isStatue == 3" style="width:90%;margin:0 auto;">
            <el-col :span="24">
              <el-form-item label="评分：" prop="scores">
                <el-rate v-model="examineTemp.scores" show-text :texts="['1分','2分', '3分', '4分', '5分']" style="width:100%;margin-top:10px;" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="dialogStatus==='examine'" type="primary" :disabled="isokDisable" @click="createExamineData()">确认</el-button>
        <el-button v-if="dialogStatus==='examine2'" type="primary" :disabled="isokDisable" @click="createExamineData2()">确认</el-button>
        <el-button v-if="dialogStatus==='examine3'" type="primary" :disabled="isokDisable" @click="createExamineData3()">确认</el-button>
        <el-button @click="dialogFormVisible_examine = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 视频 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_video" :close-on-click-modal="false" width="60%">
      <div class="app-video">
        <el-form ref="videoTemp" :rules="rules" :model="videoTemp" label-position="right" style="width: 80%;min-height:150px;margin:0 auto;">
          <el-row>
            <el-col :span="24">
              <el-form-item label="" prop="scores">
                <video :src="videoTemp.videoPath" controls="controls" style="width:90%;height:450px;margin:0 auto;" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// 引入
import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
// import { mapGetters } from 'vuex'
import waves from '@/directive/waves' // waves directive
import { parseTime, sortChange } from '@/utils/index.js'
// eslint-disable-next-line no-unused-vars
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import Cookies from 'js-cookie'
import { MessageBox } from 'element-ui'
export default {
  name: 'Maintain',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      active: 0,
      activeList: [],
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' },
      isokDisable: false,
      rules: {
        employeeId: [{ required: true, message: '必填', trigger: 'blur' }]
      },
      findAllPasture: [],
      findAllDepart: [],
      findAllEmploye: [],
      requestParams: [
        { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
        { name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }},
        { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
        { name: 'getDictByName', offset: 0, pagecount: 0, params: ['保养模板执行动作'] }
      ],
      getDepartParam: {
        name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }
      },
      statues: [{ id: '0', name: '已逾期' }, { id: '1', name: '保养中' }, { id: '2', name: '保养完成' }],
      SHStatues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
      empdeptList: [],
      getDictByName: [],
      radio2: '全部',
      textMap: {
        see: '查看详情',
        receivingSpareParts: '保养及领用',
        maintainComplete: '完成保养',
        examine: '保养审核',
        examine2: '保养审核2',
        examine3: '保养审核3',
        video: '视频'
      },
      dialogStatus: '',
      radioAll: '全部',
      getdataListParm: {
        name: 'getBigupkeepList',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          inputDatetime: '',
          upkeepCode: '',
          eqName: '',
          eqCode: '',
          departmentId: '',
          statue: '',
          pastureName: Cookies.get('pasturename'),
          loginId: Cookies.get('employeid'),
          menu: 'Maintain',
          SHStatue: '',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid')
        }
      },
      total: 0,
      tableKey: 0,
      listLoading: false,
      list: [],
      // 查看
      dialogFormVisible_See: false,
      seeTemp: {},
      statue1: false,
      statue2: false,
      activeName: 'first',
      listLoadingMaintenanceContent: false,
      listMaintenanceContent: [],
      getMaintenanceContentParm: {
        name: 'getUpkeepTemplateListbyeqV2',
        returntype: 'Map',
        parammaps: {}
      },
      Reason: false,
      // 查看-领用记录
      getCollarUseParm: {
        name: 'getPartsapplybyMt',
        returntype: 'Map',
        parammaps: {}
      },
      collarUseTemp: {},
      // 查看-领用记录table
      getCollarUseListParm: {
        name: 'getpartapplyListBybig',
        returntype: 'Map',
        parammaps: {}
      },
      listLoadingCollarUse: false,
      listCollarUse: [],
      // 查看-旧品录入记录table
      getOldProductsParm: {
        name: 'getMaintainRefuse',
        returntype: 'Map',
        parammaps: {}
      },
      listLoadingOldProducts: false,
      listOldProducts: [],
      // 保养及领用
      dialogFormVisible_ReceivingSpareParts: false,
      activeName2: 'first',
      maintainTemp: {},
      receivingTemp: {},
      getEmpdeptParm: {
        name: 'getEmpdept',
        returntype: 'Map',
        parammaps: {
          deptId: ''
        }
      },
      getAutoCreatCodeParm: {
        name: 'autoCreatCode',
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid'),
          codeType: 'LY'
        }
      },
      requestSparePart: {
        name: 'getPartsListLY',
        page: 1,
        offset: 1,
        pagecount: 20,
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },

      postDataPramas: {},
      // 完成保养
      dialogFormVisible_maintainComplete: false,
      maintainCompleteTemp: {},
      requestOldProducts: {
        name: 'getAllPartsListWB',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {}
      },
      No2: false,
      listAdd: [],
      // 保养审核
      dialogFormVisible_examine: false,
      requestParam: {},
      examineTemp: {
        isStatue: 3
      },
      isStatueReason: false,
      // 权限按钮
      isSee: [],
      isLingYong: [],
      isComplete: [],
      isCharge: [],
      isLeaderCharge: [],
      isDepartmentCharge: [],
      buttons: [],
      pending: {
        total: 0,
        getdataListParm: {
          name: 'getBigupkeepWebListNO', page: 1, offset: 1, getTotal: 'total3', pagecount: 10, returntype: 'Map',
          parammaps: {}
        }
      },
      dialogFormVisible_video: false,
      videoTemp: {},
      requestParam2: {}
    }
  },
  // computed: {
  //   ...mapGetters([
  //     'sidebar',
  //     'avatar',
  //     'employeid',
  //     'pastureid'
  //   ])
  // },
  computed: {
    space() {
      const { isSimple, $parent: { space }} = this
      return isSimple ? '' : space
    },
    style: function() {
      const style = {}
      const parent = this.$parent
      const len = parent.steps.length

      const space =
        typeof this.space === 'number'
          ? this.space + 'px'
          : this.space
            ? this.space
            : 100 / (len - (this.isCenter ? 0 : 1)) + '%'
      style.flexBasis = space
      if (this.isVertical) return style
      if (this.isLast) {
        style.maxWidth = 100 / this.stepsCount + '%'
      } else {
        style.marginRight = -this.$parent.stepOffset + 'px'
      }
      return style
    }
  },
  created() {
    const that = this
    GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
      that.buttons = response.data.list
      that.get_auto_buttons()
    })
    if (this.$route.query.myPath !== undefined && this.$route.query.myPath == 'MaintenancePlan') {
      this.getdataListParm.parammaps.eqCode = this.$route.query.eqCode
      this.getdataListParm.parammaps.inputDatetime = [this.$route.query.time, this.$route.query.time]
      this.getdataListParm.parammaps.startTime = this.$route.query.time
      this.getdataListParm.parammaps.stopTime = this.$route.query.time
    }
    this.get_select_list()
    this.getList()
    this.getPendingList()
  },
  methods: {
    // handleCheck(row) {
    //   this.playvideo = row.hotVideoPath // 存储用户点击的视频播放链接
    //   this.playvideoName = row.hotVideoPath // 存储用户点击的视频播放链接
    // },
    tableSort(column) {
      if (this.activeName == 'second') {
        sortChange(column, this.listCollarUse)
      } else if (this.activeName == 'third') {
        sortChange(column, this.listOldProducts)
      }
    },
    get_auto_buttons() {
      // 查看
      const See = 'maintenance:maintain:see'
      const isSee = checkButtons(JSON.parse(sessionStorage.buttons), See)
      this.isSee = isSee
      //  保养及领用
      const LingYong = 'maintenance:maintain:lingyong'
      const isLingYong = checkButtons(JSON.parse(sessionStorage.buttons), LingYong)
      this.isLingYong = isLingYong
      //  完成保养
      const Complete = 'maintenance:maintain:complete'
      const isComplete = checkButtons(JSON.parse(sessionStorage.buttons), Complete)
      this.isComplete = isComplete
      //  使用人保养审核
      const Charge = 'maintenance:maintain:charge'
      const isCharge = checkButtons(JSON.parse(sessionStorage.buttons), Charge)
      this.isCharge = isCharge
      //  主管审核
      const LeaderCharge = 'maintenance:maintain:leaderCharge'
      const isLeaderCharge = checkButtons(JSON.parse(sessionStorage.buttons), LeaderCharge)
      this.isLeaderCharge = isLeaderCharge
      // 部门审核
      const DeptCharge = 'maintenance:maintain:deptcharge'
      const isDepartmentCharge = checkButtons(JSON.parse(sessionStorage.buttons), DeptCharge)
      this.isDepartmentCharge = isDepartmentCharge
    },
    // next() {
    //   if (this.active++ > 2) this.active = 0
    //   this.finishStatus = 'error'
    // },
    get_select_list() {
      GetDataByNames(this.requestParams).then(response => {
        this.findAllPasture = response.data.findAllPasture.list
        this.findAllEmploye = response.data.findAllEmploye.list
        this.getDictByName = 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()
    },

    close_diago(){
      console.log(11111111111111)
      this.dialogFormVisible_See = false
    },
    getPendingList() {
      this.pending.getdataListParm.parammaps = {
        inputDatetime: this.getdataListParm.parammaps.inputDatetime,
        pastureName: this.getdataListParm.parammaps.pastureName,
        SHStatue: this.getdataListParm.parammaps.SHStatue,
        upkeepCode: this.getdataListParm.parammaps.upkeepCode,
        eqName: this.getdataListParm.parammaps.eqName,
        eqCode: this.getdataListParm.parammaps.eqCode,
        departmentId: this.getdataListParm.parammaps.departmentId,
        statue: this.getdataListParm.parammaps.statue,
        loginId: Cookies.get('employeid'),
        menu: 'Maintain',
        logindeptId: Cookies.get('departmentid'),
        loginpastureId: Cookies.get('pastureid'),
        empId: Cookies.get('employeid'),
        pastureId: Cookies.get('pastureid'),
        deptId: Cookies.get('departmentid')
      }
      GetDataByName(this.pending.getdataListParm).then(response => {
        this.pending.total = response.data.total3
      })
    },
    getList() {
      if (this.getdataListParm.parammaps.inputDatetime !== undefined && this.getdataListParm.parammaps.inputDatetime !== '') {
        this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime[0]
        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime[1]
      } else {
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      }
      this.listLoading = true
      GetDataByName(this.getdataListParm).then(response => {
        if (response.data.list !== null) {
          console.log('table数据', response.data.list)
          for (let i = 0; i < response.data.list.length; i++) {
            this.$set(response.data.list[i], 'img', '视频')
          }
          this.list = response.data.list
          this.pageNum = response.data.pageNum
          this.pageSize = response.data.pageSize
        } else {
          this.list = []
        }
        this.total = response.data.total
        // Just to simulate the time of the request
        setTimeout(() => {
          this.listLoading = false
        }, 100)
      })
    },
    tableCellStyle({ row, column, rowIndex, columnIndex }) {
      if (row.statue == 0 && columnIndex === 10) {
        return {
          background: 'red',
          color: '#fff'
        }
      }
      return {
        background: ''
      }
    },
    changeAll() {
      console.log(this.radioAll)
      if (this.radioAll === '全部') {
        this.getdataListParm.name = 'getBigupkeepList'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          inputDatetime: '',
          upkeepCode: '',
          eqName: '',
          eqCode: '',
          departmentId: '',
          statue: '',
          pastureName: Cookies.get('pasturename'),
          loginId: Cookies.get('employeid'),
          menu: 'Maintain',
          SHStatue: '',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid')
        }
        this.getList()
      } else if (this.radioAll === '待处理') {
        this.getdataListParm.name = 'getBigupkeepWebListNO'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          inputDatetime: this.getdataListParm.parammaps.inputDatetime,
          pastureName: this.getdataListParm.parammaps.pastureName,
          SHStatue: this.getdataListParm.parammaps.SHStatue,
          upkeepCode: this.getdataListParm.parammaps.upkeepCode,
          eqName: this.getdataListParm.parammaps.eqName,
          eqCode: this.getdataListParm.parammaps.eqCode,
          departmentId: this.getdataListParm.parammaps.departmentId,
          statue: this.getdataListParm.parammaps.statue,
          loginId: Cookies.get('employeid'),
          menu: 'Maintain',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid'),
          empId: Cookies.get('employeid'),
          pastureId: Cookies.get('pastureid'),
          deptId: Cookies.get('departmentid')
        }
        this.getList()
      } else if (this.radioAll === '已处理') {
        this.getdataListParm.name = 'getBigupkeepWebList'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          inputDatetime: this.getdataListParm.parammaps.inputDatetime,
          pastureName: this.getdataListParm.parammaps.pastureName,
          SHStatue: this.getdataListParm.parammaps.SHStatue,
          upkeepCode: this.getdataListParm.parammaps.upkeepCode,
          eqName: this.getdataListParm.parammaps.eqName,
          eqCode: this.getdataListParm.parammaps.eqCode,
          departmentId: this.getdataListParm.parammaps.departmentId,
          statue: this.getdataListParm.parammaps.statue,

          loginId: Cookies.get('employeid'),
          menu: 'Maintain',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid'),
          empId: Cookies.get('employeid'),
          pastureId: Cookies.get('pastureid'),
          deptId: Cookies.get('departmentid')
        }
        this.getList()
      }
    },
    statue: function(cellValue) {
      // console.log(cellValue.isZeroStock)
      if (cellValue.statue == 0) {
        return '已逾期'
      } else if (cellValue.statue == 1) {
        return '保养中'
      } else if (cellValue.statue == 2) {
        return '已完成'
      }
    },
    SHStatue: function(cellValue) {
      // console.log(cellValue.isZeroStock)
      if (cellValue.SHStatue == 1) {
        return ''
      } else if (cellValue.SHStatue == 2) {
        return '审核中'
      } else if (cellValue.SHStatue == 3) {
        return '审核中'
      } else if (cellValue.SHStatue == 4) {
        return '未通过'
      } else if (cellValue.SHStatue == 6) {
        return '未通过'
      } else if (cellValue.SHStatue == 8) {
        return '未通过'
      } else if (cellValue.SHStatue == 5) {
        return '审核中'
      } else if (cellValue.SHStatue == 7) {
        return '已通过'
      }
    },
    form_search() {
      console.log('点击了table搜索')
      this.listLoading = true
      if (this.getdataListParm.parammaps.inputDatetime === null) {
        this.getdataListParm.parammaps.inputDatetime = ''
      }
      this.getdataListParm.offset = 1
      this.getList()
      this.getPendingList()
    },
    form_see(row) {
      this.seeTemp = Object.assign({}, row)
      console.log('查看', this.seeTemp)
      // 流程图
      var reason = '未通过原因:' + this.seeTemp.workflowNote
      var scores = '评分:' + this.seeTemp.scores + '分'
      if (this.seeTemp.SHStatue === 1) {
        this.activeList = [{ title: '完成保养' }, { title: '使用人审核' }, { title: '部门主管审核' }, { title: '设备主管审核' }]
        this.active = 0
      } else if (this.seeTemp.SHStatue === 2) {
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核' }, { title: '部门主管审核' }, { title: '设备主管审核' }]
        this.active = 1
      } else if (this.seeTemp.SHStatue === 3) {
        this.active = 2
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: '', reason: '', scores: scores }, { title: '部门主管审核' }, { title: '设备主管审核' }]
      } else if (this.seeTemp.SHStatue === 4) {
        this.active = 2
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: 'error', reason: reason }, { title: '部门主管审核' }, { title: '设备主管审核' }]
      } else if (this.seeTemp.SHStatue === 5) {
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: '', reason: '', scores: scores }, { title: '部门主管审核', date: this.seeTemp.deptChargeDate, name: this.seeTemp.deptChargePerson, status: '', reason: '' }, { title: '设备主管审核' }]
        this.active = 3
      } else if (this.seeTemp.SHStatue === 6) {
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: '', reason: '', scores: scores }, { title: '部门主管审核', date: this.seeTemp.deptChargeDate, name: this.seeTemp.deptChargePerson, status: 'error', reason: reason }, { title: '设备主管审核' }]
        this.active = 3
      } else if (this.seeTemp.SHStatue === 7) {
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: '', reason: '', scores: scores }, { title: '部门主管审核', date: this.seeTemp.deptChargeDate, name: this.seeTemp.deptChargePerson }, { title: '设备主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
        this.active = 4
      } else if (this.seeTemp.SHStatue === 8) {
        this.activeList = [{ title: '完成保养', name: this.seeTemp.upkeepPerson, date: this.seeTemp.finishedTime, status: '', reason: '' }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: '', reason: '', scores: scores }, { title: '部门主管审核', date: this.seeTemp.deptChargeDate, name: this.seeTemp.deptChargePerson }, { title: '设备主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
        this.active = 4
      }
      this.dialogStatus = 'see'
      this.dialogFormVisible_See = true
      if (this.seeTemp.SHStatue !== 1) {
        // 查看显示类型2
        this.statue1 = false
        this.statue2 = true
        this.getMaintenanceContentList()
      } else {
        if (this.seeTemp.SHStatue == 1 && this.seeTemp.LYStatue == '未领用' && this.seeTemp.LRStatue == '未录入') {
          // 查看显示类型1
          this.statue1 = true
          this.statue2 = false
          this.getMaintenanceContentList()
        } else {
          // 查看显示类型2
          this.statue1 = false
          this.statue2 = true
          this.getMaintenanceContentList()
        }
      }
      this.collarUseTemp = {}
      this.listCollarUse = []
      this.getCollarUse()
      this.getOldProductsList()
    },
    getMaintenanceContentList() {
      this.getMaintenanceContentParm.parammaps.id = this.seeTemp.id
      this.listLoadingMaintenanceContent = false
      GetDataByName(this.getMaintenanceContentParm).then(response => {
        console.log('保养内容table数据', response.data.list)
        this.listMaintenanceContent = response.data.list
        this.$forceUpdate()
        setTimeout(() => {
          this.listLoadingMaintenanceContent = false
        }, 100)
      })
    },
    openDetails(row, column, cell, event) {
      if (column.label !== '操作') {
        this.$router.push({ path: '/customs/Receive', query: { applyCode: this.collarUseTemp.applyCode }})
      }
    },
    getCollarUse() {
      this.getCollarUseParm.parammaps.RUCode = this.seeTemp.upkeepCode
      GetDataByName(this.getCollarUseParm).then(response => {
        this.collarUseTemp = response.data.list[0]
        if (response.data.list.length > 0) {
          console.log('领用记录数据', response.data.list[0])
          if (response.data.list[0].statue == 0) {
            this.$set(this.collarUseTemp, 'statueName', '未领用')
          } else {
            this.$set(this.collarUseTemp, 'statueName', '已领用')
          }
        }
        this.getCollarUseList()
      })
    },
    getCollarUseList() {
      this.getCollarUseListParm.parammaps.id = this.collarUseTemp.id
      this.listLoadingCollarUse = true
      GetDataByName(this.getCollarUseListParm).then(response => {
        console.log('领用table数据', response.data.list)
        this.listCollarUse = response.data.list
        setTimeout(() => {
          this.listLoadingCollarUse = false
        }, 100)
      })
    },
    getOldProductsList() {
      this.getOldProductsParm.parammaps.repairCode = this.seeTemp.upkeepCode
      this.listLoadingOldProducts = true
      GetDataByName(this.getOldProductsParm).then(response => {
        console.log('旧品录入记录table数据', response.data.list)
        this.listOldProducts = response.data.list
        setTimeout(() => {
          this.listLoadingOldProducts = false
        }, 100)
      })
    },
    // 保养及领用
    handleReceivingSpareParts(row) {
      console.log('点击了保养及领用')
      if (row == undefined) {
        this.receivingTemp = this.seeTemp
      } else {
        this.receivingTemp = Object.assign({}, row)
      }
      this.maintainTemp = this.receivingTemp
      this.maintainTemp.employeeId = String(this.maintainTemp.useEmpId)
      this.seeTemp = this.maintainTemp
      this.listCollarUse = []
      this.getAutoCreatCode()
      this.receivingTemp.createDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.getEmpdeptList()
      this.getCollarUse()
      this.getMaintenanceContentList()
      this.dialogStatus = 'receivingSpareParts'
      this.dialogFormVisible_ReceivingSpareParts = true
    },
    getEmpdeptList() {
      this.getEmpdeptParm.parammaps.deptId = this.maintainTemp.departmentId
      GetDataByName(this.getEmpdeptParm).then(response => {
        console.log('保养使用人', response.data.list)
        if (response.data.list !== null) {
          this.empdeptList = response.data.list
        } else {
          this.empdeptList = []
        }
      })
    },
    getAutoCreatCode() {
      GetDataByName(this.getAutoCreatCodeParm).then(response => {
        console.log('领用领用单号', response.data.list[0])
        this.receivingTemp.applyCode = response.data.list[0].orderCode
        this.$forceUpdate()
      })
    },
    sparePartSearch(queryString, cb) {
      console.log('备件模糊查询输入值', queryString)
      this.requestSparePart.parammaps['partCode'] = queryString
      GetDataByName(this.requestSparePart).then(response => {
        console.log('备件模糊查询搜索data', response.data.list)
        if (response.data.list == null) {
          cb([])
        } else {
          cb(response.data.list)
        }
      })
    },
    handleSelectSparePart(item) {
      console.log('备件模糊查询选中值', item)
      if (this.listCollarUse.length > 0) {
        // eslint-disable-next-line no-redeclare
        if (this.listCollarUse.find(obj => obj.id === item.id)) {
          this.$message({
            type: 'warning',
            message: '此备件已存在，请重新选择备件'
          })
        } else {
          this.listCollarUse.unshift(item)
        }
      } else {
        this.listCollarUse = []
        this.listCollarUse.unshift(item)
      }
    },
    createReceivingSparePartseData1() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['maintainTemp'].validate(valid => {
        if (valid) {
          this.postDataPramas.common = { 'returnmap': '0' }
          this.postDataPramas.data = []
          this.postDataPramas.data[0] = { 'name': 'updateEquseEmpId', 'type': 'e', 'parammaps': {
            employeeId: this.maintainTemp.employeeId,
            id: this.maintainTemp.id
          }}
          this.postDataPramas.data[1] = { 'name': 'deleteutupbyBigid', 'type': 'e', 'parammaps': {
            id: this.maintainTemp.id
          }}
          this.postDataPramas.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listMaintenanceContent }}
          this.postDataPramas.data[2].children = []
          this.postDataPramas.data[2].children[0] = { 'name': 'insertutup', 'type': 'e', 'parammaps': {
            id: this.maintainTemp.id,
            positionName: '@insertSpotList.positionName',
            program: '@insertSpotList.program',
            standard: '@insertSpotList.standard',
            active: '@insertSpotList.active'
          }}
          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.dialogFormVisible_ReceivingSpareParts = false
              this.dialogFormVisible_See = false
              this.getList()
              this.getPendingList()
              this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
            }
          })
        }
      })
    },
    createReceivingSparePartseData2() {
      console.log('点击了保养及领用保存')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['receivingTemp'].validate(valid => {
        if (valid) {
          if (this.listCollarUse.length !== 0) {
            for (var i = 0; i < this.listCollarUse.length; i++) {
              console.log(this.listCollarUse[i].amount)
              if (this.listCollarUse[i].amount !== undefined) {
                var rulesAmount = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
                if (!rulesAmount.test(this.listCollarUse[i].amount)) {
                  this.$message({ type: 'error', message: '领用数量请输入正数，最多保留两位小数', duration: 2000 })
                  return false
                } else if (parseFloat(this.listCollarUse[i].amount) > parseFloat(this.listCollarUse[i].reportery)) {
                  this.$message({ type: 'error', message: '领用数量不可大于库存数', duration: 2000 })
                  return false
                }
              } else {
                this.$message({ type: 'error', message: '请检查领用数量是否未填写', duration: 2000 })
                return false
              }
            }
            let mySumPrice = 0
            for (let i = 0; i < this.listCollarUse.length; i++) {
              mySumPrice += parseFloat(this.listCollarUse[i].price) * parseFloat(this.listCollarUse[i].amount)
            }
            if (mySumPrice > 500) {
              this.receivingTemp.SHStatus = 2
            } else {
              this.receivingTemp.SHStatus = 9
            }
            this.postDataPramas.common = { 'returnmap': '0' }
            this.postDataPramas.data = []
            this.postDataPramas.data[0] = { 'name': 'insertBigpartapply', 'type': 'e', 'parammaps': {
              pastureId: this.$store.state.user.pastureid,
              applyCode: this.receivingTemp.applyCode,
              applyType: 2,
              departmentId: this.receivingTemp.departmentId,
              empId: this.receivingTemp.upkeepPersonId,
              applyDate: this.receivingTemp.createDate,
              RUCode: this.receivingTemp.upkeepCode,
              SHStatus: this.receivingTemp.SHStatus
            }}
            this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listCollarUse }}
            this.postDataPramas.data[1].children = []
            this.postDataPramas.data[1].children[0] = { 'name': 'insertpartapply', 'type': 'e', 'parammaps': {
              bigId: '@insertBigpartapply.LastInsertId',
              pastureId: '@insertSpotList.pastureId',
              partId: '@insertSpotList.partId',
              partCode: '@insertSpotList.partCode',
              partName: '@insertSpotList.partName',
              specification: '@insertSpotList.specification',
              brandId: '@insertSpotList.brandId',
              price: '@insertSpotList.price',
              amount: '@insertSpotList.amount',
              eqName: this.receivingTemp.eqName,
              eqCode: this.receivingTemp.eqCode,
              providerId: '@insertSpotList.providerId',
              note: '@insertSpotList.note',
              reportery: '@insertSpotList.reportery',
              contractId: '@insertSpotList.contractId',
              locationId: '@insertSpotList.locationId'
            }}
            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.dialogFormVisible_ReceivingSpareParts = false
                this.dialogFormVisible_See = false
                this.getList()
                this.getPendingList()
                this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
              }
            })
            // return true
          } else {
            this.$notify({ title: '', message: '请选择备件', type: 'warning', duration: 2000 })
            return false
          }
        }
      })
    },
    // 完成保养
    handleCompleteMaintenance(row) {
      console.log('点击了完成保养', row)
      if (row == undefined) {
        this.$set(this.seeTemp, 'isOldProducts', 0)
        this.maintainCompleteTemp = this.seeTemp
      } else {
        this.maintainCompleteTemp = Object.assign({}, row)
        this.$set(this.maintainCompleteTemp, 'isOldProducts', 0)
      }
      this.dialogStatus = 'maintainComplete'
      this.No2 = false
      this.dialogFormVisible_maintainComplete = true
      this.listAdd = []
    },
    changeIsOldProducts(val) {
      console.log(val)
      if (val == 1) {
        this.No2 = true
      } else {
        this.No2 = false
      }
    },
    oldProductsSearch(queryString, cb) {
      console.log('旧品录入模糊查询输入值', queryString)
      this.requestOldProducts.parammaps.partCode = queryString
      this.requestOldProducts.parammaps.RUCode = this.maintainCompleteTemp.upkeepCode
      GetDataByName(this.requestOldProducts).then(response => {
        console.log('旧品录入模糊查询搜索data', response.data.list)
        cb(response.data.list)
      })
    },
    handleSelectOldProducts(item) {
      this.maintainCompleteTemp.partCode = ''
      console.log('旧品录入模糊查询选中值', item)
      if (this.listAdd.length > 0) {
        // eslint-disable-next-line no-redeclare
        if (this.listAdd.find(obj => obj.id === item.id)) {
          this.$message({
            type: 'warning',
            message: '此旧品已存在，请重新选择旧品'
          })
        } else {
          if (item.checkoutNumber == null) {
            this.$set(item, 'checkoutNumber', item.reportery)
          }
          this.listAdd.unshift(item)
        }
      } else {
        if (item.checkoutNumber == null) {
          this.$set(item, 'checkoutNumber', item.reportery)
        }
        this.listAdd.unshift(item)
      }
    },
    sparePartsDelete(row) {
      MessageBox.confirm('设备名称：' + row.partName, '确认删除？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // console.log(this.list2)
        for (var i = 0; i < this.listCollarUse.length; i++) {
          console.log(this.listCollarUse[i])
          if (this.listCollarUse[i].id === row.id) {
            var listCollarUseIndex = this.listCollarUse.indexOf(this.listCollarUse[i])
          }
          if (listCollarUseIndex > -1) {
            this.listCollarUse.splice(listCollarUseIndex, 1)
            return
          }
        }
      })
    },
    partDelete(row) {
      console.log(this.listAdd)
      MessageBox.confirm('设备名称：' + row.partName, '确认删除？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // console.log(this.list2)
        for (var i = 0; i < this.listAdd.length; i++) {
          console.log(this.listAdd[i])
          if (this.listAdd[i].id === row.id) {
            var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
          }
          if (listAddIndex > -1) {
            this.listAdd.splice(listAddIndex, 1)
            return
          }
        }
      })
    },
    // 完成保养-保存
    createMaintainCompleteData() {
      console.log('点击了完成保养确认', this.maintainCompleteTemp)
      console.log('点击了完成保养确认', this.maintainCompleteTemp.laidcou)
      if (this.maintainCompleteTemp.laidcou == 0) {
        if (this.maintainCompleteTemp.isOldProducts == 0) {
          console.log('否')
          this.requestParam.name = 'completeUpkeep'
          this.requestParam.parammaps = {}
          this.requestParam.parammaps.id = this.maintainCompleteTemp.id
          PostDataByName(this.requestParam).then((response) => {
            if (response.msg !== 'fail') {


              //如果有设备记录仪的权限
              if(this.maintainCompleteTemp.isVideoBtnShow == '1'){
                // 临时注释
                  if (this.maintainCompleteTemp.videoTxt == '已录制') {
                    this.requestParam2.name = 'upkeepChargDone'
                    this.requestParam2.parammaps = {}
                    this.requestParam2.parammaps.id = this.maintainCompleteTemp.id
                    this.requestParam2.parammaps.statue = 7
                    this.requestParam2.parammaps.orderStatue = 2
                    this.requestParam2.parammaps.empId = Cookies.get('employeid')
                    PostDataByName(this.requestParam2).then(response => {
                      if (response.msg !== 'fail') {
                        if (this.getdataListParm.parammaps.inputDatetime === null) {
                          this.getdataListParm.parammaps.inputDatetime = ''
                        }
                        this.getList()
                        this.dialogFormVisible_maintainComplete = false
                        this.dialogFormVisible_See = false
                        this.getPendingList()
                        this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
                      } else {
                        failproccess(response, this.$notify)
                      }
                    })
                  }
              // 临时注释
              }else{
                //正常流程。没有记录仪权限

                 if (this.getdataListParm.parammaps.inputDatetime === null) {
                    this.getdataListParm.parammaps.inputDatetime = ''
                  }
                  this.dialogFormVisible_maintainComplete = false
                  this.dialogFormVisible_See = false
                  this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
                  this.getList()
                  this.getPendingList()
              }


              


            } else {
              failproccess(response, this.$notify)
            }
          })
        } else {
          console.log('是')
          this.isokDisable = true
          setTimeout(() => {
            this.isokDisable = false
          }, 1000)
          this.$refs['maintainCompleteTemp'].validate(valid => {
            if (valid) {
              if (this.listAdd.length !== 0) {
                for (var i = 0; i < this.listAdd.length; i++) {
                  if (this.listAdd[i].acturalAmount == null || this.listAdd[i].acturalAmount == '') {
                    this.$message({
                      type: 'warning',
                      message: '请录入数量是否未填写',
                      duration: 2000
                    })
                    return false
                  } else {
                    var rulesActuralAmount = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
                    if (!rulesActuralAmount.test(parseFloat(this.listAdd[i].acturalAmount))) {
                      this.$message({
                        type: 'error',
                        message: '录入数量请输入正数，最多保留两位小数点',
                        duration: 2000
                      })
                      return false
                    }
                  }
                }
                this.postDataPramas.common = { 'returnmap': '0' }
                this.postDataPramas.data = []
                this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
                this.postDataPramas.data[0].children = []
                this.postDataPramas.data[0].children[0] = { 'name': 'insertRepirsRefuse', 'type': 'e', 'parammaps': {
                  pastureId: Cookies.get('pastureid'),
                  deptId: this.maintainCompleteTemp.departmentId,
                  partCode: '@insertSpotList.partCode',
                  partName: '@insertSpotList.partName',
                  partId: '@insertSpotList.id',
                  specification: '@insertSpotList.specification',
                  unit: '@insertSpotList.unit',
                  acturalAmount: '@insertSpotList.acturalAmount',
                  eqId: this.maintainCompleteTemp.eqId,
                  eqCode: this.maintainCompleteTemp.eqCode,
                  eqName: this.maintainCompleteTemp.eqName,
                  repairCode: this.maintainCompleteTemp.upkeepCode,
                  listType: 1
                }}
                this.postDataPramas.data[1] = { 'name': 'completeUpkeep', 'type': 'e', 'parammaps': {
                  id: this.maintainCompleteTemp.id
                }}
                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.dialogFormVisible_maintainComplete = false
                    this.dialogFormVisible_See = false
                    this.getList()
                    this.getPendingList()
                    this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
                  }
                })
                return true
              } else {
                this.$notify({
                  title: '',
                  message: '请完善旧品信息',
                  type: 'warning',
                  duration: 2000
                })
                return false
              }
            }
          })
        }
      } else {
        this.$notify({ message: '备件未领用不可完成保养', type: 'warning', duration: 2000 })
      }
    },
    // 保养审核
    handleExamine(row) {
      console.log('点击了保养审核')
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'isStatue', 3)
        this.$set(this.seeTemp, 'workflowNote', '')
        this.$set(this.examineTemp, 'scores', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'isStatue', 3)
        this.$set(this.examineTemp, 'workflowNote', '')
        this.$set(this.examineTemp, 'scores', '')
      }
      this.dialogStatus = 'examine'
      this.dialogFormVisible_examine = true
    },
    changeIsStatue(val) {
      console.log(val)
      if (val == 4) {
        this.isStatueReason = true
      } else {
        this.isStatueReason = false
      }
    },
    // 保养审核1
    createExamineData() {
      console.log('点击了保养审核确认')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['examineTemp'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'upkeepCharge'
          this.requestParam.parammaps = {}
          this.requestParam.parammaps.id = this.examineTemp.id
          this.requestParam.parammaps.statue = this.examineTemp.isStatue
          this.requestParam.parammaps.empId	 = Cookies.get('employeid')
          this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
          if (this.requestParam.parammaps.statue == 4) {
            this.requestParam.parammaps.scores = 5
          } else {
            this.requestParam.parammaps.scores = this.examineTemp.scores
          }
          PostDataByName(this.requestParam).then(response => {
            console.log('保养审核确认发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              if (this.getdataListParm.parammaps.inputDatetime === null) {
                this.getdataListParm.parammaps.inputDatetime = ''
              }
              this.getList()
              this.dialogFormVisible_examine = false
              this.dialogFormVisible_See = false
              this.isStatueReason = false
              this.getPendingList()
              this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    // 保养审核2
    handleExamine2(row) {
      console.log('点击了保养审核------', row)
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'isStatue', 3)
        this.$set(this.seeTemp, 'workflowNote', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'isStatue', 3)
        this.$set(this.examineTemp, 'workflowNote', '')
      }
      this.dialogStatus = 'examine2'
      this.dialogFormVisible_examine = true
    },
    // 保养审核2-保存
    createExamineData2() {
      if (this.examineTemp.isStatue == 3) {
        console.log('点击了保养审核2确认-通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'upkeepChargDone'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            this.requestParam.parammaps.statue = 7
            this.requestParam.parammaps.orderStatue = 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') {
                if (this.getdataListParm.parammaps.inputDatetime === null) {
                  this.getdataListParm.parammaps.inputDatetime = ''
                }
                this.getList()
                this.dialogFormVisible_examine = false
                this.dialogFormVisible_See = false
                this.isStatueReason = false
                this.getPendingList()
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      } else {
        console.log('点击了保养审核2确认-不通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'upkeepCharge1'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            this.requestParam.parammaps.statue = 8
            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') {
                if (this.getdataListParm.parammaps.inputDatetime === null) {
                  this.getdataListParm.parammaps.inputDatetime = ''
                }
                this.getList()
                this.dialogFormVisible_examine = false
                this.dialogFormVisible_See = false
                this.isStatueReason = false
                this.getPendingList()
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      }
    },
    // 保养审核2
    handleExamine3(row) {
      console.log('点击了保养审核------', row)
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'isStatue', 3)
        this.$set(this.seeTemp, 'workflowNote', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'isStatue', 3)
        this.$set(this.examineTemp, 'workflowNote', '')
      }
      this.dialogStatus = 'examine3'
      this.dialogFormVisible_examine = true
    },
    // 保养审核3-保存
    createExamineData3() {
      if (this.examineTemp.isStatue == 3) {
        console.log('点击了保养审核3确认-通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'upkeepCharge3'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            this.requestParam.parammaps.statue = 5
            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') {
                if (this.getdataListParm.parammaps.inputDatetime === null) {
                  this.getdataListParm.parammaps.inputDatetime = ''
                }
                this.getList()
                this.dialogFormVisible_examine = false
                this.dialogFormVisible_See = false
                this.isStatueReason = false
                this.getPendingList()
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      } else {
        console.log('点击了保养审核3确认-不通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'upkeepCharge3'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            this.requestParam.parammaps.statue = 6
            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') {
                if (this.getdataListParm.parammaps.inputDatetime === null) {
                  this.getdataListParm.parammaps.inputDatetime = ''
                }
                this.getList()
                this.getPendingList()
                this.dialogFormVisible_examine = false
                this.dialogFormVisible_See = false
                this.isStatueReason = false
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      }
    },
    preview(row) {
      console.log(row, '=====666')
      this.dialogStatus = 'video'
      this.dialogFormVisible_video = true
      // row.videoPath = 'https://sys.mcs8.net:7706' + row.videoPath
      this.videoTemp = Object.assign({}, row)
    }
  }
}
</script>
<style lang="scss" scoped>
  /deep/ .el-badge__content.is-fixed{
    z-index: 1;
  }
</style>
<style lang="scss">
.el-step__head.is-success {
    color: #409EFF;
    border-color: #409EFF;
}
.el-step__title.is-success{
  color: #409EFF;
}
.el-step__head.is-process{
  color: #409EFF;
  border-color: #409EFF;
  .el-step__icon.is-text{
    background: #409EFF;
    color: #fff;
  }
}
.step-row{
  color: #000;
}
</style>
