diff --git a/src/views/VoltageSag_BJ/components/reportForms.vue b/src/views/VoltageSag_BJ/components/reportForms.vue index 2bea03d..664f588 100644 --- a/src/views/VoltageSag_BJ/components/reportForms.vue +++ b/src/views/VoltageSag_BJ/components/reportForms.vue @@ -1,25 +1,56 @@ @@ -41,7 +74,7 @@ import { ref, watch, inject, onMounted } from "vue"; import { ElMessage } from "element-plus"; import { Check, Close } from "@element-plus/icons-vue"; import { getDept, exportForms } from "@/api/statistics/index"; -import type { CheckboxValueType } from 'element-plus' +import type { CheckboxValueType } from "element-plus"; import { useStore } from "vuex"; const store = useStore(); const machineVisible = ref(false); @@ -50,8 +83,8 @@ const timeValue = ref([]); const deptLists = ref(); //form表单校验规则 const emit = defineEmits(["flushed"]); -const checkAll = ref(false) -const indeterminate = ref(false) +const checkAll = ref(false); +const indeterminate = ref(false); const form = ref({ searchBeginTime: "", searchEndTime: "", @@ -88,28 +121,28 @@ const init = () => { // } // }) watch( - () => form.value.deptList, // 使用函数返回值的形式 + () => form.value.deptList, // 使用函数返回值的形式 (val) => { if (val.length == 0) { - checkAll.value = false - indeterminate.value = false + checkAll.value = false; + indeterminate.value = false; } else if (val.length == deptLists.value.length) { - checkAll.value = true - indeterminate.value = false + checkAll.value = true; + indeterminate.value = false; } else { - indeterminate.value = true + indeterminate.value = true; } }, - { deep: true } // 添加深度监听选项 -) + { deep: true } // 添加深度监听选项 +); const handleCheckAll = (val: CheckboxValueType) => { - indeterminate.value = false + indeterminate.value = false; if (val) { - form.value.deptList = deptLists.value.map((_) => _.deptsIndex) + form.value.deptList = deptLists.value.map((_) => _.deptsIndex); } else { - form.value.deptList = [] + form.value.deptList = []; } -} +}; const save = () => { if (!timeValue.value[0]) { ElMessage.warning("请选择时间!"); @@ -122,9 +155,8 @@ const save = () => { (form.value.deptId = store.state.deptId), (form.value.searchBeginTime = timeValue.value[0]), - (form.value.searchEndTime = timeValue.value[1] - ? timeValue.value[1].split(" ")[0] + " 23:59:59" - : ""); + (form.value.searchEndTime = timeValue.value[1]); + exportForms(form.value).then((res: any) => { let blob = new Blob([res], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8",