Pre Merge pull request !81 from bug制造者/master

pull/81/MERGE
bug制造者 4 years ago committed by Gitee
commit 6228f0eab5

@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> <select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1 where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select> </select>
<insert id="insertDept" parameterType="SysDept"> <insert id="insertDept" parameterType="SysDept">

@ -82,12 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_name=#{roleName} limit 1 WHERE r.role_name=#{roleName} AND r.del_flag = '0' limit 1
</select> </select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_key=#{roleKey} limit 1 WHERE r.role_key=#{roleKey} AND r.del_flag = '0' limit 1
</select> </select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">

@ -1,181 +1,181 @@
<template> <template>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')"> <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel-icon-wrapper icon-people"> <div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="peoples" class-name="card-panel-icon" /> <svg-icon icon-class="peoples" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
访客 访客
</div> </div>
<count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" /> <count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')"> <div class="card-panel" @click="handleSetLineChartData('messages')">
<div class="card-panel-icon-wrapper icon-message"> <div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="message" class-name="card-panel-icon" /> <svg-icon icon-class="message" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
消息 消息
</div> </div>
<count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" /> <count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')"> <div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel-icon-wrapper icon-money"> <div class="card-panel-icon-wrapper icon-money">
<svg-icon icon-class="money" class-name="card-panel-icon" /> <svg-icon icon-class="money" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
金额 金额
</div> </div>
<count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" /> <count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('shoppings')"> <div class="card-panel" @click="handleSetLineChartData('shoppings')">
<div class="card-panel-icon-wrapper icon-shopping"> <div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="shopping" class-name="card-panel-icon" /> <svg-icon icon-class="shopping" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
订单 订单
</div> </div>
<count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" /> <count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
<script> <script>
import CountTo from 'vue-count-to' import CountTo from 'vue-count-to'
export default { export default {
components: { components: {
CountTo CountTo
}, },
methods: { methods: {
handleSetLineChartData(type) { handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type) this.$emit('handleSetLineChartData', type)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.panel-group { .panel-group {
margin-top: 18px; //margin-top: 18px;
.card-panel-col { .card-panel-col {
margin-bottom: 32px; margin-bottom: 32px;
} }
.card-panel { .card-panel {
height: 108px; height: 108px;
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
color: #666; color: #666;
background: #fff; background: #fff;
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05); box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
border-color: rgba(0, 0, 0, .05); border-color: rgba(0, 0, 0, .05);
&:hover { &:hover {
.card-panel-icon-wrapper { .card-panel-icon-wrapper {
color: #fff; color: #fff;
} }
.icon-people { .icon-people {
background: #40c9c6; background: #40c9c6;
} }
.icon-message { .icon-message {
background: #36a3f7; background: #36a3f7;
} }
.icon-money { .icon-money {
background: #f4516c; background: #f4516c;
} }
.icon-shopping { .icon-shopping {
background: #34bfa3 background: #34bfa3
} }
} }
.icon-people { .icon-people {
color: #40c9c6; color: #40c9c6;
} }
.icon-message { .icon-message {
color: #36a3f7; color: #36a3f7;
} }
.icon-money { .icon-money {
color: #f4516c; color: #f4516c;
} }
.icon-shopping { .icon-shopping {
color: #34bfa3 color: #34bfa3
} }
.card-panel-icon-wrapper { .card-panel-icon-wrapper {
float: left; float: left;
margin: 14px 0 0 14px; margin: 14px 0 0 14px;
padding: 16px; padding: 16px;
transition: all 0.38s ease-out; transition: all 0.38s ease-out;
border-radius: 6px; border-radius: 6px;
} }
.card-panel-icon { .card-panel-icon {
float: left; float: left;
font-size: 48px; font-size: 48px;
} }
.card-panel-description { .card-panel-description {
float: right; float: right;
font-weight: bold; font-weight: bold;
margin: 26px; margin: 26px;
margin-left: 0px; margin-left: 0px;
.card-panel-text { .card-panel-text {
line-height: 18px; line-height: 18px;
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
font-size: 16px; font-size: 16px;
margin-bottom: 12px; margin-bottom: 12px;
} }
.card-panel-num { .card-panel-num {
font-size: 20px; font-size: 20px;
} }
} }
} }
} }
@media (max-width:550px) { @media (max-width:550px) {
.card-panel-description { .card-panel-description {
display: none; display: none;
} }
.card-panel-icon-wrapper { .card-panel-icon-wrapper {
float: none !important; float: none !important;
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0 !important; margin: 0 !important;
.svg-icon { .svg-icon {
display: block; display: block;
margin: 14px auto !important; margin: 14px auto !important;
float: none !important; float: none !important;
} }
} }
} }
</style> </style>

@ -1,481 +1,485 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="任务名称" prop="jobName"> <el-form-item label="任务名称" prop="jobName">
<el-input <el-input
v-model="queryParams.jobName" v-model="queryParams.jobName"
placeholder="请输入任务名称" placeholder="请输入任务名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="任务组名" prop="jobGroup"> <el-form-item label="任务组名" prop="jobGroup">
<el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small"> <el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small">
<el-option <el-option
v-for="dict in jobGroupOptions" v-for="dict in jobGroupOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</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 size="small"> <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['monitor:job:add']" v-hasPermi="['monitor:job:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['monitor:job:edit']" v-hasPermi="['monitor:job:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['monitor:job:remove']" v-hasPermi="['monitor:job:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['monitor:job:export']" v-hasPermi="['monitor:job:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" type="info"
plain plain
icon="el-icon-s-operation" icon="el-icon-s-operation"
size="mini" size="mini"
@click="handleJobLog" @click="handleJobLog"
v-hasPermi="['monitor:job:query']" v-hasPermi="['monitor:job:query']"
>日志</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="jobList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="jobList" @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="jobId" /> <el-table-column label="任务编号" align="center" prop="jobId" />
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
<el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" /> <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" />
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
<el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> <el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
active-value="0" active-value="0"
inactive-value="1" inactive-value="1"
@change="handleStatusChange(scope.row)" @change="handleStatusChange(scope.row)"
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-caret-right" icon="el-icon-caret-right"
@click="handleRun(scope.row)" @click="handleRun(scope.row)"
v-hasPermi="['monitor:job:changeStatus']" v-hasPermi="['monitor:job:changeStatus']"
>执行一次</el-button> >执行一次</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleView(scope.row)" @click="handleView(scope.row)"
v-hasPermi="['monitor:job:query']" v-hasPermi="['monitor:job:query']"
>详细</el-button> >详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改定时任务对话框 --> <!-- 添加或修改定时任务对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务名称" prop="jobName"> <el-form-item label="任务名称" prop="jobName">
<el-input v-model="form.jobName" placeholder="请输入任务名称" /> <el-input v-model="form.jobName" placeholder="请输入任务名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务分组" prop="jobGroup"> <el-form-item label="任务分组" prop="jobGroup">
<el-select v-model="form.jobGroup" placeholder="请选择"> <el-select v-model="form.jobGroup" placeholder="请选择">
<el-option <el-option
v-for="dict in jobGroupOptions" v-for="dict in jobGroupOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="invokeTarget"> <el-form-item prop="invokeTarget">
<span slot="label"> <span slot="label">
调用方法 调用方法
<el-tooltip placement="top"> <el-tooltip placement="top">
<div slot="content"> <div slot="content">
Bean调用示例ryTask.ryParams('ry') Bean调用示例ryTask.ryParams('ry')
<br />Class类调用示例com.ruoyi.quartz.task.RyTask.ryParams('ry') <br />Class类调用示例com.ruoyi.quartz.task.RyTask.ryParams('ry')
<br />参数说明支持字符串布尔类型长整型浮点型整型 <br />参数说明支持字符串布尔类型长整型浮点型整型
</div> </div>
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
</el-tooltip> </el-tooltip>
</span> </span>
<el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" /> <el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="cron表达式" prop="cronExpression"> <el-form-item label="cron表达式" prop="cronExpression">
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" /> <el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否并发" prop="concurrent"> <el-form-item label="是否并发" prop="concurrent">
<el-radio-group v-model="form.concurrent" size="small"> <el-radio-group v-model="form.concurrent" size="small">
<el-radio-button label="0">允许</el-radio-button> <el-radio-button label="0">允许</el-radio-button>
<el-radio-button label="1">禁止</el-radio-button> <el-radio-button label="1">禁止</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="错误策略" prop="misfirePolicy"> <el-form-item label="错误策略" prop="misfirePolicy">
<el-radio-group v-model="form.misfirePolicy" size="small"> <el-radio-group v-model="form.misfirePolicy" size="small">
<el-radio-button label="1">立即执行</el-radio-button> <el-radio-button label="1">立即执行</el-radio-button>
<el-radio-button label="2">执行一次</el-radio-button> <el-radio-button label="2">执行一次</el-radio-button>
<el-radio-button label="3">放弃执行</el-radio-button> <el-radio-button label="3">放弃执行</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
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>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 任务日志详细 --> <!-- 任务日志详细 -->
<el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body> <el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="120px" size="mini"> <el-form ref="form" :model="form" label-width="120px" size="mini">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务编号:">{{ form.jobId }}</el-form-item> <el-form-item label="任务编号:">{{ form.jobId }}</el-form-item>
<el-form-item label="任务名称:">{{ form.jobName }}</el-form-item> <el-form-item label="任务名称:">{{ form.jobName }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务分组:">{{ jobGroupFormat(form) }}</el-form-item> <el-form-item label="任务分组:">{{ jobGroupFormat(form) }}</el-form-item>
<el-form-item label="创建时间:">{{ form.createTime }}</el-form-item> <el-form-item label="创建时间:">{{ form.createTime }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="cron表达式">{{ form.cronExpression }}</el-form-item> <el-form-item label="cron表达式">{{ form.cronExpression }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="下次执行时间:">{{ parseTime(form.nextValidTime) }}</el-form-item> <el-form-item label="下次执行时间:">{{ parseTime(form.nextValidTime) }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="调用目标方法:">{{ form.invokeTarget }}</el-form-item> <el-form-item label="调用目标方法:">{{ form.invokeTarget }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务状态:"> <el-form-item label="任务状态:">
<div v-if="form.status == 0"></div> <div v-if="form.status == 0"></div>
<div v-else-if="form.status == 1">失败</div> <div v-else-if="form.status == 1">失败</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否并发:"> <el-form-item label="是否并发:">
<div v-if="form.concurrent == 0"></div> <div v-if="form.concurrent == 0"></div>
<div v-else-if="form.concurrent == 1">禁止</div> <div v-else-if="form.concurrent == 1">禁止</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="执行策略:"> <el-form-item label="执行策略:">
<div v-if="form.misfirePolicy == 0"></div> <div v-if="form.misfirePolicy == 0"></div>
<div v-else-if="form.misfirePolicy == 1">立即执行</div> <div v-else-if="form.misfirePolicy == 1">立即执行</div>
<div v-else-if="form.misfirePolicy == 2">执行一次</div> <div v-else-if="form.misfirePolicy == 2">执行一次</div>
<div v-else-if="form.misfirePolicy == 3">放弃执行</div> <div v-else-if="form.misfirePolicy == 3">放弃执行</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="openView = false"> </el-button> <el-button @click="openView = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
export default { export default {
name: "Job", name: "Job",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
jobList: [], jobList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
openView: false, openView: false,
// //
jobGroupOptions: [], jobGroupOptions: [],
// //
statusOptions: [], statusOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
jobName: undefined, jobName: undefined,
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
jobName: [ jobName: [
{ required: true, message: "任务名称不能为空", trigger: "blur" } { required: true, message: "任务名称不能为空", trigger: "blur" }
], ],
invokeTarget: [ invokeTarget: [
{ required: true, message: "调用目标字符串不能为空", trigger: "blur" } { required: true, message: "调用目标字符串不能为空", trigger: "blur" }
], ],
cronExpression: [ cronExpression: [
{ required: true, message: "cron执行表达式不能为空", trigger: "blur" } { required: true, message: "cron执行表达式不能为空", trigger: "blur" }
] ]
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_job_group").then(response => { this.getDicts("sys_job_group").then(response => {
this.jobGroupOptions = response.data; this.jobGroupOptions = response.data;
}); });
this.getDicts("sys_job_status").then(response => { this.getDicts("sys_job_status").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
}, },
methods: { methods: {
/** 查询定时任务列表 */ /** 查询定时任务列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listJob(this.queryParams).then(response => { listJob(this.queryParams).then(response => {
this.jobList = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
}); }
}, this.jobList = response.rows;
// this.total = response.total;
jobGroupFormat(row, column) { this.loading = false;
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); });
}, },
// //
statusFormat(row, column) { jobGroupFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
}, },
// //
cancel() { statusFormat(row, column) {
this.open = false; return this.selectDictLabel(this.statusOptions, row.status);
this.reset(); },
}, //
// cancel() {
reset() { this.open = false;
this.form = { this.reset();
jobId: undefined, },
jobName: undefined, //
jobGroup: undefined, reset() {
invokeTarget: undefined, this.form = {
cronExpression: undefined, jobId: undefined,
misfirePolicy: 1, jobName: undefined,
concurrent: 1, jobGroup: undefined,
status: "0" invokeTarget: undefined,
}; cronExpression: undefined,
this.resetForm("form"); misfirePolicy: 1,
}, concurrent: 1,
/** 搜索按钮操作 */ status: "0"
handleQuery() { };
this.queryParams.pageNum = 1; this.resetForm("form");
this.getList(); },
}, /** 搜索按钮操作 */
/** 重置按钮操作 */ handleQuery() {
resetQuery() { this.queryParams.pageNum = 1;
this.resetForm("queryForm"); this.getList();
this.handleQuery(); },
}, /** 重置按钮操作 */
// resetQuery() {
handleSelectionChange(selection) { this.resetForm("queryForm");
this.ids = selection.map(item => item.jobId); this.handleQuery();
this.single = selection.length != 1; },
this.multiple = !selection.length; //
}, handleSelectionChange(selection) {
// this.ids = selection.map(item => item.jobId);
handleStatusChange(row) { this.single = selection.length != 1;
let text = row.status === "0" ? "启用" : "停用"; this.multiple = !selection.length;
this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", { },
confirmButtonText: "确定", //
cancelButtonText: "取消", handleStatusChange(row) {
type: "warning" let text = row.status === "0" ? "启用" : "停用";
}).then(function() { this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", {
return changeJobStatus(row.jobId, row.status); confirmButtonText: "确定",
}).then(() => { cancelButtonText: "取消",
this.msgSuccess(text + "成功"); type: "warning"
}).catch(function() { }).then(function() {
row.status = row.status === "0" ? "1" : "0"; return changeJobStatus(row.jobId, row.status);
}); }).then(() => {
}, this.msgSuccess(text + "成功");
/* 立即执行一次 */ }).catch(()=>{
handleRun(row) { row.status = row.status === "0" ? "1" : "0";
this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", { });
confirmButtonText: "确定", },
cancelButtonText: "取消", /* 立即执行一次 */
type: "warning" handleRun(row) {
}).then(function() { this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", {
return runJob(row.jobId, row.jobGroup); confirmButtonText: "确定",
}).then(() => { cancelButtonText: "取消",
this.msgSuccess("执行成功"); type: "warning"
}).catch(() => {}); }).then(function() {
}, return runJob(row.jobId, row.jobGroup);
/** 任务详细信息 */ }).then(() => {
handleView(row) { this.msgSuccess("执行成功");
getJob(row.jobId).then(response => { }).catch(() => {});
this.form = response.data; },
this.openView = true; /** 任务详细信息 */
}); handleView(row) {
}, getJob(row.jobId).then(response => {
/** 任务日志列表查询 */ this.form = response.data;
handleJobLog() { this.openView = true;
this.$router.push("/job/log"); });
}, },
/** 新增按钮操作 */ /** 任务日志列表查询 */
handleAdd() { handleJobLog() {
this.reset(); this.$router.push("/job/log");
this.open = true; },
this.title = "添加任务"; /** 新增按钮操作 */
}, handleAdd() {
/** 修改按钮操作 */ this.reset();
handleUpdate(row) { this.open = true;
this.reset(); this.title = "添加任务";
const jobId = row.jobId || this.ids; },
getJob(jobId).then(response => { /** 修改按钮操作 */
this.form = response.data; handleUpdate(row) {
this.open = true; this.reset();
this.title = "修改任务"; const jobId = row.jobId || this.ids;
}); getJob(jobId).then(response => {
}, this.form = response.data;
/** 提交按钮 */ this.open = true;
submitForm: function() { this.title = "修改任务";
this.$refs["form"].validate(valid => { });
if (valid) { },
if (this.form.jobId != undefined) { /** 提交按钮 */
updateJob(this.form).then(response => { submitForm: function() {
this.msgSuccess("修改成功"); this.$refs["form"].validate(valid => {
this.open = false; if (valid) {
this.getList(); if (this.form.jobId != undefined) {
}); updateJob(this.form).then(response => {
} else { this.msgSuccess("修改成功");
addJob(this.form).then(response => { this.open = false;
this.msgSuccess("新增成功"); this.getList();
this.open = false; });
this.getList(); } else {
}); addJob(this.form).then(response => {
} this.msgSuccess("新增成功");
} this.open = false;
}); this.getList();
}, });
/** 删除按钮操作 */ }
handleDelete(row) { }
const jobIds = row.jobId || this.ids; });
this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", { },
confirmButtonText: "确定", /** 删除按钮操作 */
cancelButtonText: "取消", handleDelete(row) {
type: "warning" const jobIds = row.jobId || this.ids;
}).then(function() { this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", {
return delJob(jobIds); confirmButtonText: "确定",
}).then(() => { cancelButtonText: "取消",
this.getList(); type: "warning"
this.msgSuccess("删除成功"); }).then(function() {
}) return delJob(jobIds);
}, }).then(() => {
/** 导出按钮操作 */ this.getList();
handleExport() { this.msgSuccess("删除成功");
this.download('schedule/job/export', { })
...this.queryParams },
}, `job_${new Date().getTime()}.xlsx`) /** 导出按钮操作 */
} handleExport() {
} this.download('schedule/job/export', {
}; ...this.queryParams
</script> }, `job_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -1,292 +1,295 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="任务名称" prop="jobName"> <el-form-item label="任务名称" prop="jobName">
<el-input <el-input
v-model="queryParams.jobName" v-model="queryParams.jobName"
placeholder="请输入任务名称" placeholder="请输入任务名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="任务组名" prop="jobGroup"> <el-form-item label="任务组名" prop="jobGroup">
<el-select <el-select
v-model="queryParams.jobGroup" v-model="queryParams.jobGroup"
placeholder="请任务组名" placeholder="请任务组名"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in jobGroupOptions" v-for="dict in jobGroupOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="执行状态" prop="status"> <el-form-item label="执行状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="请选择执行状态" placeholder="请选择执行状态"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="执行时间"> <el-form-item label="执行时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['monitor:job:remove']" v-hasPermi="['monitor:job:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
@click="handleClean" @click="handleClean"
v-hasPermi="['monitor:job:remove']" v-hasPermi="['monitor:job:remove']"
>清空</el-button> >清空</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['monitor:job:export']" v-hasPermi="['monitor:job:export']"
>导出</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="jobLogList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="jobLogList" @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="日志编号" width="80" align="center" prop="jobLogId" /> <el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
<el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" /> <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" />
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" /> <el-table-column label="日志信息" align="center" prop="jobMessage" :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="createTime" width="180"> <el-table-column label="执行时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleView(scope.row)" @click="handleView(scope.row)"
v-hasPermi="['monitor:job:query']" v-hasPermi="['monitor:job:query']"
>详细</el-button> >详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 调度日志详细 --> <!-- 调度日志详细 -->
<el-dialog title="调度日志详细" :visible.sync="open" width="700px" append-to-body> <el-dialog title="调度日志详细" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="100px" size="mini"> <el-form ref="form" :model="form" label-width="100px" size="mini">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="日志序号:">{{ form.jobLogId }}</el-form-item> <el-form-item label="日志序号:">{{ form.jobLogId }}</el-form-item>
<el-form-item label="任务名称:">{{ form.jobName }}</el-form-item> <el-form-item label="任务名称:">{{ form.jobName }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务分组:">{{ form.jobGroup }}</el-form-item> <el-form-item label="任务分组:">{{ form.jobGroup }}</el-form-item>
<el-form-item label="执行时间:">{{ form.createTime }}</el-form-item> <el-form-item label="执行时间:">{{ form.createTime }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="调用方法:">{{ form.invokeTarget }}</el-form-item> <el-form-item label="调用方法:">{{ form.invokeTarget }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="日志信息:">{{ form.jobMessage }}</el-form-item> <el-form-item label="日志信息:">{{ form.jobMessage }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="执行状态:"> <el-form-item label="执行状态:">
<div v-if="form.status == 0"></div> <div v-if="form.status == 0"></div>
<div v-else-if="form.status == 1">失败</div> <div v-else-if="form.status == 1">失败</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="异常信息:" v-if="form.status == 1">{{ form.exceptionInfo }}</el-form-item> <el-form-item label="异常信息:" v-if="form.status == 1">{{ form.exceptionInfo }}</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button> <el-button @click="open = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog"; import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
export default { export default {
name: "JobLog", name: "JobLog",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
jobLogList: [], jobLogList: [],
// //
open: false, open: false,
// //
dateRange: [], dateRange: [],
// //
form: {}, form: {},
// //
statusOptions: [], statusOptions: [],
// //
jobGroupOptions: [], jobGroupOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
jobName: undefined, jobName: undefined,
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_job_status").then(response => { this.getDicts("sys_job_status").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
this.getDicts("sys_job_group").then(response => { this.getDicts("sys_job_group").then(response => {
this.jobGroupOptions = response.data; this.jobGroupOptions = response.data;
}); });
}, },
methods: { methods: {
/** 查询调度日志列表 */ /** 查询调度日志列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.jobLogList = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
} }
); this.jobLogList = response.rows;
}, this.total = response.total;
// this.loading = false;
statusFormat(row, column) { });
return this.selectDictLabel(this.statusOptions, row.status); },
}, //
// statusFormat(row, column) {
jobGroupFormat(row, column) { return this.selectDictLabel(this.statusOptions, row.status);
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); },
}, //
/** 搜索按钮操作 */ jobGroupFormat(row, column) {
handleQuery() { return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
this.queryParams.pageNum = 1; },
this.getList(); /** 搜索按钮操作 */
}, handleQuery() {
/** 重置按钮操作 */ this.queryParams.pageNum = 1;
resetQuery() { this.getList();
this.dateRange = []; },
this.resetForm("queryForm"); /** 重置按钮操作 */
this.handleQuery(); resetQuery() {
}, this.dateRange = [];
// this.resetForm("queryForm");
handleSelectionChange(selection) { this.handleQuery();
this.ids = selection.map(item => item.jobLogId); },
this.multiple = !selection.length; //
}, handleSelectionChange(selection) {
/** 详细按钮操作 */ this.ids = selection.map(item => item.jobLogId);
handleView(row) { this.multiple = !selection.length;
this.open = true; },
this.form = row; /** 详细按钮操作 */
}, handleView(row) {
/** 删除按钮操作 */ this.open = true;
handleDelete(row) { this.form = row;
const jobLogIds = this.ids; },
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", { /** 删除按钮操作 */
confirmButtonText: "确定", handleDelete(row) {
cancelButtonText: "取消", const jobLogIds = this.ids;
type: "warning" this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", {
}).then(function() { confirmButtonText: "确定",
return delJobLog(jobLogIds); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("删除成功"); return delJobLog(jobLogIds);
}) }).then(() => {
}, this.getList();
/** 清空按钮操作 */ this.msgSuccess("删除成功");
handleClean() { })
this.$confirm("是否确认清空所有调度日志数据项?", "警告", { },
confirmButtonText: "确定", /** 清空按钮操作 */
cancelButtonText: "取消", handleClean() {
type: "warning" this.$confirm("是否确认清空所有调度日志数据项?", "警告", {
}).then(function() { confirmButtonText: "确定",
return cleanJobLog(); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("清空成功"); return cleanJobLog();
}) }).then(() => {
}, this.getList();
/** 导出按钮操作 */ this.msgSuccess("清空成功");
handleExport() { })
this.download('schedule/job/log/export', { },
...this.queryParams /** 导出按钮操作 */
}, `log_${new Date().getTime()}.xlsx`) handleExport() {
} this.download('schedule/job/log/export', {
} ...this.queryParams
}; }, `log_${new Date().getTime()}.xlsx`)
</script> }
}
};
</script>

@ -1,124 +1,128 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="70px">
<el-form-item label="登录地址" prop="ipaddr"> <el-form-item label="登录地址" prop="ipaddr">
<el-input <el-input
v-model="queryParams.ipaddr" v-model="queryParams.ipaddr"
placeholder="请输入登录地址" placeholder="请输入登录地址"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)" :data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
style="width: 100%;" style="width: 100%;"
> >
<el-table-column label="序号" type="index" align="center"> <el-table-column label="序号" type="index" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span> <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" /> <el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" /> <el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180"> <el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span> <span>{{ parseTime(scope.row.loginTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleForceLogout(scope.row)" @click="handleForceLogout(scope.row)"
v-hasPermi="['monitor:online:forceLogout']" v-hasPermi="['monitor:online:forceLogout']"
>强退</el-button> >强退</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" /> <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
</div> </div>
</template> </template>
<script> <script>
import { list, forceLogout } from "@/api/monitor/online"; import { list, forceLogout } from "@/api/monitor/online";
export default { export default {
name: "Online", name: "Online",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
total: 0, total: 0,
// //
list: [], list: [],
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// //
queryParams: { queryParams: {
ipaddr: undefined, ipaddr: undefined,
userName: undefined userName: undefined
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 查询登录日志列表 */ /** 查询登录日志列表 */
getList() { getList() {
this.loading = true; this.loading = true;
list(this.queryParams).then(response => { list(this.queryParams).then(response => {
this.list = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
}); }
}, this.list = response.rows;
/** 搜索按钮操作 */ this.total = response.total;
handleQuery() { this.loading = false;
this.pageNum = 1; });
this.getList(); },
}, /** 搜索按钮操作 */
/** 重置按钮操作 */ handleQuery() {
resetQuery() { this.pageNum = 1;
this.resetForm("queryForm"); this.getList();
this.handleQuery(); },
}, /** 重置按钮操作 */
/** 强退按钮操作 */ resetQuery() {
handleForceLogout(row) { this.resetForm("queryForm");
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", { this.handleQuery();
confirmButtonText: "确定", },
cancelButtonText: "取消", /** 强退按钮操作 */
type: "warning" handleForceLogout(row) {
}).then(function() { this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", {
return forceLogout(row.tokenId); confirmButtonText: "确定",
}).then(() => { cancelButtonText: "取消",
this.getList(); type: "warning"
this.msgSuccess("强退成功"); }).then(function() {
}).catch(() => {}); return forceLogout(row.tokenId);
} }).then(() => {
} this.getList();
}; this.msgSuccess("强退成功");
</script> }).catch(() => {});
}
}
};
</script>

@ -1,354 +1,399 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="参数名称" prop="configName"> <el-form-item label="参数名称" prop="configName">
<el-input <el-input
v-model="queryParams.configName" v-model="queryParams.configName"
placeholder="请输入参数名称" placeholder="请输入参数名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="参数键名" prop="configKey"> <el-form-item label="参数键名" prop="configKey">
<el-input <el-input
v-model="queryParams.configKey" v-model="queryParams.configKey"
placeholder="请输入参数键名" placeholder="请输入参数键名"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="系统内置" prop="configType"> <el-form-item label="系统内置" prop="configType">
<el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small"> <el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:config:add']" v-hasPermi="['system:config:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:config:edit']" v-hasPermi="['system:config:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:config:remove']" v-hasPermi="['system:config:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:config:export']" :loading="exportLoading"
>导出</el-button> v-hasPermi="['system:config:export']"
</el-col> >导出</el-button>
<el-col :span="1.5"> </el-col>
<el-button <el-col :span="1.5">
type="danger" <el-button
plain type="danger"
icon="el-icon-refresh" plain
size="mini" icon="el-icon-refresh"
@click="handleRefreshCache" size="mini"
v-hasPermi="['system:config:remove']" @click="handleRefreshCache"
>刷新缓存</el-button> :loading="refreshLoading"
</el-col> v-hasPermi="['system:config:remove']"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> >刷新缓存</el-button>
</el-row> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> </el-row>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="参数主键" align="center" prop="configId" /> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" /> <el-table-column label="参数主键" align="center" prop="configId" />
<el-table-column label="参数键值" align="center" prop="configValue" /> <el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
<el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" /> <el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="参数键值" align="center" prop="configValue" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" />
<template slot-scope="scope"> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<span>{{ parseTime(scope.row.createTime) }}</span> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
</template> <template slot-scope="scope">
</el-table-column> <span>{{ parseTime(scope.row.createTime) }}</span>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </template>
<template slot-scope="scope"> </el-table-column>
<el-button <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
size="mini" <template slot-scope="scope">
type="text" <el-button
icon="el-icon-edit" size="mini"
@click="handleUpdate(scope.row)" type="text"
v-hasPermi="['system:config:edit']" icon="el-icon-edit"
>修改</el-button> @click="handleUpdate(scope.row)"
<el-button v-hasPermi="['system:config:edit']"
size="mini" >修改</el-button>
type="text" <el-button
icon="el-icon-delete" size="mini"
@click="handleDelete(scope.row)" type="text"
v-hasPermi="['system:config:remove']" icon="el-icon-delete"
>删除</el-button> @click="handleDelete(scope.row)"
</template> v-hasPermi="['system:config:remove']"
</el-table-column> >删除</el-button>
</el-table> </template>
</el-table-column>
<pagination </el-table>
v-show="total>0"
:total="total" <pagination
:page.sync="queryParams.pageNum" v-show="total>0"
:limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" :page.sync="queryParams.pageNum"
/> :limit.sync="queryParams.pageSize"
@pagination="getList"
<!-- 添加或修改参数配置对话框 --> />
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <!-- 添加或修改参数配置对话框 -->
<el-form-item label="参数名称" prop="configName"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-input v-model="form.configName" placeholder="请输入参数名称" /> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
</el-form-item> <el-form-item label="参数名称" prop="configName">
<el-form-item label="参数键名" prop="configKey"> <el-input v-model="form.configName" placeholder="请输入参数名称" />
<el-input v-model="form.configKey" placeholder="请输入参数键名" /> </el-form-item>
</el-form-item> <el-form-item label="参数键名" prop="configKey">
<el-form-item label="参数键值" prop="configValue"> <el-input v-model="form.configKey" placeholder="请输入参数键名" />
<el-input v-model="form.configValue" placeholder="请输入参数键值" /> </el-form-item>
</el-form-item> <el-form-item label="参数键值" prop="configValue">
<el-form-item label="系统内置" prop="configType"> <el-input v-model="form.configValue" placeholder="请输入参数键值" />
<el-radio-group v-model="form.configType"> </el-form-item>
<el-radio <el-form-item label="系统内置" prop="configType">
v-for="dict in typeOptions" <el-radio-group v-model="form.configType">
:key="dict.dictValue" <el-radio
:label="dict.dictValue" v-for="dict in typeOptions"
>{{dict.dictLabel}}</el-radio> :key="dict.dictValue"
</el-radio-group> :label="dict.dictValue"
</el-form-item> >{{dict.dictLabel}}</el-radio>
<el-form-item label="备注" prop="remark"> </el-radio-group>
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> </el-form-item>
</el-form-item> <el-form-item label="备注" prop="remark">
</el-form> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<div slot="footer" class="dialog-footer"> </el-form-item>
<el-button type="primary" @click="submitForm"> </el-button> </el-form>
<el-button @click="cancel"> </el-button> <div slot="footer" class="dialog-footer">
</div> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
</el-dialog> <el-button @click="cancel"> </el-button>
</div> </div>
</template> </el-dialog>
</div>
<script> </template>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
<script>
export default { import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
name: "Config", import {delType} from "@/api/system/dict/type";
data() {
return { export default {
// name: "Config",
loading: true, data() {
// return {
ids: [], //
// loading: true,
single: true, //
// ids: [],
multiple: true, //
// single: true,
showSearch: true, //
// multiple: true,
total: 0, //
// showSearch: true,
configList: [], //
// total: 0,
title: "", //
// configList: [],
open: false, //
// title: "",
typeOptions: [], //
// open: false,
dateRange: [], //
// typeOptions: [],
queryParams: { //
pageNum: 1, dateRange: [],
pageSize: 10, //
configName: undefined, queryParams: {
configKey: undefined, pageNum: 1,
configType: undefined pageSize: 10,
}, configName: undefined,
// configKey: undefined,
form: {}, configType: undefined
// },
rules: { //
configName: [ form: {},
{ required: true, message: "参数名称不能为空", trigger: "blur" } //
], rules: {
configKey: [ configName: [
{ required: true, message: "参数键名不能为空", trigger: "blur" } { required: true, message: "参数名称不能为空", trigger: "blur" }
], ],
configValue: [ configKey: [
{ required: true, message: "参数键值不能为空", trigger: "blur" } { required: true, message: "参数键名不能为空", trigger: "blur" }
] ],
} configValue: [
}; { required: true, message: "参数键值不能为空", trigger: "blur" }
}, ]
created() { },
this.getList(); //
this.getDicts("sys_yes_no").then(response => { dialogLoading: false,
this.typeOptions = response.data; //
}); submitLoading: false,
}, //
methods: { exportLoading: false,
/** 查询参数列表 */ //
getList() { refreshLoading: false
this.loading = true; };
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { },
this.configList = response.rows; created() {
this.total = response.total; this.getList();
this.loading = false; this.getDicts("sys_yes_no").then(response => {
} this.typeOptions = response.data;
); });
}, },
// methods: {
typeFormat(row, column) { /** 查询参数列表 */
return this.selectDictLabel(this.typeOptions, row.configType); getList() {
}, this.loading = true;
// listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
cancel() { let currentPageNum = response.total / this.queryParams.pageSize;
this.open = false; if(this.queryParams.pageNum > currentPageNum){
this.reset(); this.queryParams.pageNum = currentPageNum;
}, }
// this.configList = response.rows;
reset() { this.total = response.total;
this.form = { this.loading = false;
configId: undefined, });
configName: undefined, },
configKey: undefined, //
configValue: undefined, typeFormat(row, column) {
configType: "Y", return this.selectDictLabel(this.typeOptions, row.configType);
remark: undefined },
}; //
this.resetForm("form"); cancel() {
}, this.open = false;
/** 搜索按钮操作 */ this.reset();
handleQuery() { },
this.queryParams.pageNum = 1; //
this.getList(); reset() {
}, this.form = {
/** 重置按钮操作 */ configId: undefined,
resetQuery() { configName: undefined,
this.dateRange = []; configKey: undefined,
this.resetForm("queryForm"); configValue: undefined,
this.handleQuery(); configType: "Y",
}, remark: undefined
/** 新增按钮操作 */ };
handleAdd() { this.resetForm("form");
this.reset(); },
this.open = true; /** 搜索按钮操作 */
this.title = "添加参数"; handleQuery() {
}, this.queryParams.pageNum = 1;
// this.getList();
handleSelectionChange(selection) { },
this.ids = selection.map(item => item.configId) /** 重置按钮操作 */
this.single = selection.length!=1 resetQuery() {
this.multiple = !selection.length this.dateRange = [];
}, this.resetForm("queryForm");
/** 修改按钮操作 */ this.handleQuery();
handleUpdate(row) { },
this.reset(); /** 新增按钮操作 */
const configId = row.configId || this.ids handleAdd() {
getConfig(configId).then(response => { this.reset();
this.form = response.data; this.title = "添加参数";
this.open = true; this.open = true;
this.title = "修改参数"; },
}); //
}, handleSelectionChange(selection) {
/** 提交按钮 */ this.ids = selection.map(item => item.configId)
submitForm: function() { this.single = selection.length!=1
this.$refs["form"].validate(valid => { this.multiple = !selection.length
if (valid) { },
if (this.form.configId != undefined) { /** 修改按钮操作 */
updateConfig(this.form).then(response => { handleUpdate(row) {
this.msgSuccess("修改成功"); this.reset();
this.open = false; const configId = row.configId || this.ids
this.getList(); this.title = "修改参数";
}); this.open = true;
} else { this.dialogLoading = true;
addConfig(this.form).then(response => { this.submitLoading = true;
this.msgSuccess("新增成功"); getConfig(configId).then(response => {
this.open = false; this.form = response.data;
this.getList(); }).finally(()=>{
}); this.dialogLoading = false;
} this.submitLoading = false;
} });
}); },
}, /** 提交按钮 */
/** 删除按钮操作 */ submitForm: function() {
handleDelete(row) { this.$refs["form"].validate(valid => {
const configIds = row.configId || this.ids; if (valid) {
this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', "警告", { this.submitLoading = true;
confirmButtonText: "确定", if (this.form.configId != undefined) {
cancelButtonText: "取消", updateConfig(this.form).then(response => {
type: "warning" this.msgSuccess("修改成功");
}).then(function() { this.open = false;
return delConfig(configIds); this.getList();
}).then(() => { }).finally(()=>{
this.getList(); this.submitLoading = false;
this.msgSuccess("删除成功"); });
}).catch(() => {}); } else {
}, addConfig(this.form).then(response => {
/** 导出按钮操作 */ this.msgSuccess("新增成功");
handleExport() { this.open = false;
this.download('system/config/export', { this.getList();
...this.queryParams }).finally(()=>{
}, `config_${new Date().getTime()}.xlsx`) this.submitLoading = false;
}, });
/** 刷新缓存按钮操作 */ }
handleRefreshCache() { }
refreshCache().then(() => { });
this.msgSuccess("刷新成功"); },
}); /** 删除按钮操作 */
} handleDelete(row) {
} const configIds = row.configId || this.ids;
}; this.$msgbox({
</script> title: '警告',
message: '是否确认删除参数编号为"' + configIds + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delConfig(configIds).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
},
/** 导出按钮操作 */
handleExport() {
this.exportLoading = true;
this.download('system/config/export', {
...this.queryParams
}, `config_${new Date().getTime()}.xlsx`).then(()=>{
}).finally(()=>{
this.exportLoading = false;
});
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
this.refreshLoading = true;
refreshCache().then(() => {
this.msgSuccess("刷新成功");
}).finally(()=>{
this.refreshLoading = false;
});
}
}
};
</script>

@ -1,317 +1,345 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
<el-form-item label="部门名称" prop="deptName"> <el-form-item label="部门名称" prop="deptName">
<el-input <el-input
v-model="queryParams.deptName" v-model="queryParams.deptName"
placeholder="请输入部门名称" placeholder="请输入部门名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="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 size="small"> <el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dept:add']" v-hasPermi="['system:dept:add']"
>新增</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 <el-table
v-loading="loading" v-loading="loading"
:data="deptList" :data="deptList"
row-key="deptId" row-key="deptId"
default-expand-all default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column> <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column> <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column> <el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200"> <el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dept:edit']" v-hasPermi="['system:dept:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['system:dept:add']" v-hasPermi="['system:dept:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
v-if="scope.row.parentId != 0" v-if="scope.row.parentId != 0"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:dept:remove']" v-hasPermi="['system:dept:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改部门对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="24" v-if="form.parentId !== 0"> <el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId"> <el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" /> <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="部门名称" prop="deptName"> <el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入部门名称" /> <el-input v-model="form.deptName" placeholder="请输入部门名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="显示排序" prop="orderNum"> <el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="负责人" prop="leader"> <el-form-item label="负责人" prop="leader">
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" /> <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="联系电话" prop="phone"> <el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" /> <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="部门状态"> <el-form-item label="部门状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
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>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/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";
import {changeUserStatus} from "@/api/system/user";
export default {
name: "Dept", export default {
components: { Treeselect }, name: "Dept",
data() { components: { Treeselect },
return { data() {
// return {
loading: true, //
// loading: true,
showSearch: true, //
// showSearch: true,
deptList: [], //
// deptList: [],
deptOptions: [], //
// deptOptions: [],
title: "", //
// title: "",
open: false, //
// open: false,
statusOptions: [], //
// statusOptions: [],
queryParams: { //
deptName: undefined, queryParams: {
status: undefined deptName: undefined,
}, status: undefined
// },
form: {}, //
// form: {},
rules: { //
parentId: [ rules: {
{ required: true, message: "上级部门不能为空", trigger: "blur" } parentId: [
], { required: true, message: "上级部门不能为空", trigger: "blur" }
deptName: [ ],
{ required: true, message: "部门名称不能为空", trigger: "blur" } deptName: [
], { required: true, message: "部门名称不能为空", trigger: "blur" }
orderNum: [ ],
{ required: true, message: "显示排序不能为空", trigger: "blur" } orderNum: [
], { required: true, message: "显示排序不能为空", trigger: "blur" }
email: [ ],
{ email: [
type: "email", {
message: "'请输入正确的邮箱地址", type: "email",
trigger: ["blur", "change"] message: "'请输入正确的邮箱地址",
} trigger: ["blur", "change"]
], }
phone: [ ],
{ phone: [
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, {
message: "请输入正确的手机号码", pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
trigger: "blur" message: "请输入正确的手机号码",
} trigger: "blur"
] }
} ]
}; },
}, //
created() { dialogLoading: false,
this.getList(); //
this.getDicts("sys_normal_disable").then(response => { submitLoading: false,
this.statusOptions = response.data; };
}); },
}, created() {
methods: { this.getList();
/** 查询部门列表 */ this.getDicts("sys_normal_disable").then(response => {
getList() { this.statusOptions = response.data;
this.loading = true; });
listDept(this.queryParams).then(response => { },
this.deptList = this.handleTree(response.data, "deptId"); methods: {
this.loading = false; /** 查询部门列表 */
}); getList() {
}, this.loading = true;
/** 转换部门数据结构 */ listDept(this.queryParams).then(response => {
normalizer(node) { this.deptList = this.handleTree(response.data, "deptId");
if (node.children && !node.children.length) { this.loading = false;
delete node.children; });
} },
return { /** 转换部门数据结构 */
id: node.deptId, normalizer(node) {
label: node.deptName, if (node.children && !node.children.length) {
children: node.children delete node.children;
}; }
}, return {
// id: node.deptId,
statusFormat(row, column) { label: node.deptName,
return this.selectDictLabel(this.statusOptions, row.status); children: node.children
}, };
// },
cancel() { //
this.open = false; statusFormat(row, column) {
this.reset(); return this.selectDictLabel(this.statusOptions, row.status);
}, },
// //
reset() { cancel() {
this.form = { this.open = false;
deptId: undefined, this.reset();
parentId: undefined, },
deptName: undefined, //
orderNum: undefined, reset() {
leader: undefined, this.form = {
phone: undefined, deptId: undefined,
email: undefined, parentId: undefined,
status: "0" deptName: undefined,
}; orderNum: undefined,
this.resetForm("form"); leader: undefined,
}, phone: undefined,
/** 搜索按钮操作 */ email: undefined,
handleQuery() { status: "0"
this.getList(); };
}, this.resetForm("form");
/** 重置按钮操作 */ },
resetQuery() { /** 搜索按钮操作 */
this.resetForm("queryForm"); handleQuery() {
this.handleQuery(); this.getList();
}, },
/** 新增按钮操作 */ /** 重置按钮操作 */
handleAdd(row) { resetQuery() {
this.reset(); this.resetForm("queryForm");
if (row != undefined) { this.handleQuery();
this.form.parentId = row.deptId; },
} /** 新增按钮操作 */
this.open = true; handleAdd(row) {
this.title = "添加部门"; this.reset();
listDept().then(response => { if (row != undefined) {
this.deptOptions = this.handleTree(response.data, "deptId"); this.form.parentId = row.deptId;
}); }
}, this.title = "添加部门";
/** 修改按钮操作 */ this.open = true;
handleUpdate(row) { listDept().then(response => {
this.reset(); this.deptOptions = this.handleTree(response.data, "deptId");
getDept(row.deptId).then(response => { });
this.form = response.data; },
this.open = true; /** 修改按钮操作 */
this.title = "修改部门"; handleUpdate(row) {
}); this.reset();
listDeptExcludeChild(row.deptId).then(response => { this.title = "修改部门";
this.deptOptions = this.handleTree(response.data, "deptId"); this.open = true;
}); this.dialogLoading = true;
}, this.submitLoading = true;
/** 提交按钮 */ listDeptExcludeChild(row.deptId).then(response => {
submitForm: function() { this.deptOptions = this.handleTree(response.data, "deptId");
this.$refs["form"].validate(valid => { });
if (valid) { getDept(row.deptId).then(response => {
if (this.form.deptId != undefined) { this.form = response.data;
updateDept(this.form).then(response => { }).finally(()=>{
this.msgSuccess("修改成功"); this.dialogLoading = false;
this.open = false; this.submitLoading = false;
this.getList(); });
}); },
} else { /** 提交按钮 */
addDept(this.form).then(response => { submitForm: function() {
this.msgSuccess("新增成功"); this.$refs["form"].validate(valid => {
this.open = false; if (valid) {
this.getList(); this.submitLoading = true;
}); if (this.form.deptId != undefined) {
} updateDept(this.form).then(response => {
} this.msgSuccess("修改成功");
}); this.open = false;
}, this.getList();
/** 删除按钮操作 */ }).finally(()=>{
handleDelete(row) { this.submitLoading = false;
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", { });
confirmButtonText: "确定", } else {
cancelButtonText: "取消", addDept(this.form).then(response => {
type: "warning" this.msgSuccess("新增成功");
}).then(function() { this.open = false;
return delDept(row.deptId); this.getList();
}).then(() => { }).finally(()=>{
this.getList(); this.submitLoading = false;
this.msgSuccess("删除成功"); });
}).catch(() => {}); }
} }
} });
}; },
</script> /** 删除按钮操作 */
handleDelete(row) {
this.$msgbox({
title: '警告',
message: '是否确认删除名称为"' + row.deptName + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delDept(row.deptId).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
}
}
};
</script>

@ -1,394 +1,398 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="字典名称" prop="dictType"> <el-form-item label="字典名称" prop="dictType">
<el-select v-model="queryParams.dictType" size="small"> <el-select v-model="queryParams.dictType" size="small">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
:key="item.dictId" :key="item.dictId"
:label="item.dictName" :label="item.dictName"
:value="item.dictType" :value="item.dictType"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字典标签" prop="dictLabel"> <el-form-item label="字典标签" prop="dictLabel">
<el-input <el-input
v-model="queryParams.dictLabel" v-model="queryParams.dictLabel"
placeholder="请输入字典标签" placeholder="请输入字典标签"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="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 size="small"> <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dict:add']" v-hasPermi="['system:dict:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</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="dataList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="dataList" @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="dictCode" /> <el-table-column label="字典编码" align="center" prop="dictCode" />
<el-table-column label="字典标签" align="center" prop="dictLabel"> <el-table-column label="字典标签" align="center" prop="dictLabel">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span> <span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span>
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag> <el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="字典键值" align="center" prop="dictValue" /> <el-table-column label="字典键值" align="center" prop="dictValue" />
<el-table-column label="字典排序" align="center" prop="dictSort" /> <el-table-column label="字典排序" align="center" prop="dictSort" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="statusOptions" :value="scope.row.status"/> <dict-tag :options="statusOptions" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典类型"> <el-form-item label="字典类型">
<el-input v-model="form.dictType" :disabled="true" /> <el-input v-model="form.dictType" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="数据标签" prop="dictLabel"> <el-form-item label="数据标签" prop="dictLabel">
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" /> <el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
</el-form-item> </el-form-item>
<el-form-item label="数据键值" prop="dictValue"> <el-form-item label="数据键值" prop="dictValue">
<el-input v-model="form.dictValue" placeholder="请输入数据键值" /> <el-input v-model="form.dictValue" placeholder="请输入数据键值" />
</el-form-item> </el-form-item>
<el-form-item label="样式属性" prop="cssClass"> <el-form-item label="样式属性" prop="cssClass">
<el-input v-model="form.cssClass" placeholder="请输入样式属性" /> <el-input v-model="form.cssClass" placeholder="请输入样式属性" />
</el-form-item> </el-form-item>
<el-form-item label="显示排序" prop="dictSort"> <el-form-item label="显示排序" prop="dictSort">
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> <el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
</el-form-item> </el-form-item>
<el-form-item label="回显样式" prop="listClass"> <el-form-item label="回显样式" prop="listClass">
<el-select v-model="form.listClass"> <el-select v-model="form.listClass">
<el-option <el-option
v-for="item in listClassOptions" v-for="item in listClassOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
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-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
import { listType, getType } from "@/api/system/dict/type"; import { listType, getType } from "@/api/system/dict/type";
export default { export default {
name: "Data", name: "Data",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
dataList: [], dataList: [],
// //
defaultDictType: "", defaultDictType: "",
// //
title: "", title: "",
// //
open: false, open: false,
// //
listClassOptions: [ listClassOptions: [
{ {
value: "default", value: "default",
label: "默认" label: "默认"
}, },
{ {
value: "primary", value: "primary",
label: "主要" label: "主要"
}, },
{ {
value: "success", value: "success",
label: "成功" label: "成功"
}, },
{ {
value: "info", value: "info",
label: "信息" label: "信息"
}, },
{ {
value: "warning", value: "warning",
label: "警告" label: "警告"
}, },
{ {
value: "danger", value: "danger",
label: "危险" label: "危险"
} }
], ],
// //
statusOptions: [], statusOptions: [],
// //
typeOptions: [], typeOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
dictLabel: [ dictLabel: [
{ required: true, message: "数据标签不能为空", trigger: "blur" } { required: true, message: "数据标签不能为空", trigger: "blur" }
], ],
dictValue: [ dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" } { required: true, message: "数据键值不能为空", trigger: "blur" }
], ],
dictSort: [ dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" } { required: true, message: "数据顺序不能为空", trigger: "blur" }
] ]
} }
}; };
}, },
created() { created() {
const dictId = this.$route.params && this.$route.params.dictId; const dictId = this.$route.params && this.$route.params.dictId;
this.getType(dictId); this.getType(dictId);
this.getTypeList(); this.getTypeList();
this.getDicts("sys_normal_disable").then(response => { this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
}, },
methods: { methods: {
/** 查询字典类型详细 */ /** 查询字典类型详细 */
getType(dictId) { getType(dictId) {
getType(dictId).then(response => { getType(dictId).then(response => {
this.queryParams.dictType = response.data.dictType; this.queryParams.dictType = response.data.dictType;
this.defaultDictType = response.data.dictType; this.defaultDictType = response.data.dictType;
this.getList(); this.getList();
}); });
}, },
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getTypeList() { getTypeList() {
listType().then(response => { listType().then(response => {
this.typeOptions = response.rows; this.typeOptions = response.rows;
}); });
}, },
/** 查询字典数据列表 */ /** 查询字典数据列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listData(this.queryParams).then(response => { listData(this.queryParams).then(response => {
this.dataList = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
}); }
}, this.dataList = response.rows;
// this.total = response.total;
cancel() { this.loading = false;
this.open = false; });
this.reset(); },
}, //
// cancel() {
reset() { this.open = false;
this.form = { this.reset();
dictCode: undefined, },
dictLabel: undefined, //
dictValue: undefined, reset() {
cssClass: undefined, this.form = {
listClass: 'default', dictCode: undefined,
dictSort: 0, dictLabel: undefined,
status: "0", dictValue: undefined,
remark: undefined cssClass: undefined,
}; listClass: 'default',
this.resetForm("form"); dictSort: 0,
}, status: "0",
/** 搜索按钮操作 */ remark: undefined
handleQuery() { };
this.queryParams.pageNum = 1; this.resetForm("form");
this.getList(); },
}, /** 搜索按钮操作 */
/** 重置按钮操作 */ handleQuery() {
resetQuery() { this.queryParams.pageNum = 1;
this.resetForm("queryForm"); this.getList();
this.queryParams.dictType = this.defaultDictType; },
this.handleQuery(); /** 重置按钮操作 */
}, resetQuery() {
/** 新增按钮操作 */ this.resetForm("queryForm");
handleAdd() { this.queryParams.dictType = this.defaultDictType;
this.reset(); this.handleQuery();
this.open = true; },
this.title = "添加字典数据"; /** 新增按钮操作 */
this.form.dictType = this.queryParams.dictType; handleAdd() {
}, this.reset();
// this.open = true;
handleSelectionChange(selection) { this.title = "添加字典数据";
this.ids = selection.map(item => item.dictCode) this.form.dictType = this.queryParams.dictType;
this.single = selection.length!=1 },
this.multiple = !selection.length //
}, handleSelectionChange(selection) {
/** 修改按钮操作 */ this.ids = selection.map(item => item.dictCode)
handleUpdate(row) { this.single = selection.length!=1
this.reset(); this.multiple = !selection.length
const dictCode = row.dictCode || this.ids },
getData(dictCode).then(response => { /** 修改按钮操作 */
this.form = response.data; handleUpdate(row) {
this.open = true; this.reset();
this.title = "修改字典数据"; const dictCode = row.dictCode || this.ids
}); getData(dictCode).then(response => {
}, this.form = response.data;
/** 提交按钮 */ this.open = true;
submitForm: function() { this.title = "修改字典数据";
this.$refs["form"].validate(valid => { });
if (valid) { },
if (this.form.dictCode != undefined) { /** 提交按钮 */
updateData(this.form).then(response => { submitForm: function() {
this.msgSuccess("修改成功"); this.$refs["form"].validate(valid => {
this.open = false; if (valid) {
this.getList(); if (this.form.dictCode != undefined) {
}); updateData(this.form).then(response => {
} else { this.msgSuccess("修改成功");
addData(this.form).then(response => { this.open = false;
this.msgSuccess("新增成功"); this.getList();
this.open = false; });
this.getList(); } else {
}); addData(this.form).then(response => {
} this.msgSuccess("新增成功");
} this.open = false;
}); this.getList();
}, });
/** 删除按钮操作 */ }
handleDelete(row) { }
const dictCodes = row.dictCode || this.ids; });
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", { },
confirmButtonText: "确定", /** 删除按钮操作 */
cancelButtonText: "取消", handleDelete(row) {
type: "warning" const dictCodes = row.dictCode || this.ids;
}).then(function() { this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", {
return delData(dictCodes); confirmButtonText: "确定",
}).then(() => { cancelButtonText: "取消",
this.getList(); type: "warning"
this.msgSuccess("删除成功"); }).then(function() {
}).catch(() => {}); return delData(dictCodes);
}, }).then(() => {
/** 导出按钮操作 */ this.getList();
handleExport() { this.msgSuccess("删除成功");
this.download('system/dict/data/export', { }).catch(() => {});
...this.queryParams },
}, `data_${new Date().getTime()}.xlsx`) /** 导出按钮操作 */
} handleExport() {
} this.download('system/dict/data/export', {
}; ...this.queryParams
</script> }, `data_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -1,358 +1,403 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="字典名称" prop="dictName"> <el-form-item label="字典名称" prop="dictName">
<el-input <el-input
v-model="queryParams.dictName" v-model="queryParams.dictName"
placeholder="请输入字典名称" placeholder="请输入字典名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="字典类型" prop="dictType"> <el-form-item label="字典类型" prop="dictType">
<el-input <el-input
v-model="queryParams.dictType" v-model="queryParams.dictType"
placeholder="请输入字典类型" placeholder="请输入字典类型"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="字典状态" placeholder="字典状态"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dict:add']" v-hasPermi="['system:dict:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" :loading="exportLoading"
>导出</el-button> v-hasPermi="['system:dict:export']"
</el-col> >导出</el-button>
<el-col :span="1.5"> </el-col>
<el-button <el-col :span="1.5">
type="danger" <el-button
plain type="danger"
icon="el-icon-refresh" plain
size="mini" icon="el-icon-refresh"
@click="handleRefreshCache" size="mini"
v-hasPermi="['system:dict:remove']" @click="handleRefreshCache"
>刷新缓存</el-button> :loading="refreshLoading"
</el-col> v-hasPermi="['system:dict:remove']"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> >刷新缓存</el-button>
</el-row> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> </el-row>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" /> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true"> <el-table-column label="字典编号" align="center" prop="dictId" />
<template slot-scope="scope"> <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
<router-link :to="'/dict/type/data/' + scope.row.dictId" class="link-type"> <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<span>{{ scope.row.dictType }}</span> <template slot-scope="scope">
</router-link> <router-link :to="'/dict/type/data/' + scope.row.dictId" class="link-type">
</template> <span>{{ scope.row.dictType }}</span>
</el-table-column> </router-link>
<el-table-column label="状态" align="center" prop="status"> </template>
<template slot-scope="scope"> </el-table-column>
<dict-tag :options="statusOptions" :value="scope.row.status"/> <el-table-column label="状态" align="center" prop="status">
</template> <template slot-scope="scope">
</el-table-column> <dict-tag :options="statusOptions" :value="scope.row.status"/>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> </template>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<span>{{ parseTime(scope.row.createTime) }}</span> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
</template> <template slot-scope="scope">
</el-table-column> <span>{{ parseTime(scope.row.createTime) }}</span>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </template>
<template slot-scope="scope"> </el-table-column>
<el-button <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
size="mini" <template slot-scope="scope">
type="text" <el-button
icon="el-icon-edit" size="mini"
@click="handleUpdate(scope.row)" type="text"
v-hasPermi="['system:dict:edit']" icon="el-icon-edit"
>修改</el-button> @click="handleUpdate(scope.row)"
<el-button v-hasPermi="['system:dict:edit']"
size="mini" >修改</el-button>
type="text" <el-button
icon="el-icon-delete" size="mini"
@click="handleDelete(scope.row)" type="text"
v-hasPermi="['system:dict:remove']" icon="el-icon-delete"
>删除</el-button> @click="handleDelete(scope.row)"
</template> v-hasPermi="['system:dict:remove']"
</el-table-column> >删除</el-button>
</el-table> </template>
</el-table-column>
<pagination </el-table>
v-show="total>0"
:total="total" <pagination
:page.sync="queryParams.pageNum" v-show="total>0"
:limit.sync="queryParams.pageSize" :total="total"
@pagination="getList" :page.sync="queryParams.pageNum"
/> :limit.sync="queryParams.pageSize"
@pagination="getList"
<!-- 添加或修改参数配置对话框 --> />
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <!-- 添加或修改参数配置对话框 -->
<el-form-item label="字典名称" prop="dictName"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-input v-model="form.dictName" placeholder="请输入字典名称" /> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
</el-form-item> <el-form-item label="字典名称" prop="dictName">
<el-form-item label="字典类型" prop="dictType"> <el-input v-model="form.dictName" placeholder="请输入字典名称" />
<el-input v-model="form.dictType" placeholder="请输入字典类型" /> </el-form-item>
</el-form-item> <el-form-item label="字典类型" prop="dictType">
<el-form-item label="状态" prop="status"> <el-input v-model="form.dictType" placeholder="请输入字典类型" />
<el-radio-group v-model="form.status"> </el-form-item>
<el-radio <el-form-item label="状态" prop="status">
v-for="dict in statusOptions" <el-radio-group v-model="form.status">
:key="dict.dictValue" <el-radio
:label="dict.dictValue" v-for="dict in statusOptions"
>{{dict.dictLabel}}</el-radio> :key="dict.dictValue"
</el-radio-group> :label="dict.dictValue"
</el-form-item> >{{dict.dictLabel}}</el-radio>
<el-form-item label="备注" prop="remark"> </el-radio-group>
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> </el-form-item>
</el-form-item> <el-form-item label="备注" prop="remark">
</el-form> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
<div slot="footer" class="dialog-footer"> </el-form-item>
<el-button type="primary" @click="submitForm"> </el-button> </el-form>
<el-button @click="cancel"> </el-button> <div slot="footer" class="dialog-footer">
</div> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
</el-dialog> <el-button @click="cancel"> </el-button>
</div> </div>
</template> </el-dialog>
</div>
<script> </template>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
<script>
export default { import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
name: "Dict", import {delPost} from "@/api/system/post";
data() {
return { export default {
// name: "Dict",
loading: true, data() {
// return {
ids: [], //
// loading: true,
single: true, //
// ids: [],
multiple: true, //
// single: true,
showSearch: true, //
// multiple: true,
total: 0, //
// showSearch: true,
typeList: [], //
// total: 0,
title: "", //
// typeList: [],
open: false, //
// title: "",
statusOptions: [], //
// open: false,
dateRange: [], //
// statusOptions: [],
queryParams: { //
pageNum: 1, dateRange: [],
pageSize: 10, //
dictName: undefined, queryParams: {
dictType: undefined, pageNum: 1,
status: undefined pageSize: 10,
}, dictName: undefined,
// dictType: undefined,
form: {}, status: undefined
// },
rules: { //
dictName: [ form: {},
{ required: true, message: "字典名称不能为空", trigger: "blur" } //
], rules: {
dictType: [ dictName: [
{ required: true, message: "字典类型不能为空", trigger: "blur" } { required: true, message: "字典名称不能为空", trigger: "blur" }
] ],
} dictType: [
}; { required: true, message: "字典类型不能为空", trigger: "blur" }
}, ]
created() { },
this.getList(); //
this.getDicts("sys_normal_disable").then(response => { dialogLoading: false,
this.statusOptions = response.data; //
}); submitLoading: false,
}, //
methods: { exportLoading: false,
/** 查询字典类型列表 */ //
getList() { refreshLoading: false
this.loading = true; };
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { },
this.typeList = response.rows; created() {
this.total = response.total; this.getList();
this.loading = false; this.getDicts("sys_normal_disable").then(response => {
} this.statusOptions = response.data;
); });
}, },
// methods: {
cancel() { /** 查询字典类型列表 */
this.open = false; getList() {
this.reset(); this.loading = true;
}, listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
// let currentPageNum = response.total / this.queryParams.pageSize;
reset() { if(this.queryParams.pageNum > currentPageNum){
this.form = { this.queryParams.pageNum = currentPageNum;
dictId: undefined, }
dictName: undefined, this.typeList = response.rows;
dictType: undefined, this.total = response.total;
status: "0", this.loading = false;
remark: undefined });
}; },
this.resetForm("form"); //
}, cancel() {
/** 搜索按钮操作 */ this.open = false;
handleQuery() { this.reset();
this.queryParams.pageNum = 1; },
this.getList(); //
}, reset() {
/** 重置按钮操作 */ this.form = {
resetQuery() { dictId: undefined,
this.dateRange = []; dictName: undefined,
this.resetForm("queryForm"); dictType: undefined,
this.handleQuery(); status: "0",
}, remark: undefined
/** 新增按钮操作 */ };
handleAdd() { this.resetForm("form");
this.reset(); },
this.open = true; /** 搜索按钮操作 */
this.title = "添加字典类型"; handleQuery() {
}, this.queryParams.pageNum = 1;
// this.getList();
handleSelectionChange(selection) { },
this.ids = selection.map(item => item.dictId) /** 重置按钮操作 */
this.single = selection.length!=1 resetQuery() {
this.multiple = !selection.length this.dateRange = [];
}, this.resetForm("queryForm");
/** 修改按钮操作 */ this.handleQuery();
handleUpdate(row) { },
this.reset(); /** 新增按钮操作 */
const dictId = row.dictId || this.ids handleAdd() {
getType(dictId).then(response => { this.reset();
this.form = response.data; this.title = "添加字典类型";
this.open = true; this.open = true;
this.title = "修改字典类型"; },
}); //
}, handleSelectionChange(selection) {
/** 提交按钮 */ this.ids = selection.map(item => item.dictId)
submitForm: function() { this.single = selection.length!=1
this.$refs["form"].validate(valid => { this.multiple = !selection.length
if (valid) { },
if (this.form.dictId != undefined) { /** 修改按钮操作 */
updateType(this.form).then(response => { handleUpdate(row) {
this.msgSuccess("修改成功"); this.reset();
this.open = false; const dictId = row.dictId || this.ids
this.getList(); this.title = "修改字典类型";
}); this.open = true;
} else { this.dialogLoading = true;
addType(this.form).then(response => { this.submitLoading = true;
this.msgSuccess("新增成功"); getType(dictId).then(response => {
this.open = false; this.form = response.data;
this.getList(); }).finally(()=>{
}); this.dialogLoading = false;
} this.submitLoading = false;
} });
}); },
}, /** 提交按钮 */
/** 删除按钮操作 */ submitForm: function() {
handleDelete(row) { this.$refs["form"].validate(valid => {
const dictIds = row.dictId || this.ids; if (valid) {
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", { this.submitLoading = true;
confirmButtonText: "确定", if (this.form.dictId != undefined) {
cancelButtonText: "取消", updateType(this.form).then(response => {
type: "warning" this.msgSuccess("修改成功");
}).then(function() { this.open = false;
return delType(dictIds); this.getList();
}).then(() => { }).finally(()=>{
this.getList(); this.submitLoading = false;
this.msgSuccess("删除成功"); });
}).catch(() => {}); } else {
}, addType(this.form).then(response => {
/** 导出按钮操作 */ this.msgSuccess("新增成功");
handleExport() { this.open = false;
this.download('system/dict/type/export', { this.getList();
...this.queryParams }).finally(()=>{
}, `type_${new Date().getTime()}.xlsx`) this.submitLoading = false;
}, });
/** 刷新缓存按钮操作 */ }
handleRefreshCache() { }
refreshCache().then(() => { });
this.msgSuccess("刷新成功"); },
}); /** 删除按钮操作 */
} handleDelete(row) {
} const dictIds = row.dictId || this.ids;
}; this.$msgbox({
</script> title: '警告',
message: '是否确认删除字典编号为"' + dictIds + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delType(dictIds).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
},
/** 导出按钮操作 */
handleExport() {
this.exportLoading = true;
this.download('system/dict/type/export', {
...this.queryParams
}, `type_${new Date().getTime()}.xlsx`).then(()=>{
}).finally(()=>{
this.exportLoading = false;
});
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
this.refreshLoading = true;
refreshCache().then(() => {
this.msgSuccess("刷新成功");
}).finally(()=>{
this.refreshLoading = false;
});
}
}
};
</script>

@ -1,232 +1,235 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="登录地址" prop="ipaddr"> <el-form-item label="登录地址" prop="ipaddr">
<el-input <el-input
v-model="queryParams.ipaddr" v-model="queryParams.ipaddr"
placeholder="请输入登录地址" placeholder="请输入登录地址"
clearable clearable
style="width: 240px;" style="width: 240px;"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
style="width: 240px;" style="width: 240px;"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="登录状态" placeholder="登录状态"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="登录时间"> <el-form-item label="登录时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:logininfor:remove']" v-hasPermi="['system:logininfor:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
@click="handleClean" @click="handleClean"
v-hasPermi="['system:logininfor:remove']" v-hasPermi="['system:logininfor:remove']"
>清空</el-button> >清空</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:logininfor:export']" v-hasPermi="['system:logininfor:export']"
>导出</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 ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<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="infoId" /> <el-table-column label="访问编号" align="center" prop="infoId" />
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" /> <el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
<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="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="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> <el-table-column label="访问时间" align="center" prop="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.accessTime) }}</span> <span>{{ parseTime(scope.row.accessTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
</template> </template>
<script> <script>
import { list, delLogininfor, cleanLogininfor } from "@/api/system/logininfor"; import { list, delLogininfor, cleanLogininfor } from "@/api/system/logininfor";
export default { export default {
name: "Logininfor", name: "Logininfor",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
statusOptions: [], statusOptions: [],
// //
dateRange: [], dateRange: [],
// //
defaultSort: {prop: 'loginTime', order: 'descending'}, defaultSort: {prop: 'loginTime', order: 'descending'},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
ipaddr: undefined, ipaddr: undefined,
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;
}); });
}, },
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.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
} }
); this.list = response.rows;
}, this.total = response.total;
// this.loading = false;
statusFormat(row, column) { });
return this.selectDictLabel(this.statusOptions, row.status); },
}, //
/** 搜索按钮操作 */ statusFormat(row, column) {
handleQuery() { return this.selectDictLabel(this.statusOptions, row.status);
this.queryParams.pageNum = 1; },
this.getList(); /** 搜索按钮操作 */
}, handleQuery() {
/** 重置按钮操作 */ this.queryParams.pageNum = 1;
resetQuery() { this.getList();
this.dateRange = []; },
this.resetForm("queryForm"); /** 重置按钮操作 */
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) resetQuery() {
this.handleQuery(); this.dateRange = [];
}, this.resetForm("queryForm");
/** 多选框选中数据 */ this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
handleSelectionChange(selection) { this.handleQuery();
this.ids = selection.map(item => item.infoId) },
this.multiple = !selection.length /** 多选框选中数据 */
}, handleSelectionChange(selection) {
/** 排序触发事件 */ this.ids = selection.map(item => item.infoId)
handleSortChange(column, prop, order) { this.multiple = !selection.length
this.queryParams.orderByColumn = column.prop; },
this.queryParams.isAsc = column.order; /** 排序触发事件 */
this.getList(); handleSortChange(column, prop, order) {
}, this.queryParams.orderByColumn = column.prop;
/** 删除按钮操作 */ this.queryParams.isAsc = column.order;
handleDelete(row) { this.getList();
const infoIds = row.infoId || this.ids; },
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", { /** 删除按钮操作 */
confirmButtonText: "确定", handleDelete(row) {
cancelButtonText: "取消", const infoIds = row.infoId || this.ids;
type: "warning" this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", {
}).then(function() { confirmButtonText: "确定",
return delLogininfor(infoIds); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("删除成功"); return delLogininfor(infoIds);
}).catch(() => {}); }).then(() => {
}, this.getList();
/** 清空按钮操作 */ this.msgSuccess("删除成功");
handleClean() { }).catch(() => {});
this.$confirm('是否确认清空所有登录日志数据项?', "警告", { },
confirmButtonText: "确定", /** 清空按钮操作 */
cancelButtonText: "取消", handleClean() {
type: "warning" this.$confirm('是否确认清空所有登录日志数据项?', "警告", {
}).then(function() { confirmButtonText: "确定",
return cleanLogininfor(); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("清空成功"); return cleanLogininfor();
}).catch(() => {}); }).then(() => {
}, this.getList();
/** 导出按钮操作 */ this.msgSuccess("清空成功");
handleExport() { }).catch(() => {});
this.download('system/logininfor/export', { },
...this.queryParams /** 导出按钮操作 */
}, `logininfor_${new Date().getTime()}.xlsx`) handleExport() {
} this.download('system/logininfor/export', {
} ...this.queryParams
}; }, `logininfor_${new Date().getTime()}.xlsx`)
</script> }
}
};
</script>

@ -1,400 +1,428 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
<el-form-item label="菜单名称" prop="menuName"> <el-form-item label="菜单名称" prop="menuName">
<el-input <el-input
v-model="queryParams.menuName" v-model="queryParams.menuName"
placeholder="请输入菜单名称" placeholder="请输入菜单名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="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 size="small"> <el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:menu:add']" v-hasPermi="['system:menu:add']"
>新增</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 <el-table
v-loading="loading" v-loading="loading"
:data="menuList" :data="menuList"
row-key="menuId" row-key="menuId"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column> <el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
<el-table-column prop="icon" label="图标" align="center" width="100"> <el-table-column prop="icon" label="图标" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon" /> <svg-icon :icon-class="scope.row.icon" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column> <el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column> <el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime"> <el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:menu:edit']" v-hasPermi="['system:menu:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['system:menu:add']" v-hasPermi="['system:menu:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:menu:remove']" v-hasPermi="['system:menu:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改菜单对话框 --> <!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="上级菜单"> <el-form-item label="上级菜单">
<treeselect <treeselect
v-model="form.parentId" v-model="form.parentId"
:options="menuOptions" :options="menuOptions"
:normalizer="normalizer" :normalizer="normalizer"
:show-count="true" :show-count="true"
placeholder="选择上级菜单" placeholder="选择上级菜单"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="菜单类型" prop="menuType"> <el-form-item label="菜单类型" prop="menuType">
<el-radio-group v-model="form.menuType"> <el-radio-group v-model="form.menuType">
<el-radio label="M">目录</el-radio> <el-radio label="M">目录</el-radio>
<el-radio label="C">菜单</el-radio> <el-radio label="C">菜单</el-radio>
<el-radio label="F">按钮</el-radio> <el-radio label="F">按钮</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item v-if="form.menuType != 'F'" label="菜单图标"> <el-form-item v-if="form.menuType != 'F'" label="菜单图标">
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
width="460" width="460"
trigger="click" trigger="click"
@show="$refs['iconSelect'].reset()" @show="$refs['iconSelect'].reset()"
> >
<IconSelect ref="iconSelect" @selected="selected" /> <IconSelect ref="iconSelect" @selected="selected" />
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly> <el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly>
<svg-icon <svg-icon
v-if="form.icon" v-if="form.icon"
slot="prefix" slot="prefix"
:icon-class="form.icon" :icon-class="form.icon"
class="el-input__icon" class="el-input__icon"
style="height: 32px;width: 16px;" style="height: 32px;width: 16px;"
/> />
<i v-else slot="prefix" class="el-icon-search el-input__icon" /> <i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input> </el-input>
</el-popover> </el-popover>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="菜单名称" prop="menuName"> <el-form-item label="菜单名称" prop="menuName">
<el-input v-model="form.menuName" placeholder="请输入菜单名称" /> <el-input v-model="form.menuName" placeholder="请输入菜单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="显示排序" prop="orderNum"> <el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'" label="是否外链"> <el-form-item v-if="form.menuType != 'F'" label="是否外链">
<el-radio-group v-model="form.isFrame"> <el-radio-group v-model="form.isFrame">
<el-radio label="0"></el-radio> <el-radio label="0"></el-radio>
<el-radio label="1"></el-radio> <el-radio label="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'" label="路由地址" prop="path"> <el-form-item v-if="form.menuType != 'F'" label="路由地址" prop="path">
<el-input v-model="form.path" placeholder="请输入路由地址" /> <el-input v-model="form.path" placeholder="请输入路由地址" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="form.menuType == 'C'"> <el-col :span="12" v-if="form.menuType == 'C'">
<el-form-item label="组件路径" prop="component"> <el-form-item label="组件路径" prop="component">
<el-input v-model="form.component" placeholder="请输入组件路径" /> <el-input v-model="form.component" placeholder="请输入组件路径" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'M'" label="权限标识"> <el-form-item v-if="form.menuType != 'M'" label="权限标识">
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" /> <el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'" label="显示状态"> <el-form-item v-if="form.menuType != 'F'" label="显示状态">
<el-radio-group v-model="form.visible"> <el-radio-group v-model="form.visible">
<el-radio <el-radio
v-for="dict in visibleOptions" v-for="dict in visibleOptions"
: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>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'" label="菜单状态"> <el-form-item v-if="form.menuType != 'F'" label="菜单状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
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>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType == 'C'" label="是否缓存"> <el-form-item v-if="form.menuType == 'C'" label="是否缓存">
<el-radio-group v-model="form.isCache"> <el-radio-group v-model="form.isCache">
<el-radio label="0">缓存</el-radio> <el-radio label="0">缓存</el-radio>
<el-radio label="1">不缓存</el-radio> <el-radio label="1">不缓存</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"; import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu";
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";
import IconSelect from "@/components/IconSelect"; import IconSelect from "@/components/IconSelect";
import {authUserCancelAll} from "@/api/system/role";
export default {
name: "Menu", export default {
components: { Treeselect, IconSelect }, name: "Menu",
data() { components: { Treeselect, IconSelect },
return { data() {
// return {
loading: true, //
// loading: true,
showSearch: true, //
// showSearch: true,
menuList: [], //
// menuList: [],
menuOptions: [], //
// menuOptions: [],
title: "", //
// title: "",
open: false, //
// open: false,
visibleOptions: [], //
// visibleOptions: [],
statusOptions: [], //
// statusOptions: [],
queryParams: { //
menuName: undefined, queryParams: {
visible: undefined menuName: undefined,
}, visible: undefined
// },
form: {}, //
// form: {},
rules: { //
menuName: [ rules: {
{ required: true, message: "菜单名称不能为空", trigger: "blur" } menuName: [
], { required: true, message: "菜单名称不能为空", trigger: "blur" }
orderNum: [ ],
{ required: true, message: "菜单顺序不能为空", trigger: "blur" } orderNum: [
], { required: true, message: "菜单顺序不能为空", trigger: "blur" }
path: [ ],
{ required: true, message: "路由地址不能为空", trigger: "blur" } path: [
] { required: true, message: "路由地址不能为空", trigger: "blur" }
} ]
}; },
}, //
created() { dialogLoading: false,
this.getList(); //
this.getDicts("sys_show_hide").then(response => { submitLoading: false,
this.visibleOptions = response.data; };
}); },
this.getDicts("sys_normal_disable").then(response => { created() {
this.statusOptions = response.data; this.getList();
}); this.getDicts("sys_show_hide").then(response => {
}, this.visibleOptions = response.data;
methods: { });
// this.getDicts("sys_normal_disable").then(response => {
selected(name) { this.statusOptions = response.data;
this.form.icon = name; });
}, },
/** 查询菜单列表 */ methods: {
getList() { //
this.loading = true; selected(name) {
listMenu(this.queryParams).then(response => { this.form.icon = name;
this.menuList = this.handleTree(response.data, "menuId"); },
this.loading = false; /** 查询菜单列表 */
}); getList() {
}, this.loading = true;
/** 转换菜单数据结构 */ listMenu(this.queryParams).then(response => {
normalizer(node) { this.menuList = this.handleTree(response.data, "menuId");
if (node.children && !node.children.length) { this.loading = false;
delete node.children; });
} },
return { /** 转换菜单数据结构 */
id: node.menuId, normalizer(node) {
label: node.menuName, if (node.children && !node.children.length) {
children: node.children delete node.children;
}; }
}, return {
/** 查询菜单下拉树结构 */ id: node.menuId,
getTreeselect() { label: node.menuName,
listMenu().then(response => { children: node.children
this.menuOptions = []; };
const menu = { menuId: 0, menuName: '主类目', children: [] }; },
menu.children = this.handleTree(response.data, "menuId"); /** 查询菜单下拉树结构 */
this.menuOptions.push(menu); getTreeselect() {
}); listMenu().then(response => {
}, this.menuOptions = [];
// const menu = { menuId: 0, menuName: '主类目', children: [] };
visibleFormat(row, column) { menu.children = this.handleTree(response.data, "menuId");
if (row.menuType == "F") { this.menuOptions.push(menu);
return ""; });
} },
return this.selectDictLabel(this.visibleOptions, row.visible); //
}, visibleFormat(row, column) {
// if (row.menuType == "F") {
statusFormat(row, column) { return "";
if (row.menuType == "F") { }
return ""; return this.selectDictLabel(this.visibleOptions, row.visible);
} },
return this.selectDictLabel(this.statusOptions, row.status); //
}, statusFormat(row, column) {
// if (row.menuType == "F") {
cancel() { return "";
this.open = false; }
this.reset(); return this.selectDictLabel(this.statusOptions, row.status);
}, },
// //
reset() { cancel() {
this.form = { this.open = false;
menuId: undefined, this.reset();
parentId: 0, },
menuName: undefined, //
icon: undefined, reset() {
menuType: "M", this.form = {
orderNum: undefined, menuId: undefined,
isFrame: "1", parentId: 0,
isCache: "0", menuName: undefined,
visible: "0", icon: undefined,
status: "0" menuType: "M",
}; orderNum: undefined,
this.resetForm("form"); isFrame: "1",
}, isCache: "0",
/** 搜索按钮操作 */ visible: "0",
handleQuery() { status: "0"
this.getList(); };
}, this.resetForm("form");
/** 重置按钮操作 */ },
resetQuery() { /** 搜索按钮操作 */
this.resetForm("queryForm"); handleQuery() {
this.handleQuery(); this.getList();
}, },
/** 新增按钮操作 */ /** 重置按钮操作 */
handleAdd(row) { resetQuery() {
this.reset(); this.resetForm("queryForm");
this.getTreeselect(); this.handleQuery();
if (row != null && row.menuId) { },
this.form.parentId = row.menuId; /** 新增按钮操作 */
} else { handleAdd(row) {
this.form.parentId = 0; this.reset();
} this.getTreeselect();
this.open = true; if (row != null && row.menuId) {
this.title = "添加菜单"; this.form.parentId = row.menuId;
}, } else {
/** 修改按钮操作 */ this.form.parentId = 0;
handleUpdate(row) { }
this.reset(); this.open = true;
this.getTreeselect(); this.title = "添加菜单";
getMenu(row.menuId).then(response => { },
this.form = response.data; /** 修改按钮操作 */
this.open = true; handleUpdate(row) {
this.title = "修改菜单"; this.reset();
}); this.getTreeselect();
}, this.title = "修改菜单";
/** 提交按钮 */ this.open = true;
submitForm: function() { this.dialogLoading = true;
this.$refs["form"].validate(valid => { this.submitLoading = true;
if (valid) { getMenu(row.menuId).then(response => {
if (this.form.menuId != undefined) { this.form = response.data;
updateMenu(this.form).then(response => { }).finally(()=>{
this.msgSuccess("修改成功"); this.dialogLoading = false;
this.open = false; this.submitLoading = false;
this.getList(); });
}); },
} else { /** 提交按钮 */
addMenu(this.form).then(response => { submitForm: function() {
this.msgSuccess("新增成功"); this.$refs["form"].validate(valid => {
this.open = false; if (valid) {
this.getList(); this.submitLoading = true;
}); if (this.form.menuId != undefined) {
} updateMenu(this.form).then(response => {
} this.msgSuccess("修改成功");
}); this.open = false;
}, this.getList();
/** 删除按钮操作 */ }).finally(()=>{
handleDelete(row) { this.submitLoading = false;
this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', "警告", { });
confirmButtonText: "确定", } else {
cancelButtonText: "取消", addMenu(this.form).then(response => {
type: "warning" this.msgSuccess("新增成功");
}).then(function() { this.open = false;
return delMenu(row.menuId); this.getList();
}).then(() => { }).finally(()=>{
this.getList(); this.submitLoading = false;
this.msgSuccess("删除成功"); });
}).catch(() => {}); }
} }
} });
}; },
</script> /** 删除按钮操作 */
handleDelete(row) {
this.$msgbox({
title: '警告',
message: '是否确认删除名称为"' + row.menuName + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delMenu(row.menuId).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
}
}
};
</script>

@ -1,339 +1,371 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="公告标题" prop="noticeTitle"> <el-form-item label="公告标题" prop="noticeTitle">
<el-input <el-input
v-model="queryParams.noticeTitle" v-model="queryParams.noticeTitle"
placeholder="请输入公告标题" placeholder="请输入公告标题"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="操作人员" prop="createBy"> <el-form-item label="操作人员" prop="createBy">
<el-input <el-input
v-model="queryParams.createBy" v-model="queryParams.createBy"
placeholder="请输入操作人员" placeholder="请输入操作人员"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="noticeType"> <el-form-item label="类型" prop="noticeType">
<el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small"> <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:notice:add']" v-hasPermi="['system:notice:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</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="noticeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="noticeList" @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="noticeId" width="100" /> <el-table-column label="序号" align="center" prop="noticeId" width="100" />
<el-table-column <el-table-column
label="公告标题" label="公告标题"
align="center" align="center"
prop="noticeTitle" prop="noticeTitle"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="公告类型" label="公告类型"
align="center" align="center"
prop="noticeType" prop="noticeType"
:formatter="typeFormat" :formatter="typeFormat"
width="100" width="100"
/> />
<el-table-column <el-table-column
label="状态" label="状态"
align="center" align="center"
prop="status" prop="status"
:formatter="statusFormat" :formatter="statusFormat"
width="100" width="100"
/> />
<el-table-column label="创建者" align="center" prop="createBy" width="100" /> <el-table-column label="创建者" align="center" prop="createBy" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="100"> <el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改公告对话框 --> <!-- 添加或修改公告对话框 -->
<el-dialog :title="title" :visible.sync="open" width="780px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle"> <el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" /> <el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="公告类型" prop="noticeType"> <el-form-item label="公告类型" prop="noticeType">
<el-select v-model="form.noticeType" placeholder="请选择"> <el-select v-model="form.noticeType" placeholder="请选择">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
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>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="内容"> <el-form-item label="内容">
<editor v-model="form.noticeContent" :min-height="192"/> <editor v-model="form.noticeContent" :min-height="192"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
export default { export default {
name: "Notice", name: "Notice",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
noticeList: [], noticeList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
statusOptions: [], statusOptions: [],
// //
typeOptions: [], typeOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
noticeTitle: undefined, noticeTitle: undefined,
createBy: undefined, createBy: undefined,
status: undefined status: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
noticeTitle: [ noticeTitle: [
{ required: true, message: "公告标题不能为空", trigger: "blur" } { required: true, message: "公告标题不能为空", trigger: "blur" }
], ],
noticeType: [ noticeType: [
{ required: true, message: "公告类型不能为空", trigger: "change" } { required: true, message: "公告类型不能为空", trigger: "change" }
] ]
} },
}; //
}, dialogLoading: false,
created() { //
this.getList(); submitLoading: false,
this.getDicts("sys_notice_status").then(response => { };
this.statusOptions = response.data; },
}); created() {
this.getDicts("sys_notice_type").then(response => { this.getList();
this.typeOptions = response.data; this.getDicts("sys_notice_status").then(response => {
}); this.statusOptions = response.data;
}, });
methods: { this.getDicts("sys_notice_type").then(response => {
/** 查询公告列表 */ this.typeOptions = response.data;
getList() { });
this.loading = true; },
listNotice(this.queryParams).then(response => { methods: {
this.noticeList = response.rows; /** 查询公告列表 */
this.total = response.total; getList() {
this.loading = false; this.loading = true;
}); listNotice(this.queryParams).then(response => {
}, let currentPageNum = response.total / this.queryParams.pageSize;
// if(this.queryParams.pageNum > currentPageNum){
statusFormat(row, column) { this.queryParams.pageNum = currentPageNum;
return this.selectDictLabel(this.statusOptions, row.status); }
}, this.noticeList = response.rows;
// this.total = response.total;
typeFormat(row, column) { this.loading = false;
return this.selectDictLabel(this.typeOptions, row.noticeType); });
}, },
// //
cancel() { statusFormat(row, column) {
this.open = false; return this.selectDictLabel(this.statusOptions, row.status);
this.reset(); },
}, //
// typeFormat(row, column) {
reset() { return this.selectDictLabel(this.typeOptions, row.noticeType);
this.form = { },
noticeId: undefined, //
noticeTitle: undefined, cancel() {
noticeType: undefined, this.open = false;
noticeContent: undefined, this.reset();
status: "0" },
}; //
this.resetForm("form"); reset() {
}, this.form = {
/** 搜索按钮操作 */ noticeId: undefined,
handleQuery() { noticeTitle: undefined,
this.queryParams.pageNum = 1; noticeType: undefined,
this.getList(); noticeContent: undefined,
}, status: "0"
/** 重置按钮操作 */ };
resetQuery() { this.resetForm("form");
this.resetForm("queryForm"); },
this.handleQuery(); /** 搜索按钮操作 */
}, handleQuery() {
// this.queryParams.pageNum = 1;
handleSelectionChange(selection) { this.getList();
this.ids = selection.map(item => item.noticeId) },
this.single = selection.length!=1 /** 重置按钮操作 */
this.multiple = !selection.length resetQuery() {
}, this.resetForm("queryForm");
/** 新增按钮操作 */ this.handleQuery();
handleAdd() { },
this.reset(); //
this.open = true; handleSelectionChange(selection) {
this.title = "添加公告"; this.ids = selection.map(item => item.noticeId)
}, this.single = selection.length!=1
/** 修改按钮操作 */ this.multiple = !selection.length
handleUpdate(row) { },
this.reset(); /** 新增按钮操作 */
const noticeId = row.noticeId || this.ids handleAdd() {
getNotice(noticeId).then(response => { this.reset();
this.form = response.data; this.title = "添加公告";
this.open = true; this.open = true;
this.title = "修改公告"; },
}); /** 修改按钮操作 */
}, handleUpdate(row) {
/** 提交按钮 */ this.reset();
submitForm: function() { const noticeId = row.noticeId || this.ids
this.$refs["form"].validate(valid => { this.title = "修改公告";
if (valid) { this.open = true;
if (this.form.noticeId != undefined) { this.dialogLoading = true;
updateNotice(this.form).then(response => { this.submitLoading = true;
this.msgSuccess("修改成功"); getNotice(noticeId).then(response => {
this.open = false; this.form = response.data;
this.getList(); }).finally(()=>{
}); this.dialogLoading = false;
} else { this.submitLoading = false;
addNotice(this.form).then(response => { });
this.msgSuccess("新增成功"); },
this.open = false; /** 提交按钮 */
this.getList(); submitForm: function() {
}); this.$refs["form"].validate(valid => {
} if (valid) {
} this.submitLoading = true;
}); if (this.form.noticeId != undefined) {
}, updateNotice(this.form).then(response => {
/** 删除按钮操作 */ this.msgSuccess("修改成功");
handleDelete(row) { this.open = false;
const noticeIds = row.noticeId || this.ids this.getList();
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", { }).finally(()=>{
confirmButtonText: "确定", this.submitLoading = false;
cancelButtonText: "取消", });
type: "warning" } else {
}).then(function() { addNotice(this.form).then(response => {
return delNotice(noticeIds); this.msgSuccess("新增成功");
}).then(() => { this.open = false;
this.getList(); this.getList();
this.msgSuccess("删除成功"); }).finally(()=>{
}).catch(() => {}); this.submitLoading = false;
} });
} }
}; }
</script> });
},
/** 删除按钮操作 */
handleDelete(row) {
const noticeIds = row.noticeId || this.ids
this.$msgbox({
title: '警告',
message: '是否确认删除公告编号为"' + noticeIds + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delNotice(noticeIds).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
}
}
};
</script>

@ -1,322 +1,325 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="系统模块" prop="title"> <el-form-item label="系统模块" prop="title">
<el-input <el-input
v-model="queryParams.title" v-model="queryParams.title"
placeholder="请输入系统模块" placeholder="请输入系统模块"
clearable clearable
style="width: 240px;" style="width: 240px;"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="操作人员" prop="operName"> <el-form-item label="操作人员" prop="operName">
<el-input <el-input
v-model="queryParams.operName" v-model="queryParams.operName"
placeholder="请输入操作人员" placeholder="请输入操作人员"
clearable clearable
style="width: 240px;" style="width: 240px;"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="businessType"> <el-form-item label="类型" prop="businessType">
<el-select <el-select
v-model="queryParams.businessType" v-model="queryParams.businessType"
placeholder="操作类型" placeholder="操作类型"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="操作状态" placeholder="操作状态"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="操作时间"> <el-form-item label="操作时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:operlog:remove']" v-hasPermi="['system:operlog:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
@click="handleClean" @click="handleClean"
v-hasPermi="['system:operlog:remove']" v-hasPermi="['system:operlog:remove']"
>清空</el-button> >清空</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:operlog:export']" v-hasPermi="['system:operlog:export']"
>导出</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 ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<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="operId" /> <el-table-column label="日志编号" align="center" prop="operId" />
<el-table-column label="系统模块" align="center" prop="title" /> <el-table-column label="系统模块" align="center" prop="title" />
<el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" /> <el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" />
<el-table-column label="请求方式" align="center" prop="requestMethod" /> <el-table-column label="请求方式" align="center" prop="requestMethod" />
<el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/> <el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/>
<el-table-column label="主机" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" /> <el-table-column label="主机" align="center" prop="operIp" width="130" :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="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> <el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.operTime) }}</span> <span>{{ parseTime(scope.row.operTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleView(scope.row,scope.index)" @click="handleView(scope.row,scope.index)"
v-hasPermi="['system:operlog:query']" v-hasPermi="['system:operlog:query']"
>详细</el-button> >详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 操作日志详细 --> <!-- 操作日志详细 -->
<el-dialog title="操作日志详细" :visible.sync="open" width="700px" append-to-body> <el-dialog title="操作日志详细" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="100px" size="mini"> <el-form ref="form" :model="form" label-width="100px" size="mini">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="操作模块:">{{ form.title }} / {{ typeFormat(form) }}</el-form-item> <el-form-item label="操作模块:">{{ form.title }} / {{ typeFormat(form) }}</el-form-item>
<el-form-item <el-form-item
label="登录信息:" label="登录信息:"
>{{ form.operName }} / {{ form.operIp }}</el-form-item> >{{ form.operName }} / {{ form.operIp }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="请求地址:">{{ form.operUrl }}</el-form-item> <el-form-item label="请求地址:">{{ form.operUrl }}</el-form-item>
<el-form-item label="请求方式:">{{ form.requestMethod }}</el-form-item> <el-form-item label="请求方式:">{{ form.requestMethod }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="操作方法:">{{ form.method }}</el-form-item> <el-form-item label="操作方法:">{{ form.method }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="请求参数:">{{ form.operParam }}</el-form-item> <el-form-item label="请求参数:">{{ form.operParam }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="返回参数:">{{ form.jsonResult }}</el-form-item> <el-form-item label="返回参数:">{{ form.jsonResult }}</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="操作状态:"> <el-form-item label="操作状态:">
<div v-if="form.status === 0"></div> <div v-if="form.status === 0"></div>
<div v-else-if="form.status === 1">失败</div> <div v-else-if="form.status === 1">失败</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="操作时间:">{{ parseTime(form.operTime) }}</el-form-item> <el-form-item label="操作时间:">{{ parseTime(form.operTime) }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="异常信息:" v-if="form.status === 1">{{ form.errorMsg }}</el-form-item> <el-form-item label="异常信息:" v-if="form.status === 1">{{ form.errorMsg }}</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button> <el-button @click="open = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { list, delOperlog, cleanOperlog } from "@/api/system/operlog"; import { list, delOperlog, cleanOperlog } from "@/api/system/operlog";
export default { export default {
name: "Operlog", name: "Operlog",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
open: false, open: false,
// //
typeOptions: [], typeOptions: [],
// //
statusOptions: [], statusOptions: [],
// //
dateRange: [], dateRange: [],
// //
defaultSort: {prop: 'operTime', order: 'descending'}, defaultSort: {prop: 'operTime', order: 'descending'},
// //
form: {}, form: {},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
title: undefined, title: undefined,
operName: undefined, operName: undefined,
businessType: undefined, businessType: undefined,
status: undefined status: undefined
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_oper_type").then(response => { this.getDicts("sys_oper_type").then(response => {
this.typeOptions = response.data; this.typeOptions = response.data;
}); });
this.getDicts("sys_common_status").then(response => { this.getDicts("sys_common_status").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
}, },
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.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
} }
); this.list = response.rows;
}, this.total = response.total;
// this.loading = false;
statusFormat(row, column) { });
return this.selectDictLabel(this.statusOptions, row.status); },
}, //
// statusFormat(row, column) {
typeFormat(row, column) { return this.selectDictLabel(this.statusOptions, row.status);
return this.selectDictLabel(this.typeOptions, row.businessType); },
}, //
/** 搜索按钮操作 */ typeFormat(row, column) {
handleQuery() { return this.selectDictLabel(this.typeOptions, row.businessType);
this.queryParams.pageNum = 1; },
this.getList(); /** 搜索按钮操作 */
}, handleQuery() {
/** 重置按钮操作 */ this.queryParams.pageNum = 1;
resetQuery() { this.getList();
this.dateRange = []; },
this.resetForm("queryForm"); /** 重置按钮操作 */
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) resetQuery() {
this.handleQuery(); this.dateRange = [];
}, this.resetForm("queryForm");
/** 多选框选中数据 */ this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
handleSelectionChange(selection) { this.handleQuery();
this.ids = selection.map(item => item.operId) },
this.multiple = !selection.length /** 多选框选中数据 */
}, handleSelectionChange(selection) {
/** 排序触发事件 */ this.ids = selection.map(item => item.operId)
handleSortChange(column, prop, order) { this.multiple = !selection.length
this.queryParams.orderByColumn = column.prop; },
this.queryParams.isAsc = column.order; /** 排序触发事件 */
this.getList(); handleSortChange(column, prop, order) {
}, this.queryParams.orderByColumn = column.prop;
/** 详细按钮操作 */ this.queryParams.isAsc = column.order;
handleView(row) { this.getList();
this.open = true; },
this.form = row; /** 详细按钮操作 */
}, handleView(row) {
/** 删除按钮操作 */ this.open = true;
handleDelete(row) { this.form = row;
const operIds = row.operId || this.ids; },
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", { /** 删除按钮操作 */
confirmButtonText: "确定", handleDelete(row) {
cancelButtonText: "取消", const operIds = row.operId || this.ids;
type: "warning" this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", {
}).then(function() { confirmButtonText: "确定",
return delOperlog(operIds); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("删除成功"); return delOperlog(operIds);
}).catch(() => {}); }).then(() => {
}, this.getList();
/** 清空按钮操作 */ this.msgSuccess("删除成功");
handleClean() { }).catch(() => {});
this.$confirm('是否确认清空所有操作日志数据项?', "警告", { },
confirmButtonText: "确定", /** 清空按钮操作 */
cancelButtonText: "取消", handleClean() {
type: "warning" this.$confirm('是否确认清空所有操作日志数据项?', "警告", {
}).then(function() { confirmButtonText: "确定",
return cleanOperlog(); cancelButtonText: "取消",
}).then(() => { type: "warning"
this.getList(); }).then(function() {
this.msgSuccess("清空成功"); return cleanOperlog();
}).catch(() => {}); }).then(() => {
}, this.getList();
/** 导出按钮操作 */ this.msgSuccess("清空成功");
handleExport() { }).catch(() => {});
this.download('system/operlog/export', { },
...this.queryParams /** 导出按钮操作 */
}, `operlog_${new Date().getTime()}.xlsx`) handleExport() {
} this.download('system/operlog/export', {
} ...this.queryParams
}; }, `operlog_${new Date().getTime()}.xlsx`)
</script> }
}
};
</script>

@ -1,319 +1,359 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="岗位编码" prop="postCode"> <el-form-item label="岗位编码" prop="postCode">
<el-input <el-input
v-model="queryParams.postCode" v-model="queryParams.postCode"
placeholder="请输入岗位编码" placeholder="请输入岗位编码"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="岗位名称" prop="postName"> <el-form-item label="岗位名称" prop="postName">
<el-input <el-input
v-model="queryParams.postName" v-model="queryParams.postName"
placeholder="请输入岗位名称" placeholder="请输入岗位名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="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 size="small"> <el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:post:add']" v-hasPermi="['system:post:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:post:edit']" v-hasPermi="['system:post:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:post:remove']" v-hasPermi="['system:post:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:post:export']" :loading="exportLoading"
>导出</el-button> v-hasPermi="['system:post:export']"
</el-col> >导出</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-col>
</el-row> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
<el-table-column label="岗位编号" align="center" prop="postId" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="岗位编码" align="center" prop="postCode" /> <el-table-column label="岗位编号" align="center" prop="postId" />
<el-table-column label="岗位名称" align="center" prop="postName" /> <el-table-column label="岗位编码" align="center" prop="postCode" />
<el-table-column label="岗位排序" align="center" prop="postSort" /> <el-table-column label="岗位名称" align="center" prop="postName" />
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" /> <el-table-column label="岗位排序" align="center" prop="postSort" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
<template slot-scope="scope"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<span>{{ parseTime(scope.row.createTime) }}</span> <template slot-scope="scope">
</template> <span>{{ parseTime(scope.row.createTime) }}</span>
</el-table-column> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-button <template slot-scope="scope">
size="mini" <el-button
type="text" size="mini"
icon="el-icon-edit" type="text"
@click="handleUpdate(scope.row)" icon="el-icon-edit"
v-hasPermi="['system:post:edit']" @click="handleUpdate(scope.row)"
>修改</el-button> v-hasPermi="['system:post:edit']"
<el-button >修改</el-button>
size="mini" <el-button
type="text" size="mini"
icon="el-icon-delete" type="text"
@click="handleDelete(scope.row)" icon="el-icon-delete"
v-hasPermi="['system:post:remove']" @click="handleDelete(scope.row)"
>删除</el-button> v-hasPermi="['system:post:remove']"
</template> >删除</el-button>
</el-table-column> </template>
</el-table> </el-table-column>
</el-table>
<pagination
v-show="total>0" <pagination
:total="total" v-show="total>0"
:page.sync="queryParams.pageNum" :total="total"
:limit.sync="queryParams.pageSize" :page.sync="queryParams.pageNum"
@pagination="getList" :limit.sync="queryParams.pageSize"
/> @pagination="getList"
/>
<!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <!-- 添加或修改岗位对话框 -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form-item label="岗位名称" prop="postName"> <el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-input v-model="form.postName" placeholder="请输入岗位名称" /> <el-form-item label="岗位名称" prop="postName">
</el-form-item> <el-input v-model="form.postName" placeholder="请输入岗位名称" />
<el-form-item label="岗位编码" prop="postCode"> </el-form-item>
<el-input v-model="form.postCode" placeholder="请输入编码名称" /> <el-form-item label="岗位编码" prop="postCode">
</el-form-item> <el-input v-model="form.postCode" placeholder="请输入编码名称" />
<el-form-item label="岗位顺序" prop="postSort"> </el-form-item>
<el-input-number v-model="form.postSort" controls-position="right" :min="0" /> <el-form-item label="岗位顺序" prop="postSort">
</el-form-item> <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
<el-form-item label="岗位状态" prop="status"> </el-form-item>
<el-radio-group v-model="form.status"> <el-form-item label="岗位状态" prop="status">
<el-radio <el-radio-group v-model="form.status">
v-for="dict in statusOptions" <el-radio
:key="dict.dictValue" v-for="dict in statusOptions"
:label="dict.dictValue" :key="dict.dictValue"
>{{dict.dictLabel}}</el-radio> :label="dict.dictValue"
</el-radio-group> >{{dict.dictLabel}}</el-radio>
</el-form-item> </el-radio-group>
<el-form-item label="备注" prop="remark"> </el-form-item>
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-form-item label="备注" prop="remark">
</el-form-item> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form> </el-form-item>
<div slot="footer" class="dialog-footer"> </el-form>
<el-button type="primary" @click="submitForm"> </el-button> <div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button> <el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
</div> <el-button @click="cancel"> </el-button>
</el-dialog> </div>
</div> </el-dialog>
</template> </div>
</template>
<script>
import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post"; <script>
import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
export default { import {delDept} from "@/api/system/dept";
name: "Post",
data() { export default {
return { name: "Post",
// data() {
loading: true, return {
// //
ids: [], loading: true,
// //
single: true, ids: [],
// //
multiple: true, single: true,
// //
showSearch: true, multiple: true,
// //
total: 0, showSearch: true,
// //
postList: [], total: 0,
// //
title: "", postList: [],
// //
open: false, title: "",
// //
statusOptions: [], open: false,
// //
queryParams: { statusOptions: [],
pageNum: 1, //
pageSize: 10, queryParams: {
postCode: undefined, pageNum: 1,
postName: undefined, pageSize: 10,
status: undefined postCode: undefined,
}, postName: undefined,
// status: undefined
form: {}, },
// //
rules: { form: {},
postName: [ //
{ required: true, message: "岗位名称不能为空", trigger: "blur" } rules: {
], postName: [
postCode: [ { required: true, message: "岗位名称不能为空", trigger: "blur" }
{ required: true, message: "岗位编码不能为空", trigger: "blur" } ],
], postCode: [
postSort: [ { required: true, message: "岗位编码不能为空", trigger: "blur" }
{ required: true, message: "岗位顺序不能为空", trigger: "blur" } ],
] postSort: [
} { required: true, message: "岗位顺序不能为空", trigger: "blur" }
}; ]
}, },
created() { //
this.getList(); dialogLoading: false,
this.getDicts("sys_normal_disable").then(response => { //
this.statusOptions = response.data; submitLoading: false,
}); //
}, exportLoading: false
methods: { };
/** 查询岗位列表 */ },
getList() { created() {
this.loading = true; this.getList();
listPost(this.queryParams).then(response => { this.getDicts("sys_normal_disable").then(response => {
this.postList = response.rows; this.statusOptions = response.data;
this.total = response.total; });
this.loading = false; },
}); methods: {
}, /** 查询岗位列表 */
// getList() {
statusFormat(row, column) { this.loading = true;
return this.selectDictLabel(this.statusOptions, row.status); listPost(this.queryParams).then(response => {
}, let currentPageNum = response.total / this.queryParams.pageSize;
// if(this.queryParams.pageNum > currentPageNum){
cancel() { this.queryParams.pageNum = currentPageNum;
this.open = false; }
this.reset(); this.postList = response.rows;
}, this.total = response.total;
// this.loading = false;
reset() { });
this.form = { },
postId: undefined, //
postCode: undefined, statusFormat(row, column) {
postName: undefined, return this.selectDictLabel(this.statusOptions, row.status);
postSort: 0, },
status: "0", //
remark: undefined cancel() {
}; this.open = false;
this.resetForm("form"); this.reset();
}, },
/** 搜索按钮操作 */ //
handleQuery() { reset() {
this.queryParams.pageNum = 1; this.form = {
this.getList(); postId: undefined,
}, postCode: undefined,
/** 重置按钮操作 */ postName: undefined,
resetQuery() { postSort: 0,
this.resetForm("queryForm"); status: "0",
this.handleQuery(); remark: undefined
}, };
// this.resetForm("form");
handleSelectionChange(selection) { },
this.ids = selection.map(item => item.postId) /** 搜索按钮操作 */
this.single = selection.length!=1 handleQuery() {
this.multiple = !selection.length this.queryParams.pageNum = 1;
}, this.getList();
/** 新增按钮操作 */ },
handleAdd() { /** 重置按钮操作 */
this.reset(); resetQuery() {
this.open = true; this.resetForm("queryForm");
this.title = "添加岗位"; this.handleQuery();
}, },
/** 修改按钮操作 */ //
handleUpdate(row) { handleSelectionChange(selection) {
this.reset(); this.ids = selection.map(item => item.postId)
const postId = row.postId || this.ids this.single = selection.length!=1
getPost(postId).then(response => { this.multiple = !selection.length
this.form = response.data; },
this.open = true; /** 新增按钮操作 */
this.title = "修改岗位"; handleAdd() {
}); this.reset();
}, this.title = "添加岗位";
/** 提交按钮 */ this.open = true;
submitForm: function() { },
this.$refs["form"].validate(valid => { /** 修改按钮操作 */
if (valid) { handleUpdate(row) {
if (this.form.postId != undefined) { this.reset();
updatePost(this.form).then(response => { const postId = row.postId || this.ids
this.msgSuccess("修改成功"); this.title = "修改岗位";
this.open = false; this.open = true;
this.getList(); this.dialogLoading = true;
}); this.submitLoading = true;
} else { getPost(postId).then(response => {
addPost(this.form).then(response => { this.form = response.data;
this.msgSuccess("新增成功"); }).finally(()=>{
this.open = false; this.dialogLoading = false;
this.getList(); this.submitLoading = false;
}); });
} },
} /** 提交按钮 */
}); submitForm: function() {
}, this.$refs["form"].validate(valid => {
/** 删除按钮操作 */ if (valid) {
handleDelete(row) { this.submitLoading = true;
const postIds = row.postId || this.ids; if (this.form.postId != undefined) {
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", { updatePost(this.form).then(response => {
confirmButtonText: "确定", this.msgSuccess("修改成功");
cancelButtonText: "取消", this.open = false;
type: "warning" this.getList();
}).then(function() { }).finally(()=>{
return delPost(postIds); this.submitLoading = false;
}).then(() => { });
this.getList(); } else {
this.msgSuccess("删除成功"); addPost(this.form).then(response => {
}).catch(() => {}); this.msgSuccess("新增成功");
}, this.open = false;
/** 导出按钮操作 */ this.getList();
handleExport() { }).finally(()=>{
this.download('system/post/export', { this.submitLoading = false;
...this.queryParams });
}, `post_${new Date().getTime()}.xlsx`) }
} }
} });
}; },
</script> /** 删除按钮操作 */
handleDelete(row) {
const postIds = row.postId || this.ids;
this.$msgbox({
title: '警告',
message: '是否确认删除岗位编号为"' + postIds + '"的数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '删除中...';
delPost(postIds).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}).finally(()=>{
done();
instance.confirmButtonLoading = false;
});
} else {
done();
}
}
});
},
/** 导出按钮操作 */
handleExport() {
this.exportLoading = true;
this.download('system/post/export', {
...this.queryParams
}, `post_${new Date().getTime()}.xlsx`).then(()=>{
}).finally(()=>{
this.exportLoading = false;
});
}
}
};
</script>

@ -1,213 +1,241 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true"> <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input
v-model="queryParams.phonenumber" v-model="queryParams.phonenumber"
placeholder="请输入手机号码" placeholder="请输入手机号码"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="openSelectUser" @click="openSelectUser"
v-hasPermi="['system:role:add']" v-hasPermi="['system:role:add']"
>添加用户</el-button> >添加用户</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-circle-close" icon="el-icon-circle-close"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="cancelAuthUserAll" @click="cancelAuthUserAll"
v-hasPermi="['system:role:remove']" v-hasPermi="['system:role:remove']"
>批量取消授权</el-button> >批量取消授权</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-close" icon="el-icon-close"
size="mini" size="mini"
@click="handleClose" @click="handleClose"
>关闭</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="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @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="用户名称" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="statusOptions" :value="scope.row.status"/> <dict-tag :options="statusOptions" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-circle-close" icon="el-icon-circle-close"
@click="cancelAuthUser(scope.row)" @click="cancelAuthUser(scope.row)"
v-hasPermi="['system:role:remove']" v-hasPermi="['system:role:remove']"
>取消授权</el-button> >取消授权</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" /> <select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" />
</div> </div>
</template> </template>
<script> <script>
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"; import {allocatedUserList, authUserCancel, authUserCancelAll, changeRoleStatus} from "@/api/system/role";
import selectUser from "./selectUser"; import selectUser from "./selectUser";
export default { export default {
name: "AuthUser", name: "AuthUser",
components: { selectUser }, components: { selectUser },
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
userIds: [], userIds: [],
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
userList: [], userList: [],
// //
statusOptions: [], statusOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
roleId: undefined, roleId: undefined,
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} }
}; };
}, },
created() { created() {
const roleId = this.$route.params && this.$route.params.roleId; const roleId = this.$route.params && this.$route.params.roleId;
if (roleId) { if (roleId) {
this.queryParams.roleId = roleId; this.queryParams.roleId = roleId;
this.getList(); this.getList();
this.getDicts("sys_normal_disable").then(response => { this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
} }
}, },
methods: { methods: {
/** 查询授权用户列表 */ /** 查询授权用户列表 */
getList() { getList() {
this.loading = true; this.loading = true;
allocatedUserList(this.queryParams).then(response => { allocatedUserList(this.queryParams).then(response => {
this.userList = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
} }
); this.userList = response.rows;
}, this.total = response.total;
// this.loading = false;
handleClose() { });
this.$store.dispatch("tagsView/delView", this.$route); },
this.$router.push({ path: "/system/role" }); //
}, handleClose() {
/** 搜索按钮操作 */ this.$store.dispatch("tagsView/delView", this.$route);
handleQuery() { this.$router.push({ path: "/system/role" });
this.queryParams.pageNum = 1; },
this.getList(); /** 搜索按钮操作 */
}, handleQuery() {
/** 重置按钮操作 */ this.queryParams.pageNum = 1;
resetQuery() { this.getList();
this.resetForm("queryForm"); },
this.handleQuery(); /** 重置按钮操作 */
}, resetQuery() {
// this.resetForm("queryForm");
handleSelectionChange(selection) { this.handleQuery();
this.userIds = selection.map(item => item.userId) },
this.multiple = !selection.length //
}, handleSelectionChange(selection) {
/** 打开授权用户表弹窗 */ this.userIds = selection.map(item => item.userId)
openSelectUser() { this.multiple = !selection.length
this.$refs.select.show(); },
}, /** 打开授权用户表弹窗 */
/** 取消授权按钮操作 */ openSelectUser() {
cancelAuthUser(row) { this.$refs.select.show();
const roleId = this.queryParams.roleId; },
this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', "警告", { /** 取消授权按钮操作 */
confirmButtonText: "确定", cancelAuthUser(row) {
cancelButtonText: "取消", const roleId = this.queryParams.roleId;
type: "warning" this.$msgbox({
}).then(function() { title: '警告',
return authUserCancel({ userId: row.userId, roleId: roleId }); message: '确认要取消该用户"' + row.userName + '"角色吗?',
}).then(() => { type: "warning",
this.getList(); showCancelButton: true,
this.msgSuccess("取消授权成功"); confirmButtonText: '确定',
}).catch(() => {}); cancelButtonText: '取消',
}, beforeClose: (action, instance, done) => {
/** 批量取消授权按钮操作 */ if (action === 'confirm') {
cancelAuthUserAll(row) { instance.confirmButtonLoading = true;
const roleId = this.queryParams.roleId; instance.confirmButtonText = '取消中...';
const userIds = this.userIds.join(","); authUserCancel({ userId: row.userId, roleId: roleId }).then(() => {
this.$confirm('是否取消选中用户授权数据项?', "警告", { this.getList();
confirmButtonText: "确定", this.msgSuccess("取消授权成功");
cancelButtonText: "取消", }).catch(()=>{}).finally(()=>{
type: "warning" done();
}).then(() => { instance.confirmButtonLoading = false;
return authUserCancelAll({ roleId: roleId, userIds: userIds }); });
}).then(() => { } else {
this.getList(); done();
this.msgSuccess("取消授权成功"); }
}).catch(() => {}); }
} });
} },
}; /** 批量取消授权按钮操作 */
</script> cancelAuthUserAll(row) {
const roleId = this.queryParams.roleId;
const userIds = this.userIds.join(",");
this.$msgbox({
title: '警告',
message: '是否取消选中用户授权数据项?',
type: "warning",
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '取消中...';
authUserCancelAll({ roleId: roleId, userIds: userIds }).then(() => {
instance.confirmButtonLoading = false;
done();
this.getList();
this.msgSuccess("取消授权成功");
}).catch(()=>{})
} else {
done();
}
}
});
}
}
};
</script>

File diff suppressed because it is too large Load Diff

@ -1,142 +1,153 @@
<template> <template>
<!-- 授权用户 --> <!-- 授权用户 -->
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body> <el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form :model="queryParams" v-loading="dialogLoading" ref="queryForm" :inline="true">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input
v-model="queryParams.phonenumber" v-model="queryParams.phonenumber"
placeholder="请输入手机号码" placeholder="请输入手机号码"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row> <el-row>
<el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px"> <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="statusOptions" :value="scope.row.status"/> <dict-tag :options="statusOptions" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSelectUser"> </el-button> <el-button type="primary" @click="handleSelectUser" :loading="submitLoading"> </el-button>
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
export default { export default {
props: { props: {
// //
roleId: { roleId: {
type: Number type: Number
} }
}, },
data() { data() {
return { return {
// //
visible: false, visible: false,
// //
userIds: [], userIds: [],
// //
total: 0, total: 0,
// //
userList: [], userList: [],
// //
statusOptions: [], statusOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
roleId: undefined, roleId: undefined,
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} },
}; //
}, dialogLoading: false,
created() { //
this.getDicts("sys_normal_disable").then(response => { submitLoading: false,
this.statusOptions = response.data; };
}); },
}, created() {
methods: { this.getDicts("sys_normal_disable").then(response => {
// this.statusOptions = response.data;
show() { });
this.queryParams.roleId = this.roleId; },
this.getList(); methods: {
this.visible = true; //
}, show() {
clickRow(row) { this.queryParams.roleId = this.roleId;
this.$refs.table.toggleRowSelection(row); this.getList();
}, this.visible = true;
// },
handleSelectionChange(selection) { clickRow(row) {
this.userIds = selection.map(item => item.userId); this.$refs.table.toggleRowSelection(row);
}, },
// //
getList() { handleSelectionChange(selection) {
unallocatedUserList(this.queryParams).then(res => { this.userIds = selection.map(item => item.userId);
this.userList = res.rows; },
this.total = res.total; //
}); getList() {
}, unallocatedUserList(this.queryParams).then(res => {
/** 搜索按钮操作 */ let currentPageNum = response.total / this.queryParams.pageSize;
handleQuery() { if(this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = 1; this.queryParams.pageNum = currentPageNum;
this.getList(); }
}, this.userList = res.rows;
/** 重置按钮操作 */ this.total = res.total;
resetQuery() { });
this.resetForm("queryForm"); },
this.handleQuery(); /** 搜索按钮操作 */
}, handleQuery() {
/** 选择授权用户操作 */ this.queryParams.pageNum = 1;
handleSelectUser() { this.getList();
const roleId = this.queryParams.roleId; },
const userIds = this.userIds.join(","); /** 重置按钮操作 */
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { resetQuery() {
this.msgSuccess(res.msg); this.resetForm("queryForm");
if (res.code === 200) { this.handleQuery();
this.visible = false; },
this.$emit("ok"); /** 选择授权用户操作 */
} handleSelectUser() {
}); this.submitLoading = true;
} const roleId = this.queryParams.roleId;
} const userIds = this.userIds.join(",");
}; authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
</script> this.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = false;
this.$emit("ok");
}
}).finally(()=>{
this.submitLoading = false;
});
}
}
};
</script>

@ -1,117 +1,122 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<h4 class="form-header h4">基本信息</h4> <h4 class="form-header h4">基本信息</h4>
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
<el-row> <el-row>
<el-col :span="8" :offset="2"> <el-col :span="8" :offset="2">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" disabled /> <el-input v-model="form.nickName" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8" :offset="2"> <el-col :span="8" :offset="2">
<el-form-item label="登录账号" prop="phonenumber"> <el-form-item label="登录账号" prop="phonenumber">
<el-input v-model="form.userName" disabled /> <el-input v-model="form.userName" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<h4 class="form-header h4">角色信息</h4> <h4 class="form-header h4">角色信息</h4>
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)"> <el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
<el-table-column label="序号" type="index" align="center"> <el-table-column label="序号" type="index" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span> <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column> <el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
<el-table-column label="角色编号" align="center" prop="roleId" /> <el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" /> <el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" /> <el-table-column label="权限字符" align="center" prop="roleKey" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" /> <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
<el-form label-width="100px"> <el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-120px;margin-top:30px;"> <el-form-item style="text-align: center;margin-left:-120px;margin-top:30px;">
<el-button type="primary" @click="submitForm()"></el-button> <el-button type="primary" @click="submitForm()" :loading="submitLoading">提交</el-button>
<el-button @click="close()"></el-button> <el-button @click="close()"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
import { getAuthRole, updateAuthRole } from "@/api/system/user"; import { getAuthRole, updateAuthRole } from "@/api/system/user";
export default { export default {
name: "AuthRole", name: "AuthRole",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// //
roleIds:[], roleIds:[],
// //
roles: [], roles: [],
// //
form: {} form: {},
}; //
}, submitLoading: false
created() { };
const userId = this.$route.params && this.$route.params.userId; },
if (userId) { created() {
this.loading = true; const userId = this.$route.params && this.$route.params.userId;
getAuthRole(userId).then((response) => { if (userId) {
this.form = response.user; this.loading = true;
this.roles = response.roles; getAuthRole(userId).then((response) => {
this.total = this.roles.length; this.form = response.user;
this.$nextTick(() => { this.roles = response.roles;
this.roles.forEach((row) => { this.total = this.roles.length;
if (row.flag) { this.$nextTick(() => {
this.$refs.table.toggleRowSelection(row); this.roles.forEach((row) => {
} if (row.flag) {
}); this.$refs.table.toggleRowSelection(row);
}); }
this.loading = false; });
}); });
} this.loading = false;
}, });
methods: { }
/** 单击选中行数据 */ },
clickRow(row) { methods: {
this.$refs.table.toggleRowSelection(row); /** 单击选中行数据 */
}, clickRow(row) {
// this.$refs.table.toggleRowSelection(row);
handleSelectionChange(selection) { },
this.roleIds = selection.map((item) => item.roleId); //
}, handleSelectionChange(selection) {
// this.roleIds = selection.map((item) => item.roleId);
getRowKey(row) { },
return row.roleId; //
}, getRowKey(row) {
/** 提交按钮 */ return row.roleId;
submitForm() { },
const userId = this.form.userId; /** 提交按钮 */
const roleIds = this.roleIds.join(","); submitForm() {
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => { const userId = this.form.userId;
this.msgSuccess("授权成功"); const roleIds = this.roleIds.join(",");
this.close(); this.submitLoading = true;
}); updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
}, this.msgSuccess("授权成功");
/** 关闭按钮 */ this.close();
close() { }).finally(()=>{
this.$store.dispatch("tagsView/delView", this.$route); this.submitLoading = false;
this.$router.push({ path: "/system/user" }); });
}, },
}, /** 关闭按钮 */
}; close() {
</script> this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/system/user" });
},
},
};
</script>

File diff suppressed because it is too large Load Diff

@ -1,72 +1,84 @@
<template> <template>
<el-form ref="form" :model="user" :rules="rules" label-width="80px"> <el-form ref="form" :model="user" :rules="rules" label-width="80px">
<el-form-item label="旧密码" prop="oldPassword"> <el-form-item label="旧密码" prop="oldPassword">
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" /> <el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" />
</el-form-item> </el-form-item>
<el-form-item label="新密码" prop="newPassword"> <el-form-item label="新密码" prop="newPassword">
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" /> <el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" />
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirmPassword"> <el-form-item label="确认密码" prop="confirmPassword">
<el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" /> <el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="mini" @click="submit"></el-button> <el-button type="primary" size="mini" @click="submit" :loading="resetPwdLoading">保存</el-button>
<el-button type="danger" size="mini" @click="close"></el-button> <el-button type="danger" size="mini" @click="close"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script> <script>
import { updateUserPwd } from "@/api/system/user"; import { updateUserPwd } from "@/api/system/user";
export default { export default {
data() { data() {
const equalToPassword = (rule, value, callback) => { const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) { if (this.user.newPassword !== value) {
callback(new Error("两次输入的密码不一致")); callback(new Error("两次输入的密码不一致"));
} else { } else {
callback(); callback();
} }
}; };
return { return {
test: "1test", test: "1test",
user: { user: {
oldPassword: undefined, oldPassword: undefined,
newPassword: undefined, newPassword: undefined,
confirmPassword: undefined confirmPassword: undefined
}, },
// //
rules: { rules: {
oldPassword: [ oldPassword: [
{ required: true, message: "旧密码不能为空", trigger: "blur" } { required: true, message: "旧密码不能为空", trigger: "blur" }
], ],
newPassword: [ newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" }, { required: true, message: "新密码不能为空", trigger: "blur" },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" } { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
], ],
confirmPassword: [ confirmPassword: [
{ required: true, message: "确认密码不能为空", trigger: "blur" }, { required: true, message: "确认密码不能为空", trigger: "blur" },
{ required: true, validator: equalToPassword, trigger: "blur" } { required: true, validator: equalToPassword, trigger: "blur" }
] ]
} },
}; resetPwdLoading: false
}, };
methods: { },
submit() { methods: {
this.$refs["form"].validate(valid => { reset() {
if (valid) { this.user = {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then( oldPassword: undefined,
response => { newPassword: undefined,
this.msgSuccess("修改成功"); confirmPassword: undefined
} }
); },
} submit() {
}); this.$refs["form"].validate(valid => {
}, if (valid) {
close() { this.resetPwdLoading = true;
this.$store.dispatch("tagsView/delView", this.$route); updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
this.$router.push({ path: "/index" }); response => {
} this.msgSuccess("修改成功");
} this.reset();
}; }
</script> ).finally(() => {
this.resetPwdLoading = false;
});
}
});
},
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/index" });
}
}
};
</script>

@ -1,76 +1,80 @@
<template> <template>
<el-form ref="form" :model="user" :rules="rules" label-width="80px"> <el-form ref="form" :model="user" :rules="rules" label-width="80px">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="用户昵称" prop="nickName">
<el-input v-model="user.nickName" maxlength="30" /> <el-input v-model="user.nickName" maxlength="30" />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="user.phonenumber" maxlength="11" /> <el-input v-model="user.phonenumber" maxlength="11" />
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">
<el-input v-model="user.email" maxlength="50" /> <el-input v-model="user.email" maxlength="50" />
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item label="性别">
<el-radio-group v-model="user.sex"> <el-radio-group v-model="user.sex">
<el-radio label="0"></el-radio> <el-radio label="0"></el-radio>
<el-radio label="1"></el-radio> <el-radio label="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="mini" @click="submit"></el-button> <el-button type="primary" size="mini" @click="submit" :loading="updateInfoLoading">保存</el-button>
<el-button type="danger" size="mini" @click="close"></el-button> <el-button type="danger" size="mini" @click="close"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script> <script>
import { updateUserProfile } from "@/api/system/user"; import { updateUserProfile } from "@/api/system/user";
export default { export default {
props: { props: {
user: { user: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
// //
rules: { rules: {
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { required: true, message: "邮箱地址不能为空", trigger: "blur" },
{ {
type: "email", type: "email",
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"] trigger: ["blur", "change"]
} }
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" }, { required: true, message: "手机号码不能为空", trigger: "blur" },
{ {
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"
} }
] ]
} },
}; updateInfoLoading: false
}, };
methods: { },
submit() { methods: {
this.$refs["form"].validate(valid => { submit() {
if (valid) { this.$refs["form"].validate(valid => {
updateUserProfile(this.user).then(response => { if (valid) {
this.msgSuccess("修改成功"); this.updateInfoLoading = true;
}); updateUserProfile(this.user).then(response => {
} this.msgSuccess("修改成功");
}); }).finally(() => {
}, this.updateInfoLoading = false;
close() { });
this.$store.dispatch("tagsView/delView", this.$route); }
this.$router.push({ path: "/index" }); });
} },
} close() {
}; this.$store.dispatch("tagsView/delView", this.$route);
</script> this.$router.push({ path: "/index" });
}
}
};
</script>

@ -1,117 +1,121 @@
<template> <template>
<!-- 导入表 --> <!-- 导入表 -->
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body> <el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="表名称" prop="tableName"> <el-form-item label="表名称" prop="tableName">
<el-input <el-input
v-model="queryParams.tableName" v-model="queryParams.tableName"
placeholder="请输入表名称" placeholder="请输入表名称"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="表描述" prop="tableComment"> <el-form-item label="表描述" prop="tableComment">
<el-input <el-input
v-model="queryParams.tableComment" v-model="queryParams.tableComment"
placeholder="请输入表描述" placeholder="请输入表描述"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row> <el-row>
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px"> <el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column prop="updateTime" label="更新时间"></el-table-column> <el-table-column prop="updateTime" label="更新时间"></el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleImportTable"> </el-button> <el-button type="primary" @click="handleImportTable"> </el-button>
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { listDbTable, importTable } from "@/api/tool/gen"; import { listDbTable, importTable } from "@/api/tool/gen";
export default { export default {
data() { data() {
return { return {
// //
visible: false, visible: false,
// //
tables: [], tables: [],
// //
total: 0, total: 0,
// //
dbTableList: [], dbTableList: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
tableName: undefined, tableName: undefined,
tableComment: undefined tableComment: undefined
} }
}; };
}, },
methods: { methods: {
// //
show() { show() {
this.getList(); this.getList();
this.visible = true; this.visible = true;
}, },
clickRow(row) { clickRow(row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row);
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.tables = selection.map(item => item.tableName); this.tables = selection.map(item => item.tableName);
}, },
// //
getList() { getList() {
listDbTable(this.queryParams).then(res => { listDbTable(this.queryParams).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.dbTableList = res.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = res.total; if(this.queryParams.pageNum > currentPageNum){
} this.queryParams.pageNum = currentPageNum;
}); }
}, this.dbTableList = res.rows;
/** 搜索按钮操作 */ this.total = res.total;
handleQuery() { }
this.queryParams.pageNum = 1; });
this.getList(); },
}, /** 搜索按钮操作 */
/** 重置按钮操作 */ handleQuery() {
resetQuery() { this.queryParams.pageNum = 1;
this.resetForm("queryForm"); this.getList();
this.handleQuery(); },
}, /** 重置按钮操作 */
/** 导入按钮操作 */ resetQuery() {
handleImportTable() { this.resetForm("queryForm");
importTable({ tables: this.tables.join(",") }).then(res => { this.handleQuery();
this.msgSuccess(res.msg); },
if (res.code === 200) { /** 导入按钮操作 */
this.visible = false; handleImportTable() {
this.$emit("ok"); importTable({ tables: this.tables.join(",") }).then(res => {
} this.msgSuccess(res.msg);
}); if (res.code === 200) {
} this.visible = false;
} this.$emit("ok");
}; }
</script> });
}
}
};
</script>

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="表名称" prop="tableName"> <el-form-item label="表名称" prop="tableName">
<el-input <el-input
v-model="queryParams.tableName" v-model="queryParams.tableName"
@ -246,11 +246,14 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tableList = response.rows; let currentPageNum = response.total / this.queryParams.pageSize;
this.total = response.total; if(this.queryParams.pageNum > currentPageNum){
this.loading = false; this.queryParams.pageNum = currentPageNum;
} }
); this.tableList = response.rows;
this.total = response.total;
this.loading = false;
});
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {

Loading…
Cancel
Save