功能变化(日志管理):操作列增加详细按钮;封装formDialog组件用作显示详细信息;

pull/2/head
xt12321 2021-03-27 18:42:44 +08:00
parent 7525e6cf2c
commit 9c5a931e6d
4 changed files with 515 additions and 203 deletions

View File

@ -0,0 +1,77 @@
<template>
<el-dialog :title="dialogTitle"
:visible="openDetailModal"
:width="modalWidth"
@close="closeDetailFormDialog"
append-to-body
>
<el-form ref="form"
:model="formData"
:label-width="labelWidth"
:size="formSize"
>
<el-row>
<template v-for="item in formItem">
<el-col :span="item.singleLine? 24:12">
<el-form-item :label="`${item.label}`" :key="item.index" >
<template v-if="item.customRender">
<slot :name="item.key" :item="item"></slot>
</template>
<template v-else>
{{ parseFormItemContent(item) }}
</template>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDetailFormDialog"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { parseTime } from '../../utils/ruoyi'
const labelTypeToFunction = {
time: (item, formData) => {
return parseTime(formData[item.key])
},
boolean: (item, formData) => {
return item.labelChoices[formData[item.key]]
}
}
export default {
name: 'DetailFormDialog',
props: {
dialogTitle: { type: String, required: true },
openDetailModal: { type: Boolean, required: true },
modalWidth: { type: String, default: '720px' },
labelWidth: { type: String, default: '100px' },
formSize: { type: String, default: 'mini' },
formData: { type: Object, default: {} },
formItem: { type: Array, default: [] }
},
methods: {
parseFormItemContent(item) {
let labelType = item.labelType
if (labelType) {
return labelTypeToFunction[labelType](item, this.formData)
} else {
return this.formData[item.key]
}
},
closeDetailFormDialog() {
this.$emit('closeDialog', false)
}
}
}
</script>
<style scoped>
</style>

View File

@ -105,6 +105,18 @@
<span>{{ parseTime(scope.row.create_datetime) }}</span> <span>{{ parseTime(scope.row.create_datetime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['admin:system:celerylog:get']"
>详细
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
@ -114,14 +126,79 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 表单类详情dialog-->
<detail-form-dialog v-if="openDetailModal"
dialog-title="定时日志详细"
modalWidth="700px"
:openDetailModal="openDetailModal"
:formData="form"
:formItem="formItem"
@closeDialog="value=>{openDetailModal=value}"
></detail-form-dialog>
</div> </div>
</template> </template>
<script> <script>
import { list, delCeleryLog, cleanCeleryLog, exportCeleryLog } from "@/api/vadmin/monitor/celery"; import { list, delCeleryLog, cleanCeleryLog, exportCeleryLog } from "@/api/vadmin/monitor/celery";
import DetailFormDialog from '@/components/Modal/DetailFormDialog'
const CELERY_LOG_FORM_ITEM = [
{
index: 1,
label: '日志编号',
key: 'id'
},
{
index: 2,
label: '任务名称',
key: 'name'
},
{
index: 3,
label: '执行函数名称',
key: 'func_name',
width: "auto"
},
{
index: 4,
label: '执行参数',
key: 'kwargs',
singleLine: true
},
{
index: 5,
label: '执行时间',
key: 'seconds'
},
{
index: 6,
label: '运行状态',
key: 'status',
labelType: 'boolean',
labelChoices: {
false: '失败',
true: '正常'
}
},
{
index: 7,
label: '任务结果',
key: 'result',
singleLine: true
},
{
index: 8,
label: '执行日期',
key: 'create_datetime',
labelType: 'time',
singleLine: true
}
];
export default { export default {
name: "CeleryLog", name: "CeleryLog",
components: { DetailFormDialog },
data() { data() {
return { return {
// //
@ -135,12 +212,15 @@ export default {
// //
total: 0, total: 0,
// //
//
openDetailModal: false,
list: [], list: [],
// //
statusOptions:[{dictLabel: '成功', dictValue: true}, {dictLabel: '失败', dictValue: false}], statusOptions:[{dictLabel: '成功', dictValue: true}, {dictLabel: '失败', dictValue: false}],
// //
dateRange: [], dateRange: [],
form: {}, form: {},
formItem: CELERY_LOG_FORM_ITEM,
// //
queryParams: { queryParams: {
@ -191,6 +271,13 @@ export default {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 详细按钮操作 */
handleView(row) {
this.openDetailModal = true
this.form = row
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const infoIds = row.id || this.ids; const infoIds = row.id || this.ids;

View File

@ -66,7 +66,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['admin:system:logininfor:{id}:delete']" v-hasPermi="['admin:system:logininfor:{id}:delete']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -76,7 +77,8 @@
size="mini" size="mini"
@click="handleClean" @click="handleClean"
v-hasPermi="['admin:system:logininfor:clean:delete']" v-hasPermi="['admin:system:logininfor:clean:delete']"
>清空</el-button> >清空
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -86,26 +88,39 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['admin:system:logininfor:export:get']" v-hasPermi="['admin:system:logininfor:export:get']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="访问编号" align="center" prop="id" /> <el-table-column label="访问编号" align="center" prop="id"/>
<el-table-column label="用户名称" align="center" prop="creator_name" /> <el-table-column label="用户名称" align="center" prop="creator_name"/>
<el-table-column label="登录地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" /> <el-table-column label="登录地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true"/>
<el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" /> <el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true"/>
<el-table-column label="浏览器" align="center" prop="browser" /> <el-table-column label="浏览器" align="center" prop="browser"/>
<el-table-column label="操作系统" align="center" prop="os" /> <el-table-column label="操作系统" align="center" prop="os"/>
<el-table-column label="登录状态" align="center" prop="status" :formatter="statusFormat"/> <el-table-column label="登录状态" align="center" prop="status" :formatter="statusFormat"/>
<el-table-column label="操作信息" align="center" prop="msg" /> <el-table-column label="操作信息" align="center" prop="msg"/>
<el-table-column label="登录日期" align="center" prop="create_datetime" width="180"> <el-table-column label="登录日期" align="center" prop="create_datetime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.create_datetime) }}</span> <span>{{ parseTime(scope.row.create_datetime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['admin:system:logininfor:get']"
>详细
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
@ -115,124 +130,204 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 表单类详情dialog-->
<detail-form-dialog v-if="openDetailModal"
dialog-title="登录日志详细"
modalWidth="700px"
:openDetailModal="openDetailModal"
:formData="form"
:formItem="formItem"
@closeDialog="value=>{openDetailModal=value}"
>
</detail-form-dialog>
</div> </div>
</template> </template>
<script> <script>
import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/vadmin/monitor/logininfor"; import { list, delLogininfor, cleanLogininfor, exportLogininfor } from '@/api/vadmin/monitor/logininfor'
import DetailFormDialog from '@/components/Modal/DetailFormDialog'
export default { const LOGIN_FORM_ITEM = [
name: "Logininfor", {
data() { index: 1,
return { label: '访问编号',
// key: 'id'
loading: true, },
// {
ids: [], index: 2,
// label: '用户名称',
multiple: true, key: 'creator_name',
// },
showSearch: true, {
// index: 3,
total: 0, label: '登录地址',
// key: 'ipaddr'
list: [], },
// {
statusOptions:[{dictLabel: '成功', dictValue: true}, {dictLabel: '失败', dictValue: false}], index: 4,
// label: '登录地点',
dateRange: [], key: 'loginLocation'
form: {}, },
{
// index: 5,
queryParams: { label: '浏览器',
pageNum: 1, key: 'browser'
pageSize: 10, },
ipaddr: undefined, {
userName: undefined, index: 6,
status: undefined label: '操作系统',
key: 'browser'
},
{
index: 7,
label: '操作信息',
key: 'os'
},
{
index: 8,
label: '登录状态',
key: 'status',
labelType: 'boolean',
labelChoices: {
false: '失败',
true: '正常'
} }
}; },
}, {
created() { index: 9,
this.getList(); label: '登录日期',
// this.getDicts("sys_common_status").then(response => { key: 'create_datetime',
// this.statusOptions = response.data; labelType: 'time',
// }); singleLine: true
}, }
methods: {
/** 查询登录日志列表 */ ]
getList() {
this.loading = true; export default {
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { name: 'Logininfor',
this.list = response.data.results; components: { DetailFormDialog },
this.total = response.data.count; data() {
this.loading = false; return {
//
loading: true,
//
ids: [],
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
list: [],
//
openDetailModal: false,
//
statusOptions: [{ dictLabel: '成功', dictValue: true }, { dictLabel: '失败', dictValue: false }],
//
dateRange: [],
form: {},
formItem: LOGIN_FORM_ITEM,
//
queryParams: {
pageNum: 1,
pageSize: 10,
ipaddr: undefined,
userName: undefined,
status: undefined
} }
); }
}, },
// created() {
statusFormat(row, column) { this.getList()
return this.selectDictLabel(this.statusOptions, row.status); // this.getDicts("sys_common_status").then(response => {
// this.statusOptions = response.data;
// });
}, },
/** 搜索按钮操作 */ methods: {
handleQuery() {
this.queryParams.pageNum = 1; /** 查询登录日志列表 */
console.log(this.queryParams) getList() {
this.getList(); this.loading = true
}, list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
/** 重置按钮操作 */ this.list = response.data.results
resetQuery() { this.total = response.data.count
this.dateRange = []; this.loading = false
this.resetForm("queryForm"); }
this.handleQuery(); )
}, },
// //
handleSelectionChange(selection) { statusFormat(row, column) {
this.ids = selection.map(item => item.id) return this.selectDictLabel(this.statusOptions, row.status)
this.multiple = !selection.length },
}, /** 搜索按钮操作 */
/** 删除按钮操作 */ handleQuery() {
handleDelete(row) { this.queryParams.pageNum = 1
const infoIds = row.id || this.ids; console.log(this.queryParams)
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", { this.getList()
confirmButtonText: "确定", },
cancelButtonText: "取消", /** 重置按钮操作 */
type: "warning" resetQuery() {
this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.multiple = !selection.length
},
/** 详细按钮操作 */
handleView(row) {
this.openDetailModal = true
this.form = row
},
/** 删除按钮操作 */
handleDelete(row) {
const infoIds = row.id || this.ids
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() { }).then(function() {
return delLogininfor(infoIds); return delLogininfor(infoIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}) })
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean() { handleClean() {
this.$confirm('是否确认清空所有登录日志数据项?', "警告", { this.$confirm('是否确认清空所有登录日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function() { }).then(function() {
return cleanLogininfor(); return cleanLogininfor()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("清空成功"); this.msgSuccess('清空成功')
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', "警告", { this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function() { }).then(function() {
return exportLogininfor(queryParams); return exportLogininfor(queryParams)
}).then(response => { }).then(response => {
this.download(response.data.file_url,response.data.name); this.download(response.data.file_url, response.data.name)
}) })
}
} }
} }
};
</script> </script>

View File

@ -66,7 +66,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['admin:system:operation_log:{id}:delete']" v-hasPermi="['admin:system:operation_log:{id}:delete']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -76,7 +77,8 @@
size="mini" size="mini"
@click="handleClean" @click="handleClean"
v-hasPermi="['admin:system:operation_log:clean:delete']" v-hasPermi="['admin:system:operation_log:clean:delete']"
>清空</el-button> >清空
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -86,20 +88,21 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['admin:system:operlog:export:get']" v-hasPermi="['admin:system:operlog:export:get']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="日志编号" align="center" prop="id" /> <el-table-column label="日志编号" align="center" prop="id"/>
<el-table-column label="系统模块" align="center" prop="request_modular" /> <el-table-column label="系统模块" align="center" prop="request_modular"/>
<el-table-column label="请求方式" align="center" prop="request_method" /> <el-table-column label="请求方式" align="center" prop="request_method"/>
<el-table-column label="操作人员" align="center" prop="creator_name" /> <el-table-column label="操作人员" align="center" prop="creator_name"/>
<el-table-column label="主机" align="center" prop="request_ip" width="130" :show-overflow-tooltip="true" /> <el-table-column label="主机" align="center" prop="request_ip" width="130" :show-overflow-tooltip="true"/>
<el-table-column label="操作地点" align="center" prop="request_location" :show-overflow-tooltip="true" /> <el-table-column label="操作地点" align="center" prop="request_location" :show-overflow-tooltip="true"/>
<el-table-column label="操作状态" align="center" prop="status" :formatter="statusFormat" /> <el-table-column label="操作状态" align="center" prop="status" :formatter="statusFormat"/>
<el-table-column label="操作日期" align="center" prop="create_datetime" width="180"> <el-table-column label="操作日期" align="center" prop="create_datetime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.create_datetime) }}</span> <span>{{ parseTime(scope.row.create_datetime) }}</span>
@ -113,7 +116,8 @@
icon="el-icon-view" icon="el-icon-view"
@click="handleView(scope.row,scope.index)" @click="handleView(scope.row,scope.index)"
v-hasPermi="['admin:system:operlog:get']" v-hasPermi="['admin:system:operlog:get']"
>详细</el-button> >详细
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -127,54 +131,94 @@
/> />
<!-- 操作日志详细 --> <!-- 操作日志详细 -->
<el-dialog title="操作日志详细" :visible.sync="open" width="700px" append-to-body> <!-- 表单类详情dialog-->
<el-form ref="form" :model="form" label-width="100px" size="mini"> <detail-form-dialog v-if="openDetailModal"
<el-row> dialog-title="操作日志详细"
<el-col :span="12"> modalWidth="700px"
<el-form-item label="操作模块:">{{ form.request_modular }} / {{ form.request_msg }}</el-form-item> :openDetailModal="openDetailModal"
<el-form-item :formData="form"
label="登录信息:" :formItem="formItem"
>{{ form.creator_name }} / {{ form.request_ip }} / {{ form.request_location }} / {{ form.request_browser }}</el-form-item> @closeDialog="value=>{openDetailModal=value}"
</el-col> >
<el-col :span="12"> <template slot="customRequestModular" slot-scope="{item}">
<el-form-item label="请求地址:">{{ form.request_path }}</el-form-item> <span>{{connectFieldsContent([form.request_modular, form.request_msg], '/') }}</span>
<el-form-item label="请求方式:">{{ form.request_method }}</el-form-item> </template>
</el-col> <template slot="customLoginInfo" slot-scope="{item}">
<el-col :span="24"> <span>{{connectFieldsContent([form.creator_name, form.request_ip, form.request_location, form.request_browser], '/')}}</span>
<el-form-item label="请求参数:">{{ form.request_body }}</el-form-item> </template>
</el-col> </detail-form-dialog>
<el-col :span="24">
<el-form-item label="返回参数:">{{ form.json_result }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="返回状态码:">{{ form.response_code }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作状态:">
<div v-if="form.status === true"></div>
<div v-else-if="form.status === false">失败</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作时间:">{{ parseTime(form.create_datetime) }}</el-form-item>
</el-col>
<!-- <el-col :span="24">-->
<!-- <el-form-item label="异常信息:" v-if="form.status === false">{{ form.json_result }}</el-form-item>-->
<!-- </el-col>-->
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {cleanOperationLog, delOperationLog, exportOperationLog, list} from "@/api/vadmin/system/operationlog"; import { cleanOperationLog, delOperationLog, exportOperationLog, list } from '@/api/vadmin/system/operationlog'
import DetailFormDialog from '@/components/Modal/DetailFormDialog'
import log from '../job/log'
const OPERATION_LOG_FORM_ITEM = [
{
index: 1,
label: '操作模块',
key: 'customRequestModular',
customRender: true,
singleLine: true
},
{
index: 2,
label: '登录信息',
key: 'customLoginInfo',
customRender: true,
singleLine: true
},
{
index: 3,
label: '请求地址',
key: 'request_path'
},
{
index: 4,
label: '请求参数',
key: 'request_body',
singleLine: true
},
{
index: 5,
label: '返回参数',
key: 'json_result'
},
{
index: 6,
label: '返回状态码',
key: 'response_code'
},
{
index: 7,
label: '操作状态',
key: 'status',
labelType: 'boolean',
labelChoices: {
false: '失败',
true: '正常'
}
},
{
index: 8,
label: '任务结果',
key: 'result',
singleLine: true
},
{
index: 9,
label: '操作时间',
key: 'create_datetime',
labelType: 'time',
singleLine: true
}
]
export default { export default {
name: "Operlog", name: 'Operlog',
components: { DetailFormDialog },
data() { data() {
return { return {
// //
@ -190,13 +234,14 @@
// //
list: [], list: [],
// //
open: false, openDetailModal: false,
// //
statusOptions: [{dictLabel: '成功', dictValue: true}, {dictLabel: '失败', dictValue: false}], statusOptions: [{ dictLabel: '成功', dictValue: true }, { dictLabel: '失败', dictValue: false }],
// //
dateRange: [], dateRange: [],
// //
form: {}, form: {},
formItem: OPERATION_LOG_FORM_ITEM,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -205,36 +250,36 @@
creator_name: undefined, creator_name: undefined,
status: undefined status: undefined
} }
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询登录日志 */ /** 查询登录日志 */
getList() { getList() {
this.loading = true; this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.data.results; this.list = response.data.results
this.total = response.data.count; this.total = response.data.count
this.loading = false; this.loading = false
} }
); )
}, },
// //
statusFormat(row, column) { statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -243,50 +288,58 @@
}, },
/** 详细按钮操作 */ /** 详细按钮操作 */
handleView(row) { handleView(row) {
this.open = true; this.openDetailModal = true
this.form = row; this.form = row
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids
this.$confirm('是否确认删除日志编号为"' + ids + '"的数据项?', "警告", { this.$confirm('是否确认删除日志编号为"' + ids + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function() { }).then(function() {
return delOperationLog(ids); return delOperationLog(ids)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}) })
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean() { handleClean() {
this.$confirm('是否确认清空所有操作日志数据项?', "警告", { this.$confirm('是否确认清空所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function() { }).then(function() {
return cleanOperationLog(); return cleanOperationLog()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("清空成功"); this.msgSuccess('清空成功')
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', "警告", { this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function() { }).then(function() {
return exportOperationLog(queryParams); return exportOperationLog(queryParams)
}).then(response => { }).then(response => {
this.download(response.data.file_url,response.data.name); this.download(response.data.file_url, response.data.name)
}) })
},
connectFieldsContent(fieldsContent, symbol) {
fieldsContent.forEach((fieldContent, index) => {
if (!fieldContent) {
delete fieldsContent[index]
}
})
return fieldsContent.join(symbol)
} }
} }
}; }
</script> </script>