<!-- 归属组织 -->
<template>
  <div class="OrganizationManager">
    <div style="margin: 20px;margin-top:0;">
      <a-tabs v-model:activeKey="activeKey">
        <a-tab-pane key="1" tab="培训发生组织列表"> 
          <OrganizationList :activeKeyFn="activeKeyFn"/>
        </a-tab-pane>
        <!-- v-if="lecturerAdmin('lecturer-admin')" -->
        <a-tab-pane key="2" tab="审批中心"> 
          <OrganizationApproval ref="organizationApprovalRef" :organizationActive="organizationActive"/>
        </a-tab-pane>
      </a-tabs>
    </div>
  </div>



</template>
<script lang="jsx">
import { reactive, toRefs, ref, watch ,onMounted} from "vue";
import OrganizationList from "../lecturer/OrganizationList.vue"
import OrganizationApproval from "../lecturer/OrganizationApproval.vue"

import { useRoute } from "vue-router";
export default {
  name: "organization",
  components: {
    OrganizationList,
    OrganizationApproval
  },
  setup() {
    const route = useRoute();

    const state = reactive({
      activeKey: '1',
      organizationActive:"0"
    });

    const organizationApprovalRef = ref(null)
    onMounted(() => {
      if (route.query.activeKey) {
        state.activeKey = '2';
        state.organizationActive = "1"
      }
    })

    
    const activeKeyFn = () => {
      setTimeout(() => {
        state.activeKey = '2';
        console.log("激活获取值")
        organizationApprovalRef.value.getTableDate(state.activeKey)
      }, 5000);
   
    }

    return {
      ...toRefs(state),
      activeKeyFn
    };
  },
};
</script>
<style lang="scss" scoped>
.OrganizationManager {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  .filter {
    margin-left: 38px;
    margin-right: 38px;
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    .filterItems {
      display: flex;
      flex-wrap: wrap;

      .select {
        margin-right: 20px;
        margin-bottom: 20px;
      }

      .addTimeBox {
        position: relative;
        display: flex;
        align-items: center;

        .addTime {
          position: absolute;
          z-index: 10;
          margin-left: 10px;
          color: rgba(0, 0, 0, 0.4);
        }

        .ant-picker {
          padding-left: 85px;
        }

        .ant-picker-range .ant-picker-active-bar {
          margin-left: 85px;
        }
      }

      .btn {
        padding: 0px 26px 0px 26px;
        height: 38px;
        background: #4ea6ff;
        border-radius: 8px;
        border: 1px solid rgba(64, 158, 255, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 14px;
        flex-shrink: 0;
        cursor: pointer;

        .search {
          background-size: 100%;
        }

        .btnText {
          font-size: 14px;
          font-weight: 400;
          color: #fff;
          line-height: 36px;
          margin-left: 5px;
        }
      }

      .btnn {
        padding: 0px 26px 0px 26px;
        height: 38px;
        background: #4ea6ff;
        border-radius: 8px;
        border: 1px solid rgba(64, 158, 255, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 14px;
        flex-shrink: 0;
        cursor: pointer;

        .search {
          background-size: 100%;
        }

        .btnText {
          font-size: 14px;
          font-weight: 400;
          color: #ffffff;
          line-height: 36px;
          margin-left: 5px;
        }
      }

      .btn1 {
        .search {
          width: 15px;
          height: 17px;
          background-image: url("../../assets/images/courseManage/search0.png");
        }
      }

      .btn2 {
        .search {
          width: 16px;
          height: 18px;
          background-image: url("../../assets/images/courseManage/reset0.png");
        }
      }

      .btn1:active {
        background: #0982ff;
      }

      // .btn2:hover {
      //   background: rgba(64, 158, 255, 0.1);
      // }

      .btn2:active {
        background: #0982ff;
      }
    }

    .btns {
      display: flex;

      // flex-wrap: wrap;
      .btn {
        padding: 0px 26px 0px 26px;
        height: 38px;
        background: #4ea6ff;
        border-radius: 8px;
        border: 1px solid rgba(64, 158, 255, 1);
        display: flex;
        align-items: center;
        cursor: pointer;
        justify-content: center;
        margin-right: 14px;
        flex-shrink: 0;

        .search {
          background-size: 100%;
        }

        .btnText {
          font-size: 14px;
          font-weight: 400;
          color: #ffffff;
          line-height: 36px;
          margin-left: 5px;
        }
      }

      .btn3 {
        margin-right: 0px;

        .search {
          width: 17px;
          height: 18px;
          background-image: url("../../assets/images/courseManage/add0.png");
        }
      }

      // .btn3:hover {
      //   background: rgba(64, 158, 255, 0.76);
      // }

      .btn3:active {
        background: #0982ff;
      }
    }
  }

  .tableBox {
    margin: 20px 38px 30px;

    .ant-table-thead>tr>th {
      background-color: #eff4fc;
    }

    th {
      background-color: #eff4fc !important;
      text-align: center !important;
    }
  }

  .tableBox {
    padding-bottom: 20px;

    .pa {
      // position: absolute;
      // bottom: 20px;
      // left: 0;
      width: 100%;
      // height: 20px;
      // background-color: red;
      display: flex;
      justify-content: center;
      // margin-bottom: 10px;
      // position: absolute;
      // bottom: -40px;
    }
  }

  .operation {
    font-size: 14px;
    font-weight: 400;
    color: #4ea6ff;
    margin-right: -45px;
    display: flex;
    justify-content: right;
    margin-right: 18px;

    // line-height: 36px;
    .operation1 {
      margin-left: 21px;
      width: 28px;
      display: inline-block;
    }

    .operation3 {
      margin-left: 21px;
      width: 70px;
      display: inline-block;
      text-align: center;
    }

    .more {
      width: 50px;
      display: inline-block;
      margin-left: 21px;
      position: relative;
      text-align: left;

      // z-index: 99999;
      .moreArrow {
        width: 13px;
        height: 7px;
        display: inline-block;
        background-image: url("../../assets/images/navtop/down.png");
        background-size: 100%;
        margin: 2px;
        margin-left: 7px;
      }

      .moreItems {
        width: 80px;
        padding: 5px;
        display: none;
        background: #ffffff;
        box-shadow: 2px 3px 9px 3px rgba(0, 0, 0, 0.05);
        border-radius: 3px;
        border: 0px solid #dcdcdc;
        position: absolute;
        left: 0px;
        top: 28px;
        z-index: 100;
        text-align: center;
      }
    }

    .more:hover .moreArrow {
      background-image: url("../../assets/images/navtop/up.png");
    }

    .more:hover .moreItems {
      display: block;
    }
  }
}
</style>
