<template>
  <div class="app-container">
    <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
      <h4 style="padding-left: 10px;line-height: 0;">导出进度：</h4>
      <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
    </div>
    <el-tabs v-model="tabName" @tab-click="handleTabClick">
      <el-tab-pane v-if="isBasic" label="备件基础信息" name="first">
        <div class="filter-container">
          <el-input v-model="getdataListParm.parammaps.partCode" placeholder="备件编号" style="width: 200px;" class="filter-item" />
          <el-input v-model="getdataListParm.parammaps.partName" placeholder="备件名称" style="width: 140px;" class="filter-item" />
          <el-input v-model="getdataListParm.parammaps.specification" placeholder="备件规格" style="width: 200px;" class="filter-item" />
          <tree-select
            class="typeSelect"
            :height="150"
            :width="250"
            size="small"
            clearable
            :data="parentDept"
            :disabled="disabled"
            :placeholder="placeholder"
            style="display:inline-block;"
            :default-props="defaultProps"
            :node-key="nodeKey"
            :checked-keys="defaultCheckedKeys"
            @popoverHide="popoverHide"
          />
          <el-date-picker
            ref="inputDatetime"
            v-model="getdataListParm.parammaps.inputDatetime"
            class="inputDatetime"
            type="datetimerange"
            style="width: 250px;top:-3px;"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="审批时间"
            end-placeholder="审批时间"
          />
          <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
          <div>
            <el-button v-if="isBasicAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>
            <el-button v-if="isBasicTemplate" v-waves class="filter-item" type="info" icon="el-icon-tickets" @click="handleDownloadTemp">模板</el-button>
            <el-button v-if="isDisable" v-waves class="filter-item" type="danger" icon="el-icon-remove-outline" @click="handleBatchDisable">批量禁用</el-button>
            <el-button v-if="isEnable" v-waves class="filter-item" type="danger" icon="el-icon-success" @click="handleBatchEnable">批量启用</el-button>
            <el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
              <el-button v-if="isBasicImport" v-waves class="filter-item" type="warning" icon="el-icon-download" @click="form_search">导入</el-button>
            </el-upload>
            <el-button v-if="isBasicExport" v-waves class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
            <el-button v-if="isEasSynchronization" class="filter-item" type="primary" style="float: right;" @click="handleEAS">EAS同步</el-button>
          </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"
          @selection-change="handleSelectionChange2"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" align="center" type="index" width="50px">
            <template slot-scope="scope">
              <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件编号" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partCode }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件名称" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件规格" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.specification }}</span>
            </template>
          </el-table-column>
          <el-table-column label="计量单位" min-width="60px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.unit }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件类别" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.eqClassName1 }}/{{ scope.row.eqClassName2 }}/{{ scope.row.eqClassName3 }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="录入时间" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.createTime }}</span>
            </template>
          </el-table-column> -->
          <el-table-column label="审批时间" sortable prop="chargeDate" min-width="110px" align="center" />
          <el-table-column label="录入人" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.createPerson }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件图片" min-width="110px" align="center">
            <template slot-scope="scope">
              <el-popover placement="right" title="" trigger="hover">
                <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
                <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column label="备件库存" min-width="120px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.reportery }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="350px" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <el-button v-if="isBasicSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
              <el-button v-if="isBasicEditTab1 && row.enable == 1" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
              <el-button v-if="isDisable && row.enable == 1" type="danger" size="mini" @click="handleDisable(row)">禁用</el-button>
              <el-button v-if="isEnable && row.enable == 0" type="danger" size="mini" @click="handleEnable(row)">启用</el-button>
              <el-button v-if="isBasicDelete1 && row.enable == 1" type="danger" size="mini" @click="handleDelate(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-tab-pane>
      <el-tab-pane v-if="isBasicSH" label="审核备件" name="second">
        <div class="filter-container">
          <el-input v-model="getdataListParmSH.parammaps.partCode" placeholder="备件编号" style="width: 200px;" class="filter-item" />
          <el-input v-model="getdataListParmSH.parammaps.partName" placeholder="备件名称" style="width: 140px;" class="filter-item" />
          <el-input v-model="getdataListParmSH.parammaps.specification" placeholder="备件规格" style="width: 200px;" class="filter-item" />
          <tree-select
            class="typeSelect"
            :height="150"
            :width="250"
            size="small"
            clearable
            :data="parentDept"
            :disabled="disabled"
            :placeholder="placeholder"
            style="display:inline-block;"
            :default-props="defaultProps"
            :node-key="nodeKey"
            :checked-keys="defaultCheckedKeys"
            @popoverHide="popoverHide"
          />
          <el-select v-model="getdataListParmSH.parammaps.statue" style="width: 120px;" clearable placeholder="审核状态" class="filter-item">
            <el-option v-for="item in statues" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-date-picker
            ref="inputDatetimeSH"
            v-model="getdataListParmSH.parammaps.inputDatetimeSH"
            class="inputDatetime"
            type="datetimerange"
            style="width: 250px;top:-3px;"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          />
          <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchSH">搜索</el-button>
          <div>
            <el-button v-if="isBasicExamine" class="filter-item" type="primary" @click="handleExamines">批量审批</el-button>
          </div>
        </div>
        <el-table
          :key="tableKey"
          v-loading="listLoadingSH"
          element-loading-text="给我一点时间"
          :data="listSH"
          border
          fit
          highlight-current-row
          style="width: 100%;"
          :row-style="rowStyle"
          :cell-style="cellStyle"
          class="elTable table-fixed"
          :max-height="myHeight"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" align="center" type="index" width="50px">
            <template slot-scope="scope">
              <span>{{ scope.$index + (pageNumSH-1) * pageSizeSH + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件编号" min-width="130px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partCode }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件名称" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.partName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件规格" min-width="110px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.specification }}</span>
            </template>
          </el-table-column>
          <el-table-column label="计量单位" min-width="60px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.unit }}</span>
            </template>
          </el-table-column>
          <el-table-column label="备件类别" min-width="150px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.eqClassName1 }}/{{ scope.row.eqClassName2 }}/{{ scope.row.eqClassName3 }}</span>
            </template>
          </el-table-column>
          <el-table-column label="审核状态" min-width="130px" align="center" :formatter="statue" />
          <el-table-column label="审批时间" sortable prop="chargeDate" min-width="110px" align="center" />
          <el-table-column label="备件图片" min-width="110px" align="center">
            <template slot-scope="scope">
              <el-popover placement="right" title="" trigger="hover">
                <img :src="scope.row.picpath">
                <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column label="录入人" min-width="100px" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.createPerson }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <el-button v-if="isBasicSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
              <!-- 编辑 -->
              <el-button v-if="isBasicEdit && row.statue==2" type="success" style="display:inline-block" size="mini" @click="form_edit(row)">编辑</el-button>
              <el-button v-else type="success" style="display:none" size="mini" @click="form_edit(row)">编辑</el-button>
              <el-button v-if="isBasicExamine && row.statue == 0" style="display:inline-block" type="success" size="mini" @click="handleExamine(row)">审核</el-button>
              <el-button v-else style="display:none" type="success" size="mini" @click="handleExamine(row)">审核</el-button>

              <el-button v-if="isBasicDelete && row.statue == 2" style="display:inline-block" type="danger" size="mini" @click="handleDelate(row)">删除</el-button>
              <el-button v-else style="display:none" type="danger" size="mini" @click="handleDelate(row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination v-show="totalSH>0" :total="totalSH" :page.sync="getdataListParmSH.offset" :limit.sync="getdataListParmSH.pagecount" @pagination="get_table_dataSH" />
      </el-tab-pane>
    </el-tabs>

    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="90%">
      <div class="app-add">
        <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="100px" style="width: 90%;margin:0 auto">
          <el-row>
            <el-col v-if="partClassCreate" :span="8">
              <el-form-item ref="partClass" label="备件类别：" prop="partClass">
                <tree-select
                  class="typeSelect"
                  :height="150"
                  :width="230"
                  size="small"
                  :data="parentDept"
                  :disabled="disabled"
                  :default-props="defaultProps"
                  :node-key="nodeKey"
                  :checked-keys="defaultCheckedKeys"
                  @popoverHide="popoverHide"
                />
                <!-- style="display:inline-block;width:100%" -->
                <!-- display -->
              </el-form-item>
            </el-col>
            <el-col v-if="partClassUpdate" :span="8">
              <el-form-item label="备件类别：" prop="partClass">
                <el-input ref="partClass" v-model="createTemp.partClass" disabled />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="备件编号：" prop="partCode">
                <el-input ref="partCode" v-model="createTemp.partCode" disabled />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="备件名称：" prop="partName">
                <el-input ref="partName" v-model="createTemp.partName" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="备件规格：" prop="specification">
                <el-input ref="specification" v-model="createTemp.specification" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="计量单位：" prop="unit">
                <el-select v-model="createTemp.unit" clearable placeholder="计量单位" class="filter-item" style="width:100%">
                  <el-option
                    v-for="item in units"
                    :key="item.id"
                    :label="item.label"
                    :value="item.label"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用途：" prop="purpose">
                <el-input v-model="createTemp.purpose" type="textarea" placeholder="用途" autosize maxlength="100" show-word-limit />
                <!-- <el-input v-model="createTemp.purpose" :row="1" type="textarea" placeholder="用途" /> -->
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="录入日期：" prop="createTime">
                <el-date-picker
                  v-model="createTemp.createTime"
                  disabled
                  :picker-options="pickerOptions"
                  type="date"
                  placeholder="录入日期"
                  style="top:-3px;width:100%"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="录入人：" prop="createPerson">
                <el-select v-model="createTemp.createPerson" 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="note">
                <el-input v-model="createTemp.note" type="textarea" placeholder="备注" autosize />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item label="备件图片：" prop="picpath">
                <el-upload
                  id="uploadPic"
                  ref="upload"
                  :limit="1"
                  list-type="picture-card"
                  :file-list="createTemp.fileList"
                  :headers="headers"
                  :action="uploadImageUrl"
                  :auto-upload="true"
                  :on-preview="handlePicPreview"
                  :before-remove="beforeRemove"
                  :class="{hide:showUpload}"
                  :on-change="(file,fileList)=>{ return handlePicChange(file, fileList) }"
                  :on-success="(response,file, fileList)=>{ return handlePicSuccess(response,file, fileList) }"
                  :on-remove="(file, fileList)=>{ return handlePicRemove(file, fileList) }"
                >
                  <i class="el-icon-plus" />
                </el-upload>
                <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
                  <img :src="dialogImageUrl" alt="" @load="onLoad">
                </el-dialog>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="dialogStatus==='create'" ref="createb" type="success" :disabled="isokDisable" @click="add_dialog_save_again()">保存并新增</el-button>
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">保存并关闭</el-button>
        <el-button @click="dialogFormVisible = false;createTemp.partCode='';createTemp.partClass = '';createTemp.partClassNameCode = '';get_table_data();">取消并关闭</el-button>
      </div>
    </el-dialog>
    <!-- 查看 -->
    <el-dialog :title="textMap[dialogStatusSee]" :visible.sync="dialogFormVisible_See" :close-on-click-modal="false" width="90%">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="备件基础信息" name="first">
          <el-form
            ref="seeTemp"
            :rules="rules"
            :model="seeTemp"
            label-position="right"
            label-width="100px"
            style="width: 90%;margin:0 auto"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item ref="partClass" label="备件类别：" prop="partClass">
                  <span>{{ seeTemp.eqClassName1 }}/{{ seeTemp.eqClassName3 }}/{{ seeTemp.eqClassName3 }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="备件编号：" prop="partCode">
                  <span>{{ seeTemp.partCode }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="备件名称：" prop="partName">
                  <span>{{ seeTemp.partName }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="备件规格：" prop="specification">
                  <span>{{ seeTemp.specification }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="计量单位：" prop="unit">
                  <span>{{ seeTemp.unit }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="用途：" prop="purpose">
                  <span>{{ seeTemp.purpose }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="录入日期：" prop="createTime">
                  <span>{{ seeTemp.createTime }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="录入人：" prop="createPerson">
                  <span>{{ seeTemp.createPerson }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="备注：" prop="note">
                  <span>{{ seeTemp.note }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="备件图片：">
                  <el-popover placement="right" title="" trigger="hover">
                    <img v-if="seeTemp.picpath !== ''" :src="seeTemp.picpath">
                    <img v-if="seeTemp.picpath !== ''" slot="reference" :src="seeTemp.picpath" :alt="seeTemp.srcpath" style="height: 100px;width:100px;">
                  </el-popover>
                </el-form-item>
              </el-col>
            </el-row>
            <div v-if="isFlowChart">
              <el-row>
                <el-col>
                  <el-form-item label="流程进度" />
                  <el-steps :active="active" align-center finish-status="success">
                    <el-step
                      v-for="(item,index) in activeList"
                      :key="index"
                      :title="item.title"
                      :status="item.status"
                    >
                      <template slot="description">
                        <div class="step-row">
                          <div>{{ item.name }}&nbsp;&nbsp;{{ item.date }}</div>
                          <div>{{ item.reason }}</div>
                        </div>
                      </template>
                    </el-step>
                  </el-steps>
                </el-col>
              </el-row>
              <el-row>
                <el-col>
                  <el-form-item label="操作:">
                    <el-button v-if="isBasicExamine && seeTemp.statue == 0" type="success" style="display:inline-block" @click="handleExamine()">审核</el-button>
                    <el-button v-else type="success" style="display:none" class="success" @click="handleExamine()">审核</el-button>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-form>

        </el-tab-pane>
        <el-tab-pane v-if="isDisplayPasture" label="牧场信息" name="second">
          <div class="pasture-title">
            <b>备件类别：<span>{{ seeTemp.eqClassName1 }}/{{ seeTemp.eqClassName3 }}/{{ seeTemp.eqClassName3 }}</span></b>
            <b>备件编号：<span> {{ seeTemp.partCode }}</span></b>
            <b>备件编名称：<span>{{ seeTemp.partName }}</span></b>
          </div>

          <el-table
            :key="tableKey"
            v-loading="listLoadingSee"
            element-loading-text="给我一点时间"
            :data="listSee"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable"
            @sort-change="tableSort"
          >
            <!-- 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="130px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.pastureName }}</span>
              </template>
            </el-table-column>
            <el-table-column label="供应商" min-width="110px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.providerName }}</span>
              </template>
            </el-table-column>
            <el-table-column label="当前库存" sortable prop="reportery" min-width="130px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.reportery }}</span>
              </template>
            </el-table-column>
            <el-table-column label="最低库存" sortable prop="minRepertory" min-width="110px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.minRepertory }}</span>
              </template>
            </el-table-column>
            <el-table-column label="最高库存" sortable prop="maxRepertory" min-width="110px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.maxRepertory }}</span>
              </template>
            </el-table-column>
            <el-table-column label="单价" sortable prop="price" min-width="130px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.price }}</span>
              </template>
            </el-table-column>
            <el-table-column label="库位" min-width="110px" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.location }}</span>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="totalSee>0"
            :total="totalSee"
            :page.sync="getdataListSee.offset"
            :limit.sync="getdataListSee.pagecount"
            @pagination="getSeeList"
          />
        </el-tab-pane>
      </el-tabs>

      <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
        <el-button @click="dialogFormVisible_See = false">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 审核 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examine" :close-on-click-modal="false" width="30%">
      <div class="app-examine">
        <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请确认审核结果:</h3>
        <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 50%;margin:0 auto;">
          <el-row style="width:88%;height:150px;margin:0 auto;">
            <el-col :span="20">
              <el-form-item>
                <el-radio-group v-model="examineTemp.SHstatue" @change="changeStatue">
                  <el-radio :label="1" checked>通过</el-radio>
                  <el-radio :label="2">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col v-if="statueReason" :span="20">
              <el-input v-model="examineTemp.workflowNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入不通过原因" />
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @keyup.enter.native="createExamineData()" @click="createExamineData()">确认</el-button>
        <el-button @click="dialogFormVisible_Examine = false;">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 批量审批 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examines" :close-on-click-modal="false" width="40%">
      <div class="app-examine" style="text-align:center;font:600 20px/40px '';height:200px;margin-top:40px;">
        <div> 当前共选中备件：{{ Selection }}条 </div>
        <div> 是否确认批量通过审核 </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='examine'?createExamineDatas():createExamineDatas()">确认</el-button>
        <el-button @click="dialogFormVisible_Examines = false;">关闭</el-button>
      </div>
    </el-dialog>   <!-- EAS同步 -->
    <!-- EAS同步 -->
    <el-dialog :title="textMap[easStatus.dialogStatus]" :visible.sync="easStatus.dialogFormVisible" :close-on-click-modal="false" width="80%">
      <div class="easStatus">
        <el-table
          :key="easStatus.tableKey"
          v-loading="easStatus.listLoading"
          element-loading-text="给我一点时间"
          :data="easStatus.list"
          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="备件编号" min-width="110px" align="center" prop="partCode" />
          <el-table-column label="备件编号" min-width="110px" align="center" prop="partName" />
          <el-table-column label="备件规格" min-width="110px" align="center" prop="specification" />
          <el-table-column label="录入时间" min-width="110px" align="center" prop="createTime" />
          <el-table-column label="失败原因" min-width="110px" align="center" prop="failReason" />
          <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="{row}">
              <el-button v-if="isManualSynchronization" type="primary" size="mini" style="width:70px;" @click="handleManual(row)">手动同步</el-button>
              <el-button v-if="isIgnoreSynchronization" type="danger" size="mini" style="width:70px;" @click="handleIgnore(row)">忽略同步</el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination v-show="easStatus.total>0" :total="easStatus.total" :page.sync="easStatus.getdataListParm.offset" :limit.sync="easStatus.getdataListParm.pagecount" @pagination="get_table_dataEasStatusLst" />
      </div>
      <div slot="footer" class="dialog-footer" style="bottom: 10px;">
        <el-button @click="easStatus.dialogFormVisible = false;get_table_data()">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// 引入
import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, checkButtons, getRecuData, failproccess, transData, GetAccount, EasSync } from '@/api/common'
import waves from '@/directive/waves' // waves directive
import { parseTime, json2excel, sortChange } from '@/utils/index.js'
// eslint-disable-next-line no-unused-vars
import { validateEMail } from '@/utils/validate.js'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import TreeSelect from '@/components/TreeSelect'
import Cookies from 'js-cookie'
import { MessageBox } from 'element-ui'
import { getToken } from '@/utils/auth'
export default {
  name: 'Basic',
  components: { Pagination, TreeSelect },
  directives: { waves },
  data() {
    return {
      isStyle: 'display:none',
      isBasicAdd: [],
      isBasicTemplate: [],
      isBasicExport: [],
      isBasicImport: [],
      isBasicSee: [],
      isBasicEdit: [],
      isBasicEditTab1: [],
      isDisable: [],
      isEnable: [],
      isBasicExamine: [],
      isBasicDelete: [],
      isBasicDelete1: [],
      isBasic: [],
      isBasicSH: [],
      isEasSynchronization: [],
      isManualSynchronization: [],
      isIgnoreSynchronization: [],
      multipleSelection: [],
      rules: {
        temptypeCode: [{ required: true, message: '必填', trigger: 'blur' }],
        partClass: [{ required: true, message: '必填', trigger: 'blur' }],
        partCode: [{ required: true, message: '必填', trigger: 'blur' }],
        partName: [{ required: true, message: '必填', trigger: 'blur' }],
        specification: [{ required: true, message: '必填', trigger: 'blur' }],
        providerId: [{ required: true, message: '必填', trigger: 'blur' }],
        unit: [{ required: true, message: '必填', trigger: 'blur' }],
        purpose: [{ required: true, message: '必填', trigger: 'blur' }]
      },
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' },

      textMap: {
        see: '查看详情',
        create: '新增',
        update: '编辑',
        examine: '审核',
        examines: '批量审批',
        easStatus: 'EAS同步—同步失败数据'
      },
      dialogFormVisible: false,
      dialogStatus: '',

      dialogImageUrl: '',
      dialogVisible: false,
      fileList: [],
      showUpload: false,
      headers: {
        optname: 'insertcustompic',
        id: 1,
        token: getToken() // 从cookie里获取token，并赋值token
      },
      uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
      widht: '',
      listType: [],
      parentDept: [],
      defaultProps: {
        children: 'children',
        label: 'partClassNameCode'
      },
      nodeKey: 'id',
      defaultCheckedKeys: [],
      deptform: {
        id: '',
        tempPtypeCode: '',
        temptypeCode: '',
        typeName: '',
        typeCode: '',
        pid: '',
        sort: '',
        enable: ''
      },
      statues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
      findAllProvider: [],
      findAllAssetType: [],
      findAllPasture: [],
      findAllDepart: [],
      findAllEmploye: [],
      getDictByNameYuJing: [],
      findAllCategory: [],
      requestParams: [
        { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
        { name: 'findAllDepart', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
        { name: 'findAllCategory', offset: 0, pagecount: 0, params: [] },
        { name: 'getDictByName', offset: 0, pagecount: 0, params: ['计量单位'] },
        { name: 'getPastureRoleList', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid'), empId: this.$store.state.user.employeid }}
      ],
      isokDisable: false,
      disabled: false,
      activeName: 'first',
      tableKey: 0,
      total: 0,
      listLoading: true,
      list: [],
      getdataListParm: {
        name: 'getStockList',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          partCode: '',
          partName: '',
          partClass: '',
          inputDatetime: '',
          specification: '',
          easStatus: ''
        }
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()// 当天之前的时间可选
        }
      },
      createTemp: {
        partClass: '',
        partCode: '',
        tempPtypeCode: '',
        temptypeCode: '',
        partName: '',
        specification: '',
        unit: '',
        purpose: '',
        createPerson: this.$store.state.user.employeid,
        createTime: parseTime(new Date(), '{y}-{m}-{d}'),
        note: ''
      },
      placeholder: '请选择备件类别',
      partClassCreate: false,
      partClassUpdate: false,
      temptypeCode: true,
      temptypeCode1: false,
      listLoadingSee: true,
      dialogFormVisible_See: false,
      dialogStatusSee: '',
      listSee: [],
      seeTemp: {},
      getdataListSee: {
        name: 'getStockdetail',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {}
      },
      totalSee: 0,
      getRecuListParm: {
        name: 'getStockTypeList',
        idname: 'id',
        params: [-1]
      },
      requestParam: {},
      getDeptListParm: { name: 'getpart_classList_enable' },
      units: [],
      radio1: '全部',
      getdataListParmSH: {
        name: 'getStockListSH',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          partCode: '',
          partName: '',
          partClass: '',
          statue: '',
          inputDatetimeSH: '',
          specification: ''
        }
      },
      listSH: [],
      listLoadingSH: false,
      totalSH: 0,
      tabName: '',
      dialogFormVisible_Examine: false,
      dialogFormVisible_Examines: false,
      examineTemp: {
        SHstatue: 1
      },
      statueReason: false,
      activeList: [],
      active: 3,
      isFlowChart: false, // 流程图/操作
      isDisplayPasture: false, // 查看-牧场信息,
      buttons: [],
      isPercentage: false,
      percentage: 1,
      downloadParam: {},
      postDataPramas: {},
      Selection: 0,
      selectionList: [],
      width: 0,
      createExamineParm: { name: 'getPartCode', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: {}},
      // EAS同步
      easStatus: {
        easStatusList: [{ name: '同步成功', id: '1' }, { name: '同步失败', id: '0' }],
        dialogStatus: '',
        dialogFormVisible: false,
        tableKey: 0,
        total: 0,
        listLoading: true,
        list: [],
        getdataListParm: {
          name: 'getpartsSync',
          page: 1,
          offset: 1,
          pagecount: 10,
          returntype: 'Map',
          parammaps: {}
        }
      },
      myHeight: document.documentElement.clientHeight - 85 - 250
      // fileList: [],
      // headers1: {
      //   optname: 'insertcustompic',
      //   id: 1,
      //   token: getToken() // 从cookie里获取token，并赋值token
      // },
      // uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
      // showUpload: false
    }
  },
  computed: {
    // 设置请求头
    // headers() {
    //   return {
    //     token: getToken()
    //   }
    // },
    uploadData() {
      return {
        name: 'importparts',
        importParams: '编码,品名,规格型号,品牌,计量单位,一级分类,二级分类,三级分类,建立人,建立时间',
        sheetname: 'SheetJS'
      }
    },
    // 设置上传地址
    uploadExcelUrl() {
      // process.env.VUE_APP_BASE_API是服务器的路径，也是axios的基本路径
      return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
    }
  },
  created() {
    const that = this
    GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
      that.buttons = response.data.list
      that.get_auto_buttons()
    })
    this.get_select_list()
    this.getDownClassList()
    this.get_table_data()
    this.getMaxCode()
    this.getTypeList()
    this.get_table_dataSH()

    if (this.$route.query.tabName == undefined) {
      this.tabName = 'first'
    } else {
      this.tabName = this.$route.query.tabName
    }

    if (this.isBasic === false) {
      this.tabName = 'second'
    }
    if (this.tabName == 'first') {
      this.isDisplayPasture = true
      this.isFlowChart = false
    } else {
      this.isDisplayPasture = false
      this.isFlowChart = true
    }
  },
  methods: {
    tableSort(column) {
      sortChange(column, this.list)
    },
    get_auto_buttons() {
      // 新增
      const BasicAdd = 'customs:basic:add'
      const isBasicAdd = checkButtons(this.$store.state.user.buttons, BasicAdd)
      this.isBasicAdd = isBasicAdd
      // 模板
      const BasicTemplate = 'customs:basic:template'
      const isBasicTemplate = checkButtons(this.$store.state.user.buttons, BasicTemplate)
      this.isBasicTemplate = isBasicTemplate
      // 导出
      const BasicExport = 'customs:basic:export'
      const isBasicExport = checkButtons(this.$store.state.user.buttons, BasicExport)
      this.isBasicExport = isBasicExport
      // 导入
      const BasicImport = 'customs:basic:import'
      const isBasicImport = checkButtons(this.$store.state.user.buttons, BasicImport)
      this.isBasicImport = isBasicImport
      // 查看
      const BasicSee = 'customs:basic:see'
      const isBasicSee = checkButtons(this.$store.state.user.buttons, BasicSee)
      this.isBasicSee = isBasicSee
      // 编辑
      const BasicEdit = 'customs:basic:update'
      const isBasicEdit = checkButtons(this.$store.state.user.buttons, BasicEdit)
      this.isBasicEdit = isBasicEdit

      // 备件基础信息-编辑
      const BasicEditTab1 = 'customs:basic:update2'
      const isBasicEditTab1 = checkButtons(this.$store.state.user.buttons, BasicEditTab1)
      this.isBasicEditTab1 = isBasicEditTab1
      // 备件基础信息-禁用
      const Disable = 'customs:basic:disable'
      const isDisable = checkButtons(this.$store.state.user.buttons, Disable)
      this.isDisable = isDisable
      // 备件基础信息-开启
      const Enable = 'customs:basic:enable'
      const isEnable = checkButtons(this.$store.state.user.buttons, Enable)
      this.isEnable = isEnable
      // 备件基础信息删除
      const BasicDelete1 = 'customs:basic:enable'
      const isBasicDelete1 = checkButtons(this.$store.state.user.buttons, BasicDelete1)
      this.isBasicDelete1 = isBasicDelete1
      // 删除
      const BasicDelete = 'customs:basic:delete'
      const isBasicDelete = checkButtons(this.$store.state.user.buttons, BasicDelete)
      this.isBasicDelete = isBasicDelete
      // 审核
      const BasicExamine = 'customs:basic:shenhe'
      const isBasicExamine = checkButtons(this.$store.state.user.buttons, BasicExamine)
      this.isBasicExamine = isBasicExamine
      // 备件基础信息
      const Basic = 'customs:basic:basic'
      const isBasic = checkButtons(this.$store.state.user.buttons, Basic)
      this.isBasic = isBasic
      // 备件审核
      const BasicSH = 'customs:basic:shjm'
      const isBasicSH = checkButtons(this.$store.state.user.buttons, BasicSH)
      this.isBasicSH = isBasicSH
      // EAS同步
      const EasSynchronization = 'customs:basic:easSynchronization'
      const isEasSynchronization = checkButtons(this.$store.state.user.buttons, EasSynchronization)
      this.isEasSynchronization = isEasSynchronization
      // 手动同步
      const ManualSynchronization = 'customs:basic:manualSynchronization'
      const isManualSynchronization = checkButtons(this.$store.state.user.buttons, ManualSynchronization)
      this.isManualSynchronization = isManualSynchronization
      // 忽略同步
      const IgnoreSynchronization = 'customs:basic:ignoreSynchronization'
      const isIgnoreSynchronization = checkButtons(this.$store.state.user.buttons, IgnoreSynchronization)
      this.isIgnoreSynchronization = isIgnoreSynchronization
    },
    handleSelectionChange2(val) {
      this.multipleSelection = val
    },
    handleBatchDisable() {
      if (this.multipleSelection.length > 0) {
        this.$confirm('是否确定批量禁用?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.multipleSelection.forEach(row => {
            console.log('批量禁用', row)
            this.requestParam = {}
            this.requestParam.name = 'updatepartsEnable'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = row.id
            this.requestParam.parammaps.enable = 0
            PostDataByName(this.requestParam).then(() => {
              this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
            })
          })
          this.get_table_data()
          this.get_table_dataSH()
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消批量禁用'
          })
        })
      } else {
        this.$notify({ title: '提示', message: '请勾选禁用备件', type: 'error', duration: 2000 })
      }
    },
    handleBatchEnable() {
      if (this.multipleSelection.length > 0) {
        this.$confirm('是否确定批量启用?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.multipleSelection.forEach(row => {
            console.log('批量启用', row)
            this.requestParam = {}
            this.requestParam.name = 'updatepartsEnable'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = row.id
            this.requestParam.parammaps.enable = 1
            PostDataByName(this.requestParam).then(() => {
              this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
            })
          })
          this.get_table_data()
          this.get_table_dataSH()
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消批量启用'
          })
        })
      } else {
        this.$notify({ title: '提示', message: '请勾选启用备件', type: 'error', duration: 2000 })
      }
    },
    get_select_list() {
      GetDataByNames(this.requestParams).then(response => {
        this.units = response.data.getDictByName.list
        this.findAllProvider = response.data.findAllProvider.list
        this.findAllAssetType = response.data.findAllAssetType.list
        this.findAllPasture = response.data.getPastureRoleList.list // response.data.findAllPasture.list
        this.findAllDepart = response.data.findAllDepart.list
        this.findAllEmploye = response.data.findAllEmploye.list
        this.findAllCategory = response.data.findAllCategory.list
      })
    },
    getDownClassList() {
      getRecuData(this.getRecuListParm).then(response => {
        this.parentClass = response.data
      })
    },
    popoverHide(checkedIds, checkedData) {
      console.log(checkedIds, checkedData)
      if (checkedIds !== null) {
        if (checkedData.childrens == 0) {
          this.deptform.pid = checkedIds
          console.log(checkedData)
          if (checkedIds !== null) {
          // this.deptform.partCode = checkedData.partClassCode
            this.createTemp.partCode = checkedData.partClassCode
            this.createTemp.partClass = checkedData.partClassCode
            this.createTemp.partClassNameCode = checkedData.partClassNameCode
            this.getMaxCode()
          } else {
            this.createTemp.pid = -1
          }
          this.getMaxCode()
        } else {
          this.defaultCheckedKeys = []
          this.createTemp.tempPtypeCode = ''
          this.createTemp.temptypeCode = ''
          this.$message({
            type: 'warning',
            message: '请选择详细备件类别'
          })
        }
      } else {
        this.defaultCheckedKeys = []
        this.createTemp.partCode = ''
        this.createTemp.partClass = ''
        this.createTemp.partClassNameCode = ''
      }
    },
    getTypeList() {
      // this.listLoading = true
      this.getDeptListParm.parammaps = this.deptform
      GetDataByName(this.getDeptListParm).then(response => {
        this.listType = response.data
        if (response.data.list !== null) {
          this.listType = transData(response.data.list, 'id', 'pid', 'children')
          console.log(this.listType, '11111')
        }
        this.parentDept = this.listType
      })
    },
    getMaxCode() {
      this.requestParam.name = 'getPartCode'
      this.requestParam.parammaps = {}
      this.requestParam.parammaps.partCode = this.createTemp.partCode
      GetDataByName(this.requestParam).then(response => {
        console.log('备件类别选中data', response.data.list)
        if (response.data.list !== 0) {
          if (response.data.list[0].preCode === '') {
            this.createTemp.tempPtypeCode = this.deptform.typeCode + '.'
          } else {
            this.createTemp.tempPtypeCode = response.data.list[0].preCode
          }
          this.createTemp.temptypeCode = response.data.list[0].maxcode
          this.$nextTick(() => {
            // this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
            console.log(this.createTemp.partCode)
            this.$forceUpdate()
          })

          if (this.requestParam.parammaps.pid === -1) {
            this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
          }
        }
      })
    },
    get_table_data() {
      this.listLoading = true
      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.getdataListParm.parammaps.partClass = this.createTemp.partClass
      GetDataByName(this.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        this.list = response.data.list
        if (response.data.list !== null) {
          for (var i = 0; i < response.data.list.length; i++) {
            // console.log(response.data.list[i].srcpath)
            if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
              this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
              this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
              // console.log(111)
            } else {
              this.list[i].srcpath = ''
              this.list[i].picpath = ''
            }
          }
        }
        this.pageNum = response.data.pageNum
        this.pageSize = response.data.pageSize
        if (response.data.total) {
          this.total = response.data.total
        }
        // Just to simulate the time of the request
        setTimeout(() => {
          this.listLoading = false
        }, 100)
      })
    },
    statue: function(cellValue) {
      // console.log(cellValue.isZeroStock)
      if (cellValue.statue == 0) {
        return '审核中'
      } else if (cellValue.statue == 1) {
        return '已通过'
      } else if (cellValue.statue == 2) {
        return '未通过'
      } else if (cellValue.statue == 3) {
        return '历史数据'
      }
    },
    get_table_dataSH() {
      this.listLoadingSH = true
      if (this.$refs['inputDatetimeSH'] !== undefined && this.$refs['inputDatetimeSH'].value !== null) {
        this.getdataListParmSH.parammaps.startTime = this.$refs['inputDatetimeSH'].value[0]
        this.getdataListParmSH.parammaps.stopTime = this.$refs['inputDatetimeSH'].value[1]
      } else {
        this.getdataListParmSH.parammaps.startTime = ''
        this.getdataListParmSH.parammaps.stopTime = ''
      }
      this.getdataListParmSH.parammaps.partClass = this.createTemp.partClass
      GetDataByName(this.getdataListParmSH).then(response => {
        console.log('table数据', response.data.list)

        this.listSH = response.data.list
        if (response.data.list !== null) {
          for (var i = 0; i < response.data.list.length; i++) {
            if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
              this.listSH[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
              this.listSH[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
            } else {
              this.listSH[i].srcpath = ''
              this.listSH[i].picpath = ''
            }
          }
        }
        this.pageNumSH = response.data.pageNum
        this.pageSizeSH = response.data.pageSize
        if (response.data.total) {
          this.totalSH = response.data.total
        }
        setTimeout(() => {
          this.listLoadingSH = false
        }, 100)
      })
    },
    form_search() {
      this.listLoading = true
      if (this.getdataListParm.parammaps.inputDatetime === null) {
        this.getdataListParm.parammaps.inputDatetime = ''
      }
      this.getdataListParm.parammaps.partClass = this.deptform.typeCode
      this.getdataListParm.offset = 1
      this.get_table_data()
    },
    form_searchSH() {
      this.listLoadingSH = true
      if (this.getdataListParmSH.parammaps.inputDatetimeSH === null) {
        this.getdataListParmSH.parammaps.inputDatetimeSH = ''
      }
      this.getdataListParmSH.parammaps.partClass = this.deptform.typeCode
      this.getdataListParmSH.offset = 1
      this.get_table_dataSH()
    },
    form_see(row) {
      this.activeName = 'first'
      this.seeTemp = Object.assign({}, row) // copy obj
      if (this.seeTemp.srcpath !== undefined) {
        this.$set(this.seeTemp, 'srcpath', this.seeTemp.srcpath)
        this.$set(this.seeTemp, 'picpath', this.seeTemp.picpath)
      }
      console.log('查看上方数据(从table读取)', this.seeTemp)
      this.dialogStatus = 'see'
      this.dialogFormVisible_See = true
      this.getdataListSee.parammaps.partCode = row.partCode
      this.getSeeList()
      // 流程图
      var reason = '未通过原因:' + this.seeTemp.workflowNote
      if (this.seeTemp.statue === 0) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核' }]
        this.active = 1
      } else if (this.seeTemp.statue === 1) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
        this.active = 2
      } else if (this.seeTemp.statue === 2) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
        this.active = 2
      }
    },
    getSeeList() {
      this.listLoadingSee = true
      GetDataByName(this.getdataListSee).then(response => {
        console.log('查看牧场信息table数据', response.data.list)
        this.listSee = response.data.list
        this.pageNumSee = response.data.pageNum
        this.pageSizeSee = response.data.pageSize
        if (response.data.total) {
          this.totalSee = response.data.total
        }
        // Just to simulate the time of the request
        setTimeout(() => {
          this.listLoadingSee = false
        }, 100)
      })
    },
    handleClick(tab, event) {
      console.log(tab, event)
    },
    resetCreateTemp() {
      this.requestParam = { name: 'createAssetType', parammaps: {}}
      this.defaultCheckedKeys = []
      this.createTemp.partClassNameCode = ''
      this.createTemp.tempPtypeCode = ''
      this.createTemp.temptypeCode = ''
      this.createTemp.partClass = ''
      this.createTemp.partCode = ''
      this.createTemp.partName = ''
      this.createTemp.specification = ''
      this.createTemp.purpose = ''
      this.createTemp.unit = ''
      this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.note = ''
      this.createTemp.picId = ''
      this.createTemp.picpath = ''
    },
    form_add() {
      this.resetCreateTemp()
      this.createTemp.createPerson = this.$store.state.user.employeid
      this.partClassCreate = true
      this.partClassUpdate = false
      this.$nextTick(() => {
        this.$refs.upload.clearFiles()
        this.showUpload = false
        this.$refs['createTemp'].clearValidate()
      })
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.fileList = []
    },
    handlePicChange(file, fileList) {
      // console.log(response, '文件状态改变时的钩子response')
      console.log(file, '文件状态改变时的钩子file')
      console.log(fileList, '文件状态改变时的钩子fileList')
      console.log(this.createTemp, '文件状态改变时的钩子row')
      console.log(this.showUpload, '文件状态改变时的钩子row')

      if (fileList.length > 0) {
        this.$nextTick(() => {
          // this.$set(this.createTemp, 'showUpload', true)
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      console.log(this.createTemp)
    },
    handlePicSuccess(response, file, fileList) {
      if (fileList.length > 0) {
        this.$nextTick(() => {
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      if (this.createTemp.picpath === undefined || this.createTemp.picpath === '' || this.createTemp.picpath == -1) {
        this.$set(this.createTemp, 'picpath', response.execresult.LastInsertId)
      }
      console.log(this.createTemp, '文件上传成功时的钩子row')
    },
    handlePicRemove(file, fileList) {
      console.log(file, '文件列表移除文件时的钩子file---')
      console.log(fileList, '文件列表移除文件时的钩子fileList--')
      console.log(this.createTemp, '文件列表移除文件时的钩子row---')
      // console.log(this.dialogStatus)update
      if (this.dialogStatus === 'create') {
        if (fileList.length < 1) {
          this.showUpload = false
        }
        for (const key in this.createTemp) {
          if (this.createTemp[key] === file.response.execresult.LastInsertId) {
            this.$delete(this.createTemp, key)
          }
        }
      } else {
        if (fileList.length < 1) {
          this.$nextTick(() => {
            this.showUpload = false
          })
        }
        const url = file.url
        console.log(url, 'url')
        for (const key in this.createTemp) {
          console.log(this.createTemp[key], 'createTemp[key]')
          if (this.createTemp[key] === url) {
            console.log(key)
            if (key === 'picpath') {
              this.$delete(this.createTemp, 'picpath')
              this.$delete(this.createTemp, 'picId')
            }
          }
        }
      }
      console.log(this.createTemp, '文件列表移除文件时的钩子row')
    },
    handlePicPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    onLoad(e) {
      const img = e.target
      let width = 0
      if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
        width = img.width + 40
      }
      this.width = width + 'px'
    },
    beforeRemove(file, fileList) {
      console.log(file.response, '删除文件之前的钩子，参数为上传的文件和文件列表')
      return this.$confirm('删除当前图片, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
    },

    add_dialog_save() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
            this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
            return false
          }
          this.postDataPramas.common = { 'returnmap': '0' }
          this.postDataPramas.data = []
          this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
            'partName': this.createTemp.partName,
            'specification': this.createTemp.specification
          }}

          this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
            'picId': this.createTemp.picpath,
            'partClass': this.createTemp.partClass,
            // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
            'partCode': this.createTemp.partCode,
            'partName': this.createTemp.partName,
            'specification': this.createTemp.specification,
            'unit': this.createTemp.unit,
            'purpose': this.createTemp.purpose,
            'createPerson': this.createTemp.createPerson,
            'createTime': this.createTemp.createTime,
            'note': this.createTemp.note
          }}

          ExecDataByConfig(this.postDataPramas).then(response => {
            console.log('保存发送参数', this.postDataPramas)
            if (response.msg !== 'fail') {
              this.deptform.id = ''
              this.deptform.typeName = ''
              this.dialogFormVisible = false
              this.defaultCheckedKeys = []
              this.createTemp.partCode = ''
              this.createTemp.partClass = ''
              this.createTemp.partClassNameCode = ''
              this.get_table_data()
              this.getMaxCode()
              this.$nextTick(() => {
                this.$refs['createTemp'].clearValidate()
              })
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
            } else {
              this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
            }
          })
        }
      })
    },
    add_dialog_save_again() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
            this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
            return false
          }
          this.postDataPramas.common = { 'returnmap': '0' }
          this.postDataPramas.data = []
          this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
            'partName': this.createTemp.partName,
            'specification': this.createTemp.specification
          }}
          this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
            'picId': this.createTemp.picpath,
            'partClass': this.createTemp.partClass,
            // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
            'partCode': this.createTemp.partCode,
            'partName': this.createTemp.partName,
            'specification': this.createTemp.specification,
            'unit': this.createTemp.unit,
            'purpose': this.createTemp.purpose,
            'createPerson': this.createTemp.createPerson,
            'createTime': this.createTemp.createTime,
            'note': this.createTemp.note
          }}

          ExecDataByConfig(this.postDataPramas).then(response => {
            console.log('保存发送参数', this.postDataPramas)
            if (response.msg !== 'fail') {
              this.resetCreateTemp()
              this.get_table_data()
              this.$nextTick(() => {
                this.$refs['createTemp'].clearValidate()
              })
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
              this.handlePicRemove()
            } else {
              this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
            }
          })
        }
      })
    },
    handleDisable(row) {
      MessageBox.confirm('禁用后备件不可使用，是否禁用？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.requestParam.name = 'updatepartsEnable'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps.id = row.id
        this.requestParam.parammaps.enable = 0
        PostDataByName(this.requestParam).then(() => {
          this.get_table_data()
          this.get_table_dataSH()
          this.dialogFormVisible = false
          this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消禁用' })
      })
    },
    handleEnable(row) {
      this.requestParam.name = 'updatepartsEnable'
      this.requestParam.parammaps = {}
      this.requestParam.parammaps.id = row.id
      this.requestParam.parammaps.enable = 1
      PostDataByName(this.requestParam).then(() => {
        this.get_table_data()
        this.get_table_dataSH()
        this.dialogFormVisible = false
        this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
      })
    },
    form_edit(row) {
      this.createTemp = Object.assign({}, row) // copy obj
      this.createTemp.partClass = this.createTemp.eqClassName1 + '/' + this.createTemp.eqClassName2 + '/' + this.createTemp.eqClassName3
      this.dialogStatus = 'update'
      this.dialogFormVisible = true
      this.partClassCreate = false
      this.partClassUpdate = true

      const urlArray = []
      const fileList = []
      if (row.picpath == undefined) {
        urlArray.push()
      } else if (row.picpath == '') {
        urlArray.push()
      } else {
        urlArray.push(row.picpath)
      }
      for (let i = 0; i < urlArray.length; i++) {
        const urlObj = {}
        this.$set(urlObj, 'url', urlArray[i])
        fileList.push(urlObj)
      }
      this.$set(this.createTemp, 'fileList', fileList)
      console.log(this.createTemp)
      if (this.createTemp.fileList.length >= 1) {
        this.showUpload = true
      } else {
        this.showUpload = false
      }
    },
    edit_dialog_save() {
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
            this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
            return false
          }
          this.requestParam.name = 'updateParts'
          this.requestParam.parammaps.partClass = this.createTemp.partClass
          this.requestParam.parammaps.id = this.createTemp.id
          this.requestParam.parammaps.partCode = this.createTemp.partCode
          this.requestParam.parammaps.partName = this.createTemp.partName
          this.requestParam.parammaps.specification = this.createTemp.specification
          this.requestParam.parammaps.purpose = this.createTemp.purpose
          this.requestParam.parammaps.unit = this.createTemp.unit
          this.requestParam.parammaps.createPersonId = this.createTemp.createPersonId
          this.requestParam.parammaps.createTime = this.createTemp.createTime
          this.requestParam.parammaps.note = this.createTemp.note
          this.requestParam.parammaps.statue = 0
          const picpath = parseInt(this.createTemp.picpath)
          if (isNaN(picpath) == false) {
            this.requestParam.parammaps.picpath = this.createTemp.picpath
          } else {
            this.requestParam.parammaps.picpath = this.createTemp.picId
          }
          console.log('编辑保存发送data', this.requestParam.parammaps)
          PostDataByName(this.requestParam).then(response => {
            if (response.msg !== 'fail') {
              this.defaultCheckedKeys = []
              this.createTemp.partCode = ''
              this.createTemp.partClass = ''
              this.createTemp.partClassNameCode = ''
              this.get_table_data()
              this.get_table_dataSH()
              this.getMaxCode()
              this.dialogFormVisible = false
              this.$nextTick(() => {
                this.$refs['createTemp'].clearValidate()
              })
              this.$notify({
                title: '成功',
                message: '编辑成功',
                type: 'success',
                duration: 2000
              })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    handleDelate(row) {
      MessageBox.confirm('备件编号：' + row.partCode + ' ,备件名称：' + row.partName, '确认删除？', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.requestParam.name = 'deleteStock'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps['id'] = row.id
        PostDataByName(this.requestParam).then(() => {
          this.get_table_data()
          this.get_table_dataSH()
          this.dialogFormVisible = false
          this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
        })
      }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }) })
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
      this.dialogForm.imgList = fileList
      if (fileList) {
        this.$refs['uploadElement'].clearValidate()
      }
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map(v =>
        filterVal.map(j => {
          if (j === 'timestamp') {
            return parseTime(v[j])
          } else {
            return v[j]
          }
        })
      )
    },
    handleDownload() {
      console.log('点击了基础信息导出')
      console.log(this.tabName)
      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)
      if (this.tabName == 'first') {
        this.downloadParam.name = 'getStockList'
        this.downloadParam.parammaps = {}
        this.downloadParam.parammaps.partCode = this.getdataListParm.parammaps.partCode
        this.downloadParam.parammaps.partName = this.getdataListParm.parammaps.partName
        this.downloadParam.parammaps.partClass = this.getdataListParm.parammaps.partClass
        this.downloadParam.parammaps.startTime = this.getdataListParm.parammaps.startTime
        this.downloadParam.parammaps.stopTime = this.getdataListParm.parammaps.stopTime
        this.downloadParam.parammaps.specification = this.getdataListParm.parammaps.specification
      } else if (this.tabName == 'second') {
        this.downloadParam.name = 'getStockListSH'
        this.downloadParam.parammaps = {}
        this.downloadParam.parammaps.partCode = this.getdataListParmSH.parammaps.partCode
        this.downloadParam.parammaps.partName = this.getdataListParmSH.parammaps.partName
        this.downloadParam.parammaps.partClass = this.getdataListParmSH.parammaps.partClass
        this.downloadParam.parammaps.statue = this.getdataListParmSH.parammaps.statue
        this.downloadParam.parammaps.startTime = this.getdataListParmSH.parammaps.startTime
        this.downloadParam.parammaps.stopTime = this.getdataListParmSH.parammaps.stopTime
        this.downloadParam.parammaps.specification = this.getdataListParmSH.parammaps.specification
      }
      GetAccount(this.downloadParam).then(response => {
        if (response.data.list !== '') {
          this.percentage = 99
          setTimeout(() => {
            this.isPercentage = false
          }, 2000)
        }
        this.$nextTick(() => {
          const ExcelDatas = [
            {
              tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
              filterVal: ['partCode', 'partName', 'specification', 'unit', 'eqClassName1', 'eqClassName2', 'eqClassName3', 'createPerson', 'createTime'],
              tableDatas: response.data.list,
              sheetName: '备件基础信息'
            }
          ]
          json2excel(ExcelDatas, '备件基础信息', true, 'xlsx')
        })
      })
    },
    handleDownloadTemp() {
      this.requestParam.name = 'stockDownTemp'
      GetDataByName(this.requestParam).then(response => {
        this.$nextTick(() => {
          const ExcelDatas = [
            {
              tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
              filterVal: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
              tableDatas: response.data.list,
              sheetName: 'SheetJS'
            }
          ]
          json2excel(ExcelDatas, '备件基础信息模板', true, 'xlsx')
        })
      })
    },
    // 导入
    beforeImportExcel(file) {
      const isLt2M = file.size / 1024 / 1024 < 10
      if (!isLt2M) {
        this.$message.error('上传文件大小不能超过 10MB!')
      }
      return isLt2M
    },
    handleImportExcelSuccess(res, file) {
      if (res.msg === 'ok') {
        this.$message({
          title: '成功',
          message: '导入成功:' + res.data.success + '条!',
          type: 'success',
          duration: 2000
        })
        if (res.data.err_count > 0) {
          this.$notify({
            title: '失败',
            message: '导入失败:' + res.data.err_count + '条!',
            type: 'danger',
            duration: 2000
          })

          import('@/vendor/Export2Excel').then(excel => {
            const list1 = res.data.result
            const tHeader = [
              '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
            ]
            const filterVal = [
              '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
            ]
            const data1 = this.formatJson(filterVal, list1)
            excel.export_json_to_excel({
              header: tHeader,
              data: data1,
              filename: this.requestParam.parammaps.formType,
              autoWidth: true,
              bookType: 'xlsx'
            })
          })
        }
      } else {
        this.$notify({
          title: '失败',
          message: '上传失败',
          type: 'danger',
          duration: 2000
        })
      }
    },
    handleTabClick(val) {
      console.log('点击了基础信息/审核备件tab', val)
      // isFlowChart
      if (val.name == 'second') {
        this.isFlowChart = true
        this.isDisplayPasture = false
      } else {
        this.isFlowChart = false
        this.isDisplayPasture = true
      }
      this.get_table_data()
      this.get_table_dataSH()
    },
    handleExamine(row) {
      if (row == undefined) {
        this.examineTemp = this.seeTemp
        this.$set(this.seeTemp, 'SHstatue', 1)
        this.$set(this.seeTemp, 'workflowNote', '')
      } else {
        this.examineTemp = Object.assign({}, row)
        this.$set(this.examineTemp, 'SHstatue', 1)
        this.$set(this.examineTemp, 'workflowNote', '')
      }
      this.dialogStatus = 'examine'
      this.dialogFormVisible_Examine = true
      // this.examineTemp.statue = 1
      this.statueReason = false
      this.keyupSubmit()
    },
    changeStatue(val) {
      if (val == 2) {
        this.statueReason = true
      } else {
        this.statueReason = false
      }
    },
    keyupSubmit() {
      if (this.dialogStatus == 'examine' || this.dialogStatus == 'examines') {
        document.onkeydown = e => {
          const _key = window.event.keyCode
          if (_key === 13) {
            this.createExamineData()
          }
        }
      }
    },
    createExamineData() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['examineTemp'].validate(valid => {
        if (valid) {
          this.createExamineParm.parammaps.partCode = this.examineTemp.partCode
          GetDataByName(this.createExamineParm).then(response => {
            this.requestParam.name = 'partsCharge'
            this.requestParam.parammaps = {}
            this.requestParam.parammaps.id = this.examineTemp.id
            if (this.examineTemp.SHstatue === 1) {
              this.requestParam.parammaps.statue = 1
            } else {
              this.requestParam.parammaps.statue = 2
            }
            this.requestParam.parammaps.empId	 = Cookies.get('employeid')
            this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
            if (this.examineTemp.SHstatue === 1) {
              this.requestParam.parammaps.partCode = response.data.list[0].preCode + response.data.list[0].maxcode
            } else {
              this.requestParam.parammaps.partCode = this.createExamineParm.parammaps.partCode
            }
            PostDataByName(this.requestParam).then(response => {
              console.log('审核确认发送参数', this.requestParam)
              if (response.msg !== 'fail') {
                this.get_table_dataSH()
                this.dialogFormVisible_Examine = false
                this.dialogFormVisible_See = false
                this.statueReason = false
                this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
              } else {
                failproccess(response, this.$notify)
              }
            })
          })
        }
      })
    },
    handleSelectionChange(val) {
      console.log('选择', val.length)
      this.Selection = val.length
      this.selectionList = []
      if (val.length > 0) {
        for (let i = 0; i < val.length; i++) {
          const selectionObj = {}
          selectionObj.id = val[i].id
          selectionObj.statue = val[i].statue
          selectionObj.partCode = val[i].partCode
          this.selectionList.push(selectionObj)
        }
      }
    },
    handleExamines() {
      console.log('点击了批量审批', this.selectionList)
      if (this.Selection > 0) {
        // statue == 0
        for (let i = 0; i < this.selectionList.length; i++) {
          console.log(this.selectionList[i])
          if (this.selectionList[i].statue !== 0) {
            this.$message({ type: 'error', message: '通过审核的备件不可重复审核', duration: 2000 })
            return false
          }
        }
        this.dialogStatus = 'examines'
        this.dialogFormVisible_Examines = true
        this.keyupSubmit()
      } else {
        this.$message({ type: 'error', message: '请选择要审核的数据', duration: 2000 })
      }
    },
    createExamineDatas() {
      console.log(this.selectionList)
      this.postDataPramas.common = { 'returnmap': '0' }
      this.postDataPramas.data = []
      this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectionList }}
      this.postDataPramas.data[0].children = []
      this.postDataPramas.data[0].children[0] = { 'name': 'batchPartsSH', 'type': 'e', 'parammaps': {
        id: '@insertSpotList.id',
        empId: Cookies.get('employeid'),
        partCode: '@insertSpotList.partCode'
      }}
      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_Examines = false
          this.get_table_dataSH()
          this.$notify({
            title: '',
            message: '保存成功',
            type: 'success',
            duration: 2000
          })
        }
      })
    },
    handleEAS() {
      this.easStatus.dialogStatus = 'easStatus'
      this.easStatus.dialogFormVisible = true
      this.get_table_dataEasStatusLst()
    },
    get_table_dataEasStatusLst() {
      this.easStatus.listLoading = true
      GetDataByName(this.easStatus.getdataListParm).then(response => {
        if (response.data.list !== null) {
          this.easStatus.list = response.data.list
        } else {
          this.easStatus.list = []
        }
        this.easStatus.pageNum = response.data.pageNum
        this.easStatus.pageSize = response.data.pageSize
        if (response.data.total) {
          this.easStatus.total = response.data.total
        }
      })
      setTimeout(() => {
        this.easStatus.listLoading = false
      }, 100)
    },
    handleManual(row) {
      MessageBox.confirm('是否确认同步此数据至EAS？', {
        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
      }).then(() => {
        this.requestParam = {}
        this.requestParam.typeIn = row.typeIn
        this.requestParam.billCode = row.billCode
        EasSync(this.requestParam).then((response) => {
          if (response.msg !== 'fail') {
            this.$notify({ title: '成功', message: '手动同步成功', type: 'success', duration: 2000 })
            this.get_table_dataEasStatusLst()
            this.get_table_data()
          } else {
            this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
            this.get_table_dataEasStatusLst()
            this.get_table_data()
          }
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消手动同步' })
      })
    },
    handleIgnore(row) {
      MessageBox.confirm('是否确认忽略同步此数据？', {
        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
      }).then(() => {
        this.requestParam = {}
        this.requestParam.name = 'updatepartsSync'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps.issync = '3'
        this.requestParam.parammaps.id = row.id
        PostDataByName(this.requestParam).then((response) => {
          if (response.msg !== 'fail') {
            this.$notify({ title: '成功', message: '忽略同步成功', type: 'success', duration: 2000 })
            this.get_table_dataEasStatusLst()
            this.get_table_data()
          } else {
            this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
            this.get_table_dataEasStatusLst()
            this.get_table_data()
          }
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消忽略同步' })
      })
    }
  }
}
</script>
<style lang="scss">
  .typeSelect span .el-popover__reference .el-input--suffix {
    top:-3px;
    .el-input__inner{
      height:40px !important;
    }
  }
  .pasture-title{
    height: 50px;
    b{
      line-height: 50px;
      margin: 0 20px;
    }
  }
  .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;
  }
  .hide .el-upload--picture-card {
    display: none;
  }
</style>
