import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue"; import { request } from "@/utils/request"; import { useRoute, useRouter } from 'vue-router' import AddDialog from "./addDialog.vue"; const tableData = ref([]); // 表格数据 const modelVisible = ref(false); // 弹窗状态 const drawerVisible = ref(false); // 抽屉状态 // 弹窗内容 const model = reactive({ title: '', content: null, props: {}, onCancel: null, onConfirm: null, width: '', }); const form = reactive({ }); const INIT_FORM = { }; // 抽屉内容 const drawer = reactive({ title: '', content: null, props: {}, onCancel: null, onConfirm: null, direction: 'rtl', size: '50%' }); const dialogRef = ref(null); // 弹窗实例 const drawerRef = ref(null); // 抽屉实例 const columns = [ { prop: "xxx", label: "区县", }, { prop: "xxx", label: "路线编码", }, { prop: "xxx", label: "灾害类型", }, { prop: "xxx", label: "起点桩号", }, { prop: "xxx", label: "止点桩号", }, { prop: "xxx", label: "实施里程(公里)", }, { prop: "xxx", label: "技术等级", }, { prop: "xxx", label: "总投资金额(万元)", }, { prop: "xxx", label: "投资估算(万元)", }, { prop: "xxx", label: "开工或预计开工时间", }, { prop: "xxx", label: "完工或预计完工时间", }, { prop: "xxx", label: "申报状态", }, { prop: "xxx", label: "审批状态", }, { prop: "xxx", label: "更新日期", }, { label: "操作", fixed: "right", width: 150, render: (row) => () => h("div", { class: "action-btns" }, [ h( ElButton, { type: "primary", link: true, onClick: async () => { }, }, () => "审批" ), h( ElButton, { type: "primary", link: true, style: "margin-left: 10px;", onClick: async () => { }, }, () => "详情" ), ]), }, ] // 过滤条件 const filterData = reactive({ year: "", code: "", }) // 分页 const pagination = reactive({ current: 1, pageSize: 10, total: 0, pageSizes: [10, 20, 50], layout: "prev, pager, next, jumper", onChange: (page, pageSize) => { pagination.current = page; pagination.pageSize = pageSize; getTableData(filterData); }, }); // 获取预警列表 const getTableData = async (filterData) => { try { const res = await request({ url: '', method: "GET", params: { } }) } catch (error) { } } // 打开填报项目弹窗 const openAddDialog = () => { model.title = '填报项目'; Object.assign(form, INIT_FORM); model.props = { form: form, }; model.content = AddDialog; model.onCancel = () => { modelVisible.value = false; }; model.onConfirm = async () => { dialogType.value = ''; await dialogRef?.value?.dynamicComponentRef?.formRef.validate().then(() => { console.log('@@@@@填报项目', form); }) .catch((err) => { ElMessage.error('请处理表单中的错误项'); }); }; model.width = "70%" modelVisible.value = true; } export default () => { const router = useRouter(); return { tableData, filterData, pagination, columns, modelVisible, model, drawerVisible, drawer, dialogRef, drawerRef, openAddDialog, } }