新增加系统表导出功能

This commit is contained in:
izory
2021-11-21 15:48:24 +08:00
parent 156b4b5222
commit b2099eaf19
30 changed files with 357 additions and 91 deletions

View File

@@ -23,6 +23,9 @@
<el-col :span="1.5">
<el-button v-hasPermi="['monitor:job:delete']" plain type="danger" icon="el-icon-remove" size="mini" @click="handleDelete(null)" :disabled="single">删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['monitor:job:export']">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['monitor:job:query']" type="info" icon="el-icon-s-operation" size="mini" @click="handleJobLog({id: 1})">日志</el-button>
</el-col>
@@ -152,6 +155,7 @@ import {
startTasks,
stopTasks,
runTasks,
exportTasks
} from "@/api/monitor/job";
export default {
name: "tasks",
@@ -458,6 +462,18 @@ export default {
this.reset();
this.getList();
},
/** 导出按钮操作 */
handleExport() {
this.$confirm("是否确认导出所有任务?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
return exportTasks();
}).then(response => {
this.download(response.data.path)
});
},
},
};
</script>

View File

@@ -30,6 +30,9 @@
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleClean" :disabled="total <= 0" v-hasPermi="['PRIV_JOBLOG_REMOVE']">清空</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['PRIV_JOBLOG_EXPORT']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -41,7 +44,7 @@
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
<el-table-column label="执行状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="作业用时" align="center" prop="elapsed" >
<el-table-column label="作业用时" align="center" prop="elapsed">
<template slot-scope="scope">
<span :style="scope.row.elapsed < 1000 ? 'color:green':scope.row.elapsed <3000 ?'color:orange':'color:red'">{{ scope.row.elapsed }} ms</span>
</template>
@@ -137,7 +140,7 @@ export default {
jobName: undefined,
jobGroup: undefined,
status: undefined,
jobId: undefined
jobId: undefined,
},
};
},
@@ -239,7 +242,7 @@ export default {
return exportJobLog(queryParams);
})
.then((response) => {
this.download(response.msg);
this.download(response.data.path);
});
},
},

View File

@@ -28,6 +28,9 @@
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:logininfor:remove']">清空</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:logininfor:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -180,7 +183,7 @@ export default {
return exportLogininfor(queryParams);
})
.then((response) => {
this.download(response.msg);
this.download(response.data.path);
});
},
},

View File

@@ -34,13 +34,16 @@
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:operlog:remove']">清空</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:operlog:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="日志编号" align="center" prop="operId" />
<el-table-column label="系统模块" align="center" prop="title" :show-overflow-tooltip="true"/>
<el-table-column label="系统模块" align="center" prop="title" :show-overflow-tooltip="true" />
<!-- <el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" /> -->
<el-table-column label="请求方式" align="center" prop="requestMethod" />
<el-table-column label="操作人员" align="center" prop="operName" />
@@ -52,7 +55,7 @@
<span :style="scope.row.elapsed < 1000 ? 'color:green':scope.row.elapsed <3000 ?'color:orange':'color:red'">{{ scope.row.elapsed }} ms</span>
</template>
</el-table-column>
<el-table-column label="日志内容" align="center" prop="errorMsg" :show-overflow-tooltip="true"/>
<el-table-column label="日志内容" align="center" prop="errorMsg" :show-overflow-tooltip="true" />
<el-table-column label="操作日期" align="center" prop="operTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.operTime) }}</span>
@@ -119,12 +122,13 @@ import {
list,
delOperlog,
cleanOperlog,
// exportOperlog,
exportOperlog,
} from "@/api/monitor/operlog";
import DateRangePicker from '@/components/DateRangePicker'
import DateRangePicker from "@/components/DateRangePicker";
import { downloadFile } from "@/utils/zipdownload.js";
export default {
components: { DateRangePicker},
components: { DateRangePicker },
name: "Operlog",
data() {
return {
@@ -253,18 +257,25 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
// const queryParams = this.queryParams;
// this.$confirm("是否确认导出所有操作日志数据项?", "警告", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(function () {
// return exportOperlog(queryParams);
// })
// .then((response) => {
// this.download(response.msg);
// });
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有操作日志?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
exportOperlog(queryParams).then((response) => {
const { code, data } = response;
if (code == 200) {
this.msgSuccess("导出成功");
downloadFile(
process.env.VUE_APP_BASE_API + data.path,
data.fileName
);
} else {
this.msgError("导出失败");
}
});
});
},
},
};

View File

@@ -31,12 +31,15 @@
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:dict:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:dict:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="typeList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" width="80"/>
<el-table-column label="字典编号" align="center" prop="dictId" width="80" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button type="text" @click="showDictData(scope.row)">{{ scope.row.dictType }}</el-button>
@@ -281,7 +284,7 @@ export default {
return exportType(queryParams);
})
.then((response) => {
this.download(response.msg);
this.download(response.data.path);
});
},
showDictData(row) {

View File

@@ -28,9 +28,9 @@
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:post:remove']">删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:post:export']">导出</el-button>
</el-col> -->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -98,6 +98,7 @@ import {
updatePost,
exportPost,
} from "@/api/system/post";
import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "Post",
@@ -268,7 +269,12 @@ export default {
return exportPost(queryParams);
})
.then((response) => {
this.download(response.msg);
console.log(response)
// this.download(response.msg);
downloadFile(
process.env.VUE_APP_BASE_API + response.data.path,
response.data.fileName
);
});
},
},

View File

@@ -21,6 +21,9 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:role:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:role:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -116,6 +119,7 @@ import {
// treeselect as deptTreeselect,
// roleDeptTreeselect,
// } from "@/api/system/dept";
import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "Role",
@@ -483,20 +487,20 @@ export default {
});
},
/** 导出按钮操作 */
// handleExport() {
// const queryParams = this.queryParams;
// this.$confirm("是否确认导出所有角色数据项?", "警告", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(function () {
// return exportRole(queryParams);
// })
// .then((response) => {
// this.download(response.msg);
// });
// },
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有角色数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportRole(queryParams);
})
.then((response) => {
this.download(response.data.path);
});
},
},
};
</script>

View File

@@ -215,7 +215,7 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { downLoadExcel, downloadFile } from "@/utils/zipdownload.js";
import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "User",
@@ -553,7 +553,7 @@ export default {
if (code == 200) {
this.msgSuccess("导出成功");
downloadFile(
process.env.VUE_APP_BASE_API + data.zipPath,
process.env.VUE_APP_BASE_API + data.path,
data.fileName
);
} else {