| | |
| | | |
| | | /////////////////////// 调用接口(使用时打开) /////////////////////// |
| | | import { getData, getSimData, deleteSimData } from "@/api/trApi.js"; |
| | | |
| | | onMounted(() => { |
| | | getScheme(); |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | deleteSim: Boolean, // 接收父组件传递的函数 |
| | | showAddIns: Boolean, |
| | | }); |
| | | |
| | | // 获取仿真列表 |
| | | const schemeList = ref([]); |
| | | async function getScheme() { |
| | | try { |
| | | const res = await getSimData(); |
| | | schemeList.value = res.data; |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | | } |
| | | } |
| | | |
| | | // 新建方案完成之后方案列表需实时刷新 |
| | | watch( |
| | | () => props.showAddIns, |
| | | (newVal) => { |
| | | if (newVal == false) { |
| | | getScheme(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | // 删除仿真列表 |
| | | watch( |
| | | () => props.deleteSim, |
| | | (newVal) => { |
| | |
| | | } |
| | | } |
| | | ); |
| | | |
| | | const schemeList = ref([]); |
| | | |
| | | async function getScheme() { |
| | | try { |
| | | const res = await getSimData(); |
| | | schemeList.value = res.data; |
| | | } catch (error) { |
| | | console.error("Error fetching data:", error); |
| | | } |
| | | } |
| | | |
| | | const deleteSim = () => { |
| | | ElMessageBox.confirm("确定要删除该方案吗?", "删除方案", { |