<template>
  <div class="container">
    <!-- 选择图片的弹框 -->
    <el-dialog title="路演申请" v-model="props.isRadshowApplyShow" width="50%" :before-close="handleClose" draggable :close-on-click-modal="false" :modal-append-to-body="false" center>
      <div>
        <el-table :data="tableData" style="width: 100%; margin-bottom: 20px" border>
          <el-table-column prop="SubjectName" align="center" label="申请标的"></el-table-column>
          <el-table-column prop="RealName" align="center" label="申请人"></el-table-column>
          <el-table-column prop="CompanyName" align="center" label="公司名称"></el-table-column>
          <el-table-column prop="SellerName" align="center" label="所属销售"></el-table-column>
          <el-table-column width="160" prop="CreateTime" align="center" label="申请时间"></el-table-column>
        </el-table>
      </div>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, onMounted, reactive, toRefs, watch } from "vue";
import { raiInterface } from "@/api/api.js";

const props = defineProps({
  isRadshowApplyShow: {
    type: Boolean,
    default: false,
  },
  radshowApplyId: {
    type: Number,
    default: 0,
  },
});
const tableData = ref([]);

watch(
  () => props.isRadshowApplyShow,
  (newVal) => {
    newVal && getTableList();
  }
);

const $emit = defineEmits();

function handleClose() {
  $emit("update:isRadshowApplyShow", false);
  $emit("update:radshowApplyId", 0);
}
// 获取表格数据
async function getTableList() {
  const res = await raiInterface.reportSelectionTarryList({
    ArticleId: props.radshowApplyId,
  });
  if (res.Ret === 200) {
    tableData.value = res.Data.List || [];
  }
}
</script>
