导出excel加上日期

This commit is contained in:
weiwei committed 2025-03-06 14:38:52 +08:00
1 parent 8bdf76ae3a
commit 5dce0acf8c
67 files changed
+2300 -2278

No files matched your search

+45 -45
View File
@@ -16,20 +16,20 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
{{ $t('common.queryBtn') }}
{{ $t("common.queryBtn") }}
</el-button>
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }} </el-button>
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t("common.resetBtn") }} </el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button v-auth="'sys_syspublicparam_add'" @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary">
{{ $t('common.addBtn') }}
{{ $t("common.addBtn") }}
</el-button>
<el-button plain v-auth="'sys_syspublicparam_del'" @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
{{ $t('common.refreshCacheBtn') }}
{{ $t("common.refreshCacheBtn") }}
</el-button>
<el-button
@@ -41,7 +41,7 @@
icon="Delete"
type="primary"
>
{{ $t('common.delBtn') }}
{{ $t("common.delBtn") }}
</el-button>
<right-toolbar
@@ -58,7 +58,7 @@
:data="state.dataList"
@selection-change="handleSelectionChange"
style="width: 100%"
row-key="publicId"
row-key="publicId"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
@@ -83,7 +83,7 @@
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button icon="edit-pen" @click="formDialogRef.openDialog(scope.row.publicId)" text type="primary"
>{{ $t('common.editBtn') }}
>{{ $t("common.editBtn") }}
</el-button>
<el-tooltip :content="$t('sysdict.deleteDisabledTip')" :disabled="scope.row.systemFlag === '0'" placement="top">
@@ -96,7 +96,7 @@
text
type="primary"
>
{{ $t('common.delBtn') }}
{{ $t("common.delBtn") }}
</el-button>
</span>
</el-tooltip>
@@ -112,81 +112,81 @@
</template>
<script lang="ts" name="systemSysPublicParam" setup>
import { BasicTableProps, useTable } from '/@/hooks/table';
import { delObj, fetchList, refreshCache } from '/@/api/admin/param';
import { useMessage, useMessageBox } from '/@/hooks/message';
import { useDict } from '/@/hooks/dict';
import { useI18n } from 'vue-i18n';
import { BasicTableProps, useTable } from "/@/hooks/table"
import { delObj, fetchList, refreshCache } from "/@/api/admin/param"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { useI18n } from "vue-i18n"
// 引入组件
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const { t } = useI18n();
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const { t } = useI18n()
// 定义查询字典
const { dict_type, status_type } = useDict('dict_type', 'status_type');
const { dict_type, status_type } = useDict("dict_type", "status_type")
// 定义变量内容
const formDialogRef = ref();
const formDialogRef = ref()
// 搜索变量
const queryRef = ref();
const showSearch = ref(true);
const queryRef = ref()
const showSearch = ref(true)
// 多选变量
const selectObjs = ref([]) as any;
const multiple = ref(true);
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
systemFlag: '',
systemFlag: "",
},
pageList: fetchList,
descs: ['create_time'],
});
descs: ["create_time"],
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state);
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state)
// 清空搜索条件
const resetQuery = () => {
queryRef.value.resetFields();
getDataList();
};
queryRef.value.resetFields()
getDataList()
}
// 是否可以多选
const handleSelectable = (row: any) => {
// 系统类不可多选删除
return row.systemFlag !== '1';
};
return row.systemFlag !== "1"
}
// 导出excel
const exportExcel = () => {
downBlobFile('/admin/param/export', Object.assign(state.queryForm,{ids:selectObjs}), 'param.xlsx');
};
downBlobFile("/admin/param/export", Object.assign(state.queryForm, { ids: selectObjs }), "参数管理.xlsx")
}
const handleRefreshCache = () => {
refreshCache().then(() => {
useMessage().success('同步成功');
});
};
useMessage().success("同步成功")
})
}
// 多选事件
const handleSelectionChange = (objs: { publicId: string }[]) => {
selectObjs.value = objs.map(({ publicId }) => publicId);
multiple.value = !objs.length;
};
selectObjs.value = objs.map(({ publicId }) => publicId)
multiple.value = !objs.length
}
// 删除操作
const handleDelete = async (ids: string[]) => {
try {
await useMessageBox().confirm(t('common.delConfirmText'));
await useMessageBox().confirm(t("common.delConfirmText"))
} catch {
return;
return
}
try {
await delObj(ids);
getDataList();
useMessage().success(t('common.delSuccessText'));
await delObj(ids)
getDataList()
useMessage().success(t("common.delSuccessText"))
} catch (err: any) {
useMessage().error(err.msg);
useMessage().error(err.msg)
}
};
}
</script>