<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="任务编号" prop="taskCode">
        <el-input
          v-model="queryParams.taskCode"
          placeholder="请输入任务编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划流水号" prop="seqNo">
        <el-input
          v-model="queryParams.seqNo"
          placeholder="请输入计划流水号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划开始时间">
        <el-date-picker
          v-model="daterangePlanStartTime"
          style="width: 340px"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetimerange"
          range-separator="-"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
        ></el-date-picker>
      </el-form-item>
<!--      <el-form-item label="计划结束时间">-->
<!--        <el-date-picker-->
<!--          v-model="daterangePlanEndTime"-->
<!--          style="width: 340px"-->
<!--          value-format="yyyy-MM-dd HH:mm:ss"-->
<!--          type="datetimerange"-->
<!--          range-separator="-"-->
<!--          start-placeholder="开始时间"-->
<!--          end-placeholder="结束时间"-->
<!--        ></el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="关联资源" prop="associationResource">-->
<!--        <el-input-->
<!--          v-model="queryParams.associationResource"-->
<!--          placeholder="请输入关联资源"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="班组名称" prop="teamName">
        <el-input
          v-model="queryParams.teamName"
          placeholder="请输入班组名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['mes/prod:prodPlanErpInfo:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['mes/prod:prodPlanErpInfo:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['mes/prod:prodPlanErpInfo:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['mes/prod:prodPlanErpInfo:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="prodPlanErpInfoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="主键标识" align="center" prop="objId" v-if="columns[0].visible"/>
      <el-table-column label="硬件" align="center" prop="hardware" v-if="columns[1].visible"/>
      <el-table-column label="软件" align="center" prop="software" v-if="columns[2].visible"/>
      <el-table-column label="阶段文字" align="center" prop="stageText" v-if="columns[3].visible"/>
      <el-table-column label="任务编号" align="center" prop="taskCode" v-if="columns[25].visible" width="140"/>
      <el-table-column label="计划流水号" align="center" prop="seqNo" v-if="columns[4].visible" width="240"/>
      <el-table-column label="计划开始时间" align="center" prop="planStartTime" width="180" v-if="columns[5].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planStartTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划结束时间" align="center" prop="planEndTime" width="180" v-if="columns[6].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="关联资源" align="center" prop="associationResource" v-if="columns[7].visible"/>
      <el-table-column label="工作效率" align="center" prop="workingEfficiency" v-if="columns[8].visible"/>
      <el-table-column label="设备码" align="center" prop="equipmentNo" v-if="columns[9].visible" width="100"/>
      <el-table-column label="准备时间" align="center" prop="preparationDuration" v-if="columns[10].visible"/>
      <el-table-column label="收尾时间" align="center" prop="windUpDuration" v-if="columns[11].visible"/>
      <el-table-column label="出布最小速度" align="center" prop="clothMinimumSpeed" v-if="columns[12].visible"/>
      <el-table-column label="出布最大速度" align="center" prop="clothMaximumSpeed" v-if="columns[13].visible"/>
      <el-table-column label="成型最小速度" align="center" prop="formingMinimumSpeed" v-if="columns[14].visible"/>
      <el-table-column label="成型最大速度" align="center" prop="formingMaximumSpeed" v-if="columns[15].visible"/>
      <el-table-column label="包胶最小速度" align="center" prop="glueMinimumSpeed" v-if="columns[16].visible"/>
      <el-table-column label="包胶最大速度" align="center" prop="glueMaximumSpeed" v-if="columns[17].visible"/>
      <el-table-column label="每锅硫化米数" align="center" prop="sulfurizationLength" v-if="columns[18].visible"/>
      <el-table-column label="硫化机类型" align="center" prop="vulcanizingMachineType" v-if="columns[19].visible"/>
      <el-table-column label="硫化板层数" align="center" prop="vulcanizedBoardNumber" v-if="columns[20].visible"/>
      <el-table-column label="资源名称" align="center" prop="resourceName" v-if="columns[21].visible"/>
      <el-table-column label="工艺阶段" align="center" prop="processStage" v-if="columns[22].visible"/>
      <el-table-column label="前置工艺" align="center" prop="preProcess" v-if="columns[23].visible"/>
      <el-table-column label="发布订单" align="center" prop="releaseOrder" v-if="columns[24].visible"/>
      <el-table-column label="输送带长度规格" align="center" prop="conveyorLengthSpecification" v-if="columns[26].visible"/>
      <el-table-column label="上胶厚度" align="center" prop="upGlueThickness" v-if="columns[27].visible"/>
      <el-table-column label="上缓冲胶厚度" align="center" prop="upBufferGlueThickness" v-if="columns[28].visible"/>
      <el-table-column label="下胶厚度" align="center" prop="belowGlueThickness" v-if="columns[29].visible"/>
      <el-table-column label="下缓冲胶厚度" align="center" prop="belowBufferGlueThickness" v-if="columns[30].visible"/>
      <el-table-column label="输送带宽度" align="center" prop="beltWidth" v-if="columns[31].visible"/>
      <el-table-column label="客户要求输送带长度" align="center" prop="customerRequestConveyorLength"
                       v-if="columns[32].visible" width="100"
      />
      <el-table-column label="压延生产米数" align="center" prop="rollingProductionMeters" v-if="columns[33].visible"/>
      <el-table-column label="需要硫化米数" align="center" prop="vulcanizationMeters" v-if="columns[34].visible"/>
      <el-table-column label="推荐硫化时间" align="center" prop="recommendVulcanizationTime" v-if="columns[35].visible"/>
      <el-table-column label="出大布米数" align="center" prop="largeClothMeters" v-if="columns[36].visible"/>
      <el-table-column label="出小布米数" align="center" prop="smallClothMeters" v-if="columns[37].visible"/>
      <el-table-column label="包胶米数" align="center" prop="encapsulationMeters" v-if="columns[38].visible"/>
      <el-table-column label="工作速度" align="center" prop="workSpeed" v-if="columns[39].visible"/>
      <el-table-column label="需要工时" align="center" prop="workingHours" v-if="columns[40].visible"/>
      <el-table-column label="出布面积" align="center" prop="distributionArea" v-if="columns[41].visible"/>
      <el-table-column label="包胶面积" align="center" prop="encapsulationArea" v-if="columns[42].visible"/>
      <el-table-column label="硫化面积" align="center" prop="vulcanizationArea" v-if="columns[43].visible"/>
      <el-table-column label="输送带总面积" align="center" prop="conveyorTotalArea" v-if="columns[44].visible"/>
      <el-table-column label="胶料工艺" align="center" prop="glueProcess" v-if="columns[45].visible"/>
      <el-table-column label="上胶使用胶料" align="center" prop="upGlue" v-if="columns[46].visible"/>
      <el-table-column label="上胶系数" align="center" prop="upGlueCoefficient" v-if="columns[47].visible"/>
      <el-table-column label="上胶标准用胶量" align="center" prop="upGlueDosage" v-if="columns[48].visible"/>
      <el-table-column label="下胶使用胶料" align="center" prop="belowGlue" v-if="columns[49].visible"/>
      <el-table-column label="下胶系数" align="center" prop="belowGlueCoefficient" v-if="columns[50].visible"/>
      <el-table-column label="下胶标准用胶量" align="center" prop="belowGlueDosage" v-if="columns[51].visible"/>
      <el-table-column label="缓冲/布胶使用胶料" align="center" prop="bufferGlue" v-if="columns[52].visible"/>
      <el-table-column label="缓冲胶系数" align="center" prop="bufferGlueCoefficient" v-if="columns[53].visible"/>
      <el-table-column label="缓冲胶标准用胶量" align="center" prop="bufferGlueDosage" v-if="columns[54].visible"/>
      <el-table-column label="大布布料规格" align="center" prop="largeClothSpecifications" v-if="columns[55].visible"/>
      <el-table-column label="大布擦胶系数" align="center" prop="largeClothFrictioningCoefficient"
                       v-if="columns[56].visible"
      />
      <el-table-column label="胶布标准用胶量" align="center" prop="largeClothDosage" v-if="columns[57].visible"/>
      <el-table-column label="中间胶使用胶料" align="center" prop="middleGlue" v-if="columns[58].visible"/>
      <el-table-column label="中间胶系数" align="center" prop="middleGlueCoefficient" v-if="columns[59].visible"/>
      <el-table-column label="中间胶标准用胶量" align="center" prop="middleGlueDosage" v-if="columns[60].visible"/>
      <el-table-column label="设备使用限制" align="center" prop="deviceUsageRestrictions" v-if="columns[61].visible"/>
      <el-table-column label="判断工段" align="center" prop="workshopSection" v-if="columns[62].visible"/>
      <el-table-column label="班次" align="center" prop="classes" v-if="columns[63].visible"/>
      <el-table-column label="参加任务小组" align="center" prop="taskForce" v-if="columns[64].visible"/>
      <el-table-column label="班组名称" align="center" prop="teamName" v-if="columns[65].visible"/>
      <el-table-column label="组长" align="center" prop="groupLeader" v-if="columns[66].visible"/>
      <el-table-column label="人员活动详情" align="center" prop="personnelOperationDetails" v-if="columns[67].visible"/>
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['mes/prod:prodPlanErpInfo:edit']"-->
<!--          >修改-->
<!--          </el-button>-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['mes/prod:prodPlanErpInfo:remove']"-->
<!--          >删除-->
<!--          </el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改生产计划信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="硬件" prop="hardware">
          <el-input v-model="form.hardware" placeholder="请输入硬件"/>
        </el-form-item>
        <el-form-item label="软件" prop="software">
          <el-input v-model="form.software" placeholder="请输入软件"/>
        </el-form-item>
        <el-form-item label="阶段文字" prop="stageText">
          <el-input v-model="form.stageText" placeholder="请输入阶段文字"/>
        </el-form-item>
        <el-form-item label="计划流水号" prop="seqNo">
          <el-input v-model="form.seqNo" placeholder="请输入计划流水号" />
        </el-form-item>
        <el-form-item label="计划开始时间" prop="planStartTime">
          <el-date-picker clearable
                          v-model="form.planStartTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择计划开始时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="计划结束时间" prop="planEndTime">
          <el-date-picker clearable
                          v-model="form.planEndTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择计划结束时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="关联资源" prop="associationResource">
          <el-input v-model="form.associationResource" placeholder="请输入关联资源"/>
        </el-form-item>
        <el-form-item label="工作效率" prop="workingEfficiency">
          <el-input v-model="form.workingEfficiency" placeholder="请输入工作效率"/>
        </el-form-item>
        <el-form-item label="设备码" prop="equipmentNo">
          <el-input v-model="form.equipmentNo" placeholder="请输入设备码"/>
        </el-form-item>
        <el-form-item label="准备时间" prop="preparationDuration">
          <el-input v-model="form.preparationDuration" placeholder="请输入准备时间"/>
        </el-form-item>
        <el-form-item label="收尾时间" prop="windUpDuration">
          <el-input v-model="form.windUpDuration" placeholder="请输入收尾时间"/>
        </el-form-item>
        <el-form-item label="出布最小速度" prop="clothMinimumSpeed">
          <el-input v-model="form.clothMinimumSpeed" placeholder="请输入出布最小速度"/>
        </el-form-item>
        <el-form-item label="出布最大速度" prop="clothMaximumSpeed">
          <el-input v-model="form.clothMaximumSpeed" placeholder="请输入出布最大速度"/>
        </el-form-item>
        <el-form-item label="成型最小速度" prop="formingMinimumSpeed">
          <el-input v-model="form.formingMinimumSpeed" placeholder="请输入成型最小速度"/>
        </el-form-item>
        <el-form-item label="成型最大速度" prop="formingMaximumSpeed">
          <el-input v-model="form.formingMaximumSpeed" placeholder="请输入成型最大速度"/>
        </el-form-item>
        <el-form-item label="包胶最小速度" prop="glueMinimumSpeed">
          <el-input v-model="form.glueMinimumSpeed" placeholder="请输入包胶最小速度"/>
        </el-form-item>
        <el-form-item label="包胶最大速度" prop="glueMaximumSpeed">
          <el-input v-model="form.glueMaximumSpeed" placeholder="请输入包胶最大速度"/>
        </el-form-item>
        <el-form-item label="每锅硫化米数" prop="sulfurizationLength">
          <el-input v-model="form.sulfurizationLength" placeholder="请输入每锅硫化米数"/>
        </el-form-item>
        <el-form-item label="硫化板层数" prop="vulcanizedBoardNumber">
          <el-input v-model="form.vulcanizedBoardNumber" placeholder="请输入硫化板层数"/>
        </el-form-item>
        <el-form-item label="资源名称" prop="resourceName">
          <el-input v-model="form.resourceName" placeholder="请输入资源名称"/>
        </el-form-item>
        <el-form-item label="工艺阶段" prop="processStage">
          <el-input v-model="form.processStage" placeholder="请输入工艺阶段"/>
        </el-form-item>
        <el-form-item label="前置工艺" prop="preProcess">
          <el-input v-model="form.preProcess" placeholder="请输入前置工艺"/>
        </el-form-item>
        <el-form-item label="发布订单" prop="releaseOrder">
          <el-input v-model="form.releaseOrder" placeholder="请输入发布订单"/>
        </el-form-item>
        <el-form-item label="任务编号" prop="taskCode">
          <el-input v-model="form.taskCode" placeholder="请输入任务编号"/>
        </el-form-item>
        <el-form-item label="输送带长度规格" prop="conveyorLengthSpecification">
          <el-input v-model="form.conveyorLengthSpecification" placeholder="请输入输送带长度规格"/>
        </el-form-item>
        <el-form-item label="上胶厚度" prop="upGlueThickness">
          <el-input v-model="form.upGlueThickness" placeholder="请输入上胶厚度"/>
        </el-form-item>
        <el-form-item label="上缓冲胶厚度" prop="upBufferGlueThickness">
          <el-input v-model="form.upBufferGlueThickness" placeholder="请输入上缓冲胶厚度"/>
        </el-form-item>
        <el-form-item label="下胶厚度" prop="belowGlueThickness">
          <el-input v-model="form.belowGlueThickness" placeholder="请输入下胶厚度"/>
        </el-form-item>
        <el-form-item label="下缓冲胶厚度" prop="belowBufferGlueThickness">
          <el-input v-model="form.belowBufferGlueThickness" placeholder="请输入下缓冲胶厚度"/>
        </el-form-item>
        <el-form-item label="输送带宽度" prop="beltWidth">
          <el-input v-model="form.beltWidth" placeholder="请输入输送带宽度"/>
        </el-form-item>
        <el-form-item label="客户要求输送带长度" prop="customerRequestConveyorLength">
          <el-input v-model="form.customerRequestConveyorLength" placeholder="请输入客户要求输送带长度"/>
        </el-form-item>
        <el-form-item label="压延生产米数" prop="rollingProductionMeters">
          <el-input v-model="form.rollingProductionMeters" placeholder="请输入压延生产米数"/>
        </el-form-item>
        <el-form-item label="需要硫化米数" prop="vulcanizationMeters">
          <el-input v-model="form.vulcanizationMeters" placeholder="请输入需要硫化米数"/>
        </el-form-item>
        <el-form-item label="推荐硫化时间" prop="recommendVulcanizationTime">
          <el-input v-model="form.recommendVulcanizationTime" placeholder="请输入推荐硫化时间"/>
        </el-form-item>
        <el-form-item label="出大布米数" prop="largeClothMeters">
          <el-input v-model="form.largeClothMeters" placeholder="请输入出大布米数"/>
        </el-form-item>
        <el-form-item label="出小布米数" prop="smallClothMeters">
          <el-input v-model="form.smallClothMeters" placeholder="请输入出小布米数"/>
        </el-form-item>
        <el-form-item label="包胶米数" prop="encapsulationMeters">
          <el-input v-model="form.encapsulationMeters" placeholder="请输入包胶米数"/>
        </el-form-item>
        <el-form-item label="工作速度" prop="workSpeed">
          <el-input v-model="form.workSpeed" placeholder="请输入工作速度"/>
        </el-form-item>
        <el-form-item label="需要工时" prop="workingHours">
          <el-input v-model="form.workingHours" placeholder="请输入需要工时"/>
        </el-form-item>
        <el-form-item label="出布面积" prop="distributionArea">
          <el-input v-model="form.distributionArea" placeholder="请输入出布面积"/>
        </el-form-item>
        <el-form-item label="包胶面积" prop="encapsulationArea">
          <el-input v-model="form.encapsulationArea" placeholder="请输入包胶面积"/>
        </el-form-item>
        <el-form-item label="硫化面积" prop="vulcanizationArea">
          <el-input v-model="form.vulcanizationArea" placeholder="请输入硫化面积"/>
        </el-form-item>
        <el-form-item label="输送带总面积" prop="conveyorTotalArea">
          <el-input v-model="form.conveyorTotalArea" placeholder="请输入输送带总面积"/>
        </el-form-item>
        <el-form-item label="胶料工艺" prop="glueProcess">
          <el-input v-model="form.glueProcess" placeholder="请输入胶料工艺"/>
        </el-form-item>
        <el-form-item label="上胶使用胶料" prop="upGlue">
          <el-input v-model="form.upGlue" placeholder="请输入上胶使用胶料"/>
        </el-form-item>
        <el-form-item label="上胶系数" prop="upGlueCoefficient">
          <el-input v-model="form.upGlueCoefficient" placeholder="请输入上胶系数"/>
        </el-form-item>
        <el-form-item label="上胶标准用胶量" prop="upGlueDosage">
          <el-input v-model="form.upGlueDosage" placeholder="请输入上胶标准用胶量"/>
        </el-form-item>
        <el-form-item label="下胶使用胶料" prop="belowGlue">
          <el-input v-model="form.belowGlue" placeholder="请输入下胶使用胶料"/>
        </el-form-item>
        <el-form-item label="下胶系数" prop="belowGlueCoefficient">
          <el-input v-model="form.belowGlueCoefficient" placeholder="请输入下胶系数"/>
        </el-form-item>
        <el-form-item label="下胶标准用胶量" prop="belowGlueDosage">
          <el-input v-model="form.belowGlueDosage" placeholder="请输入下胶标准用胶量"/>
        </el-form-item>
        <el-form-item label="缓冲/布胶使用胶料" prop="bufferGlue">
          <el-input v-model="form.bufferGlue" placeholder="请输入缓冲/布胶使用胶料"/>
        </el-form-item>
        <el-form-item label="缓冲胶系数" prop="bufferGlueCoefficient">
          <el-input v-model="form.bufferGlueCoefficient" placeholder="请输入缓冲胶系数"/>
        </el-form-item>
        <el-form-item label="缓冲胶标准用胶量" prop="bufferGlueDosage">
          <el-input v-model="form.bufferGlueDosage" placeholder="请输入缓冲胶标准用胶量"/>
        </el-form-item>
        <el-form-item label="大布布料规格" prop="largeClothSpecifications">
          <el-input v-model="form.largeClothSpecifications" placeholder="请输入大布布料规格"/>
        </el-form-item>
        <el-form-item label="大布擦胶系数" prop="largeClothFrictioningCoefficient">
          <el-input v-model="form.largeClothFrictioningCoefficient" placeholder="请输入大布擦胶系数"/>
        </el-form-item>
        <el-form-item label="胶布标准用胶量" prop="largeClothDosage">
          <el-input v-model="form.largeClothDosage" placeholder="请输入胶布标准用胶量"/>
        </el-form-item>
        <el-form-item label="中间胶使用胶料" prop="middleGlue">
          <el-input v-model="form.middleGlue" placeholder="请输入中间胶使用胶料"/>
        </el-form-item>
        <el-form-item label="中间胶系数" prop="middleGlueCoefficient">
          <el-input v-model="form.middleGlueCoefficient" placeholder="请输入中间胶系数"/>
        </el-form-item>
        <el-form-item label="中间胶标准用胶量" prop="middleGlueDosage">
          <el-input v-model="form.middleGlueDosage" placeholder="请输入中间胶标准用胶量"/>
        </el-form-item>
        <el-form-item label="设备使用限制" prop="deviceUsageRestrictions">
          <el-input v-model="form.deviceUsageRestrictions" placeholder="请输入设备使用限制"/>
        </el-form-item>
        <el-form-item label="判断工段" prop="workshopSection">
          <el-input v-model="form.workshopSection" placeholder="请输入判断工段"/>
        </el-form-item>
        <el-form-item label="班次" prop="classes">
          <el-input v-model="form.classes" placeholder="请输入班次"/>
        </el-form-item>
        <el-form-item label="参加任务小组" prop="taskForce">
          <el-input v-model="form.taskForce" placeholder="请输入参加任务小组"/>
        </el-form-item>
        <el-form-item label="班组名称" prop="teamName">
          <el-input v-model="form.teamName" placeholder="请输入班组名称"/>
        </el-form-item>
        <el-form-item label="组长" prop="groupLeader">
          <el-input v-model="form.groupLeader" placeholder="请输入组长"/>
        </el-form-item>
        <el-form-item label="人员活动详情" prop="personnelOperationDetails">
          <el-input v-model="form.personnelOperationDetails" placeholder="请输入人员活动详情"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listProdPlanErpInfo,
  getProdPlanErpInfo,
  delProdPlanErpInfo,
  addProdPlanErpInfo,
  updateProdPlanErpInfo
} from '@/api/mes/prod/prodPlanErpInfo'

export default {
  name: 'ProdPlanErpInfo',
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产计划信息表格数据
      prodPlanErpInfoList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 人员活动详情时间范围
      daterangePlanStartTime: [],
      // 人员活动详情时间范围
      daterangePlanEndTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        hardware: null,
        software: null,
        stageText: null,
        seqNo: null,
        planStartTime: null,
        planEndTime: null,
        associationResource: null,
        workingEfficiency: null,
        equipmentNo: null,
        preparationDuration: null,
        windUpDuration: null,
        clothMinimumSpeed: null,
        clothMaximumSpeed: null,
        formingMinimumSpeed: null,
        formingMaximumSpeed: null,
        glueMinimumSpeed: null,
        glueMaximumSpeed: null,
        sulfurizationLength: null,
        vulcanizingMachineType: null,
        vulcanizedBoardNumber: null,
        resourceName: null,
        processStage: null,
        preProcess: null,
        releaseOrder: null,
        taskCode: null,
        conveyorLengthSpecification: null,
        upGlueThickness: null,
        upBufferGlueThickness: null,
        belowGlueThickness: null,
        belowBufferGlueThickness: null,
        beltWidth: null,
        customerRequestConveyorLength: null,
        rollingProductionMeters: null,
        vulcanizationMeters: null,
        recommendVulcanizationTime: null,
        largeClothMeters: null,
        smallClothMeters: null,
        encapsulationMeters: null,
        workSpeed: null,
        workingHours: null,
        distributionArea: null,
        encapsulationArea: null,
        vulcanizationArea: null,
        conveyorTotalArea: null,
        glueProcess: null,
        upGlue: null,
        upGlueCoefficient: null,
        upGlueDosage: null,
        belowGlue: null,
        belowGlueCoefficient: null,
        belowGlueDosage: null,
        bufferGlue: null,
        bufferGlueCoefficient: null,
        bufferGlueDosage: null,
        largeClothSpecifications: null,
        largeClothFrictioningCoefficient: null,
        largeClothDosage: null,
        middleGlue: null,
        middleGlueCoefficient: null,
        middleGlueDosage: null,
        deviceUsageRestrictions: null,
        workshopSection: null,
        classes: null,
        taskForce: null,
        teamName: null,
        groupLeader: null,
        personnelOperationDetails: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        objId: [
          { required: true, message: '主键标识不能为空', trigger: 'blur' }
        ],
        seqNo: [
          { required: true, message: '计划流水号不能为空', trigger: 'blur' }
        ]
      },
      columns: [
        { key: 0, label: `主键标识`, visible: false },
        { key: 1, label: `硬件`, visible: true },
        { key: 2, label: `软件`, visible: true },
        { key: 3, label: `阶段文字`, visible: true },
        { key: 4, label: `计划流水号`, visible: true },
        { key: 5, label: `计划开始时间`, visible: true },
        { key: 6, label: `计划结束时间`, visible: true },
        { key: 7, label: `关联资源`, visible: true },
        { key: 8, label: `工作效率`, visible: true },
        { key: 9, label: `设备码`, visible: true },
        { key: 10, label: `准备时间`, visible: true },
        { key: 11, label: `收尾时间`, visible: true },
        { key: 12, label: `出布最小速度`, visible: true },
        { key: 13, label: `出布最大速度`, visible: true },
        { key: 14, label: `成型最小速度`, visible: true },
        { key: 15, label: `成型最大速度`, visible: true },
        { key: 16, label: `包胶最小速度`, visible: true },
        { key: 17, label: `包胶最大速度`, visible: true },
        { key: 18, label: `每锅硫化米数`, visible: true },
        { key: 19, label: `硫化机类型`, visible: true },
        { key: 20, label: `硫化板层数`, visible: true },
        { key: 21, label: `资源名称`, visible: true },
        { key: 22, label: `工艺阶段`, visible: true },
        { key: 23, label: `前置工艺`, visible: true },
        { key: 24, label: `发布订单`, visible: true },
        { key: 25, label: `任务编号`, visible: true },
        { key: 26, label: `输送带长度规格`, visible: true },
        { key: 27, label: `上胶厚度`, visible: true },
        { key: 28, label: `上缓冲胶厚度`, visible: true },
        { key: 29, label: `下胶厚度`, visible: true },
        { key: 30, label: `下缓冲胶厚度`, visible: true },
        { key: 31, label: `输送带宽度`, visible: true },
        { key: 32, label: `客户要求输送带长度`, visible: true },
        { key: 33, label: `压延生产米数`, visible: true },
        { key: 34, label: `需要硫化米数`, visible: true },
        { key: 35, label: `推荐硫化时间`, visible: true },
        { key: 36, label: `出大布米数`, visible: true },
        { key: 37, label: `出小布米数`, visible: true },
        { key: 38, label: `包胶米数`, visible: true },
        { key: 39, label: `工作速度`, visible: true },
        { key: 40, label: `需要工时`, visible: true },
        { key: 41, label: `出布面积`, visible: true },
        { key: 42, label: `包胶面积`, visible: true },
        { key: 43, label: `硫化面积`, visible: true },
        { key: 44, label: `输送带总面积`, visible: true },
        { key: 45, label: `胶料工艺`, visible: true },
        { key: 46, label: `上胶使用胶料`, visible: true },
        { key: 47, label: `上胶系数`, visible: true },
        { key: 48, label: `上胶标准用胶量`, visible: true },
        { key: 49, label: `下胶使用胶料`, visible: true },
        { key: 50, label: `下胶系数`, visible: true },
        { key: 51, label: `下胶标准用胶量`, visible: true },
        { key: 52, label: `缓冲/布胶使用胶料`, visible: true },
        { key: 53, label: `缓冲胶系数`, visible: true },
        { key: 54, label: `缓冲胶标准用胶量`, visible: true },
        { key: 55, label: `大布布料规格`, visible: true },
        { key: 56, label: `大布擦胶系数`, visible: true },
        { key: 57, label: `胶布标准用胶量`, visible: true },
        { key: 58, label: `中间胶使用胶料`, visible: true },
        { key: 59, label: `中间胶系数`, visible: true },
        { key: 60, label: `中间胶标准用胶量`, visible: true },
        { key: 61, label: `设备使用限制`, visible: true },
        { key: 62, label: `判断工段`, visible: true },
        { key: 63, label: `班次`, visible: true },
        { key: 64, label: `参加任务小组`, visible: true },
        { key: 65, label: `班组名称`, visible: true },
        { key: 66, label: `组长`, visible: true },
        { key: 67, label: `人员活动详情`, visible: true },
        { key: 68, label: `创建人`, visible: false },
        { key: 69, label: `创建时间`, visible: false },
        { key: 70, label: `更新人`, visible: false },
        { key: 71, label: `更新时间`, visible: false }
      ]
    }
  },
  created() {
    const planCode = this.$route.params && this.$route.params.planCode;
    if (planCode != null){
      this.queryParams.seqNo = planCode;
    }
    this.getList()
  },
  methods: {
    /** 查询生产计划信息列表 */
    getList() {
      this.loading = true
      this.queryParams.params = {}
      if (null != this.daterangePlanStartTime && '' != this.daterangePlanStartTime) {
        this.queryParams.params['beginPlanStartTime'] = this.daterangePlanStartTime[0]
        this.queryParams.params['endPlanStartTime'] = this.daterangePlanStartTime[1]
      }
      if (null != this.daterangePlanEndTime && '' != this.daterangePlanEndTime) {
        this.queryParams.params['beginPlanEndTime'] = this.daterangePlanEndTime[0]
        this.queryParams.params['endPlanEndTime'] = this.daterangePlanEndTime[1]
      }
      listProdPlanErpInfo(this.queryParams).then(response => {
        this.prodPlanErpInfoList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        objId: null,
        hardware: null,
        software: null,
        stageText: null,
        seqNo: null,
        planStartTime: null,
        planEndTime: null,
        associationResource: null,
        workingEfficiency: null,
        equipmentNo: null,
        preparationDuration: null,
        windUpDuration: null,
        clothMinimumSpeed: null,
        clothMaximumSpeed: null,
        formingMinimumSpeed: null,
        formingMaximumSpeed: null,
        glueMinimumSpeed: null,
        glueMaximumSpeed: null,
        sulfurizationLength: null,
        vulcanizingMachineType: null,
        vulcanizedBoardNumber: null,
        resourceName: null,
        processStage: null,
        preProcess: null,
        releaseOrder: null,
        taskCode: null,
        conveyorLengthSpecification: null,
        upGlueThickness: null,
        upBufferGlueThickness: null,
        belowGlueThickness: null,
        belowBufferGlueThickness: null,
        beltWidth: null,
        customerRequestConveyorLength: null,
        rollingProductionMeters: null,
        vulcanizationMeters: null,
        recommendVulcanizationTime: null,
        largeClothMeters: null,
        smallClothMeters: null,
        encapsulationMeters: null,
        workSpeed: null,
        workingHours: null,
        distributionArea: null,
        encapsulationArea: null,
        vulcanizationArea: null,
        conveyorTotalArea: null,
        glueProcess: null,
        upGlue: null,
        upGlueCoefficient: null,
        upGlueDosage: null,
        belowGlue: null,
        belowGlueCoefficient: null,
        belowGlueDosage: null,
        bufferGlue: null,
        bufferGlueCoefficient: null,
        bufferGlueDosage: null,
        largeClothSpecifications: null,
        largeClothFrictioningCoefficient: null,
        largeClothDosage: null,
        middleGlue: null,
        middleGlueCoefficient: null,
        middleGlueDosage: null,
        deviceUsageRestrictions: null,
        workshopSection: null,
        classes: null,
        taskForce: null,
        teamName: null,
        groupLeader: null,
        personnelOperationDetails: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangePlanStartTime = []
      this.daterangePlanEndTime = []
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.objId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加生产计划信息'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const objId = row.objId || this.ids
      getProdPlanErpInfo(objId).then(response => {
        this.form = response.data
        this.open = true
        this.title = '修改生产计划信息'
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.objId != null) {
            updateProdPlanErpInfo(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addProdPlanErpInfo(this.form).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const objIds = row.objId || this.ids
      this.$modal.confirm('是否确认删除生产计划信息编号为"' + objIds + '"的数据项？').then(function() {
        return delProdPlanErpInfo(objIds)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('mes/prod/prodPlanErpInfo/export', {
        ...this.queryParams
      }, `prodPlanErpInfo_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
