去除多余列,导出文件国际化

This commit is contained in:
lai
2024-02-01 14:03:48 +08:00
parent 1d5ec0a036
commit 6d3e592886
2 changed files with 50 additions and 14 deletions

View File

@@ -48,8 +48,6 @@ let tableColumnsDnd = ref<ColumnsType>([]);
/**记录开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
/**查询参数 */
let queryParams = reactive({
/**告警设备类型 */
@@ -120,7 +118,7 @@ type TabeStateType = {
let tableState: TabeStateType = reactive({
loading: false,
size: 'middle',
seached: true,
seached: false,
data: [],
selectedRowKeys: [],
});
@@ -639,6 +637,11 @@ function fnExportAll() {
filteredObj[key] = objA[key];
}
});
dict.activeAckState.map((item: any) => {
if (item.value === `${filteredObj.ackState}`)
filteredObj.ackState = item.label;
});
return filteredObj;
});
message.success({
@@ -692,7 +695,6 @@ function fnGetList(pageNum?: number) {
filterState.sql = sql;
}
listAct(toRaw(queryParams), filterState.sql).then((res: any) => {
console.log(res);
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (state.selectedRowKeys.length > 0) {

View File

@@ -112,7 +112,7 @@ type TabeStateType = {
let tableState: TabeStateType = reactive({
loading: false,
size: 'middle',
seached: true,
seached: false,
data: [],
selectedRowKeys: [],
});
@@ -444,6 +444,30 @@ function fnExportAll() {
};
exportAll(queryParams).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
res.data = res.data.map((objA: any) => {
let filteredObj: any = {};
sortArr.forEach((key: any) => {
if (objA.hasOwnProperty(key)) {
filteredObj[key] = objA[key];
}
});
const mapProps = (dict: any, key: string) => {
const item = dict.find(
(item: any) => item.value === `${filteredObj[key]}`
);
if (item) {
filteredObj[key] = item.label;
}
};
mapProps(dict.activeAckState, 'ackState');
mapProps(dict.activeClearType, 'clearType');
mapProps(dict.activeAlarmSeverity, 'origSeverity');
mapProps(dict.activeAlarmType, 'alarmType');
return filteredObj;
});
message.success({
content: t('common.msgSuccess', { msg: t('common.export') }),
key,
@@ -494,7 +518,11 @@ function fnGetList(pageNum?: number) {
}
tablePagination.total = res.total;
tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) {
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false;
fnGetList(queryParams.pageNum - 1);
}
@@ -673,7 +701,11 @@ onMounted(() => {
</template>
{{ t('views.faultManage.activeAlarm.updateConfirm') }}
</a-button>
<a-button type="primary" @click.prevent="fnExportAll()">
<a-button
type="primary"
@click.prevent="fnExportAll()"
:disabled="tableState.data.length <= 0"
>
<template #icon> <export-outlined /> </template>
{{ t('views.faultManage.activeAlarm.exportAll') }}
</a-button>
@@ -797,7 +829,11 @@ onMounted(() => {
:ok-text="t('views.faultManage.activeAlarm.confirm')"
@cancel="fnModalCancel"
>
<a-form name="modalStateFrom" layout="horizontal" :label-col="{span:8}">
<a-form
name="modalStateFrom"
layout="horizontal"
:label-col="{ span: 8 }"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
@@ -897,7 +933,7 @@ onMounted(() => {
<a-form-item
:label="t('views.faultManage.activeAlarm.locationInfo')"
name="locationInfo"
:label-col="{span:4}"
:label-col="{ span: 4 }"
>
{{ modalState.from.locationInfo }}
</a-form-item>
@@ -923,15 +959,14 @@ onMounted(() => {
<a-form-item
:label="t('views.faultManage.activeAlarm.addInfo')"
name="addInfo"
:label-col="{span:4}"
:label-col="{ span: 4 }"
>
{{ modalState.from.addInfo }}
</a-form-item>
<a-form-item
:label="t('views.faultManage.activeAlarm.specificProblemId')"
name="specificProblemId"
:label-col="{span:4}"
:label-col="{ span: 4 }"
>
{{ modalState.from.specificProblemId }}
</a-form-item>
@@ -939,8 +974,7 @@ onMounted(() => {
<a-form-item
:label="t('views.faultManage.activeAlarm.specificProblem')"
name="specificProblem"
:label-col="{span:4}"
:label-col="{ span: 4 }"
>
{{ modalState.from.specificProblem }}
</a-form-item>