<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>
        <ContentWrap>
          <TableView
            v-if="tabPosition == 'first'"
            :sopId="route.query.sopId"
            :modeId="route.query.modeId"
          />
          <WorkflowView v-else  :sopId="route.query.sopId" :modeId="route.query.modeId"/>
        </ContentWrap>
      </div>
    </div>
  </ContentWrap>
</div>
</template>
<script setup lang="ts">
import TableView from './ModeView/TableView.vue'
import WorkflowView from './ModeView/WorkFlowView.vue'
const router=useRouter()
const route=useRoute()
const tabPosition = ref('first')
const goBack=()=>{
  if(route.query.type=='update'){
    router.push({
      path:'/sopm/sopm/sop/UpdateSop',
      query:{
        id:route.query.sopId,
        type:route.query.type,
      }

    })
  }else {
    router.push({
      path:'/sopm/sopm/sop/UpdateSop',
      query:{
        id:route.query.sopId,
        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>
