<template>
  <el-dialog
    :visible.sync="dialogVisible"
    :show-close="false"
    :destroy-on-close="true"
    :close-on-click-modal="false"
    append-to-body
    custom-class="dialog-boxed"
    width="70%"
  >
  <div class="dialog-slot">
    <div class="closeClick">
      <div class="newplan">
        <div class="line"></div>
        <div class="span">新增计划</div>
      </div>
      <img src="@/assets/images/close.png" alt="" @click="Close">
    </div>
    <div class="content">
      <div class="module">
        <div class="select" :class="nextStep ? '':'nextStepSelect'">
          <span class="span-one">Ⅰ</span>
          <span>选择企业</span>
        </div>
        <div class="issue" :class="nextStep ? 'nextStepIssue':''">
          <span class="span-one">Ⅱ</span>
          <span>发布计划</span>
        </div>
      </div>
      <div v-if="!nextStep">
        <div class="filtrate">
          <div class="select-input">
            <div class="select-span">行政区划:</div>
            <el-select v-model="form.compartment" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="select-input">
            <div class="select-span">企业类型:</div>
            <el-select v-model="form.frimType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="select-input">
            <div class="select-span">经济类型:</div>
            <el-select v-model="form.economicsType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="select-input">
            <div class="select-span">行业类型:</div>
            <el-select v-model="form.industryType" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="select-input">
            <div class="select-span">重大危险源等级:</div>
            <el-select v-model="form.riskGrade" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="select-input">
            <div class="select-span">企业分色:</div>
            <el-select v-model="form.frimColor" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="input-input">
            <el-input v-model="form.frimName" placeholder="请输入企业名称/统一信用代码"></el-input>
          </div>
          <div class="select-btn">搜索</div>
        </div>
        <div class="tables">
          <el-table
            :data="tableData"
            style="width: 100%"
            :border="false"
            @selection-change="handleSelectionChange"
            :row-class-name="tableRowClassName"
          >
            <el-table-column
              type="selection"
              width="55"
              header-align="center"
            >
            </el-table-column>
            <el-table-column
              prop="date"
              label="企业名称"
              width="180"
              header-align="center"
            >
            </el-table-column>
            <el-table-column
              prop="name"
              label="行政区划"
              width="180"
              header-align="center"
            >
            </el-table-column>
            <el-table-column
              prop="address"
              label="企业类型"
              header-align="center"
            >
            </el-table-column>
            <el-table-column
              prop="address"
              label="统一社会信用代码"
              header-align="center"
            >
            </el-table-column>
          </el-table>
        </div>
        <div class="pagination">
          <my-pagination :total="28" @pagesChange="pagesChange"></my-pagination>
        </div>
      </div>
      <div v-else="nextStep" class="release-planning">
        <div class="inputs centered">
          <div class="inputs-span">计划年份:</div>
          <el-select v-model="form2.year" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </div>
        <div class="inputs centered">
          <div class="inputs-span">计划标题:</div>
          <div class="input">
            <el-input v-model="form2.title" :maxlength="50" placeholder="请输入计划标题"></el-input>
          </div>
        </div>
        <div class="inputs">
          <div class="inputs-span">计划内容:</div>
          <div class="input">
            <el-input v-model="form2.content" type="textarea" resize="none" placeholder="请输入计划内容"></el-input>
          </div>
        </div>
        <div class="inputs">
          <div class="inputs-span">备注:</div>
          <div class="input">
            <el-input v-model="form2.remark" type="textarea" resize="none" placeholder="请输入备注"></el-input>
          </div>
        </div>
      </div>
      <div class="next">
        <div class="selected">已选择<span>{{ selected }}</span>家企业</div>
        <div class="btn" @click="next" ref="next">{{ nextText }}</div>
      </div>
    </div>
  </div>
  </el-dialog>
</template>
<script>
import myPagination from "@/views/components/myPagination/index.vue"
export default {
  components:{myPagination},
  data() {
    return {
      dialogVisible:false,
      tableData: [{
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-08',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-06',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-07',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-08',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-06',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-07',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }],
      options:[],
      multipleSelection: [],
      selected:0,
      nextStep:false,
      nextText:'下一步',
      form:{
        compartment:'',
        frimType:'',
        economicsType:'',
        industryType:'',
        riskGrade:'',
        frimColor:'',
        frimName:'',
      },
      form2:{
        year:'',
        title:'',
        content:'',
        remark:'',
      }
    }
  },
  methods:{
    open(){
      this.dialogVisible = true;
    },
    Close(){
      this.dialogVisible = false;
      this.nextStep = false;
      this.nextText = '下一步';
    },
    // 页码，当前页切换事件
    pagesChange(pages){
      console.log(pages)
    },
    // 选中的数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
      this.selected = this.multipleSelection.length;
    },
    // 下一步
    next(){
      if(this.$refs.next.innerText == '下一步') {
        this.nextStep = true;
        this.nextText = '发布计划'
      } else {
        console.log(form2)
        // console.log('该发布计划了')
      }
    },
    tableRowClassName({row, rowIndex}) {
      if (rowIndex % 2 !== 0) {
        return 'success-row';
      }
      return '';
    }
  },
}
</script>
<style lang="scss" scoped>
.dialog-slot {
  .closeClick {
    position: absolute;
    top: 0;
    right: 0;
    padding: 10px 20px;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    background: #f8f9fa;
    box-shadow: 0px 1px 0px 0px #dbe0e8;
    background-color: #E0EAF8;
    img {
      width: 18px;
      height: 18px;
      cursor: pointer;
    }
    .newplan {
      display: flex;
      align-items: center;
      .line {
        margin-right: 10px;
        width: 5px;
        height: 16px;
        background-color: #1E70DE;
      }
      .span {
        font-size: 16px;
        font-family: 'Alibaba PuHuiTi';
        font-weight: bold;
        color: #1E70DE;
      }
    }
  }
  .content {
    // padding: 15px 10px;
    .module {
      padding-bottom: 15px;
      display: flex;
      border-bottom: 1px solid #E8ECF0;
      .select,.issue {
        width: 150px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #525966;
        span {
          font-size: 15px;
          font-family: 'Alibaba PuHuiTi';
          font-weight: 400;
        }
        .span-one {
          margin-right: 10px;
        }
      }
      .select {
        background-image: url('../../../assets/images/select2.png');
        background-size: 100% 100%;
        margin-right: 10px;
      }
      .issue {
        background-image: url('../../../assets/images/issue2.png');
        background-size: 100% 100%;
      }
      .nextStepSelect {
        background-image: url('../../../assets/images/select1.png');
        span {
          color: #2378EC;
        }
      }
      .nextStepIssue {
        background-image: url('../../../assets/images/issue1.png');
        span {
          color: #2378EC;
        }
      }
    }
    .filtrate {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      padding-bottom: 10px;
      .select-input {
        // margin-right: 10px;
        margin-top: 20px;
        display: flex;
        align-items: center;
        .select-span {
          font-size: 13px;
          font-family: 'Alibaba PuHuiTi';
          font-weight: 400;
          color: #525966;
          line-height: 40px;
          margin-right: 10px;
        }
        ::v-deep .el-select {
          background-color: transparent;
          width: 180px;
          .el-input__inner {
            height: 33px;
          }
          // border-radius: 2px;
          .el-input .el-input__suffix .el-input__suffix-inner .el-icon-arrow-up::before {
            content: "";
            background: url(../../../assets/images/down2.png) center center no-repeat;
            background-size: cover;
            position: absolute;
            width: 10px;
            height: 7px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
        }
      }
      .input-input {
        margin: 20px 40px 0 0;
        width: 250px;
        ::v-deep .el-input {
          .el-input__inner {
            height: 33px;
          }
        }
      }
      .select-btn {
        margin: 20px 0 0 0;
        width: 140px;
        height: 33px;
        background: #2378EC;
        border-radius: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        font-family: Alibaba PuHuiTi;
        font-weight: 500;
        color: #FFFFFF;
        cursor: pointer;
      }
    }
    .tables {
      background-color: #EAF2FD;
      ::v-deep .el-table {
        .success-row {
          background-color: rgba(234, 242, 253, 0.25);
        }
        td {
          height: 30px;
          text-align: center;
          font-size: 15px;
          font-family: 'Alibaba PuHuiTi';
          font-weight: 400;
          color: #525966;
        }
        th {
          height: 30px;
          background-color: #EAF2FD;
          font-size: 16px;
          font-family: 'Alibaba PuHuiTi';
          font-weight: bold;
          color: #525966;
          .el-checkbox {
            display: none;
          }
        }
        .el-table__body-wrapper {
          height: 448px !important;
          overflow-y: auto;
        }
      }
      ::v-deep .el-table::before {
        height: 0;
      }
    }
    .pagination {
      margin-top: 10px;
    }
    .release-planning {
      padding: 0 10px 0 0;
      .inputs {
        display: flex;
        margin-top: 20px;
        .inputs-span {
          width: 80px;
          text-align: right;
          margin-right: 10px;
          font-size: 15px;
          font-family: 'Alibaba PuHuiTi';
          font-weight: 400;
          color: #525966;
        }
        ::v-deep .el-select {
          background-color: transparent;
          width: 190px;
          .el-input__inner {
            height: 33px;
          }
          // border-radius: 2px;
          .el-input .el-input__suffix .el-input__suffix-inner .el-icon-arrow-up::before {
            content: "";
            background: url(../../../assets/images/down2.png) center center no-repeat;
            background-size: cover;
            position: absolute;
            width: 10px;
            height: 7px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
        }
        .input {
          flex: 1;
          ::v-deep .el-textarea {
            height: 180px;
            .el-textarea__inner {
              height: 100%;
            }
          }
        }
      }
      .centered {
        align-items: center;
      }
    }
    .next {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 10px;
      .selected {
        display: flex;
        align-items: center;
        font-size: 15px;
        font-family: 'Alibaba PuHuiTi';
        font-weight: 400;
        color: #525966;
        margin-right: 15px;
        span {
          color: #2378EC;
        }
      }
      .btn {
        width: 150px;
        height: 30px;
        border: 1px solid #2378EC;
        border-radius: 2px;
        background-color: #EFF6FF;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        font-family: 'Alibaba PuHuiTi';
        font-weight: 400;
        color: #2378EC;
        cursor: pointer;
      }
    }
  }
}
::v-deep .el-dialog__body {
  padding: 30px 15px;
}
</style>
