<template>
  <u-popup
    v-model="props.show"
    mode="center"
    closeable
    width="400rpx"
    border-radius="24"
    @close="handleClose"
  >
    <view class="taught">
      <view class="title">可授课程</view>
      <u-table v-if="taughtList.length">
        <u-tr>
          <u-th>课程</u-th>
        </u-tr>
        <u-tr v-for="(item, index) in taughtList" :key="index">
          <u-td>{{ item.FDATAVALUE }}</u-td>
        </u-tr>
      </u-table>
      <u-empty v-else text="暂无可授课程" mode="data"></u-empty>
    </view>
  </u-popup>
</template>

<script setup lang="ts">
const props = defineProps({
  show: {
    type: Boolean,
    default: false,
  },
});

const emits = defineEmits(["update:show"]);

const formRef = ref();
const taughtList = ref([] as any);

const handleClose = () => {
  formRef.value?.resetFields();
  emits("update:show", false);
};

defineExpose({
  taughtList,
});
</script>

<style lang="scss" scoped>
.taught {
  padding: 40rpx 32rpx;
  .title {
    font-size: 34rpx;
    font-weight: 500;
    color: #000000;
    margin-bottom: 32rpx;
  }
}
</style>
