提交 7cf5902a 编写于 作者: laizhilong's avatar laizhilong

Merge branch 'master' of http://labcs.ibizee.cn/ibiz4jteam/ibzou

...@@ -51,21 +51,16 @@ export default class AppOrgSelect extends Vue { ...@@ -51,21 +51,16 @@ export default class AppOrgSelect extends Vue {
*/ */
@Watch('data',{immediate:true,deep:true}) @Watch('data',{immediate:true,deep:true})
onDataChange(newVal: any, oldVal: any) { onDataChange(newVal: any, oldVal: any) {
// 计算出选中值 if(newVal){
// 单选 this.computedSelectedData();
if(!this.multiple){ if(this.filter){
if(this.fillMap && Object.keys(this.fillMap).length >0){ let tempFilterValue:any = this.initBasicData();
let templateValue = {}; // filter值变化才去请求数据
Object.keys(this.fillMap).forEach((item:any) =>{ if(tempFilterValue && (this.copyFilterValue !== tempFilterValue)){
if(this.data && this.data[this.fillMap[item]]){ this.loadTreeData(this.orgDataUrl.replace('${orgid}',tempFilterValue));
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]}); this.copyFilterValue = tempFilterValue;
} }
})
this.selectTreeValue = JSON.stringify([templateValue]);
} }
}else{
// 多选
} }
} }
...@@ -91,11 +86,11 @@ export default class AppOrgSelect extends Vue { ...@@ -91,11 +86,11 @@ export default class AppOrgSelect extends Vue {
public NodesData:any = []; public NodesData:any = [];
/** /**
* 过滤值 * 备份过滤值
* *
* @memberof AppOrgSelect * @memberof AppOrgSelect
*/ */
public filterValue:any; public copyFilterValue:any;
/** /**
* vue生命周期 * vue生命周期
...@@ -103,8 +98,9 @@ export default class AppOrgSelect extends Vue { ...@@ -103,8 +98,9 @@ export default class AppOrgSelect extends Vue {
* @memberof AppOrgSelect * @memberof AppOrgSelect
*/ */
public created(){ public created(){
this.initBasicData(); if(!this.filter){
this.loadTreeData(); this.loadTreeData(this.orgDataUrl.replace('${orgid}','alls'));
}
} }
/** /**
...@@ -116,25 +112,44 @@ export default class AppOrgSelect extends Vue { ...@@ -116,25 +112,44 @@ export default class AppOrgSelect extends Vue {
// 计算出过滤值 // 计算出过滤值
if(this.filter){ if(this.filter){
if(this.data && this.data[this.filter]){ if(this.data && this.data[this.filter]){
this.filterValue= this.data[this.filter]; return this.data[this.filter];
}else if(this.context && this.context[this.filter]){ }else if(this.context && this.context[this.filter]){
this.filterValue= this.context[this.filter]; return this.context[this.filter];
}else{
return null;
} }
} }
} }
/** /**
* 加载树数据 * 计算选中值
* *
* @memberof AppOrgSelect * @memberof AppOrgSelect
*/ */
public loadTreeData(){ public computedSelectedData(){
let requestUrl:string = ""; // 单选
if(!this.filter){ if(!this.multiple){
requestUrl = this.orgDataUrl.replace('${orgid}','alls'); if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{ }else{
requestUrl = this.orgDataUrl.replace('${orgid}',this.filterValue); // 多选
}
} }
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public loadTreeData(requestUrl:string){
Http.getInstance().get(requestUrl).then((res:any) =>{ Http.getInstance().get(requestUrl).then((res:any) =>{
if(!res.status && res.status !== 200){ if(!res.status && res.status !== 200){
console.error("加载数据失败"); console.error("加载数据失败");
......
...@@ -55,6 +55,7 @@ export const viewstate: any = { ...@@ -55,6 +55,7 @@ export const viewstate: any = {
viewaction: '', viewaction: '',
viewdatachange: false, viewdatachange: false,
refviews: [ refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
'b59db4df07430a34645566a64d59244c', 'b59db4df07430a34645566a64d59244c',
], ],
}, },
......
...@@ -42,7 +42,26 @@ ...@@ -42,7 +42,26 @@
</i-col> </i-col>
<i-col v-show="detailsModel.orgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <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.ibzdepartment.main_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzdepartment.main_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-org-select :data="data" :context="JSON.parse(JSON.stringify(context))" :fillMap="{'id':'orgid','label':'orgname'}" filter="pdeptid" :multiple="false" style="" @formitemvaluechange="onFormItemValueChange"></app-org-select> <app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.orgname.disabled"
name='orgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='orgid'
:value="data.orgname"
editortype=""
:pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item> </app-form-item>
</i-col> </i-col>
...@@ -66,7 +85,18 @@ ...@@ -66,7 +85,18 @@
</i-col> </i-col>
<i-col v-show="detailsModel.leadername.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.leadername.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='leadername' :itemRules="this.rules.leadername" class='' :caption="$t('entities.ibzdepartment.main_form.details.leadername')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.leadername.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='leadername' :itemRules="this.rules.leadername" class='' :caption="$t('entities.ibzdepartment.main_form.details.leadername')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.leadername.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.leadername" @enter="onEnter($event)" unit="" :disabled="detailsModel.leadername.disabled" type='text' style=""></input-box> <ibiz-group-select
name="leadername"
:value='data.leadername'
valueitem="leaderid"
filter="orgid"
:disabled="detailsModel.leadername.disabled"
:data="data"
:context="context"
@formitemvaluechange="onFormItemValueChange">
</ibiz-group-select>
</app-form-item> </app-form-item>
</i-col> </i-col>
......
...@@ -2,6 +2,7 @@ import { Http,Util,Errorlog } from '@/utils'; ...@@ -2,6 +2,7 @@ import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service'; import ControlService from '@/widgets/control-service';
import IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service'; import IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service';
import MainModel from './main-form-model'; import MainModel from './main-form-model';
import IBZOrganizationService from '@/service/ibzorganization/ibzorganization-service';
/** /**
...@@ -41,6 +42,14 @@ export default class MainService extends ControlService { ...@@ -41,6 +42,14 @@ export default class MainService extends ControlService {
this.model = new MainModel(); this.model = new MainModel();
} }
/**
* 单位机构服务对象
*
* @type {IBZOrganizationService}
* @memberof MainService
*/
public ibzorganizationService: IBZOrganizationService = new IBZOrganizationService();
/** /**
* 处理数据 * 处理数据
* *
...@@ -83,6 +92,9 @@ export default class MainService extends ControlService { ...@@ -83,6 +92,9 @@ export default class MainService extends ControlService {
if (Object.is(serviceName, 'IBZDepartmentService') && Object.is(interfaceName, 'FetchDefault')) { if (Object.is(serviceName, 'IBZDepartmentService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.appEntityService.FetchDefault(JSON.parse(JSON.stringify(context)), data, isloading), 'deptid', 'ibzdepartment'); return this.doItems(this.appEntityService.FetchDefault(JSON.parse(JSON.stringify(context)), data, isloading), 'deptid', 'ibzdepartment');
} }
if (Object.is(serviceName, 'IBZOrganizationService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.ibzorganizationService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'orgid', 'ibzorganization');
}
return Promise.reject([]) return Promise.reject([])
} }
......
...@@ -82,7 +82,7 @@ public class IBZDepartmentResource { ...@@ -82,7 +82,7 @@ public class IBZDepartmentResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZDepartment-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzdepartmentMapping,#ibzdepartmentdto})")
@ApiOperation(value = "Save", tags = {"IBZDepartment" }, notes = "Save") @ApiOperation(value = "Save", tags = {"IBZDepartment" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/ibzdepartments/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzdepartments/save")
public ResponseEntity<Boolean> save(@RequestBody IBZDepartmentDTO ibzdepartmentdto) { public ResponseEntity<Boolean> save(@RequestBody IBZDepartmentDTO ibzdepartmentdto) {
...@@ -222,7 +222,7 @@ public class IBZDepartmentResource { ...@@ -222,7 +222,7 @@ public class IBZDepartmentResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZDepartment-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzdepartmentMapping,#ibzdepartmentdto})")
@ApiOperation(value = "SaveByIBZOrganization", tags = {"IBZDepartment" }, notes = "SaveByIBZOrganization") @ApiOperation(value = "SaveByIBZOrganization", tags = {"IBZDepartment" }, notes = "SaveByIBZOrganization")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzdepartments/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzdepartments/save")
public ResponseEntity<Boolean> saveByIBZOrganization(@PathVariable("ibzorganization_id") String ibzorganization_id, @RequestBody IBZDepartmentDTO ibzdepartmentdto) { public ResponseEntity<Boolean> saveByIBZOrganization(@PathVariable("ibzorganization_id") String ibzorganization_id, @RequestBody IBZDepartmentDTO ibzdepartmentdto) {
......
...@@ -127,7 +127,7 @@ public class IBZEmployeeResource { ...@@ -127,7 +127,7 @@ public class IBZEmployeeResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZEmployee-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzemployeeMapping,#ibzemployeedto})")
@ApiOperation(value = "Save", tags = {"IBZEmployee" }, notes = "Save") @ApiOperation(value = "Save", tags = {"IBZEmployee" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/ibzemployees/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzemployees/save")
public ResponseEntity<Boolean> save(@RequestBody IBZEmployeeDTO ibzemployeedto) { public ResponseEntity<Boolean> save(@RequestBody IBZEmployeeDTO ibzemployeedto) {
...@@ -263,7 +263,7 @@ public class IBZEmployeeResource { ...@@ -263,7 +263,7 @@ public class IBZEmployeeResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZEmployee-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzemployeeMapping,#ibzemployeedto})")
@ApiOperation(value = "SaveByIBZDepartment", tags = {"IBZEmployee" }, notes = "SaveByIBZDepartment") @ApiOperation(value = "SaveByIBZDepartment", tags = {"IBZEmployee" }, notes = "SaveByIBZDepartment")
@RequestMapping(method = RequestMethod.POST, value = "/ibzdepartments/{ibzdepartment_id}/ibzemployees/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzdepartments/{ibzdepartment_id}/ibzemployees/save")
public ResponseEntity<Boolean> saveByIBZDepartment(@PathVariable("ibzdepartment_id") String ibzdepartment_id, @RequestBody IBZEmployeeDTO ibzemployeedto) { public ResponseEntity<Boolean> saveByIBZDepartment(@PathVariable("ibzdepartment_id") String ibzdepartment_id, @RequestBody IBZEmployeeDTO ibzemployeedto) {
...@@ -409,7 +409,7 @@ public class IBZEmployeeResource { ...@@ -409,7 +409,7 @@ public class IBZEmployeeResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZEmployee-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzemployeeMapping,#ibzemployeedto})")
@ApiOperation(value = "SaveByIBZOrganization", tags = {"IBZEmployee" }, notes = "SaveByIBZOrganization") @ApiOperation(value = "SaveByIBZOrganization", tags = {"IBZEmployee" }, notes = "SaveByIBZOrganization")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzemployees/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzemployees/save")
public ResponseEntity<Boolean> saveByIBZOrganization(@PathVariable("ibzorganization_id") String ibzorganization_id, @RequestBody IBZEmployeeDTO ibzemployeedto) { public ResponseEntity<Boolean> saveByIBZOrganization(@PathVariable("ibzorganization_id") String ibzorganization_id, @RequestBody IBZEmployeeDTO ibzemployeedto) {
...@@ -555,7 +555,7 @@ public class IBZEmployeeResource { ...@@ -555,7 +555,7 @@ public class IBZEmployeeResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZEmployee-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzemployeeMapping,#ibzemployeedto})")
@ApiOperation(value = "SaveByIBZOrganizationIBZDepartment", tags = {"IBZEmployee" }, notes = "SaveByIBZOrganizationIBZDepartment") @ApiOperation(value = "SaveByIBZOrganizationIBZDepartment", tags = {"IBZEmployee" }, notes = "SaveByIBZOrganizationIBZDepartment")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzdepartments/{ibzdepartment_id}/ibzemployees/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/{ibzorganization_id}/ibzdepartments/{ibzdepartment_id}/ibzemployees/save")
public ResponseEntity<Boolean> saveByIBZOrganizationIBZDepartment(@PathVariable("ibzorganization_id") String ibzorganization_id, @PathVariable("ibzdepartment_id") String ibzdepartment_id, @RequestBody IBZEmployeeDTO ibzemployeedto) { public ResponseEntity<Boolean> saveByIBZOrganizationIBZDepartment(@PathVariable("ibzorganization_id") String ibzorganization_id, @PathVariable("ibzdepartment_id") String ibzdepartment_id, @RequestBody IBZEmployeeDTO ibzemployeedto) {
......
...@@ -100,7 +100,7 @@ public class IBZOrganizationResource { ...@@ -100,7 +100,7 @@ public class IBZOrganizationResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzou-IBZOrganization-Save-all')") @PreAuthorize("hasPermission('','Save',{'Sql',this.ibzorganizationMapping,#ibzorganizationdto})")
@ApiOperation(value = "Save", tags = {"IBZOrganization" }, notes = "Save") @ApiOperation(value = "Save", tags = {"IBZOrganization" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/save") @RequestMapping(method = RequestMethod.POST, value = "/ibzorganizations/save")
public ResponseEntity<Boolean> save(@RequestBody IBZOrganizationDTO ibzorganizationdto) { public ResponseEntity<Boolean> save(@RequestBody IBZOrganizationDTO ibzorganizationdto) {
......
...@@ -104,6 +104,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -104,6 +104,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if(action.equalsIgnoreCase("create")){ if(action.equalsIgnoreCase("create")){
return createBatchActionPermissionValid(entityList,dataRangeList); return createBatchActionPermissionValid(entityList,dataRangeList);
} }
else if(action.equalsIgnoreCase("save")){
return saveBatchActionPermissionValid(deStorageMode, entityList, dataRangeList);
}
else{ else{
if(!action.equalsIgnoreCase("remove")){ if(!action.equalsIgnoreCase("remove")){
ids=getIds(entity,entityList); ids=getIds(entity,entityList);
...@@ -114,6 +117,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -114,6 +117,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
} }
} }
/**
* 批save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/** /**
* 实体行为权限检查 :用于检查当前用户是否拥有实体的新建、编辑、删除权限 * 实体行为权限检查 :用于检查当前用户是否拥有实体的新建、编辑、删除权限
* *
...@@ -157,6 +197,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -157,6 +197,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if(dataRangeList.size()==0) if(dataRangeList.size()==0)
return false; return false;
if(action.equalsIgnoreCase("save")){
Map<String,String> permissionField=getPermissionField(entity);
String keyFieldName=permissionField.get(keyFieldTag);
Object srfKey=entity.get(keyFieldName);
if(ObjectUtils.isEmpty(srfKey))
action="create";
else
action="update";
}
if(action.equalsIgnoreCase("create")){ if(action.equalsIgnoreCase("create")){
return createActionPermissionValid(entity,dataRangeList); return createActionPermissionValid(entity,dataRangeList);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册