<template>
  <div class="app-container">
    <div class="filter-container">
      <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 120px;">
        <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
      </el-select>
      <el-input v-model="getdataListParm.parammaps.repairCode" placeholder="报修单号" clearable style="width: 130px;" class="filter-item" />
      <el-input v-model="getdataListParm.parammaps.eqName" placeholder="设备名称" clearable style="width: 130px;" class="filter-item" />
      <el-input v-model="getdataListParm.parammaps.eqCode" placeholder="设备内部编号" clearable style="width: 130px;" class="filter-item" />
      <el-select v-model="getdataListParm.parammaps.orderStatue" clearable placeholder="处理状态" class="filter-item" style="width: 120px;">
        <el-option v-for="item in orderStatues" :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-select v-model="getdataListParm.parammaps.outsourcing" clearable placeholder="是否委外" class="filter-item" style="width: 120px;">
        <el-option v-for="item in outsourcingList" :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 class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
      <div>
        <el-button v-if="isRepair" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">报修</el-button>
        <!-- 临时注释 -->
        <el-button v-if="isRepairExport" class="filter-item" type="success" icon="el-icon-download" style="" @click="handleDownload">导出</el-button>
        <!-- 临时注释 -->
        <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="cellStyle"
      class="elTable table-fixed"
      :max-height="myHeight"
    >
      <el-table-column label="序号" align="center" type="index" width="50px">
        <template slot-scope="scope">
          <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报修单号" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.repairCode }}</span>
        </template>
      </el-table-column>
      <el-table-column label="牧场" 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="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.details }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报修人" min-width="100px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.requesterName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报修时间" sortable prop="requestTime" min-width="110px" align="center" />
      <el-table-column label="维修日期" sortable prop="stopTime" min-width="110px" align="center" />
      <el-table-column label="维修部门" min-width="80px" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.repairDeptName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="处理状态" min-width="100px" align="center" :formatter="orderStatue" />
      <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="110px" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.outsourcing == 0">无委外</span>
          <span v-else-if="scope.row.outsourcing == 1">确认委外维修</span>
          <span v-else-if="scope.row.outsourcing == 2">生成委外维修</span>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" min-width="100px" align="center" :formatter="SHStatue" />
      <el-table-column label="操作" align="center" min-width="400" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="{row}">
          <el-button v-if="isMaintenanceSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
          <!-- 维修审核 -->
          <el-button v-if="(row.SHStatue == 2) && isMaintenanceAudit && row.requesterId == getdataListParm.parammaps.loginId" style="display:inline-block" type="success" size="mini" class="successMaintenanceAudit" @click="handleExamine(row)">维修审核</el-button>
          <el-button v-else style="display:none" type="success" size="mini" class="successMaintenanceAudit" @click="handleExamine(row)">维修审核</el-button>
          <!-- 维修审核2 -->
          <el-button v-if="(row.SHStatue == 3) && isMaintenanceAudit2" style="display:inline-block" type="success" size="mini" class="successMaintenanceAudit" @click="handleExamine2(row)">维修审核2</el-button>
          <el-button v-else style="display:none" type="success" size="mini" class="successMaintenanceAudit" @click="handleExamine2(row)">主管审核</el-button>
          <!-- 派单 -->
          <el-button v-if="(row.orderStatue == 0) && isDistributeLeaflets" style="display:inline-block" type="success" size="mini" @click="handleDistributeLeaflets(row)">派单</el-button>
          <el-button v-else-if="(row.orderStatue == 1 ||row.orderStatue == 2 )" style="display:none" type="success" size="mini" @click="handleDistributeLeaflets(row)">派单</el-button>
          <!-- 接单 -->
          <!-- <el-button v-if="(row.orderStatue == 0 && isReceipt && (row.pickId == getdataListParm.parammaps.loginId))" style="display:inline-block" type="success" size="mini" @click="handleReceipt(row)">接单</el-button> -->
          <el-button v-if="roleSet1(row)" style="display:inline-block" type="success" size="mini" @click="handleReceipt(row)">接单</el-button>
          <!-- <el-button v-else-if="(row.orderStatue == 1)" style="display:none" type="success" size="mini" @click="handleReceipt(row)">接单</el-button> -->
          <el-button v-else-if="(row.orderStatue == 1 ||row.orderStatue == 2 )" style="display:none" type="success" size="mini" @click="handleReceipt(row)">接单</el-button>
          <!-- 维修及领用 -->
          <!-- <el-button v-if="(row.orderStatue == 1 && row.SHStatue== 1 || row.SHStatue== 4 || row.SHStatue== 6) && isMaintenanceRequisition && (row.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" size="mini" class="successRequisition" @click="handleMaintenanceRequisition(row)">维修及领用</el-button> -->

          <el-button v-if="roleSet2(row)" style="display:inline-block" type="success" size="mini" class="successRequisition" @click="handleMaintenanceRequisition(row)">维修及领用</el-button>

          <el-button v-else style="display:none" type="success" size="mini" class="successRequisition" @click="handleMaintenanceRequisition(row)">维修及领用</el-button>
          <!-- 完成维修 -->
          <!-- <el-button v-if="(row.orderStatue == 1 && (row.SHStatue == 1 || row.SHStatue== 4 || row.SHStatue== 6)) && isRepairComplete && (row.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" size="mini" class="successMaintenanceAudit" @click="handleRepairComplete(row)">完成维修</el-button> -->

          <el-button v-if="roleSet3(row)" style="display:inline-block" type="success" size="mini" class="successMaintenanceAudit" @click="handleRepairComplete(row)">完成维修</el-button>

          <el-button v-else style="display:none" type="success" size="mini" class="successMaintenanceAudit" @click="handleRepairComplete(row)">完成维修</el-button>
          <!-- 删除 -->
          <el-button v-if="(((row.orderStatue == 0 || row.orderStatue == 1  ) && row.SHStatue !== 5) && isDelete)" style="display:inline-block" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
          <el-button v-else style="display:none" type="success" size="danger" @click="form_delete(row)">删除</el-button>
          <!-- 驳回报修 -->
          <el-button v-if="(row.orderStatue == 0 && isRejectRepair)" style="display:inline-block;" type="success" class="successMaintenanceAudit" size="mini" @click="handleRejectRepair(row)">报修驳回</el-button>


          <el-button  v-if="isshengweiwaidan && row.outsourcing == 1"   style="display:inline-block" type="success" size="mini" class="successRequisition" @click="form_add_cont(row)">生成委外单</el-button>
          <el-button   v-if="roleSet11(row)"  style="display:inline-block" type="success" size="mini" class="successRequisition" @click="form_add_cont_sure(row)">委外维修</el-button>


        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />

    <!-- 新增委外维修单 -->
    <el-dialog  title="新增委外维修单1" :visible.sync="dialogFormVisibleCont" :close-on-click-modal="false" width="90%" @close="handleClose(1)">
      <div >
        <el-form ref="createTempCont" :rules="rules" :model="createTempCont" label-position="right" label-width="100px" style="width: 100%;">
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="委外维修单号：" prop="outsourcingCode">
                <el-input ref="outsourcingCode" v-model="createTempCont.outsourcingCode" disabled   />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="牧场：" prop="pastureId" >
                <el-select key="1"  v-model="createTempCont.pastureId" placeholder="牧场" class="filter-item" style="width:100%"   @change="change_pasture2" >
                  <el-option v-for="item in pastureNameList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="责任部门：" prop="departmentId">
                <el-select key="2"  v-model="createTempCont.departmentId" placeholder="责任部门" class="filter-item" style="width:100%"   @change="change_depart2">
                  <el-option v-for="item in departNameList2" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">

            <el-col :span="8">
              <el-form-item label="合同：" prop="contract">
                <el-radio-group v-model="createTempCont.contract"    @change="change_contract" >
                  <el-radio   :label="0"  >无合同</el-radio>
                  <el-radio    :label="1" checked>有合同</el-radio>

                </el-radio-group>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="申请人：" prop="applicant">
                <el-select key="3"  v-model="createTempCont.applicant" placeholder="申请人" class="filter-item" style="width:100%" @change="changeApplicant" :disabled="dialogStatus==='see'"  >
                  <el-option v-for="item in employeNameList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="日期：" prop="date">
                <el-date-picker v-model="createTempCont.date" :picker-options="pickerOptions" type="date" placeholder="日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%"    />
              </el-form-item>
            </el-col>


          </el-row>
          <el-row :gutter="20">
            <el-col :span="16">
              <el-form-item label="故障描述：" prop="description">
                <el-input   v-model="createTempCont.description" type="textarea" autosize :disabled="dialogStatus==='see'"  />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报修单号：" prop="RUCode">
                <el-input ref="RUCode" v-model="createTempCont.RUCode" disabled   />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>



        <el-table
            :key="tableKey"
            v-loading="listLoading"
            element-loading-text="给我一点时间"
            :data="listAddCont"
            border
            fit
            highlight-current-row
            style="width: 100%;margin-bottom:30px"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable"
          >
            <!-- table表格 -->
            <el-table-column :key="0" label="序号" align="center" type="index" width="50px" />
            <el-table-column :key="1" label="供应商" prop="providerName" align="center" min-width="80px">
              <template slot-scope="scope">
                <el-select v-model="scope.row.providerName" filterable clearable  placeholder="供应商" class="filter-item" style="width: 120px; margin-top:10px"   >
                  <el-option v-for="item in providerNameList" :key="item.name" :label="item.name" :value="item.name" />
                </el-select>

              </template>
            </el-table-column>
            <el-table-column :key="2" label="金额" v-if="createTempCont.contract == 0" prop="amount" align="center" min-width="80px">
              <template slot-scope="scope">
                <span >
                  <el-input v-model="scope.row.amount" style="margin-top:10px" />
                </span>

              </template>
            </el-table-column>
            <el-table-column   :key="3" label="设备名称" prop="eqName" align="center" min-width="250">
                <template slot-scope="scope">
                  <el-autocomplete     style="margin-top:10px"
                    v-model="scope.row.eqName"
                    class="inline-input"
                    :fetch-suggestions="querySearchEqNameCont"
                    value-key="eqName"
                    placeholder="设备名称"
                    @select="(value)=>
                    {handleSelectEqNameCont(value, scope.row)}"
                    @blur="(value)=>
                    {blurSelectEqNameCont(value, scope.row)}"
                  >
                    <template slot-scope="{ item }">
                      <span class="addr">{{ item.eqName }}</span>
                      |<span class="addr">{{ item.eqCode }}</span>
                    </template>
                  </el-autocomplete>

                </template>
              </el-table-column>
              <el-table-column :key="4"  label="设备内部编号" prop="eqCode" align="center" min-width="150">
                <template slot-scope="scope">
                  <el-autocomplete  style="margin-top:10px"
                    v-model="scope.row.eqCode"
                    class="inline-input"
                    :fetch-suggestions="querySearchCodeCont"
                    value-key="eqCode"
                    placeholder="设备内部编号"
                    @select="(value)=>
                    {handleSelectEqCodeCont(value, scope.row)}"
                    @blur="(value)=>
                    {blurSelectEqCodeCont(value, scope.row)}"
                  />

                </template>
              </el-table-column>


            <el-table-column :key="5" label="费用类型" prop="typea" align="center" min-width="80px">
              <template slot-scope="scope">

                <el-select v-model="scope.row.typea" placeholder="费用类型" class="filter-item" style="width: 120px; margin-top:10px "  >
                  <el-option v-for="item in costTypeList" :key="item.id" :label="item.name" :value="item.name" />
                </el-select>

              </template>
            </el-table-column>
            <!-- <el-table-column label="交付日期" prop="date" align="center" min-width="80px">
              <template slot-scope="scope">
                <span v >

                  <el-date-picker v-model="scope.row.date"   style="margin-top:10px"   type="date" placeholder="日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"   />
                </span>

              </template>
            </el-table-column> -->
            <el-table-column :key="6" v-if="createTempCont.contract == 1" label="合同编号" prop="contractCode" align="center" min-width="80px">
              <template slot-scope="scope">
                <span  >
                  <el-input v-model="scope.row.contractCode" style="margin-top:10px" />
                </span>
              </template>
            </el-table-column>
             <el-table-column :key="9" label="铅封号" prop="sealNumber" align="center" min-width="80px">
              <template slot-scope="scope">
                   <el-input v-model="scope.row.sealNumber" style="margin-top:10px" />
              </template>
            </el-table-column>
            <el-table-column  :key="10"  label="历史铅封号" prop="sealNumberHis" align="center" min-width="80px">
              <template slot-scope="scope">
                <span >{{ scope.row.sealNumberHis }}</span>
              </template>
            </el-table-column>
            <el-table-column :key="7" label="备注" prop="remark" align="center" min-width="80px">
              <template slot-scope="scope">
                <span  >
                  <el-input v-model="scope.row.remark" style="margin-top:10px" />
                </span>

              </template>
            </el-table-column>



          </el-table>





        <div slot="footer" class="dialog-footer" style="bottom:10px">
          <el-button type="primary" :disabled="isokDisable" @click="add_dialog_save_cont()">保存并关闭</el-button>
          <el-button @click="dialogFormVisibleCont = false;get_table_data()">取消</el-button>
        </div>
      </div>
    </el-dialog>

      <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Create" :close-on-click-modal="false" width="90%">
      <div class="app-create">
        <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="120px" style="width: 90%;margin:0 auto;">
          <el-row>
            <el-col :span="8">
              <el-form-item label="报修单号：" prop="repairCode">
                <el-input ref="repairCode" v-model="createTemp.repairCode" disabled />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="设备名称：" prop="eqName">
                <el-autocomplete
                  v-model="createTemp.eqName"
                  class="inline-input"
                  :fetch-suggestions="querySearchEqName"
                  value-key="eqName"
                  placeholder="设备名称"
                  style="width:100%"
                  @select="handleSelectEqName"
                >
                  <template slot-scope="{ item }">
                    <b>名称：</b><span>{{ item.eqName }}</span>&nbsp;
                    |&nbsp;<b>规格：</b><span>{{ item.specification }}</span>
                  </template>
                </el-autocomplete>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="设备内部编号：" prop="eqCode">
                <el-autocomplete
                  v-model="createTemp.eqCode"
                  class="inline-input"
                  :fetch-suggestions="querySearchCode"
                  style="width:100%"
                  value-key="eqCode"
                  placeholder="设备内部编号"
                  @select="handleSelectEqCode"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <!-- <el-col :span="8">
              <el-form-item label="维修人:" prop="pickId">
                <el-select v-model="createTemp.pickId"   multiple  filterable placeholder="维修人" filterable class="filter-item" style="width:100%" @change="changePickId">
                  <el-option v-for="item in maintainers" :key="item.id" :label="item.empNameAndmt" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col> -->

            <el-col :span="8">
              <el-form-item label="维修人:" prop="pickId">

                <el-input  v-model="pickNameArr" disabled />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <!-- <el-form-item label="故障情况：" prop="details">
                <el-input ref="details" v-model="createTemp.details" />
              </el-form-item> -->
               <!-- 这里PC和APP都需要等后端接口出来，是选了设备后带出故障内容。T T -->
              <el-form-item label="故障情况：" prop="details">
                <el-select v-model="createTemp.details"  placeholder="故障情况" filterable class="filter-item" style="width:100%" @change="changeDetails">
                  <el-option v-for="item in  DetailList" :key="item.id" :label="item.describe" :value="item.describe" />
                </el-select>

              </el-form-item>




            </el-col>
            <el-col :span="8">
              <el-form-item label="牧场：" prop="pastureName">
                <el-select v-model="createTemp.pastureId" style="width: 100%;" placeholder="牧场" class="filter-item">
                  <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="部门：" prop="deptName">
                <el-input ref="deptName" v-model="createTemp.deptName" disabled />
              </el-form-item>
              <!-- <el-form-item label="部门：" prop="departmentId">
                <el-select v-model="createTemp.departmentId" placeholder="部门" class="filter-item" style="width:100%">
                  <el-option
                    v-for="item in findAllDepart"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item> -->
            </el-col>
            <el-col :span="8">
              <el-form-item label="报修人：" prop="requesterId">
                <el-select ref="requesterId" v-model="createTemp.requesterId" placeholder="报修人" class="filter-item" style="width:100%">
                  <el-option
                    v-for="item in findAllEmploye"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报修日期：" prop="requestTime">
                <el-date-picker
                  v-model="createTemp.requestTime"
                  :picker-options="pickerOptions1"
                  type="datetime"
                  placeholder="报修日期"
                  format="yyyy-MM-dd HH:mm"
                  value-format="yyyy-MM-dd HH:mm"
                  style="width: 100%;"
                  disabled
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="备注：" prop="remark">
                <el-input ref="remark" v-model="createTemp.remark" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">保存并关闭</el-button>
        <el-button @click="handleClose(2)">关闭</el-button>
      </div>
    </el-dialog>
    <!-- todo -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_See" :close-on-click-modal="false" @close="handleClose(1)"  width="90%">
      <div class="app-see">
        <div v-if="orderStatue1" class="see">
          <el-form ref="seeTemp" :rules="rules" :model="seeTemp" label-position="right" label-width="130px" style="width: 90%;margin:0 auto;">
            <el-row>
              <el-col :span="8">
                <el-form-item label="报修单号：" prop="repairCode">
                  <el-input ref="repairCode" v-model="seeTemp.repairCode" 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="repairDeptName">
                  <el-input ref="repairDeptName" v-model="seeTemp.repairDeptName" disabled />
                </el-form-item>
              </el-col> -->
              <el-col :span="8">
                <el-form-item label="维修人：" prop="pickName">
                  <el-input ref="pickName" v-model="seeTemp.pickName" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="故障情况：" prop="details">
                  <el-input ref="details" v-model="seeTemp.details" disabled />
                </el-form-item>
              </el-col>
              <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-row>
            <el-row>
              <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="requesterName">
                  <el-input ref="requesterName" v-model="seeTemp.requesterName" disabled />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="报修日期：" prop="requestTime">
                  <el-input ref="requestTime" v-model="seeTemp.requestTime" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="备注：" prop="remark">
                  <el-input ref="remark" v-model="seeTemp.remark" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col v-if="seeTemp.orderStatue == 3" :span="8">
                <el-form-item label="驳回日期：" prop="shutdownDate">
                  <el-input ref="shutdownDate" v-model="seeTemp.shutdownDate" disabled />
                </el-form-item>
              </el-col>
              <el-col v-if="seeTemp.orderStatue == 3" :span="8">
                <el-form-item label="驳回原因：" prop="shutdownReason">
                  <el-input ref="shutdownReason" v-model="seeTemp.shutdownReason" disabled />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <h3>流程进度</h3>
                <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 == 2) && isMaintenanceAudit && seeTemp.requesterId == getdataListParm.parammaps.loginId" style="display:inline-block" type="success" @click="handleExamine()">维修审核</el-button>
                  <el-button v-else style="display:none" type="success" @click="handleExamine()">维修审核</el-button>
                  <!-- 维修审核2 -->
                  <el-button v-if="(seeTemp.SHStatue == 3) && isMaintenanceAudit2" style="display:inline-block" type="success" @click="handleExamine2(row)">维修审核2</el-button>
                  <el-button v-else style="display:none" type="success" @click="handleExamine2()">主管审核</el-button>
                  <!-- 派单 -->
                  <el-button v-if="(seeTemp.orderStatue == 0) && isDistributeLeaflets" style="display:inline-block" type="success" @click="handleDistributeLeaflets()">派单</el-button>
                  <el-button v-else-if="(seeTemp.orderStatue == 1 ||seeTemp.orderStatue == 2 )" style="display:none" type="success" @click="handleDistributeLeaflets()">派单</el-button>
                  <!-- 接单 -->
                  <el-button v-if="(seeTemp.orderStatue == 0 && isReceipt && (seeTemp.pickId == getdataListParm.parammaps.loginId))" style="display:inline-block" type="success" @click="handleReceipt()">接单</el-button>
                  <el-button v-else-if="(seeTemp.orderStatue == 1 ||seeTemp.orderStatue == 2 )" style="display:none" type="success" @click="handleReceipt()">接单</el-button>
                  <!-- 维修及领用 -->
                  <el-button v-if="(seeTemp.orderStatue == 1 && seeTemp.SHStatue== 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6) && isMaintenanceRequisition && (seeTemp.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" @click="handleMaintenanceRequisition()">维修及领用</el-button>
                  <el-button v-else style="display:none" @click="handleMaintenanceRequisition()">维修及领用</el-button>
                  <!-- 完成维修 TODO: -->
                  <el-button v-if="(seeTemp.orderStatue == 1 && (seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6)) && isRepairComplete && (seeTemp.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" @click="handleRepairComplete()">完成维修</el-button>
                  <el-button v-else style="display:none" @click="handleRepairComplete()">完成维修</el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div v-if="orderStatue2" 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="130px" style="width: 90%;margin:0 auto;">
                <el-row>
                  <el-col :span="8">
                    <h3>报修信息</h3>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="报修单号：" prop="repairCode">
                      <el-input ref="repairCode" v-model="seeTemp.repairCode" 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="repairDeptName">
                      <el-input ref="repairDeptName" v-model="seeTemp.repairDeptName" disabled />
                    </el-form-item>
                  </el-col> -->
                  <el-col :span="8">
                    <el-form-item label="维修人：" prop="pickName">
                      <el-input ref="pickName" v-model="seeTemp.pickName" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="故障情况：" prop="details">
                      <el-input ref="details" v-model="seeTemp.details" disabled />
                    </el-form-item>
                  </el-col>
                  <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-row>
                <el-row>
                  <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="requesterName">
                      <el-input ref="requesterName" v-model="seeTemp.requesterName" disabled />
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="报修日期：" prop="requestTime">
                      <el-input ref="requestTime" v-model="seeTemp.requestTime" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="备注：" prop="remark">
                      <el-input ref="remark" v-model="seeTemp.remark" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <h3>维修信息</h3>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="维修日期：" prop="stopTime">
                      <el-input ref="stopTime" v-model="seeTemp.stopTime" disabled />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <h3>故障诊断</h3>
                  </el-col>
                </el-row>
              </el-form>
              <el-table
                :key="tableKey"
                v-loading="listLoadingFault"
                element-loading-text="给我一点时间"
                :data="listFault"
                border
                fit
                highlight-current-row
                style="width: 90%;margin:0 auto"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable"
              >
                <el-table-column label="序号" align="center" type="index" width="50px">
                  <template slot-scope="scope">
                    <span>{{ scope.$index + (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.positionName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="故障详情" prop="appearanceName" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.appearanceName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="故障原因" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.failureCause }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="处理方式" prop="treatmentMethod" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.treatmentMethod }}</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>
                    <h3>流程进度</h3>
                    <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" style="font-size:18px">
                          <div class="step-row">
                            <div>{{ item.name }}</div>
                            <div>{{ 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>
                    <h3 style="display:inline">操作</h3>
                    <!-- 维修审核 -->
                    <el-button v-if="(seeTemp.SHStatue == 2) && isMaintenanceAudit && seeTemp.requesterId == getdataListParm.parammaps.loginId" style="display:inline-block" type="success" @click="handleExamine()">维修审核</el-button>
                    <el-button v-else style="display:none" type="success" @click="handleExamine()">维修审核</el-button>
                    <!-- 维修审核2 -->
                    <el-button v-if="(seeTemp.SHStatue == 3) && isMaintenanceAudit2" style="display:inline-block" type="success" @click="handleExamine2(row)">维修审核2</el-button>
                    <el-button v-else style="display:none" type="success" @click="handleExamine2()">主管审核</el-button>
                    <!-- 派单 -->
                    <el-button v-if="(seeTemp.orderStatue == 0) && isDistributeLeaflets" style="display:inline-block" type="success" @click="handleDistributeLeaflets()">派单</el-button>
                    <el-button v-else-if="(seeTemp.orderStatue == 1 ||seeTemp.orderStatue == 2 )" style="display:none" type="success" @click="handleDistributeLeaflets()">派单</el-button>
                    <!-- 接单 -->
                    <el-button v-if="(seeTemp.orderStatue == 0 && isReceipt && (seeTemp.pickId == getdataListParm.parammaps.loginId))" style="display:inline-block" type="success" @click="handleReceipt()">接单</el-button>
                    <el-button v-else-if="(seeTemp.orderStatue == 1 ||seeTemp.orderStatue == 2 )" style="display:none" type="success" @click="handleReceipt()">接单</el-button>
                    <!-- 维修及领用 -->
                    <el-button v-if="(seeTemp.orderStatue == 1 && seeTemp.SHStatue== 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6) && isMaintenanceRequisition && (seeTemp.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" @click="handleMaintenanceRequisition()">维修及领用</el-button>
                    <el-button v-else style="display:none" type="success" @click="handleMaintenanceRequisition()">维修及领用</el-button>
                    <!-- 完成维修 -->
                    <el-button v-if="(seeTemp.orderStatue == 1 && (seeTemp.SHStatue == 1 || seeTemp.SHStatue== 4 || seeTemp.SHStatue== 6)) && isRepairComplete && (seeTemp.pickId == getdataListParm.parammaps.loginId)" style="display:inline-block" type="success" @click="handleRepairComplete()">完成维修</el-button>
                    <el-button v-else style="display:none" type="success" @click="handleRepairComplete()">完成维修</el-button>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
            <el-tab-pane label="领用记录" name="second">
              <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"
              >
                <!-- 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.applyCode }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="领用部门" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.departmentName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="领用日期" sortable prop="createDate" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.createDate }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="领用明细" prop="details" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.details }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="领用状态" min-width="110px" align="center" :formatter="statue" />
                <el-table-column label="操作" min-width="110px" align="center">
                  <template slot-scope="{row}">
                    <el-button type="primary" size="mini" @click="handleCollarUseSee(row,0)">查看</el-button>
                  </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="tableSort1"
              >
                <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 label="录入数量" sortable prop="acturalAmount" 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="handleClose(1)">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 派单 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_DistributeLeaflets" :close-on-click-modal="false" width="50%">
      <div class="distributeLeaflets">
        <el-form
          ref="distributeLeafletsTemp"
          :rules="rules"
          :model="distributeLeafletsTemp"
          label-position="right"
          label-width="120px"
          style="width: 90%;margin:0 auto;"
        >
          <el-row>
            <el-col :span="20">
              <el-form-item label="维修人:" prop="pickId">
                <el-select v-model="distributeLeafletsTemp.pickId" filterable placeholder="维修人" class="filter-item" style="width:100%" @change="changePickId">
                  <el-option v-for="item in maintainers" :key="item.id" :label="item.empNameAndmt" :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>


          </el-row>
          <el-row>
            <el-col :span="20">
              <el-form-item label="派单人：" prop="chargeId">
                <el-select v-model="distributeLeafletsTemp.chargeId" placeholder="派单人" class="filter-item" style="width:100%">
                  <el-option
                    v-for="item in findAllEmploye"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="20">
              <el-form-item label="派单日期：" prop="chargeDate">
                <el-date-picker
                  v-model="distributeLeafletsTemp.chargeDate"
                  :picker-options="pickerOptions1"
                  type="date"
                  placeholder="派单日期"
                  style="width:100%;"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='distributeLeaflets'?createDistributeLeafletsData():createDistributeLeafletsData()">确认</el-button>
        <el-button @click="dialogFormVisible_DistributeLeaflets = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 审核 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_MaintenanceAudit" :close-on-click-modal="false" width="30%">
      <div class="maintenanceAudit">
        <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请确认维修审核结果:</h3>
        <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 60%;height:150px;margin:0 auto;">
          <el-row style="width:90%;margin:0 auto;">
            <el-col :span="20">
              <el-form-item>
                <el-radio-group v-model="examineTemp.statue" @change="changeStatue">
                  <el-radio :label="3" checked>通过</el-radio>
                  <el-radio :label="4">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col v-if="statueReason && examineTemp.statue == 4 " :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.statue== 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 type="primary" :disabled="isokDisable" @click="dialogStatus==='maintenanceAudit'?createExamineData():createExamineData2()">确认</el-button>
        <el-button @click="dialogFormVisible_MaintenanceAudit = false;">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_RepairComplete" :close-on-click-modal="false" width="50%">
      <div class="repairComplete">
        <el-form
          ref="repairCompleteTemp"
          :rules="rules"
          :model="repairCompleteTemp"
          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="repairCompleteTemp.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="repairCompleteTemp.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"
        >
          <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="specification" align="center" min-width="90">
            <template slot-scope="scope">
              <span>{{ scope.row.amount }}</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==='repairComplete'?createRepairCompleteData():createRepairCompleteData()">确认</el-button>
        <el-button @click="dialogFormVisible_RepairComplete = false;">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_MaintenanceRequisition" :close-on-click-modal="false" width="90%">
      <div style="position: absolute;top:12px;left:120px;font:18px/40px '' ;color:#303133;">
        <span style="margin:0 10px;">设备名称：{{ maintenanceRequisitionTemp.eqName }}</span>
        <span>内部编号：{{ maintenanceRequisitionTemp.eqCode }}</span>
      </div>
      <div class="maintenanceRequisition" style="width:90%;margin:0 auto;">
        <el-tabs v-model="activeName2" @tab-click="tabMaintenance">
          <el-tab-pane label="维修" name="first">
            <el-form
              ref="maintenanceRequisitionTemp"
              :rules="rules"
              :model="maintenanceRequisitionTemp"
              label-position="right"
              label-width="120px"
              style="width: 90%;margin:0 auto;"
            >
              <el-row>
                <el-col :span="8">
                  <el-form-item label="维修日期" prop="repirsTime">
                    <el-date-picker
                      v-model="maintenanceRequisitionTemp.repirsTime"
                      :picker-options="pickerOptions1"
                      type="date"
                      placeholder="维修日期"
                      style="width:100%;"
                      format="yyyy-MM-dd"
                      value-format="yyyy-MM-dd"
                      :clearable="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <div class="newFault">
              <el-form
                ref="newFaultTemp"
                :rules="rules"
                :model="newFaultTemp"
                label-position="right"
                label-width="120px"
                style="width: 90%;margin:0 auto"
              >
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="故障诊断：" prop="positionId">
                      <el-select v-model="newFaultTemp.positionId" style="width:100%;" filterable placeholder="故障部位" @change="changePosition">
                        <el-option
                          v-for="item in positions"
                          :key="item.id"
                          :label="item.positionName"
                          :value="item.id"
                        />
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item>
                      <el-select v-model="newFaultTemp.appearanceName" style="width:100%;" filterable placeholder="故障详情" @change="changeAppearance">
                        <el-option
                          v-for="item in appearances"
                          :key="item.id"
                          :label="item.appearanceName"
                          :value="item.appearanceName"
                        />
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
              <el-table
                :key="tableKey"
                v-loading="listLoading"
                element-loading-text="给我一点时间"
                :data="listNewFault"
                border
                fit
                highlight-current-row
                style="width: 100%;margin-bottom:30px"
                :cell-style="cellStyle"
                class="elTable"
                :row-style="rowStyle"
              >
                <el-table-column type="index" label="序号" align="center" width="50px" />
                <el-table-column label="故障部位" min-width="90px" prop="positionName" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.positionName }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="故障详情" min-width="60px" align="center" prop="appearanceName">
                  <template slot-scope="scope">
                    <el-input ref="appearanceName" v-model="scope.row.appearanceName" />
                  </template>
                </el-table-column>
                <el-table-column label="故障原因" min-width="60px" align="center" prop="failureCause">
                  <template slot-scope="scope">
                    <el-input ref="failureCause" v-model="scope.row.failureCause" />
                  </template>
                </el-table-column>
                <el-table-column label="处理方式" min-width="60px" align="center" prop="treatmentMethod">
                  <template slot-scope="scope">
                    <el-input ref="treatmentMethod" v-model="scope.row.treatmentMethod" />
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
                  <template slot-scope="{row}">
                    <a class="del" @click="newFaultDelete(row)">删除</a>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-tab-pane>
          <el-tab-pane label="备件领用" name="second">
            <el-button class="filter-item" type="primary" size="mini" style="margin-bottom:10px" @click="handleCollectionSparePartsCreate">添加领用单</el-button>
            <h4>有库存领用</h4>
            <el-table
              :key="tableKey"
              v-loading="listLoading"
              element-loading-text="给我一点时间"
              :data="listCollectionSpareParts"
              border
              fit
              highlight-current-row
              style="width: 100%;"
              :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="领用单号" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.applyCode }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用部门" width="140px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.departmentName }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用日期" sortable prop="createDate" min-width="80px" align="center" />
              <el-table-column label="领用备件" prop="details" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.details }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用状态" min-width="100px" align="center" :formatter="statue" />
              <el-table-column label="操作" min-width="80px" align="center">
                <template slot-scope="{row}">
                  <el-button type="primary" size="mini" @click="handleCollarUseSee(row,0)">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
            <h4>无库存领用</h4>
            <el-table
              :key="tableKey2"
              v-loading="listLoading"
              element-loading-text="给我一点时间"
              :data="listCollectionSpareParts2"
              border
              fit
              highlight-current-row
              style="width: 100%;"
              :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="领用部门" width="140px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.departmentName }}</span>
                </template>
              </el-table-column>
              <el-table-column label="最新领用日期" sortable prop="createDate" min-width="80px" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.createDate }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用备件" prop="details" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.details }}</span>
                </template>
              </el-table-column>
              <el-table-column label="领用状态" min-width="100px" align="center" :formatter="statue" />
              <el-table-column label="操作" min-width="80px" align="center">
                <template slot-scope="{row}">
                  <el-button type="primary" size="mini" @click="handleCollarUseSee(row,1)">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom:5px">
        <el-button v-if="rapairBtn" type="primary" :disabled="isokDisable" @click="dialogStatus==='maintenanceRequisition'?createMaintenanceRequisitionteData():createMaintenanceRequisitionteData()">确认</el-button>
        <el-button @click="dialogFormVisible_MaintenanceRequisition = false;get_table_data();">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_CollectionSparePartsSee" :close-on-click-modal="false" width="90%">
      <div class="collectionSparePartsSee">
        <el-form
          ref="collectionSparePartsSeeTemp"
          :rules="rules"
          :model="collectionSparePartsSeeTemp"
          label-position="right"
          label-width="120px"
          style="width: 90%;margin:0 auto;"
        >
          <el-row>
            <el-col v-if="collectionSparePartsSeeTemp.isStock !== 1" :span="8">
              <el-form-item label="领用单号：" prop="applyCode">
                <el-input ref="applyCode" v-model="collectionSparePartsSeeTemp.applyCode" disabled />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="领用部门：" prop="departmentName">
                <el-input ref="departmentName" v-model="collectionSparePartsSeeTemp.departmentName" disabled />
              </el-form-item>
            </el-col>
            <el-col v-if="collectionSparePartsSeeTemp.isStock !== 1" :span="8">
              <el-form-item label="领用日期：" prop="createDate">
                <el-input ref="createDate" v-model="collectionSparePartsSeeTemp.createDate" disabled />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="isPartCode">
            <el-col :span="16">
              <el-form-item label="所需备件：" prop="partCode">
                <el-autocomplete
                  v-model="collectionSparePartsSeeTemp.partCode"
                  value-key="name"
                  class="inline-input"
                  :fetch-suggestions="sparePartSearch"
                  placeholder="请输入备件编号或备件名称或备件规格"
                  style="width:98%"
                  @select="handleSelectSparePart"
                >
                  <template slot-scope="{ item }">
                    <b>备件编号：</b><div class="name" style="display: inline;">{{ item.partCode }}</div>&nbsp;
                    |  &nbsp;<b>备件名称：</b><span class="addr">{{ item.partName }}</span>&nbsp;
                    |  &nbsp;<b>备件规格：</b><span class="addr">{{ item.specification }}</span>
                    |  &nbsp;<b>库存：</b><span class="addr">{{ item.reportery }}</span>
                    |  &nbsp;<b>是否零库存：</b><span class="addr" v-if="item.isZeroStock==1">是</span>
                    <span class="addr" v-else>否</span>
                  </template>
                </el-autocomplete>
              </el-form-item>
            </el-col>
            <el-col :span="2">
              <el-button type="primary" @click="handleAddSparePartsToBeCollected">添加待领用备件</el-button>
            </el-col>
          </el-row>
        </el-form>
        <el-table
          :key="tableKey"
          v-loading="listLoading"
          element-loading-text="给我一点时间"
          :data="listCreateCollectionSpareParts"
          border
          fit
          highlight-current-row
          style="width: 100%;margin-bottom:30px"
          :row-style="rowStyle"
          :cell-style="cellStyle"
          class="elTable table-fixed"
        >
          <!-- 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="80px" 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="100">
            <template slot-scope="scope">
              <span>{{ scope.row.specification }}</span>
            </template>
          </el-table-column>
          <el-table-column label="库存数" prop="reportery" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.reportery }}</span>
            </template>
          </el-table-column>
          <el-table-column label="领用数量" prop="amount" align="center" min-width="80">
            <template slot-scope="scope">
              <el-form :model="scope.row">
                <el-form-item prop="amount">
                  <el-input ref="amount" v-model="scope.row.amount" :disabled="dialogStatus==='collectionSparePartsSee'" style="margin-top:15px" />
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column v-if="collectionSparePartsSeeTemp.isStock==1" label="领用时间" prop="date" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.date }}</span>
            </template>
          </el-table-column>

          <el-table-column label="单价" min-width="90px" prop="price" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.price }}</span>
            </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" :disabled="dialogStatus==='collectionSparePartsSee'" style="margin-top:15px" />
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column v-if="collectionSparePartsSeeTemp.isStock==1" label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <a class="primary" @click="handleViewProgress(row)">查看进度</a>
            </template>
          </el-table-column>
          <el-table-column v-if="isCreatePartDelete" label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <a class="del" @click="createPartDelete(row)">删除</a>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom:5px">
        <el-button v-if="isPartCode" type="primary" :disabled="isokDisable" @click="dialogStatus==='collectionSparePartsCreate'?createCollectionSparePartsData():createCollectionSparePartsData()">确认</el-button>
        <el-button @click="dialogFormVisible_CollectionSparePartsSee = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 查看进度 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_ViewProgress" :close-on-click-modal="false" width="90%">
      <div class="viewProgress">
        <el-form
          ref="viewProgressTemp"
          :rules="rules"
          :model="viewProgressTemp"
          label-position="right"
          label-width="120px"
          style="width: 90%;margin:0 auto;"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="本次领用数量：" prop="amountY">
                <span> {{ numbersList.amountY }} </span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="其他领用数量：" prop="amountQT">
                <span> {{ numbersList.amountQT }} </span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="未出库数量：" prop="amountLY">
                <span> {{ numbersList.amountLY }} </span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <h4>申购情况：</h4>
        <el-table
          :key="tableKey"
          v-loading="listLoading"
          element-loading-text="给我一点时间"
          :data="purchaseapplicationList"
          border
          fit
          highlight-current-row
          style="width: 100%;margin-bottom:30px"
          :row-style="rowStyle"
          :cell-style="cellStyle"
          class="elTable table-fixed"
          @sort-change="tableSort2"
        >
          <el-table-column type="index" label="序号" align="center" width="50px" />
          <el-table-column label="申购单号" min-width="90px" prop="orderNumber" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.orderNumber }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable prop="amount" label="申购数量" min-width="80px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.amount }}</span><br>
            </template>
          </el-table-column>
          <el-table-column label="申购时间" sortable prop="createTime" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.createTime }}</span>
            </template>
          </el-table-column>
          <el-table-column label="申购部门" prop="deptName" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.deptName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="申购人" prop="amount" align="center" min-width="80">
            <template slot-scope="scope">
              <span>{{ scope.row.empName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="是否配单" prop="buyStatu" align="center" min-width="80">
            <template slot-scope="scope">
              <span>{{ scope.row.buyStatu }}</span>
            </template>
          </el-table-column>
          <el-table-column label="配单号" prop="matchCode" align="center" min-width="80">
            <template slot-scope="scope">
              <span>{{ scope.row.matchCode }}</span>
            </template>
          </el-table-column>
        </el-table>
        <h4>采购情况：</h4>
        <el-table
          :key="tableKey2"
          v-loading="listLoading"
          element-loading-text="给我一点时间"
          :data="procurementList"
          border
          fit
          highlight-current-row
          style="width: 100%;margin-bottom:30px"
          :row-style="rowStyle"
          :cell-style="cellStyle"
          class="elTable table-fixed"
          @sort-change="tableSort3"
        >
          <el-table-column type="index" label="序号" align="center" width="50px" />
          <el-table-column label="采购单号" min-width="90px" prop="buyeCode" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.buyeCode }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable prop="amount" label="采购数量" min-width="80px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.amount }}</span><br>
            </template>
          </el-table-column>
          <el-table-column label="配单号" prop="specification" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.matchCode }}</span>
            </template>
          </el-table-column>
          <el-table-column label="提交时间" prop="buyerDate" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.buyerDate }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable prop="receiveAmount" label="入库数量" align="center" min-width="100">
            <template slot-scope="scope">
              <span>{{ scope.row.receiveAmount }}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom:5px">
        <el-button @click="dialogFormVisible_ViewProgress = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 报修驳回 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="rejectRepair.dialogFormVisible" :close-on-click-modal="false" width="30%">
      <div class="maintenanceAudit">
        <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请输入报修驳回原因:</h3>
        <el-form ref="rejectRepair" :rules="rules" :model="rejectRepair.temp" label-position="right" style="width: 60%;height:150px;margin:0 auto;">
          <el-row>
            <el-col :span="20">
              <el-form-item prop="shutdownReason">
                <el-input v-model="rejectRepair.temp.shutdownReason" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入报修驳回原因" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="rejectRepairData()">确认</el-button>
        <el-button @click="rejectRepair.dialogFormVisible = false;">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// 引入
import { GetDataByName, GetDataByNames,GetAccount, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
import { mapGetters } from 'vuex'
import waves from '@/directive/waves' // waves directive
import { parseTime, sortChange,json2excel } from '@/utils/index.js'
// eslint-disable-next-line no-unused-vars
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { MessageBox } from 'element-ui'
import Cookies from 'js-cookie'
export default {
  name: 'Repair',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      myHeight:document.documentElement.clientHeight - 85- 200,
      dialogFormVisibleCont:false,

      createTempCont: {

        RUCode: '',
        pastureId: this.$store.state.user.pastureid,
        departmentId: this.$store.state.user.departmentid,
        employeId: this.$store.state.user.employeid,
        date: parseTime(new Date(), '{y}-{m}-{d}'),
        outsourcingCode: '',
        applicant: '',
        providerId: '',
        departmentName: '',
        description: '',
        contract:1,
      },

      getDepartParam2: {
        name: 'findAllDepart', offset: 0, pagecount: 0,
        parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }
      },
      departNameList2: [],



      isokDisable: false,
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' },
      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: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
        { name: 'findAllProviderByCt', offset: 0, pagecount: 0, parammaps: { 'id': Cookies.get('pastureid') }},
      ],
      orderStatues: [{ id: '0', name: '待接单' }, { id: '1', name: '维修中' }, { id: '2', name: '维修完成' }],
      SHStatues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
      outsourcingList: [{ id: '0', name: '无委外' }, { id: '1', name: '确认委外维修' }, { id: '2', name: '生成委外维修' }],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()// 当天之前的时间可选
        }
      },
      rules: {
        repairDept: [{ required: true, message: '必填', trigger: 'blur' }],
        pickId: [{ required: true, message: '必填', trigger: 'blur' }],
        chargeDate: [{ required: true, message: '必填', trigger: 'blur' }],
        chargeId: [{ required: true, message: '必填', trigger: 'blur' }],
        repirsTime: [{ required: true, message: '必填', trigger: 'blur' }],
        positionId: [{ required: true, message: '必填', trigger: 'blur' }],
        repairCode: [{ required: true, message: '必填', trigger: 'blur' }],
        eqName: [{ required: true, message: '必填', trigger: 'blur' }],
        eqCode: [{ required: true, message: '必填', trigger: 'blur' }],
        deptName: [{ required: true, message: '必填', trigger: 'blur' }],
        details: [{ required: true, message: '必填', trigger: 'blur' }],
        shutdownReason: [{ required: true, message: '必填', trigger: 'blur' }],
        description: [{ required: true, message: '必填', trigger: 'blur' }],
      },
      getdataListParm: {
        name: 'getRepirsList',
        page: 1,
        offset: 1,
        pagecount: 50,
        returntype: 'Map',
        parammaps: {
          pastureName: Cookies.get('pasturename'),
          repairCode: '',
          eqName: '',
          eqCode: '',
          orderStatue: '',
          SHStatue: '',
          inputDatetime: '',
          outsourcing:'',

          loginId: Cookies.get('employeid'),
          menu: 'Repair',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid')
        }
      },


      isshengweiwaidan:[],
      isCanSubmit:false,
      total: 0,
      tableKey: 0,
      listLoading: false,
      list: [],
      dialogFormVisible_Create: false,
      createTemp: {
        pastureId: '',
        departmentId: '',
        eqId: '',
        eqCode: '',
        eqName: '',
        repairDept: '',
        details: '',
        requesterId: '',
        requestTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'),
        pickId: '',
        repairCode: '',
        deptName: '',
        eqClassId: '',
        remark:''
      },
      requestEqName: {
        name: 'geteqbyNameCode',
        page: 1,
        offset: 1,
        pagecount: '',
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },
      requestEqName2: {
        name: 'getOutsourceEqbyNameCode',
        page: 1,
        offset: 1,
        pagecount: '',
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },
      getdataListParmDetail: {
        name: 'getFaultdescription',
        parammaps: {   eqClassId: '',  }
      },
      DetailList: [],

      EqNameList: [],
      EqCodeList: [],
      getRepairNumberParm: {
        name: 'autoCreatCode',
        parammaps: {
          pastureId: Cookies.get('pastureid'),
          codeType: 'BX'
        }
      },
      radioAll: '全部',
      dialogFormVisible_See: false,
      dialogStatus: '',
      textMap: {
        create: '报修',
        see: '查看详情',
        distributeLeaflets: '派单',
        maintenanceAudit: '维修审核',
        maintenanceAudit2: '维修审核',
        repairComplete: '完成维修',
        maintenanceRequisition: '维修及领用',
        collectionSparePartsSee: '查看领用',
        collectionSparePartsCreate: '添加领用',
        ViewProgress: '查看进度', rejectRepair: '报修驳回', update: '修改报修'
      },
      activeList: [],
      active: 3,
      seeTemp: {},
      activeName: 'first',
      orderStatue1: false,
      orderStatue2: false,
      // Reason: false,
      // MaintenanceAudit: false,
      listLoadingFault: false,
      listFault: [],
      getFaultListParm: {
        name: 'getmaintainappearance',
        page: 1,
        offset: 1,
        pagecount: 50,
        returntype: 'Map',
        parammaps: {}
      },
      listLoadingCollarUse: false,
      listCollarUse: [],
      getCollarUseListParm: {
        name: 'getPartsapplybyMt',
        page: 1,
        offset: 1,
        returntype: 'Map',
        parammaps: {}
      },
      getCollarUseListParm2: {
        name: 'getPartsapplybyMt_m',
        page: 1,
        offset: 1,
        pagecount: 50,
        returntype: 'Map',
        parammaps: {}
      },
      listLoadingOldProducts: false,
      listOldProducts: [],
      getOldProductsListParm: {
        name: 'getMaintainRefuse',
        page: 1,
        offset: 1,
        pagecount: 50,
        returntype: 'Map',
        parammaps: {}
      },
      getDepartParam1: {
        name: 'findAllDepart', offset: 0, pagecount: 0,
        parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }
      },
      pastureNameList: [],
      employeNameList: [],
      departNameList1: [],
      getDepartParam2: {
        name: 'findAllDepart', offset: 0, pagecount: 0,
        parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }
      },
      departNameList2: [],
      listAddCont:[
         {providerName:"",providerId: "0",eqId: "0",contractId: "0",}
      ],
      dialogFormVisible_DistributeLeaflets: false,
      distributeLeafletsTemp: {
        repairDept: '',
        pickId: '',
        chargeId: this.$store.state.user.employeid,
        chargeDate: parseTime(new Date(), '{y}-{m}-{d}')
      },
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now()// 当天之前的时间可选
        }
      },
      receiptTemp: {},
      requestParam: {},
      maintainers: [],
      getRepirsEmpParm: {
        name: 'getRepirsEmp',
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid'),
          empid: ""
        }
      },
      examineTemp: {
        statue: 3
      },
      statueReason: false,
      dialogFormVisible_MaintenanceAudit: false,
      dialogFormVisible_RepairComplete: false,
      repairCompleteTemp: {
        isOldProducts: 0
      },
      requestOldProducts: {
        name: 'getAllPartsListWB',
        page: 1,
        offset: 1,
        pagecount: 50,
        returntype: 'Map',
        parammaps: {}
      },
      No2: false,
      listAdd: [],
      postDataPramas: {},
      maintenanceRequisitionTemp: {
        repirsTime: ''
      },
      dialogFormVisible_MaintenanceRequisition: false,
      activeName2: 'first',
      rowId: 0,
      listNewFault: [],
      newFaultTemp: {},
      appearances: [],
      positions: [],
      getPositionsParm: {
        name: 'geteqPosition',
        parammaps: {}
      },
      getAppearanceParm: {
        name: 'getAppearancebyPid',
        parammaps: {}
      },
      rapairBtn: true,
      listCollectionSpareParts: [],
      tableKey2: 1,
      listCollectionSpareParts2: [],
      collectionSparePartsSeeTemp: {
        isStock: 0
      },

      depTiDArr:[],
      pickidArr:[],
      pickNameArr:[],
      getParmCreateNumber: {
        name: 'autoCreatCode',
        page: 0,
        offset: 0,
        pagecount: 0,
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid'),
          codeType: 'WW'
        }
      },
      requestSparePart: {
        name: 'getPartsListLY_m',
        page: 1,
        offset: 1,
        pagecount: 20,
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },
      addSparePartsToBeCollectedParam: {
        name: 'getPartapply_mr',
        page: 1,
        offset: 1,
        pagecount: 20,
        returntype: 'Map',
        parammaps: {}
      },
      dialogFormVisible_CollectionSparePartsSee: false,
      listCreateCollectionSpareParts: [],
      isCreatePartDelete: false,
      isPartCode: true,
      getCollarUseSeeParm: {
        name: 'getpartapplyListBybig',
        parammaps: {}
      },
      getCollarUseSeeParm2: {
        name: 'getpartapplyListBybig_m',
        parammaps: {}
      },
      dialogFormVisible_ViewProgress: false,
      viewProgressTemp: {},
      getNumbersParm: {
        name: 'getpartApply_mstatue',
        page: 1,
        offset: 1,
        pagecount: 20,
        returntype: 'Map',
        parammaps: {}
      },
      numbersList: [],
      getPurchaseapplicationParm: {
        name: 'getpartApply_mstatueSG',
        page: 1,
        offset: 1,
        returntype: 'Map',
        parammaps: {}
      },
      purchaseapplicationList: [], // 采购情况
      getProcurementParm: {
        name: 'getpartApply_mstatueCG',
        page: 1,
        offset: 1,
        returntype: 'Map',
        parammaps: {}
      },
      procurementList: [], // 采购情况
      rejectRepair: {
        dialogFormVisible: false,
        temp: {}
      },

      costTypeList:[
        {id:'保养',name:'保养'},
        {id:'维修',name:'维修'},
        {id:'物耗',name:'物耗'},
        {id:'土建',name:'土建'},
        {id:'安全',name:'安全'},
      ],

      providerNameList:[

      ],



      // 权限按钮
      isRepair: [],
      isMaintenanceSee: [],
      isDistributeLeaflets: [],
      isReceipt: [],
      isReceipt1:[],
      isMaintenanceRequisition: [],
      isRepairComplete: [],
      isDelete: [],
      isMaintenanceAudit: [],
      isMaintenanceAudit2: [], isRejectRepair: [],
      isRepairExport:[],
      buttons: [],
      pending: {
        total: 0,
        getdataListParm: {
          name: 'getRepirsWebListNO', page: 1, offset: 1, getTotal: 'total3', pagecount: 50, returntype: 'Map',
          parammaps: {}
        }
      },
      isPercentage: false,
      percentage: 1,
      downLoadParm:{},
      downLoadList:[],
      resubmit:{},
      compateleMsg:''
    }
  },
  // computed: {
  //   ...mapGetters([
  //     'buttons'
  //   ])
  // },
  created() {
    const that = this
    GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
      that.buttons = response.data.list
      that.get_auto_buttons()
    })
  },
  methods: {
  // 关闭要做的事 todo
  handleClose(val) {
    console.log( this.dialogStatus,' this.dialogStatus')
    this.dialogStatus = ''
    if(val== 1){
      this.dialogFormVisible_See = false
    }else{
      this.dialogFormVisible_Create = false
      this.get_table_data()
    }

  },
    roleSet1(row){
      var result = true
      if(row.orderStatue == 0 && this.isReceipt ){

        if(row.pickId){
          if(row.pickId.split(',').includes(this.getdataListParm.parammaps.loginId)){
            result = true
          } else{
            result = false
          }
        } else{
            result = false
        }

      } else {
        result = false
      }


      return result

    },
    roleSet11(row){
      var result = true
      if(row.orderStatue == 1  && row.SHStatue == 1 &&  this.isReceipt1 ){

        if(row.pickId){
          if(row.pickId.split(',').includes(this.getdataListParm.parammaps.loginId)){
            result = true
          } else{
            result = false
          }
        } else{
            result = false
        }

      } else {
        result = false
      }


      return result

    },

    roleSet2(row){


      console.log("isMaintenanceRequisition",this.isMaintenanceRequisition)

      console.log("roleSet2",((row.orderStatue == 1 && row.SHStatue == 1 || row.SHStatue == 4 || row.SHStatue == 6) && this.isMaintenanceRequisition ))

      var result = true
      if((row.orderStatue == 1 && row.SHStatue == 1 || row.SHStatue == 4 || row.SHStatue == 6) && this.isMaintenanceRequisition ){

        console.log("roleSet2")

        if(row.pickId){
          if(row.pickId.split(',').includes(this.getdataListParm.parammaps.loginId)){
            result = true
          } else{
            result = false
          }
        } else{
            result = false
        }

      } else {
        result = false
      }


      return result

    },
    roleSet3(row){
      console.log("roleSet3",((row.orderStatue == 1 && (row.SHStatue == 1 || row.SHStatue == 4 || row.SHStatue == 6)) && this.isRepairComplete ))
      var result = true
      if((row.orderStatue == 1 && (row.SHStatue == 1 || row.SHStatue == 4 || row.SHStatue == 6)) && this.isRepairComplete ){

        console.log("roleSet3")

        if(row.pickId){
          if(row.pickId.split(',').includes(this.getdataListParm.parammaps.loginId)){
            result = true
          } else{
            result = false
          }
        } else{
            result = false
        }

      } else {
        result = false
      }


      return result

    },

    tableSort1(column) {
      sortChange(column, this.listOldProducts)
    },
    tableSort2(column) {
      sortChange(column, this.purchaseapplicationList)
    },
    tableSort3(column) {
      sortChange(column, this.procurementList)
    },
    get_auto_buttons() {




      const shengweiwaidan = 'shengweiwaidan'
      const isshengweiwaidan = checkButtons(this.buttons, shengweiwaidan)
      this.isshengweiwaidan = isshengweiwaidan

      // 报修
      const Repair = 'maintenance:repair:baoxiu'
      const isRepair = checkButtons(this.buttons, Repair)
      this.isRepair = isRepair
      // 派单
      const DistributeLeaflets = 'maintenance:repair:paidan'
      const isDistributeLeaflets = checkButtons(this.buttons, DistributeLeaflets)
      this.isDistributeLeaflets = isDistributeLeaflets
      // 接单
      const Receipt = 'maintenance:repair:jiedan'
      const isReceipt = checkButtons(this.buttons, Receipt)
      this.isReceipt = isReceipt

      // 委外维修
      const Receipt1 = 'maintenance:repair:weiwaiweixiu'
      const isReceipt1 = checkButtons(this.buttons, Receipt1)
      this.isReceipt1 = isReceipt1
      // 维修及领用
      const Repairlingyong = 'maintenance:repair:lingyong'
      const isMaintenanceRequisition = checkButtons(this.buttons, Repairlingyong)
      this.isMaintenanceRequisition = isMaintenanceRequisition
      // 维修完成
      const RepairComplete = 'maintenance:repair:weixiuwancheng'
      const isRepairComplete = checkButtons(this.buttons, RepairComplete)
      this.isRepairComplete = isRepairComplete
      // 删除
      const Delete = 'maintenance:repair:delete'
      const isDelete = checkButtons(this.buttons, Delete)
      this.isDelete = isDelete
      // 维修审核
      const MaintenanceAudit = 'maintenance:repair:seeMaintenanceAudit'
      const isMaintenanceAudit = checkButtons(this.buttons, MaintenanceAudit)
      this.isMaintenanceAudit = isMaintenanceAudit
      // 查看
      const See = 'maintenance:repair:see'
      const isMaintenanceSee = checkButtons(this.buttons, See)
      this.isMaintenanceSee = isMaintenanceSee
      // 主管审核
      const MaintenanceAudit2 = 'maintenance:repair:shenhe2'
      const isMaintenanceAudit2 = checkButtons(this.buttons, MaintenanceAudit2)
      this.isMaintenanceAudit2 = isMaintenanceAudit2
      // 报修驳回
      const RejectRepair = 'maintenance:repair:rejectRepair'
      const isRejectRepair = checkButtons(this.buttons, RejectRepair)
      this.isRejectRepair = isRejectRepair
      // 导出
      const RejectExport = 'maintenance:repair:rejectExport'
      const isRepairExport = checkButtons(this.buttons, RejectExport)
      this.isRepairExport = isRepairExport
      this.get_select_list()
      this.get_table_data()
      this.getPendingList()
    },
    get_select_list() {
      GetDataByNames(this.requestParams).then(response => {
        this.findAllPasture = response.data.findAllPasture.list
        this.findAllDepart = response.data.findAllDepart1.list
        this.findAllEmploye = response.data.findAllEmploye.list

        this.pastureNameList = response.data.findAllPasture.list
        console.log("牧场下拉框", this.pastureNameList)
        this.employeNameList = response.data.findAllEmploye.list
        console.log("申请人下拉框", this.employeNameList)
        this.providerNameList = response.data.findAllProviderByCt.list

        this.get_depart_list1()

      })
    },

    get_depart_list1() {
      GetDataByName(this.getDepartParam1).then(response => {
        this.departNameList1 = response.data.list
      })
    },


    change_pasture2(item) {
      this.getDepartParam2.parammaps.pastureId = item
      this.get_depart_list2()
    },

    get_depart_list2() {
      GetDataByName(this.getDepartParam2).then(response => {
        this.departNameList2 = response.data.list
      })
    },

    change_depart2(item) {
      this.createTemp.departmentName = this.departNameList2.find(obj => obj.id == item).name
    },
    changeApplicant(){
      this.$forceUpdate(); // 调用此函数方法
    },

    getPendingList() {
      this.pending.getdataListParm.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
      this.pending.getdataListParm.parammaps.repairCode = this.getdataListParm.parammaps.repairCode
      this.pending.getdataListParm.parammaps.eqName = this.getdataListParm.parammaps.eqName
      this.pending.getdataListParm.parammaps.eqCode = this.getdataListParm.parammaps.eqCode
      this.pending.getdataListParm.parammaps.SHStatue = this.getdataListParm.parammaps.SHStatue
      this.pending.getdataListParm.parammaps.inputDatetime = this.getdataListParm.parammaps.inputDatetime
      this.pending.getdataListParm.parammaps.loginId = this.getdataListParm.parammaps.loginId
      this.pending.getdataListParm.parammaps.menu = this.getdataListParm.parammaps.menu
      this.pending.getdataListParm.parammaps.logindeptId = this.getdataListParm.parammaps.logindeptId
      this.pending.getdataListParm.parammaps.loginpastureId = this.getdataListParm.parammaps.loginpastureId
      this.pending.getdataListParm.parammaps.empId = Cookies.get('employeid')
      this.pending.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
      this.pending.getdataListParm.parammaps.deptId = Cookies.get('departmentid')
      GetDataByName(this.pending.getdataListParm).then(response => {
        this.pending.total = response.data.total3
      })
    },
    get_table_data() {
      if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
        this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
        this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[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)
          this.list = response.data.list
          this.pageNum = response.data.pageNum
          this.pageSize = response.data.pageSize
        } else {
          this.list = []
        }
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 100)
      })
    },
    changeAll() {
      console.log(this.radioAll)
      if (this.radioAll === '全部') {
        this.getdataListParm.name = 'getRepirsList'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          pastureName: Cookies.get('pasturename'),
          inputDatetime: '',
          loginId: Cookies.get('employeid'),
          menu: 'Repair',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid')
        }
        this.get_table_data()
      } else if (this.radioAll === '待处理') {
        this.getdataListParm.name = 'getRepirsWebListNO'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          pastureName: this.getdataListParm.parammaps.pastureName,
          repairCode: this.getdataListParm.parammaps.repairCode,
          eqName: this.getdataListParm.parammaps.eqName,
          eqCode: this.getdataListParm.parammaps.eqCode,
          orderStatue: this.getdataListParm.parammaps.orderStatue,
          SHStatue: this.getdataListParm.parammaps.SHStatue,
          inputDatetime: this.getdataListParm.parammaps.inputDatetime,

          loginId: Cookies.get('employeid'),
          menu: 'Repair',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid'),
          empId: Cookies.get('employeid'),
          pastureId: Cookies.get('pastureid'),
          deptId: Cookies.get('departmentid')
        }
        this.get_table_data()
      } else if (this.radioAll === '已处理') {
        this.getdataListParm.name = 'getRepirsWebList'
        this.getdataListParm.offset = 1
        this.getdataListParm.parammaps = {
          pastureName: this.getdataListParm.parammaps.pastureName,
          repairCode: this.getdataListParm.parammaps.repairCode,
          eqName: this.getdataListParm.parammaps.eqName,
          eqCode: this.getdataListParm.parammaps.eqCode,
          orderStatue: this.getdataListParm.parammaps.orderStatue,
          SHStatue: this.getdataListParm.parammaps.SHStatue,
          inputDatetime: this.getdataListParm.parammaps.inputDatetime,
          loginId: Cookies.get('employeid'),
          menu: 'Repair',
          logindeptId: Cookies.get('departmentid'),
          loginpastureId: Cookies.get('pastureid'),
          empId: Cookies.get('employeid'),
          pastureId: Cookies.get('pastureid'),
          deptId: Cookies.get('departmentid')
        }
        this.get_table_data()
      }
    },
    orderStatue: function(cellValue) {
      // console.log(cellValue.isZeroStock)
      if (cellValue.orderStatue == 0) {
        return '待接单'
      } else if (cellValue.orderStatue == 1) {
        return '维修中'
      } else if (cellValue.orderStatue == 2) {
        return '维修完成'
      } else if (cellValue.orderStatue == 3) {
        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 == 5) {
        return '已通过'
      }
    },
    form_search() {
      console.log('点击了table搜索')
      this.listLoading = true
      if (this.getdataListParm.parammaps.inputDatetime === null) {
        this.getdataListParm.parammaps.inputDatetime = ''
      }
      this.getdataListParm.offset = 1
      this.get_table_data()
      this.getPendingList()
    },
    resetCreateTemp() {
      this.createTemp.pastureId = this.$store.state.user.pastureid
      this.createTemp.departmentId = this.$store.state.user.departmentid
      this.createTemp.eqId = ''
      this.createTemp.eqCode = ''
      this.createTemp.eqName = ''
      this.createTemp.repairDept = ''
      this.createTemp.details = ''
      this.createTemp.requesterId = this.$store.state.user.employeid
      this.createTemp.requestTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
      this.createTemp.pickId = ''
      this.createTemp.repairCode = ''
      this.createTemp.deptName = ''
      this.createTemp.departmentId = ''
      this.createTemp.eqClassId = ''
      this.createTemp.remark = ''
      this.pickNameArr = []
    },
    changePickId(val) {
      if (this.dialogStatus == 'create') {
        var depTiDArr = []
        this.maintainers.forEach(function(item){
           val.forEach(function(items){
            if(item.id == items){
              depTiDArr.push(item.deptid)
            }
          })
        })
        console.log(depTiDArr)

        this.createTemp.repairDept = depTiDArr[0]

         //this.createTemp.repairDept = this.maintainers.find(obj => obj.id == val).deptid


        console.log(val)
      } else {
        this.distributeLeafletsTemp.repairDept = this.maintainers.find(obj => obj.id == val).deptid
      }
    },




    add_dialog_save_cont() {
      this.isokDisable = true
      console.log(this.createTempCont,this.listAddCont, '点击保存ss')
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTempCont'].validate(valid => {
        if (valid) {
          console.log(this.listAddCont)
          if (this.createTempCont.outsourcingCode == '' || this.createTempCont.outsourcingCode == null || this.createTempCont.outsourcingCode == undefined) {
            GetDataByName(this.getParmCreateNumber).then(response => {
              this.$nextTick(() => {
                console.log('新增单号', response.data.list[0].orderCode)
                this.createTempCont.outsourcingCode = response.data.list[0].orderCode
                this.$forceUpdate()
                this.add_dialog_cont_saveSave()
              })
            })
          } else {
            this.add_dialog_cont_saveSave()
          }
        }
      })
    },


    add_dialog_cont_saveSave() {

        // for (var j = 0; j < this.listAddCont.length; j++) {
        //   console.log(this.listAddCont[j].amount)
        //   if (this.createTempCont.contract == 1){
        //     if (this.listAddCont[j].contractCode == null || this.listAddCont[j].contractCode === '') {
        //       this.$message({ type: 'warning', message: '请检查合同编号是否未填写', duration: 2000 })
        //       return false
        //     }
        //   }
        // }


        // var send_data = {
        //   "common": {  "returnmap": "0" },
        //   "data": [
        //     {
        //       "name": "addBigoutsourcing", "type": "e",
        //       "parammaps": this.createTempCont
        //     },
        //     {
        //       "name": "insertSpotList",
        //       "resultmaps": {  "list": this.listAddCont },
        //       "children": [
        //         {
        //             "name": "addOutsourcing",  "type": "e",
        //             "parammaps": {
        //               "bigId": "@addBigoutsourcing.LastInsertId",
        //               "providerId": "@insertSpotList.providerId",
        //               "amount": "@insertSpotList.amount",
        //               "eqId": "@insertSpotList.eqId",
        //               "eqCode": "@insertSpotList.eqCode",
        //               "eqName": "@insertSpotList.eqName",
        //               "typea": "@insertSpotList.typea",
        //               "date": "@insertSpotList.date",
        //               "contractId": "@insertSpotList.contractId",
        //               "providerName": "@insertSpotList.providerName",
        //               "RUCode": "@insertSpotList.RUCode",
        //               "contractCode": "@insertSpotList.contractCode"
        //               }
        //           }
        //       ]
        //     },
        //     {
        //       "name": "takeOutsourcing", "type": "e",
        //       "parammaps": {
        //         departmentId:this.createTempCont.departmentId,
        //         id:this.createTempCont.id,
        //       }
        //     },



        //     ]
        // }

        // ExecDataByConfig(send_data).then(response => {
        //   console.log('新增保存发送参数', send_data)
        //   if (response.msg === 'fail') {
        //     this.$notify({
        //       title: '保存失败',
        //       message: response.data,
        //       type: 'warning',
        //       duration: 2000
        //     })
        //   } else {
        //     this.dialogFormVisibleCont = false

        //     this.get_table_data()

        //     this.$notify({
        //       title: '',
        //       message: '保存成功',
        //       type: 'success',
        //       duration: 2000
        //     })
        //   }
        // })
        // return true
        // ========================
        for (var j = 0; j < this.listAddCont.length; j++) {
          console.log(this.listAddCont[j].amount)
          if(this.listAddCont[j].sealNumber == ''){
            this.$message({ type: 'warning', message: '铅封号不能为空', duration: 2000 })
            return false
          }
          if( !/^\d+$/.test(this.listAddCont[j].sealNumber)){
            this.$message({ type: 'warning', message: '铅封号格式不对', duration: 2000 })
            return false
          }
          if (this.listAddCont[j].amount == null || this.listAddCont[j].amount === '') {
            // this.$message({ type: 'warning', message: '请检查金额是否未填写', duration: 2000 })
            // return false
          } else {
            // var rulesAmount = /^[1-9]\d*$/
            // if (!rulesAmount.test(this.listAddCont[j].amount)) {
            //   this.$message({ type: 'error', message: '申购数量请输入正整数', duration: 2000 })
            //   return false
            // }
          }

          if (this.createTempCont.contract == 1){
            if (this.listAddCont[j].contractCode == null || this.listAddCont[j].contractCode === '') {
              this.$message({ type: 'warning', message: '请检查合同编号是否未填写', duration: 2000 })
              return false
            }
            if (this.listAddCont[j].providerName == null || this.listAddCont[j].providerName === '') {
            this.$message({ type: 'warning', message: '请检查供应商是否未填写', duration: 2000 })
            return false
            }
          }
           // 如果是无合同则金额比填写
        if (this.listAddCont[j].amount == 0 && this.createTempCont.contract == 0 ) {
            this.$message({ type: 'warning', message: '请检查: 金额 是否填写', duration: 2000} )
          return false
        }
          if (this.listAddCont[j].eqCode == null || this.listAddCont[j].eqCode === '') {
            this.$message({ type: 'warning', message: '请检查设备名称是否未填写', duration: 2000 })
            return false
          }
          if (this.listAddCont[j].eqName == null || this.listAddCont[j].eqName === '') {
            this.$message({ type: 'warning', message: '请检查设备内部编号是否未填写', duration: 2000 })
            return false
          }
          if (this.listAddCont[j].typea == null || this.listAddCont[j].typea === '') {
            this.$message({ type: 'warning', message: '请检查费用类型是否未填写', duration: 2000 })
            return false
          }

        }
        var amount = 0
        if(this.createTempCont.contract==0){
          amount = "@insertSpotList.amount"
        }else{
          amount = 0
        }
        if(this.createTempCont.contract == 0){
          // 无合同
          this.$set(this.createTempCont,'status',0)
        }else{
          // 有合同
          this.$set(this.createTempCont,'status',1)
        }
        var send_data = {
          "common": {  "returnmap": "0" },
          "data": [
            {
              "name": "addBigoutsourcing", "type": "e",
              "parammaps": this.createTempCont
            },
            {
              "name": "insertSpotList",
              "resultmaps": {  "list": this.listAddCont },

              "children": [
                {
                    "name": "addOutsourcing",  "type": "e",
                    "parammaps": {
                      "bigId": "@addBigoutsourcing.LastInsertId",
                      "providerId": "@insertSpotList.providerId",
                      "amount": amount,
                      "eqId": "@insertSpotList.eqId",
                      "eqCode": "@insertSpotList.eqCode",
                      "eqName": "@insertSpotList.eqName",
                      "typea": "@insertSpotList.typea",
                      "date": "@insertSpotList.date",
                      "contractId": "@insertSpotList.contractId",
                      "providerName": "@insertSpotList.providerName",
                      "contractCode": "@insertSpotList.contractCode",
                      "remark": "@insertSpotList.remark",
                      "status":this.createTempCont.status,
                      "sealNumber": "@insertSpotList.sealNumber",
                      "sealNumberHis" : "@insertSpotList.sealNumberHis"
                      }
                  }
              ]
              },
              {
                  "name": "takeOutsourcing", "type": "e",
                  "parammaps": {
                    departmentId:this.createTempCont.departmentId,
                    id:this.createTempCont.id,
                    outsourcing:2
                  }
                },
            ]
        }
        ExecDataByConfig(send_data).then(response => {
          console.log('新增保存发送参数', send_data)
          if (response.msg === 'fail') {
            this.$notify({
              title: '保存失败',
              message: response.data,
              type: 'warning',
              duration: 2000
            })
          } else {
            if(this.createTempCont.contract==1){
              this.add_dialog_saveSave2()
            } else {
              this.get_table_data()
            }
            this.dialogFormVisibleCont = false

            // TODO:ss
            this.$notify({
              title: '',
              message: '保存成功',
              type: 'success',
              duration: 2000
            })
          }
        })
        return true

    },
    add_dialog_saveSave2() {
      console.log(this.examineTemp,'=======contract')
      // this.examineTemp.iscontract =

        //牧场
        var mydata = {
          // acceptanceCode:this.createTemp.acceptanceCode,
          pastureId:  parseInt(Cookies.get('pastureid')),
          departmentId: parseInt(Cookies.get('departmentid')),
          applicant:Cookies.get('employeid'),
          outsourcingCode:this.createTempCont.outsourcingCode,
          applyType:0,
          date:parseTime(new Date(), '{y}-{m}-{d}'),
          status:1
        }
        if(this.examineTemp.contract == 0){
          mydata.iscontract = 1
        }else{
          mydata.iscontract = 0
        }
        var send_data = {
          "common": {  "returnmap": "0" },
          "data": [
            {
              "name": "insertBigacceptance",
              "type": "e",
              "parammaps": mydata
            }
          ]
        }
        ExecDataByConfig(send_data).then(response => {
          console.log('新增保存发送参数', send_data)
          if (response.msg === 'fail') {
            this.$notify({
              title: '保存失败',
              message: response.data,
              type: 'warning',
              duration: 2000
            })
          } else {
            this.get_table_data()
          }
        })


    },

    change_contract(val) {
      console.log(val)
      // if(val == 1){
      //   this.createTempCont.contract = 1
      // } else {
      //   this.createTempCont.contract = 0
      // }

      this.$forceUpdate()

    },

    form_add_cont_sure(row) {
      console.log('点击了是否确认委外维修？',row)
      MessageBox.confirm('是否确认委外维修？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var send_data = {
        "common": { "returnmap": "0" },
        "data": [
          {
            "name": "editMaintainoutsourcing", "type": "e",
            "parammaps": { "outsourcing": 1, "id":row.id }
           },
           {
             "name": "takeOutsourcing", "type": "e",
             "parammaps": {
               departmentId:this.createTempCont.departmentId,
               id:row.id,
               outsourcing:1
             }
           }
          ]
        }

        ExecDataByConfig(send_data).then(response => {
          this.get_table_data()
          this.$notify({
            title: '成功',
            message: '成功',
            type: 'success',
            duration: 2000
          })
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        })
      })
    },



    form_add_cont(row) {
      console.log(row,'当前信息===hss');
      this.createTempCont = Object.assign({}, row)
      console.log(this.createTempCont.description)
      if(this.createTempCont.description == undefined || this.createTempCont.description == null){
        this.$set(this.createTempCont,'description','')
      }
      console.log(this.createTempCont.description,'====')
      this.reset_create_cont()
      // 初始化填型号+输出号
      this.listAddCont = [{providerName:"",providerId: "0",eqId: row.eqId,contractId: "0",amount:"",contractCode:"",date:"",eqCode:row.eqCode, eqName:row.eqName,sealNumberHis:'', remark:"",typea:"",sealNumber:''}]

      this.getDepartParam2.parammaps.pastureId = this.createTempCont.pastureId
      this.get_depart_list2()
      this.createTempCont.RUCode = row.repairCode

     // 获取设备编号的下拉列表
      this.requestEqName2.parammaps['eqCode'] = row.eqCode;
      GetDataByName(this.requestEqName2).then(response => {
        this.EqNameList = response.data.list
        console.log(this.EqNameList ,'this.EqNameList ')
        this.listAddCont[0].sealNumberHis = this.EqNameList[0].sealNumberHis;

        this.dialogFormVisibleCont = true
        this.listLoading = false
      })
      this.$nextTick(() => {
        this.$refs['createTempCont'].clearValidate()
      })



       //新增生成单号
      this.get_create_num()
    },


    get_create_num() {
      GetDataByName(this.getParmCreateNumber).then(response => {
        this.$nextTick(() => {
          console.log('新增单号', response.data.list[0].orderCode)
          this.createTempCont.outsourcingCode = response.data.list[0].orderCode
          this.$forceUpdate()
        })
      })
    },

    reset_create_cont() {

      this.createTempCont.pastureId =  parseInt(Cookies.get('pastureid'))
     this.createTempCont.departmentId = parseInt(Cookies.get('departmentid'))


     if(parseInt(Cookies.get('pastureid')) == 18){
      this.createTempCont.departmentId = ""
     }
     this.createTempCont.departmentName = Cookies.get('departmentname')
      this.createTempCont.employeId = parseInt(Cookies.get('employeid'))
      this.createTempCont.date = parseTime(new Date(), '{y}-{m}-{d}')

      this.createTempCont.outsourcingCode = ''
      this.createTempCont.applicant = parseInt(Cookies.get('employeid'))
      this.createTempCont.providerId = ''
      this.createTempCont.contract = 1

      this.createTempCont.repairCode = ""

      this.createTempCont.description = ''




      // this.listAddCont = [{providerName:"",providerId: "0",eqId: "0",contractId: "0",amount:"",contractCode:"",date:"",eqCode:"",eqName:"",remark:"",typea:"",}]

    },

    change_pasture2(item) {
      this.getDepartParam2.parammaps.pastureId = item
      this.get_depart_list2()
    },

    get_depart_list2() {
      GetDataByName(this.getDepartParam2).then(response => {
        this.departNameList2 = response.data.list
      })
    },

    change_depart2(item) {
      this.createTemp.departmentName = this.departNameList2.find(obj => obj.id == item).name
    },




    form_add() {
      this.dialogStatus = 'create'
      this.dialogFormVisible_Create = true

      this.resetCreateTemp()
      this.getRepairNumber()
      //this.getRepirsEmp()
    },
    isToDayrResubmit(){
      //一天同一牧场同一设备同一故障是否重复提交

      this.resubmit.name = 'checkMaintain'
      this.resubmit.parammaps = {
        pastureId : this.createTemp.pastureId,
        eqId : this.createTemp.eqId,
        eqName : this.createTemp.eqName,
        eqCode : this.createTemp.eqCode,
        details : this.createTemp.details,
        remark : this.createTemp.remark,
        requestTime : parseTime(new Date(), '{y}-{m}-{d}')
      }

    },
    getRepairNumber() {
      GetDataByName(this.getRepairNumberParm).then(response => {
        this.$nextTick(() => {
          console.log('新增报修单号', response.data.list[0].orderCode)
          this.createTemp.repairCode = response.data.list[0].orderCode
          this.$forceUpdate()
        })
      })
    },
    add_dialog_save() {
      this.isToDayrResubmit()
      GetDataByName(this.resubmit).then(response => {
        console.log('该设备已报修未完成修复，请勿重复提交', this.requestParam,this.resubmit,response)
        if (response.msg !== 'fail') {
          if(response.data.total > 0){
            this.$notify({ title: '提交失败', message: '该设备已报修未完成修复', type: 'warning', duration: 2000 })
            this.isCanSubmit = false
            return false
          }
          this.isCanSubmit = true
          // 可以提交
          this.isokDisable = true
          setTimeout(() => {
            this.isokDisable = false
          }, 1000)
          this.$refs['createTemp'].validate(valid => {
            if (valid) {
              if (this.createTemp.repairCode == '' || this.createTemp.repairCode == null || this.createTemp.repairCode == undefined) {
                GetDataByName(this.getRepairNumberParm).then(response => {
                  this.$nextTick(() => {
                    console.log('新增报修单号', response.data.list[0].orderCode)
                    this.createTemp.repairCode = response.data.list[0].orderCode
                    this.$forceUpdate()
                    this.add_dialog_saveSave()
                  })
                })
              } else {
                this.add_dialog_saveSave()
              }
            }
          })
        }else{
          this.$notify({ title: '请检查接口', message: "name: checkMaintain", type: 'warning', duration: 2000 })
        }
      })
    },
    add_dialog_saveSave() {
      this.requestParam.name = 'insertmaintain'
      this.requestParam.parammaps = JSON.parse(JSON.stringify(this.createTemp));

      var detailString = this.requestParam.parammaps.details.toString()

      this.requestParam.parammaps.details = detailString

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

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

      PostDataByName(this.requestParam).then(response => {
        console.log('新增保存发送参数', this.requestParam)
        if (response.msg !== 'fail') {
          this.get_table_data()
          this.getPendingList()
          this.dialogFormVisible_Create = false
          this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
        } else {
          failproccess(response, this.$notify)
        }
      })
    },
    querySearchEqName(queryString, cb) {
      console.log('备件名称/设备内部编号模糊查询输入值', queryString)
      this.requestEqName.parammaps['eqName'] = queryString
      GetDataByName(this.requestEqName).then(response => {
        if (response.data.list !== null) {
          console.log('备件名称模糊查询搜索data', response.data.list)
          this.EqNameList = response.data.list
        } else {
          this.EqNameList = []
        }
        cb(this.EqNameList)
      })
    },
    handleSelectEqName(item) {
      console.log('备件名称/设备内部编号模糊查询选中值', item)
      this.$set(this.createTemp, 'eqCode', item.eqCode)
      this.$set(this.createTemp, 'eqId', item.eqId)
      // this.$set(this.createTemp, 'sealNumberHis', item.sealNumberHis)
      this.$set(this.createTemp, 'eqClassId', item.eqClassId)
      this.$set(this.createTemp, 'pickId', '')
      if (item.deptName !== undefined && item.departmentId !== undefined) {
        this.$set(this.createTemp, 'deptName', item.deptName)
        this.$set(this.createTemp, 'departmentId', item.departmentId)
      } else {
        this.$set(this.createTemp, 'deptName', '')
        this.$set(this.createTemp, 'departmentId', '')
      }

      this.getdataListParmDetail.parammaps.eqClassId = item.eqClassId
      this.getDetail()

      this.getRepirsEmpParm.parammaps.empid = item.maintenance
      this.getRepirsEmp()

      this.$forceUpdate()
    },
    querySearchCode(queryString, cb) {
      console.log('备件名称/设备内部编号模糊查询输入值', queryString)
      this.requestEqName.parammaps['eqCode'] = queryString
      GetDataByName(this.requestEqName).then(response => {
        if (response.data.list !== null) {
          console.log('备件名称模糊查询搜索data', response.data.list)
          this.EqNameList = response.data.list
        } else {
          this.EqNameList = []
        }
        cb(this.EqNameList)
      })
    },
    handleSelectEqCode(item, row) {
      console.log('备件名称/设备内部编号模糊查询选中值', item)
      console.log('备件名称/设备内部编号模糊查询选中值所在行', row)
      this.$set(this.createTemp, 'eqName', item.eqName)
      this.$set(this.createTemp, 'eqId', item.eqId)
      this.$set(this.createTemp, 'eqClassId', item.eqClassId)
      this.$set(this.createTemp, 'pickId', '')
      this.$set(this.createTemp, 'sealNumberHis', item.sealNumberHis)
      if (item.deptName !== undefined && item.departmentId !== undefined) {
        this.$set(this.createTemp, 'deptName', item.deptName)
        this.$set(this.createTemp, 'departmentId', item.departmentId)
      } else {
        this.$set(this.createTemp, 'deptName', '')
        this.$set(this.createTemp, 'departmentId', '')
      }




      this.getdataListParmDetail.parammaps.eqClassId = item.eqClassId
      this.getDetail()
      this.$forceUpdate()

      this.getRepirsEmpParm.parammaps.empid = item.maintenance
      this.getRepirsEmp()
    },

    getDetail(){
      GetDataByName(this.getdataListParmDetail).then(response => {
        if (response.data.list !== null) {
          console.log('DetailList数据', response.data.list)
          this.DetailList = response.data.list
        } else {
          this.DetailList = []
        }
      })
    },
    changeDetails(e){
      console.log(e)
    },
    form_see(row) {
      console.log(row)
      this.seeTemp = Object.assign({}, row)
      // 流程图
      var reason = '未通过原因:' + this.seeTemp.workflowNote
      var scores = '评分:' + this.seeTemp.scores + '分'
      if (this.seeTemp.orderStatue === 0) {
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单' }, { title: '完成维修' }, { title: '使用人审核' }, { title: '设备主管审核' }]
        this.active = 1
      } else if (this.seeTemp.orderStatue == 3) {
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '报修驳回', date: this.seeTemp.shutdownDate, name: this.seeTemp.shutdownPerson }]
        this.active = 1
      } else if (this.seeTemp.orderStatue === 1 && this.seeTemp.SHStatue === 1) {
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修' }, { title: '使用人审核' }, { title: '设备主管审核' }]
        this.active = 2
      } else if (this.seeTemp.SHStatue === 2) {
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修', date: this.seeTemp.stopTime, name: this.seeTemp.pickName }, { title: '使用人审核' }, { title: '设备主管审核' }]
        this.active = 3
      } else if (this.seeTemp.SHStatue === 3) {
        this.active = 4
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修', date: this.seeTemp.stopTime, name: this.seeTemp.pickName }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, scores: scores }, { title: '设备主管审核' }]
      } else if (this.seeTemp.SHStatue === 4) {
        this.active = 4
        // var reason = '未通过原因:' + this.seeTemp.workflowNote
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修', date: this.seeTemp.stopTime, name: this.seeTemp.pickName }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, status: 'error', reason: reason }, { title: '设备主管审核' }]
      } else if (this.seeTemp.SHStatue === 5) {
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修', date: this.seeTemp.stopTime, name: this.seeTemp.pickName }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, scores: scores }, { title: '设备主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
        this.active = 5
      } else if (this.seeTemp.SHStatue === 6) {
        // var reason = '未通过原因:' + this.seeTemp.workflowNote
        this.activeList = [{ title: '报修', date: this.seeTemp.requestTime, name: this.seeTemp.requesterName }, { title: '维修接单', date: this.seeTemp.orderTime, name: this.seeTemp.pickName }, { title: '完成维修', date: this.seeTemp.stopTime, name: this.seeTemp.pickName }, { title: '使用人审核', date: this.seeTemp.useChargeDate, name: this.seeTemp.useChargePerson, scores: scores }, { title: '设备主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
        this.active = 5
      }
      this.seeTemp.requestTime = parseTime(this.seeTemp.requestTime, '{y}-{m}-{d}')
      this.seeTemp.shutdownDate = parseTime(this.seeTemp.shutdownDate, '{y}-{m}-{d}')
      this.seeTemp.orderTime = parseTime(this.seeTemp.orderTime, '{y}-{m}-{d}')
      this.dialogStatus = 'see'
      this.dialogFormVisible_See = true
      if (row.orderStatue == 0) {
        this.orderStatue1 = true
        this.orderStatue2 = false
      } else if (row.orderStatue == 3) {
        this.orderStatue1 = true
        this.orderStatue2 = false
      } else {
        this.orderStatue1 = false
        this.orderStatue2 = true
        this.getFaultList()
        this.getOldProductsList()
        this.getCollarUseList()
      }
    },
    resetDistributeLeafletsTemp() {
      this.distributeLeafletsTemp.repairDept = ''
      this.distributeLeafletsTemp.pickId = ''
      this.distributeLeafletsTemp.chargeDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.distributeLeafletsTemp.chargeId = this.$store.state.user.employeid
    },
    // 派单
    handleDistributeLeaflets(row) {
      if (row == undefined) {
        this.distributeLeafletsTemp = this.seeTemp
      } else {
        this.distributeLeafletsTemp = Object.assign({}, row)
      }
      console.log('点击了派单')
      this.dialogStatus = 'distributeLeaflets'
      this.dialogFormVisible_DistributeLeaflets = true
      this.resetDistributeLeafletsTemp()
      this.getRepirsEmpParm.parammaps.empid = ""
      this.getRepirsEmp()
    },
    changeMaintenanceTeam(val) {
      console.log(val)
      this.getRepirsEmpParm.parammaps.deptid = val
      this.createTemp.pickId = ''
      this.distributeLeafletsTemp.pickId = ''
      this.getRepirsEmpParm.parammaps.empid = ""
      this.getRepirsEmp()
    },
    getRepirsEmp() {
      var _this = this
      GetDataByName(this.getRepirsEmpParm).then(response => {
        console.log('维修人数据', response.data.list)
        _this.maintainers = response.data.list
        var pickNameArr = []
        var pickidArr = []
        var depTiDArr = []
        _this.maintainers.forEach(function(item){

          pickNameArr.push(item.empNameAndmt)
           pickidArr.push(item.id)
           depTiDArr.push(item.deptid)

        })



        _this.pickNameArr = pickNameArr
        _this.pickidArr = pickidArr
        _this.depTiDArr = depTiDArr

        _this.createTemp.pickId = pickidArr

        _this.createTemp.repairDept =  depTiDArr[0]

        console.log(pickNameArr,pickidArr,depTiDArr)

      })
    },
    // 派单-保存
    createDistributeLeafletsData() {
      console.log('点击了派单确认')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['distributeLeafletsTemp'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'setRepirsEmp'
          this.requestParam.parammaps = this.distributeLeafletsTemp
          this.requestParam.parammaps.id = this.distributeLeafletsTemp.id
          PostDataByName(this.requestParam).then(response => {
            console.log('派单确认发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              this.listLoading = true
              this.get_table_data()
              this.dialogFormVisible_DistributeLeaflets = false
              this.dialogFormVisible_See = false
              this.getPendingList()
              this.$notify({ title: '成功', message: '派单成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    getFaultList() {
      this.listLoadingFault = true
      if (this.dialogStatus == 'repairComplete') {
        this.getFaultListParm.parammaps.maintainId = this.repairCompleteTemp.id
      } else {
        this.getFaultListParm.parammaps.maintainId = this.seeTemp.id
      }
      GetDataByName(this.getFaultListParm).then(response => {
        if (response.data.list !== null) {
          console.log('故障table数据', response.data.list)
          this.listFault = response.data.list
        } else {
          this.listFault = []
        }
        setTimeout(() => {
          this.listLoadingFault = false
        }, 100)
      })
    },
    getCollarUseList() {
      this.listLoadingCollarUse = true
      this.getCollarUseListParm.parammaps.RUCode = this.seeTemp.repairCode
      GetDataByName(this.getCollarUseListParm).then(response => {
        console.log('领用记录table数据', response.data.list)
        this.listCollarUse = response.data.list
        setTimeout(() => {
          this.listLoadingCollarUse = false
        }, 100)
      })
    },
    statue: function(cellValue) {
      // console.log(cellValue.isZeroStock)
      if (cellValue.statue == 0) {
        return '未领用'
      } else if (cellValue.statue == 1) {
        return '已领用'
      }
    },
    getOldProductsList() {
      this.listLoadingOldProducts = true
      this.getOldProductsListParm.parammaps.repairCode = this.seeTemp.repairCode
      GetDataByName(this.getOldProductsListParm).then(response => {
        console.log('旧品录入记录table数据', response.data.list)
        this.listOldProducts = response.data.list
        setTimeout(() => {
          this.listLoadingOldProducts = false
        }, 100)
      })
    },
    // 维修及审核
    handleExamine(row) {
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'statue', 3)
        this.$set(this.seeTemp, 'workflowNote', '')
        this.$set(this.seeTemp, 'scores', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'statue', 3)
        this.$set(this.examineTemp, 'workflowNote', '')
        this.$set(this.examineTemp, 'scores', '')
      }
      console.log('点击了维修审核')
      this.dialogStatus = 'maintenanceAudit'
      this.dialogFormVisible_MaintenanceAudit = true
    },
    changeStatue(val) {
      if (val == 4) {
        this.statueReason = true
      } else {
        this.statueReason = false
      }
    },
    // 维修审核-保存
    createExamineData() {
      console.log('点击了维修审核确认123')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['examineTemp'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'maintainCharge'
          this.requestParam.parammaps = {}
          this.requestParam.parammaps.id = this.examineTemp.id
          this.requestParam.parammaps.statue = this.examineTemp.statue
          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.get_table_data()
              this.getPendingList()
              this.dialogFormVisible_MaintenanceAudit = false
              this.dialogFormVisible_See = false
              this.statueReason = false
              this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    // 维修审核2
    handleExamine2(row) {
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'statue', 3)
        this.$set(this.seeTemp, 'workflowNote', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'statue', 3)
        this.$set(this.examineTemp, 'workflowNote', '')
      }
      console.log('点击了维修审核')
      this.dialogStatus = 'maintenanceAudit2'
      this.dialogFormVisible_MaintenanceAudit = true
    },
    // 维修审核2-保养form_add_cont
    createExamineData2() {
      if (this.examineTemp.statue == 3) {
        console.log('点击了维修审核确认-通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'maintainChargDone'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            this.requestParam.parammaps.statue = 5
            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.get_table_data()
                this.getPendingList()
                this.dialogFormVisible_MaintenanceAudit = false
                this.dialogFormVisible_See = false
                this.statueReason = false
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      } else {
        console.log('点击了维修审核确认-未通过')
        this.isokDisable = true
        setTimeout(() => {
          this.isokDisable = false
        }, 1000)
        this.$refs['examineTemp'].validate(valid => {
          if (valid) {
            this.requestParam.name = 'maintainCharge1'
            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.get_table_data()
                this.getPendingList()
                this.dialogFormVisible_MaintenanceAudit = false
                this.dialogFormVisible_See = false
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        })
      }
    },
    // 接单
    handleReceipt(row) {
      if (row == undefined) {
        this.receiptTemp = this.seeTemp
      } else {
        this.receiptTemp = Object.assign({}, row)
      }
      MessageBox.confirm('是否确认接单', {
        title: '接单',
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.requestParam.name = 'takeRepirsEmp'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps.id = this.receiptTemp.id
        this.requestParam.parammaps.empid =  Cookies.get('employeid')
        PostDataByName(this.requestParam).then((response) => {
          if (response.msg !== 'fail') {
            this.get_table_data()
            this.getPendingList()
            this.dialogFormVisible_See = false
            this.$notify({ title: '成功', message: '接单成功', type: 'success', duration: 2000 })
          } else {
            failproccess(response, this.$notify)
          }
        })
      })
    },

    // TODO:
    // 点击完成之前需要去查下 当前报修单号下的委外维修订单状态是否已 验收-审核通过状态
    // 审核通知-可以完成维修
    // 反之 -提示:当前订单无法完成维修
    handleRepairComplete(row){

      if (row == undefined) {
        this.$set(this.seeTemp, 'isOldProducts', 0)
        this.repairCompleteTemp = this.seeTemp
      } else {
        this.repairCompleteTemp = Object.assign({}, row)
        this.$set(this.repairCompleteTemp, 'isOldProducts', 0)
      }
      console.log('完成维修',this.repairCompleteTemp)
      const requestBody = {
        "name": "checkOutsourcingStatus",
        "parammaps":{  "code": this.repairCompleteTemp.repairCode  }
      }
      GetDataByName(requestBody).then(response => {
        console.log('维修进度查询--1', response.data.list[0].vmsg)
        if (this.repairCompleteTemp.outsourcing != 0 && response.data.list != null && response.data.list[0].vmsg != '' ) {
          this.compateleMsg = response.data.list[0].vmsg;
          this.$alert(this.compateleMsg, '维修进度通知', {
          confirmButtonText: '确定',
            callback: action => {
              this.$message({
                type: 'info',
                message: '已关闭'
              });
              console.log('取消完成维修')
            }
          })
        } else {
          console.log('无委外|委外维修进度完成--2', )
          this.compateleMsg =  '';
          this.No2 = false
          this.dialogStatus = 'repairComplete'
          this.dialogFormVisible_RepairComplete = true
          this.getFaultList()
          var send_data2 = {
            "name": "getpartapplyListBybig",
            "parammaps":{  "RUCode": this.repairCompleteTemp.repairCode }
          }
          GetDataByName(send_data2).then(response => {
            if (response.data.list !== null) {
              this.listAdd = response.data.list
            } else {
              this.listAdd = []
            }
            setTimeout(() => {
              this.listLoading = false
            }, 100)
          })

        //
        }
      })

    },
    // 完成维修
    // handleRepairComplete(row) {

    //     if (row == undefined) {
    //       this.$set(this.seeTemp, 'isOldProducts', 0)
    //       this.repairCompleteTemp = this.seeTemp
    //     } else {
    //       this.repairCompleteTemp = Object.assign({}, row)
    //       this.$set(this.repairCompleteTemp, 'isOldProducts', 0)
    //     }
    //     this.No2 = false
    //     this.dialogStatus = 'repairComplete'
    //     this.dialogFormVisible_RepairComplete = true
    //     this.getFaultList()

    //     var send_data2 = {
    //       "name": "getpartapplyListBybig",
    //       "parammaps":{  "RUCode": row.repairCode }
    //     }
    //     GetDataByName(send_data2).then(response => {
    //       console.log('自动带出旧品内容数据', response.data.list)
    //       if (response.data.list !== null) {
    //         this.listAdd = response.data.list
    //       } else {
    //         this.listAdd = []
    //       }
    //       setTimeout(() => {
    //         this.listLoading = false
    //       }, 100)
    //     })

    //   },
    changeIsOldProducts(val) {
      console.log(val)
      if (val == 1) {
        this.No2 = true
        //旧品录入
      } else {
        this.No2 = false
      }
    },


    querySearchEqNameCont(queryString, cb) {
      console.log('备件名称/设备内部编号模糊查询输入值', queryString)
      this.requestEqName2.parammaps['eqName'] = queryString
      GetDataByName(this.requestEqName2).then(response => {
        console.log('备件名称模糊查询搜索data', response.data.list)
        this.EqNameList = response.data.list
        cb(this.EqNameList)
      })
    },
    handleSelectEqNameCont(item, row) {
      console.log('备件名称/设备内部编号模糊查询选中值', item.eqName)
      console.log('备件名称/设备内部编号模糊查询选中值所在行', row)
      this.$set(row, 'eqCode', item.eqCode)
      this.$set(row, 'sealNumberHis', item.sealNumberHis)
      this.$forceUpdate()
    },
    querySearchCodeCont(queryString, cb) {
      console.log('备件名称/设备内部编号模糊查询输入值', queryString)
      this.requestEqName2.parammaps['eqCode'] = queryString
      GetDataByName(this.requestEqName2).then(response => {
        console.log('备件名称模糊查询搜索data', response.data.list)
        this.EqNameList = response.data.list
        cb(this.EqNameList)
      })
    },
    handleSelectEqCodeCont(item, row) {
      console.log('备件名称/设备内部编号模糊查询选中值', item)
      console.log('备件名称/设备内部编号模糊查询选中值所在行', row)
      this.$set(row, 'eqName', item.eqName)
      this.$set(row, 'sealNumberHis', item.sealNumberHis)
      this.$forceUpdate()
    },
    blurSelectEqNameCont(item, row) {
      this.$set(row, 'eqName', '')
      this.$set(row, 'eqCode', '')
    },
    blurSelectEqCodeCont(item, row) {
      this.$set(row, 'eqName', '')
      this.$set(row, 'eqCode', '')
    },





    // 完成维修保存
    createRepairCompleteData() {
      console.log('点击了完成维修确认')
      if (this.listFault.length > 0) {
        if (this.repairCompleteTemp.laidcou == 0) {
          if (this.repairCompleteTemp.isOldProducts == 0) {
            console.log('否')
            this.requestParam.name = 'completeRepirs'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.repairCompleteTemp.id
            this.requestParam.parammaps.empId = Cookies.get('employeid')
            PostDataByName(this.requestParam).then((response) => {
              if (response.msg !== 'fail') {
                this.get_table_data()
                this.getPendingList()
                this.dialogFormVisible_RepairComplete = false
                this.dialogFormVisible_See = false
                this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          } else {
            console.log('是')
            this.isokDisable = true
            setTimeout(() => {
              this.isokDisable = false
            }, 1000)
            this.$refs['repairCompleteTemp'].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 if(this.listAdd[i].acturalAmount > this.listAdd[i].amount){

                      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: this.repairCompleteTemp.pastureId,
                    deptId: this.repairCompleteTemp.departmentId,
                    partCode: '@insertSpotList.partCode',
                    partName: '@insertSpotList.partName',
                    partId: '@insertSpotList.id',
                    specification: '@insertSpotList.specification',
                    unit: '@insertSpotList.unit',
                    acturalAmount: '@insertSpotList.acturalAmount',
                    eqId: this.repairCompleteTemp.eqId,
                    eqCode: this.repairCompleteTemp.eqCode,
                    eqName: this.repairCompleteTemp.eqName,
                    repairCode: this.repairCompleteTemp.repairCode,
                    listType: 0
                  }}
                  this.postDataPramas.data[1] = { 'name': 'completeRepirs', 'type': 'e', 'parammaps': {
                    id: this.repairCompleteTemp.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.listAdd = []
                      this.dialogFormVisible_RepairComplete = false
                      this.dialogFormVisible_See = false
                      this.get_table_data()
                      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 })
        }
      } else {
        this.$message({ type: 'warning', message: '请完善故障信息！' })
      }
    },
    oldProductsSearch(queryString, cb) {
      console.log('旧品录入模糊查询输入值', queryString)
      this.requestOldProducts.parammaps['partCode'] = queryString
      this.requestOldProducts.parammaps['RUCode'] = this.repairCompleteTemp.repairCode
      GetDataByName(this.requestOldProducts).then(response => {
        console.log('旧品录入模糊查询搜索data', response.data.list)
        cb(response.data.list)
      })
    },
    handleSelectOldProducts(item) {
      this.repairCompleteTemp.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)
      }
    },
    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
          }
        }
      })
    },
    // 维修及领用
    handleMaintenanceRequisition(row) {
      console.log('点击了维修及领用')
      if (row == undefined) {
        this.maintenanceRequisitionTemp = this.seeTemp
        this.$set(this.maintenanceRequisitionTemp, 'repirsTime', parseTime(new Date(), '{y}-{m}-{d}'))
      } else {
        this.maintenanceRequisitionTemp = Object.assign({}, row)
        this.$set(this.maintenanceRequisitionTemp, 'repirsTime', parseTime(new Date(), '{y}-{m}-{d}'))
      }
      this.dialogStatus = 'maintenanceRequisition'
      this.dialogFormVisible_MaintenanceRequisition = true
      this.getNewFaultList()
      this.getPosition()
      this.getCollectionSpareParts()
      this.getCollectionSpareParts2()
    },
    getNewFaultList() {
      this.listLoadingFault = true
      this.getFaultListParm.parammaps.maintainId = this.maintenanceRequisitionTemp.id
      GetDataByName(this.getFaultListParm).then(response => {
        console.log('故障table数据', response.data.list)
        if (response.data.list !== null) {
          this.listNewFault = response.data.list
        } else {
          this.listNewFault = []
        }
        setTimeout(() => {
          this.listLoadingFault = false
        }, 100)
      })
    },
    getNewCollarUseList() {
      this.listLoadingCollarUse = true
      this.getCollarUseListParm.parammaps.RUCode = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.getCollarUseListParm).then(response => {
        console.log('领用记录table数据', response.data.list)
        this.listCollarUse = response.data.list
        setTimeout(() => {
          this.listLoadingCollarUse = false
        }, 100)
      })
    },
    tabMaintenance(tab, event) {
      console.log(tab.name)
      if (tab.name == 'first') {
        this.rapairBtn = true
      } else {
        this.rapairBtn = false
      }
    },
    getPosition() {
      this.getPositionsParm.parammaps.eqId = this.maintenanceRequisitionTemp.eqId
      GetDataByName(this.getPositionsParm).then(response => {
        console.log('故障部位数据', response.data.list)
        this.positions = response.data.list
      })
    },
    changePosition(val) {
      console.log('故障部位输入值', val)
      console.log(this.positions.find(obj => obj.id == val).positionName)
      this.newFaultTemp.positionName = this.positions.find(obj => obj.id == val).positionName
      this.getAppearanceParm.parammaps.id = val
      this.getAppearance()
    },
    getAppearance() {
      GetDataByName(this.getAppearanceParm).then(response => {
        console.log('故障详情数据', response.data.list)
        this.appearances = response.data.list
      })
    },
    changeAppearance(val) {
      console.log('故障详情输入值', val)
      if (this.newFaultTemp.positionId == '') {
        this.$message({
          type: 'warning',
          message: '请选择故障部位'
        })
      }
      if (this.listNewFault == null) {
        this.listNewFault = []
        this.listNewFault.push({ 'rowId': this.rowId++, positionId: this.newFaultTemp.positionId, positionName: this.newFaultTemp.positionName, appearanceName: val, failureCause: this.newFaultTemp.failureCause, treatmentMethod: this.newFaultTemp.treatmentMethod })
        this.newFaultTemp = {}
        this.appearances = []
      } else {
        this.listNewFault.push({ 'rowId': this.rowId++, positionId: this.newFaultTemp.positionId, positionName: this.newFaultTemp.positionName, appearanceName: val, failureCause: this.newFaultTemp.failureCause, treatmentMethod: this.newFaultTemp.treatmentMethod })
        this.newFaultTemp = {}
        this.appearances = []
      }
    },
    newFaultDelete(row) {
      console.log(row)
      MessageBox.confirm('确认删除？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        for (var i = 0; i < this.listNewFault.length; i++) {
          console.log(this.listNewFault[i])
          if (this.listNewFault[i].rowId === row.rowId) {
            var listNewFaultIndex = this.listNewFault.indexOf(this.listNewFault[i])
          }
          if (listNewFaultIndex > -1) {
            this.listNewFault.splice(listNewFaultIndex, 1)
            return
          }
        }
      })
    },
    // 维修及领用-维修确认
    createMaintenanceRequisitionteData() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['maintenanceRequisitionTemp'].validate(valid => {
        if (valid) {
          console.log(this.newFaultTemp.positionId)
          if (this.listNewFault.length == 0) {
            this.$notify({ title: '', message: '请输入故障诊断', type: 'warning', duration: 2000 })
            return false
          } else {
            for (let i = 0; i < this.listNewFault.length; i++) {
              if (this.listNewFault[i].failureCause == '' || this.listNewFault[i].failureCause == undefined) {
                this.$notify({ title: '', message: '请输入故障原因', type: 'warning', duration: 2000 })
                return false
              }
            }
          }
          if (this.listNewFault.length !== 0) {
            this.postDataPramas.common = { 'returnmap': '0' }
            this.postDataPramas.data = []
            this.postDataPramas.data[0] = { 'name': 'deleteMaintainAppearance', 'type': 'e', 'parammaps': {
              maintainId: this.maintenanceRequisitionTemp.id
            }}
            this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listNewFault }}
            this.postDataPramas.data[1].children = []
            this.postDataPramas.data[1].children[0] = { 'name': 'insertMaintainAppearance', 'type': 'e', 'parammaps': {
              appearanceName: '@insertSpotList.appearanceName',
              positionId: '@insertSpotList.positionId',
              positionName: '@insertSpotList.positionName',
              repirsTime: this.maintenanceRequisitionTemp.repirsTime,
              maintainId: this.maintenanceRequisitionTemp.id,
              failureCause: '@insertSpotList.failureCause',
              treatmentMethod: '@insertSpotList.treatmentMethod'
            }}
            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.get_table_data()
                this.getPendingList()
                this.dialogFormVisible_MaintenanceRequisition = false
                this.dialogFormVisible_See = false
                this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
              }
            })
          } else {
            this.$notify({ title: '', message: '请选择故障', type: 'warning', duration: 2000 })
            return false
          }
        }
      })
    },
    getCollectionSpareParts() {
      this.getCollarUseListParm.parammaps.RUCode = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.getCollarUseListParm).then(response => {
        console.log('备件领用table数据', response.data.list)
        this.listCollectionSpareParts = response.data.list
      })
    },
    getCollectionSpareParts2() {
      this.getCollarUseListParm2.parammaps.RUCode = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.getCollarUseListParm2).then(response => {
        console.log('备件领用无库存table数据', response.data.list)
        this.listCollectionSpareParts2 = response.data.list
      })
    },
    openDetails(row, column, cell, event) {
      if (column.label !== '操作') {
        this.$router.push({ path: '/customs/Receive', query: { applyCode: row.applyCode }})
      }
    },
    handleCollarUseSee(row, isStock) {
      this.collectionSparePartsSeeTemp = Object.assign({}, row)
      this.dialogStatus = 'collectionSparePartsSee'
      this.dialogFormVisible_CollectionSparePartsSee = true
      this.isCreatePartDelete = false
      this.isPartCode = false
      if (isStock == 0) {
        this.collectionSparePartsSeeTemp.isStock = 0
        this.getCollarUseSeeList()
      } else if (isStock == 1) {
        this.collectionSparePartsSeeTemp.isStock = 1
        this.getCollarUseSeeList2()
      }
    },
    getCollarUseSeeList() {
      this.getCollarUseSeeParm.parammaps.id = this.collectionSparePartsSeeTemp.id
      GetDataByName(this.getCollarUseSeeParm).then(response => {
        this.listCreateCollectionSpareParts = response.data.list
      })
    },
    getCollarUseSeeList2() {
      // console.log(this.collectionSparePartsSeeTemp)
      this.getCollarUseSeeParm2.parammaps.bigId = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.getCollarUseSeeParm2).then(response => {
        this.listCreateCollectionSpareParts = response.data.list
      })
    },
    handleCollectionSparePartsCreate() {
      this.collectionSparePartsSeeTemp = this.maintenanceRequisitionTemp
      this.collectionSparePartsSeeTemp.createDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.dialogStatus = 'collectionSparePartsCreate'
      this.dialogFormVisible_CollectionSparePartsSee = true
      this.isCreatePartDelete = true
      this.listCreateCollectionSpareParts = []
      this.isPartCode = true
      this.getCreateNumber()
    },
    getCreateNumber() {
      this.getParmCreateNumber.parammaps.codeType = 'LY'
      GetDataByName(this.getParmCreateNumber).then(response => {
        this.$nextTick(() => {
          console.log('新增领用单号', response.data.list[0].orderCode)
          this.collectionSparePartsSeeTemp.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.listCreateCollectionSpareParts.length > 0) {
        // eslint-disable-next-line no-redeclare
        if (this.listCreateCollectionSpareParts.find(obj => obj.partId === item.partId)) {
          this.$message({ type: 'warning', message: '此备件已存在，请重新选择备件' })
        } else {
          this.listCreateCollectionSpareParts.unshift(item)
        }
      } else {
        this.listCreateCollectionSpareParts.unshift(item)
      }
    },
    handleAddSparePartsToBeCollected() {
      console.log('添加待领用备件')
      this.addSparePartsToBeCollectedParam.parammaps.RUCode = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.addSparePartsToBeCollectedParam).then(response => {
        if (response.data.list == null) {
          this.$message({ type: 'warning', message: '无可添加待领用备件' })
        } else {
          if (this.listCreateCollectionSpareParts.length > 0) {
            console.log(this.filtersArr(this.listCreateCollectionSpareParts, response.data.list))
            this.listCreateCollectionSpareParts = this.filtersArr(this.listCreateCollectionSpareParts, response.data.list)
          } else {
            this.listCreateCollectionSpareParts = response.data.list
          }
        }
      })
    },
    filtersArr(list, list2) {
      for (var i = 0; i < list.length; i++) {
        for (var j = 0; j < list2.length; j++) {
          if (list[i].partId == list2[j].partId) {
            list[i] = list2[j]
            list2.splice(j, 1)
          }
        }
      }
      return list.concat(list2)
    },
    createPartDelete(row) {
      console.log(this.listAdd)
      MessageBox.confirm('设备名称：' + row.partName, '确认删除？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // console.log(this.list2)
        for (var i = 0; i < this.listCreateCollectionSpareParts.length; i++) {
          console.log(this.listCreateCollectionSpareParts[i])
          if (this.listCreateCollectionSpareParts[i].id === row.id) {
            var listCreateCollectionSparePartsIndex = this.listCreateCollectionSpareParts.indexOf(this.listCreateCollectionSpareParts[i])
          }
          if (listCreateCollectionSparePartsIndex > -1) {
            this.listCreateCollectionSpareParts.splice(listCreateCollectionSparePartsIndex, 1)
            return
          }
        }
      })
    },
    handleViewProgress(row) {
      console.log('查看进度', row)
      console.log(this.maintenanceRequisitionTemp)
      this.viewProgressTemp = Object.assign({}, row)
      this.dialogStatus = 'ViewProgress'
      this.dialogFormVisible_ViewProgress = true
      this.getNumbers()
      this.getPurchaseapplicationList()
      this.getProcurementList()
    },
    getNumbers() {
      this.getNumbersParm.parammaps.contractId = this.viewProgressTemp.contractId
      this.getNumbersParm.parammaps.RUCode = this.maintenanceRequisitionTemp.repairCode
      GetDataByName(this.getNumbersParm).then(response => {
        this.numbersList = response.data.list[0]
      })
    },
    // 申购情况
    getPurchaseapplicationList() {
      this.getPurchaseapplicationParm.parammaps.createDate = this.viewProgressTemp.date
      this.getPurchaseapplicationParm.parammaps.partCode = this.viewProgressTemp.partCode
      this.getPurchaseapplicationParm.parammaps.pastureId = this.viewProgressTemp.pastureId
      GetDataByName(this.getPurchaseapplicationParm).then(response => {
        if (response.data.list !== null) {
          this.purchaseapplicationList = response.data.list
        } else {
          this.purchaseapplicationList = []
        }
      })
    },
    // 采购情况
    getProcurementList() {
      this.getProcurementParm.parammaps.createDate = this.viewProgressTemp.date
      this.getProcurementParm.parammaps.partCode = this.viewProgressTemp.partCode
      this.getProcurementParm.parammaps.pastureId = this.viewProgressTemp.pastureId
      GetDataByName(this.getProcurementParm).then(response => {
        if (response.data.list !== null) {
          this.procurementList = response.data.list
        } else {
          this.procurementList = []
        }
      })
    },
    // 添加领用保存
    createCollectionSparePartsData() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['collectionSparePartsSeeTemp'].validate(valid => {
        if (valid) {
          if (this.listCreateCollectionSpareParts.length !== 0) {
            for (var i = 0; i < this.listCreateCollectionSpareParts.length; i++) {
              console.log(this.listCreateCollectionSpareParts[i].amount)
              if (this.listCreateCollectionSpareParts[i].amount !== undefined && this.listCreateCollectionSpareParts[i].amount !== '') {
                var rulesAmount = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
                if (!rulesAmount.test(this.listCreateCollectionSpareParts[i].amount)) {
                  this.$message({
                    type: 'error',
                    message: '领用数量请输入正数，最多保留两位小数',
                    duration: 2000
                  })
                  return false
                } else {
                  var listCreateCollectionSpareParts1 = [] // >库存
                  var listCreateCollectionSpareParts2 = [] // <=库存
                  var amountList = []
                  var amount2List = []
                  for (let i = 0; i < this.listCreateCollectionSpareParts.length; i++) {
                    var obj = {}
                    var obj2 = {}
                    obj.amount = this.listCreateCollectionSpareParts[i].amount
                    obj.bigId = this.listCreateCollectionSpareParts[i].bigId
                    obj.brand = this.listCreateCollectionSpareParts[i].brand
                    obj.brandId = this.listCreateCollectionSpareParts[i].brandId
                    obj.contractId = this.listCreateCollectionSpareParts[i].contractId
                    obj.enable = this.listCreateCollectionSpareParts[i].enable
                    obj.id = this.listCreateCollectionSpareParts[i].id
                    obj.inventoryType = this.listCreateCollectionSpareParts[i].inventoryType
                    obj.isZeroStock = this.listCreateCollectionSpareParts[i].isZeroStock
                    obj.partCode = this.listCreateCollectionSpareParts[i].partCode
                    obj.partId = this.listCreateCollectionSpareParts[i].partId
                    obj.partName = this.listCreateCollectionSpareParts[i].partName
                    obj.partRepId = this.listCreateCollectionSpareParts[i].partRepId
                    obj.pastureId = this.listCreateCollectionSpareParts[i].pastureId
                    obj.pastureName = this.listCreateCollectionSpareParts[i].pastureName
                    obj.planAmount = this.listCreateCollectionSpareParts[i].planAmount
                    obj.price = this.listCreateCollectionSpareParts[i].price
                    obj.providerId = this.listCreateCollectionSpareParts[i].providerId
                    obj.providerName = this.listCreateCollectionSpareParts[i].providerName
                    obj.remark = this.listCreateCollectionSpareParts[i].remark
                    obj.reportery = this.listCreateCollectionSpareParts[i].reportery
                    obj.specification = this.listCreateCollectionSpareParts[i].specification
                    obj.unit = this.listCreateCollectionSpareParts[i].unit
                    obj.prid = this.listCreateCollectionSpareParts[i].prid
                    obj.mr = this.listCreateCollectionSpareParts[i].mr
                    obj.locationId = this.listCreateCollectionSpareParts[i].locationId
                    amountList.push(obj)
                    obj2.amount = this.listCreateCollectionSpareParts[i].amount
                    obj2.bigId = this.listCreateCollectionSpareParts[i].bigId
                    obj2.brand = this.listCreateCollectionSpareParts[i].brand
                    obj2.brandId = this.listCreateCollectionSpareParts[i].brandId
                    obj2.contractId = this.listCreateCollectionSpareParts[i].contractId
                    obj2.enable = this.listCreateCollectionSpareParts[i].enable
                    obj2.id = this.listCreateCollectionSpareParts[i].id
                    obj2.inventoryType = this.listCreateCollectionSpareParts[i].inventoryType
                    obj2.isZeroStock = this.listCreateCollectionSpareParts[i].isZeroStock
                    obj2.partCode = this.listCreateCollectionSpareParts[i].partCode
                    obj2.partId = this.listCreateCollectionSpareParts[i].partId
                    obj2.partName = this.listCreateCollectionSpareParts[i].partName
                    obj2.partRepId = this.listCreateCollectionSpareParts[i].partRepId
                    obj2.pastureId = this.listCreateCollectionSpareParts[i].pastureId
                    obj2.pastureName = this.listCreateCollectionSpareParts[i].pastureName
                    obj2.planAmount = this.listCreateCollectionSpareParts[i].planAmount
                    obj2.price = this.listCreateCollectionSpareParts[i].price
                    obj2.providerId = this.listCreateCollectionSpareParts[i].providerId
                    obj2.providerName = this.listCreateCollectionSpareParts[i].providerName
                    obj2.remark = this.listCreateCollectionSpareParts[i].remark
                    obj2.reportery = this.listCreateCollectionSpareParts[i].reportery
                    obj2.specification = this.listCreateCollectionSpareParts[i].specification
                    obj2.unit = this.listCreateCollectionSpareParts[i].unit
                    obj2.prid = this.listCreateCollectionSpareParts[i].prid
                    obj.mr = this.listCreateCollectionSpareParts[i].mr
                    obj2.locationId = this.listCreateCollectionSpareParts[i].locationId
                    amount2List.push(obj2)
                  }
                  for (let i = 0; i < amountList.length; i++) {
                    if (parseFloat(amountList[i].amount) > parseFloat(amountList[i].reportery)) {
                      var amount = String(parseFloat(amountList[i].amount) - parseFloat(amountList[i].reportery))
                      amountList[i].amount = amount
                      listCreateCollectionSpareParts1.push(amountList[i])
                      if (parseFloat(amountList[i].reportery) > 0) {
                        amount2List[i].amount = String(amount2List[i].reportery)
                        listCreateCollectionSpareParts2.push(amount2List[i])
                      }
                    } else {
                      listCreateCollectionSpareParts2.push(amountList[i])
                    }
                  }
                  console.log(this.listCreateCollectionSpareParts, 'this.listCreateCollectionSpareParts')
                  console.log(listCreateCollectionSpareParts1, '>库存listCreateCollectionSpareParts1')
                  console.log(listCreateCollectionSpareParts2, '<=库存listCreateCollectionSpareParts2')
                  let mySumPrice = 0
                  for (let i = 0; i < listCreateCollectionSpareParts2.length; i++) {
                    mySumPrice += parseFloat(listCreateCollectionSpareParts2[i].price) * parseFloat(listCreateCollectionSpareParts2[i].amount)
                  }
                  if (mySumPrice > 500) {
                    this.collectionSparePartsSeeTemp.SHStatus = 2
                  } else {
                    this.collectionSparePartsSeeTemp.SHStatus = 9
                  }
                  this.postDataPramas.common = { 'returnmap': '0' }
                  this.postDataPramas.data = []
                  this.postDataPramas.data[0] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.listCreateCollectionSpareParts }}
                  this.postDataPramas.data[0].children = []
                  this.postDataPramas.data[0].children[0] = { 'name': 'updatePartapplyuseAmount_m', 'type': 'e', 'parammaps': {
                    amount: '@insertSpotList3.amount',
                    paid: '@insertSpotList3.contractId',
                    RUCode: this.collectionSparePartsSeeTemp.repairCode
                  }}
                  this.postDataPramas.data[1] = { 'name': 'insertBigpartapply_m', 'type': 'e', 'parammaps': {
                    pastureId: this.collectionSparePartsSeeTemp.pastureId,
                    applyCode: this.collectionSparePartsSeeTemp.applyCode,
                    applyType: 1,
                    departmentId: this.collectionSparePartsSeeTemp.departmentId,
                    // empId: this.collectionSparePartsSeeTemp.pickId,
                    empId: Cookies.get('employeid'),
                    applyDate: this.collectionSparePartsSeeTemp.createDate,
                    RUCode: this.collectionSparePartsSeeTemp.repairCode
                  }}
                  this.postDataPramas.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': listCreateCollectionSpareParts1 }}
                  this.postDataPramas.data[2].children = []
                  this.postDataPramas.data[2].children[0] = { 'name': 'insertpartapply_m', 'type': 'e', 'parammaps': {
                    bigId: this.collectionSparePartsSeeTemp.repairCode,
                    prid: '@insertSpotList2.prid',
                    pastureId: '@insertSpotList2.pastureId',
                    partId: '@insertSpotList2.partId',
                    partCode: '@insertSpotList2.partCode',
                    partName: '@insertSpotList2.partName',
                    specification: '@insertSpotList2.specification',
                    brandId: '@insertSpotList2.brandId',
                    price: '@insertSpotList2.price',
                    amount: '@insertSpotList2.amount',
                    eqName: this.collectionSparePartsSeeTemp.eqName,
                    eqCode: this.collectionSparePartsSeeTemp.eqCode,
                    providerId: '@insertSpotList2.providerId',
                    note: '@insertSpotList2.note',
                    reportery: '@insertSpotList2.reportery',
                    contractId: '@insertSpotList2.contractId'
                  }}
                  if (listCreateCollectionSpareParts2.length > 0) {
                    this.postDataPramas.data[3] = { 'name': 'insertBigpartapply', 'type': 'e', 'parammaps': {
                      pastureId: this.collectionSparePartsSeeTemp.pastureId,
                      applyCode: this.collectionSparePartsSeeTemp.applyCode,
                      applyType: 1,
                      departmentId: this.collectionSparePartsSeeTemp.departmentId,
                      // empId: this.collectionSparePartsSeeTemp.pickId,
                      empId: Cookies.get('employeid'),
                      applyDate: this.collectionSparePartsSeeTemp.createDate,
                      RUCode: this.collectionSparePartsSeeTemp.repairCode,
                      SHStatus: this.collectionSparePartsSeeTemp.SHStatus
                    }}
                    this.postDataPramas.data[4] = { 'name': 'insertSpotList', 'resultmaps': { 'list': listCreateCollectionSpareParts2 }}
                    this.postDataPramas.data[4].children = []
                    this.postDataPramas.data[4].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.collectionSparePartsSeeTemp.eqName,
                      eqCode: this.collectionSparePartsSeeTemp.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_CollectionSparePartsSee = false
                      this.getCollectionSpareParts()
                      this.getCollectionSpareParts()
                      this.getCollectionSpareParts2()
                      this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
                    }
                  })
                  return true
                }
              } else {
                this.$message({ type: 'error', message: '请检查领用数量是否未填写', duration: 2000 })
                return false
              }
            }
          } else {
            this.$notify({ title: '', type: 'warning', message: '请选择备件', duration: 2000 })
            return false
          }
        }
      })
    },
    form_delete(row) {
      MessageBox.confirm('确认删除？', {
        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
      }).then(() => {
        this.requestParam.name = 'deleteMaintain'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps.id = row.id
        PostDataByName(this.requestParam).then((response) => {
          if (response.msg !== 'fail') {
            this.get_table_data()
            this.getPendingList()
            this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
          } else {
            failproccess(response, this.$notify)
          }
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消删除' })
      })
    },
    handleRejectRepair(row) {
      console.log('报修驳回')
      this.rejectRepair.temp = Object.assign({}, row)
      this.dialogStatus = 'rejectRepair'
      this.rejectRepair.dialogFormVisible = true
    },
    rejectRepairData() {
      console.log('报修驳回确认')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['rejectRepair'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'updateMaintain'
          this.requestParam.parammaps = {}
          this.requestParam.parammaps.shutdownPerson = Cookies.get('employeid')
          this.requestParam.parammaps.id = this.rejectRepair.temp.id
          this.requestParam.parammaps.shutdownReason = this.rejectRepair.temp.shutdownReason
          PostDataByName(this.requestParam).then((response) => {
            if (response.msg !== 'fail') {
              this.get_table_data()
              this.getPendingList()
              this.rejectRepair.dialogFormVisible = false
              this.$notify({ title: '成功', message: '驳回成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    handleDownload() {
      this.$alert('设备维修正在导出中，请勿刷新或离开本页面，若导出时间过长，建议缩小导出数据范围重新导出', {})
      this.isPercentage = true
      this.percentage = 1
      var timer = setInterval(() => {
        this.percentage += 5
        if (this.percentage > 95) {
          this.percentage = 99
          clearInterval(timer)
        }
        this.percentage = this.percentage
      }, 1000)
      this.downLoadParm = {}
      this.downLoadParm.name = 'loadRepirsList'
      this.downLoadParm.offset = 0
      this.downLoadParm.page = 1
      this.downLoadParm.returntype = 'Map'
      if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
        this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
        this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
      } else {
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      }
      this.downLoadParm.parammaps = this.getdataListParm.parammaps
      GetAccount(this.downLoadParm).then(response => {
        if(response.data.list !== null && response.data.list !== ''){
          for(let i=0;i<response.data.list.length;i++){
            if(response.data.list[i].orderStatue == 0){
              this.$set(response.data.list[i],'orderStatue','待接单')
            }else if(response.data.list[i].orderStatue == 1){
              this.$set(response.data.list[i],'orderStatue','维修中')
            }else if(response.data.list[i].orderStatue == 2){
              this.$set(response.data.list[i],'orderStatue','维修完成')
            }else if(response.data.list[i].orderStatue == 3){
              this.$set(response.data.list[i],'orderStatue','已驳回')
            }
            if (response.data.list[i].SHStatue == 1) {
              this.$set(response.data.list[i],'SHStatue','')
            } else if (response.data.list[i].SHStatue == 2 || response.data.list[i].SHStatue == 3) {
              this.$set(response.data.list[i],'SHStatue','审核中')
            } else if (response.data.list[i].SHStatue == 4 || response.data.list[i].SHStatue == 6) {
              this.$set(response.data.list[i],'SHStatue','未通过')
            } else if (response.data.list[i].SHStatue == 5) {
              this.$set(response.data.list[i],'SHStatue','已通过')
            }
          }
        }else{
          response.data.list = []
        }
        this.downLoadList = response.data.list
        console.log(this.downLoadList)
        if (response.data.list !== '') {
          this.percentage = 99
          setTimeout(() => {
            this.isPercentage = false
          }, 2000)
        }
        const elecExcelDatas = [
          {
            tHeader: ['报修单号', '牧场', '设备内部编号', '设备名称', '规格型号', '部门', '故障情况','报修人','报修时间','维修日期','维修部门','处理状态','领用单状态','旧品录入状态','审核状态','故障部位','故障详情','故障原因','处理方式'],
            filterVal: ['repairCode', 'pastureName', 'eqCode', 'eqName', 'specification', 'departmentName', 'details','requesterName','requestTime','stopTime','repairDeptName','orderStatue','LYStatue','LRStatue','SHStatue','positionName','appearanceName','failureCause','treatmentMethod'],
            tableDatas: this.downLoadList,
            sheetName: '设备维修'
          }
        ]
        json2excel(elecExcelDatas, '设备维修', true, 'xlsx')
      })
    },
  }
}
</script>
<style lang="scss" scoped>
.successMaintenanceAudit{
  width: 70px;
  color: #fff;
}
.successRequisition{
  width: 80px;
  color: #fff;
}
/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>
