mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 20:35:29 +08:00
Jeecg-Boot 2.2.0 版本发布 | 重磅升级
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-card :loading="cardLoading" :bordered="false" style="height: 100%;">
|
||||
<a-spin :spinning="loading">
|
||||
<a-input-search @search="handleSearch" style="width:100%;margin-top: 10px" placeholder="输入机构名称查询..." allowClear enterButton />
|
||||
<a-input-search @search="handleSearch" style="width:100%;margin-top: 10px" placeholder="输入机构名称查询..." enterButton />
|
||||
|
||||
<a-tree
|
||||
showLine
|
||||
|
||||
@ -40,7 +40,11 @@
|
||||
<a-button style="float: right" @click="handleSubmit" type="primary" htmlType="button" icon="form">保存</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else style="height:330px;"><h3>请先选择一个部门!</h3></div>
|
||||
<a-card v-else :bordered="false" style="height:200px">
|
||||
<a-empty>
|
||||
<span slot="description"> 请先选择一个部门! </span>
|
||||
</a-empty>
|
||||
</a-card>
|
||||
<depart-datarule-modal ref="datarule"/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
multiple
|
||||
treeCheckable="tree"
|
||||
checkable
|
||||
@expand="onExpand"
|
||||
:expandedKeys="expandedKeysss"
|
||||
:checkedKeys="checkedKeys"
|
||||
allowClear="true"
|
||||
:checkStrictly="true"
|
||||
@ -45,6 +47,7 @@
|
||||
data () {
|
||||
return {
|
||||
checkedKeys:[], // 存储选中的部门id
|
||||
expandedKeysss:[],//展开的节点
|
||||
userId:"", // 存储用户id
|
||||
model:{}, // 存储SysUserDepartsVO表
|
||||
userDepartModel:{userId:'',departIdList:[]}, // 存储用户id一对多部门信息的对象
|
||||
@ -146,9 +149,27 @@
|
||||
queryIdTree().then((res)=>{
|
||||
if(res.success){
|
||||
this.departTree = res.result;
|
||||
if(this.checkedKeys&&this.checkedKeys.length >0){
|
||||
let treekey=[];
|
||||
let arr=res.result;
|
||||
if(arr&&arr.length>0){
|
||||
arr.forEach(item => {
|
||||
treekey.push(item.key);
|
||||
/* if(item.children&&item.children.length>0){
|
||||
item.children.forEach(item1 => {
|
||||
treekey.push(item1.key);
|
||||
})
|
||||
}*/
|
||||
})
|
||||
this.expandedKeysss = treekey
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onExpand(expandedKeys){
|
||||
this.expandedKeysss = expandedKeys;
|
||||
},
|
||||
modalFormOk(){
|
||||
|
||||
}
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
<div class="drawer-bootom-button">
|
||||
<a-dropdown style="float: left" :trigger="['click']" placement="topCenter">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>
|
||||
<a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>
|
||||
<a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
|
||||
<a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
|
||||
<a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
|
||||
@ -75,7 +77,7 @@
|
||||
expandedKeysss:[],
|
||||
allTreeKeys:[],
|
||||
autoExpandParent: true,
|
||||
checkStrictly: false,
|
||||
checkStrictly: true,
|
||||
title:"部门角色权限配置",
|
||||
visible: false,
|
||||
loading: false,
|
||||
@ -83,16 +85,25 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchCheckStrictly (v) {
|
||||
if(v==1){
|
||||
this.checkStrictly = false
|
||||
}else if(v==2){
|
||||
this.checkStrictly = true
|
||||
}
|
||||
},
|
||||
onTreeNodeSelect(id){
|
||||
if(id && id.length>0){
|
||||
this.selectedKeys = id
|
||||
}
|
||||
this.$refs.datarule.show(this.selectedKeys[0],this.departId,this.roleId)
|
||||
},
|
||||
onCheck (checkedKeys, { halfCheckedKeys }) {
|
||||
// 保存选中的和半选中的,后面保存的时候合并提交
|
||||
this.checkedKeys = checkedKeys
|
||||
this.halfCheckedKeys = halfCheckedKeys
|
||||
onCheck (o) {
|
||||
if(this.checkStrictly){
|
||||
this.checkedKeys = o.checked;
|
||||
}else{
|
||||
this.checkedKeys = o
|
||||
}
|
||||
},
|
||||
show(roleId,departId){
|
||||
this.departId = departId
|
||||
@ -131,11 +142,9 @@
|
||||
},
|
||||
handleSubmit(exit) {
|
||||
let that = this;
|
||||
let checkedKeys = [...that.checkedKeys, ...that.halfCheckedKeys]
|
||||
const permissionIds = checkedKeys.join(",")
|
||||
let params = {
|
||||
roleId:that.roleId,
|
||||
permissionIds,
|
||||
permissionIds:that.checkedKeys.join(","),
|
||||
lastpermissionIds:that.defaultCheckedKeys.join(","),
|
||||
};
|
||||
that.loading = true;
|
||||
@ -170,22 +179,9 @@
|
||||
queryTreeListForDeptRole({departId:this.departId}).then((res) => {
|
||||
this.treeData = res.result.treeList
|
||||
this.allTreeKeys = res.result.ids
|
||||
const keyLeafPairs = this.convertTreeListToKeyLeafPairs(this.treeData)
|
||||
queryDeptRolePermission({roleId:this.roleId}).then((res)=>{
|
||||
// 过滤出 leaf node 即可,即选中的
|
||||
// Tree组件中checkStrictly默认为false的时候,选中子节点,父节点会自动设置选中或半选中
|
||||
// 保存 checkedKeys 以及 halfCheckedKeys 以便于未做任何操作时提交表单数据
|
||||
const checkedKeys = [...res.result].filter(key => {
|
||||
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
|
||||
return keyLeafPair && keyLeafPair.isLeaf
|
||||
})
|
||||
const halfCheckedKeys = [...res.result].filter(key => {
|
||||
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
|
||||
return keyLeafPair && !keyLeafPair.isLeaf
|
||||
})
|
||||
this.checkedKeys = [...checkedKeys];
|
||||
this.halfCheckedKeys = [...halfCheckedKeys]
|
||||
this.defaultCheckedKeys = [...halfCheckedKeys, ...checkedKeys];
|
||||
this.checkedKeys = [...res.result];
|
||||
this.defaultCheckedKeys = [...res.result];
|
||||
this.expandedKeysss = this.allTreeKeys;
|
||||
})
|
||||
})
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator" :md="24" :sm="24">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">部门角色录入</a-button>
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新建部门角色</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
@ -55,18 +55,15 @@
|
||||
更多 <a-icon type="down"/>
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handlePerssion(record)">授权</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="handlePerssion(record)">授权</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
</a-table>
|
||||
@ -132,9 +129,7 @@
|
||||
methods: {
|
||||
searchReset() {
|
||||
this.queryParam = {}
|
||||
this.currentDeptId = '';
|
||||
this.loadData(1);
|
||||
this.$emit('clearSelectedDepartKeys')
|
||||
},
|
||||
loadData(arg) {
|
||||
if (!this.url.list) {
|
||||
|
||||
@ -166,7 +166,7 @@
|
||||
},
|
||||
/** 加载desform */
|
||||
loadDesformList() {
|
||||
getAction(this.url.getDeptRoleList, { departId: this.currentDeptId }).then((res) => {
|
||||
getAction(this.url.getDeptRoleList, { departId: this.currentDeptId, userId:this.userId }).then((res) => {
|
||||
if (res.success) {
|
||||
this.desformList = res.result
|
||||
var designName = [];
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
</div>
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator" :md="24" :sm="24" style="margin-top: -15px">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus" style="margin-top: 16px">用户录入</a-button>
|
||||
<!--<a-button @click="handleEdit" type="primary" icon="edit" style="margin-top: 16px">用户编辑</a-button>-->
|
||||
<a-button @click="handleAddUserDepart" type="primary" icon="plus">添加已有用户</a-button>
|
||||
<a-button @click="handleAdd" type="primary" icon="plus" style="margin-top: 16px">新建用户</a-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
@ -75,8 +75,12 @@
|
||||
更多 <a-icon type="down"/>
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleDeptRole(record)">分配部门角色</a>
|
||||
</a-menu-item>
|
||||
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleDetail(record)">详情</a>
|
||||
<a href="javascript:;" @click="handleDetail(record)">用户详情</a>
|
||||
</a-menu-item>
|
||||
|
||||
<a-menu-item>
|
||||
@ -84,9 +88,6 @@
|
||||
<a>取消关联</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleDeptRole(record)">分配部门角色</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
@ -124,15 +125,20 @@
|
||||
currentDeptId: '',
|
||||
// 表头
|
||||
columns: [{
|
||||
title: '用户账号',
|
||||
align: "center",
|
||||
dataIndex: 'username'
|
||||
},
|
||||
title: '用户账号',
|
||||
align: "center",
|
||||
dataIndex: 'username'
|
||||
},
|
||||
{
|
||||
title: '用户名称',
|
||||
align: "center",
|
||||
dataIndex: 'realname'
|
||||
},
|
||||
{
|
||||
title: '部门',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode'
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
align: "center",
|
||||
@ -143,17 +149,12 @@
|
||||
align: "center",
|
||||
dataIndex: 'phone'
|
||||
},
|
||||
{
|
||||
title: '部门',
|
||||
align: "center",
|
||||
dataIndex: 'orgCode'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
scopedSlots: {customRender: 'action'},
|
||||
align: "center",
|
||||
width: 170
|
||||
width: 150
|
||||
}],
|
||||
url: {
|
||||
list: "/sys/user/departUserList",
|
||||
@ -169,9 +170,7 @@
|
||||
methods: {
|
||||
searchReset() {
|
||||
this.queryParam = {}
|
||||
this.currentDeptId = '';
|
||||
this.loadData(1);
|
||||
this.$emit('clearSelectedDepartKeys')
|
||||
},
|
||||
loadData(arg) {
|
||||
if (!this.url.list) {
|
||||
@ -315,8 +314,12 @@
|
||||
})
|
||||
},
|
||||
handleDeptRole(record){
|
||||
this.$refs.deptRoleUser.add(record,this.currentDeptId);
|
||||
this.$refs.deptRoleUser.title = "部门角色分配";
|
||||
if(this.currentDeptId != ''){
|
||||
this.$refs.deptRoleUser.add(record,this.currentDeptId);
|
||||
this.$refs.deptRoleUser.title = "部门角色分配";
|
||||
}else{
|
||||
this.$message.warning("请先选择一个部门!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,14 +15,14 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="名称">
|
||||
<a-input placeholder="请输入名称" v-decorator="['itemText', validatorRules.itemText]"/>
|
||||
<a-input placeholder="请输入名称" v-decorator.trim="['itemText', validatorRules.itemText]"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="数据值">
|
||||
<a-input placeholder="请输入数据值" v-decorator="['itemValue', validatorRules.itemValue]"/>
|
||||
<a-input placeholder="请输入数据值" v-decorator.trim="['itemValue', validatorRules.itemValue]"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
|
||||
@ -15,14 +15,14 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="字典名称">
|
||||
<a-input placeholder="请输入字典名称" v-decorator="[ 'dictName', validatorRules.dictName]"/>
|
||||
<a-input placeholder="请输入字典名称" v-decorator.trim="[ 'dictName', validatorRules.dictName]"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="字典编码">
|
||||
<a-input placeholder="请输入字典编码" v-decorator="[ 'dictCode', validatorRules.dictCode]"/>
|
||||
<a-input placeholder="请输入字典编码" v-decorator.trim="[ 'dictCode', validatorRules.dictCode]"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
|
||||
@ -4,9 +4,8 @@
|
||||
:width="drawerWidth"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
:wrapStyle="{height: 'calc(100% - 108px)',overflow: 'auto',paddingBottom: '108px'}"
|
||||
>
|
||||
:confirmLoading="confirmLoading">
|
||||
|
||||
<div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
@ -76,7 +75,7 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="授权标识">
|
||||
<a-input placeholder="多个用逗号分隔, 如: user:list,user:create" v-decorator="[ 'perms', {}]" :readOnly="disableSubmit"/>
|
||||
<a-input placeholder="多个用逗号分隔, 如: user:list,user:create" v-decorator="[ 'perms', {rules:[{ required: false, message: '请输入授权标识!' },{validator: this.validatePerms }]}]" :readOnly="disableSubmit"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
@ -102,7 +101,7 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="菜单图标">
|
||||
<a-input placeholder="点击右侧按钮选择图标" v-model="model.icon" :readOnly="disableSubmit">
|
||||
<a-input placeholder="点击选择图标" v-model="model.icon" :readOnly="disableSubmit">
|
||||
<a-icon slot="addonAfter" type="setting" @click="selectIcons" />
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
@ -175,11 +174,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addPermission,editPermission,queryTreeList} from '@/api/api'
|
||||
import {addPermission,editPermission,queryTreeList, duplicateCheck} from '@/api/api'
|
||||
import Icons from './icon/Icons'
|
||||
import pick from 'lodash.pick'
|
||||
|
||||
|
||||
export default {
|
||||
name: "PermissionModal",
|
||||
components: {Icons},
|
||||
@ -359,6 +357,26 @@
|
||||
callback("请输入正整数!");
|
||||
}
|
||||
},
|
||||
validatePerms(rule, value, callback){
|
||||
if(value && value.length>0){
|
||||
//校验授权标识是否存在
|
||||
var params = {
|
||||
tableName: 'sys_permission',
|
||||
fieldName: 'perms',
|
||||
fieldVal: value,
|
||||
dataId: this.model.id
|
||||
};
|
||||
duplicateCheck(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback()
|
||||
} else {
|
||||
callback("授权标识已存在!")
|
||||
}
|
||||
})
|
||||
}else{
|
||||
callback()
|
||||
}
|
||||
},
|
||||
onChangeMenuType(e) {
|
||||
//console.log('localMenuType checked', e.target.value)
|
||||
this.localMenuType=e.target.value
|
||||
|
||||
@ -47,12 +47,8 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="状态">
|
||||
<a-radio-group buttonStyle="solid" v-decorator="[ 'status', {'initialValue':0}]">
|
||||
<a-radio-button :value="0">正常</a-radio-button>
|
||||
<a-radio-button :value="-1">停止</a-radio-button>
|
||||
</a-radio-group>
|
||||
<j-dict-select-tag type="radioButton" v-decorator="[ 'status', {'initialValue':0}]" :trigger-change="true" dictCode="quartz_status"/>
|
||||
</a-form-item>
|
||||
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@ -72,6 +68,7 @@
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
buttonStyle: 'solid',
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="角色名称">
|
||||
<a-input placeholder="请输入角色名称" v-decorator="[ 'roleName', validatorRules.roleName]" />
|
||||
<a-input placeholder="请输入角色名称" v-decorator.trim="[ 'roleName', validatorRules.roleName]" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="角色编码">
|
||||
<a-input placeholder="请输入角色编码" :disabled="roleDisabled" v-decorator="[ 'roleCode', validatorRules.roleCode]" />
|
||||
<a-input placeholder="请输入角色编码" :disabled="roleDisabled" v-decorator.trim="[ 'roleCode', validatorRules.roleCode]" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
|
||||
@ -170,10 +170,11 @@
|
||||
this.edit(selectUser,userIds);
|
||||
},
|
||||
edit(selectUser,userIds){
|
||||
if(!userIds){
|
||||
this.selectedRowKeys = []
|
||||
}else{
|
||||
//控制台报错
|
||||
if(userIds&&userIds.length>0){
|
||||
this.selectedRowKeys = userIds.split(',');
|
||||
}else{
|
||||
this.selectedRowKeys = []
|
||||
}
|
||||
if(!selectUser){
|
||||
this.selectionRows=[]
|
||||
|
||||
@ -91,6 +91,14 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row style="width: 100%;">
|
||||
<a-col :span="24/2">
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="摘要">
|
||||
<a-textarea placeholder="请输入摘要" v-decorator="['msgAbstract',validatorRules.msgAbstract]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24/2">
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
@ -165,8 +173,9 @@
|
||||
title:{rules: [{ required: true, message: '请输入标题!' }]},
|
||||
msgCategory:{rules: [{ required: true, message: '请选择消息类型!' }]},
|
||||
msgType:{rules: [{ required: true, message: '请选择通告对象类型!' }]},
|
||||
endTime:{rules:[{validator: this.endTimeValidate}]},
|
||||
startTime:{rules:[{validator: this.startTimeValidate}]}
|
||||
endTime:{rules:[{ required: true, message: '请选择结束时间!'} ,{validator: this.endTimeValidate}]},
|
||||
startTime:{rules:[{required: true, message: '请选择开始时间!'},{validator: this.startTimeValidate}]},
|
||||
msgAbstract:{rules: [{ required: true, message: '请输入摘要!' }]},
|
||||
},
|
||||
url: {
|
||||
queryByIds: "/sys/user/queryByIds",
|
||||
@ -209,7 +218,7 @@
|
||||
});
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model,'endTime','startTime','titile','msgContent','sender','priority','msgCategory','msgType','sendStatus','delFlag'))
|
||||
this.form.setFieldsValue(pick(this.model,'endTime','startTime','titile','msgContent','sender','priority','msgCategory','msgType','sendStatus','delFlag','msgAbstract'))
|
||||
});
|
||||
},
|
||||
close () {
|
||||
@ -219,6 +228,11 @@
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
//当设置指定用户类型,但用户为空时,后台报错
|
||||
if(this.userType &&!(this.userIds!=null && this.userIds.length >0)){
|
||||
this.$message.warning('指定用户不能为空!')
|
||||
return;
|
||||
}
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
@ -241,6 +255,7 @@
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
that.resetUser();
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
</j-tree-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input v-decorator="[ 'name', validatorRules.name]" placeholder="请输入类型名称"></a-input>
|
||||
<a-form-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input v-decorator="[ 'name', validatorRules.name]" placeholder="请输入分类名称"></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<!--<a-form-item label="类型编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
@ -80,15 +80,16 @@
|
||||
}]
|
||||
},
|
||||
pid:{},
|
||||
name:{}
|
||||
name:{rules: [{ required: true, message: '请输入类型名称!' }]}
|
||||
},
|
||||
url: {
|
||||
add: "/sys/category/add",
|
||||
edit: "/sys/category/edit",
|
||||
checkCode:"/sys/category/checkCode"
|
||||
checkCode:"/sys/category/checkCode",
|
||||
},
|
||||
expandedRowKeys:[],
|
||||
pidField:"pid"
|
||||
pidField:"pid",
|
||||
subExpandedKeys:[]
|
||||
|
||||
}
|
||||
},
|
||||
@ -153,10 +154,13 @@
|
||||
let treeData = this.$refs.treeSelect.getCurrTreeData()
|
||||
this.expandedRowKeys=[]
|
||||
this.getExpandKeysByPid(formData[this.pidField],treeData,treeData)
|
||||
if(formData.pid && this.expandedRowKeys.length==0){
|
||||
this.expandedRowKeys = this.subExpandedKeys;
|
||||
}
|
||||
this.$emit('ok',formData,this.expandedRowKeys.reverse());
|
||||
}else{
|
||||
this.$emit('ok',formData);
|
||||
}
|
||||
}
|
||||
},
|
||||
getExpandKeysByPid(pid,arr,all){
|
||||
if(pid && arr && arr.length>0){
|
||||
|
||||
@ -14,14 +14,14 @@
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="数据源名称">
|
||||
<a-input placeholder="请输入数据源名称" v-decorator="['name', validatorRules.name]"/>
|
||||
label="数据源编码">
|
||||
<a-input placeholder="请输入数据源编码" :disabled="!!model.id" v-decorator="['code', validatorRules.code]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="数据源编码">
|
||||
<a-input placeholder="请输入数据源编码" :disabled="!!model.id" v-decorator="['code', validatorRules.code]"/>
|
||||
label="数据源名称">
|
||||
<a-input placeholder="请输入数据源名称" v-decorator="['name', validatorRules.name]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
@ -137,6 +137,14 @@
|
||||
'2': { dbDriver: 'oracle.jdbc.OracleDriver' },
|
||||
// SQLServer 数据库
|
||||
'3': { dbDriver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' },
|
||||
},
|
||||
dbUrlMap: {
|
||||
// MySQL 数据库
|
||||
'1': { dbUrl: 'jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false' },
|
||||
// Oracle
|
||||
'2': { dbUrl: 'jdbc:oracle:thin:@127.0.0.1:1521:ORCL' },
|
||||
// SQLServer 数据库
|
||||
'3': { dbUrl: 'jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=jeecgboot' }
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -216,9 +224,13 @@
|
||||
// 数据库类型更改时,联动更改数据库驱动
|
||||
handleDbTypeChange(val) {
|
||||
let dbDriver = this.dbDriverMap[val]
|
||||
let dbUrl = this.dbUrlMap[val]
|
||||
if (dbDriver) {
|
||||
this.form.setFieldsValue(dbDriver)
|
||||
}
|
||||
if (dbUrl) {
|
||||
this.form.setFieldsValue(dbUrl)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<a-form :form="form">
|
||||
|
||||
<a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入用户账号" v-decorator="[ 'username', validatorRules.username]" :readOnly="!!model.id"/>
|
||||
<a-input placeholder="请输入用户账号" v-decorator.trim="[ 'username', validatorRules.username]" :readOnly="!!model.id"/>
|
||||
</a-form-item>
|
||||
|
||||
<template v-if="!model.id">
|
||||
@ -37,11 +37,11 @@
|
||||
</template>
|
||||
|
||||
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
||||
<a-input placeholder="请输入用户姓名" v-decorator="[ 'realname', validatorRules.realname]" />
|
||||
<a-input placeholder="请输入用户姓名" v-decorator.trim="[ 'realname', validatorRules.realname]" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入工号" v-decorator="[ 'workNo', validatorRules.workNo]" />
|
||||
<a-input placeholder="请输入工号" v-decorator.trim="[ 'workNo', validatorRules.workNo]" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
@ -54,7 +54,8 @@
|
||||
style="width: 100%"
|
||||
placeholder="请选择用户角色"
|
||||
optionFilterProp = "children"
|
||||
v-model="selectedRole">
|
||||
v-model="selectedRole"
|
||||
:getPopupContainer= "(target) => target.parentNode">
|
||||
<a-select-option v-for="(role,roleindex) in roleList" :key="roleindex.toString()" :value="role.id">
|
||||
{{ role.roleName }}
|
||||
</a-select-option>
|
||||
@ -64,9 +65,9 @@
|
||||
<!--部门分配-->
|
||||
<a-form-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
|
||||
<a-input-search
|
||||
placeholder="点击右侧按钮选择部门"
|
||||
placeholder="点击选择部门"
|
||||
v-model="checkedDepartNameString"
|
||||
disabled
|
||||
readOnly
|
||||
@search="onSearch">
|
||||
<a-button slot="enterButton" icon="search">选择</a-button>
|
||||
</a-input-search>
|
||||
@ -104,11 +105,12 @@
|
||||
<a-date-picker
|
||||
style="width: 100%"
|
||||
placeholder="请选择生日"
|
||||
v-decorator="['birthday', {initialValue:!model.birthday?null:moment(model.birthday,dateFormat)}]"/>
|
||||
v-decorator="['birthday', {initialValue:!model.birthday?null:moment(model.birthday,dateFormat)}]"
|
||||
:getCalendarContainer="node => node.parentNode"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-select v-decorator="[ 'sex', {}]" placeholder="请选择性别">
|
||||
<a-select v-decorator="[ 'sex', {}]" placeholder="请选择性别" :getPopupContainer= "(target) => target.parentNode">
|
||||
<a-select-option :value="1">男</a-select-option>
|
||||
<a-select-option :value="2">女</a-select-option>
|
||||
</a-select>
|
||||
@ -248,7 +250,6 @@
|
||||
picUrl: "",
|
||||
url: {
|
||||
fileUpload: window._CONFIG['domianURL']+"/sys/common/upload",
|
||||
imgerver: window._CONFIG['staticDomainURL'],
|
||||
userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
|
||||
userId:"/sys/user/generateUserId", // 引入生成添加用户情况下的url
|
||||
syncUserByUserName:"/process/extActProcess/doSyncUserByUserName",//同步用户到工作流
|
||||
@ -332,7 +333,7 @@
|
||||
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone','activitiSync','workNo','telephone','post'))
|
||||
});
|
||||
//身份为上级显示负责部门,否则不显示
|
||||
if(this.model.identity=="2"){
|
||||
if(this.model.userIdentity=="2"){
|
||||
this.identity="2";
|
||||
this.departIdShow=true;
|
||||
}else{
|
||||
@ -406,10 +407,14 @@
|
||||
values.birthday = values.birthday.format(this.dateFormat);
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
formData.avatar = that.fileList;
|
||||
if(that.fileList != ''){
|
||||
formData.avatar = that.fileList;
|
||||
}else{
|
||||
formData.avatar = null;
|
||||
}
|
||||
formData.selectedroles = this.selectedRole.length>0?this.selectedRole.join(","):'';
|
||||
formData.selecteddeparts = this.userDepartModel.departIdList.length>0?this.userDepartModel.departIdList.join(","):'';
|
||||
formData.identity=this.identity;
|
||||
formData.userIdentity=this.identity;
|
||||
//如果是上级择传入departIds,否则为空
|
||||
if(this.identity==="2"){
|
||||
formData.departIds=this.departIds.join(",");
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { putAction,deleteAction,getFileAccessHttpUrl } from "@/api/manage"
|
||||
|
||||
// 高度封装的请求,请务必使用 superRequest.call(this,{}) 的方式调用
|
||||
function superRequest(options) {
|
||||
@ -95,9 +96,11 @@
|
||||
{ title: '操作', align: 'center', dataIndex: 'action', width: 200, scopedSlots: { customRender: 'action' } }
|
||||
],
|
||||
url: {
|
||||
getAvatar: (path) => `window._CONFIG['staticDomainURL']/${path}`,
|
||||
getAvatar: (path) => getFileAccessHttpUrl(`${path}`),
|
||||
// 回收站操作,get = 获取列表;put = 取回;delete = 彻底删除
|
||||
recycleBin: '/sys/user/recycleBin',
|
||||
putRecycleBin: '/sys/user/putRecycleBin',
|
||||
deleteRecycleBin: '/sys/user/deleteRecycleBin',
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -137,10 +140,8 @@
|
||||
content: `您确定要恢复这 ${userIds.length} 个用户吗?`,
|
||||
centered: true,
|
||||
onOk: () => {
|
||||
superRequest.call(this, {
|
||||
loading: true,
|
||||
promise: this.$http.put(this.url.recycleBin, userIds),
|
||||
success: () => {
|
||||
putAction(this.url.putRecycleBin,{userIds:userIds.join(',')}).then((res)=>{
|
||||
if(res.success){
|
||||
this.handleOk()
|
||||
this.handleClearSelection()
|
||||
this.$message.success(`还原 ${userIds.length} 个用户成功!`)
|
||||
@ -159,15 +160,16 @@
|
||||
</div>),
|
||||
centered: true,
|
||||
onOk: () => {
|
||||
superRequest.call(this, {
|
||||
loading: true,
|
||||
promise: this.$http.delete(this.url.recycleBin + `?userIds=${userIds.join(',')}`),
|
||||
success: () => {
|
||||
var that = this;
|
||||
deleteAction(that.url.deleteRecycleBin, {userIds: userIds.join(',')}).then((res) => {
|
||||
if (res.success) {
|
||||
this.loadData()
|
||||
this.handleClearSelection()
|
||||
this.$message.success(`彻底删除 ${userIds.length} 个用户成功!`)
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
@ -169,7 +169,7 @@
|
||||
this.checkedKeys = [...res.result];
|
||||
this.defaultCheckedKeys = [...res.result];
|
||||
this.expandedKeysss = this.allTreeKeys;
|
||||
//console.log(this.defaultCheckedKeys)
|
||||
console.log(this.defaultCheckedKeys)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user