导出报表,时分秒可选
This commit is contained in:
@@ -1,25 +1,56 @@
|
|||||||
<!--报表导出-->
|
<!--报表导出-->
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :close-on-click-modal="false" draggable v-model="machineVisible" :title="title" width="500">
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable
|
||||||
|
v-model="machineVisible"
|
||||||
|
:title="title"
|
||||||
|
width="500"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<div class="smsConfig">
|
<div class="smsConfig">
|
||||||
<el-form :model="form" inline label-width="auto" class=" ml30 mt10">
|
<el-form :model="form" inline label-width="auto" class="ml30 mt10">
|
||||||
<el-form-item label="时间">
|
<el-form-item label="时间">
|
||||||
<el-date-picker v-model="timeValue" size="small" type="daterange" :disabled-date="isFutureDate"
|
<el-date-picker
|
||||||
style="width: 250px; margin-right: 10px" unlink-panels :clearable="false" range-separator="至"
|
v-model="timeValue"
|
||||||
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" />
|
size="small"
|
||||||
|
type="datetimerange"
|
||||||
|
:disabled-date="isFutureDate"
|
||||||
|
style="width: 250px; margin-right: 10px"
|
||||||
|
unlink-panels
|
||||||
|
:clearable="false"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="部门集合">
|
<el-form-item label="部门集合">
|
||||||
<el-select v-model="form.deptList" placeholder="请选择部门集合" style="width: 250px" size="small" multiple
|
<el-select
|
||||||
collapse-tags collapse-tags-tooltip>
|
v-model="form.deptList"
|
||||||
|
placeholder="请选择部门集合"
|
||||||
|
style="width: 250px"
|
||||||
|
size="small"
|
||||||
|
multiple
|
||||||
|
collapse-tags
|
||||||
|
collapse-tags-tooltip
|
||||||
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAll">
|
<el-checkbox
|
||||||
|
v-model="checkAll"
|
||||||
|
:indeterminate="indeterminate"
|
||||||
|
@change="handleCheckAll"
|
||||||
|
>
|
||||||
全部
|
全部
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
<el-option v-for="item in deptLists" :key="item.deptsIndex" :label="item.deptsname"
|
<el-option
|
||||||
:value="item.deptsIndex" />
|
v-for="item in deptLists"
|
||||||
|
:key="item.deptsIndex"
|
||||||
|
:label="item.deptsname"
|
||||||
|
:value="item.deptsIndex"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -32,7 +63,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button :icon="Close" @click="setUp" size="small">取消</el-button>
|
<el-button :icon="Close" @click="setUp" size="small">取消</el-button>
|
||||||
<el-button type="primary" :icon="Check" @click="save" size="small">确定</el-button>
|
<el-button type="primary" :icon="Check" @click="save" size="small"
|
||||||
|
>确定</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -41,7 +74,7 @@ import { ref, watch, inject, onMounted } from "vue";
|
|||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { Check, Close } from "@element-plus/icons-vue";
|
import { Check, Close } from "@element-plus/icons-vue";
|
||||||
import { getDept, exportForms } from "@/api/statistics/index";
|
import { getDept, exportForms } from "@/api/statistics/index";
|
||||||
import type { CheckboxValueType } from 'element-plus'
|
import type { CheckboxValueType } from "element-plus";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const machineVisible = ref(false);
|
const machineVisible = ref(false);
|
||||||
@@ -50,8 +83,8 @@ const timeValue = ref([]);
|
|||||||
const deptLists = ref();
|
const deptLists = ref();
|
||||||
//form表单校验规则
|
//form表单校验规则
|
||||||
const emit = defineEmits(["flushed"]);
|
const emit = defineEmits(["flushed"]);
|
||||||
const checkAll = ref(false)
|
const checkAll = ref(false);
|
||||||
const indeterminate = ref(false)
|
const indeterminate = ref(false);
|
||||||
const form = ref({
|
const form = ref({
|
||||||
searchBeginTime: "",
|
searchBeginTime: "",
|
||||||
searchEndTime: "",
|
searchEndTime: "",
|
||||||
@@ -91,25 +124,25 @@ watch(
|
|||||||
() => form.value.deptList, // 使用函数返回值的形式
|
() => form.value.deptList, // 使用函数返回值的形式
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val.length == 0) {
|
if (val.length == 0) {
|
||||||
checkAll.value = false
|
checkAll.value = false;
|
||||||
indeterminate.value = false
|
indeterminate.value = false;
|
||||||
} else if (val.length == deptLists.value.length) {
|
} else if (val.length == deptLists.value.length) {
|
||||||
checkAll.value = true
|
checkAll.value = true;
|
||||||
indeterminate.value = false
|
indeterminate.value = false;
|
||||||
} else {
|
} else {
|
||||||
indeterminate.value = true
|
indeterminate.value = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true } // 添加深度监听选项
|
{ deep: true } // 添加深度监听选项
|
||||||
)
|
);
|
||||||
const handleCheckAll = (val: CheckboxValueType) => {
|
const handleCheckAll = (val: CheckboxValueType) => {
|
||||||
indeterminate.value = false
|
indeterminate.value = false;
|
||||||
if (val) {
|
if (val) {
|
||||||
form.value.deptList = deptLists.value.map((_) => _.deptsIndex)
|
form.value.deptList = deptLists.value.map((_) => _.deptsIndex);
|
||||||
} else {
|
} else {
|
||||||
form.value.deptList = []
|
form.value.deptList = [];
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
const save = () => {
|
const save = () => {
|
||||||
if (!timeValue.value[0]) {
|
if (!timeValue.value[0]) {
|
||||||
ElMessage.warning("请选择时间!");
|
ElMessage.warning("请选择时间!");
|
||||||
@@ -122,9 +155,8 @@ const save = () => {
|
|||||||
|
|
||||||
(form.value.deptId = store.state.deptId),
|
(form.value.deptId = store.state.deptId),
|
||||||
(form.value.searchBeginTime = timeValue.value[0]),
|
(form.value.searchBeginTime = timeValue.value[0]),
|
||||||
(form.value.searchEndTime = timeValue.value[1]
|
(form.value.searchEndTime = timeValue.value[1]);
|
||||||
? timeValue.value[1].split(" ")[0] + " 23:59:59"
|
|
||||||
: "");
|
|
||||||
exportForms(form.value).then((res: any) => {
|
exportForms(form.value).then((res: any) => {
|
||||||
let blob = new Blob([res], {
|
let blob = new Blob([res], {
|
||||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8",
|
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8",
|
||||||
|
|||||||
Reference in New Issue
Block a user