<template>
  <el-dialog
    class="dialog-container"
    v-el-drag-dialog
    :visible.sync="show"
    top="15vh"
    :modal="false"
    width="472px"
    :show-close="false"
  >
    <div slot="title" class="dialog-title">
      <img :src="require('@/assets/imgs/logo_small.png')" alt="" />
      <div class="title-box">
        <span class="title-text">{{ info.group }}</span>
        <span class="title-text">{{ info.company + info.curStation }}</span>
      </div>
    </div>
    <div class="list-container">
      <div class="table-title">
        <span class="title-text">{{ detail.name }}</span>
        <span class="sub-title">{{ detail.subName }}</span>
      </div>
      <div class="table-box">
        <div class="list-item table-header">
          <div class="sort">序号</div>
          <div class="content">处置步骤</div>
          <div class="person">负责人</div>
        </div>
        <div class="list-item" v-for="item of detail.steps" :key="item.id">
          <div class="sort">{{ item.sort }}</div>
          <div class="content">{{ item.content }}</div>
          <div class="person">{{ item.personInCharge }}</div>
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button size="mini" @click="handleClose">关 闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import elDragDialog from "@/directive/el-drag-dialog";
export default {
  name: "CardDetailDialog",
  directives: { elDragDialog },
  data() {
    return {
      show: false,
      detail: {},
      info: {
        group: "国家管网集团西南管道公司",
        company: "贵阳输油气分公司",
        curStation: "都匀作业区",
      },
    };
  },
  watch: {
    detail(val) {
      this.show = !!val.id;
    },
  },
  mounted() {
    this.info = HOME_DATA;
    this.$EventBus.$off("handleClickRow");
    this.$EventBus.$on("handleClickRow", (data) => {
      this.detail = data;
    });
  },
  methods: {
    handleClose() {
      this.detail = {};
    },
  },
};
</script>

<style lang="less" scoped>
.dialog-container {
  pointer-events: none;
  ::v-deep .el-dialog {
    pointer-events: auto;
    background: rgba(0, 58, 109, 0.9);
    border: 1px solid #a0f0ff;
    border-radius: 10px;
    left: 570px;
    .el-dialog__header {
      height: 88px;
      padding: 0;
      background-image: linear-gradient(
        180deg,
        rgba(0, 70, 140, 0.8) 0%,
        rgba(0, 121, 215, 0.8) 100%
      );
      border-radius: 10px 10px 0 0;
      .dialog-title {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        .title-box {
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          .title-text {
            width: 300px;
            // height: 40px;
            font-size: 18px;
            color: #ffffff;
            letter-spacing: 2px;
            font-weight: 700;
            text-align-last: justify;
          }
        }
      }
    }
    .el-dialog__body {
      padding: 0;
      .list-container {
        padding: 20px;
        // background: rgba(0, 85, 96, 0.5);
        .table-title {
          width: 100%;
          padding-bottom: 10px;
          display: flex;
          flex-direction: column;
          align-items: center;
          .title-text {
            font-size: 16px;
            color: #ffffff;
            letter-spacing: 1px;
            font-weight: 700;
            // text-align-last: justify;
          }
          .sub-title {
            font-size: 14px;
            color: #ffffff;
            letter-spacing: 1px;
            font-weight: 500;
            // text-align-last: justify;
          }
        }
        .table-box {
          min-height: 470px;
          border: 1px solid #a0f0ff;
          border-bottom: 0;
          display: table;
          border-collapse: collapse;
          .table-header {
            background: rgba(0, 156, 255, 0.3);
          }
        }

        .list-item {
          min-height: 40px;
          display: table-row;
          color: #fff;
          border-bottom: 1px solid #a0f0ff;
          text-align: center;
          &.table-header {
            display: table-header-group;
            height: 40px;
          }
          & > div {
            min-height: 40px;
            display: table-cell;
            padding: 5px 10px;
            vertical-align: middle;
          }
          .sort {
            width: 50px;
          }
          .content {
            width: calc(100% - 150px);

            border-left: 1px solid #a0f0ff;
            border-right: 1px solid #a0f0ff;
          }
          .person {
            width: 100px;
          }
        }
      }
    }
    .el-dialog__footer {
      padding: 0;
      height: 48px;
      background-image: linear-gradient(
        180deg,
        rgba(0, 70, 140, 0.8) 0%,
        rgba(0, 121, 215, 0.8) 100%
      );
      border-radius: 0 0 10px 10px;
      .dialog-footer {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        .el-button {
          // width: 80px;
          // height: 26px;
          // line-height: 26px;
          color: #fff;
          background: rgba(0, 20, 41, 0.5);
          border: 1px solid #a0f0ff;
        }
      }
    }
  }
}
</style>
