<template>
  <div>
    <el-card>
      <div style="padding: 10px;background-color:#F5F5F5">
        <span>关键字:</span>
        <el-input v-model="keyword" style="width: 200px;height: 50px" class="input11" @input="pageCurrent = 1,searchTable()" />
        <el-select v-model="machineShop" style="width:180px;margin-left: 10px" clearable class="select12" placeholder="请选择车间" @change="pageCurrent = 1;searchProductionLine();searchRegion();searchTable()">
          <el-option
            v-for="item in machineShops1"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <el-select v-model="productionLine" style="width:180px;margin-left: 20px" clearable class="select12" placeholder="请选择产线" @change="pageCurrent = 1;searchRegion();searchTable()">
          <el-option
            v-for="item in productionLines1"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <el-select v-model="region" style="width:180px;margin-left: 20px" clearable class="select12" placeholder="请选择工序" @change="pageCurrent = 1;searchTable()">
          <el-option
            v-for="item in regions1"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <el-button style="float: right;right:5%;font-size: 30px;position: absolute" type="text" icon="el-icon-circle-plus-outline" @click="addMachine('form')"/>
      </div>
      <el-table
        v-loading="loading"
        :data="tableData"
        :header-cell-style="tableHeaderColor"
        :cell-style="tableColor"
        element-loading-text="数据加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.2)"
        tooltip-effect="dark"
        style="width: 100%"
        height="700px"
        @sort-change="sortChange">
        <el-table-column align="left" label="图片" width="150px" show-overflow-tooltip>
          <template slot-scope="scope">
            <div style="width: 110px;height: 90px">
              <img v-if="scope.row.图片" :src="scope.row.图片" width="100%" height="100%" style="border-radius:5px 5px 5px 5px;overflow:hidden;">
              <img v-else src="static/image.png" width="100%" height="100%" style="border-radius:5px 5px 5px 5px;overflow:hidden;">
            </div>
          </template>
        </el-table-column>
        <el-table-column align="left" label="设备编号" prop="设备编号" min-width="90" show-overflow-tooltip sortable="custom">
          <template slot-scope="scope">
            <div style="cursor: pointer; color: #1e6abc;text-decoration: underline;" @click="searchMachine(scope.row)">{{ scope.row.设备编号 }}</div>
          </template>
        </el-table-column>
        <el-table-column align="left" label="设备名称" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.设备名称 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="承包人" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.承包人 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="网格长" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.网格长 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="车间" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.车间 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="产线" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            <span >{{ scope.row.产线 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="工序" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.工序 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="ABC指标" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.ABC指标 }}</span>
          </template>
        </el-table-column>
        <el-table-column align="left" label="状态" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.状态代码 === 1" color="forestgreen" size="mini" type="info" >{{ scope.row.状态 }}</el-tag>
            <el-tag v-if="scope.row.状态代码 === 2" color="rgb(252,175,63)" size="mini" type="info" >{{ scope.row.状态 }}</el-tag>
            <el-tag v-if="scope.row.状态代码 === 3" color="rgb(226,0,21)" size="mini" type="info" >{{ scope.row.状态 }}</el-tag>
            <el-tag v-if="scope.row.状态代码 === 4" color="rgb(0,142,207)" size="mini" type="info" >{{ scope.row.状态 }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="left" label="生命周期(时间)" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-progress :percentage="scope.row.生命周期时间" :stroke-width="26" :text-inside="true"/>
          </template>
        </el-table-column>
        <el-table-column align="left" label="操作" >
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-edit" @click="editMachine(scope.row)"/>
            <el-button type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"/>
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin-top: 10px;">
        <el-pagination
          v-if="!loading"
          :current-page="pageCurrent"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="pageSize"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"/>
      </div>
      <el-dialog :title="title" :visible.sync="dialogFormVisible" center width="60%" >
        <el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="700px" label-padding-bottom="0px">
          <el-card>
            <el-row>
              <el-col :span="17">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="资产号" prop="assetNumber">
                      <el-input v-model="form.assetNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备编号" prop="machineNumber">
                      <el-input v-model="form.machineNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备名称:" prop="machineName">
                      <el-input v-model="form.machineName" style="width: 200px;margin-left: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="承包人:" prop="people1">
                      <el-select v-model="form.people1" style="width:200px" >
                        <el-option
                          v-for="item in peoples"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="网格长:" prop="people2">
                      <el-select v-model="form.people2" style="width:200px" >
                        <el-option
                          v-for="item in peoples"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="ABC指标:" prop="quota">
                      <el-select v-model="form.quota" style="width:200px" >
                        <el-option
                          v-for="item in quotas"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="车间:" prop="machineShop">
                      <el-select v-model="form.machineShop" style="width:200px" @change="getProductionLine()">
                        <el-option
                          v-for="item in machineShops"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="产线:" prop="productionLine">
                      <el-select v-model="form.productionLine" style="width:200px" @change="getRegion()">
                        <el-option
                          v-for="item in productionLines"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="工序:" prop="region">
                      <el-select v-model="form.region" style="width:200px" >
                        <el-option
                          v-for="item in regions"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-col>
              <el-col :span="7" align="center">
                <div class="avatar-uploader">
                  <img v-if="imageUrl" :src="imageUrl" class="avatar">
                  <img v-else src="static/image.png" class="avatar">
                </div>
                <el-upload
                  ref="upload"
                  :action="action"
                  :data="Data"
                  :limit="1"
                  :show-file-list="true"
                  :file-list="fileList"
                  :auto-upload="false"
                  :on-change="fileChange"
                  :on-exceed="fileExceed"
                  :on-remove="fileRemove"
                  :on-success="fileSuccess"
                  accept=".jpg,.png">
                  <el-button slot="trigger" style="margin-top: 10px" size="small" plain type="primary">选取文件</el-button>
                </el-upload>
              </el-col>
            </el-row>
            <div class="machine-divider"/>
            <el-tabs v-model="activeName">
              <el-tab-pane label="基本信息" name="1">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="成本中心">
                      <el-input v-model="form.costCenter" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修起始日期">
                      <el-date-picker
                        v-model="form.warrantyStartDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息1">
                      <el-input v-model="form.additionalInformation1" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="工作中心代码">
                      <el-input v-model="form.workCenterCode" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修终止日期">
                      <el-date-picker
                        v-model="form.warrantyEndDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息2">
                      <el-input v-model="form.additionalInformation2" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="制造商" name="2">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="制造商">
                      <el-input v-model="form.manufacturer" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备型号">
                      <el-input v-model="form.model" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="生产序列号">
                      <el-input v-model="form.productionSerialNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="供应商">
                      <el-input v-model="form.supplier" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="制造日期">
                      <el-date-picker
                        v-model="form.manufactureDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="生命周期管理" name="3">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="开始日期">
                      <el-date-picker
                        v-model="form.startDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="警告日期">
                      <el-date-picker
                        v-model="form.warningDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="报废日期">
                      <el-date-picker
                        v-model="form.scrapDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="资产折旧" name="4">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="原值">
                      <el-input v-model="form.original" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="资产价值">
                      <el-input v-model="form.assets" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="剩余价值">
                      <el-input v-model="form.lave" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
            </el-tabs>
            <el-row>
              <div style="float: right">
                <el-button style="margin-top: 20px" class="button12" @click="callOff('form')">取消</el-button>
                <el-button :disabled="!isMachineValue" class="button11" @click="submit('form')">确 定</el-button>
                <el-button :disabled="isMachineValue" class="button11" @click="openFile('form3')">上传文件</el-button>
              </div>
            </el-row>
          </el-card>
        </el-form>
      </el-dialog>
      <el-dialog :visible.sync="dialogFormVisible4" title="修改设备" center width="60%" >
        <el-form ref="form4" :model="form4" :rules="rules4" label-position="top" label-width="700px" label-padding-bottom="0px">
          <el-card>
            <el-row>
              <el-col :span="17">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="资产号" prop="assetNumber">
                      <el-input v-model="form4.assetNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备编号" prop="machineNumber">
                      <el-input v-model="form4.machineNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备名称:" prop="machineName">
                      <el-input v-model="form4.machineName" style="width: 200px;margin-left: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="承包人:" prop="people1">
                      <el-select v-model="form4.people1" style="width:200px" >
                        <el-option
                          v-for="item in peoples"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="网格长:" prop="people2">
                      <el-select v-model="form4.people2" style="width:200px" >
                        <el-option
                          v-for="item in peoples"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="ABC指标:" prop="quota">
                      <el-select v-model="form4.quota" style="width:200px" >
                        <el-option
                          v-for="item in quotas"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="车间:" prop="machineShop">
                      <el-select v-model="form4.machineShop" style="width:200px" @change="form4.productionLine = '',form4.region = '',getProductionLine1()">
                        <el-option
                          v-for="item in machineShops"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="产线:" prop="productionLine">
                      <el-select v-model="form4.productionLine" style="width:200px" @change="form4.region = '',getRegion1()">
                        <el-option
                          v-for="item in productionLines"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="工序:" prop="region">
                      <el-select v-model="form4.region" style="width:200px" >
                        <el-option
                          v-for="item in regions"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"/>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-col>
              <el-col :span="7" align="center">
                <div class="avatar-uploader">
                  <img v-if="imageUrl" :src="imageUrl" class="avatar">
                  <img v-else src="static/image.png" class="avatar">
                </div>
                <el-upload
                  ref="uploadEdit"
                  :action="action"
                  :data="Data"
                  :limit="1"
                  :show-file-list="true"
                  :file-list="imgList"
                  :auto-upload="false"
                  :on-change="fileChange"
                  :on-exceed="fileExceed"
                  :on-remove="fileRemove"
                  :on-success="fileEditSuccess"
                  accept=".jpg,.png">
                  <el-button slot="trigger" style="margin-top: 10px" size="mini" icon="el-icon-edit-outline" circle/>
                  <el-tooltip class="item" effect="light" content="上传" placement="bottom">
                    <el-button style="margin-left: 10px;" size="mini" icon="el-icon-check" circle @click="EditFile"/>
                  </el-tooltip>
                  <el-tooltip class="item" effect="light" content="删除" placement="bottom">
                    <el-button style="margin-left: 10px;" size="mini" icon="el-icon-delete" circle @click="deleteMachineImg"/>
                  </el-tooltip>
                </el-upload>
              </el-col>
            </el-row>
            <div class="machine-divider"/>
            <el-tabs v-model="activeName">
              <el-tab-pane label="基本信息" name="1">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="成本中心">
                      <el-input v-model="form4.costCenter" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修起始日期">
                      <el-date-picker
                        v-model="form4.warrantyStartDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息1">
                      <el-input v-model="form4.additionalInformation1" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="工作中心代码">
                      <el-input v-model="form4.workCenterCode" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修终止日期">
                      <el-date-picker
                        v-model="form4.warrantyEndDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息2">
                      <el-input v-model="form4.additionalInformation2" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="制造商" name="2">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="制造商">
                      <el-input v-model="form4.manufacturer" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备型号">
                      <el-input v-model="form4.model" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="生产序列号">
                      <el-input v-model="form4.productionSerialNumber" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="供应商">
                      <el-input v-model="form4.supplier" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="制造日期">
                      <el-date-picker
                        v-model="form4.manufactureDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="生命周期管理" name="3">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="开始日期">
                      <el-date-picker
                        v-model="form4.startDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="警告日期">
                      <el-date-picker
                        v-model="form4.warningDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="报废日期">
                      <el-date-picker
                        v-model="form4.scrapDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="资产折旧" name="4">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="原值">
                      <el-input v-model="form4.original" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="资产价值">
                      <el-input v-model="form4.assets" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="剩余价值">
                      <el-input v-model="form4.lave" style="width: 200px;margin-top: 0px"/>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
            </el-tabs>
            <el-row>
              <div style="float: right">
                <el-button style="margin-top: 20px" class="button12" @click="callOff4('form4')">取消</el-button>
                <el-button class="button11" @click="submit1('form4')">确 定</el-button>
                <el-button class="button11" @click="openFile('form3')">上传文件</el-button>
              </div>
            </el-row>
          </el-card>
        </el-form>
      </el-dialog>
      <el-dialog :title="title2" :visible.sync="dialogFormVisible2" center width="60%" >
        <el-form ref="form2" :model="form2" :rules="rules2" label-position="top" label-width="700px" label-padding-bottom="0px">
          <span style="font-size: 22px">设备信息</span>
          <el-card style="margin-top: 10px">
            <el-row>
              <el-col :span="18">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="资产号" prop="assetNumber">
                      <div class="div">{{ form2.assetNumber }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备编号:" prop="description">
                      <div class="div">{{ form2.machineNumber }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="设备名称:" prop="description">
                      <div class="div">{{ form2.machineName }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="承包人:" prop="deviceGroup">
                      <div class="div">{{ form2.people1 }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="网格长:" prop="people">
                      <div class="div">{{ form2.people2 }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="ABC指标:" prop="quota">
                      <div class="div">{{ form2.quota }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="车间:" prop="machineShop">
                      <div class="div">{{ form2.machineShop }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="产线:" prop="productionLine">
                      <div class="div">{{ form2.productionLine }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="工序:" prop="region">
                      <div class="div">{{ form2.region }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-col>
              <el-col :span="6">
                <div class="avatar-uploader" >
                  <img v-if="form2.imageUrl" :src="form2.imageUrl" class="avatar">
                  <img v-else src="static/image.png" class="avatar">
                </div>
              </el-col>
            </el-row>
            <div class="machine-divider"/>
            <el-tabs v-model="activeName">
              <el-tab-pane label="基本信息" name="1">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="成本中心">
                      <div class="div">{{ form2.costCenter }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修起始日期">
                      <div class="div">{{ form2.warrantyStartDate }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息1">
                      <div class="div">{{ form2.additionalInformation1 }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="工作中心代码">
                      <div class="div">{{ form2.workCenterCode }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="保修终止日期">
                      <div class="div">{{ form2.warrantyEndDate }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="附加信息2">
                      <div class="div">{{ form2.additionalInformation2 }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="制造商" name="2">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="制造商">
                      <div class="div">{{ form2.manufacturer }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="型号">
                      <div class="div">{{ form2.model }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="生产序列号">
                      <div class="div">{{ form2.productionSerialNumber }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="供应商">
                      <div class="div">{{ form2.supplier }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="制造日期">
                      <div class="div">{{ form2.manufactureDate }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="生命周期管理" name="3">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="开始日期">
                      <div class="div">{{ form2.startDate }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="警告日期">
                      <div class="div">{{ form2.warningDate }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="报废日期">
                      <div class="div">{{ form2.scrapDate }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="资产折旧" name="4">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="原值">
                      <div class="div">{{ form2.original }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="资产价值">
                      <div class="div">{{ form2.assets }}</div>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="剩余价值">
                      <div class="div">{{ form2.lave }}</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-tab-pane>
            </el-tabs>
          </el-card>
          <el-card style="margin-top: 20px">
            <el-tabs v-model="activeName1" @tab-click="handleClickMachineInfo">
              <el-tab-pane label="标准文件" name="1">
                <el-row>
                  <div v-for="(file, key) in hadFile" :key="key">
                    <div class="wrapper">
                      <div class="content">
                        <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
                        <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
                        <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
                        <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
                        <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
                        <div v-else class="icon"><svg-icon icon-class="file" /></div>
                        <a id="appUrl2" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
                      </div>
                    </div>
                  </div>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="技术参考文件" name="2">
                <el-row>
                  <div v-for="(file, key) in hadFile1" :key="key">
                    <div class="wrapper">
                      <div class="content">
                        <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
                        <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
                        <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
                        <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
                        <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
                        <div v-else class="icon"><svg-icon icon-class="file" /></div>
                        <a id="appUrl3" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
                      </div>
                    </div>
                  </div>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="备件列表" name="3">
                <el-table
                  :data="spareTableData2"
                  :header-cell-style="tableHeaderColor"
                  :cell-style="tableColor3"
                  element-loading-text="数据加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.2)"
                  tooltip-effect="dark"
                  height="402px"
                  style="width: 75%">
                  <el-table-column align="left" label="SAP编码" prop="SAP编码" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <div>{{ scope.row.SAP编码 }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="备件名称" prop="备件名称" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.物料描述 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="库存地点" prop="库存地点" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.库存地点 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="库存架位" prop="库存架位" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.库存架位 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="一级帐数" prop="数量" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.SAP库存数量 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="二级帐数" prop="二级帐" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.二级帐 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="单价" prop="单价" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.单价 }}</span>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="备件更换历史" name="4">
                <el-table
                  v-loading="loading"
                  :data="spareTableData"
                  :header-cell-style="tableHeaderColor"
                  :cell-style="tableColor1"
                  element-loading-text="数据加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.2)"
                  tooltip-effect="dark"
                  height="400px"
                  style="width: 70%">
                  <el-table-column align="left" label="SAP编码" prop="SAP编码" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <div>{{ scope.row.SAP编码 }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="备件名称" prop="备件名称" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.备件名称 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="一级帐数" prop="数量" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.数量 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="二级帐数" prop="二级帐" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.二级帐 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="操作时间" prop="操作时间" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.操作时间 }}</span>
                    </template>
                  </el-table-column>
                </el-table>
                <div class="block" style="margin-top: 10px;">
                  <el-pagination
                    v-if="!loading"
                    :current-page="sparePageCurrent"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="sparePageSize"
                    :total="spareTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    @size-change="handleSizeChange1"
                    @current-change="handleCurrentChange1"/>
                </div>
              </el-tab-pane>
              <el-tab-pane label="EM" name="5">
                <el-table
                  v-loading="loading"
                  :data="orderTableData"
                  :header-cell-style="tableHeaderColor"
                  :cell-style="tableColor2"
                  element-loading-text="数据加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.2)"
                  tooltip-effect="dark"
                  height="400px"
                  style="width: 90%">
                  <el-table-column align="left" label="工单号" prop="工单号" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag color="rgb(153,153,153)" size="mini" type="info" style="cursor: pointer" @click="orderClick(scope.row)">{{ scope.row.工单号 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障类别" prop="故障类别" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障名称 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障现象" prop="故障现象" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障现象 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="状态" prop="状态" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag v-if="scope.row.状态代码 === 1 || scope.row.状态代码 === 2" color="red" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 4" color="rgb(0,142,207)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 3" color="rgb(255,165,0)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 5" color="green" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="开始时间" prop="开始时间" min-width="130" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.开始时间 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="持续时长" prop="持续时长" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.持续时长 }}</span>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="CM" name="6">
                <el-table
                  v-loading="loading"
                  :data="orderTableData1"
                  :header-cell-style="tableHeaderColor"
                  :cell-style="tableColor2"
                  element-loading-text="数据加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.2)"
                  tooltip-effect="dark"
                  height="400px"
                  style="width: 90%">
                  <el-table-column align="left" label="工单号" prop="工单号" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag color="rgb(153,153,153)" size="mini" type="info" style="cursor: pointer" @click="orderClick(scope.row)">{{ scope.row.工单号 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障类别" prop="故障类别" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障名称 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障现象" prop="故障现象" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障现象 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="状态" prop="状态" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag v-if="scope.row.状态代码 === 1 || scope.row.状态代码 === 2" color="red" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 4" color="rgb(0,142,207)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 3" color="rgb(255,165,0)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 5" color="green" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="开始时间" prop="开始时间" min-width="130" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.开始时间 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="持续时长" prop="持续时长" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.持续时长 }}</span>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="PM" name="7">
                <el-table
                  v-loading="loading"
                  :data="orderTableData2"
                  :header-cell-style="tableHeaderColor"
                  :cell-style="tableColor2"
                  element-loading-text="数据加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.2)"
                  tooltip-effect="dark"
                  height="400px"
                  style="width: 90%">
                  <el-table-column align="left" label="工单号" prop="工单号" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag color="rgb(153,153,153)" size="mini" type="info" style="cursor: pointer" @click="orderClick(scope.row)">{{ scope.row.工单号 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障类别" prop="故障类别" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障名称 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="故障现象" prop="故障现象" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.故障现象 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="状态" prop="状态" min-width="80" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <el-tag v-if="scope.row.状态代码 === 1 || scope.row.状态代码 === 2" color="red" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 4" color="rgb(0,142,207)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 3" color="rgb(255,165,0)" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                      <el-tag v-if="scope.row.状态代码 === 5" color="green" type="info" size="mini" >{{ scope.row.状态 }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="开始时间" prop="开始时间" min-width="130" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.开始时间 }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column align="left" label="持续时长" prop="持续时长" min-width="120" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <span>{{ scope.row.持续时长 }}</span>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-form>
      </el-dialog>
      <el-dialog :visible.sync="dialogFormVisible3" title="上传设备文件" center width="40%" >
        <el-form ref="form3" :model="form3" :rules="rules3" label-position="top" label-width="700px" label-padding-bottom="0px">
          <el-card>
            <el-tabs v-model="activeName2" @tab-click="handleClick">
              <el-tab-pane label="标准文件" name="1">
                <el-row>
                  <div v-for="(file, key) in hadFile" :key="key">
                    <div class="wrapper">
                      <div class="content">
                        <div class="action">
                          <a class="delete" @click="deleteFileData(file.id)">删除</a>
                        </div>
                        <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
                        <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
                        <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
                        <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
                        <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
                        <div v-else class="icon"><svg-icon icon-class="file" /></div>
                        <a id="appUrl" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
                      </div>
                    </div>
                  </div>
                </el-row>
                <el-row>
                  <div style="float: right">
                    <el-upload
                      :action="action"
                      :on-success="uploadSuccess"
                      :on-error="uploadFailure"
                      :show-file-list="showFileList"
                      :file-list="fileList"
                      class="upload-demo"
                      style="display: inline"
                      multiple>
                      <el-button class="button11" @click="batchImportOfDrawings">点击上传</el-button>
                    </el-upload>
                    <el-button style="margin-top: 20px" class="button12" @click="dialogFormVisible3 =false">关 闭</el-button>
                  </div>
                </el-row>
              </el-tab-pane>
              <el-tab-pane label="技术参考文件" name="2">
                <el-row>
                  <div v-for="(file, key) in hadFile1" :key="key">
                    <div class="wrapper">
                      <div class="content">
                        <div class="action">
                          <a class="delete" @click="deleteFileData1(file.id)">删除</a>
                        </div>
                        <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
                        <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
                        <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
                        <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
                        <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
                        <div v-else class="icon"><svg-icon icon-class="file" /></div>
                        <a id="appUrl1" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
                      </div>
                    </div>
                  </div>
                </el-row>
                <el-row>
                  <div style="float: right">
                    <el-upload
                      :action="action1"
                      :on-success="uploadSuccess1"
                      :on-error="uploadFailure1"
                      :show-file-list="showFileList1"
                      :file-list="fileList1"
                      class="upload-demo"
                      style="display: inline"
                      multiple>
                      <el-button class="button11" @click="batchImportOfDrawings1">点击上传</el-button>
                    </el-upload>
                    <el-button style="margin-top: 20px" class="button12" @click="dialogFormVisible3 =false">关 闭</el-button>
                  </div>
                </el-row>
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-form>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
import { ExecDatabase } from '@/main'
import { MESUploadFileEquipment, MESDownloadFile } from '@/utils/request'
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      showFileList: false,
      showFileList1: false,
      hadFile: [],
      hadFile1: [],
      keyword: '', // 关键词
      keyword_check: 0,
      loading: false,
      tableData: [],
      order: '',
      title: '',
      dialogFormVisible: false,
      dialogFormVisible4: false,
      peoples: [], // 人员
      quotas: [], // 指标
      machineShops: [], // 车间
      regions: [], // 工序
      productionLines: [], // 产线
      machineShops1: [], // 车间
      regions1: [], // 工序
      productionLines1: [], // 产线
      machineShop: '', // 车间
      region: '', // 工序
      productionLine: '', // 产线
      machineShop_check: 0,
      region_check: 0,
      productionLine_check: 0,
      action: '',
      action1: '',
      imageUrl: '',
      imageUrl1: '',
      fileList: [],
      fileList1: [],
      imgList: [],
      Data: {},
      activeName: '1',
      activeName1: '1',
      activeName2: '1',
      form: {
        assetNumber: '', // 资产号
        machineNumber: '', // 设备编号
        machineName: '', // 设备名称
        people1: '', // 承包人
        people2: '', // 网格长
        quota: '', // 指标
        machineShop: '', // 车间
        region: '', // 工序
        productionLine: '', // 产线
        costCenter: '', // 成本中心
        warrantyStartDate: '', // 保修起始日期
        additionalInformation1: '', // 附加信息1
        workCenterCode: '', // 工作中心代码
        warrantyEndDate: '', // 保修终止日期
        additionalInformation2: '', // 附加信息2
        manufacturer: '', // 制造商
        model: '', // 型号
        productionSerialNumber: '', // 生产序列号
        supplier: '', // 供应商
        manufactureDate: '', // 制造日期
        startDate: '', // 开始日期
        warningDate: '', // 警告日期
        scrapDate: '', // 报废日期
        original: '',
        assets: '',
        lave: ''
      },
      rules: {
        assetNumber: [{ required: true, message: '请输入资产号', trigger: 'blur' }],
        machineName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
        machineNumber: [{ required: true, message: '请输入设备编号', trigger: 'blur' }],
        people1: [{ required: true, message: '请输入承包人', trigger: 'blur' }],
        people2: [{ required: true, message: '请输入网格长', trigger: 'blur' }],
        machineShop: [{ required: true, message: '请输入车间', trigger: 'blur' }],
        region: [{ required: true, message: '请输入工序', trigger: 'blur' }],
        productionLine: [{ required: true, message: '请输入产线', trigger: 'blur' }],
        quota: [{ required: true, message: '请输入ABC指标', trigger: 'blur' }]
      },
      form4: {
        assetNumber: '', // 资产号
        machineNumber: '', // 设备编号
        machineName: '', // 设备名称
        people1: '', // 承包人
        people2: '', // 网格长
        quota: '', // 指标
        machineShop: '', // 车间
        region: '', // 工序
        productionLine: '', // 产线
        costCenter: '', // 成本中心
        warrantyStartDate: '', // 保修起始日期
        additionalInformation1: '', // 附加信息1
        workCenterCode: '', // 工作中心代码
        warrantyEndDate: '', // 保修终止日期
        additionalInformation2: '', // 附加信息2
        manufacturer: '', // 制造商
        model: '', // 型号
        productionSerialNumber: '', // 生产序列号
        supplier: '', // 供应商
        manufactureDate: '', // 制造日期
        startDate: '', // 开始日期
        warningDate: '', // 警告日期
        scrapDate: '', // 报废日期
        original: '',
        assets: '',
        lave: ''
      },
      rules4: {
        assetNumber: [{ required: true, message: '请输入资产号', trigger: 'blur' }],
        machineName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
        machineNumber: [{ required: true, message: '请输入设备编号', trigger: 'blur' }],
        people1: [{ required: true, message: '请输入承包人', trigger: 'blur' }],
        people2: [{ required: true, message: '请输入网格长', trigger: 'blur' }],
        machineShop: [{ required: true, message: '请输入车间', trigger: 'blur' }],
        region: [{ required: true, message: '请输入工序', trigger: 'blur' }],
        productionLine: [{ required: true, message: '请输入产线', trigger: 'blur' }],
        quota: [{ required: true, message: '请输入ABC指标', trigger: 'blur' }]
      },
      aaa: -1,
      machineValue: '',
      title2: '',
      dialogFormVisible2: false,
      form2: {
        assetNumber: '', // 资产号
        machineNumber: '', // 设备编号
        machineName: '', // 设备名称
        people1: '', // 承包人
        people2: '', // 网格长
        quota: '', // 指标
        machineShop: '', // 车间
        region: '', // 工序
        productionLine: '', // 产线
        costCenter: '', // 成本中心
        warrantyStartDate: '', // 保修起始日期
        additionalInformation1: '', // 附加信息1
        workCenterCode: '', // 工作中心代码
        warrantyEndDate: '', // 保修终止日期
        additionalInformation2: '', // 附加信息2
        manufacturer: '', // 制造商
        model: '', // 型号
        productionSerialNumber: '', // 生产序列号
        supplier: '', // 供应商
        manufactureDate: '', // 制造日期
        startDate: '', // 开始日期
        warningDate: '', // 警告日期
        scrapDate: '', // 报废日期
        imageUrl: '',
        original: '',
        assets: '',
        lave: ''
      },
      rules2: {},
      title3: '',
      dialogFormVisible3: false,
      form3: {
      },
      isMachineValue: true,
      rules3: {},
      loadingFiles: false,
      tableDataFiles: [],
      spareTableData: [],
      spareTableData2: [],
      orderTableData: [],
      orderTableData1: [],
      orderTableData2: [],
      spareTotal: 0, // 总条数
      sparePageSize: 10, // 每页显示条数
      sparePageCurrent: 1, // 后台获取页
      total: 0, // 总条数
      pageSize: 10, // 每页显示条数
      pageCurrent: 1 // 后台获取页
    }
  },
  computed: {
    ...mapGetters([
      'sidebar',
      'avatar',
      'name',
      'id',
      'token',
      'cname'
    ])
  },
  created() {
    this.searchTable()
    this.searchMachineShop()
  },
  methods: {
    tableHeaderColor() {
      return 'background-color: rgb(250, 250, 250);' +
        'height:20px;' +
        'border-bottom: 4px rgb(170, 170, 170) solid;color: rgb(35, 35, 35);' +
        'font-weight: 5000;' +
        'padding: 5px 10px'
    },
    tableColor() {
      return 'border-color: #E8E8E8;padding: 6px 0px 4px 0px'
    },
    tableColor1() {
      return 'border-color: #E8E8E8;padding: 7px 0px 5px 0px'
    },
    tableColor2() {
      return 'border-color: #E8E8E8;padding: 10px 0px 8px 0px'
    },
    uploadManual() {
      this.hadFile = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['类型', 1]
      var Data = this.CreateData('11', '基础数据_设备文件_查询数据', param)
      ExecDatabase(Data).then(res => {
        this.suffix = res.data
        if (res.data.length > 0) {
          const server = `${MESDownloadFile}`.split('/')
          res.data.map(item => {
            this.hadFile.push({
              url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
              name: `${item.name}.${item.suffix}`,
              suffix: item.suffix,
              id: item.num
            })
          })
        }
      })
    },
    deleteFileData(id) {
      var param = []
      param[0] = ['num', id]
      var Data = this.CreateData('12', '基础数据_设备文件_删除数据', param)
      ExecDatabase(Data).then(res => {
        if (res.data[0].result === '1') {
          this.$message.success('删除成功')
          this.hadFile = []
          var param = []
          param[0] = ['设备代码', this.machineValue]
          param[1] = ['类型', 1]
          var Data = this.CreateData('11', '基础数据_设备文件_查询数据', param)
          ExecDatabase(Data).then(res => {
            this.suffix = res.data
            if (res.data.length > 0) {
              const server = `${MESDownloadFile}`.split('/')
              res.data.map(item => {
                this.hadFile.push({
                  url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
                  name: `${item.name}.${item.suffix}`,
                  suffix: item.suffix,
                  id: item.num
                })
              })
            }
          })
        } else {
          this.$message.success('删除失败')
        }
      })
    },
    batchImportOfDrawings() {
      this.action = `${MESUploadFileEquipment}?&num=1&tableName=基础数据_设备管理_设备文件&type=1&UploaderName=${this.id}&equipment=${this.machineValue}`
    },
    uploadSuccess(res, file, fileList) {
      if (res[0].result === '1') {
        const index = fileList.indexOf(file)
        fileList.splice(index, 1)
      } else {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      }
      if (fileList.length === 0) {
        this.uploadManual()
        this.$message.success('文件上传成功')
      }
    },
    uploadFailure(res, file, fileList) {
      fileList.map(file => {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      })
    },
    uploadManual1() {
      this.hadFile1 = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['类型', 2]
      var Data = this.CreateData('11', '基础数据_设备文件_查询数据', param)
      ExecDatabase(Data).then(res => {
        this.suffix = res.data
        if (res.data.length > 0) {
          const server = `${MESDownloadFile}`.split('/')
          res.data.map(item => {
            this.hadFile1.push({
              url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
              name: `${item.name}.${item.suffix}`,
              suffix: item.suffix,
              id: item.num
            })
          })
        }
      })
    },
    deleteFileData1(id) {
      var param = []
      param[0] = ['num', id]
      var Data = this.CreateData('12', '基础数据_设备文件_删除数据', param)
      ExecDatabase(Data).then(res => {
        if (res.data[0].result === '1') {
          this.$message.success('删除成功')
          this.hadFile1 = []
          var param = []
          param[0] = ['设备代码', this.machineValue]
          param[1] = ['类型', 2]
          var Data = this.CreateData('11', '基础数据_设备文件_查询数据', param)
          ExecDatabase(Data).then(res => {
            this.suffix = res.data
            if (res.data.length > 0) {
              const server = `${MESDownloadFile}`.split('/')
              res.data.map(item => {
                this.hadFile1.push({
                  url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
                  name: `${item.name}.${item.suffix}`,
                  suffix: item.suffix,
                  id: item.num
                })
              })
            }
          })
        } else {
          this.$message.success('删除失败')
        }
      })
    },
    batchImportOfDrawings1() {
      this.action1 = `${MESUploadFileEquipment}?&num=1&tableName=基础数据_设备管理_设备文件&type=2&UploaderName=${this.id}&equipment=${this.machineValue}`
    },
    uploadSuccess1(res, file, fileList) {
      if (res[0].result === '1') {
        const index = fileList.indexOf(file)
        fileList.splice(index, 1)
      } else {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      }
      if (fileList.length === 0) {
        this.uploadManual1()
        this.$message.success('文件上传成功')
      }
    },
    uploadFailure1(res, file, fileList) {
      fileList.map(file => {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      })
    },
    // 获得车间
    searchMachineShop() {
      this.machineShops1 = []
      this.machineShop = ''
      var param = []
      var Data = this.CreateData('11', '设备管理_车间_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.machineShops1.push({
            label: v.车间,
            value: v.车间代码
          })
        })
      }).then(() => {
      })
    },
    // 获得产线
    searchProductionLine() {
      this.productionLines1 = []
      this.productionLine = ''
      var param = []
      param[0] = ['车间代码', this.machineShop]
      var Data = this.CreateData('11', '设备管理_产线_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.productionLines1.push({
            label: v.产线名称,
            value: v.产线代码
          })
        })
      }).then(() => {
      })
    },
    // 获得工序
    searchRegion() {
      this.regions1 = []
      this.region = ''
      var param = []
      param[0] = ['产线代码', this.productionLine]
      var Data = this.CreateData('11', '设备管理_工序_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.regions1.push({
            label: v.工序名称,
            value: v.工序代码
          })
        })
      }).then(() => {
      })
    },
    // 查询
    searchTable() {
      this.loading = true
      this.tableData = []
      if (this.keyword) { this.keyword_check = 1 } else { this.keyword_check = 0 }
      if (this.machineShop) { this.machineShop_check = 1 } else { this.machineShop_check = 0 }
      if (this.productionLine) { this.productionLine_check = 1 } else { this.productionLine_check = 0 }
      if (this.region) { this.region_check = 1 } else { this.region_check = 0 }
      var param = []
      param[0] = ['关键字', this.keyword]
      param[1] = ['关键字_check', this.keyword_check]
      param[2] = ['排序方式', this.order]
      param[3] = ['PageSize', this.pageSize]
      param[4] = ['PageCurrent', this.pageCurrent]
      param[5] = ['PageCount', '1111', 'int', '1']
      param[6] = ['ItemCount', '1111', 'int', '1']
      param[7] = ['车间', this.machineShop]
      param[8] = ['车间_check', this.machineShop_check]
      param[9] = ['产线', this.productionLine]
      param[10] = ['产线_check', this.productionLine_check]
      param[11] = ['工序', this.region]
      param[12] = ['工序_check', this.region_check]
      var Data = this.CreateData('11', '基础数据_设备_查询_分页', param)
      ExecDatabase(Data).then(response => {
        response.data.result.map(v => {
          if (v.图片 !== null) {
            v.图片 = 'data:image/png;base64,' + v.图片
          }
          if (v.生命周期时间 === null) {
            v.生命周期时间 = 0
          }
          this.tableData.push({
            图片: v.图片,
            设备代码: v.设备代码,
            资产号: v.资产号,
            设备编号: v.设备编号,
            设备名称: v.设备名称,
            承包人: v.承包人,
            网格长: v.网格长,
            承包人代码: v.承包人代码,
            网格长代码: v.网格长代码,
            车间: v.车间,
            工序: v.工序,
            产线: v.产线,
            车间代码: v.车间代码,
            工序代码: v.工序代码,
            产线代码: v.产线代码,
            ABC指标: v.ABC指标,
            ABC代码: v.ABC代码,
            状态: v.状态,
            状态代码: v.状态代码,
            生命周期时间: v.生命周期时间,
            成本中心: v.成本中心,
            保修起始日期: v.保修起始日期,
            附加信息1: v.附加信息1,
            工作中心代码: v.工作中心代码,
            保修截至日期: v.保修截至日期,
            附加信息2: v.附加信息2,
            制造商: v.制造商,
            设备型号: v.设备型号,
            生产序列号: v.生产序列号,
            供应商: v.供应商,
            制造日期: v.制造日期,
            资产价值: v.资产价值,
            剩余价值: v.剩余价值,
            原值: v.原值,
            生命周期开始日期: v.生命周期开始日期,
            生命周期警告日期: v.生命周期警告日期,
            生命周期报废日期: v.生命周期报废日期
          })
        })
        this.total = parseInt(response.data.output[0].ItemCount)
        this.loading = false
      })
    },
    /**
     * 查询设备信息详情
     */
    searchMachine(row) {
      this.title2 = row.设备编号 + '—设备信息'
      this.form2.original = row.原值
      this.form2.assets = row.资产价值
      this.form2.lave = row.剩余价值
      this.form2.assetNumber = row.资产号
      this.form2.machineNumber = row.设备编号
      this.form2.machineName = row.设备名称
      this.form2.people1 = row.承包人
      this.form2.people2 = row.网格长
      this.form2.machineShop = row.车间
      this.form2.quota = row.ABC指标
      this.form2.region = row.工序
      this.form2.productionLine = row.产线
      this.form2.imageUrl = row.图片
      this.form2.costCenter = row.成本中心
      this.form2.warrantyStartDate = row.保修起始日期
      this.form2.additionalInformation1 = row.附加信息1
      this.form2.workCenterCode = row.工作中心代码
      this.form2.warrantyEndDate = row.保修截至日期
      this.form2.additionalInformation2 = row.附加信息2
      this.form2.manufacturer = row.制造商
      this.form2.model = row.设备型号
      this.form2.productionSerialNumber = row.生产序列号
      this.form2.supplier = row.供应商
      this.form2.manufactureDate = row.制造日期
      this.form2.startDate = row.生命周期开始日期
      this.form2.warningDate = row.生命周期警告日期
      this.form2.scrapDate = row.生命周期报废日期
      this.machineValue = row.设备代码
      this.activeName1 = '1'
      this.getFileListMachine(1)
      this.getSpare()
      this.getSpare2()
      this.getOrder()
      this.uploadManual()
      this.uploadManual1()
      this.dialogFormVisible2 = true
    },
    /**
     * 查询设备文件详情
     */
    getSpare() {
      this.spareTableData = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['PageSize', this.sparePageSize]
      param[2] = ['PageCurrent', this.sparePageCurrent]
      param[3] = ['PageCount', '1111', 'int', '1']
      param[4] = ['ItemCount', '1111', 'int', '1']
      var Data = this.CreateData('11', '维修工单_历史备件_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.result.map(v => {
          this.spareTableData.push({
            备件代码: v.备件代码,
            工单号: v.工单号,
            SAP编码: v.SAP编码,
            备件名称: v.备件名称,
            数量: v.数量,
            二级帐: v.二级帐,
            操作时间: v.操作时间
          })
        })
        this.spareTotal = parseInt(response.data.output[0].ItemCount)
      })
    },
    getSpare2() {
      var param = []
      param[0] = ['设备代码', this.machineValue]
      var Data = this.CreateData('11', '基础数据_设备_备件信息查询', param)
      ExecDatabase(Data).then(response => {
        this.spareTableData2 = response.data
      })
    },
    getOrder() {
      this.orderTableData = []
      this.orderTableData1 = []
      this.orderTableData2 = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['工单类型', 'EM']
      var Data = this.CreateData('11', '维修工单_工单历史_查询_拆分', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.orderTableData.push({
            维修工单代码: v.维修工单代码,
            故障名称: v.故障名称,
            故障现象: v.故障现象,
            工单号: v.工单号,
            状态代码: v.状态代码,
            状态: v.状态,
            开始时间: v.开始时间,
            持续时长: v.持续时长,
            设备代码: v.设备代码,
            设备编号: v.设备编号
          })
        })
      })
      var param1 = []
      param1[0] = ['设备代码', this.machineValue]
      param1[1] = ['工单类型', 'CM']
      var Data1 = this.CreateData('11', '维修工单_工单历史_查询_拆分', param1)
      ExecDatabase(Data1).then(response => {
        response.data.map(v => {
          this.orderTableData1.push({
            维修工单代码: v.维修工单代码,
            故障名称: v.故障名称,
            故障现象: v.故障现象,
            工单号: v.工单号,
            状态代码: v.状态代码,
            状态: v.状态,
            开始时间: v.开始时间,
            持续时长: v.持续时长,
            设备代码: v.设备代码,
            设备编号: v.设备编号
          })
        })
      })
      var param2 = []
      param2[0] = ['设备代码', this.machineValue]
      param2[1] = ['工单类型', 'PM']
      var Data2 = this.CreateData('11', '维修工单_工单历史_查询_拆分', param2)
      ExecDatabase(Data2).then(response => {
        response.data.map(v => {
          this.orderTableData2.push({
            维修工单代码: v.维修工单代码,
            故障名称: v.故障名称,
            故障现象: v.故障现象,
            工单号: v.工单号,
            状态代码: v.状态代码,
            状态: v.状态,
            开始时间: v.开始时间,
            持续时长: v.持续时长,
            设备代码: v.设备代码,
            设备编号: v.设备编号
          })
        })
      })
    },
    // 点击工单
    orderClick(row) {
      this.$router.push({
        name: 'Test',
        query: {
          jobNumber: row
        }
      })
    },
    getFileListMachine(filesType) {
      this.loadingFiles = true
      this.tableDataFiles = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['文件类型', filesType]
      var Data = this.CreateData('11', '基础数据_设备_文件查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.tableDataFiles.push({
            参考文档名称: v.参考文档名称,
            参考文档类型: v.参考文档类型,
            参考文档代码: v.参考文档代码
          })
        })
        this.loadingFiles = false
      })
    },
    /**
     * 详情页切换标签
     */
    handleClickMachineInfo(tab, event) {
      this.fileList = []
      if (tab.name === '1') {
        this.getFileListMachine(1)
      } else if (tab.name === '2') {
        this.getFileListMachine(2)
      }
    },
    /**
     * 排序查询
     */
    sortChange(column) {
      if (column.order === 'ascending') {
        this.order = column.prop + ' asc'
      } else if (column.order === 'descending') { this.order = column.prop + ' desc' } else {
        this.order = ''
      }
      this.pageCurrent = 1
      this.searchTable()
    },
    /**
     * 点击增加设备
     */
    addMachine() {
      if (this.$refs['form'] !== undefined) {
        this.$refs['form'].resetFields()
      }
      this.aaa = 1
      this.title = '新增设备'
      this.dialogFormVisible = true
      this.form.assetNumber = ''
      this.form.machineNumber = ''
      this.form.machineName = ''
      this.form.costCenter = ''
      this.form.workCenterCode = ''
      this.form.warrantyStartDate = ''
      this.form.warrantyEndDate = ''
      this.form.additionalInformation1 = ''
      this.form.additionalInformation2 = ''
      this.form.startDate = ''
      this.form.warningDate = ''
      this.form.scrapDate = ''
      this.form.manufacturer = ''
      this.form.supplier = ''
      this.form.model = ''
      this.form.productionSerialNumber = ''
      this.form.manufactureDate = ''
      this.form.original = ''
      this.form.assets = ''
      this.form.lave = ''
      this.form.people1 = ''
      this.form.people2 = ''
      this.form.quota = ''
      this.form.machineShop = ''
      this.form.productionLine = ''
      this.form.region = ''
      this.regions = []
      this.productionLines = []
      this.imageUrl = ''
      this.fileList = []
      this.getPeople()
      this.getQuotas()
      this.getMachineShop()
      this.isMachineValue = true
    },
    getPeople() {
      this.peoples = []
      var param = []
      var Data = this.CreateData('11', '设备管理_人员_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.peoples.push({
            label: v.姓名,
            value: v.人员代码
          })
        })
      }).then(() => {
      })
    },
    /**
     * 获得指标
     */
    getQuotas() {
      this.quotas = []
      var param = []
      var Data = this.CreateData('11', '设备管理_ABC指标_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.quotas.push({
            label: v.ABC名称,
            value: v.ABC代码
          })
        })
      }).then(() => {
      })
    },
    /**
     * 获得车间
     */
    getMachineShop() {
      this.machineShops = []
      var param = []
      var Data = this.CreateData('11', '设备管理_车间_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.machineShops.push({
            label: v.车间,
            value: v.车间代码
          })
        })
      }).then(() => {
      })
    },
    /**
     * 获得产线
     */
    getProductionLine() {
      this.productionLines = []
      this.form.productionLine = ''
      var param = []
      param[0] = ['车间代码', this.form.machineShop]
      var Data = this.CreateData('11', '设备管理_产线_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.productionLines.push({
            label: v.产线名称,
            value: v.产线代码
          })
        })
      }).then(() => {
        this.form.productionLine = this.productionLines[0].value
        this.getRegion()
      })
    },
    /**
     * 获得工序
     */
    getRegion() {
      this.regions = []
      this.form.region = ''
      var param = []
      param[0] = ['产线代码', this.form.productionLine]
      var Data = this.CreateData('11', '设备管理_工序_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.regions.push({
            label: v.工序名称,
            value: v.工序代码
          })
        })
      }).then(() => {
        this.form.region = this.regions[0].value
      })
    },
    /**
     * 图片预览
     */
    fileChange(file) {
      this.imageUrl = URL.createObjectURL(file.raw)
    },
    /**
     * 文件超出限制
     */
    fileExceed() {
      this.$message.warning('当前限制选择 1 个文件')
    },
    /**
     * 文件删除
     */
    fileRemove() {
      this.imageUrl = ''
    },
    /**
     * 确定增加设备
     */
    submit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['资产号', this.form.assetNumber]
          param[1] = ['设备编号', this.form.machineNumber]
          param[2] = ['设备名称', this.form.machineName]
          param[3] = ['承包人代码', this.form.people1]
          param[4] = ['网格长代码', this.form.people2]
          param[5] = ['车间代码', this.form.machineShop]
          param[6] = ['ABC代码', this.form.quota]
          param[7] = ['工序代码', this.form.region]
          param[8] = ['产线代码', this.form.productionLine]
          param[9] = ['成本中心', this.form.costCenter]
          param[10] = ['工作中心代码', this.form.workCenterCode]
          param[11] = ['保修起始日期', this.form.warrantyStartDate]
          param[12] = ['保修截至日期', this.form.warrantyEndDate]
          param[13] = ['附加信息1', this.form.additionalInformation1]
          param[14] = ['附加信息2', this.form.additionalInformation2]
          param[15] = ['生命周期开始日期', this.form.startDate]
          param[16] = ['生命周期警告日期', this.form.warningDate]
          param[17] = ['生命周期报废日期', this.form.scrapDate]
          param[18] = ['制造商', this.form.manufacturer]
          param[19] = ['供应商', this.form.supplier]
          param[20] = ['设备型号', this.form.model]
          param[21] = ['生产序列号', this.form.productionSerialNumber]
          param[22] = ['制造日期', this.form.manufactureDate]
          param[23] = ['原值', this.form.original]
          param[24] = ['资产价值', this.form.assets]
          param[25] = ['剩余价值', this.form.lave]
          param[26] = ['文件名称', '']
          param[27] = ['文件后缀', '']
          param[28] = ['文件内容', null]
          var Data = this.CreateData('15', '基础数据_设备_增加', param)
          this.Data.param = Data
          this.pageCurrent = 1
          if (this.imageUrl === null || this.imageUrl === '' || this.imageUrl === undefined) {
            ExecDatabase(Data).then(response => {
              if (!response.data[0][0]) {
                this.$message.error('信息增加失败')
              } else {
                this.$message({
                  message: '信息增加成功',
                  type: 'success'
                })
                this.machineValue = response.data[0][0].设备代码
                this.isMachineValue = false
                this.pageCurrent = 1
                this.searchTable()
              }
            })
          } else {
            this.$refs.upload.submit()
          }
        }
      })
    },
    /**
     * 增加设备图片上传成功后
     */
    fileSuccess(res) {
      if (!res[0][0]) {
        this.$message.error('信息增加失败')
      } else {
        this.$message({
          message: '信息增加成功',
          type: 'success'
        })
        this.machineValue = res[0][0].设备代码
        this.isMachineValue = false
        this.pageCurrent = 1
        this.searchTable()
      }
    },
    /**
     * 增加设备取消
     */
    callOff(formName) {
      this.isMachineValue = true
      this.machineValue = ''
      this.dialogFormVisible = false
      this.$refs[formName].resetFields()
    },
    /**
     * 点击修改设备
     */
    editMachine(row) {
      if (this.$refs['form4'] !== undefined) {
        this.$refs['form4'].resetFields()
      }
      this.dialogFormVisible4 = true
      this.machineValue = row.设备代码
      this.uploadManual()
      this.uploadManual1()
      this.form4.original = row.原值
      this.form4.assets = row.资产价值
      this.form4.lave = row.剩余价值
      this.form4.assetNumber = row.资产号
      this.form4.machineNumber = row.设备编号
      this.form4.machineName = row.设备名称
      this.form4.people1 = row.承包人代码
      this.form4.people2 = row.网格长代码
      this.form4.machineShop = row.车间代码
      this.form4.quota = row.ABC代码
      this.form4.region = row.工序代码
      this.form4.productionLine = row.产线代码
      this.form4.costCenter = row.成本中心
      this.form4.warrantyStartDate = row.保修起始日期
      this.form4.additionalInformation1 = row.附加信息1
      this.form4.workCenterCode = row.工作中心代码
      this.form4.warrantyEndDate = row.保修截至日期
      this.form4.additionalInformation2 = row.附加信息2
      this.form4.manufacturer = row.制造商
      this.form4.model = row.设备型号
      this.form4.productionSerialNumber = row.生产序列号
      this.form4.supplier = row.供应商
      this.form4.manufactureDate = row.制造日期
      this.form4.startDate = row.生命周期开始日期
      this.form4.warningDate = row.生命周期警告日期
      this.form4.scrapDate = row.生命周期报废日期
      this.imageUrl = row.图片
      this.imageUrl1 = row.图片
      this.imgList = []
      this.getPeople()
      this.getQuotas()
      this.getMachineShop1()
    },
    /**
     * 获得车间
     */
    getMachineShop1() {
      this.machineShops = []
      var param = []
      var Data = this.CreateData('11', '设备管理_车间_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.machineShops.push({
            label: v.车间,
            value: v.车间代码
          })
        })
      }).then(() => {
        this.getProductionLine1()
      })
    },
    /**
     * 获得产线
     */
    getProductionLine1() {
      this.productionLines = []
      var param = []
      param[0] = ['车间代码', this.form4.machineShop]
      var Data = this.CreateData('11', '设备管理_产线_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.productionLines.push({
            label: v.产线名称,
            value: v.产线代码
          })
        })
      }).then(() => {
        this.getRegion1()
      })
    },
    /**
     * 获得工序
     */
    getRegion1() {
      this.regions = []
      var param = []
      param[0] = ['产线代码', this.form4.productionLine]
      var Data = this.CreateData('11', '设备管理_工序_查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.regions.push({
            label: v.工序名称,
            value: v.工序代码
          })
        })
      }).then(() => {
      })
    },
    /**
     * 确定修改设备
     */
    submit1(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['资产号', this.form4.assetNumber]
          param[1] = ['设备编号', this.form4.machineNumber]
          param[2] = ['设备名称', this.form4.machineName]
          param[3] = ['承包人代码', this.form4.people1]
          param[4] = ['网格长代码', this.form4.people2]
          param[5] = ['车间代码', this.form4.machineShop]
          param[6] = ['ABC代码', this.form4.quota]
          param[7] = ['工序代码', this.form4.region]
          param[8] = ['产线代码', this.form4.productionLine]
          param[9] = ['成本中心', this.form4.costCenter]
          param[10] = ['工作中心代码', this.form4.workCenterCode]
          param[11] = ['保修起始日期', this.form4.warrantyStartDate]
          param[12] = ['保修截至日期', this.form4.warrantyEndDate]
          param[13] = ['附加信息1', this.form4.additionalInformation1]
          param[14] = ['附加信息2', this.form4.additionalInformation2]
          param[15] = ['生命周期开始日期', this.form4.startDate]
          param[16] = ['生命周期警告日期', this.form4.warningDate]
          param[17] = ['生命周期报废日期', this.form4.scrapDate]
          param[18] = ['制造商', this.form4.manufacturer]
          param[19] = ['供应商', this.form4.supplier]
          param[20] = ['设备型号', this.form4.model]
          param[21] = ['生产序列号', this.form4.productionSerialNumber]
          param[22] = ['制造日期', this.form4.manufactureDate]
          param[23] = ['原值', this.form4.original]
          param[24] = ['资产价值', this.form4.assets]
          param[25] = ['剩余价值', this.form4.lave]
          param[26] = ['设备代码', this.machineValue]
          var Data = this.CreateData('12', '基础数据_设备_修改1', param)
          ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message({
                message: '信息修改成功',
                type: 'success'
              })
              this.searchTable()
            } else {
              this.$message.error('信息修改失败')
            }
          })
        }
      })
    },
    /**
     * 取消编辑
     */
    callOff4(formName) {
      this.isMachineValue = true
      this.machineValue = ''
      this.dialogFormVisible4 = false
      this.$refs[formName].resetFields()
    },
    /**
     * 编辑设备照片
     */
    EditFile() {
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['文件名称', '']
      param[2] = ['文件后缀', '']
      param[3] = ['文件内容', null]
      if (this.$refs.uploadEdit.uploadFiles.length > 0) {
        var Data1 = this.CreateData('15', '基础数据_设备_更改图片', param)
        this.Data.param = Data1
        this.$refs.uploadEdit.submit()
      } else {
        console.log('文件为空')
      }
    },
    /**
     * 编辑设备照片成功后
     */
    fileEditSuccess() {
      this.$message({
        message: '照片更改成功',
        type: 'success'
      })
      this.searchTable()
    },
    /**
     * 编辑设备-删除图片
     */
    deleteMachineImg() {
      this.$confirm('此操作将永久删除设备照片, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['设备代码', this.machineValue]
        var Data = this.CreateData('12', '基础数据_设备_删除图片', param)
        ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('删除成功')
            this.imgList = []
            this.imageUrl = ''
            this.searchTable()
          } else {
            this.$message.error('删除失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    /**
     * 删除设备
     */
    handleDelete(row) {
      this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['设备代码', row.设备代码]
        var Data = this.CreateData('12', '基础数据_设备_删除', param)
        ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('删除成功')
            this.searchTable()
          } else {
            this.$message.error('删除失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    /**
     * 点击上传文件按钮
     */
    openFile() {
      this.fileList = []
      this.activeName2 = '1'
      this.getFileList(1)
    },
    /**
     * 点击上传文件按钮
     */
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    /**
     * 上传设备文件大小限制
     */
    beforeAvatarUpload(file) {
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isLt2M) {
        this.$message.error('上传设备文档大小不能超过 2MB!')
      }
      return isLt2M
    },
    /**
     * 上传设备文件大小限制
     */
    handlePreview(file) {
      console.log(file)
    },
    /**
     * 上传标准文件
     */
    uploadStandFile() {
      var param = []
      var filesType = 1
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['文件类型', filesType]
      param[2] = ['文件名称', '']
      param[3] = ['文件后缀', '']
      param[4] = ['文件内容', null]
      var Data1 = this.CreateData('15', '基础数据_设备_上传文件', param)
      this.Data.param = Data1
      this.$refs.uploadStandFile.submit()
    },
    /**
     * 上传技术文档
     */
    uploadProFile() {
      var param = []
      var filesType = 2
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['文件类型', filesType]
      param[2] = ['文件名称', '']
      param[3] = ['文件后缀', '']
      param[4] = ['文件内容', null]
      var Data1 = this.CreateData('15', '基础数据_设备_上传文件', param)
      this.Data.param = Data1
      this.$refs.uploadProFile.submit()
    },
    /**
     * 上传技术设备文件成功后
     */
    proFileSuccess(res, file) {
      this.fileList = []
      this.getFileList(2)
    },
    /**
     * 上传标准设备文件成功后
     */
    stnFileSuccess(res, file) {
      this.fileList = []
      this.getFileList(1)
    },
    /**
     * 获取设备文件
     */
    getFileList(filesType) {
      this.dialogFormVisible3 = true
      this.loadingFiles = true
      this.tableDataFiles = []
      var param = []
      param[0] = ['设备代码', this.machineValue]
      param[1] = ['文件类型', filesType]
      var Data = this.CreateData('11', '基础数据_设备_文件查询', param)
      ExecDatabase(Data).then(response => {
        response.data.map(v => {
          this.tableDataFiles.push({
            参考文档名称: v.参考文档名称,
            参考文档类型: v.参考文档类型,
            参考文档代码: v.参考文档代码
          })
        })
        this.loadingFiles = false
      })
    },
    /**
     * 下载文件
     */
    downloadFiles(row) {
      var param = []
      param[0] = ['参考文档代码', row.参考文档代码]
      var Data = this.CreateData('2004', '基础数据_设备_文件下载', param)
      this.exportExcel_NPOI(Data)
    },
    /**
     * 删除文件
     */
    deleteFile(row, type) {
      this.$confirm('此操作将永久删除此文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['参考文档代码', row.参考文档代码]
        var Data = this.CreateData('12', '基础数据_设备_文件删除', param)
        ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('删除成功')
            this.getFileList(type)
          } else {
            this.$message.error('删除失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    /**
     * 上传文件TAB点击切换
     */
    handleClick(tab, event) {
      this.fileList = []
      if (tab.name === '1') {
        this.getFileList(1)
      } else if (tab.name === '2') {
        this.getFileList(2)
      }
    },
    handleSizeChange(val) {
      this.pageCurrent = 1
      this.pageSize = val
      this.searchTable()
    },
    handleCurrentChange(val) {
      this.pageCurrent = val
      this.searchTable()
    },
    handleSizeChange1(val) {
      this.sparePageCurrent = 1
      this.sparePageSize = val
      this.getSpare()
    },
    handleCurrentChange1(val) {
      this.sparePageCurrent = val
      this.getSpare()
    }
  }
}
</script>

<style scoped>
  .machine-divider {
    margin: 5px 0;
    width: 100%;
    border-bottom: 1px solid #ccc;
  }
  .div {
    width: 220px;
    height:45px;
    margin-top: 0px;
    border-bottom: rgb(220,220,220) solid 2px
  }
  >>>.el-form--label-top .el-form-item__label {
    padding: 0px;
  }
  >>>.el-dialog__body {
    padding: 0px 30px;
    color: #606266;
    font-size: 20px;
    word-break: break-all;
  }
  >>>.el-tabs__item {
    font-size: 16px;
    padding-top: 10px;
    padding-bottom: 50px;
  }
  .wrapper{
    width: 90%;
    height: 50px;
    overflow: hidden;
    border: 1px solid #b8c7d9;
    /*float: left;*/
    margin: 10px;
  }
  .content{
    position: relative;
    padding: 8px 8px 0 8px;
  }
  .action{
    position: absolute;
    top: 2px;
    right: 8px;
  }
  .delete{
    padding: 0 5px;
    border-radius: 3px;
    color: #0f84b0;
    font-size: 12px;
  }
  .delete:hover{
    background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
    color: #fff;
  }
  a{
    text-decoration: none;
  }
  .icon{
    width: 30px;
    height: 30px;
    display: inline-block;
    margin-right: 7px;
    margin-top: 2px;
    font-size: 26px;
  }
  .info{
    width: 300px;
    height: 50px;
    left: 44px;
    line-height: 30px;
    display: inline-block;
    color: #999;
  }
</style>

