<template>
  <demandVue ref="demandRef" @visibleDialog="visibleDialog" @loadTableForm="loadTableForm">
    <template #tableFormSlot>
      <div>模拟任务</div>
    </template>
  </demandVue>
</template>
<script lang='ts' setup>
import { nextTick, ref } from 'vue';
import demandVue from '@/views/task/simulationTask/newDemand/index.vue';

const demandRef = ref();

const visibleDialog = (data: any) => {
  const { visible } = data;
  if (visible) {
    nextTick(() => {
      console.log('visibleDialog demandRef.value', demandRef.value, JSON.stringify(demandRef.value));
      console.log('visibleDialog demandRef.value.tableFormRef', demandRef.value.tableFormRef);
      console.log('visibleDialog demandRef.value.tableFormRef.setOptionsFun', JSON.stringify(demandRef.value.tableFormRef.setOptionsFun));
      demandRef.value.tableFormRef.setOptionsFun('robotBrand', [{ label: '机器人品牌1', value: 1 }, { label: '机器人品牌2', value: 2 }]);
      demandRef.value.tableFormRef.setOptionsFun('axis', [{ label: '四轴', value: 1 }, { label: '六轴', value: 2 }]);
    });
  }
};
const loadTableForm = () => {
  console.log('loadTableForm');
  console.log('loadTableForm demandRef.value.tableFormRef', JSON.stringify(demandRef.value.tableFormRef));
  console.log('loadTableForm demandRef.value.tableFormRef.setOptionsFun', JSON.stringify(demandRef.value.tableFormRef.setOptionsFun));
};
</script>
<style lang='scss' scoped></style>
