<script>
import { getJdjcUnit, getGcjztjUnit } from "@/api/index.js";
import { ylycyhzzqdTc } from "@/api/risk";
import { area } from "@/api/area";
import punishmentMixin from "@/mixin/unit.js";
export default {
  name: "BasicInfoModalContent",
  mixins: [punishmentMixin],
  data() {
    return {
      options: [],
      fxdjList: [],
      tableData: [],
      unitList: [],
      value: "全市",
      params: {
        pageSize: 10,
        pageNum: 1,
      },
      total: 0,
      search: "",
    };
  },
  props: {
    unit: String,
  },
  watch: {
    unit: {
      handler(val) {
        this.value = val;
        this.funUnitList();
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    rowClickHandler(val) {
      this.$router.push(`/detail?id=${val.id}`);
    },
    funUnitList() {
      ylycyhzzqdTc({
        ...this.params,
        qx: this.value === "重庆市" ? "" : this.value,
        gcjzmc: this.search,
      }).then((res) => {
        this.tableData = res.data.rows;
        this.total = res.data.total;
      });
    },
    handleSizeChange(val) {
      this.params.pageSize = val;
      this.funUnitList();
    },
    handleCurrentChange(val) {
      this.params.pageNum = val;
      this.funUnitList();
    },
    resetForm() {
      this.value = "";
      this.search = "";
      (this.params = {
        pageSize: 10,
        pageNum: 1,
      }),
        this.funUnitList();
    },
  },
  created() {
    this.funUnitList();
    area({
      pageNum: 1,
      pageSize: 100,
    }).then((res) => {
      this.options = res.data.rows;
    });
  },
};
</script>

<template>
  <div>
    <!-- 建筑数 -->
    <div class="unit-bulid">
      <div class="unit-num" v-for="(item, index) in unitList" :key="index">
        <span>{{ item.title }}</span>
        <!-- <span class="build-num">{{ item.unitNum }}</span> -->
        <LinearText
          style="display: inline-block"
          :text="item.unitNum"
          fontSize="40px"
        ></LinearText>
      </div>
    </div>
    <!-- 搜索 -->
    <div class="maintenance-supervision">
      <div class="maintenance-supervision_header">
        <div class="select-item">
          <el-select v-model="value" placeholder="请选择">
            <el-option
              :value="item.areaTitle"
              :label="item.areaTitle"
              v-for="(item, index) in options"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 重点情形 -->
        <div>
          <el-select v-model="params.jzdx" placeholder="重点情形">
            <el-option
              :value="item.value"
              :label="item.label"
              v-for="(item, index) in TypeList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 隐患项目 -->
        <div>
          <el-select v-model="params.jcnd" placeholder="隐患项目">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in yearList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 排查情况 -->
        <div>
          <el-select v-model="params.gd" placeholder="排查情况">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in higthList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 整改进度 -->
        <div>
          <el-select v-model="params.xfaqglxs" placeholder="整改进度">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in mentList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 隐患分类 -->
        <div>
          <el-select v-model="params.glzthztjzd" placeholder="隐患分类">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in glList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 整改期限 -->
        <div>
          <el-select v-model="params.wbxs" placeholder="整改期限">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in wbList"
              :key="index"
            >
            </el-option>
          </el-select>
        </div>
        <!-- 风险等级 -->
        <!-- <div>
          <el-select v-model="params.fxdj" placeholder="风险等级">
            <el-option
              :value="item.value"
              :label="item.lable"
              v-for="(item, index) in fxdjLlst"
              :key="index"
            >
            </el-option>
          </el-select>
        </div> -->
        <div class="inp">
          <el-input v-model="search" placeholder="请输入建筑名称"></el-input>
        </div>
      </div>
      <div class="btn-item">
        <el-button @click="funUnitList">搜索</el-button>
        <el-button @click="resetForm">重置</el-button>
      </div>
    </div>

    <basic-table
      :data="tableData"
      @row-click="rowClickHandler"
      style="text-align: center"
    >
      <el-table-column type="index" label="序号"> </el-table-column>
      <el-table-column prop="qx" label="区县" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="gcjzmc" label="建筑名称" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="zdqx" label="重点情形" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="yhs" label="隐患数" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="yhxm" label="隐患项目" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="pcqk" label="排查情况" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="yhjd" label="整改进度" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="jtqk" label="具体问题" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="zgcs" label="整改措施" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="zgzrdw" label="整改单位" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="zgzrr" label="整改责任人" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="zgsx" label="整改时限" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="zgzjwy" label="整改资金" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="djsj" label="登记时间" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="sftxdw" label="是否提醒单位" show-overflow-tooltip> </el-table-column>
      <el-table-column
        prop="sfts"
        label="是否推送乡镇街道、公安派出所或者行业部门"
        show-overflow-tooltip
      >
      </el-table-column>
    </basic-table>
    <br />
    <basic-pagination
      layout="total,->,prev, pager, next, sizes,jumper"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="params.pageSize"
      :current-page="params.PageNum"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<style scoped lang="less">
.maintenance-supervision {
  // padding: 10px 10px 0px 20px;
  ::v-deep(.el-input__inner) {
    border: none;
    background: linear-gradient(
      360deg,
      rgba(0, 148, 255, 0.5) 0%,
      rgba(0, 148, 255, 0.31) 100%
    );
    color: #fff;
  }

  ::v-deep(.el-button) {
    border: none;
    background: linear-gradient(360deg, #0094ff90 0%, #0094ff10 100%);
    color: #fff;
  }

  .maintenance-supervision_header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    // border-bottom: 1px solid #154956;
    padding-bottom: 10px;
    font-size: 12px;
    color: rgb(79, 149, 186);
    // .select-item{
    //   margin-right: 20px;
    // }
  }

  .btn-item {
    margin-bottom: 10px;
  }

  .warp {
    height: 520px;
    margin: 0 auto;
    overflow: hidden;

    .item {
      list-style: none;
      padding: 0;
      margin: 0 auto;
      cursor: pointer;
    }
    &:hover {
      overflow: auto;
    }
  }

  /deep/.el-input__inner {
    background-color: #184254;
    width: 150px;
    height: 30px;
    margin-bottom: 5px;
  }

  /deep/.el-button {
    width: 100px;
    height: 32px;
    font-size: 14px;
    line-height: 2px;
    // margin: 0 20px 0 30px;
    color: #fff;
    border-radius: 5px;
    border: none;
  }

  /deep/.el-button:hover {
    color: rgb(80, 147, 224);
  }

  /deep/.select_btn {
    position: absolute;
    top: 225px;
    right: 320px;
    //下拉框
  }

  /deep/.el-input {
    width: 150px;
    // margin-left: 20px;
  }

  .header {
    color: #fff;
    height: 33px !important;
    line-height: 33px !important;
    background-color: rgba(0, 163, 255, 0.3) !important;
    color: #61dbff;
    margin-top: 15px;
    margin-bottom: 6px;
  }

  .row,
  li,
  a {
    display: block;
    height: 39px;
    line-height: 39px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.2);

    .time,
    .num,
    .person,
    .result {
      flex: 0.33;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .num {
      flex: 0.15;
    }
  }

  .inp {
    margin-left: 20px;
  }
}

.unit-bulid {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 18px;
}

.unit-num {
  width: 200px;
  height: 109px;
  border: 1px solid #0463a7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  line-height: 59px;
}
</style>
