<template>
  <div class="page-edit-healthy-file">
    <div v-if="archivesModule">
      <EditQuestionTemplate :indicator="archivesModule" :archives-id="props.id" :is-plat="props.isPlat" @close="f => emits('close', f)"/>
    </div>
  </div>
</template>

<script setup >
import { useRoute, useRouter } from "vue-router";
import { ref, watch, onMounted } from 'vue';
import EditQuestionTemplate from './EditQuestionTemplate.vue';
import { deepClone, parseJSON } from '@/utils';
import { ElMessage } from 'element-plus';
const route = useRoute()
const router = useRouter()
const props = defineProps({
  isPlat: {
    type: Boolean,
    default: false
  },
  id: {
    type: String,
    default: ''
  },
  moduleId: {
    type: String,
    default: undefined
  },
  indicator: {
    type: Object,
    default: undefined
  }
})
const emits = defineEmits(['close'])
const archivesModule = ref()
watch(() => props.indicator, () => {
  archivesModule.value = deepClone(props.indicator)
})

const init = async () => {
  if (props.isPlat) {
    archivesModule.value = deepClone(props.indicator)
  } else {
    const indicator = healthyFile.editArchivesItem
    const { moduleId } = route.query
    console.log(moduleId, indicator);
    archivesModule.value = indicator
  }
}

onMounted(init)
</script>
<style lang="scss">
.page-edit-healthy-file {
  padding: 15px 0 110px;
  .checkbox-list {
    .checkbox-item {
      margin: 0 10px 10px 0;
      padding: 4px 10px;
      height: auto;
    }
    .el-button+.el-button {
      margin-left: 0;
    }
  }
  .survey-matrix-container {
    overflow-x: auto;
    padding: 10px 0;
    .survey-matrix {
      font-size: 12px;
      border-collapse: collapse;
      margin: 0 auto;
      min-width: 100%;
      th, td {
        border: 1px solid #ccc;
        padding: 10px;
        text-align: center;
      }
      th {
        white-space: nowrap;
      }
      tr {
        td:first-of-type {
          font-weight: blod;
          white-space: nowrap;
        }
      }
    }
  }
}
</style>
