提交 23718905 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 1a261b23
......@@ -9,6 +9,7 @@
}
>.ivu-card-extra {
.item-extract-mode {
display: flex;
.item {
margin-left: 12px;
}
......
......@@ -58,6 +58,18 @@ export default {
caption: "-",
tip: "",
},
tbitem24: {
caption: "行编辑",
tip: "行编辑",
},
tbitem25: {
caption: "新建行",
tip: "新建行",
},
tbitem26: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "Remove",
tip: "Remove {0}",
......
......@@ -57,6 +57,18 @@ export default {
caption: '-',
tip: '',
},
tbitem24: {
caption: '行编辑',
tip: '行编辑',
},
tbitem25: {
caption: '新建行',
tip: '新建行',
},
tbitem26: {
caption: '-',
tip: '',
},
tbitem8: {
caption: '删除',
tip: '删除',
......
<template>
<div class='view-container degridview ibzdept-member-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="ibzdeptmembergridview"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<p slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</p>
<card class='view-card view-no-caption' :dis-hover="true" :bordered="false">
<div class='content-container'>
<div class='view-top-messages'>
</div>
<div style='margin-bottom: 6px;'>
<i-input v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;' placeholder="请输入成员" />
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
......@@ -26,6 +22,20 @@
</i-button>
<div slot='content'>{{$t('entities.ibzdeptmember.gridviewtoolbar_toolbar.tbitem6.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem24.visabled" :disabled="toolBarModels.tbitem24.disabled" class='' @click="toolbar_click({ tag: 'tbitem24' }, $event)">
<i class='fa fa-table'></i>
<span class='caption'>{{$t('entities.ibzdeptmember.gridviewtoolbar_toolbar.tbitem24.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzdeptmember.gridviewtoolbar_toolbar.tbitem24.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem25.visabled" :disabled="toolBarModels.tbitem25.disabled" class='' @click="toolbar_click({ tag: 'tbitem25' }, $event)">
<i class='fa fa-plus'></i>
</i-button>
<div slot='content'>{{$t('entities.ibzdeptmember.gridviewtoolbar_toolbar.tbitem25.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem8.visabled" :disabled="toolBarModels.tbitem8.disabled" class='' @click="toolbar_click({ tag: 'tbitem8' }, $event)">
<i class='fa fa-remove'></i>
......@@ -46,14 +56,14 @@
:context="context"
:isSingleSelect="isSingleSelect"
:showBusyIndicator="true"
:isOpenEdit="false"
:isOpenEdit="true"
:gridRowActiveMode="gridRowActiveMode"
@save="onSave"
updateAction=""
updateAction="Update"
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
fetchAction="FetchDefault"
:newdata="newdata"
:opendata="opendata"
......@@ -266,6 +276,11 @@ export default class IBZDeptMemberGridViewBase extends Vue {
tbitem6: { name: 'tbitem6', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem24: { name: 'tbitem24', caption: '行编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleRowEdit', target: '' } },
tbitem25: { name: 'tbitem25', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'NewRow', target: '' } },
tbitem26: { name: 'tbitem26', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem8: { name: 'tbitem8', caption: '删除', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY' } },
tbitem9: { name: 'tbitem9', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
......
import { Http,Util } from '@/utils';
import EntityService from '../entity-service';
import SaveDeptMemberLogic from '@/service/ibzemployee/save-dept-member-logic';
......
import IBZDeptMemberService from '@/service/ibzdept-member/ibzdept-member-service';
import { Verify } from '@/utils/verify/verify';
/**
* 保存人事关系
*
* @export
* @class SaveDeptMemberLogicBase
*/
export default class SaveDeptMemberLogicBase {
/**
* 名称
*
* @memberof SaveDeptMemberLogicBase
*/
private name:string ="saveDeptMember";
/**
* 唯一标识
*
* @memberof SaveDeptMemberLogicBase
*/
private id:string = "E3FF4728-CD18-4940-BAEF-8A71111A5D05";
/**
* 默认参数名称
*
* @memberof SaveDeptMemberLogicBase
*/
private defaultParamName:string = "Default";
/**
* Creates an instance of SaveDeptMemberLogicBase.
*
* @param {*} [opts={}]
* @memberof SaveDeptMemberLogicBase
*/
constructor(opts: any = {}) {
}
/**
* 计算0节点结果
*
* @param params 传入参数
*/
public compute0Cond(params:any):boolean{
return true;
}
/**
* 计算1节点结果
*
* @param params 传入参数
*/
public compute1Cond(params:any):boolean{
return true;
}
/**
* 执行逻辑
*
* @param context 应用上下文
* @param params 传入参数
*/
public onExecute(context:any,params:any,isloading:boolean){
return this.executeBegin(context,params,isloading);
}
/**
* 保存成员
*
* @param context 应用上下文
* @param params 传入参数
*/
private async executeDeaction1(context:any,params:any,isloading:boolean){
// 行为处理节点
let result: any;
const targetService:IBZDeptMemberService = new IBZDeptMemberService();
if (targetService['Save'] && targetService['Save'] instanceof Function) {
result = await targetService['Save'](context,params, false);
}
if(result && result.status == 200){
Object.assign(params,result.data);
return params;
}
}
/**
* 准备成员
*
* @param context 应用上下文
* @param params 传入参数
*/
private async executePrepareparam1(context:any,params:any,isloading:boolean){
// 准备参数节点
Object.assign(params,{deptid:params.mdeptid});
Object.assign(context,{ibzdeptmember:params.mdeptid});
Object.assign(params,{userid:params.userid});
Object.assign(context,{ibzdeptmember:params.userid});
if(this.compute1Cond(params)){
return this.executeDeaction1(context,params,isloading);
}
}
/**
* 开始
*
* @param params 传入参数
*/
private async executeBegin(context:any,params:any,isloading:boolean){
//开始节点
if(this.compute0Cond(params)){
return this.executePrepareparam1(context,params,isloading);
}
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import SaveDeptMemberLogicBase from './save-dept-member-logic-base';
/**
* 保存人事关系
*
* @export
* @class SaveDeptMemberLogic
*/
export default class SaveDeptMemberLogic extends SaveDeptMemberLogicBase{
/**
* Creates an instance of SaveDeptMemberLogic
*
* @param {*} [opts={}]
* @memberof SaveDeptMemberLogic
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
import { Store } from 'vuex';
import { Util } from '@/utils/util/util';
import CodeListService from "@service/app/codelist-service";
/**
* 部件服务基类
......@@ -26,6 +27,14 @@ export default class ControlService {
*/
public model: any | null = null;
/**
* 代码表服务对象
*
* @type {any}
* @memberof ControlService
*/
public codeListService:any;
/**
* 是否为从数据模式
*
......@@ -43,6 +52,7 @@ export default class ControlService {
constructor(opts: any = {}) {
this.$store = opts.$store;
this.setTempMode();
this.codeListService = new CodeListService({ $store:opts.$store });
}
/**
......@@ -118,31 +128,41 @@ export default class ControlService {
* @param {*} response
* @memberof ControlService
*/
public handleResponse(action: string, response: any,isCreate:boolean = false){
public async handleResponse(action: string, response: any,isCreate:boolean = false){
let result = null;
if (!response.data) {
return
} else if (response.data instanceof Array) {
result = [];
response.data.forEach((item:any) =>{
result.push(this.handleResponseData(action, item, isCreate));
});
}else{
result = this.handleResponseData(action, response.data, isCreate);
}
// response状态,头文件
if(response.headers){
if(response.headers['x-page']){
Object.assign(response,{page:Number(response.headers['x-page'])});
}
if(response.headers['x-per-page']){
Object.assign(response,{size:Number(response.headers['x-per-page'])});
const handleResult:any = (action: string, response: any,isCreate:boolean,codelistArray?:any) =>{
if (response.data instanceof Array) {
result = [];
response.data.forEach((item:any) =>{
result.push(this.handleResponseData(action, item, isCreate,codelistArray));
});
}else{
result = this.handleResponseData(action, response.data, isCreate,codelistArray);
}
if(response.headers['x-total']){
Object.assign(response,{total:Number(response.headers['x-total'])});
// response状态,头文件
if(response.headers){
if(response.headers['x-page']){
Object.assign(response,{page:Number(response.headers['x-page'])});
}
if(response.headers['x-per-page']){
Object.assign(response,{size:Number(response.headers['x-per-page'])});
}
if(response.headers['x-total']){
Object.assign(response,{total:Number(response.headers['x-total'])});
}
}
response.data = result;
}
let codelistModel:Array<any> = this.handleCodelist();
if(codelistModel.length >0){
let res:any = await this.getAllCodeList(codelistModel);
handleResult(action, response,isCreate,res);
}else{
handleResult(action, response,isCreate);
}
response.data = result;
}
/**
......@@ -152,7 +172,7 @@ export default class ControlService {
* @param {*} response
* @memberof ControlService
*/
public handleResponseData(action: string, data: any = {},isCreate?:boolean){
public handleResponseData(action: string, data: any = {},isCreate?:boolean,codelistArray?:any){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
......@@ -167,10 +187,13 @@ export default class ControlService {
if((isCreate === undefined || isCreate === null ) && Object.is(dataitem.dataType, 'GUID') && Object.is(dataitem.name, 'srfkey') && (val && !Object.is(val, ''))){
isCreate = true;
}
// if((Object.is(dataitem.dataType,'DATE') || Object.is(dataitem.dataType,'DATETIME')) && !Object.is(Date.parse(val),NaN)){
// val = Util.dateFormat(new Date(val));
// }
item[dataitem.name] = val;
// 转化代码表
if(codelistArray && dataitem.codelist){
if(codelistArray.get(dataitem.codelist.tag) && codelistArray.get(dataitem.codelist.tag).get(val)){
item[dataitem.name] = codelistArray.get(dataitem.codelist.tag).get(val);
}
}
});
item.srfuf = data.srfuf ? data.srfuf : (isCreate ? "0" : "1");
return item;
......@@ -199,4 +222,86 @@ export default class ControlService {
return requestData;
}
/**
* 处理代码表
*
* @memberof ControlService
*/
public handleCodelist(){
let model: any = this.getMode();
if (!model) {
return [];
}
let dataItems: any[] = model.getDataItems();
let codelistMap:Map<string,any> = new Map();
if(dataItems && dataItems.length >0){
dataItems.forEach((item:any) =>{
if(item.codelist){
codelistMap.set(item.name,item.codelist);
}
})
}
if(codelistMap.size >0){
return Array.from(codelistMap).map(item => item[1]);
}else{
return [];
}
}
/**
* 获取所有代码表
*
* @param codelistArray 代码表模型数组
* @memberof ControlService
*/
public getAllCodeList(codelistArray:Array<any>):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
let codeListMap:Map<string,any> = new Map();
let promiseArray:Array<any> = [];
codelistArray.forEach((item:any) =>{
if(!codeListMap.get(item.tag)){
promiseArray.push(this.getCodeList(item));
Promise.all(promiseArray).then((result:any) =>{
if(result && result.length >0){
result.forEach((codeList:any) =>{
let tempCodeListMap:Map<number,any> = new Map();
if(codeList.length >0){
codeList.forEach((codeListItem:any) =>{
tempCodeListMap.set(codeListItem.value,codeListItem.text);
})
}
codeListMap.set(item.tag,tempCodeListMap);
})
resolve(codeListMap);
}
})
}
})
})
}
/**
* 获取代码表
*
* @param codeListObject 传入代码表对象
* @memberof ControlService
*/
public getCodeList(codeListObject:any):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
if(codeListObject.tag && Object.is(codeListObject.codelistType,"STATIC")){
const codelist = (this.getStore() as Store<any>).getters.getCodeList(codeListObject.tag);
if (codelist) {
resolve([...JSON.parse(JSON.stringify(codelist.items))]);
} else {
console.log(`<#noparse>----${codeListObject.tag}----代码表不存在</#noparse>`);
}
}else if(codeListObject.tag && Object.is(codeListObject.codelistType,"DYNAMIC")){
this.codeListService.getItems(codeListObject.tag).then((res:any) => {
resolve(res);
}).catch((error:any) => {
console.log(`<#noparse>----${codeListObject.tag}----代码表不存在</#noparse>`);
});
}
})
}
}
\ No newline at end of file
......@@ -22,63 +22,63 @@
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('deptid')">
<el-table-column show-overflow-tooltip :prop="'deptid'" :label="$t('entities.ibzdepartment.main_grid.columns.deptid')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'deptid'" :label="$t('entities.ibzdepartment.main_grid.columns.deptid')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.deptid}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('deptcode')">
<el-table-column show-overflow-tooltip :prop="'deptcode'" :label="$t('entities.ibzdepartment.main_grid.columns.deptcode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'deptcode'" :label="$t('entities.ibzdepartment.main_grid.columns.deptcode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.deptcode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('deptname')">
<el-table-column show-overflow-tooltip :prop="'deptname'" :label="$t('entities.ibzdepartment.main_grid.columns.deptname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'deptname'" :label="$t('entities.ibzdepartment.main_grid.columns.deptname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.deptname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('shortname')">
<el-table-column show-overflow-tooltip :prop="'shortname'" :label="$t('entities.ibzdepartment.main_grid.columns.shortname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'shortname'" :label="$t('entities.ibzdepartment.main_grid.columns.shortname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.shortname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('deptlevel')">
<el-table-column show-overflow-tooltip :prop="'deptlevel'" :label="$t('entities.ibzdepartment.main_grid.columns.deptlevel')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'deptlevel'" :label="$t('entities.ibzdepartment.main_grid.columns.deptlevel')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.deptlevel}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('bcode')">
<el-table-column show-overflow-tooltip :prop="'bcode'" :label="$t('entities.ibzdepartment.main_grid.columns.bcode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'bcode'" :label="$t('entities.ibzdepartment.main_grid.columns.bcode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.bcode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('showorder')">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzdepartment.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzdepartment.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.showorder}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('createdate')">
<el-table-column show-overflow-tooltip :prop="'createdate'" :label="$t('entities.ibzdepartment.main_grid.columns.createdate')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'createdate'" :label="$t('entities.ibzdepartment.main_grid.columns.createdate')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.createdate"></app-format-data>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.ibzdepartment.main_grid.columns.updatedate')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.ibzdepartment.main_grid.columns.updatedate')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzdepartment.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzdepartment.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.deptcode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='deptcode' :itemRules="this.rules.deptcode" class='' :caption="$t('entities.ibzdepartment.newform_form.details.deptcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.deptcode.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -486,8 +486,8 @@ export default class NewFormBase extends Vue implements ControlInterface {
orgname: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
{ required: true, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
],
pdeptname: [
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'change' },
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzdeptmember.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzdeptmember.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.deptname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='deptname' :itemRules="this.rules.deptname" class='' :caption="$t('entities.ibzdeptmember.main_form.details.deptname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.deptname.error" :isEmptyCaption="false" labelPos="LEFT">
......
......@@ -22,14 +22,14 @@
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('deptname')">
<el-table-column show-overflow-tooltip :prop="'deptname'" :label="$t('entities.ibzdeptmember.main_grid.columns.deptname')" :width="250" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'deptname'" :label="$t('entities.ibzdeptmember.main_grid.columns.deptname')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.deptname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('personname')">
<el-table-column show-overflow-tooltip :prop="'personname'" :label="$t('entities.ibzdeptmember.main_grid.columns.personname')" :width="250" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'personname'" :label="$t('entities.ibzdeptmember.main_grid.columns.personname')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.personname}}</span>
</template>
......@@ -1281,6 +1281,117 @@ export default class MainBase extends Vue implements ControlInterface {
});
}
/**
* 新建行
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public newRow(args: any[], params?: any, $event?: any, xData?: any): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBZDeptMemberGridView视图表格loaddraftAction参数未配置' });
return;
}
let _this = this;
Object.assign(args[0],{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction, JSON.parse(JSON.stringify(this.context)), args[0], this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
data.rowDataState = "create";
_this.items.push(data);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 表格编辑项值变更
*
* @param row 行数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
public onGridItemValueChange(row: any,$event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !row.hasOwnProperty($event.name)) {
return;
}
row[$event.name] = $event.value;
this.gridEditItemChange(row, $event.name, $event.value);
}
/**
* 表格编辑项值变化
*
* @public
* @param row 行数据
* @param property 列编辑项名
* @param row 列编辑项值
* @returns {void}
* @memberof Main
*/
public gridEditItemChange(row: any, property: string, value: any){
row.rowDataState = row.rowDataState ? row.rowDataState : "update" ;
}
/**
* 表格编辑项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
public updateGridEditItem(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = JSON.parse(JSON.stringify(data));
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const _data: any = response.data;
if(!_data){
return;
}
updateDetails.forEach((name: string) => {
if (!_data.hasOwnProperty(name)) {
return;
}
data[name] = _data[name];
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 获取对应行class
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.changepw_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.changepw_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.oldpasswd.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='oldpasswd' :itemRules="this.rules.oldpasswd" class='' :caption="$t('entities.ibzemployee.changepw_form.details.oldpasswd')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.oldpasswd.error" :isEmptyCaption="false" labelPos="LEFT">
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.usercode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='usercode' :itemRules="this.rules.usercode" class='' :caption="$t('entities.ibzemployee.main_form.details.usercode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.usercode.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -25,7 +25,7 @@
</i-col>
<i-col v-show="detailsModel.grouppanel1.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.grouppanel1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.grouppanel1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.grouppanel1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.orgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzemployee.main_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -173,7 +173,7 @@
</i-col>
<i-col v-show="detailsModel.grouppanel2.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.grouppanel2.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.grouppanel2')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel2.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.main_form.details.grouppanel2')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
</row>
......@@ -668,8 +668,8 @@ export default class MainBase extends Vue implements ControlInterface {
mdeptname: [
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'blur' },
{ required: true, type: 'string', message: '部门 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '部门 值不能为空', trigger: 'blur' },
],
nickname: [
{ type: 'string', message: '昵称别名 值必须为字符串类型', trigger: 'change' },
......
......@@ -22,56 +22,56 @@
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('usercode')">
<el-table-column show-overflow-tooltip :prop="'usercode'" :label="$t('entities.ibzemployee.main_grid.columns.usercode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'usercode'" :label="$t('entities.ibzemployee.main_grid.columns.usercode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.usercode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('personname')">
<el-table-column show-overflow-tooltip :prop="'personname'" :label="$t('entities.ibzemployee.main_grid.columns.personname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'personname'" :label="$t('entities.ibzemployee.main_grid.columns.personname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.personname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('loginname')">
<el-table-column show-overflow-tooltip :prop="'loginname'" :label="$t('entities.ibzemployee.main_grid.columns.loginname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'loginname'" :label="$t('entities.ibzemployee.main_grid.columns.loginname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.loginname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('orgcode')">
<el-table-column show-overflow-tooltip :prop="'orgcode'" :label="$t('entities.ibzemployee.main_grid.columns.orgcode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orgcode'" :label="$t('entities.ibzemployee.main_grid.columns.orgcode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orgcode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('orgname')">
<el-table-column show-overflow-tooltip :prop="'orgname'" :label="$t('entities.ibzemployee.main_grid.columns.orgname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orgname'" :label="$t('entities.ibzemployee.main_grid.columns.orgname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orgname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('mdeptcode')">
<el-table-column show-overflow-tooltip :prop="'mdeptcode'" :label="$t('entities.ibzemployee.main_grid.columns.mdeptcode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'mdeptcode'" :label="$t('entities.ibzemployee.main_grid.columns.mdeptcode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.mdeptcode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('mdeptname')">
<el-table-column show-overflow-tooltip :prop="'mdeptname'" :label="$t('entities.ibzemployee.main_grid.columns.mdeptname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'mdeptname'" :label="$t('entities.ibzemployee.main_grid.columns.mdeptname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.mdeptname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('sex')">
<el-table-column show-overflow-tooltip :prop="'sex'" :label="$t('entities.ibzemployee.main_grid.columns.sex')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'sex'" :label="$t('entities.ibzemployee.main_grid.columns.sex')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<template >
<codelist :value="row.sex" tag='CLIBZSex' codelistType='STATIC' ></codelist>
......@@ -80,21 +80,21 @@
</el-table-column>
</template>
<template v-if="getColumnState('phone')">
<el-table-column show-overflow-tooltip :prop="'phone'" :label="$t('entities.ibzemployee.main_grid.columns.phone')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'phone'" :label="$t('entities.ibzemployee.main_grid.columns.phone')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.phone}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('ipaddr')">
<el-table-column show-overflow-tooltip :prop="'ipaddr'" :label="$t('entities.ibzemployee.main_grid.columns.ipaddr')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'ipaddr'" :label="$t('entities.ibzemployee.main_grid.columns.ipaddr')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.ipaddr}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('showorder')">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzemployee.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzemployee.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.showorder}}</span>
</template>
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzemployee.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.usercode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='usercode' :itemRules="this.rules.usercode" class='' :caption="$t('entities.ibzemployee.newform_form.details.usercode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.usercode.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -499,14 +499,14 @@ export default class NewFormBase extends Vue implements ControlInterface {
orgname: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
{ required: true, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
],
mdeptname: [
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'blur' },
{ required: true, type: 'string', message: '部门 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '部门 值不能为空', trigger: 'blur' },
],
enable: [
{ type: 'number', message: '逻辑有效 值必须为数值类型', trigger: 'change' },
......
......@@ -22,56 +22,56 @@
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('orgid')">
<el-table-column show-overflow-tooltip :prop="'orgid'" :label="$t('entities.ibzorganization.main_grid.columns.orgid')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orgid'" :label="$t('entities.ibzorganization.main_grid.columns.orgid')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orgid}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('orgcode')">
<el-table-column show-overflow-tooltip :prop="'orgcode'" :label="$t('entities.ibzorganization.main_grid.columns.orgcode')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orgcode'" :label="$t('entities.ibzorganization.main_grid.columns.orgcode')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orgcode}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('orgname')">
<el-table-column show-overflow-tooltip :prop="'orgname'" :label="$t('entities.ibzorganization.main_grid.columns.orgname')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orgname'" :label="$t('entities.ibzorganization.main_grid.columns.orgname')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orgname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('orglevel')">
<el-table-column show-overflow-tooltip :prop="'orglevel'" :label="$t('entities.ibzorganization.main_grid.columns.orglevel')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'orglevel'" :label="$t('entities.ibzorganization.main_grid.columns.orglevel')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.orglevel}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('shortname')">
<el-table-column show-overflow-tooltip :prop="'shortname'" :label="$t('entities.ibzorganization.main_grid.columns.shortname')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'shortname'" :label="$t('entities.ibzorganization.main_grid.columns.shortname')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.shortname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('showorder')">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzorganization.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.ibzorganization.main_grid.columns.showorder')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.showorder}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('createdate')">
<el-table-column show-overflow-tooltip :prop="'createdate'" :label="$t('entities.ibzorganization.main_grid.columns.createdate')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'createdate'" :label="$t('entities.ibzorganization.main_grid.columns.createdate')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.createdate"></app-format-data>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.ibzorganization.main_grid.columns.updatedate')" :width="200" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.ibzorganization.main_grid.columns.updatedate')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzorganization.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibzorganization.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.orgcode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orgcode' :itemRules="this.rules.orgcode" class='' :caption="$t('entities.ibzorganization.newform_form.details.orgcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgcode.error" :isEmptyCaption="false" labelPos="LEFT">
......
......@@ -150,7 +150,7 @@
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:IBZFILE,IBZUSER,IBZDATAAUDIT</diffExcludeObjects>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
......
package cn.ibizlab.core.ou.service.logic;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import cn.ibizlab.core.ou.domain.IBZEmployee;
/**
* 关系型数据实体[saveDeptMember] 对象
*/
public interface IIBZEmployeesaveDeptMemberLogic {
void execute(IBZEmployee ibzemployee ) ;
}
package cn.ibizlab.core.ou.service.logic.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer;
import cn.ibizlab.core.ou.service.logic.IIBZEmployeesaveDeptMemberLogic;
import cn.ibizlab.core.ou.domain.IBZEmployee;
/**
* 关系型数据实体[saveDeptMember] 对象
*/
@Slf4j
@Service
public class IBZEmployeesaveDeptMemberLogicImpl implements IIBZEmployeesaveDeptMemberLogic{
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.core.ou.service.IIBZDeptMemberService ibzdeptmemberservice;
public cn.ibizlab.core.ou.service.IIBZDeptMemberService getIbzdeptmemberService() {
return this.ibzdeptmemberservice;
}
@Autowired
private cn.ibizlab.core.ou.service.IIBZEmployeeService iBzSysDefaultService;
public cn.ibizlab.core.ou.service.IIBZEmployeeService getIBzSysDefaultService() {
return this.iBzSysDefaultService;
}
public void execute(IBZEmployee et){
KieSession kieSession = null;
try{
kieSession=kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("ibzemployeesavedeptmemberdefault",et);
cn.ibizlab.core.ou.domain.IBZDeptMember ibzemployeesavedeptmembermember =new cn.ibizlab.core.ou.domain.IBZDeptMember();
kieSession.insert(ibzemployeesavedeptmembermember);
kieSession.setGlobal("ibzemployeesavedeptmembermember",ibzemployeesavedeptmembermember);
kieSession.setGlobal("ibzdeptmemberservice",ibzdeptmemberservice);
kieSession.setGlobal("iBzSysIbzemployeeDefaultService",iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.core.ou.service.logic.ibzemployeesavedeptmember");
}catch(Exception e){
throw new RuntimeException("执行[保存人事关系]处理逻辑发生异常"+e);
}finally {
if(kieSession!=null)
kieSession.destroy();
}
}
}
......@@ -28,7 +28,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZEMP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzemp-611-2">
<changeSet author="a_A_5d9d78509" id="tab-ibzemp-616-2">
<createTable tableName="IBZEMP">
<column name="USERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZEMP_USERID"/>
......@@ -106,7 +106,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPTMEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzdeptmember-24-3">
<changeSet author="a_A_5d9d78509" id="tab-ibzdeptmember-25-3">
<createTable tableName="IBZDEPTMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZDEPTMEMBER_MEMBERID"/>
......@@ -118,7 +118,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPT]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-541-4">
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-542-4">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZDEPT_DEPTID"/>
......@@ -157,24 +157,24 @@
<addForeignKeyConstraint baseColumnNames="PORGID" baseTableName="IBZORG" constraintName="DER1N_IBZORG_IBZORG_PORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZEMP]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-611-6">
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-616-6">
<addForeignKeyConstraint baseColumnNames="MDEPTID" baseTableName="IBZEMP" constraintName="DER1N_IBZEMP_IBZDEPT_MDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-611-7">
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-616-7">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZEMP" constraintName="DER1N_IBZEMP_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZDEPTMEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzdeptmember-24-8">
<changeSet author="a_A_5d9d78509" id="fk-ibzdeptmember-25-8">
<addForeignKeyConstraint baseColumnNames="DEPTID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_IBZDEPTMEMBER_IBZDEPT_DE" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzdeptmember-24-9">
<changeSet author="a_A_5d9d78509" id="fk-ibzdeptmember-25-9">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_IBZDEPTMEMBER_IBZEMP_USE" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZEMP" validate="true"/>
</changeSet>
<!--输出实体[IBZDEPT]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-541-10">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-542-10">
<addForeignKeyConstraint baseColumnNames="PDEPTID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZDEPT_PDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-541-11">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-542-11">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
......
package cn.ibizlab.ou.logic.ibzemployeelogic.savedeptmember;
import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
global cn.ibizlab.core.ou.domain.IBZEmployee ibzemployeesavedeptmemberdefault;
global cn.ibizlab.core.ou.domain.IBZDeptMember ibzemployeesavedeptmembermember;
global cn.ibizlab.core.ou.service.IIBZDeptMemberService ibzdeptmemberservice;
global cn.ibizlab.core.ou.service.IIBZEmployeeService iBzSysIbzemployeeDefaultService;
global cn.ibizlab.util.security.AuthenticationUser curuser;
no-loop
//逻辑处理节点[保存成员]
rule "deaction1"
ruleflow-group "ibzemployeesavedeptmemberdeaction1"
when
then
ibzdeptmemberservice.save(ibzemployeesavedeptmemberdefault);
update(ibzemployeesavedeptmemberdefault);//更新fact中变量值
update(ibzemployeesavedeptmembermember);//更新fact中变量值
end
//逻辑处理节点[准备成员]
rule "prepareparam1"
ruleflow-group "ibzemployeesavedeptmemberprepareparam1"
when
then
ibzemployeesavedeptmembermember.set("deptid",ibzemployeesavedeptmemberdefault.get("mdeptid"));
ibzemployeesavedeptmembermember.set("userid",ibzemployeesavedeptmemberdefault.get("userid"));
update(ibzemployeesavedeptmemberdefault);//更新fact中变量值
update(ibzemployeesavedeptmembermember);//更新fact中变量值
end
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "ibzemployeesavedeptmemberbegin"
when
then
end
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="cn.ibizlab.core.ou.service.logic.ibzemployeesavedeptmember" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.core.ou.service.logic.ibzemployeesavedeptmember">
<extensionElements>
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:global identifier="ibzemployeesavedeptmemberdefault" type="cn.ibizlab.core.ou.domain.IBZEmployee" />
<tns:global identifier="ibzemployeesavedeptmembermember" type="cn.ibizlab.core.ou.domain.IBZDeptMember" />
</extensionElements>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="ibzemployeesavedeptmemberdeaction1" id="F58FA774-B371-4481-8E9B-8483341ABB57" implementation="http://www.jboss.org/drools/rule" name="保存成员"/>
<endEvent id="F58FA774-B371-4481-8E9B-8483341ABB57_End" name="End"/>
<sequenceFlow id="F58FA774-B371-4481-8E9B-8483341ABB57_End_Line" sourceRef="F58FA774-B371-4481-8E9B-8483341ABB57" targetRef="F58FA774-B371-4481-8E9B-8483341ABB57_End"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="ibzemployeesavedeptmemberprepareparam1" id="EE4970ED-28DF-4578-9B6B-7E468DD9B866" implementation="http://www.jboss.org/drools/rule" name="准备成员"/>
<startEvent id="E3FF4728-CD18-4940-BAEF-8A71111A5D05" isInterrupting="true"/>
<sequenceFlow id="0DF4511B-818D-493E-9CC6-77B2E3EEFAE7" sourceRef="E3FF4728-CD18-4940-BAEF-8A71111A5D05" targetRef="EE4970ED-28DF-4578-9B6B-7E468DD9B866">
</sequenceFlow>
<sequenceFlow id="BDDA5BD4-EA82-4239-952F-B33AEC733ACB" sourceRef="EE4970ED-28DF-4578-9B6B-7E468DD9B866" targetRef="F58FA774-B371-4481-8E9B-8483341ABB57">
</sequenceFlow>
</process>
</definitions>
......@@ -50,11 +50,14 @@ public class IBZOrganizationResource {
@Autowired
@Lazy
private IBZOrganizationMapping ibzorganizationMapping;
public IBZOrganizationMapping ibzorganizationMapping;
public IBZOrganizationDTO permissionDTO=new IBZOrganizationDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"IBZOrganization" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody IBZOrganizationDTO ibzorganizationdto) {
......@@ -64,7 +67,7 @@ public class IBZOrganizationResource {
@PreAuthorize("hasPermission(#ibzorganization_id,'Update',{this.getEntity(),'Sql'})")
@PreAuthorize("hasPermission(#ibzorganization_id,'Update',{'Sql',this.ibzorganizationMapping,#ibzorganizationdto})")
@ApiOperation(value = "Update", tags = {"IBZOrganization" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/ibzorganizations/{ibzorganization_id}")
@Transactional
......@@ -76,7 +79,6 @@ public class IBZOrganizationResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(#ibzorganization_id,'Update',{this.getEntity(),'Sql'})")
@ApiOperation(value = "UpdateBatch", tags = {"IBZOrganization" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/ibzorganizations/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<IBZOrganizationDTO> ibzorganizationdtos) {
......@@ -87,7 +89,7 @@ public class IBZOrganizationResource {
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'Sql'})")
@PreAuthorize("hasPermission('','Create',{'Sql',this.ibzorganizationMapping,#ibzorganizationdto})")
@ApiOperation(value = "Create", tags = {"IBZOrganization" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations")
@Transactional
......@@ -97,7 +99,7 @@ public class IBZOrganizationResource {
IBZOrganizationDTO dto = ibzorganizationMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'Sql'})")
@ApiOperation(value = "createBatch", tags = {"IBZOrganization" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<IBZOrganizationDTO> ibzorganizationdtos) {
......@@ -108,6 +110,7 @@ public class IBZOrganizationResource {
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Save-all')")
@ApiOperation(value = "Save", tags = {"IBZOrganization" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/save")
public ResponseEntity<Boolean> save(@RequestBody IBZOrganizationDTO ibzorganizationdto) {
......@@ -124,7 +127,7 @@ public class IBZOrganizationResource {
@PreAuthorize("hasPermission(#ibzorganization_id,'Remove',{this.getEntity(),'Sql'})")
@PreAuthorize("hasPermission(#ibzorganization_id,'Remove',{'Sql',this.ibzorganizationMapping,this.permissionDTO})")
@ApiOperation(value = "Remove", tags = {"IBZOrganization" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/ibzorganizations/{ibzorganization_id}")
@Transactional
......@@ -142,7 +145,7 @@ public class IBZOrganizationResource {
@PreAuthorize("hasPermission(#ibzorganization_id,'Get',{this.getEntity(),'Sql'})")
@PreAuthorize("hasPermission(#ibzorganization_id,'Get',{'Sql',this.ibzorganizationMapping,this.permissionDTO})")
@ApiOperation(value = "Get", tags = {"IBZOrganization" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/ibzorganizations/{ibzorganization_id}")
public ResponseEntity<IBZOrganizationDTO> get(@PathVariable("ibzorganization_id") String ibzorganization_id) {
......@@ -154,13 +157,14 @@ public class IBZOrganizationResource {
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"IBZOrganization" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/ibzorganizations/getdraft")
public ResponseEntity<IBZOrganizationDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(ibzorganizationMapping.toDto(ibzorganizationService.getDraft(new IBZOrganization())));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectSOrg-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectSOrg-all')")
@ApiOperation(value = "fetch查询下级单位", tags = {"IBZOrganization" } ,notes = "fetch查询下级单位")
@RequestMapping(method= RequestMethod.GET , value="/ibzorganizations/fetchselectsorg")
public ResponseEntity<List<IBZOrganizationDTO>> fetchSelectSOrg(IBZOrganizationSearchContext context) {
......@@ -173,7 +177,7 @@ public class IBZOrganizationResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectSOrg-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectSOrg-all')")
@ApiOperation(value = "search查询下级单位", tags = {"IBZOrganization" } ,notes = "search查询下级单位")
@RequestMapping(method= RequestMethod.POST , value="/ibzorganizations/searchselectsorg")
public ResponseEntity<Page<IBZOrganizationDTO>> searchSelectSOrg(@RequestBody IBZOrganizationSearchContext context) {
......@@ -182,7 +186,7 @@ public class IBZOrganizationResource {
.body(new PageImpl(ibzorganizationMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectPOrg-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectPOrg-all')")
@ApiOperation(value = "fetch查询上级单位", tags = {"IBZOrganization" } ,notes = "fetch查询上级单位")
@RequestMapping(method= RequestMethod.GET , value="/ibzorganizations/fetchselectporg")
public ResponseEntity<List<IBZOrganizationDTO>> fetchSelectPOrg(IBZOrganizationSearchContext context) {
......@@ -195,7 +199,7 @@ public class IBZOrganizationResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectPOrg-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-SelectPOrg-all')")
@ApiOperation(value = "search查询上级单位", tags = {"IBZOrganization" } ,notes = "search查询上级单位")
@RequestMapping(method= RequestMethod.POST , value="/ibzorganizations/searchselectporg")
public ResponseEntity<Page<IBZOrganizationDTO>> searchSelectPOrg(@RequestBody IBZOrganizationSearchContext context) {
......@@ -204,7 +208,7 @@ public class IBZOrganizationResource {
.body(new PageImpl(ibzorganizationMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Default-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"IBZOrganization" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/ibzorganizations/fetchdefault")
public ResponseEntity<List<IBZOrganizationDTO>> fetchDefault(IBZOrganizationSearchContext context) {
......@@ -217,7 +221,7 @@ public class IBZOrganizationResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Default-all')")
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"IBZOrganization" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/ibzorganizations/searchdefault")
public ResponseEntity<Page<IBZOrganizationDTO>> searchDefault(@RequestBody IBZOrganizationSearchContext context) {
......@@ -227,12 +231,6 @@ public class IBZOrganizationResource {
}
/**
* 用户权限校验
* @return
*/
public IBZOrganization getEntity(){
return new IBZOrganization();
}
}
......@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mongodb.QueryBuilder;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.domain.MappingBase;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.filter.QueryBuildContext;
import cn.ibizlab.util.filter.QueryWrapperContext;
......@@ -72,8 +74,10 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
return true;
List paramList = (ArrayList) params;
EntityBase entity = (EntityBase) paramList.get(0);
String deStorageMode= (String) paramList.get(1);
String deStorageMode= (String) paramList.get(0);
MappingBase mappingBase= (MappingBase) paramList.get(1);
DTOBase dtoBase = (DTOBase) paramList.get(2);
EntityBase entity = (EntityBase) mappingBase.toDomain(dtoBase);
if (StringUtils.isEmpty(entity))
return false;
......@@ -82,20 +86,19 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
JSONObject permissionList=userPermission.getJSONObject("entities");
String entityName = entity.getClass().getSimpleName();
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(permissionList,entityName,action)){
return true;
}
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(permissionList,entityName,action)){
return false;
}
if(action.equalsIgnoreCase("create")){
return validDEActionHasPermission(permissionList,entityName,action);
return createActionPermissionValid(permissionList,entity, action);
}
else{
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(permissionList,entityName,action)){
return true;
}
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(permissionList,entityName,action)){
return false;
}
//检查是否有数据权限
return deActionPermissionValidRouter(deStorageMode, entity , action , srfKey, permissionList);
return otherActionPermissionValidRouter(deStorageMode, entity , action , srfKey, permissionList);
}
}
......@@ -113,7 +116,10 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if(!permissionList.containsKey(entityName))
return false;
JSONObject entity=permissionList.getJSONObject(entityName);
if(entity.containsKey(action) && entity.getJSONArray(action).contains("ALL"))
if(!entity.containsKey(DEActionType))
return false;
JSONObject dataRange=entity.getJSONObject(DEActionType);//获取实体行为对应的数据范围
if(dataRange.containsKey(action) && dataRange.getJSONArray(action).contains("all"))
return true;
return false;
......@@ -144,6 +150,81 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
return hasPermission;
}
/**
* 新建行为校验
* @param permissionList
* @param entity
* @param action
* @return
*/
private boolean createActionPermissionValid(JSONObject permissionList,EntityBase entity, String action){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray dataRangeList=permissionType.getJSONArray(action);//行为:read;insert...
if(dataRangeList.size()==0)
return false;
boolean isCreate=true;
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield");
AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser();
Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
Set<String> orgParent = userInfo.get("parentorg");
Set<String> orgChild = userInfo.get("suborg");
Set<String> orgDeptParent = userInfo.get("parentdept");
Set<String> orgDeptChild = userInfo.get("subdept");
Object orgFieldValue=entity.get(orgField);
Object orgDeptFieldValue=entity.get(orgDeptField);
Object crateManFieldValue=entity.get(createManField);
Set<String> userOrg = new HashSet<>();
Set<String> userOrgDept = new HashSet<>();
for(int a=0;a<dataRangeList.size();a++){
String permissionCond=dataRangeList.getString(a);//权限配置条件
if(permissionCond.equals("curorg")){ //本单位
userOrg.add(authenticationUser.getOrgid());
}
else if(permissionCond.equals("porg")){//上级单位
userOrg.addAll(orgParent);
}
else if(permissionCond.equals("sorg")){//下级单位
userOrg.addAll(orgChild);
}
else if(permissionCond.equals("curorgdept")){//本部门
userOrgDept.add(authenticationUser.getMdeptid());
}
else if(permissionCond.equals("porgdept")){//上级部门
userOrgDept.addAll(orgDeptParent);
}
else if(permissionCond.equals("sorgdept")){//下级部门
userOrgDept.addAll(orgDeptChild);
}
}
if(!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue)){
return false;
}
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue)){
return false;
}
if(!ObjectUtils.isEmpty(crateManFieldValue) && !crateManFieldValue.equals(authenticationUser.getUserid())){
return false;
}
return isCreate;
}
/**
* 根据实体存储模式,进行鉴权
......@@ -154,7 +235,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @param permissionList
* @return
*/
private boolean deActionPermissionValidRouter(String deStorageMode, EntityBase entity , String action , Object srfKey , JSONObject permissionList){
private boolean otherActionPermissionValidRouter(String deStorageMode, EntityBase entity , String action , Object srfKey , JSONObject permissionList){
if(deStorageMode.equalsIgnoreCase("sql")){
return sqlPermissionValid(entity , action , srfKey, permissionList);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册