<template>
  <div class="decisionMaking">

    <template v-if="ifEmpty">
      <div class="flex-box query-box">
        <div class="flex-box query-params"></div>
        <div class="flex-box query-add">
          <el-button type="primary" icon="el-icon-plus" @click="opennew">新增决策链条</el-button>
        </div>
      </div>
      <div class="table-item">
        <el-table
          v-loading="tableLoading"
          :data="tableData"
          element-loading-text="Loading"
          border
          fit
          highlight-current-row
        >
          <el-table-column label="序号" width="50" align="left">
            <template slot-scope="scope">{{ pageIndex * pageSize - pageSize + scope.$index + 1 }}</template>
          </el-table-column>
          <el-table-column label="姓名" prop="enterpriseName" min-width="70" align="left" />
          <el-table-column label="角色" prop="level" min-width="70" align="left" />
          <el-table-column label="公司/机关" prop="legalPerson" min-width="70" align="left" />
          <el-table-column label="职位" prop="capital" min-width="115" align="left" />
          <el-table-column label="联系方式" prop="capital" min-width="115" align="left" />
          <el-table-column label="内部维护人" prop="capital" min-width="115" align="left" />
          <el-table-column label="备注" prop="capital" min-width="115" align="left" />
        </el-table>
      </div>
      <div class="pagination-box">
        <el-pagination background :current-page="queryParams.pageNum" :page-size="queryParams.pageSize" :total="tableDataTotal" layout="prev, pager, next, jumper" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
      </div>
    </template>
    <template v-else>
      <div class="cooperate_empty">
        <img src="@/assets/images/project/empty.png"/>
        <div class="empty-t">暂无客户联系人数据</div>
        <div class="empty-d">抱歉，你还未添加客户联系人，快去添加吧</div>
        <el-button type="primary" class="empty-b" @click="opennew">添加联系人</el-button>
      </div>
    </template>

    <!-- 弹窗添加联系人 -->
    <el-dialog
      class="popups"
      :visible.sync="dialogVisible"
      width="464px">
      <div class="poptitle">
        <img src="@/assets/images/economies/icon.png">
        <span>重庆市轨道交通3号线二期工程4标段施工总承包</span>
      </div>
      <div class="popform">
        <div class="row">
          <span class="left">联系人姓名：</span>
          <el-input type="text" placeholder="请输入"></el-input>
        </div>
        <div class="row">
          <span class="left">联系人角色：</span>
          <el-select  placeholder="请选择">
            <el-option label="cccc" value="11"></el-option>
            <el-option label="cccc" value="121"></el-option>
          </el-select>
        </div>
        <div class="row">
          <span class="left">联系人职位：</span>
          <el-input type="text" placeholder="请输入"></el-input>
        </div>
        <div class="row">
          <span class="left">联系人公司/机关：</span>
          <el-input type="text" placeholder="请输入"></el-input>
        </div>
        <div class="row">
          <span class="left">内部维护人：</span>
          <el-input type="text" placeholder="请输入"></el-input>
        </div>
        <div class="row">
          <span class="left">联系方式：</span>
          <el-input type="text" placeholder="请输入"></el-input>
        </div>
        <div class="popbot">
          <div class="btn btn_cancel h32" @click="cancel">返回</div>
          <div class="btn btn_primary h32">保存</div>
        </div>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {
  getList,
  addChain
} from '@/api/decisionMaking/decisionMaking'
export default {
  name: 'DecisionMaking',
  components: {

  },
  data() {
    return {
      ifEmpty:true,
      queryParams:{
        customerId:null,
        pageNum:1,
        pageSize:10,
      },
      stageOptions:[],
      statusOptions:[],
      //列表
      tableLoading:false,
      tableData:[],
      pageIndex:1,
      pageSize:10,
      tableDataTotal:0,
      //弹窗
      dialogVisible: false,
    }
  },
  created() {
    this.list();
  },
  computed: {

  },
  methods: {
    list(){
      getList(this.queryParams).then((res) => {
        console.log(res)
      })
    },
    resetQuery() {

    },
    //分页
    handleCurrentChange(e){

    },
    handleSizeChange(e){

    },
    cancel(){
      this.dialogVisible = false
    },
    //打开新建窗口
    opennew(){
      this.dialogVisible = true
    },
  }
}
</script>
<style lang="scss" scoped>
.decisionMaking{
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
  input{
    border: 1px solid #EFEFEF;
  }
  ::v-deep .el-form-item{
    margin-right: 8px !important;
  }
  .cooperate-name{
    ::v-deep .el-form-item__content{
      display: flex;
      span{
        width: 60px;
        height: 32px;
        background: #F5F5F5;
        text-align: center;
        color: #0081FF;
        border: 1px solid #EFEFEF;
        border-left: 0;
        cursor: pointer;
      }
    }
    ::v-deep .el-input__inner{
      border-right: 0;
      border-radius: 2px 0 2px 0;
    }
  }
  .query-add{
    button{
      width: 124px;
      line-height: 32px;
      height: 32px;
      background: #0081FF;
      border-radius: 2px 2px 2px 2px;
      padding: 0;
      color: #ffffff;
      span{
        color: #ffff;
        margin-left: 4px;
      }
    }
  }
  .cooperate_empty{
    text-align: center;
    height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    img{
      width: 108px;
      height: 108px;
      border-radius: 50%;
      margin-bottom: 24px;
    }
    .empty-t{
      font-size: 16px;
      color: #333333;
      margin-bottom: 8px;
    }
    .empty-d{
      font-size: 14px;
      font-weight: 400;
      color: #999999;
      margin-bottom: 24px;
    }
    .empty-b{
      width: 116px;
      height: 36px;
      background: #0081FF;
      border-radius: 4px;
      padding: 0;
    }
  }
  .table-item{
    margin-top: 10px;
  }
  // 弹窗
  .popups{
    .poptitle {
      line-height: 48px;
      border-bottom: 1px solid #E1E1E1;
      height: 48px;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      img {
        width: 17px;
        margin: 16px;
        float: left;
      }
      span {
        font-weight: bold;
        font-size: 16px;
        color: #232323;
        font-family: Microsoft YaHei-Bold, Microsoft YaHei;
        width: 385px;
        display: block;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
    .popform {
      padding-top: 24px;
      .row {
        padding-bottom: 16px;
        .left {
          width: 137px;
          display: inline-block;
          text-align: right;
          opacity: 0.8;
        }
        ::v-deep .el-input {
          display: inline-block;
          width: 240px;
        }
      }
      .popbot {
        text-align: right;
        padding-top: 8px;
      }
    }
  }
}

</style>
