|
@ -1,18 +1,16 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="head-container"> |
|
|
<div class="head-container"> |
|
|
<!-- <crudOperation /> --> |
|
|
|
|
|
<!-- <el-button v-permission="permission.download" :loading="crud.downloadLoading" :disabled="!selections.length" size="mini" icon="el-icon-download" @click="handleDownload">导出</el-button> --> |
|
|
|
|
|
<div class="head-search"> |
|
|
<div class="head-search"> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="query.blurry" |
|
|
|
|
|
|
|
|
v-model="keyWord" |
|
|
size="small" |
|
|
size="small" |
|
|
clearable |
|
|
clearable |
|
|
placeholder="请输入关键词" |
|
|
placeholder="请输入关键词" |
|
|
style="width: 300px;" |
|
|
style="width: 300px;" |
|
|
class="input-prepend filter-item" |
|
|
class="input-prepend filter-item" |
|
|
|
|
|
@clear="crud.toQuery" |
|
|
@keyup.enter.native="crud.toQuery" |
|
|
@keyup.enter.native="crud.toQuery" |
|
|
> |
|
|
> |
|
|
<!-- <el-select slot="prepend" v-model="optionVal" style="width: 100px" @keyup.enter.native="crud.toQuery"> --> |
|
|
|
|
|
<el-select slot="prepend" v-model="optionVal" style="width: 92px"> |
|
|
<el-select slot="prepend" v-model="optionVal" style="width: 92px"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in options" |
|
|
v-for="item in options" |
|
@ -22,12 +20,19 @@ |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-input> |
|
|
</el-input> |
|
|
<date-range-picker v-model="query.createTime" class="date-item" /> |
|
|
|
|
|
<rrOperation /> |
|
|
|
|
|
|
|
|
<date-range-picker v-model="blurryTime" class="date-item" /> |
|
|
|
|
|
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="crud.toQuery">搜索</el-button> |
|
|
|
|
|
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery()">重置</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<crudOperation :permission="permission"> |
|
|
|
|
|
|
|
|
<crudOperation> |
|
|
<template v-slot:left> |
|
|
<template v-slot:left> |
|
|
<el-button :loading="crud.downloadLoading" size="mini" @click="delVisible=true"><i class="iconfont icon-shanchu" />清空</el-button> |
|
|
|
|
|
|
|
|
<el-button :loading="crud.downloadLoading" size="mini" @click="handleComfiredDelt"><i class="iconfont icon-shanchu" />清空</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-slot:right> |
|
|
|
|
|
<el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)"> |
|
|
|
|
|
<i class="iconfont icon-daochu" /> |
|
|
|
|
|
导出 |
|
|
|
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</crudOperation> |
|
|
</crudOperation> |
|
|
<!-- <el-button :loading="crud.downloadLoading" size="mini" icon="el-icon-download" @click="handleDownload">导出</el-button> --> |
|
|
<!-- <el-button :loading="crud.downloadLoading" size="mini" icon="el-icon-download" @click="handleDownload">导出</el-button> --> |
|
@ -41,7 +46,6 @@ |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<el-button type="text" @click="delVisible = false">取消</el-button> |
|
|
<el-button type="text" @click="delVisible = false">取消</el-button> |
|
|
<el-button type="primary">继续</el-button> |
|
|
<el-button type="primary">继续</el-button> |
|
|
<!-- @click="confirmDelAll" --> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
@ -49,26 +53,129 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { header, crud } from '@crud/crud' |
|
|
|
|
|
import rrOperation from '@crud/RR.operation' |
|
|
|
|
|
|
|
|
import CRUD, { header, crud } from '@crud/crud' |
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
import DateRangePicker from '@/components/DateRangePicker' |
|
|
import DateRangePicker from '@/components/DateRangePicker' |
|
|
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
|
|
import { exportFile } from '@/utils/index' |
|
|
|
|
|
import qs from 'qs' |
|
|
export default { |
|
|
export default { |
|
|
components: { rrOperation, DateRangePicker, crudOperation }, |
|
|
|
|
|
|
|
|
components: { DateRangePicker, crudOperation }, |
|
|
mixins: [header(), crud()], |
|
|
mixins: [header(), crud()], |
|
|
|
|
|
props: { |
|
|
|
|
|
isLogType: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
default: '' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
|
|
|
blurryTime: [], |
|
|
delVisible: false, |
|
|
delVisible: false, |
|
|
optionVal: 1, |
|
|
|
|
|
options: [ |
|
|
|
|
|
{ value: 1, label: '用户名' }, |
|
|
|
|
|
{ value: 2, label: '所属部门' }, |
|
|
|
|
|
{ value: 3, label: '登录账号' }, |
|
|
|
|
|
{ value: 4, label: '请求方法' }, |
|
|
|
|
|
{ value: 5, label: '请求参数' } |
|
|
|
|
|
], |
|
|
|
|
|
permission: {} |
|
|
|
|
|
|
|
|
keyWord: '', |
|
|
|
|
|
optionVal: 'username', |
|
|
|
|
|
options: [] |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
computed: { |
|
|
|
|
|
...mapGetters([ |
|
|
|
|
|
'baseApi' |
|
|
|
|
|
]) |
|
|
|
|
|
}, |
|
|
|
|
|
created() { |
|
|
|
|
|
if (this.isLogType === 'error') { |
|
|
|
|
|
this.options = [ |
|
|
|
|
|
{ value: 'username', label: '用户名' }, |
|
|
|
|
|
{ value: 'account', label: '登录账号' }, |
|
|
|
|
|
{ value: 'method', label: '请求方法' }, |
|
|
|
|
|
{ value: 'params', label: '请求参数' } |
|
|
|
|
|
] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.options = [ |
|
|
|
|
|
{ value: 'username', label: '用户名' }, |
|
|
|
|
|
{ value: 'det', label: '所属部门' }, |
|
|
|
|
|
{ value: 'account', label: '登录账号' } |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
|
|
this.crud.query[this.optionVal] = this.keyWord |
|
|
|
|
|
if (this.blurryTime) { |
|
|
|
|
|
this.crud.query.startTime = this.blurryTime[0] |
|
|
|
|
|
this.crud.query.endTime = this.blurryTime[1] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.crud.query.startTime = null |
|
|
|
|
|
this.crud.query.endTime = null |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
resetQuery() { |
|
|
|
|
|
if (this.isLogType === 'error') { |
|
|
|
|
|
this.options = [ |
|
|
|
|
|
{ value: 'username', label: '用户名' }, |
|
|
|
|
|
{ value: 'account', label: '登录账号' }, |
|
|
|
|
|
{ value: 'method', label: '请求方法' }, |
|
|
|
|
|
{ value: 'params', label: '请求参数' } |
|
|
|
|
|
] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.options = [ |
|
|
|
|
|
{ value: 'username', label: '用户名' }, |
|
|
|
|
|
{ value: 'det', label: '所属部门' }, |
|
|
|
|
|
{ value: 'account', label: '登录账号' } |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
this.keyWord = '' |
|
|
|
|
|
this.crud.query[this.optionVal] = this.keyWord |
|
|
|
|
|
this.blurryTime = null |
|
|
|
|
|
this.crud.query.startTime = null |
|
|
|
|
|
this.crud.query.endTime = null |
|
|
|
|
|
this.crud.toQuery() |
|
|
|
|
|
}, |
|
|
|
|
|
handleComfiredDelt() { |
|
|
|
|
|
if (this.isLogType === 'login') { |
|
|
|
|
|
this.$emit('handleClearData') |
|
|
|
|
|
} else if (this.isLogType === 'operate') { |
|
|
|
|
|
this.$emit('handleClearOperateData') |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$emit('handleClearErrorData') |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
doExport(data) { |
|
|
|
|
|
console.log(data) |
|
|
|
|
|
crud.downloadLoading = true |
|
|
|
|
|
this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
|
|
confirmButtonText: '继续', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
const ids = [] |
|
|
|
|
|
data.forEach(val => { |
|
|
|
|
|
ids.push(val.id) |
|
|
|
|
|
}) |
|
|
|
|
|
if (this.isLogType === 'login') { |
|
|
|
|
|
console.log('导出 - 登录日志') |
|
|
|
|
|
const params = { |
|
|
|
|
|
'deptsIds': ids |
|
|
|
|
|
} |
|
|
|
|
|
exportFile(this.baseApi + '/api/depts/download?' + qs.stringify(params, { indices: false })) |
|
|
|
|
|
} else if (this.isLogType === 'operate') { |
|
|
|
|
|
console.log('导出 - 操作日志') |
|
|
|
|
|
const params = { |
|
|
|
|
|
'deptsIds': ids |
|
|
|
|
|
} |
|
|
|
|
|
exportFile(this.baseApi + '/api/depts/download?' + qs.stringify(params, { indices: false })) |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('导出 - 错误日志') |
|
|
|
|
|
const params = { |
|
|
|
|
|
'deptsIds': ids |
|
|
|
|
|
} |
|
|
|
|
|
exportFile(this.baseApi + '/api/depts/download?' + qs.stringify(params, { indices: false })) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|