docs: update readme

Signed-off-by: yovinchen <gzh298255@gmail.com>
Signed-off-by: YoVinchen <gzh298255@gmail.com>
This commit is contained in:
YoVinchen 2023-06-15 23:31:19 +08:00
parent e73f313786
commit 16a23785e4
11 changed files with 473 additions and 65 deletions

View File

@ -0,0 +1,41 @@
import request from '@/utils/request'
const api_name = '/admin/process/processTemplate'
export default {
getPageList(page, limit) {
return request({
url: `${api_name}/${page}/${limit}`,
method: 'get'
})
},
getById(id) {
return request({
url: `${api_name}/get/${id}`,
method: 'get'
})
},
save(role) {
return request({
url: `${api_name}/save`,
method: 'post',
data: role
})
},
updateById(role) {
return request({
url: `${api_name}/update`,
method: 'put',
data: role
})
},
removeById(id) {
return request({
url: `${api_name}/remove/${id}`,
method: 'delete'
})
}
}

View File

@ -0,0 +1,39 @@
import request from '@/utils/request'
const api_name = '/admin/process/processType'
export default {
getPageList(page, limit) {
return request({
url: `${api_name}/${page}/${limit}`,
method: 'get'
})
},
getById(id) {
return request({
url: `${api_name}/get/${id}`,
method: 'get'
})
},
save(role) {
return request({
url: `${api_name}/save`,
method: 'post',
data: role
})
},
updateById(role) {
return request({
url: `${api_name}/update`,
method: 'put',
data: role
})
},
removeById(id) {
return request({
url: `${api_name}/remove/${id}`,
method: 'delete'
})
}
}

View File

@ -23,7 +23,7 @@ export default {
removeById(id) {
return request({
url: `${api_name}/remove/${id}`,
method: "delete"
method: 'delete'
})
},
@ -33,7 +33,7 @@ export default {
save(sysMenu) {
return request({
url: `${api_name}/save`,
method: "post",
method: 'post',
data: sysMenu
})
},
@ -44,7 +44,7 @@ export default {
updateById(sysMenu) {
return request({
url: `${api_name}/update`,
method: "put",
method: 'put',
data: sysMenu
})
},
@ -65,7 +65,7 @@ export default {
doAssign(assginMenuVo) {
return request({
url: `${api_name}/doAssign`,
method: "post",
method: 'post',
data: assginMenuVo
})
}

View File

@ -31,7 +31,7 @@ export default {
'sidebar'
]),
routes() {
//return this.$router.options.routes
// return this.$router.options.routes
return this.$router.options.routes.concat(global.antRouter)
},
activeMenu() {

View File

@ -7,15 +7,16 @@ import 'nprogress/nprogress.css' // 水平进度条样式
import getPageTitle from '@/utils/get-page-title' // 获取应用头部标题的函数
import Layout from '@/layout'
import ParentView from '@/components/ParentView'
const _import = require('./router/_import_'+process.env.NODE_ENV) // 获取组件的方法
const _import = require('./router/_import_' + process.env.NODE_ENV) // 获取组件的方法
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
NProgress.start()
// set page title
// set page title
document.title = getPageTitle(to.meta.title)
// determine whether the user has logged in
// determine whether the user has logged in
const hasToken = getToken()
if (hasToken) {
if (to.path === '/login') {
@ -37,14 +38,14 @@ router.beforeEach(async(to, from, next) => {
const menus = filterAsyncRouter(store.getters.menus)// 1.过滤路由
console.log(menus)
router.addRoutes(menus) // 2.动态添加路由
let lastRou = [{ path: '*', redirect: '/404', hidden: true }]
const lastRou = [{ path: '*', redirect: '/404', hidden: true }]
router.addRoutes(lastRou)
global.antRouter = menus // 3.将路由数据传递给全局变量,做侧边栏菜单渲染工作
next({
...to,
replace: true
})
//next()
// next()
} catch (error) {
// remove token and go to login page to re-login
console.log(error)
@ -81,7 +82,6 @@ function filterAsyncRouter(asyncRouterMap) {
try {
route.component = _import(route.component)// 导入组件
} catch (error) {
debugger
console.log(error)
route.component = _import('dashboard/index')// 导入组件
}

View File

@ -0,0 +1,143 @@
<template>
<div class="app-container">
<!-- 工具条 -->
<div class="tools-div">
<el-button
:disabled="$hasBP('bnt.processTemplate.templateSet') === false"
icon="el-icon-plus"
size="mini"
type="success"
@click="add()"
>添加审批设置
</el-button>
</div>
<!-- 列表 -->
<el-table
v-loading="listLoading"
:data="list"
border
stripe
style="width: 100%;margin-top: 10px;"
>
<el-table-column
align="center"
label="序号"
width="70"
>
<template slot-scope="scope">
{{ (page - 1) * limit + scope.$index + 1 }}
</template>
</el-table-column>
iconPath
<el-table-column label="审批名称" prop="name" />
<el-table-column label="图标">
<template slot-scope="scope">
<img :src="scope.row.iconUrl" style="width: 30px;height: 30px;vertical-align: text-bottom;">
</template>
</el-table-column>
<el-table-column label="审批类型" prop="processTypeName" />
<el-table-column label="描述" prop="description" />
<el-table-column label="创建时间" prop="createTime" />
<el-table-column label="更新时间" prop="updateTime" />
<el-table-column align="center" label="操作" width="250">
<template slot-scope="scope">
<el-button
:disabled="$hasBP('bnt.processTemplate.templateSet') === false"
size="mini"
type="text"
@click="edit(scope.row.id)"
>修改审批设置
</el-button>
<el-button
:disabled="$hasBP('bnt.processTemplate.remove') === false"
size="mini"
type="text"
@click="removeDataById(scope.row.id)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
:current-page="page"
:page-size="limit"
:page-sizes="[5, 10, 20, 30, 40, 50, 100]"
:total="total"
layout="sizes, prev, pager, next, jumper, ->, total, slot"
style="padding: 30px 0; text-align: center;"
@current-change="fetchData"
@size-change="changeSize"
/>
</div>
</template>
<script>
import api from '@/api/process/processTemplate'
export default {
data() {
return {
listLoading: true, //
list: null, // banner
total: 0, //
page: 1, //
limit: 10, //
searchObj: {} //
}
},
//
created() {
this.fetchData()
},
//
mounted() {
},
methods: {
//
changeSize(size) {
this.limit = size
this.fetchData(1)
},
// banner
fetchData(page = 1) {
// ajax
this.page = page
api.getPageList(this.page, this.limit, this.searchObj).then(
response => {
this.list = response.data.records
this.total = response.data.total
//
this.listLoading = false
}
)
},
//
resetData() {
this.searchObj = {}
this.fetchData()
},
// id
removeDataById(id) {
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => { // promise
// ajax
return api.removeById(id)
}).then((response) => {
this.fetchData(this.page)
this.$message.success(response.message)
}).catch(() => {
this.$message.info('取消删除')
})
},
add() {
this.$router.push('/processSet/templateSet')
},
edit(id) {
this.$router.push('/processSet/templateSet?id=' + id)
}
}
}
</script>

View File

@ -0,0 +1,192 @@
<template>
<div class="app-container">
<!-- 工具条 -->
<div class="tools-div">
<el-button
:disabled="$hasBP('bnt.processType.add') === false"
icon="el-icon-plus"
size="mini"
type="success"
@click="add"
>
</el-button>
</div>
<!-- banner列表 -->
<el-table
v-loading="listLoading"
:data="list"
border
stripe
style="width: 100%;margin-top: 10px;"
>
<el-table-column
type="selection"
width="55"
/>
<el-table-column
align="center"
label="序号"
width="70"
>
<template slot-scope="scope">
{{ (page - 1) * limit + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="类型名称" prop="name" />
<el-table-column label="描述" prop="description" />
<el-table-column label="创建时间" prop="createTime" />
<el-table-column label="更新时间" prop="updateTime" />
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button
:disabled="$hasBP('bnt.processType.update') === false"
size="mini"
type="text"
@click="edit(scope.row.id)"
>修改
</el-button>
<el-button
:disabled="$hasBP('bnt.processType.remove') === false"
size="mini"
type="text"
@click="removeDataById(scope.row.id)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
:current-page="page"
:page-size="limit"
:page-sizes="[5, 10, 20, 30, 40, 50, 100]"
:total="total"
layout="sizes, prev, pager, next, jumper, ->, total, slot"
style="padding: 30px 0; text-align: center;"
@current-change="fetchData"
@size-change="changeSize"
/>
<el-dialog :visible.sync="dialogVisible" title="添加/修改" width="40%">
<el-form ref="flashPromotionForm" label-width="150px" size="small" style="padding-right: 40px;">
<el-form-item label="类型名称">
<el-input v-model="processType.name" />
</el-form-item>
<el-form-item label="描述">
<el-input v-model="processType.description" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false"> </el-button>
<el-button size="small" type="primary" @click="saveOrUpdate()"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import api from '@/api/process/processType'
const defaultForm = {
id: '',
name: '',
description: ''
}
export default {
data() {
return {
listLoading: true, //
list: null, // banner
total: 0, //
page: 1, //
limit: 10, //
searchObj: {}, //
dialogVisible: false,
processType: defaultForm,
saveBtnDisabled: false
}
},
//
created() {
this.fetchData()
},
//
mounted() {
},
methods: {
//
changeSize(size) {
console.log(size)
this.limit = size
this.fetchData(1)
},
//
fetchData(page = 1) {
this.page = page
api.getPageList(this.page, this.limit, this.searchObj).then(response => {
this.list = response.data.records
this.total = response.data.total
//
this.listLoading = false
})
},
//
resetData() {
console.log('重置查询表单')
this.searchObj = {}
this.fetchData()
},
// id
removeDataById(id) {
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => { // promise
// ajax
return api.removeById(id)
}).then((response) => {
this.fetchData(this.page)
this.$message.success(response.message)
}).catch(() => {
this.$message.info('取消删除')
})
},
add() {
this.dialogVisible = true
this.processType = Object.assign({}, defaultForm)
},
edit(id) {
this.dialogVisible = true
this.fetchDataById(id)
},
fetchDataById(id) {
api.getById(id).then(response => {
this.processType = response.data
})
},
saveOrUpdate() {
this.saveBtnDisabled = true //
if (!this.processType.id) {
this.saveData()
} else {
this.updateData()
}
},
//
saveData() {
api.save(this.processType).then(response => {
this.$message.success(response.message || '操作成功')
this.dialogVisible = false
this.fetchData(this.page)
})
},
// id
updateData() {
api.updateById(this.processType).then(response => {
this.$message.success(response.message || '操作成功')
this.dialogVisible = false
this.fetchData(this.page)
})
}
}
}
</script>

View File

@ -21,16 +21,16 @@
style="width: 100%;margin-bottom: 20px;margin-top: 10px;"
>
<el-table-column label="菜单名称" prop="name" width="160"/>
<el-table-column label="菜单名称" prop="name" width="160" />
<el-table-column label="图标">
<template slot-scope="scope">
<i :class="scope.row.icon"/>
<i :class="scope.row.icon" />
</template>
</el-table-column>
<el-table-column label="权限标识" prop="perms" width="160"/>
<el-table-column label="路由地址" prop="path" width="120"/>
<el-table-column label="组件路径" prop="component" width="160"/>
<el-table-column label="排序" prop="sortValue" width="60"/>
<el-table-column label="权限标识" prop="perms" width="160" />
<el-table-column label="路由地址" prop="path" width="120" />
<el-table-column label="组件路径" prop="component" width="160" />
<el-table-column label="排序" prop="sortValue" width="60" />
<el-table-column label="状态" width="80">
<template slot-scope="scope">
<el-switch
@ -39,7 +39,7 @@
/>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" width="160"/>
<el-table-column label="创建时间" prop="createTime" width="160" />
<el-table-column align="center" fixed="right" label="操作" width="180">
<template slot-scope="scope">
<el-button
@ -73,7 +73,7 @@
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%">
<el-form ref="dataForm" :model="sysMenu" label-width="150px" size="small" style="padding-right: 40px;">
<el-form-item v-if="sysMenu.id === ''" label="上级部门">
<el-input v-model="sysMenu.parentName" disabled="true"/>
<el-input v-model="sysMenu.parentName" disabled="true" />
</el-form-item>
<el-form-item label="菜单类型" prop="type">
<el-radio-group v-model="sysMenu.type" :disabled="typeDisabled">
@ -83,47 +83,47 @@
</el-radio-group>
</el-form-item>
<el-form-item label="菜单名称" prop="name">
<el-input v-model="sysMenu.name"/>
<el-input v-model="sysMenu.name" />
</el-form-item>
<el-form-item v-if="sysMenu.type !== 2" label="图标" prop="icon">
<el-select v-model="sysMenu.icon" clearable>
<el-option v-for="item in iconList" :key="item.class" :label="item.class" :value="item.class">
<span style="float: left;">
<i :class="item.class"/> <!-- 如果动态显示图标这里添加判断 -->
<i :class="item.class" /> <!-- 如果动态显示图标这里添加判断 -->
</span>
<span style="padding-left: 6px;">{{ item.class }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="sysMenu.sortValue" :min="0" controls-position="right"/>
<el-input-number v-model="sysMenu.sortValue" :min="0" controls-position="right" />
</el-form-item>
<el-form-item prop="path">
<span slot="label">
<el-tooltip content="访问的路由地址,如:`sysUser`" placement="top">
<i class="el-icon-question"/>
<i class="el-icon-question" />
</el-tooltip>
路由地址
</span>
<el-input v-model="sysMenu.path" placeholder="请输入路由地址"/>
<el-input v-model="sysMenu.path" placeholder="请输入路由地址" />
</el-form-item>
<el-form-item v-if="sysMenu.type !== 0" prop="component">
<span slot="label">
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
<i class="el-icon-question"/>
<i class="el-icon-question" />
</el-tooltip>
组件路径
</span>
<el-input v-model="sysMenu.component" placeholder="请输入组件路径"/>
<el-input v-model="sysMenu.component" placeholder="请输入组件路径" />
</el-form-item>
<el-form-item v-if="sysMenu.type === 2">
<el-input v-model="sysMenu.perms" maxlength="100" placeholder="请输入权限标识"/>
<el-input v-model="sysMenu.perms" maxlength="100" placeholder="请输入权限标识" />
<span slot="label">
<el-tooltip
content="控制器中定义的权限字符,如:@PreAuthorize(hasAuthority('bnt.sysRole.list'))"
placement="top"
>
<i class="el-icon-question"/>
<i class="el-icon-question" />
</el-tooltip>
权限字符
</span>
@ -248,7 +248,6 @@ export default {
// id
removeDataById(id) {
// debugger
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -269,7 +268,6 @@ export default {
// -------------
add(row) {
debugger
this.typeDisabled = false
this.dialogTitle = '添加下级节点'
this.dialogVisible = true
@ -300,7 +298,6 @@ export default {
},
edit(row) {
debugger
this.dialogTitle = '修改节点'
this.dialogVisible = true

View File

@ -4,8 +4,8 @@
授权角色{{ $route.query.roleName }}
</div>
<el-tree
style="margin: 20px 0"
ref="tree"
style="margin: 20px 0"
:data="sysMenuList"
node-key="id"
show-checkbox
@ -14,14 +14,14 @@
/>
<div style="padding: 20px 20px;">
<el-button :loading="loading" type="primary" icon="el-icon-check" size="mini" @click="save">保存</el-button>
<el-button @click="$router.push('/system/sysRole')" size="mini" icon="el-icon-refresh-right">返回</el-button>
<el-button icon="el-icon-refresh-right" size="mini" @click="$router.push('/system/sysRole')">返回</el-button>
</div>
</div>
</template>
<script>
import api from '@/api/system/sysMenu'
export default {
name: 'roleAuth',
name: 'RoleAuth',
data() {
return {
@ -30,8 +30,8 @@ export default {
defaultProps: {
children: 'children',
label: 'name'
},
};
}
}
},
created() {
@ -56,7 +56,7 @@ export default {
/*
得到所有选中的id列表
*/
getCheckedIds (auths, initArr = []) {
getCheckedIds(auths, initArr = []) {
return auths.reduce((pre, item) => {
if (item.select && item.children.length === 0) {
pre.push(item.id)
@ -71,14 +71,13 @@ export default {
保存权限列表
*/
save() {
debugger
//
//const checkedNodes = this.$refs.tree.getCheckedNodes()
//
const allCheckedNodes = this.$refs.tree.getCheckedNodes(false, true);
let idList = allCheckedNodes.map(node => node.id);
//
// const checkedNodes = this.$refs.tree.getCheckedNodes()
//
const allCheckedNodes = this.$refs.tree.getCheckedNodes(false, true)
const idList = allCheckedNodes.map(node => node.id)
console.log(idList)
let assginMenuVo = {
const assginMenuVo = {
roleId: this.$route.query.id,
menuIdList: idList
}
@ -86,9 +85,9 @@ export default {
api.doAssign(assginMenuVo).then(result => {
this.loading = false
this.$message.success(result.$message || '分配权限成功')
this.$router.push('/system/sysRole');
this.$router.push('/system/sysRole')
})
}
}
};
}
</script>

View File

@ -220,7 +220,6 @@ export default {
},
// id
removeDataById(id) {
// debugger
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',

View File

@ -6,7 +6,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="关 键 字">
<el-input v-model="searchObj.keyword" placeholder="用户名/姓名/手机号码" style="width: 95%"/>
<el-input v-model="searchObj.keyword" placeholder="用户名/姓名/手机号码" style="width: 95%" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -63,11 +63,11 @@
</template>
</el-table-column>
<el-table-column label="用户名" prop="username" width="100"/>
<el-table-column label="姓名" prop="name" width="70"/>
<el-table-column label="手机" prop="phone" width="120"/>
<el-table-column label="岗位" prop="postName" width="100"/>
<el-table-column label="部门" prop="deptName" width="100"/>
<el-table-column label="用户名" prop="username" width="100" />
<el-table-column label="姓名" prop="name" width="70" />
<el-table-column label="手机" prop="phone" width="120" />
<el-table-column label="岗位" prop="postName" width="100" />
<el-table-column label="部门" prop="deptName" width="100" />
<el-table-column label="所属角色" width="130">
<template slot-scope="scope">
<span v-for="item in scope.row.roleList" :key="item.id" style="margin-right: 10px;">{{ item.roleName }}</span>
@ -81,7 +81,7 @@
/>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" width="160"/>
<el-table-column label="创建时间" prop="createTime" width="160" />
<el-table-column align="center" fixed="right" label="操作" width="180">
<template slot-scope="scope">
@ -128,16 +128,16 @@
<el-dialog :visible.sync="dialogVisible" title="添加/修改" width="40%">
<el-form ref="dataForm" :model="sysUser" label-width="100px" size="small" style="padding-right: 40px;">
<el-form-item label="用户名" prop="username">
<el-input v-model="sysUser.username"/>
<el-input v-model="sysUser.username" />
</el-form-item>
<el-form-item v-if="!sysUser.id" label="密码" prop="password">
<el-input v-model="sysUser.password" type="password"/>
<el-input v-model="sysUser.password" type="password" />
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="sysUser.name"/>
<el-input v-model="sysUser.name" />
</el-form-item>
<el-form-item label="手机" prop="phone">
<el-input v-model="sysUser.phone"/>
<el-input v-model="sysUser.phone" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -149,13 +149,13 @@
<el-dialog :visible.sync="dialogRoleVisible" title="分配角色">
<el-form label-width="80px">
<el-form-item label="用户名">
<el-input :value="sysUser.username" disabled/>
<el-input :value="sysUser.username" disabled />
</el-form-item>
<el-form-item label="角色列表">
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选
</el-checkbox>
<div style="margin: 15px 0;"/>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="userRoleIds" @change="handleCheckedChange">
<el-checkbox v-for="role in allRoles" :key="role.id" :label="role.id">{{ role.roleName }}</el-checkbox>
</el-checkbox-group>
@ -230,11 +230,10 @@ export default {
// banner
fetchData(page = 1) {
debugger
this.page = page
console.log('翻页。。。' + this.page)
if (this.createTimes && this.createTimes.length == 2) {
if (this.createTimes && this.createTimes.length === 2) {
this.searchObj.createTimeBegin = this.createTimes[0]
this.searchObj.createTimeEnd = this.createTimes[1]
}
@ -261,7 +260,6 @@ export default {
// id
removeDataById(id) {
// debugger
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -333,7 +331,7 @@ export default {
getRoles() {
roleApi.getRoles(this.sysUser.id).then(response => {
const {allRolesList, assginRoleList} = response.data
const { allRolesList, assginRoleList } = response.data
this.allRoles = allRolesList
this.userRoleIds = assginRoleList.map(item => item.id)
this.checkAll = allRolesList.length === assginRoleList.length
@ -355,7 +353,7 @@ export default {
角色列表选中项发生改变的监听
*/
handleCheckedChange(value) {
const {userRoleIds, allRoles} = this
const { userRoleIds, allRoles } = this
this.checkAll = userRoleIds.length === allRoles.length && allRoles.length > 0
this.isIndeterminate = userRoleIds.length > 0 && userRoleIds.length < allRoles.length
},