更换组合式API写法

This commit is contained in:
不做码农 2022-06-13 12:31:18 +08:00
parent 4035eaee47
commit 6b505312d9
6 changed files with 525 additions and 561 deletions

View File

@ -1,101 +1,90 @@
<template> <template>
<div :class="className" :style="{height:height,width:width}" /> <div ref="chartRef" :class="className" :style="{ height: height, width: width }" />
</template> </template>
<script> <script setup>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
// import resize from './mixins/resize' let chart = null
const { proxy } = getCurrentInstance()
const animationDuration = 6000 const animationDuration = 6000
const props = defineProps({
className: {
type: String,
default: 'chart',
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '300px',
},
})
function initChart() {
chart = echarts.init(proxy.$refs.chartRef, 'macarons')
export default { chart.setOption({
// mixins: [resize], tooltip: {
props: { trigger: 'axis',
className: { axisPointer: {
type: String, //
default: 'chart' type: 'shadow', // 线'line' | 'shadow'
},
}, },
width: { grid: {
type: String, top: 10,
default: '100%' left: '2%',
right: '2%',
bottom: '3%',
containLabel: true,
}, },
height: { xAxis: [
type: String, {
default: '300px' type: 'category',
} data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
}, axisTick: {
data() { alignWithLabel: true,
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el)
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { //
type: 'shadow' // 线'line' | 'shadow'
}
}, },
grid: { },
top: 10, ],
left: '2%', yAxis: [
right: '2%', {
bottom: '3%', type: 'value',
containLabel: true axisTick: {
show: false,
}, },
xAxis: [{ },
type: 'category', ],
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], series: [
axisTick: { {
alignWithLabel: true name: 'pageA',
} type: 'bar',
}], stack: 'vistors',
yAxis: [{ barWidth: '60%',
type: 'value', data: [79, 52, 200, 334, 390, 330, 220],
axisTick: { animationDuration,
show: false },
} {
}], name: 'pageB',
series: [{ type: 'bar',
name: 'pageA', stack: 'vistors',
type: 'bar', barWidth: '60%',
stack: 'vistors', data: [80, 52, 200, 334, 390, 330, 220],
barWidth: '60%', animationDuration,
data: [79, 52, 200, 334, 390, 330, 220], },
animationDuration {
}, { name: 'pageC',
name: 'pageB', type: 'bar',
type: 'bar', stack: 'vistors',
stack: 'vistors', barWidth: '60%',
barWidth: '60%', data: [30, 52, 200, 334, 390, 330, 220],
data: [80, 52, 200, 334, 390, 330, 220], animationDuration,
animationDuration },
}, { ],
name: 'pageC', })
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [30, 52, 200, 334, 390, 330, 220],
animationDuration
}]
})
}
}
} }
onMounted(() => {
initChart()
})
</script> </script>

View File

@ -1,133 +1,118 @@
<template> <template>
<div :class="className" :style="{ height: height, width: width }" /> <div ref="chartRef" :class="className" :style="{ height: height, width: width }" />
</template> </template>
<script> <script setup>
import * as echarts from 'echarts' import * as echarts from 'echarts'
// import resize from './mixins/resize' const { proxy } = getCurrentInstance()
const chartRef = ref(null)
const props = defineProps({
className: {
type: String,
default: 'chart',
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '350px',
},
autoResize: {
type: Boolean,
default: true,
},
chartData: {
type: Object,
required: true,
},
})
let chart = null
watch(
() => props.chartData,
(val) => {
setOptions(val)
},
{ deep: true },
)
export default { function setOptions({ expectedData, actualData } = {}) {
// mixins: [resize], chart.setOption({
props: { xAxis: {
className: { data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
type: String, boundaryGap: false,
default: 'chart', axisTick: {
}, show: false,
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '350px',
},
autoResize: {
type: Boolean,
default: true,
},
chartData: {
type: Object,
required: true,
},
},
data() {
return {
chart: null,
}
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}, },
}, },
}, grid: {
mounted() { left: 10,
this.$nextTick(() => { right: 10,
this.initChart() bottom: 20,
}) top: 30,
}, containLabel: true,
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el)
this.setOptions(this.chartData)
}, },
setOptions({ expectedData, actualData } = {}) { tooltip: {
this.chart.setOption({ trigger: 'axis',
xAxis: { axisPointer: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], type: 'cross',
boundaryGap: false, },
axisTick: { padding: [5, 10],
show: false,
},
},
grid: {
left: 10,
right: 10,
bottom: 20,
top: 30,
containLabel: true,
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
},
padding: [5, 10],
},
yAxis: {
axisTick: {
show: false,
},
},
legend: {
data: ['expected', 'actual'],
},
series: [
{
name: 'expected',
itemStyle: {
color: '#FF005A',
lineStyle: {
color: '#FF005A',
width: 2,
},
},
smooth: true,
type: 'line',
data: expectedData,
animationDuration: 2800,
animationEasing: 'cubicInOut',
},
{
name: 'actual',
smooth: true,
type: 'line',
itemStyle: {
color: '#3888fa',
areaStyle: {
color: '#f3f8ff',
},
lineStyle: {
color: '#3888fa',
width: 2,
},
},
data: actualData,
animationDuration: 2800,
animationEasing: 'quadraticOut',
},
],
})
}, },
}, yAxis: {
axisTick: {
show: false,
},
},
legend: {
data: ['expected', 'actual'],
},
series: [
{
name: 'expected',
itemStyle: {
color: '#FF005A',
lineStyle: {
color: '#FF005A',
width: 2,
},
},
smooth: true,
type: 'line',
data: expectedData,
animationDuration: 2800,
animationEasing: 'cubicInOut',
},
{
name: 'actual',
smooth: true,
type: 'line',
itemStyle: {
color: '#3888fa',
areaStyle: {
color: '#f3f8ff',
},
lineStyle: {
color: '#3888fa',
width: 2,
},
},
data: actualData,
animationDuration: 2800,
animationEasing: 'quadraticOut',
},
],
})
}
function initChart() {
chart = echarts.init(proxy.$refs.chartRef, 'macarons')
setOptions(props.chartData)
}
onMounted(() => {
initChart()
})
window.onresize = function () {
chart.resize()
} }
</script> </script>

View File

@ -1,78 +1,60 @@
<template> <template>
<div :class="className" :style="{height:height,width:width}" /> <div ref="chartRef" :class="className" :style="{ height: height, width: width }" />
</template> </template>
<script> <script setup>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
// import resize from './mixins/resize' const { proxy } = getCurrentInstance()
let chart = null
const props = defineProps({
className: {
type: String,
default: 'chart',
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '300px',
},
})
export default { function initChart() {
// mixins: [resize], chart = echarts.init(proxy.$refs.chartRef)
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el)
this.chart.setOption({ chart.setOption({
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)' formatter: '{a} <br/>{b} : {c} ({d}%)',
}, },
legend: { legend: {
left: 'center', left: 'center',
bottom: '10', bottom: '10',
data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts'] data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts'],
}, },
series: [ series: [
{ {
name: 'WEEKLY WRITE ARTICLES', name: 'WEEKLY WRITE ARTICLES',
type: 'pie', type: 'pie',
roseType: 'radius', roseType: 'radius',
radius: [15, 95], radius: [15, 95],
center: ['50%', '38%'], center: ['50%', '38%'],
data: [ data: [
{ value: 320, name: 'Industries' }, { value: 320, name: 'Industries' },
{ value: 240, name: 'Technology' }, { value: 240, name: 'Technology' },
{ value: 149, name: 'Forex' }, { value: 149, name: 'Forex' },
{ value: 100, name: 'Gold' }, { value: 100, name: 'Gold' },
{ value: 59, name: 'Forecasts' } { value: 59, name: 'Forecasts' },
], ],
animationEasing: 'cubicInOut', animationEasing: 'cubicInOut',
animationDuration: 2600 animationDuration: 2600,
} },
] ],
}) })
}
}
} }
onMounted(() => {
initChart()
})
</script> </script>

View File

@ -4,7 +4,6 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
// import resize from './mixins/resize'
const animationDuration = 3000 const animationDuration = 3000

View File

@ -5,15 +5,21 @@
<el-input v-model="queryParams.ipaddr" placeholder="请输入登录地址" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.ipaddr" placeholder="请输入登录地址" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="登录状态" clearable > <el-select v-model="queryParams.status" placeholder="登录状态" clearable>
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" /> <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="登录时间"> <el-form-item label="登录时间">
<el-date-picker v-model="dateRange" style="width: 240px" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> <el-date-picker
v-model="dateRange"
style="width: 240px"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
@ -23,7 +29,9 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" plain icon="delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['monitor:logininfor:remove']">删除</el-button> <el-button type="danger" plain icon="delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['monitor:logininfor:remove']"
>删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" plain icon="delete" @click="handleClean" v-hasPermi="['monitor:logininfor:remove']">清空</el-button> <el-button type="danger" plain icon="delete" @click="handleClean" v-hasPermi="['monitor:logininfor:remove']">清空</el-button>
@ -43,7 +51,7 @@
<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"> <el-table-column label="操作状态" align="center" prop="status">
<template #default="{row}"> <template #default="{ row }">
<dict-tag :options="statusOptions" :value="row.status"></dict-tag> <dict-tag :options="statusOptions" :value="row.status"></dict-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -55,142 +63,124 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</div> </div>
</template> </template>
<script> <script setup name="logininfor">
import { import { list as queryList, delLogininfor, cleanLogininfor, exportLogininfor } from '@/api/monitor/logininfor'
list,
delLogininfor,
cleanLogininfor,
exportLogininfor,
} from "@/api/monitor/logininfor";
export default { //
name: "logininfor", const loading = ref(true)
data() { //
return { const ids = ref([])
// //
loading: true, const multiple = ref(true)
// //
ids: [], const showSearch = ref(true)
// //
multiple: true, const total = ref(0)
// //
showSearch: true, const list = ref([])
// //
total: 0, const statusOptions = ref([])
// //
list: [], const dateRange = ref([])
// //
statusOptions: [], const queryParams = reactive({
// pageNum: 1,
dateRange: [], pageSize: 10,
// ipaddr: undefined,
queryParams: { userName: undefined,
pageNum: 1, status: undefined,
pageSize: 10, })
ipaddr: undefined,
userName: undefined, const { proxy } = getCurrentInstance()
status: undefined, /** 查询登录日志列表 */
}, function getList() {
}; loading.value = true
}, queryList(proxy.addDateRange(queryParams, dateRange.value)).then((response) => {
created() { loading.value = false
this.getList(); if (response.code == 200) {
this.getDicts("sys_common_status").then((response) => { list.value = response.data.result
this.statusOptions = response.data; total.value = response.data.totalNum
}); } else {
}, total.value = 0
methods: { list.value = []
/** 查询登录日志列表 */ }
getList() { })
this.loading = true; }
list(this.addDateRange(this.queryParams, this.dateRange)).then( //
(response) => { function statusFormat(row, column) {
this.loading = false; return proxy.selectDictLabel(statusOptions.value, row.status)
if (response.code == 200) { }
this.list = response.data.result; getList()
this.total = response.data.totalNum; proxy.getDicts('sys_common_status').then((response) => {
} else { statusOptions.value = response.data
this.total = 0; })
this.list = [];
} /** 搜索按钮操作 */
} function handleQuery() {
); queryParams.pageNum = 1
}, getList()
// }
statusFormat(row, column) { /** 重置按钮操作 */
return this.selectDictLabel(this.statusOptions, row.status); function resetQuery() {
}, dateRange.value = []
/** 搜索按钮操作 */ proxy.resetForm('queryForm')
handleQuery() { handleQuery()
this.queryParams.pageNum = 1; }
this.getList(); //
}, function handleSelectionChange(selection) {
/** 重置按钮操作 */ ids.value = selection.map((item) => item.infoId)
resetQuery() { multiple.value = !selection.length
this.dateRange = []; }
this.resetForm("queryForm"); /** 删除按钮操作 */
this.handleQuery(); function handleDelete(row) {
}, const infoIds = row.infoId || ids.value
// proxy
handleSelectionChange(selection) { .$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', '警告', {
this.ids = selection.map((item) => item.infoId); confirmButtonText: '确定',
this.multiple = !selection.length; cancelButtonText: '取消',
}, type: 'warning',
/** 删除按钮操作 */ })
handleDelete(row) { .then(function () {
const infoIds = row.infoId || this.ids; return delLogininfor(infoIds)
this.$confirm( })
'是否确认删除访问编号为"' + infoIds + '"的数据项?', .then(() => {
"警告", getList()
{ proxy.$modal.msgSuccess('删除成功')
confirmButtonText: "确定", })
cancelButtonText: "取消", }
type: "warning", /** 清空按钮操作 */
} function handleClean() {
) proxy
.then(function () { .$confirm('是否确认清空所有登录日志数据项?', '警告', {
return delLogininfor(infoIds); confirmButtonText: '确定',
}) cancelButtonText: '取消',
.then(() => { type: 'warning',
this.getList(); })
this.$modal.msgSuccess("删除成功"); .then(function () {
}); return cleanLogininfor()
}, })
/** 清空按钮操作 */ .then(() => {
handleClean() { getList()
this.$confirm("是否确认清空所有登录日志数据项?", "警告", { proxy.$modal.msgSuccess('清空成功')
confirmButtonText: "确定", })
cancelButtonText: "取消", }
type: "warning", /** 导出按钮操作 */
}) function handleExport() {
.then(function () { proxy
return cleanLogininfor(); .$confirm('是否确认导出所有操作日志数据项?', '警告', {
}) confirmButtonText: '确定',
.then(() => { cancelButtonText: '取消',
this.getList(); type: 'warning',
this.$modal.msgSuccess("清空成功"); })
}); .then(function () {
}, return exportLogininfor(queryParams)
/** 导出按钮操作 */ })
handleExport() { .then((response) => {
const queryParams = this.queryParams; proxy.download(response.data.path)
this.$confirm("是否确认导出所有操作日志数据项?", "警告", { })
confirmButtonText: "确定", }
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportLogininfor(queryParams);
})
.then((response) => {
this.download(response.data.path);
});
},
},
};
</script> </script>

View File

@ -90,7 +90,7 @@
<!-- 操作日志详细 --> <!-- 操作日志详细 -->
<el-dialog title="操作日志详细" v-model="open" width="700px" append-to-body> <el-dialog title="操作日志详细" v-model="open" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="100px"> <el-form ref="formRef" :model="form" label-width="100px">
<el-row> <el-row>
<el-col :lg="12"> <el-col :lg="12">
<el-form-item label="操作模块:">{{ form.title }} </el-form-item> <el-form-item label="操作模块:">{{ form.title }} </el-form-item>
@ -136,148 +136,167 @@
</div> </div>
</template> </template>
<script> <script setup name="operlog">
import { list, delOperlog, cleanOperlog, exportOperlog } from '@/api/monitor/operlog' import { list as listOperLog, delOperlog, cleanOperlog, exportOperlog } from '@/api/monitor/operlog'
export default { const { proxy } = getCurrentInstance()
name: 'operlog', //
data() { const loading = ref(true)
return { //
// const ids = ref([])
loading: true, //
// const multiple = ref(true)
ids: [], //
// const showSearch = ref(true)
multiple: true, //
// const total = ref(0)
showSearch: true, //
// const list = ref([])
total: 0, //
// const open = ref(false)
list: [], //
// const statusOptions = ref([])
open: false, // 0 1 2 3 eg:{ dictLabel: '', dictValue: '0'}
// const businessTypeOptions = ref([])
statusOptions: [], //
// 0 1 2 3 eg:{ dictLabel: '', dictValue: '0'} const dateRange = ref([])
businessTypeOptions: [],
// const state = reactive({
dateRange: [], form: {},
// queryParams: {
form: {}, pageNum: 1,
// pageSize: 20,
queryParams: { title: undefined,
pageNum: 1, operName: undefined,
pageSize: 20, businessType: undefined,
title: undefined, status: undefined,
operName: undefined, },
businessType: undefined, })
status: undefined, const { form, queryParams } = toRefs(state)
}, var dictParams = [
{ dictType: 'sys_oper_type', columnName: 'businessTypeOptions' },
{ dictType: 'sys_common_status', columnName: 'statusOptions' },
]
proxy.getDicts(dictParams).then((response) => {
response.data.forEach((element) => {
proxy[element.columnName] = element.list
})
})
/** 查询登录日志 */
function getList() {
loading.value = true
listOperLog(proxy.addDateRange(queryParams.value, dateRange.value)).then((response) => {
loading.value = false
if (response.code == 200) {
list.value = response.data.result
total.value = response.data.totalNum
} else {
total.value = 0
list.value = []
} }
}, })
created() { }
this.getList() //
var dictParams = [ function statusFormat(row, column) {
{ dictType: 'sys_oper_type', columnName: 'businessTypeOptions' }, return proxy.selectDictLabel(statusOptions.value, row.status)
{ dictType: 'sys_common_status', columnName: 'statusOptions' }, }
] /** 搜索按钮操作 */
this.getDicts(dictParams).then((response) => { function handleQuery() {
response.data.forEach((element) => { queryParams.value.pageNum = 1
this[element.columnName] = element.list getList()
}) }
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = []
proxy.resetForm('queryForm')
handleQuery()
}
//
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.operId)
multiple.value = !selection.length
}
const formRef = ref()
/** 重置操作表单 */
function reset() {
form.value = {
operId: undefined,
title: undefined,
businessType: undefined,
method: undefined,
requestMethod: undefined,
operatorType: undefined,
deptName: undefined,
operUrl: undefined,
operIp: undefined,
operLocation: undefined,
operParam: undefined,
jsonResult: undefined,
status: 0,
errorMsg: undefined,
operTime: undefined,
elapsed: 0,
}
proxy.resetForm('formRef')
}
/** 详细按钮操作 */
function handleView(row) {
reset()
open.value = true
form.value = row
}
/** 删除按钮操作 */
function handleDelete(row) {
const operIds = row.operId || ids.value
proxy
.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}) })
}, .then(function () {
methods: { return delOperlog(operIds)
/** 查询登录日志 */ })
getList() { .then(() => {
this.loading = true getList()
list(this.addDateRange(this.queryParams, this.dateRange)).then((response) => { proxy.$modal.msgSuccess('删除成功')
this.loading = false })
if (response.code == 200) { }
this.list = response.data.result /** 清空按钮操作 */
this.total = response.data.totalNum function handleClean() {
proxy
.$confirm('是否确认清空所有操作日志数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return cleanOperlog()
})
.then(() => {
getList()
proxy.$modal.msgSuccess('清空成功')
})
}
/** 导出按钮操作 */
function handleExport() {
proxy
.$confirm('是否确认导出所有操作日志?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
exportOperlog(queryParams.value).then((response) => {
const { code, data } = response
if (code == 200) {
proxy.$modal.msgSuccess('导出成功')
proxy.download(data.path)
} else { } else {
this.total = 0 proxy.$modal.msgError('导出失败')
this.list = []
} }
}) })
}, })
//
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.operId)
this.multiple = !selection.length
},
/** 详细按钮操作 */
handleView(row) {
this.open = true
this.form = row
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return delOperlog(operIds)
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
},
/** 清空按钮操作 */
handleClean() {
this.$confirm('是否确认清空所有操作日志数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return cleanOperlog()
})
.then(() => {
this.getList()
this.$modal.msgSuccess('清空成功')
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
exportOperlog(queryParams).then((response) => {
const { code, data } = response
if (code == 200) {
this.$modal.msgSuccess('导出成功')
this.download(data.path)
} else {
this.$modal.msgError('导出失败')
}
})
})
},
},
} }
handleQuery()
</script> </script>