验证,样式调整等

This commit is contained in:
吕金泽 2022-02-05 17:20:12 +08:00
parent 854a860aa7
commit 0edba9b3cc
16 changed files with 167 additions and 85 deletions

View File

@ -5,7 +5,7 @@
"groupId" : "c7ce65f5b3cf4aaa913f6fec7d35d176",
"name" : "保存",
"createTime" : null,
"updateTime" : 1634734554311,
"updateTime" : 1644046408348,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -23,4 +23,8 @@
}
}
================================
var typeCount = db.selectInt("select count(1) from sys_dict where is_del = 0 and type = #{data.type} ?{id, and id != #{data.id}}")
if(typeCount > 0){
exit 0,'类型已存在'
}
return db.table("sys_dict").primary("id").saveOrUpdate(data)

View File

@ -5,7 +5,7 @@
"groupId" : "376f26eb43a44a3daeafd27020a96f48",
"name" : "保存",
"createTime" : null,
"updateTime" : 1634735495162,
"updateTime" : 1644046552214,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -23,4 +23,8 @@
}
}
================================
var valueCount = db.selectInt("select count(1) from sys_dict_items where is_del = 0 and dict_id = #{data.dictId} and value = #{data.value} ?{id, and id != #{data.id}}")
if(valueCount > 0){
exit 0,'值已存在'
}
return db.table("sys_dict_items").primary("id").saveOrUpdate(data)

View File

@ -5,7 +5,7 @@
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
"name" : "保存",
"createTime" : null,
"updateTime" : 1643710594405,
"updateTime" : 1644046192172,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -24,6 +24,11 @@
import cn.dev33.satoken.secure.SaSecureUtil;
import org.ssssssss.magicapi.cache.SqlCache
var usernameCount = db.selectInt("select count(1) from sys_user where is_del = 0 and username = #{username} ?{id, and id != #{id}}")
if(usernameCount > 0){
exit 0,'登录名称已存在'
}
password = password ? SaSecureUtil.sha256(password) : ''
var user = {
id,

View File

@ -5,7 +5,7 @@
"groupId" : "8295fc13678d4144bf7363c465247a50",
"name" : "保存",
"createTime" : null,
"updateTime" : 1641732020139,
"updateTime" : 1644046432007,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -23,4 +23,8 @@
}
}
================================
var codeCount = db.selectInt("select count(1) from sys_office where is_del = 0 and code = #{code} ?{id, and id != #{id}}")
if(codeCount > 0){
exit 0,'机构编码已存在'
}
return db.table("sys_office").primary("id").saveOrUpdate(data);

View File

@ -5,7 +5,7 @@
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "保存",
"createTime" : null,
"updateTime" : 1641219427227,
"updateTime" : 1644031443910,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -26,6 +26,19 @@
import org.ssssssss.magicapi.cache.SqlCache;
import '@get:/menu/cache/delete' as cacheDelete;
if(data.url){
var urlCount = db.selectInt("select count(1) from sys_menu where is_del = 0 and url = #{data.url} ?{data.id, and id != #{data.id}}")
if(urlCount > 0){
exit 0,'菜单链接已存在'
}
}
if(data.permission){
var permissionCount = db.selectInt("select count(1) from sys_menu where is_del = 0 and permission = #{data.permission} ?{data.id, and id != #{data.id}}")
if(permissionCount > 0){
exit 0,'权限标识已存在'
}
}
SqlCache.delete('permissions:1')
if(data.id){
var menuId = data.id

View File

@ -5,7 +5,7 @@
"groupId" : "89130d496f6f467c88b22ae4a7f688eb",
"name" : "保存",
"createTime" : null,
"updateTime" : 1642326331841,
"updateTime" : 1644046445441,
"lock" : "0",
"method" : "POST",
"path" : "/save",
@ -25,6 +25,11 @@
================================
import '@get:/role/cache/delete' as cacheDelete
var codeCount = db.selectInt("select count(1) from sys_role where is_del = 0 and code = #{code} ?{id, and id != #{id}}")
if(codeCount > 0){
exit 0,'角色编码已存在'
}
var role = {
code,
permission,

View File

@ -36,6 +36,10 @@ export default {
where: {
type: Object,
default: () => {}
},
notReset: {
type: String,
default: ''
}
},
data() {
@ -69,10 +73,12 @@ export default {
},
reset() {
for(var key in this.where){
if(this.where[key] instanceof Object){
this.where[key].value = null
}else{
this.where[key] = null
if(this.notReset.indexOf(key) == -1){
if(this.where[key] instanceof Object){
this.where[key].value = null
}else{
this.where[key] = null
}
}
}
this.$nextTick(() => this.$emit('search'))

View File

@ -125,6 +125,7 @@ common.uuid = () => {
}
common.objAssign = (obj1, obj2, exclude) => {
exclude = exclude || ''
for (var o1 in obj1) {
for (var o2 in obj2) {
if (o1 === o2) {

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<mb-search :where="tableOptions.where" @search="reloadTable" />
<mb-search :where="tableOptions.where" @search="reloadTable" not-reset="dictId" />
<el-row class="toolbar-container">
<el-button v-permission="'dict:items:save'" class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
@ -11,21 +11,33 @@
<mb-table ref="table" v-bind="tableOptions" />
<mb-dialog ref="formDialog" :title="dialogTitle" width="700px" @confirm-click="save($event)">
<mb-dialog ref="formDialog" :title="dialogTitle" width="640px" @confirm-click="save($event)">
<template #content>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="标签名" prop="label">
<el-input v-model="temp.label" />
</el-form-item>
<el-form-item label="值" prop="value">
<el-input v-model="temp.value" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="标签名" prop="label">
<el-input v-model="temp.label" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="值" prop="value">
<el-input v-model="temp.value" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
</mb-dialog>
@ -81,12 +93,14 @@ export default {
{
title: '操作',
type: 'btns',
width: 160,
fixed: 'right',
btns: [
{
permission: 'dict:items:save',
title: '修改',
type: 'primary',
type: 'text',
icon: 'el-icon-edit',
click: (row) => {
this.handleUpdate(row)
}
@ -94,7 +108,8 @@ export default {
{
permission: 'dict:items:delete',
title: '删除',
type: 'danger',
type: 'text',
icon: 'el-icon-delete',
click: (row) => {
this.$common.handleDelete({
url: 'dict/items/delete',

View File

@ -4,31 +4,47 @@
<mb-search :where="tableOptions.where" @search="reloadTable" />
<el-row class="toolbar-container">
<el-button v-permission="'dict:save'" class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">
<el-button v-permission="'dict:save'" class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
添加
</el-button>
</el-row>
<mb-table ref="table" v-bind="tableOptions" />
<mb-dialog ref="dictDialog" :title="dialogTitle" width="700px" @confirm-click="save($event)">
<mb-dialog ref="dictDialog" :title="dialogTitle" width="640px" @confirm-click="save($event)">
<template #content>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="100px" style="margin-left: 20px">
<el-form-item label="字典类型" prop="dictType">
<mb-select v-model="temp.dictType" type="dict_type" width="185px" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-input v-model="temp.type" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
<el-form-item label="描述" prop="descRibe">
<el-input v-model="temp.descRibe" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
<el-form ref="dataForm" :inline="true" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="字典类型" prop="dictType">
<mb-select v-model="temp.dictType" type="dict_type" width="185px" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型" prop="type">
<el-input v-model="temp.type" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="descRibe">
<el-input v-model="temp.descRibe" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
</mb-dialog>
@ -99,13 +115,14 @@ export default {
{
title: '操作',
type: 'btns',
width: 300,
width: 220,
fixed: 'right',
btns: [
{
permission: 'dict:save',
title: '修改',
type: 'primary',
type: 'text',
icon: 'el-icon-edit',
click: (row) => {
this.handleUpdate(row)
}
@ -113,7 +130,8 @@ export default {
{
permission: 'dict:delete',
title: '删除',
type: 'danger',
type: 'text',
icon: 'el-icon-delete',
click: (row) => {
this.$common.handleDelete({
url: 'dict/delete',
@ -128,7 +146,8 @@ export default {
{
permission: 'dict:items',
title: '字典项',
type: 'primary',
type: 'text',
icon: 'el-icon-menu',
click: (row) => {
this.$refs.dictItemsDialog.show()
this.dictId = row.id

View File

@ -6,7 +6,7 @@
<template>
<div>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" style="width: 900px; margin-left:50px;">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="菜单类型" prop="type">
@ -169,7 +169,7 @@ export default {
d.hideLoading()
this.$notify({
title: '成功',
message: (this.dialogStatus === 'create' ? '创建' : '修改') + '成功',
message: d.title + '成功',
type: 'success',
duration: 2000
})

View File

@ -24,7 +24,7 @@
<mb-table ref="table" v-bind="tableOptions" v-if="menuData && menuData.length > 0 && refreshTable" />
<mb-dialog ref="menuFormDialog" width="1050px" :title="dialogTitle" @confirm-click="$refs.menuForm.save($event)">
<mb-dialog ref="menuFormDialog" width="950px" :title="dialogTitle" @confirm-click="$refs.menuForm.save($event)">
<template #content>
<menu-form ref="menuForm" :menu-tree="menuTree" @reload-table="reloadTable" />
</template>
@ -162,7 +162,7 @@ export default {
}
},
{
title: '编辑',
title: '修改',
type: 'text',
icon: 'el-icon-edit',
click: (row) => {

View File

@ -21,8 +21,8 @@
</el-form>
</div>
<el-row style="margin-bottom: 5px">
<el-button class="filter-item" style="margin-bottom:10px;" type="primary" icon="el-icon-edit" @click="addSubOffice('0')">
<el-row class="toolbar-container">
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="addSubOffice('0')">
添加机构
</el-button>
<el-button type="primary" icon="el-icon-sort" plain @click="expand">展开/折叠</el-button>
@ -30,9 +30,9 @@
<mb-table ref="table" v-bind="tableOptions" v-if="officeData && officeData.length > 0 && refreshTable" />
<mb-dialog ref="officeFormDialog" width="1050px" :title="dialogTitle" @confirm-click="save($event)">
<mb-dialog ref="officeFormDialog" width="700px" :title="dialogTitle" @confirm-click="save($event)">
<template #content>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" style="width: 900px; margin-left:50px;">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="机构类型" prop="type">
@ -161,7 +161,7 @@ export default {
}
},
{
title: '编辑',
title: '修改',
type: 'text',
icon: 'el-icon-edit',
click: (row) => {
@ -288,14 +288,14 @@ export default {
}
this.$post('office/save', this.temp).then(() => {
d.hideLoading()
this.reloadTable()
this.$refs.officeFormDialog.hide()
this.$notify({
title: '成功',
message: dialogTitle + '成功',
message: this.dialogTitle + '成功',
type: 'success',
duration: 2000
})
this.reloadTable()
this.$refs.officeFormDialog.hide()
}).catch(() => d.hideLoading())
}
})

View File

@ -11,9 +11,9 @@
<mb-table ref="table" v-bind="tableOptions" />
<mb-dialog ref="roleFormDialog" :title="dialogTitle" width="1000px" @confirm-click="save($event)">
<mb-dialog ref="roleFormDialog" :title="dialogTitle" width="900px" @confirm-click="save($event)">
<template #content>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="120px" style="width: 900px;">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="角色名称" prop="name">
@ -41,13 +41,13 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="菜单权限" prop="menus">
<mb-tree ref="tree" :el="{ 'show-checkbox': true }" max-height="320px" url="menu/tree" :search="true" :select-values.sync="temp.menus" />
<mb-tree ref="tree" :el="{ 'show-checkbox': true }" max-height="270px" url="menu/tree" :search="true" :select-values.sync="temp.menus" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据权限" prop="permission">
<mb-select v-model="temp.permission" :data="permissionData" />
<mb-tree v-if="temp.permission == 1" max-height="320px" :el="{ 'check-strictly': true, 'show-checkbox': true }" ref="office" url="office/tree" :select-values.sync="temp.offices" />
<mb-tree v-if="temp.permission == 1" max-height="270px" :el="{ 'check-strictly': true, 'show-checkbox': true }" ref="office" url="office/tree" :select-values.sync="temp.offices" />
</el-form-item>
</el-col>
</el-row>

View File

@ -1,5 +1,5 @@
<template>
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" v-if="isForm">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="登录名称" prop="username">
@ -7,15 +7,15 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名/昵称" prop="name">
<el-input v-model="temp.name" autocomplete="new-password" />
<el-form-item label="密码" prop="password">
<el-input v-model="temp.password" type="password" autocomplete="new-password" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="密码" prop="password">
<el-input v-model="temp.password" type="password" autocomplete="new-password" />
<el-form-item label="姓名/昵称" prop="name">
<el-input v-model="temp.name" autocomplete="new-password" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -52,12 +52,6 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'UserForm',
components: { Treeselect },
props: {
dialogTitle: {
type: String,
default: ''
}
},
data() {
return {
rules: {
@ -66,7 +60,8 @@ export default {
officeId: [{ required: true, message: '请选择组织机构', trigger: 'change' }]
},
temp: this.getTemp(),
officeTree: []
officeTree: [],
isForm: true
}
},
created() {
@ -89,9 +84,14 @@ export default {
}
},
resetTemp() {
this.isForm = false
this.rules.password = [{ required: true, message: '请输入密码', trigger: 'change' }]
this.temp = this.getTemp()
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
this.isForm = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
})
},
save(d) {
@ -106,7 +106,7 @@ export default {
d.hideLoading()
this.$notify({
title: '成功',
message: this.dialogTitle + '成功',
message: d.title + '成功',
type: 'success',
duration: 2000
})
@ -116,6 +116,11 @@ export default {
})
},
getInfo(row) {
this.isForm = false
delete this.rules.password
this.$nextTick(() => {
this.isForm = true
})
for (var t in this.temp) {
if (t !== 'roles') {
this.temp[t] = row[t]

View File

@ -34,9 +34,9 @@
<mb-table ref="table" v-bind="tableOptions" @selection-change="selectionChange" />
<mb-dialog ref="userFormDialog" :title="dialogTitle" @confirm-click="$refs.userForm.save($event)" width="770px">
<mb-dialog ref="userFormDialog" :title="dialogTitle" @confirm-click="$refs.userForm.save($event)" width="670px">
<template #content>
<user-form ref="userForm" :dialog-status="dialogTitle" @reload-table="reloadTable" />
<user-form ref="userForm" @reload-table="reloadTable" />
</template>
</mb-dialog>
</div>
@ -125,13 +125,14 @@ export default {
{
title: '操作',
type: 'btns',
width: 200,
width: 140,
fixed: 'right',
btns: [
{
permission: 'user:save',
title: '修改',
type: 'primary',
type: 'text',
icon: 'el-icon-edit',
click: (row) => {
this.handleUpdate(row)
}
@ -139,7 +140,8 @@ export default {
{
permission: 'user:delete',
title: '删除',
type: 'danger',
type: 'text',
icon: 'el-icon-delete',
click: (row) => {
this.$common.handleDelete({
url: 'user/delete',
@ -167,7 +169,6 @@ export default {
},
methods: {
checkChange(values) {
console.log(values)
this.tableOptions.where.officeId = values
this.$nextTick(() => this.reloadTable())
},