<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="编号" prop="code">
        <el-input
          v-model="queryParams.code"
          placeholder="请输入编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" 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"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['monitor:pfdmgr:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['monitor:pfdmgr:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['monitor:pfdmgr:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['monitor:pfdmgr:add']"
        >导入</el-button>
      </el-col>
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="pfdmgrList" @selection-change="handleSelectionChange" :height="clientHeight" border>
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="code" :show-overflow-tooltip="true"/>
      <el-table-column label="Description" align="center" prop="description" :show-overflow-tooltip="true" width="200"/>
      <el-table-column label="H2O" align="center" prop="h2o" :show-overflow-tooltip="true"/>
      <el-table-column label="HYDROGEN" align="center" prop="hydrogen" :show-overflow-tooltip="true"/>
      <el-table-column label="CO" align="center" prop="co" :show-overflow-tooltip="true"/>
      <el-table-column label="METHANE" align="center" prop="methane" :show-overflow-tooltip="true"/>
      <el-table-column label="ACETYLN" align="center" prop="acetyln" :show-overflow-tooltip="true"/>
      <el-table-column label="ETHYLENE" align="center" prop="ethylene" :show-overflow-tooltip="true"/>
      <el-table-column label="ETHANE" align="center" prop="ethane" :show-overflow-tooltip="true"/>
      <el-table-column label="MACETYLN" align="center" prop="macetyln" :show-overflow-tooltip="true"/>
      <el-table-column label="PROPDIEN" align="center" prop="propdien" :show-overflow-tooltip="true"/>
      <el-table-column label="PROPYLEN" align="center" prop="propylen" :show-overflow-tooltip="true"/>
      <el-table-column label="PROPANE" align="center" prop="propane" :show-overflow-tooltip="true"/>
      <el-table-column label="13BUTD" align="center" prop="butd13" :show-overflow-tooltip="true"/>
      <el-table-column label="1BUTENE" align="center" prop="butene1" :show-overflow-tooltip="true"/>
      <el-table-column label="IBTE" align="center" prop="ibte" :show-overflow-tooltip="true"/>
      <el-table-column label="C2BUTENE" align="center" prop="c2butene" :show-overflow-tooltip="true"/>
      <el-table-column label="T2BUTENE" align="center" prop="t2butene" :show-overflow-tooltip="true"/>
      <el-table-column label="IBUTANE" align="center" prop="ibutane" :show-overflow-tooltip="true"/>
      <el-table-column label="BUTANE" align="center" prop="butane" :show-overflow-tooltip="true"/>
      <el-table-column label="13CPD" align="center" prop="cpd13" :show-overflow-tooltip="true"/>
      <el-table-column label="ISOPRENE" align="center" prop="isoprene" :show-overflow-tooltip="true"/>
      <el-table-column label="C13PND" align="center" prop="c13pnd" :show-overflow-tooltip="true"/>
      <el-table-column label="1PENTENE" align="center" prop="pentene1" :show-overflow-tooltip="true"/>
      <el-table-column label="IPENTANE" align="center" prop="ipentane" :show-overflow-tooltip="true"/>
      <el-table-column label="PENTANE" align="center" prop="pentane" :show-overflow-tooltip="true"/>
      <el-table-column label="1HEXENE" align="center" prop="hexene1" :show-overflow-tooltip="true"/>
      <el-table-column label="BENZENE" align="center" prop="benzene" :show-overflow-tooltip="true"/>
      <el-table-column label="TOLUENE" align="center" prop="toluene" :show-overflow-tooltip="true"/>
      <el-table-column label="OXYLENE" align="center" prop="oxylene" :show-overflow-tooltip="true"/>
      <el-table-column label="C9-200C" align="center" prop="c9200c" :show-overflow-tooltip="true"/>
      <el-table-column label="FUEL OIL" align="center" prop="fuelOil" :show-overflow-tooltip="true"/>
      <el-table-column label="CO2" align="center" prop="co2" :show-overflow-tooltip="true"/>
      <el-table-column label="H2S" align="center" prop="h2s" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 25" align="center" prop="nbp25" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 58" align="center" prop="nbp58" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 72" align="center" prop="nbp72" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 86" align="center" prop="nbp86" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 100" align="center" prop="nbp100" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 114" align="center" prop="nbp114" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 128" align="center" prop="nbp128" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 141" align="center" prop="nbp141" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 155" align="center" prop="nbp155" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 169" align="center" prop="nbp169" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 183" align="center" prop="nbp183" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 199" align="center" prop="nbp199" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 207" align="center" prop="nbp207" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 222" align="center" prop="nbp222" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 236" align="center" prop="nbp236" :show-overflow-tooltip="true"/>
      <el-table-column label="NBP 249" align="center" prop="nbp249" :show-overflow-tooltip="true"/>
      <el-table-column label="Total Molar Flowrate" align="center" prop="totalMolarFlowrate" :show-overflow-tooltip="true"/>
      <el-table-column label="Total Mass Flowrate" align="center" prop="totalMassFlowrate" :show-overflow-tooltip="true"/>
      <el-table-column label="Total Molecular Weight" align="center" prop="totalMolecularWeight" :show-overflow-tooltip="true"/>
      <el-table-column label="Temperature" align="center" prop="temperature" :show-overflow-tooltip="true"/>
      <el-table-column label="Pressure" align="center" prop="pressure" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Mass Flowrate" align="center" prop="vaporMassFlowrate" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Molecular Weight" align="center" prop="vaporMolecularWeight" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Density, Act" align="center" prop="vaporDensityAct" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Z" align="center" prop="vaporZ" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Act Vol Flow" align="center" prop="vaporActVolFlow" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Ht Capacity" align="center" prop="vaporHtCapacity" :show-overflow-tooltip="true"/>
      <el-table-column label="Vapor Viscosity" align="center" prop="vaporViscosity" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Mass Flowrate" align="center" prop="liquidMassFlowrate" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Molecular Weight" align="center" prop="liquidMolecularWeight" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Density, Act" align="center" prop="liquidDensityAct" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Act Vol Flow" align="center" prop="liquidActVolFlow" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Ht Capacity" align="center" prop="liquidHtCapacity" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Viscosity" align="center" prop="liquidViscosity" :show-overflow-tooltip="true"/>
      <el-table-column label="Liquid Surf Tension" align="center" prop="liquidSurfTension" :show-overflow-tooltip="true"/>
      <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['monitor:pfdmgr:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['monitor:pfdmgr: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"
    />

    <!-- 添加或修改PFD管理对话框 -->
    <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="code">
          <el-input v-model="form.code" placeholder="请输入编号" />
        </el-form-item>
        <el-form-item label="Description" prop="description">
          <el-input v-model="form.description" placeholder="请输入Description" />
        </el-form-item>
        <el-form-item label="H2O" prop="h2o">
          <el-input v-model="form.h2o" placeholder="请输入H2O" />
        </el-form-item>
        <el-form-item label="HYDROGEN" prop="hydrogen">
          <el-input v-model="form.hydrogen" placeholder="请输入HYDROGEN" />
        </el-form-item>
        <el-form-item label="CO" prop="co">
          <el-input v-model="form.co" placeholder="请输入CO" />
        </el-form-item>
        <el-form-item label="METHANE" prop="methane">
          <el-input v-model="form.methane" placeholder="请输入METHANE" />
        </el-form-item>
        <el-form-item label="ACETYLN" prop="acetyln">
          <el-input v-model="form.acetyln" placeholder="请输入ACETYLN" />
        </el-form-item>
        <el-form-item label="ETHYLENE" prop="ethylene">
          <el-input v-model="form.ethylene" placeholder="请输入ETHYLENE" />
        </el-form-item>
        <el-form-item label="ETHANE" prop="ethane">
          <el-input v-model="form.ethane" placeholder="请输入ETHANE" />
        </el-form-item>
        <el-form-item label="MACETYLN" prop="macetyln">
          <el-input v-model="form.macetyln" placeholder="请输入MACETYLN" />
        </el-form-item>
        <el-form-item label="PROPDIEN" prop="propdien">
          <el-input v-model="form.propdien" placeholder="请输入PROPDIEN" />
        </el-form-item>
        <el-form-item label="PROPYLEN" prop="propylen">
          <el-input v-model="form.propylen" placeholder="请输入PROPYLEN" />
        </el-form-item>
        <el-form-item label="PROPANE" prop="propane">
          <el-input v-model="form.propane" placeholder="请输入PROPANE" />
        </el-form-item>
        <el-form-item label="13BUTD" prop="butd13">
          <el-input v-model="form.butd13" placeholder="请输入13BUTD" />
        </el-form-item>
        <el-form-item label="1BUTENE" prop="butene1">
          <el-input v-model="form.butene1" placeholder="请输入1BUTENE" />
        </el-form-item>
        <el-form-item label="IBTE" prop="ibte">
          <el-input v-model="form.ibte" placeholder="请输入IBTE" />
        </el-form-item>
        <el-form-item label="C2BUTENE" prop="c2butene">
          <el-input v-model="form.c2butene" placeholder="请输入C2BUTENE" />
        </el-form-item>
        <el-form-item label="T2BUTENE" prop="t2butene">
          <el-input v-model="form.t2butene" placeholder="请输入T2BUTENE" />
        </el-form-item>
        <el-form-item label="IBUTANE" prop="ibutane">
          <el-input v-model="form.ibutane" placeholder="请输入IBUTANE" />
        </el-form-item>
        <el-form-item label="BUTANE" prop="butane">
          <el-input v-model="form.butane" placeholder="请输入BUTANE" />
        </el-form-item>
        <el-form-item label="13CPD" prop="cpd13">
          <el-input v-model="form.cpd13" placeholder="请输入13CPD" />
        </el-form-item>
        <el-form-item label="ISOPRENE" prop="isoprene">
          <el-input v-model="form.isoprene" placeholder="请输入ISOPRENE" />
        </el-form-item>
        <el-form-item label="C13PND" prop="c13pnd">
          <el-input v-model="form.c13pnd" placeholder="请输入C13PND" />
        </el-form-item>
        <el-form-item label="1PENTENE" prop="pentene1">
          <el-input v-model="form.pentene1" placeholder="请输入1PENTENE" />
        </el-form-item>
        <el-form-item label="IPENTANE" prop="ipentane">
          <el-input v-model="form.ipentane" placeholder="请输入IPENTANE" />
        </el-form-item>
        <el-form-item label="PENTANE" prop="pentane">
          <el-input v-model="form.pentane" placeholder="请输入PENTANE" />
        </el-form-item>
        <el-form-item label="1HEXENE" prop="hexene1">
          <el-input v-model="form.hexene1" placeholder="请输入1HEXENE" />
        </el-form-item>
        <el-form-item label="BENZENE" prop="benzene">
          <el-input v-model="form.benzene" placeholder="请输入BENZENE" />
        </el-form-item>
        <el-form-item label="TOLUENE" prop="toluene">
          <el-input v-model="form.toluene" placeholder="请输入TOLUENE" />
        </el-form-item>
        <el-form-item label="OXYLENE" prop="oxylene">
          <el-input v-model="form.oxylene" placeholder="请输入OXYLENE" />
        </el-form-item>
        <el-form-item label="C9-200C" prop="c9200c">
          <el-input v-model="form.c9200c" placeholder="请输入C9-200C" />
        </el-form-item>
        <el-form-item label="FUEL OIL" prop="fuelOil">
          <el-input v-model="form.fuelOil" placeholder="请输入FUEL OIL" />
        </el-form-item>
        <el-form-item label="CO2" prop="co2">
          <el-input v-model="form.co2" placeholder="请输入CO2" />
        </el-form-item>
        <el-form-item label="H2S" prop="h2s">
          <el-input v-model="form.h2s" placeholder="请输入H2S" />
        </el-form-item>
        <el-form-item label="NBP 25" prop="nbp25">
          <el-input v-model="form.nbp25" placeholder="请输入NBP 25" />
        </el-form-item>
        <el-form-item label="NBP 58" prop="nbp58">
          <el-input v-model="form.nbp58" placeholder="请输入NBP 58" />
        </el-form-item>
        <el-form-item label="NBP 72" prop="nbp72">
          <el-input v-model="form.nbp72" placeholder="请输入NBP 72" />
        </el-form-item>
        <el-form-item label="NBP 86" prop="nbp86">
          <el-input v-model="form.nbp86" placeholder="请输入NBP 86" />
        </el-form-item>
        <el-form-item label="NBP 100" prop="nbp100">
          <el-input v-model="form.nbp100" placeholder="请输入NBP 100" />
        </el-form-item>
        <el-form-item label="NBP 114" prop="nbp114">
          <el-input v-model="form.nbp114" placeholder="请输入NBP 114" />
        </el-form-item>
        <el-form-item label="NBP 128" prop="nbp128">
          <el-input v-model="form.nbp128" placeholder="请输入NBP 128" />
        </el-form-item>
        <el-form-item label="NBP 141" prop="nbp141">
          <el-input v-model="form.nbp141" placeholder="请输入NBP 141" />
        </el-form-item>
        <el-form-item label="NBP 155" prop="nbp155">
          <el-input v-model="form.nbp155" placeholder="请输入NBP 155" />
        </el-form-item>
        <el-form-item label="NBP 169" prop="nbp169">
          <el-input v-model="form.nbp169" placeholder="请输入NBP 169" />
        </el-form-item>
        <el-form-item label="NBP 183" prop="nbp183">
          <el-input v-model="form.nbp183" placeholder="请输入NBP 183" />
        </el-form-item>
        <el-form-item label="NBP 199" prop="nbp199">
          <el-input v-model="form.nbp199" placeholder="请输入NBP 199" />
        </el-form-item>
        <el-form-item label="NBP 207" prop="nbp207">
          <el-input v-model="form.nbp207" placeholder="请输入NBP 207" />
        </el-form-item>
        <el-form-item label="NBP 222" prop="nbp222">
          <el-input v-model="form.nbp222" placeholder="请输入NBP 222" />
        </el-form-item>
        <el-form-item label="NBP 236" prop="nbp236">
          <el-input v-model="form.nbp236" placeholder="请输入NBP 236" />
        </el-form-item>
        <el-form-item label="NBP 249" prop="nbp249">
          <el-input v-model="form.nbp249" placeholder="请输入NBP 249" />
        </el-form-item>
        <el-form-item label="Total Molar Flowrate" prop="totalMolarFlowrate">
          <el-input v-model="form.totalMolarFlowrate" placeholder="请输入Total Molar Flowrate" />
        </el-form-item>
        <el-form-item label="Total Mass Flowrate" prop="totalMassFlowrate">
          <el-input v-model="form.totalMassFlowrate" placeholder="请输入Total Mass Flowrate" />
        </el-form-item>
        <el-form-item label="Total Molecular Weight" prop="totalMolecularWeight">
          <el-input v-model="form.totalMolecularWeight" placeholder="请输入Total Molecular Weight" />
        </el-form-item>
        <el-form-item label="Temperature" prop="temperature">
          <el-input v-model="form.temperature" placeholder="请输入Temperature" />
        </el-form-item>
        <el-form-item label="Pressure" prop="pressure">
          <el-input v-model="form.pressure" placeholder="请输入Pressure" />
        </el-form-item>
        <el-form-item label="Vapor Mass Flowrate" prop="vaporMassFlowrate">
          <el-input v-model="form.vaporMassFlowrate" placeholder="请输入Vapor Mass Flowrate" />
        </el-form-item>
        <el-form-item label="Vapor Molecular Weight" prop="vaporMolecularWeight">
          <el-input v-model="form.vaporMolecularWeight" placeholder="请输入Vapor Molecular Weight" />
        </el-form-item>
        <el-form-item label="Vapor Density, Act" prop="vaporDensityAct">
          <el-input v-model="form.vaporDensityAct" placeholder="请输入Vapor Density, Act" />
        </el-form-item>
        <el-form-item label="Vapor Z" prop="vaporZ">
          <el-input v-model="form.vaporZ" placeholder="请输入Vapor Z" />
        </el-form-item>
        <el-form-item label="Vapor Act Vol Flow" prop="vaporActVolFlow">
          <el-input v-model="form.vaporActVolFlow" placeholder="请输入Vapor Act Vol Flow" />
        </el-form-item>
        <el-form-item label="Vapor Ht Capacity" prop="vaporHtCapacity">
          <el-input v-model="form.vaporHtCapacity" placeholder="请输入Vapor Ht Capacity" />
        </el-form-item>
        <el-form-item label="Vapor Viscosity" prop="vaporViscosity">
          <el-input v-model="form.vaporViscosity" placeholder="请输入Vapor Viscosity" />
        </el-form-item>
        <el-form-item label="Liquid Mass Flowrate" prop="liquidMassFlowrate">
          <el-input v-model="form.liquidMassFlowrate" placeholder="请输入Liquid Mass Flowrate" />
        </el-form-item>
        <el-form-item label="Liquid Molecular Weight" prop="liquidMolecularWeight">
          <el-input v-model="form.liquidMolecularWeight" placeholder="请输入Liquid Molecular Weight" />
        </el-form-item>
        <el-form-item label="Liquid Density, Act" prop="liquidDensityAct">
          <el-input v-model="form.liquidDensityAct" placeholder="请输入Liquid Density, Act" />
        </el-form-item>
        <el-form-item label="Liquid Act Vol Flow" prop="liquidActVolFlow">
          <el-input v-model="form.liquidActVolFlow" placeholder="请输入Liquid Act Vol Flow" />
        </el-form-item>
        <el-form-item label="Liquid Ht Capacity" prop="liquidHtCapacity">
          <el-input v-model="form.liquidHtCapacity" placeholder="请输入Liquid Ht Capacity" />
        </el-form-item>
        <el-form-item label="Liquid Viscosity" prop="liquidViscosity">
          <el-input v-model="form.liquidViscosity" placeholder="请输入Liquid Viscosity" />
        </el-form-item>
        <el-form-item label="Liquid Surf Tension" prop="liquidSurfTension">
          <el-input v-model="form.liquidSurfTension" placeholder="请输入Liquid Surf Tension" />
        </el-form-item>
          <el-form-item label="归属部门" prop="deptId">
              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" 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>
      <!-- 用户导入对话框 -->
      <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
          <el-upload
                  ref="upload"
                  :limit="1"
                  accept=".xlsx, .xls"
                  :headers="upload.headers"
                  :action="upload.url"
                  :disabled="upload.isUploading"
                  :on-progress="handleFileUploadProgress"
                  :on-success="handleFileSuccess"
                  :auto-upload="false"
                  drag
          >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                  将文件拖到此处，或
                  <em>点击上传</em>
              </div>
              <!--<div class="el-upload__tip" slot="tip">-->
                  <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
                  <!--<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
              <!--</div>-->
              <!--<div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>-->
          </el-upload>
          <div slot="footer" class="dialog-footer">
              <el-button type="primary" @click="submitFileForm">确 定</el-button>
              <el-button @click="upload.open = false">取 消</el-button>
          </div>
      </el-dialog>
  </div>
</template>

<script>
import { listPfdmgr, getPfdmgr, delPfdmgr, addPfdmgr, updatePfdmgr, exportPfdmgr, importTemplate} from "@/api/monitor/pfdmgr";
import { treeselect } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "Pfdmgr",
  components: { Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // PFD管理表格数据
      pfdmgrList: [],
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: undefined,
      clientHeight:300,
      // 是否显示弹出层
      open: false,
        // 用户导入参数
        upload: {
            // 是否显示弹出层（用户导入）
            open: false,
            // 弹出层标题（用户导入）
            title: "",
            // 是否禁用上传
            isUploading: false,
            // 是否更新已经存在的用户数据
            updateSupport: 0,
            // 设置上传的请求头部
            headers: { Authorization: "Bearer " + getToken() },
            // 上传的地址
            url: process.env.VUE_APP_BASE_API + "/monitor/pfdmgr/importData"
        },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        code: null,
        h2o: null,
        hydrogen: null,
        co: null,
        methane: null,
        acetyln: null,
        ethylene: null,
        ethane: null,
        macetyln: null,
        propdien: null,
        propylen: null,
        propane: null,
        butd13: null,
        butene1: null,
        ibte: null,
        c2butene: null,
        t2butene: null,
        ibutane: null,
        butane: null,
        cpd13: null,
        isoprene: null,
        c13pnd: null,
        pentene1: null,
        ipentane: null,
        pentane: null,
        hexene1: null,
        benzene: null,
        toluene: null,
        oxylene: null,
        c9200c: null,
        fuelOil: null,
        co2: null,
        h2s: null,
        nbp25: null,
        nbp58: null,
        nbp72: null,
        nbp86: null,
        nbp100: null,
        nbp114: null,
        nbp128: null,
        nbp141: null,
        nbp155: null,
        nbp169: null,
        nbp183: null,
        nbp199: null,
        nbp207: null,
        nbp222: null,
        nbp236: null,
        nbp249: null,
        totalMolarFlowrate: null,
        totalMassFlowrate: null,
        totalMolecularWeight: null,
        temperature: null,
        pressure: null,
        vaporMassFlowrate: null,
        vaporMolecularWeight: null,
        vaporDensityAct: null,
        vaporZ: null,
        vaporActVolFlow: null,
        vaporHtCapacity: null,
        vaporViscosity: null,
        liquidMassFlowrate: null,
        liquidMolecularWeight: null,
        liquidDensityAct: null,
        liquidActVolFlow: null,
        liquidHtCapacity: null,
        liquidViscosity: null,
        liquidSurfTension: null,
        deptId: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  watch: {
        // 根据名称筛选部门树
        deptName(val) {
            this.$refs.tree.filter(val);
        }
   },
  created() {
      //设置表格高度对应屏幕高度
      this.$nextTick(() => {
          this.clientHeight = document.body.clientHeight -250
      })
    this.getList();
    this.getTreeselect();
  },
  methods: {
    /** 查询PFD管理列表 */
    getList() {
      this.loading = true;
      listPfdmgr(this.queryParams).then(response => {
        this.pfdmgrList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
     /** 查询部门下拉树结构 */
     getTreeselect() {
          treeselect().then(response => {
              this.deptOptions = response.data;
          });
     },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        code: null,
        h2o: null,
        hydrogen: null,
        co: null,
        methane: null,
        acetyln: null,
        ethylene: null,
        ethane: null,
        macetyln: null,
        propdien: null,
        propylen: null,
        propane: null,
        butd13: null,
        butene1: null,
        ibte: null,
        c2butene: null,
        t2butene: null,
        ibutane: null,
        butane: null,
        cpd13: null,
        isoprene: null,
        c13pnd: null,
        pentene1: null,
        ipentane: null,
        pentane: null,
        hexene1: null,
        benzene: null,
        toluene: null,
        oxylene: null,
        c9200c: null,
        fuelOil: null,
        co2: null,
        h2s: null,
        nbp25: null,
        nbp58: null,
        nbp72: null,
        nbp86: null,
        nbp100: null,
        nbp114: null,
        nbp128: null,
        nbp141: null,
        nbp155: null,
        nbp169: null,
        nbp183: null,
        nbp199: null,
        nbp207: null,
        nbp222: null,
        nbp236: null,
        nbp249: null,
        totalMolarFlowrate: null,
        totalMassFlowrate: null,
        totalMolecularWeight: null,
        temperature: null,
        pressure: null,
        vaporMassFlowrate: null,
        vaporMolecularWeight: null,
        vaporDensityAct: null,
        vaporZ: null,
        vaporActVolFlow: null,
        vaporHtCapacity: null,
        vaporViscosity: null,
        liquidMassFlowrate: null,
        liquidMolecularWeight: null,
        liquidDensityAct: null,
        liquidActVolFlow: null,
        liquidHtCapacity: null,
        liquidViscosity: null,
        liquidSurfTension: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        deptId: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加PFD管理";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPfdmgr(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改PFD管理";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePfdmgr(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPfdmgr(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delPfdmgr(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有PFD管理数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportPfdmgr(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    },
      /** 导入按钮操作 */
      handleImport() {
          this.upload.title = "用户导入";
          this.upload.open = true;
      },
      /** 下载模板操作 */
      importTemplate() {
          importTemplate().then(response => {
              this.download(response.msg);
          });
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
          this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
          this.upload.open = false;
          this.upload.isUploading = false;
          this.$refs.upload.clearFiles();
          this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
          this.getList();
      },
      // 提交上传文件
      submitFileForm() {
          this.$refs.upload.submit();
      }
  }
};
</script>
