<template>
  <div class="app-container">
    <el-form ref="queryForm" :model="queryParams" size="small" :inline="true">
      <el-form-item label="作业类型">
        <el-input v-model="queryParams.opTypCd" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="管理单位" prop="mgmtOrgNm">
        <el-input
          v-model="queryParams.mgmtOrgNm"
          placeholder="请输入"
        ></el-input>
      </el-form-item>
      <el-form-item label="作业班组" prop="workTeamNm">
        <el-input
          v-model="queryParams.workTeamNm"
          placeholder="请输入"
        ></el-input>
      </el-form-item>
      <el-form-item label="工作负责人" prop="workPrincipNm">
        <el-input
          v-model="queryParams.workPrincipNm"
          placeholder="请输入"
        ></el-input>
      </el-form-item>
      <el-form-item label="作业单位" prop="submitOrgNm">
        <el-input
          v-model="queryParams.submitOrgNm"
          placeholder="请输入"
        ></el-input>
      </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>
    <div class="table">
      <el-table v-loading="loading" :data="dataList">
        <el-table-column prop="date" label="序号" width="80" align="center">
          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
        </el-table-column>
        <el-table-column label="作业内容" align="center" prop="opContent" />
        <el-table-column
          label="作业地址"
          align="center"
          prop="opAddr"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="线路/变电站"
          prop="subsOrLineId"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="电压等级"
          prop="voltLvlCd"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业类型"
          prop="opTypCd"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="管理单位"
          prop="mgmtOrgNm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业单位"
          prop="submitOrgNm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="工作负责人"
          prop="workPrincipNm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业班组"
          prop="workTeamNm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业风险"
          prop="opRiskLvlDsc"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业人数"
          prop="mainBusiOrgOpNum"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业开始时间"
          prop="planStartWkTm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="作业结束时间"
          prop="planEndTm"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column label="专业类型" align="center" prop="majorTypCd">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getWorkPlanList } from "@/api/secure/pdm-work-plan";
export default {
  data() {
    return {
      dataList: [],
      // 遮罩层
      loading: true,
      total: 0,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        opTypDsc: "",
        mgmtOrgNm: "",
        workTeamNm: "",
        workPrincipNm: "",
        submitOrgNm: "",
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      getWorkPlanList({ ...this.queryParams, dataFlag: 1 }).then((response) => {
        this.dataList = response.rows;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>
<style lang="scss" scoped>
.table {
  height: calc(100% - 150px);
}
::v-deep {
  .el-table {
    height: 100%;
    width: 100%;
    .el-table__body-wrapper {
      width: 100% !important;
      height: calc(100% - 50px) !important; // 表格高度减去表头的高度
      overflow-y: scroll;
    }
  }
}
</style>
