Merge branch 'dvadmin-dev' of https://gitee.com/liqianglog/django-vue-admin
# Conflicts: # dvadmin-ui/src/views/vadmin/permission/user/index.vuepull/3/MERGE
commit
bc19d5c29f
|
@ -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>
|
|
@ -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;
|
||||||
|
|
|
@ -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,7 +88,8 @@
|
||||||
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>
|
||||||
|
@ -106,6 +109,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:logininfor:get']"
|
||||||
|
>详细
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
|
@ -115,14 +130,84 @@
|
||||||
: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'
|
||||||
|
|
||||||
|
const LOGIN_FORM_ITEM = [
|
||||||
|
{
|
||||||
|
index: 1,
|
||||||
|
label: '访问编号',
|
||||||
|
key: 'id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 2,
|
||||||
|
label: '用户名称',
|
||||||
|
key: 'creator_name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 3,
|
||||||
|
label: '登录地址',
|
||||||
|
key: 'ipaddr'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 4,
|
||||||
|
label: '登录地点',
|
||||||
|
key: 'loginLocation'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 5,
|
||||||
|
label: '浏览器',
|
||||||
|
key: 'browser'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 6,
|
||||||
|
label: '操作系统',
|
||||||
|
key: 'browser'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 7,
|
||||||
|
label: '操作信息',
|
||||||
|
key: 'os'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 8,
|
||||||
|
label: '登录状态',
|
||||||
|
key: 'status',
|
||||||
|
labelType: 'boolean',
|
||||||
|
labelChoices: {
|
||||||
|
false: '失败',
|
||||||
|
true: '正常'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 9,
|
||||||
|
label: '登录日期',
|
||||||
|
key: 'create_datetime',
|
||||||
|
labelType: 'time',
|
||||||
|
singleLine: true
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Logininfor",
|
name: 'Logininfor',
|
||||||
|
components: { DetailFormDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
@ -137,11 +222,14 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
// 表格数据
|
// 表格数据
|
||||||
list: [],
|
list: [],
|
||||||
|
// 是否显示弹出层
|
||||||
|
openDetailModal: false,
|
||||||
// 状态数据字典
|
// 状态数据字典
|
||||||
statusOptions: [{ dictLabel: '成功', dictValue: true }, { dictLabel: '失败', dictValue: false }],
|
statusOptions: [{ dictLabel: '成功', dictValue: true }, { dictLabel: '失败', dictValue: false }],
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
form: {},
|
form: {},
|
||||||
|
formItem: LOGIN_FORM_ITEM,
|
||||||
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
@ -151,10 +239,10 @@ export default {
|
||||||
userName: undefined,
|
userName: undefined,
|
||||||
status: undefined
|
status: undefined
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
// this.getDicts("sys_common_status").then(response => {
|
// this.getDicts("sys_common_status").then(response => {
|
||||||
// this.statusOptions = response.data;
|
// this.statusOptions = response.data;
|
||||||
// });
|
// });
|
||||||
|
@ -163,76 +251,83 @@ export default {
|
||||||
|
|
||||||
/** 查询登录日志列表 */
|
/** 查询登录日志列表 */
|
||||||
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
|
||||||
console.log(this.queryParams)
|
console.log(this.queryParams)
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.dateRange = [];
|
this.dateRange = []
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
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
|
||||||
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', '警告', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning"
|
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>
|
||||||
|
|
||||||
|
|
|
@ -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,7 +88,8 @@
|
||||||
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>
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,8 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['permission:user:post']"
|
v-hasPermi="['permission:user:post']"
|
||||||
>新增</el-button>
|
>新增
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -102,7 +103,8 @@
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['permission:user:{id}:put']"
|
v-hasPermi="['permission:user:{id}:put']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -113,7 +115,8 @@
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['permission:user:{id}:delete']"
|
v-hasPermi="['permission:user:{id}:delete']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -123,7 +126,8 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleImport"
|
@click="handleImport"
|
||||||
v-hasPermi="['permission:user:import:post']"
|
v-hasPermi="['permission:user:import:post']"
|
||||||
>导入</el-button>
|
>导入
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -133,7 +137,8 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['permission:user:export:get']"
|
v-hasPermi="['permission:user:export:get']"
|
||||||
>导出</el-button>
|
>导出
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -141,11 +146,33 @@
|
||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="50" align="center"/>
|
<el-table-column type="selection" width="50" align="center"/>
|
||||||
<el-table-column label="用户编号" align="center" key="id" prop="id" v-if="columns[0].visible"/>
|
<el-table-column label="用户编号" align="center" key="id" prop="id" v-if="columns[0].visible"/>
|
||||||
<el-table-column label="用户名称" align="center" key="username" prop="username" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
<el-table-column label="用户名称" align="center" key="username" prop="username" v-if="columns[1].visible"
|
||||||
<el-table-column label="用户昵称" align="center" key="name" prop="name" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
<el-table-column label="用户昵称" align="center" key="name" prop="name" v-if="columns[2].visible"
|
||||||
<el-table-column label="手机号码" align="center" key="mobile" prop="mobile" v-if="columns[4].visible" width="120" />
|
:show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="状态" align="center" key="is_active" v-if="columns[5].visible">
|
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible"
|
||||||
|
:show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="关联角色" align="center" key="role" prop="dept.role" v-if="columns[4].visible"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<template v-if="scope.row.role.length > 0">
|
||||||
|
<el-dropdown>
|
||||||
|
<span class="el-dropdown-link">{{scope.row.role[0].roleName}}
|
||||||
|
<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item v-for="role in scope.row.role">{{role.roleName}}</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>暂无关联角色</span>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="手机号码" align="center" key="mobile" prop="mobile" v-if="columns[5].visible"
|
||||||
|
width="120"/>
|
||||||
|
<el-table-column label="状态" align="center" key="is_active" v-if="columns[6].visible">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.is_active"
|
v-model="scope.row.is_active"
|
||||||
|
@ -154,7 +181,7 @@
|
||||||
></el-switch>
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="create_datetime" v-if="columns[6].visible" width="160">
|
<el-table-column label="创建时间" align="center" prop="create_datetime" v-if="columns[7].visible" width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.create_datetime) }}</span>
|
<span>{{ parseTime(scope.row.create_datetime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -173,7 +200,8 @@
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['permission:user:{id}:put']"
|
v-hasPermi="['permission:user:{id}:put']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.id !== 1"
|
v-if="scope.row.id !== 1"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -181,14 +209,16 @@
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['permission:user:{id}:delete']"
|
v-hasPermi="['permission:user:{id}:delete']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-key"
|
icon="el-icon-key"
|
||||||
@click="handleResetPwd(scope.row)"
|
@click="handleResetPwd(scope.row)"
|
||||||
v-hasPermi="['permission:user:resetpwd:put']"
|
v-hasPermi="['permission:user:resetpwd:put']"
|
||||||
>重置</el-button>
|
>重置
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -262,7 +292,8 @@
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in statusOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictValue"
|
:label="dict.dictValue"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.dictLabel}}
|
||||||
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -329,7 +360,8 @@
|
||||||
<em>点击上传</em>
|
<em>点击上传</em>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-upload__tip" slot="tip">
|
<div class="el-upload__tip" slot="tip">
|
||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
<el-checkbox v-model="upload.updateSupport"/>
|
||||||
|
是否更新已经存在的用户数据
|
||||||
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
|
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
||||||
|
@ -354,14 +386,14 @@
|
||||||
listUser,
|
listUser,
|
||||||
resetUserPwd,
|
resetUserPwd,
|
||||||
updateUser
|
updateUser
|
||||||
} from "@/api/vadmin/permission/user";
|
} from '@/api/vadmin/permission/user'
|
||||||
import {getToken} from "@/utils/auth";
|
import { getToken } from '@/utils/auth'
|
||||||
import {treeselect} from "@/api/vadmin/permission/dept";
|
import { treeselect } from '@/api/vadmin/permission/dept'
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from '@riophae/vue-treeselect'
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: 'User',
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -380,7 +412,7 @@
|
||||||
// 用户表格数据
|
// 用户表格数据
|
||||||
userList: null,
|
userList: null,
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: '',
|
||||||
// 部门树选项
|
// 部门树选项
|
||||||
deptOptions: undefined,
|
deptOptions: undefined,
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
|
@ -392,7 +424,7 @@
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 状态数据字典
|
// 状态数据字典
|
||||||
statusOptions: [{dictLabel: '正常', dictValue: true,}, {dictLabel: '停用', dictValue: false,}],
|
statusOptions: [{ dictLabel: '正常', dictValue: true }, { dictLabel: '停用', dictValue: false }],
|
||||||
// 性别状态字典
|
// 性别状态字典
|
||||||
sexOptions: [],
|
sexOptions: [],
|
||||||
// 岗位选项
|
// 岗位选项
|
||||||
|
@ -402,23 +434,23 @@
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: "children",
|
children: 'children',
|
||||||
label: "label"
|
label: 'label'
|
||||||
},
|
},
|
||||||
// 用户导入参数
|
// 用户导入参数
|
||||||
upload: {
|
upload: {
|
||||||
// 是否显示弹出层(用户导入)
|
// 是否显示弹出层(用户导入)
|
||||||
open: false,
|
open: false,
|
||||||
// 弹出层标题(用户导入)
|
// 弹出层标题(用户导入)
|
||||||
title: "",
|
title: '',
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 是否更新已经存在的用户数据
|
// 是否更新已经存在的用户数据
|
||||||
updateSupport: 0,
|
updateSupport: 0,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
headers: { Authorization: 'Bearer ' + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/admin/system/savefile/"
|
url: process.env.VUE_APP_BASE_API + '/admin/system/savefile/'
|
||||||
},
|
},
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
@ -435,103 +467,104 @@
|
||||||
{ key: 1, label: `用户名称`, visible: true },
|
{ key: 1, label: `用户名称`, visible: true },
|
||||||
{ key: 2, label: `用户昵称`, visible: true },
|
{ key: 2, label: `用户昵称`, visible: true },
|
||||||
{ key: 3, label: `部门`, visible: true },
|
{ key: 3, label: `部门`, visible: true },
|
||||||
{ key: 4, label: `手机号码`, visible: true },
|
{ key: 4, label: `关联角色`, visible: true },
|
||||||
{ key: 5, label: `状态`, visible: true },
|
{ key: 5, label: `手机号码`, visible: true },
|
||||||
{ key: 6, label: `创建时间`, visible: true }
|
{ key: 6, label: `状态`, visible: true },
|
||||||
|
{ key: 7, label: `创建时间`, visible: true }
|
||||||
],
|
],
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, message: "用户名称不能为空", trigger: "blur" }
|
{ required: true, message: '用户名称不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
{ required: true, message: '用户昵称不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, message: "用户密码不能为空", trigger: "blur" }
|
{ required: true, message: '用户密码不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
type: "email",
|
type: 'email',
|
||||||
message: "'请输入正确的邮箱地址",
|
message: '\'请输入正确的邮箱地址',
|
||||||
trigger: ["blur", "change"]
|
trigger: ['blur', 'change']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
mobile: [
|
mobile: [
|
||||||
{
|
{
|
||||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||||
message: "请输入正确的手机号码",
|
message: '请输入正确的手机号码',
|
||||||
trigger: "blur"
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 根据名称筛选部门树
|
// 根据名称筛选部门树
|
||||||
deptName(val) {
|
deptName(val) {
|
||||||
this.$refs.tree.filter(val);
|
this.$refs.tree.filter(val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.getTreeselect();
|
this.getTreeselect()
|
||||||
// this.getDicts("sys_normal_disable").then(response => {
|
// this.getDicts("sys_normal_disable").then(response => {
|
||||||
// this.statusOptions = response.data;
|
// this.statusOptions = response.data;
|
||||||
// });
|
// });
|
||||||
this.getDicts("sys_user_sex").then(response => {
|
this.getDicts('sys_user_sex').then(response => {
|
||||||
this.sexOptions = response.data;
|
this.sexOptions = response.data
|
||||||
});
|
})
|
||||||
this.getConfigKey("sys.user.initPassword").then(response => {
|
this.getConfigKey('sys.user.initPassword').then(response => {
|
||||||
this.initPassword = response.msg;
|
this.initPassword = response.msg
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
this.userList = response.data.results;
|
this.userList = response.data.results
|
||||||
this.total = response.data.count;
|
this.total = response.data.count
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
},
|
},
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
getTreeselect() {
|
getTreeselect() {
|
||||||
treeselect().then(response => {
|
treeselect().then(response => {
|
||||||
this.deptOptions = this.handleTree(response.data,'id');
|
this.deptOptions = this.handleTree(response.data, 'id')
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 筛选节点
|
// 筛选节点
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
if (!value) return true;
|
if (!value) return true
|
||||||
return data.label.indexOf(value) !== -1;
|
return data.label.indexOf(value) !== -1
|
||||||
},
|
},
|
||||||
// 节点单击事件
|
// 节点单击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
this.queryParams.deptId = data.id;
|
this.queryParams.deptId = data.id
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
let text = row.is_active === true ? "启用" : "停用";
|
let text = row.is_active === true ? '启用' : '停用'
|
||||||
this.$confirm('确认要"' + text + '""' + row.username + '"用户吗?', "警告", {
|
this.$confirm('确认要"' + text + '""' + row.username + '"用户吗?', '警告', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning"
|
type: 'warning'
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
return changeUserStatus(row.id, row.is_active);
|
return changeUserStatus(row.id, row.is_active)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.msgSuccess(text + "成功");
|
this.msgSuccess(text + '成功')
|
||||||
}).catch(function() {
|
}).catch(function() {
|
||||||
row.is_active = row.is_active === false ? true : false;
|
row.is_active = row.is_active === false ? true : false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false
|
||||||
this.reset();
|
this.reset()
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
|
@ -548,144 +581,145 @@
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
postIds: [],
|
postIds: [],
|
||||||
roleIds: []
|
roleIds: []
|
||||||
};
|
}
|
||||||
this.resetForm("form");
|
this.resetForm('form')
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.dateRange = [];
|
this.dateRange = []
|
||||||
this.queryParams.deptId = ''
|
this.queryParams.deptId = ''
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id);
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset()
|
||||||
this.getTreeselect();
|
this.getTreeselect()
|
||||||
getUser().then(response => {
|
getUser().then(response => {
|
||||||
this.postOptions = response.data.posts;
|
this.postOptions = response.data.posts
|
||||||
this.roleOptions = response.data.roles;
|
this.roleOptions = response.data.roles
|
||||||
this.open = true;
|
this.open = true
|
||||||
this.title = "添加用户";
|
this.title = '添加用户'
|
||||||
this.form.password = this.initPassword;
|
this.form.password = this.initPassword
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset()
|
||||||
this.getTreeselect();
|
this.getTreeselect()
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids
|
||||||
getUser(id).then(response => {
|
getUser(id).then(response => {
|
||||||
let data = response.data.data
|
let data = response.data.data
|
||||||
data['postIds'] = response.data.postIds
|
data['postIds'] = response.data.postIds
|
||||||
data['roleIds'] = response.data.roleIds
|
data['roleIds'] = response.data.roleIds
|
||||||
this.form = data;
|
this.form = data
|
||||||
this.postOptions = response.data.posts;
|
this.postOptions = response.data.posts
|
||||||
this.roleOptions = response.data.roles;
|
this.roleOptions = response.data.roles
|
||||||
this.open = true;
|
this.open = true
|
||||||
this.title = "修改用户";
|
this.title = '修改用户'
|
||||||
this.form.password = "";
|
this.form.password = ''
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
handleResetPwd(row) {
|
handleResetPwd(row) {
|
||||||
this.$prompt('请输入"' + row.username + '"的新密码', "提示", {
|
this.$prompt('请输入"' + row.username + '"的新密码', '提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消"
|
cancelButtonText: '取消'
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.id, value).then(response => {
|
resetUserPwd(row.id, value).then(response => {
|
||||||
this.msgSuccess("修改成功,新密码是:" + value);
|
this.msgSuccess('修改成功,新密码是:' + value)
|
||||||
});
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs['form'].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != undefined) {
|
if (this.form.id != undefined) {
|
||||||
updateUser(this.form).then(response => {
|
updateUser(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess('修改成功')
|
||||||
this.open = false;
|
this.open = false
|
||||||
this.getList();
|
this.getList()
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
addUser(this.form).then(response => {
|
addUser(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess('新增成功')
|
||||||
this.open = false;
|
this.open = false
|
||||||
this.getList();
|
this.getList()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const userIds = row.id || this.ids;
|
const userIds = row.id || this.ids
|
||||||
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning"
|
type: 'warning'
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
return delUser(userIds);
|
return delUser(userIds)
|
||||||
}).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 exportUser(queryParams);
|
return exportUser(queryParams)
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.data.file_url,response.data.name);
|
this.download(response.data.file_url, response.data.name)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
handleImport() {
|
handleImport() {
|
||||||
this.upload.title = "用户导入";
|
this.upload.title = '用户导入'
|
||||||
this.upload.open = true;
|
this.upload.open = true
|
||||||
},
|
},
|
||||||
/** 下载模板操作 */
|
/** 下载模板操作 */
|
||||||
importTemplate() {
|
importTemplate() {
|
||||||
importTemplate().then(response => {
|
importTemplate().then(response => {
|
||||||
this.download(response.data.file_url,response.data.name);
|
this.download(response.data.file_url, response.data.name)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 文件上传中处理
|
// 文件上传中处理
|
||||||
handleFileUploadProgress(event, file, fileList) {
|
handleFileUploadProgress(event, file, fileList) {
|
||||||
this.upload.isUploading = true;
|
this.upload.isUploading = true
|
||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess(response, file, fileList) {
|
||||||
this.upload.open = false;
|
this.upload.open = false
|
||||||
this.upload.isUploading = false;
|
this.upload.isUploading = false
|
||||||
this.$refs.upload.clearFiles();
|
this.$refs.upload.clearFiles()
|
||||||
// 是否更新已经存在的用户数据
|
// 是否更新已经存在的用户数据
|
||||||
importsUser({ file_url: response.data.file_url, updateSupport: this.upload.updateSupport }).then(response => {
|
importsUser({ file_url: response.data.file_url, updateSupport: this.upload.updateSupport }).then(response => {
|
||||||
this.$alert('导入成功!', "导入结果", { dangerouslyUseHTMLString: true });
|
this.$alert('导入成功!', '导入结果', { dangerouslyUseHTMLString: true })
|
||||||
this.getList();
|
this.getList()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
submitFileForm() {
|
submitFileForm() {
|
||||||
this.$refs.upload.submit();
|
this.$refs.upload.submit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue