<template>
  <div>
    <ContentWrap>
      <div class="custom-tabs-container">
        <div class="tab-header">
          <span class="tab-title">人员设置</span>
          <div class="set-btn" @click="goBack">
            <img src="../../../assets/images/返回.png" alt="" />
            返回
          </div>
        </div>
        <div class="tab-content">
          <el-radio-group v-model="tabPosition" class="mb-15px">
            <el-radio-button label="first">卡片视图</el-radio-button>
            <el-radio-button label="second">表格视图</el-radio-button>
          </el-radio-group>

          <CardView
            v-if="tabPosition == 'first'"
            :ticketId="route.query.ticketId"
            :group-added="groupAdded"
          />
          <TableView v-else :ticketId="route.query.ticketId" />
        </div>
      </div>
    </ContentWrap>
  </div>
</template>
<script setup lang="ts">
import TableView from './UserView/TableView.vue'
import CardView from './UserView/CardView.vue'

const router = useRouter()
const route = useRoute()
const tabPosition = ref('first')
// 定义信号
const groupAdded = ref(false)
const goBack=()=>{
  if(route.query.type=='update'){
    router.push({
      path:'/jobTicket/jobTicket/job/UpdateJob',
      query:{
        id:route.query.ticketId,
        type:route.query.type,
      }

    })
  }else {
    router.push({
      path:'/jobTicket/jobTicket/job/UpdateJob',
      query:{
        id:route.query.ticketId,
        type:route.query.type,
      }
    })
  }

}

</script>

<style scoped lang="scss">
.custom-tabs-container {
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  margin-top: 20px;
}

.tab-header {
  background-color: #f5f7fa;
  border-bottom: 1px solid #dcdfe6;
  padding: 12px 20px;
  border-radius: 4px 4px 0 0;
}

.tab-title {
  font-size: 14px;
  font-weight: 500;
  color: #303133;
}

.set-btn {
  width: 60px;
  height: 30px;
  border: 1px solid black;
  border-radius: 6px;
  text-align: center;
  line-height: 30px;
  float: right;
  cursor: pointer;

  img {
    width: 14px;
    height: 14px;
  }
}

.tab-content {
  padding: 20px;
  background-color: #fff;
  border-radius: 0 0 4px 4px;
}

</style>
