Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzou
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzou
提交
0ebf83eb
提交
0ebf83eb
编写于
4年前
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
6983ee7d
变更
54
隐藏空白字符变更
内嵌
并排
正在显示
54 个修改的文件
包含
3581 行增加
和
263 行删除
+3581
-263
CHANGELOG.md
app_web/CHANGELOG.md
+3
-0
noimage.png
app_web/public/assets/img/noimage.png
+0
-0
view-config.json
app_web/public/assets/json/view-config.json
+8
-0
ibzdepartment_en_US.ts
...eb/src/locale/lanres/ibzdepartment/ibzdepartment_en_US.ts
+2
-0
ibzdepartment_zh_CN.ts
...eb/src/locale/lanres/ibzdepartment/ibzdepartment_zh_CN.ts
+2
-0
ibzorganization_en_US.ts
...rc/locale/lanres/ibzorganization/ibzorganization_en_US.ts
+31
-1
ibzorganization_zh_CN.ts
...rc/locale/lanres/ibzorganization/ibzorganization_zh_CN.ts
+31
-1
viewconfig.ts
app_web/src/mock/viewconfig/viewconfig.ts
+8
-0
ibzorganization-option-view-base.vue
...nization-option-view/ibzorganization-option-view-base.vue
+554
-0
ibzorganization-option-view.less
...organization-option-view/ibzorganization-option-view.less
+14
-0
ibzorganization-option-view.vue
...zorganization-option-view/ibzorganization-option-view.vue
+19
-0
state.ts
app_web/src/store/modules/view-action/state.ts
+12
-0
ibzorganization-ui-service-base.ts
...ervice/ibzorganization/ibzorganization-ui-service-base.ts
+1
-0
main-form-base.vue
...eb/src/widgets/ibzdepartment/main-form/main-form-base.vue
+47
-0
main-form-model.ts
...eb/src/widgets/ibzdepartment/main-form/main-form-model.ts
+5
-0
main-form-service.ts
.../src/widgets/ibzdepartment/main-form/main-form-service.ts
+3
-0
pickup-viewpickupviewpanel-pickupviewpanel-model.ts
...panel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
+3
-0
main-form-base.vue
.../src/widgets/ibzorganization/main-form/main-form-base.vue
+54
-7
main-form-model.ts
.../src/widgets/ibzorganization/main-form/main-form-model.ts
+8
-3
main-form-service.ts
...rc/widgets/ibzorganization/main-form/main-form-service.ts
+3
-0
new-form-form-base.vue
...gets/ibzorganization/new-form-form/new-form-form-base.vue
+1689
-0
new-form-form-model.ts
...gets/ibzorganization/new-form-form/new-form-form-model.ts
+106
-0
new-form-form-service.ts
...ts/ibzorganization/new-form-form/new-form-form-service.ts
+370
-0
new-form-form.less
.../widgets/ibzorganization/new-form-form/new-form-form.less
+49
-0
new-form-form.vue
...c/widgets/ibzorganization/new-form-form/new-form-form.vue
+14
-0
pickup-viewpickupviewpanel-pickupviewpanel-model.ts
...panel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
+3
-0
IBZDepartment.java
...rc/main/java/cn/ibizlab/core/ou/domain/IBZDepartment.java
+7
-0
IBZOrganization.java
.../main/java/cn/ibizlab/core/ou/domain/IBZOrganization.java
+7
-0
IBZDepartmentSearchContext.java
...cn/ibizlab/core/ou/filter/IBZDepartmentSearchContext.java
+14
-0
IBZOrganizationSearchContext.java
.../ibizlab/core/ou/filter/IBZOrganizationSearchContext.java
+14
-0
IBZDepartmentServiceImpl.java
...bizlab/core/ou/service/impl/IBZDepartmentServiceImpl.java
+1
-1
IBZEmployeeServiceImpl.java
.../ibizlab/core/ou/service/impl/IBZEmployeeServiceImpl.java
+1
-1
IBZOrganizationServiceImpl.java
...zlab/core/ou/service/impl/IBZOrganizationServiceImpl.java
+1
-1
h2_table.xml
ibzou-core/src/main/resources/liquibase/h2_table.xml
+5
-5
IBZDepartmentMapper.xml
...resources/mapper/ou/ibzdepartment/IBZDepartmentMapper.xml
+3
-3
IBZOrganizationMapper.xml
...urces/mapper/ou/ibzorganization/IBZOrganizationMapper.xml
+5
-5
IBZDepartmentDTO.java
.../src/main/java/cn/ibizlab/ouapi/dto/IBZDepartmentDTO.java
+8
-0
IBZOrganizationDTO.java
...rc/main/java/cn/ibizlab/ouapi/dto/IBZOrganizationDTO.java
+8
-0
IBZDepartmentResource.java
...ain/java/cn/ibizlab/ouapi/rest/IBZDepartmentResource.java
+0
-1
IBZEmployeeResource.java
.../main/java/cn/ibizlab/ouapi/rest/IBZEmployeeResource.java
+0
-1
IBZOrganizationResource.java
...n/java/cn/ibizlab/ouapi/rest/IBZOrganizationResource.java
+0
-1
IBZOUFallback.java
...l/src/main/java/cn/ibizlab/util/client/IBZOUFallback.java
+1
-1
IBZOUFeignClient.java
...rc/main/java/cn/ibizlab/util/client/IBZOUFeignClient.java
+3
-3
IBZUAAFallback.java
.../src/main/java/cn/ibizlab/util/client/IBZUAAFallback.java
+1
-1
IBZUAAFeignClient.java
...c/main/java/cn/ibizlab/util/client/IBZUAAFeignClient.java
+3
-3
FileItem.java
...u-util/src/main/java/cn/ibizlab/util/domain/FileItem.java
+19
-0
PermissionSyncJob.java
.../src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
+1
-1
FileController.java
...il/src/main/java/cn/ibizlab/util/rest/FileController.java
+86
-0
AuthPermissionEvaluator.java
...ava/cn/ibizlab/util/security/AuthPermissionEvaluator.java
+257
-209
AuthenticationUser.java
...ain/java/cn/ibizlab/util/security/AuthenticationUser.java
+2
-1
FileService.java
...il/src/main/java/cn/ibizlab/util/service/FileService.java
+11
-0
SimpleFileService.java
.../main/java/cn/ibizlab/util/service/SimpleFileService.java
+75
-0
SimpleUserService.java
.../main/java/cn/ibizlab/util/service/SimpleUserService.java
+5
-13
application-sys.yml
ibzou-util/src/main/resources/application-sys.yml
+4
-0
未找到文件。
app_web/CHANGELOG.md
0 → 100644
浏览文件 @
0ebf83eb
*2020-4-29*
初始化文件
This diff is collapsed.
Click to expand it.
app_web/public/assets/img/noimage.png
0 → 100644
浏览文件 @
0ebf83eb
18.2 KB
This diff is collapsed.
Click to expand it.
app_web/public/assets/json/view-config.json
浏览文件 @
0ebf83eb
...
...
@@ -47,6 +47,14 @@
"viewname"
:
"IBZDepartmentPickupGridView"
,
"viewtag"
:
"66fa282d24a21eec39d958e7fc6c23a8"
},
"ibzorganizationoptionview"
:
{
"title"
:
"单位机构选项操作视图"
,
"caption"
:
"单位机构"
,
"viewtype"
:
"DEOPTVIEW"
,
"viewmodule"
:
"ou"
,
"viewname"
:
"IBZOrganizationOptionView"
,
"viewtag"
:
"995d26f289a30e31573d557a5f5ba254"
},
"ibzorganizationpickupview"
:
{
"title"
:
"单位机构数据选择视图"
,
"caption"
:
"单位机构"
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/locale/lanres/ibzdepartment/ibzdepartment_en_US.ts
浏览文件 @
0ebf83eb
...
...
@@ -6,6 +6,7 @@ export default {
deptname
:
'部门名称'
,
orgid
:
'单位'
,
parentdeptid
:
'上级部门'
,
pdeptname
:
'上级部门'
,
shortname
:
'部门简称'
,
deptlevel
:
'部门级别'
,
showorder
:
'排序'
,
...
...
@@ -47,6 +48,7 @@ export default {
deptid
:
"部门标识"
,
deptcode
:
"部门代码"
,
deptname
:
"部门名称"
,
pdeptname
:
"上级部门"
,
orgname
:
"单位"
,
orgid
:
"单位"
,
pdeptid
:
"上级部门"
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/locale/lanres/ibzdepartment/ibzdepartment_zh_CN.ts
浏览文件 @
0ebf83eb
...
...
@@ -5,6 +5,7 @@ export default {
deptname
:
'部门名称'
,
orgid
:
'单位'
,
parentdeptid
:
'上级部门'
,
pdeptname
:
'上级部门'
,
shortname
:
'部门简称'
,
deptlevel
:
'部门级别'
,
showorder
:
'排序'
,
...
...
@@ -46,6 +47,7 @@ export default {
deptid
:
'部门标识'
,
deptcode
:
'部门代码'
,
deptname
:
'部门名称'
,
pdeptname
:
'上级部门'
,
orgname
:
'单位'
,
orgid
:
'单位'
,
pdeptid
:
'上级部门'
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/locale/lanres/ibzorganization/ibzorganization_en_US.ts
浏览文件 @
0ebf83eb
...
...
@@ -5,6 +5,7 @@ export default {
orgcode
:
'单位代码'
,
orgname
:
'名称'
,
parentorgid
:
'上级单位'
,
porgname
:
'上级单位'
,
shortname
:
'单位简称'
,
orglevel
:
'单位级别'
,
showorder
:
'排序'
,
...
...
@@ -19,6 +20,10 @@ export default {
},
pickupgridview
:
{
caption
:
"单位机构"
,
title
:
'单位机构'
,
},
optionview
:
{
caption
:
"单位机构"
,
title
:
'单位机构'
,
},
pickupview
:
{
...
...
@@ -44,12 +49,37 @@ export default {
orgid
:
"单位标识"
,
orgcode
:
"单位代码"
,
orgname
:
"名称"
,
porg
id
:
"上级单位"
,
porg
name
:
"上级单位"
,
orglevel
:
"单位级别"
,
shortname
:
"单位简称"
,
showorder
:
"排序"
,
createdate
:
"创建时间"
,
updatedate
:
"最后修改时间"
,
porgid
:
"上级单位"
,
},
uiactions
:
{
},
},
newform_form
:
{
details
:
{
group1
:
"单位机构基本信息"
,
formpage1
:
"基本信息"
,
srfupdatedate
:
"最后修改时间"
,
srforikey
:
""
,
srfkey
:
"单位标识"
,
srfmajortext
:
"名称"
,
srftempmode
:
""
,
srfuf
:
""
,
srfdeid
:
""
,
srfsourcekey
:
""
,
orgcode
:
"单位代码"
,
orgname
:
"名称"
,
porgname
:
"上级单位"
,
orglevel
:
"单位级别"
,
shortname
:
"单位简称"
,
showorder
:
"排序"
,
orgid
:
"单位标识"
,
porgid
:
"上级单位"
,
},
uiactions
:
{
},
...
...
This diff is collapsed.
Click to expand it.
app_web/src/locale/lanres/ibzorganization/ibzorganization_zh_CN.ts
浏览文件 @
0ebf83eb
...
...
@@ -4,6 +4,7 @@ export default {
orgcode
:
'单位代码'
,
orgname
:
'名称'
,
parentorgid
:
'上级单位'
,
porgname
:
'上级单位'
,
shortname
:
'单位简称'
,
orglevel
:
'单位级别'
,
showorder
:
'排序'
,
...
...
@@ -18,6 +19,10 @@ export default {
},
pickupgridview
:
{
caption
:
'单位机构'
,
title
:
'单位机构'
,
},
optionview
:
{
caption
:
'单位机构'
,
title
:
'单位机构'
,
},
pickupview
:
{
...
...
@@ -43,12 +48,37 @@ export default {
orgid
:
'单位标识'
,
orgcode
:
'单位代码'
,
orgname
:
'名称'
,
porg
id
:
'上级单位'
,
porg
name
:
'上级单位'
,
orglevel
:
'单位级别'
,
shortname
:
'单位简称'
,
showorder
:
'排序'
,
createdate
:
'创建时间'
,
updatedate
:
'最后修改时间'
,
porgid
:
'上级单位'
,
},
uiactions
:
{
},
},
newform_form
:
{
details
:
{
group1
:
'单位机构基本信息'
,
formpage1
:
'基本信息'
,
srfupdatedate
:
'最后修改时间'
,
srforikey
:
''
,
srfkey
:
'单位标识'
,
srfmajortext
:
'名称'
,
srftempmode
:
''
,
srfuf
:
''
,
srfdeid
:
''
,
srfsourcekey
:
''
,
orgcode
:
'单位代码'
,
orgname
:
'名称'
,
porgname
:
'上级单位'
,
orglevel
:
'单位级别'
,
shortname
:
'单位简称'
,
showorder
:
'排序'
,
orgid
:
'单位标识'
,
porgid
:
'上级单位'
,
},
uiactions
:
{
},
...
...
This diff is collapsed.
Click to expand it.
app_web/src/mock/viewconfig/viewconfig.ts
浏览文件 @
0ebf83eb
...
...
@@ -55,6 +55,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname"
:
"IBZDepartmentPickupGridView"
,
"viewtag"
:
"66fa282d24a21eec39d958e7fc6c23a8"
},
"ibzorganizationoptionview"
:
{
"title"
:
"单位机构选项操作视图"
,
"caption"
:
"单位机构"
,
"viewtype"
:
"DEOPTVIEW"
,
"viewmodule"
:
"ou"
,
"viewname"
:
"IBZOrganizationOptionView"
,
"viewtag"
:
"995d26f289a30e31573d557a5f5ba254"
},
"ibzorganizationpickupview"
:
{
"title"
:
"单位机构数据选择视图"
,
"caption"
:
"单位机构"
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/pages/ou/ibzorganization-option-view/ibzorganization-option-view-base.vue
0 → 100644
浏览文件 @
0ebf83eb
<
template
>
<div
class=
"view-container ibzorganization-option-view"
>
<app-studioaction
:viewTitle=
"$t(model.srfTitle)"
viewName=
"ibzorganizationoptionview"
></app-studioaction>
<card
class=
'view-card'
dis-hover
:padding=
"0"
:bordered=
"false"
>
<p
slot=
'title'
>
<span
class=
'caption-info'
>
{{
$t
(
model
.
srfTitle
)
}}
</span>
</p>
<div
class=
"content-container"
>
<view
_form
:viewState=
"viewState"
:viewparams=
"viewparams"
:context=
"context"
:autosave=
"false"
:viewtag=
"viewtag"
:showBusyIndicator=
"true"
updateAction=
"Update"
removeAction=
"Remove"
loaddraftAction=
"GetDraft"
loadAction=
"Get"
createAction=
"Create"
WFSubmitAction=
""
WFStartAction=
""
style=
''
name=
"form"
ref=
'form'
@
save=
"form_save($event)"
@
remove=
"form_remove($event)"
@
load=
"form_load($event)"
@
closeview=
"closeView($event)"
>
</view
_form
>
</div>
<card
dis-hover
:bordered=
"false"
class=
'footer'
>
<row
style=
" text-align: right "
>
<i-button
type=
'primary'
@
click=
"onClickOk"
>
{{
containerModel
.
view_okbtn
.
text
}}
</i-button>
<i-button
@
click=
"onClickCancel"
>
{{
containerModel
.
view_cancelbtn
.
text
}}
</i-button>
</row>
</card>
</card>
</div>
</
template
>
<
script
lang=
'tsx'
>
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
{
Subject
}
from
'rxjs'
;
import
IBZOrganizationService
from
'@/service/ibzorganization/ibzorganization-service'
;
import
OptionViewEngine
from
'@engine/view/option-view-engine'
;
@
Component
({
components
:
{
},
})
export
default
class
IBZOrganizationOptionViewBase
extends
Vue
{
/**
* 实体服务对象
*
* @type {IBZOrganizationService}
* @memberof IBZOrganizationOptionViewBase
*/
protected
appEntityService
:
IBZOrganizationService
=
new
IBZOrganizationService
;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBZOrganizationOptionViewBase
*/
protected
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBZOrganizationOptionViewBase
*/
@
Emit
()
protected
viewDatasChange
(
val
:
any
):
any
{
return
val
;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBZOrganizationOptionViewBase
*/
@
Prop
()
protected
viewdata
!
:
string
;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBZOrganizationOptionViewBase
*/
@
Prop
()
protected
viewparam
!
:
string
;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBZOrganizationOptionViewBase
*/
@
Prop
({
default
:
true
})
protected
viewDefaultUsage
!
:
boolean
;
/**
* 视图标识
*
* @type {string}
* @memberof IBZOrganizationOptionViewBase
*/
protected
viewtag
:
string
=
'995d26f289a30e31573d557a5f5ba254'
;
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
customViewNavContexts
:
any
=
{
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
customViewParams
:
any
=
{
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
model
:
any
=
{
srfCaption
:
'entities.ibzorganization.views.optionview.caption'
,
srfTitle
:
'entities.ibzorganization.views.optionview.title'
,
srfSubTitle
:
'entities.ibzorganization.views.optionview.subtitle'
,
dataInfo
:
''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBZOrganizationOptionViewBase
*/
@
Watch
(
'viewparam'
,{
immediate
:
true
,
deep
:
true
})
onParamData
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
){
for
(
let
key
in
this
.
viewparams
){
delete
this
.
viewparams
[
key
];
}
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBZOrganizationOptionViewBase
*/
@
Watch
(
'viewdata'
)
onViewData
(
newVal
:
any
,
oldVal
:
any
)
{
const
_this
:
any
=
this
;
if
(
!
Object
.
is
(
newVal
,
oldVal
)
&&
_this
.
engine
)
{
_this
.
parseViewParam
();
_this
.
engine
.
load
();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
containerModel
:
any
=
{
view_form
:
{
name
:
'form'
,
type
:
'FORM'
},
view_okbtn
:
{
name
:
'okbtn'
,
type
:
'button'
,
text
:
'确定'
,
disabled
:
true
},
view_cancelbtn
:
{
name
:
'cancelbtn'
,
type
:
'button'
,
text
:
'取消'
,
disabled
:
false
},
view_leftbtn
:
{
name
:
'leftbtn'
,
type
:
'button'
,
text
:
'左移'
,
disabled
:
true
},
view_rightbtn
:
{
name
:
'rightbtn'
,
type
:
'button'
,
text
:
'右移'
,
disabled
:
true
},
view_allleftbtn
:
{
name
:
'allleftbtn'
,
type
:
'button'
,
text
:
'全部左移'
,
disabled
:
true
},
view_allrightbtn
:
{
name
:
'allrightbtn'
,
type
:
'button'
,
text
:
'全部右移'
,
disabled
:
true
},
};
/**
* 计数器刷新
*
* @memberof IBZOrganizationOptionViewBase
*/
public
counterRefresh
(){
const
_this
:
any
=
this
;
if
(
_this
.
counterServiceArray
&&
_this
.
counterServiceArray
.
length
>
0
){
_this
.
counterServiceArray
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
refreshData
&&
item
.
refreshData
instanceof
Function
){
item
.
refreshData
();
}
})
}
}
/**
* 视图状态订阅对象
*
* @private
* @type {Subject<{action: string, data: any}>}
* @memberof IBZOrganizationOptionViewBase
*/
protected
viewState
:
Subject
<
ViewState
>
=
new
Subject
();
/**
* 视图引擎
*
* @private
* @type {Engine}
* @memberof IBZOrganizationOptionViewBase
*/
private
engine
:
OptionViewEngine
=
new
OptionViewEngine
();
/**
* 引擎初始化
*
* @private
* @memberof IBZOrganizationOptionViewBase
*/
private
engineInit
():
void
{
this
.
engine
.
init
({
view
:
this
,
form
:
this
.
$refs
.
form
,
p2k
:
'0'
,
keyPSDEField
:
'ibzorganization'
,
majorPSDEField
:
'orgname'
,
isLoadDefault
:
true
,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
context
:
any
=
{};
/**
* 视图参数
*
* @type {*}
* @memberof IBZOrganizationOptionViewBase
*/
protected
viewparams
:
any
=
{};
/**
* 解析视图参数
*
* @private
* @memberof IBZOrganizationOptionViewBase
*/
private
parseViewParam
():
void
{
for
(
let
key
in
this
.
context
){
delete
this
.
context
[
key
];
}
if
(
!
this
.
viewDefaultUsage
&&
this
.
viewdata
&&
!
Object
.
is
(
this
.
viewdata
,
''
))
{
Object
.
assign
(
this
.
context
,
JSON
.
parse
(
this
.
viewdata
));
if
(
this
.
context
&&
this
.
context
.
srfparentdename
){
Object
.
assign
(
this
.
viewparams
,{
srfparentdename
:
this
.
context
.
srfparentdename
});
}
if
(
this
.
context
&&
this
.
context
.
srfparentkey
){
Object
.
assign
(
this
.
viewparams
,{
srfparentkey
:
this
.
context
.
srfparentkey
});
}
this
.
handleCustomViewData
();
return
;
}
const
path
=
(
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
]).
path
;
const
keys
:
Array
<
any
>
=
[];
const
curReg
=
this
.
$pathToRegExp
.
pathToRegexp
(
path
,
keys
);
const
matchArray
=
curReg
.
exec
(
this
.
$route
.
path
);
let
tempValue
:
Object
=
{};
keys
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
.
name
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
this
.
$viewTool
.
formatRouteParams
(
tempValue
,
this
.
$route
,
this
.
context
,
this
.
viewparams
);
if
(
this
.
$store
.
getters
.
getAppData
()
&&
this
.
$store
.
getters
.
getAppData
().
context
){
Object
.
assign
(
this
.
context
,
this
.
$store
.
getters
.
getAppData
().
context
);
}
//初始化视图唯一标识
Object
.
assign
(
this
.
context
,{
srfsessionid
:
this
.
$util
.
createUUID
()});
this
.
handleCustomViewData
();
}
/**
* 处理自定义视图数据
*
* @memberof IBZOrganizationOptionViewBase
*/
public
handleCustomViewData
(){
if
(
Object
.
keys
(
this
.
customViewNavContexts
).
length
>
0
){
Object
.
keys
(
this
.
customViewNavContexts
).
forEach
((
item
:
any
)
=>
{
let
tempContext
:
any
=
{};
let
curNavContext
:
any
=
this
.
customViewNavContexts
[
item
];
this
.
handleCustomDataLogic
(
curNavContext
,
tempContext
,
item
);
Object
.
assign
(
this
.
context
,
tempContext
);
})
}
if
(
Object
.
keys
(
this
.
customViewParams
).
length
>
0
){
Object
.
keys
(
this
.
customViewParams
).
forEach
((
item
:
any
)
=>
{
let
tempParam
:
any
=
{};
let
curNavParam
:
any
=
this
.
customViewParams
[
item
];
this
.
handleCustomDataLogic
(
curNavParam
,
tempParam
,
item
);
Object
.
assign
(
this
.
viewparams
,
tempParam
);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBZOrganizationOptionViewBase
*/
public
handleCustomDataLogic
(
curNavData
:
any
,
tempData
:
any
,
item
:
string
){
// 直接值直接赋值
if
(
curNavData
.
isRawValue
){
if
(
Object
.
is
(
curNavData
.
value
,
"null"
)
||
Object
.
is
(
curNavData
.
value
,
""
)){
Object
.
defineProperty
(
tempData
,
item
,
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
,
{
value
:
curNavData
.
value
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
}
else
{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if
(
this
.
context
[
curNavData
.
value
]){
Object
.
defineProperty
(
tempData
,
item
,
{
value
:
this
.
context
[
curNavData
.
value
],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
if
(
this
.
viewparams
[
curNavData
.
value
]){
Object
.
defineProperty
(
tempData
,
item
,
{
value
:
this
.
viewparams
[
curNavData
.
value
],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
,
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
created
()
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
afterCreated
(){
const
secondtag
=
this
.
$util
.
createUUID
();
this
.
$store
.
commit
(
'viewaction/createdView'
,
{
viewtag
:
this
.
viewtag
,
secondtag
:
secondtag
});
this
.
viewtag
=
secondtag
;
this
.
parseViewParam
();
}
/**
* 销毁之前
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
beforeDestroy
()
{
this
.
$store
.
commit
(
'viewaction/removeView'
,
this
.
viewtag
);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
mounted
()
{
this
.
afterMounted
();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
afterMounted
(){
const
_this
:
any
=
this
;
_this
.
engineInit
();
if
(
_this
.
loadModel
&&
_this
.
loadModel
instanceof
Function
)
{
_this
.
loadModel
();
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZOrganizationOptionViewBase
*/
protected
form_save
(
$event
:
any
,
$event2
?:
any
)
{
this
.
engine
.
onCtrlEvent
(
'form'
,
'save'
,
$event
);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZOrganizationOptionViewBase
*/
protected
form_remove
(
$event
:
any
,
$event2
?:
any
)
{
this
.
engine
.
onCtrlEvent
(
'form'
,
'remove'
,
$event
);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZOrganizationOptionViewBase
*/
protected
form_load
(
$event
:
any
,
$event2
?:
any
)
{
this
.
engine
.
onCtrlEvent
(
'form'
,
'load'
,
$event
);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBZOrganizationOptionViewBase
*/
protected
closeView
(
args
:
any
[]):
void
{
let
_view
:
any
=
this
;
if
(
_view
.
viewdata
)
{
_view
.
$emit
(
'viewdataschange'
,
[
args
]);
_view
.
$emit
(
'close'
,
[
args
]);
}
else
if
(
_view
.
$tabPageExp
)
{
_view
.
$tabPageExp
.
onClose
(
_view
.
$route
.
fullPath
);
}
}
/**
* 销毁视图回调
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
destroyed
(){
this
.
afterDestroyed
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZOrganizationOptionViewBase
*/
protected
afterDestroyed
(){
if
(
this
.
viewDefaultUsage
){
let
localStoreLength
=
Object
.
keys
(
localStorage
);
if
(
localStoreLength
.
length
>
0
){
localStoreLength
.
forEach
((
item
:
string
)
=>
{
if
(
item
.
startsWith
(
this
.
context
.
srfsessionid
)){
localStorage
.
removeItem
(
item
);
}
})
}
}
}
/**
* 确定
*
* @memberof IBZOrganizationOptionViewBase
*/
public
onClickOk
():
void
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
!
form
)
return
;
form
.
save
().
then
((
res
:
any
)
=>
{
if
(
res
.
status
==
200
){
this
.
$emit
(
'close'
,[
res
.
data
]);
}
});
}
/**
* 取消
*
* @memberof IBZOrganizationOptionViewBase
*/
public
onClickCancel
():
void
{
this
.
$emit
(
'close'
,
null
);
}
}
</
script
>
<
style
lang=
'less'
>
@import './ibzorganization-option-view.less';
</
style
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/pages/ou/ibzorganization-option-view/ibzorganization-option-view.less
0 → 100644
浏览文件 @
0ebf83eb
.ibzorganization-option-view{
position: relative;
}
.view-container {
.view-card {
.ivu-card-body {
.content-container{
height: calc(100% - 64px);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/pages/ou/ibzorganization-option-view/ibzorganization-option-view.vue
0 → 100644
浏览文件 @
0ebf83eb
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
IBZOrganizationOptionViewBase
from
'./ibzorganization-option-view-base.vue'
;
import
view_form
from
'@widgets/ibzorganization/new-form-form/new-form-form.vue'
;
@
Component
({
components
:
{
view_form
,
},
beforeRouteEnter
:
(
to
:
any
,
from
:
any
,
next
:
any
)
=>
{
next
((
vm
:
any
)
=>
{
vm
.
$store
.
commit
(
'addCurPageViewtag'
,
{
fullPath
:
to
.
fullPath
,
viewtag
:
vm
.
viewtag
});
});
},
})
export
default
class
IBZOrganizationOptionView
extends
IBZOrganizationOptionViewBase
{
}
</
script
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/store/modules/view-action/state.ts
浏览文件 @
0ebf83eb
...
...
@@ -10,6 +10,7 @@ export const viewstate: any = {
viewaction
:
''
,
viewdatachange
:
false
,
refviews
:
[
'9e25d15d43ff644fa008c9cf7d063ac3'
,
],
},
{
...
...
@@ -31,6 +32,7 @@ export const viewstate: any = {
viewdatachange
:
false
,
refviews
:
[
'9e25d15d43ff644fa008c9cf7d063ac3'
,
'b59db4df07430a34645566a64d59244c'
,
],
},
{
...
...
@@ -61,6 +63,16 @@ export const viewstate: any = {
refviews
:
[
],
},
{
viewtag
:
'995d26f289a30e31573d557a5f5ba254'
,
viewmodule
:
'ou'
,
viewname
:
'IBZOrganizationOptionView'
,
viewaction
:
''
,
viewdatachange
:
false
,
refviews
:
[
'9e25d15d43ff644fa008c9cf7d063ac3'
,
],
},
{
viewtag
:
'9e25d15d43ff644fa008c9cf7d063ac3'
,
viewmodule
:
'ou'
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/uiservice/ibzorganization/ibzorganization-ui-service-base.ts
浏览文件 @
0ebf83eb
...
...
@@ -81,6 +81,7 @@ export default class IBZOrganizationUIServiceBase extends UIService {
public
initViewMap
(){
this
.
allViewMap
.
set
(
'EDITVIEW:'
,{
viewname
:
'editview'
,
srfappde
:
'ibzorganizations'
});
this
.
allViewMap
.
set
(
':'
,{
viewname
:
'pickupgridview'
,
srfappde
:
'ibzorganizations'
});
this
.
allViewMap
.
set
(
':'
,{
viewname
:
'optionview'
,
srfappde
:
'ibzorganizations'
});
this
.
allViewMap
.
set
(
'PICKUPVIEW:'
,{
viewname
:
'pickupview'
,
srfappde
:
'ibzorganizations'
});
this
.
allViewMap
.
set
(
'MDATAVIEW:'
,{
viewname
:
'gridview'
,
srfappde
:
'ibzorganizations'
});
}
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzdepartment/main-form/main-form-base.vue
浏览文件 @
0ebf83eb
...
...
@@ -20,6 +20,31 @@
<input-box
v-model=
"data.deptname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.deptname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.pdeptname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'pdeptname'
:itemRules=
"this.rules.pdeptname"
class=
''
:caption=
"$t('entities.ibzdepartment.main_form.details.pdeptname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.pdeptname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<app-picker
:formState=
"formState"
:data=
"data"
:context=
"context"
:viewparams=
"viewparams"
:itemParam=
'
{ }'
:disabled="detailsModel.pdeptname.disabled"
name='pdeptname'
deMajorField='deptname'
deKeyField='ibzdepartment'
:service="service"
:acParams="{ serviceName: 'IBZDepartmentService', interfaceName: 'FetchDefault'}"
valueitem='pdeptid'
:value="data.pdeptname"
editortype=""
:pickupView="{ viewname: 'ibzdepartment-pickup-view', title: $t('entities.ibzdepartment.views.pickupview.title'), deResParameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, ], parameters: [{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<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"
>
...
...
@@ -385,6 +410,7 @@ export default class MainBase extends Vue implements ControlInterface {
deptid
:
null
,
deptcode
:
null
,
deptname
:
null
,
pdeptname
:
null
,
orgname
:
null
,
orgid
:
null
,
pdeptid
:
null
,
...
...
@@ -502,6 +528,12 @@ export default class MainBase extends Vue implements ControlInterface {
{
required
:
true
,
type
:
'string'
,
message
:
'部门名称 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'部门名称 值不能为空'
,
trigger
:
'blur'
},
],
pdeptname
:
[
{
type
:
'string'
,
message
:
'上级部门 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'上级部门 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级部门 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级部门 值不能为空'
,
trigger
:
'blur'
},
],
orgname
:
[
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'blur'
},
...
...
@@ -588,6 +620,8 @@ export default class MainBase extends Vue implements ControlInterface {
deptcode
:
new
FormItemModel
({
caption
:
'部门代码'
,
detailType
:
'FORMITEM'
,
name
:
'deptcode'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
1
})
,
deptname
:
new
FormItemModel
({
caption
:
'部门名称'
,
detailType
:
'FORMITEM'
,
name
:
'deptname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
pdeptname
:
new
FormItemModel
({
caption
:
'上级部门'
,
detailType
:
'FORMITEM'
,
name
:
'pdeptname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orgname
:
new
FormItemModel
({
caption
:
'单位'
,
detailType
:
'FORMITEM'
,
name
:
'orgname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
...
...
@@ -741,6 +775,18 @@ export default class MainBase extends Vue implements ControlInterface {
this
.
formDataChange
({
name
:
'deptname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 pdeptname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.pdeptname'
)
onPdeptnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'pdeptname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgname 值
*
...
...
@@ -904,6 +950,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzdepartment/main-form/main-form-model.ts
浏览文件 @
0ebf83eb
...
...
@@ -70,6 +70,11 @@ export default class MainModel {
prop
:
'deptname'
,
dataType
:
'TEXT'
,
},
{
name
:
'pdeptname'
,
prop
:
'pdeptname'
,
dataType
:
'PICKUPTEXT'
,
},
{
name
:
'orgname'
,
prop
:
'orgname'
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzdepartment/main-form/main-form-service.ts
浏览文件 @
0ebf83eb
...
...
@@ -89,6 +89,9 @@ export default class MainService extends ControlService {
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
if
(
Object
.
is
(
serviceName
,
'IBZDepartmentService'
)
&&
Object
.
is
(
interfaceName
,
'FetchDefault'
))
{
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'
);
}
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzdepartment/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
浏览文件 @
0ebf83eb
...
...
@@ -30,6 +30,9 @@ export default class PickupViewpickupviewpanelModel {
{
name
:
'parentdeptid'
,
},
{
name
:
'pdeptname'
,
},
{
name
:
'shortname'
,
},
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/main-form/main-form-base.vue
浏览文件 @
0ebf83eb
...
...
@@ -20,6 +20,31 @@
<input-box
v-model=
"data.orgname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.orgname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.porgname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'porgname'
:itemRules=
"this.rules.porgname"
class=
''
:caption=
"$t('entities.ibzorganization.main_form.details.porgname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.porgname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<app-picker
:formState=
"formState"
:data=
"data"
:context=
"context"
:viewparams=
"viewparams"
:itemParam=
'
{ }'
:disabled="detailsModel.porgname.disabled"
name='porgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='porgid'
:value="data.porgname"
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>
</i-col>
<i-col
v-show=
"detailsModel.orglevel.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'orglevel'
:itemRules=
"this.rules.orglevel"
class=
''
:caption=
"$t('entities.ibzorganization.main_form.details.orglevel')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.orglevel.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
...
...
@@ -354,12 +379,13 @@ export default class MainBase extends Vue implements ControlInterface {
orgid
:
null
,
orgcode
:
null
,
orgname
:
null
,
porg
id
:
null
,
porg
name
:
null
,
orglevel
:
null
,
shortname
:
null
,
showorder
:
null
,
createdate
:
null
,
updatedate
:
null
,
porgid
:
null
,
ibzorganization
:
null
,
};
...
...
@@ -468,7 +494,7 @@ export default class MainBase extends Vue implements ControlInterface {
{
required
:
true
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'blur'
},
],
porg
id
:
[
porg
name
:
[
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'change'
},
...
...
@@ -504,6 +530,12 @@ export default class MainBase extends Vue implements ControlInterface {
{
required
:
false
,
type
:
'string'
,
message
:
'最后修改时间 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'最后修改时间 值不能为空'
,
trigger
:
'blur'
},
],
porgid
:
[
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'blur'
},
],
}
/**
...
...
@@ -537,7 +569,7 @@ export default class MainBase extends Vue implements ControlInterface {
,
orgname
:
new
FormItemModel
({
caption
:
'名称'
,
detailType
:
'FORMITEM'
,
name
:
'orgname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
porg
id
:
new
FormItemModel
({
caption
:
'上级单位'
,
detailType
:
'FORMITEM'
,
name
:
'porgid
'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
porg
name
:
new
FormItemModel
({
caption
:
'上级单位'
,
detailType
:
'FORMITEM'
,
name
:
'porgname
'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orglevel
:
new
FormItemModel
({
caption
:
'单位级别'
,
detailType
:
'FORMITEM'
,
name
:
'orglevel'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
...
...
@@ -548,6 +580,8 @@ export default class MainBase extends Vue implements ControlInterface {
createdate
:
new
FormItemModel
({
caption
:
'创建时间'
,
detailType
:
'FORMITEM'
,
name
:
'createdate'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
updatedate
:
new
FormItemModel
({
caption
:
'最后修改时间'
,
detailType
:
'FORMITEM'
,
name
:
'updatedate'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
porgid
:
new
FormItemModel
({
caption
:
'上级单位'
,
detailType
:
'FORMITEM'
,
name
:
'porgid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
};
...
...
@@ -684,15 +718,15 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 监控表单属性 porg
id
值
* 监控表单属性 porg
name
值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.porg
id
'
)
onPorg
id
Change
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'porg
id
'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
@
Watch
(
'data.porg
name
'
)
onPorg
name
Change
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'porg
name
'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
...
...
@@ -755,6 +789,18 @@ export default class MainBase extends Vue implements ControlInterface {
this
.
formDataChange
({
name
:
'updatedate'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 porgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.porgid'
)
onPorgidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'porgid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 重置表单项值
...
...
@@ -809,6 +855,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/main-form/main-form-model.ts
浏览文件 @
0ebf83eb
...
...
@@ -71,9 +71,9 @@ export default class MainModel {
dataType
:
'TEXT'
,
},
{
name
:
'porg
id
'
,
prop
:
'p
arentorgid
'
,
dataType
:
'PICKUP'
,
name
:
'porg
name
'
,
prop
:
'p
orgname
'
,
dataType
:
'PICKUP
TEXT
'
,
},
{
name
:
'orglevel'
,
...
...
@@ -100,6 +100,11 @@ export default class MainModel {
prop
:
'updatedate'
,
dataType
:
'DATETIME'
,
},
{
name
:
'porgid'
,
prop
:
'parentorgid'
,
dataType
:
'PICKUP'
,
},
{
name
:
'ibzorganization'
,
prop
:
'orgid'
,
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/main-form/main-form-service.ts
浏览文件 @
0ebf83eb
...
...
@@ -80,6 +80,9 @@ export default class MainService extends ControlService {
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
if
(
Object
.
is
(
serviceName
,
'IBZOrganizationService'
)
&&
Object
.
is
(
interfaceName
,
'FetchDefault'
))
{
return
this
.
doItems
(
this
.
appEntityService
.
FetchDefault
(
JSON
.
parse
(
JSON
.
stringify
(
context
)),
data
,
isloading
),
'orgid'
,
'ibzorganization'
);
}
return
Promise
.
reject
([])
}
...
...
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/new-form-form/new-form-form-base.vue
0 → 100644
浏览文件 @
0ebf83eb
<
template
>
<i-form
:model=
"this.data"
class=
'app-form'
ref=
'form'
id=
'form'
style=
""
>
<input
style=
"display:none;"
/>
<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"
>
<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"
>
<input-box
v-model=
"data.orgcode"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.orgcode.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<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.ibzorganization.newform_form.details.orgname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.orgname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.orgname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.orgname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.porgname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'porgname'
:itemRules=
"this.rules.porgname"
class=
''
:caption=
"$t('entities.ibzorganization.newform_form.details.porgname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.porgname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<app-picker
:formState=
"formState"
:data=
"data"
:context=
"context"
:viewparams=
"viewparams"
:itemParam=
'
{ }'
:disabled="detailsModel.porgname.disabled"
name='porgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='porgid'
:value="data.porgname"
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>
</i-col>
<i-col
v-show=
"detailsModel.orglevel.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'orglevel'
:itemRules=
"this.rules.orglevel"
class=
''
:caption=
"$t('entities.ibzorganization.newform_form.details.orglevel')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.orglevel.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.orglevel"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.orglevel.disabled"
type=
'number'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.shortname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'shortname'
:itemRules=
"this.rules.shortname"
class=
''
:caption=
"$t('entities.ibzorganization.newform_form.details.shortname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.shortname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.shortname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.shortname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.showorder.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'showorder'
:itemRules=
"this.rules.showorder"
class=
''
:caption=
"$t('entities.ibzorganization.newform_form.details.showorder')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.showorder.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.showorder"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.showorder.disabled"
type=
'number'
style=
""
></input-box>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</row>
</i-form>
</
template
>
<
script
lang=
'tsx'
>
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
,
Model
}
from
'vue-property-decorator'
;
import
{
CreateElement
}
from
'vue'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
ControlInterface
}
from
'@/interface/control'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
IBZOrganizationService
from
'@/service/ibzorganization/ibzorganization-service'
;
import
NewFormService
from
'./new-form-form-service'
;
import
{
FormButtonModel
,
FormPageModel
,
FormItemModel
,
FormDRUIPartModel
,
FormPartModel
,
FormGroupPanelModel
,
FormIFrameModel
,
FormRowItemModel
,
FormTabPageModel
,
FormTabPanelModel
,
FormUserControlModel
}
from
'@/model/form-detail'
;
import
{
debounceTime
,
distinctUntilChanged
}
from
'rxjs/operators'
;
@
Component
({
components
:
{
}
})
export
default
class
NewFormBase
extends
Vue
implements
ControlInterface
{
/**
* 名称
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
name
?:
string
;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof NewForm
*/
@
Prop
()
protected
viewState
!
:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof NewForm
*/
@
Prop
()
protected
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof NewForm
*/
@
Prop
()
protected
viewparams
:
any
;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
protected
viewStateEvent
:
Subscription
|
undefined
;
/**
* 获取部件类型
*
* @returns {string}
* @memberof NewForm
*/
protected
getControlType
():
string
{
return
'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof NewForm
*/
protected
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 建构部件服务对象
*
* @type {NewFormService}
* @memberof NewForm
*/
protected
service
:
NewFormService
=
new
NewFormService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {IBZOrganizationService}
* @memberof NewForm
*/
protected
appEntityService
:
IBZOrganizationService
=
new
IBZOrganizationService
({
$store
:
this
.
$store
});
/**
* 关闭视图
*
* @param {any} args
* @memberof NewForm
*/
protected
closeView
(
args
:
any
):
void
{
let
_this
:
any
=
this
;
_this
.
$emit
(
'closeview'
,
[
args
]);
}
/**
* 计数器刷新
*
* @memberof NewForm
*/
public
counterRefresh
(){
const
_this
:
any
=
this
;
if
(
_this
.
counterServiceArray
&&
_this
.
counterServiceArray
.
length
>
0
){
_this
.
counterServiceArray
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
refreshData
&&
item
.
refreshData
instanceof
Function
){
item
.
refreshData
();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof NewForm
*/
public
getDatas
():
any
[]
{
return
[
this
.
data
];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof NewForm
*/
public
getData
():
any
{
return
this
.
data
;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof NewForm
*/
@
Prop
({
default
:
false
})
protected
autosave
?:
boolean
;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof NewForm
*/
@
Prop
({
default
:
true
})
protected
showBusyIndicator
?:
boolean
;
/**
* 部件行为--submit
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
WFSubmitAction
!
:
string
;
/**
* 部件行为--start
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
WFStartAction
!
:
string
;
/**
* 部件行为--update
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
updateAction
!
:
string
;
/**
* 部件行为--remove
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
removeAction
!
:
string
;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
loaddraftAction
!
:
string
;
/**
* 部件行为--load
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
loadAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
createAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
searchAction
!
:
string
;
/**
* 视图标识
*
* @type {string}
* @memberof NewForm
*/
@
Prop
()
protected
viewtag
!
:
string
;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof NewForm
*/
protected
formState
:
Subject
<
any
>
=
new
Subject
();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof NewForm
*/
protected
ignorefieldvaluechange
:
boolean
=
false
;
/**
* 数据变化
*
* @private
* @type {Subject<any>}
* @memberof NewForm
*/
private
dataChang
:
Subject
<
any
>
=
new
Subject
();
/**
* 视图状态事件
*
* @private
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
private
dataChangEvent
:
Subscription
|
undefined
;
/**
* 原始数据
*
* @private
* @type {*}
* @memberof NewForm
*/
private
oldData
:
any
=
{};
/**
* 表单数据对象
*
* @type {*}
* @memberof NewForm
*/
protected
data
:
any
=
{
srfupdatedate
:
null
,
srforikey
:
null
,
srfkey
:
null
,
srfmajortext
:
null
,
srftempmode
:
null
,
srfuf
:
null
,
srfdeid
:
null
,
srfsourcekey
:
null
,
orgcode
:
null
,
orgname
:
null
,
porgname
:
null
,
orglevel
:
null
,
shortname
:
null
,
showorder
:
null
,
orgid
:
null
,
porgid
:
null
,
ibzorganization
:
null
,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof NewForm
*/
protected
currentAction
:
string
=
""
;
/**
* 关系界面计数器
*
* @type {number}
* @memberof NewForm
*/
protected
drcounter
:
number
=
0
;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof NewForm
*/
protected
drsaveopt
:
any
=
{};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof NewForm
*/
protected
saveState
:
any
;
/**
* 属性值规则
*
* @type {*}
* @memberof NewForm
*/
protected
rules
:
any
=
{
srfupdatedate
:
[
{
type
:
'string'
,
message
:
'最后修改时间 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'最后修改时间 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'最后修改时间 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'最后修改时间 值不能为空'
,
trigger
:
'blur'
},
],
srforikey
:
[
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'blur'
},
],
srfkey
:
[
{
type
:
'string'
,
message
:
'单位标识 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位标识 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位标识 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位标识 值不能为空'
,
trigger
:
'blur'
},
],
srfmajortext
:
[
{
type
:
'string'
,
message
:
'名称 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'名称 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'blur'
},
],
srftempmode
:
[
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'blur'
},
],
srfuf
:
[
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'blur'
},
],
srfdeid
:
[
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'blur'
},
],
srfsourcekey
:
[
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
' 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
' 值不能为空'
,
trigger
:
'blur'
},
],
orgcode
:
[
{
type
:
'string'
,
message
:
'单位代码 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位代码 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
true
,
type
:
'string'
,
message
:
'单位代码 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'单位代码 值不能为空'
,
trigger
:
'blur'
},
],
orgname
:
[
{
type
:
'string'
,
message
:
'名称 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'名称 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
true
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'名称 值不能为空'
,
trigger
:
'blur'
},
],
porgname
:
[
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'blur'
},
],
orglevel
:
[
{
type
:
'number'
,
message
:
'单位级别 值必须为数值类型'
,
trigger
:
'change'
},
{
type
:
'number'
,
message
:
'单位级别 值必须为数值类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'number'
,
message
:
'单位级别 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'number'
,
message
:
'单位级别 值不能为空'
,
trigger
:
'blur'
},
],
shortname
:
[
{
type
:
'string'
,
message
:
'单位简称 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位简称 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位简称 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位简称 值不能为空'
,
trigger
:
'blur'
},
],
showorder
:
[
{
type
:
'number'
,
message
:
'排序 值必须为数值类型'
,
trigger
:
'change'
},
{
type
:
'number'
,
message
:
'排序 值必须为数值类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'number'
,
message
:
'排序 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'number'
,
message
:
'排序 值不能为空'
,
trigger
:
'blur'
},
],
orgid
:
[
{
type
:
'string'
,
message
:
'单位标识 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位标识 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位标识 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位标识 值不能为空'
,
trigger
:
'blur'
},
],
porgid
:
[
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'上级单位 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'上级单位 值不能为空'
,
trigger
:
'blur'
},
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof NewForm
*/
protected
detailsModel
:
any
=
{
group1
:
new
FormGroupPanelModel
({
caption
:
'单位机构基本信息'
,
detailType
:
'GROUPPANEL'
,
name
:
'group1'
,
visible
:
true
,
isShowCaption
:
false
,
form
:
this
,
uiActionGroup
:
{
caption
:
''
,
langbase
:
'entities.ibzorganization.newform_form'
,
extractMode
:
'ITEM'
,
details
:
[]
}
})
,
formpage1
:
new
FormPageModel
({
caption
:
'基本信息'
,
detailType
:
'FORMPAGE'
,
name
:
'formpage1'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
})
,
srfupdatedate
:
new
FormItemModel
({
caption
:
'最后修改时间'
,
detailType
:
'FORMITEM'
,
name
:
'srfupdatedate'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srforikey
:
new
FormItemModel
({
caption
:
''
,
detailType
:
'FORMITEM'
,
name
:
'srforikey'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srfkey
:
new
FormItemModel
({
caption
:
'单位标识'
,
detailType
:
'FORMITEM'
,
name
:
'srfkey'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
1
})
,
srfmajortext
:
new
FormItemModel
({
caption
:
'名称'
,
detailType
:
'FORMITEM'
,
name
:
'srfmajortext'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srftempmode
:
new
FormItemModel
({
caption
:
''
,
detailType
:
'FORMITEM'
,
name
:
'srftempmode'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srfuf
:
new
FormItemModel
({
caption
:
''
,
detailType
:
'FORMITEM'
,
name
:
'srfuf'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srfdeid
:
new
FormItemModel
({
caption
:
''
,
detailType
:
'FORMITEM'
,
name
:
'srfdeid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
srfsourcekey
:
new
FormItemModel
({
caption
:
''
,
detailType
:
'FORMITEM'
,
name
:
'srfsourcekey'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orgcode
:
new
FormItemModel
({
caption
:
'单位代码'
,
detailType
:
'FORMITEM'
,
name
:
'orgcode'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
1
})
,
orgname
:
new
FormItemModel
({
caption
:
'名称'
,
detailType
:
'FORMITEM'
,
name
:
'orgname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
porgname
:
new
FormItemModel
({
caption
:
'上级单位'
,
detailType
:
'FORMITEM'
,
name
:
'porgname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orglevel
:
new
FormItemModel
({
caption
:
'单位级别'
,
detailType
:
'FORMITEM'
,
name
:
'orglevel'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
shortname
:
new
FormItemModel
({
caption
:
'单位简称'
,
detailType
:
'FORMITEM'
,
name
:
'shortname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
showorder
:
new
FormItemModel
({
caption
:
'排序'
,
detailType
:
'FORMITEM'
,
name
:
'showorder'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orgid
:
new
FormItemModel
({
caption
:
'单位标识'
,
detailType
:
'FORMITEM'
,
name
:
'orgid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
1
})
,
porgid
:
new
FormItemModel
({
caption
:
'上级单位'
,
detailType
:
'FORMITEM'
,
name
:
'porgid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfupdatedate'
)
onSrfupdatedateChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfupdatedate'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srforikey'
)
onSrforikeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srforikey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfkey'
)
onSrfkeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfkey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfmajortext'
)
onSrfmajortextChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfmajortext'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srftempmode'
)
onSrftempmodeChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srftempmode'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfuf'
)
onSrfufChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfuf'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfdeid'
)
onSrfdeidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfdeid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.srfsourcekey'
)
onSrfsourcekeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfsourcekey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgcode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.orgcode'
)
onOrgcodeChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'orgcode'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.orgname'
)
onOrgnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'orgname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 porgname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.porgname'
)
onPorgnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'porgname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orglevel 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.orglevel'
)
onOrglevelChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'orglevel'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 shortname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.shortname'
)
onShortnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'shortname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 showorder 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.showorder'
)
onShoworderChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'showorder'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.orgid'
)
onOrgidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'orgid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 porgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@
Watch
(
'data.porgid'
)
onPorgidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'porgid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 重置表单项值
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof NewForm
*/
private
resetFormData
({
name
,
newVal
,
oldVal
}:
{
name
:
string
,
newVal
:
any
,
oldVal
:
any
}):
void
{
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof EditForm
*/
protected
ResetData
(
_datas
:
any
){
if
(
Object
.
keys
(
_datas
).
length
>
0
){
Object
.
keys
(
_datas
).
forEach
((
name
:
string
)
=>
{
if
(
this
.
data
.
hasOwnProperty
(
name
))
{
this
.
data
[
name
]
=
null
;
}
});
}
}
/**
* 表单逻辑
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof NewForm
*/
private
formLogic
({
name
,
newVal
,
oldVal
}:
{
name
:
string
,
newVal
:
any
,
oldVal
:
any
}):
void
{
}
/**
* 表单值变化
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof NewForm
*/
private
formDataChange
({
name
,
newVal
,
oldVal
}:
{
name
:
string
,
newVal
:
any
,
oldVal
:
any
}):
void
{
if
(
this
.
ignorefieldvaluechange
)
{
return
;
}
this
.
resetFormData
({
name
:
name
,
newVal
:
newVal
,
oldVal
:
oldVal
});
this
.
formLogic
({
name
:
name
,
newVal
:
newVal
,
oldVal
:
oldVal
});
this
.
dataChang
.
next
(
JSON
.
stringify
(
this
.
data
));
}
/**
* 表单加载完成
*
* @private
* @param {*} [data={}]
* @param {string} [action]
* @memberof NewForm
*/
private
onFormLoad
(
data
:
any
=
{},
action
:
string
):
void
{
if
(
Object
.
is
(
action
,
"save"
)
||
Object
.
is
(
action
,
"autoSave"
))
// 更新context的实体主键
if
(
data
.
ibzorganization
){
Object
.
assign
(
this
.
context
,{
ibzorganization
:
data
.
ibzorganization
})
}
this
.
setFormEnableCond
(
data
);
this
.
fillForm
(
data
,
action
);
this
.
oldData
=
{};
Object
.
assign
(
this
.
oldData
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
data
)));
this
.
$store
.
commit
(
'viewaction/setViewDataChange'
,
{
viewtag
:
this
.
viewtag
,
viewdatachange
:
false
});
this
.
formLogic
({
name
:
''
,
newVal
:
null
,
oldVal
:
null
});
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof NewForm
*/
protected
fillForm
(
_datas
:
any
=
{},
action
:
string
):
void
{
this
.
ignorefieldvaluechange
=
true
;
Object
.
keys
(
_datas
).
forEach
((
name
:
string
)
=>
{
if
(
this
.
data
.
hasOwnProperty
(
name
))
{
this
.
data
[
name
]
=
_datas
[
name
];
}
});
if
(
Object
.
is
(
action
,
'loadDraft'
)){
this
.
createDefault
();
}
this
.
$nextTick
(
function
()
{
this
.
ignorefieldvaluechange
=
false
;
})
}
/**
* 设置表单项是否启用
*
* @protected
* @param {*} data
* @memberof NewForm
*/
protected
setFormEnableCond
(
data
:
any
):
void
{
Object
.
values
(
this
.
detailsModel
).
forEach
((
detail
:
any
)
=>
{
if
(
!
Object
.
is
(
detail
.
detailType
,
'FORMITEM'
))
{
return
;
}
const
formItem
:
FormItemModel
=
detail
;
formItem
.
setEnableCond
(
data
.
srfuf
);
});
}
/**
* 重置草稿表单状态
*
* @private
* @memberof NewForm
*/
private
resetDraftFormStates
():
void
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
form
)
{
form
.
resetFields
();
}
}
/**
* 重置校验结果
*
* @memberof NewForm
*/
protected
resetValidates
():
void
{
Object
.
values
(
this
.
detailsModel
).
forEach
((
detail
:
any
)
=>
{
if
(
!
Object
.
is
(
detail
.
detailType
,
'FORMITEM'
))
{
return
;
}
const
formItem
:
FormItemModel
=
detail
;
formItem
.
setError
(
''
);
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof NewForm
*/
protected
fillValidates
(
fieldErrors
:
any
[]):
void
{
fieldErrors
.
forEach
((
error
:
any
)
=>
{
const
formItem
:
FormItemModel
=
this
.
detailsModel
[
error
.
field
];
if
(
!
formItem
)
{
return
;
}
this
.
$nextTick
(()
=>
{
formItem
.
setError
(
error
.
message
);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof NewForm
*/
protected
formValidateStatus
():
boolean
{
const
form
:
any
=
this
.
$refs
.
form
;
let
validatestate
:
boolean
=
true
;
form
.
validate
((
valid
:
boolean
)
=>
{
validatestate
=
valid
?
true
:
false
;
});
return
validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof NewForm
*/
protected
getValues
():
any
{
return
this
.
data
;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof NewForm
*/
protected
onFormItemValueChange
(
$event
:
{
name
:
string
,
value
:
any
}):
void
{
if
(
!
$event
)
{
return
;
}
if
(
!
$event
.
name
||
Object
.
is
(
$event
.
name
,
''
)
||
!
this
.
data
.
hasOwnProperty
(
$event
.
name
))
{
return
;
}
this
.
data
[
$event
.
name
]
=
$event
.
value
;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof NewForm
*/
protected
setDataItemValue
(
name
:
string
,
value
:
any
):
void
{
if
(
!
name
||
Object
.
is
(
name
,
''
)
||
!
this
.
data
.
hasOwnProperty
(
name
))
{
return
;
}
if
(
Object
.
is
(
this
.
data
[
name
],
value
))
{
return
;
}
this
.
data
[
name
]
=
value
;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof NewForm
*/
protected
groupUIActionClick
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
const
item
:
any
=
$event
.
item
;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof NewForm
*/
protected
created
():
void
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof NewForm
*/
protected
afterCreated
(){
if
(
this
.
viewState
)
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
if
(
Object
.
is
(
'autoload'
,
action
))
{
this
.
autoLoad
(
data
);
}
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
}
if
(
Object
.
is
(
'loaddraft'
,
action
))
{
this
.
loadDraft
(
data
);
}
if
(
Object
.
is
(
'save'
,
action
))
{
this
.
save
(
data
,
data
.
showResultInfo
);
}
if
(
Object
.
is
(
'remove'
,
action
))
{
this
.
remove
(
data
);
}
if
(
Object
.
is
(
'saveandexit'
,
action
))
{
this
.
saveAndExit
(
data
);
}
if
(
Object
.
is
(
'saveandnew'
,
action
))
{
this
.
saveAndNew
(
data
);
}
if
(
Object
.
is
(
'removeandexit'
,
action
))
{
this
.
removeAndExit
(
data
);
}
if
(
Object
.
is
(
'refresh'
,
action
))
{
this
.
refresh
(
data
);
}
});
}
this
.
dataChang
.
pipe
(
debounceTime
(
300
),
distinctUntilChanged
()
).
subscribe
((
data
:
any
)
=>
{
if
(
this
.
autosave
)
{
this
.
autoSave
();
}
const
state
=
!
Object
.
is
(
JSON
.
stringify
(
this
.
oldData
),
JSON
.
stringify
(
this
.
data
))
?
true
:
false
;
this
.
$store
.
commit
(
'viewaction/setViewDataChange'
,
{
viewtag
:
this
.
viewtag
,
viewdatachange
:
state
});
});
}
/**
* vue 生命周期
*
* @memberof NewForm
*/
protected
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof NewForm
*/
protected
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
if
(
this
.
dataChangEvent
)
{
this
.
dataChangEvent
.
unsubscribe
();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof NewForm
*/
protected
copy
(
arg
:
any
=
{}):
void
{
this
.
loadDraft
(
arg
);
}
/**
*打印
*@memberof @memberof NewForm
*/
protected
print
(){
let
_this
:
any
=
this
;
_this
.
$print
({
id
:
'form'
,
popTitle
:
'新建表单'
});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof NewForm
*/
protected
refresh
(
args
:
any
[]):
void
{
let
arg
:
any
=
{};
Object
.
assign
(
arg
,
args
[
0
]);
if
(
this
.
data
.
srfkey
&&
!
Object
.
is
(
this
.
data
.
srfkey
,
''
))
{
Object
.
assign
(
arg
,
{
srfkey
:
this
.
data
.
srfkey
});
this
.
load
(
arg
);
return
;
}
if
(
this
.
data
.
srfkeys
&&
!
Object
.
is
(
this
.
data
.
srfkeys
,
''
))
{
Object
.
assign
(
arg
,
{
srfkey
:
this
.
data
.
srfkeys
});
this
.
load
(
arg
);
return
;
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof NewForm
*/
protected
autoLoad
(
arg
:
any
=
{}):
void
{
if
(
arg
.
srfkey
&&
!
Object
.
is
(
arg
.
srfkey
,
''
))
{
Object
.
assign
(
arg
,
{
srfkey
:
arg
.
srfkey
});
this
.
load
(
arg
);
return
;
}
if
(
arg
.
srfkeys
&&
!
Object
.
is
(
arg
.
srfkeys
,
''
))
{
Object
.
assign
(
arg
,
{
srfkey
:
arg
.
srfkeys
});
this
.
load
(
arg
);
return
;
}
this
.
loadDraft
(
arg
);
}
/**
* 加载
*
* @private
* @param {*} [opt={}]
* @memberof NewForm
*/
private
load
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
loadAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单loadAction参数未配置'
});
return
;
}
const
arg
:
any
=
{
...
opt
};
let
viewparamResult
:
any
=
Object
.
assign
(
arg
,
this
.
viewparams
);
const
get
:
Promise
<
any
>
=
this
.
service
.
get
(
this
.
loadAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),{
viewparams
:
viewparamResult
},
this
.
showBusyIndicator
);
get
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
this
.
onFormLoad
(
data
,
'load'
);
this
.
$emit
(
'load'
,
data
);
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'load'
,
data
:
data
});
});
}
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof NewForm
*/
protected
loadDraft
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
loaddraftAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单loaddraftAction参数未配置'
});
return
;
}
const
arg
:
any
=
{
...
opt
}
;
let
viewparamResult
:
any
=
Object
.
assign
(
arg
,
this
.
viewparams
);
let
post
:
Promise
<
any
>
=
this
.
service
.
loadDraft
(
this
.
loaddraftAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),{
viewparams
:
viewparamResult
},
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
;
if
(
data
.
ibzorganization
){
Object
.
assign
(
this
.
context
,{
ibzorganization
:
data
.
ibzorganization
})
}
this
.
resetDraftFormStates
();
this
.
onFormLoad
(
data
,
'loadDraft'
);
this
.
$emit
(
'load'
,
data
);
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'load'
,
data
:
data
});
});
setTimeout
(()
=>
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
form
)
{
form
.
fields
.
forEach
((
field
:
any
)
=>
{
field
.
validateMessage
=
""
;
field
.
validateState
=
""
;
field
.
validateStatus
=
false
;
});
}
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof NewForm
*/
protected
autoSave
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
formValidateStatus
())
{
return
;
}
const
arg
:
any
=
{
...
opt
};
const
data
=
this
.
getValues
();
Object
.
assign
(
arg
,
data
);
const
action
:
any
=
Object
.
is
(
data
.
srfuf
,
'1'
)
?
this
.
updateAction
:
this
.
createAction
;
if
(
!
action
){
let
actionName
:
any
=
Object
.
is
(
data
.
srfuf
,
'1'
)?
"updateAction"
:
"createAction"
;
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单'
+
actionName
+
'参数未配置'
});
return
;
}
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
post
:
Promise
<
any
>
=
this
.
service
.
add
(
action
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
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
;
this
.
onFormLoad
(
data
,
'autoSave'
);
this
.
$emit
(
'save'
,
data
);
this
.
$store
.
dispatch
(
'viewaction/datasaved'
,
{
viewtag
:
this
.
viewtag
});
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'save'
,
data
:
data
});
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof NewForm
*/
protected
async
save
(
opt
:
any
=
{},
showResultInfo
?:
boolean
,
ifStateNext
:
boolean
=
true
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
showResultInfo
=
showResultInfo
===
undefined
?
true
:
false
;
if
(
!
this
.
formValidateStatus
())
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'值规则校验异常'
});
return
;
}
const
arg
:
any
=
{
...
opt
};
const
data
=
this
.
getValues
();
Object
.
assign
(
arg
,
data
);
Object
.
assign
(
arg
,
this
.
context
);
if
(
ifStateNext
)
{
this
.
drcounter
=
0
;
if
(
this
.
drcounter
!==
0
){
this
.
drsaveopt
=
opt
;
this
.
formState
.
next
({
type
:
'beforesave'
,
data
:
arg
});
//先通知关系界面保存
this
.
saveState
=
resolve
;
return
;
}
}
const
action
:
any
=
Object
.
is
(
data
.
srfuf
,
'1'
)
?
this
.
updateAction
:
this
.
createAction
;
if
(
!
action
){
let
actionName
:
any
=
Object
.
is
(
data
.
srfuf
,
'1'
)?
"updateAction"
:
"createAction"
;
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单'
+
actionName
+
'参数未配置'
});
return
;
}
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
post
:
Promise
<
any
>
=
Object
.
is
(
data
.
srfuf
,
'1'
)?
this
.
service
.
update
(
action
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
):
this
.
service
.
add
(
action
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
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
;
this
.
onFormLoad
(
data
,
'save'
);
this
.
$emit
(
'save'
,
data
);
this
.
$store
.
dispatch
(
'viewaction/datasaved'
,
{
viewtag
:
this
.
viewtag
});
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'save'
,
data
:
data
});
});
if
(
showResultInfo
)
{
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
data
.
srfmajortext
?
data
.
srfmajortext
:
''
)
+
' 保存成功!'
});
}
resolve
(
response
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
reject
(
response
);
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
});
})
}
/**
* 删除
*
* @private
* @param {*} [opt={}]
* @memberof EditForm
*/
private
remove
(
opt
:
Array
<
any
>
=
[],
showResultInfo
?:
boolean
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
!
this
.
removeAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单removeAction参数未配置'
});
return
;
}
const
arg
:
any
=
opt
[
0
];
const
_this
:
any
=
this
;
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
this
.
service
.
delete
(
_this
.
removeAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
showResultInfo
).
then
((
response
:
any
)
=>
{
if
(
response
)
{
const
data
=
response
.
data
;
this
.
$emit
(
'remove'
,
data
);
this
.
formState
.
next
({
type
:
'remove'
,
data
:
data
});
this
.
data
.
ismodify
=
false
;
this
.
$Notice
.
success
({
title
:
''
,
desc
:
(
data
.
srfmajortext
?
data
.
srfmajortext
:
''
)
+
' 删除成功!'
});
resolve
(
response
);
}
}).
catch
((
error
:
any
)
=>
{
const
{
data
:
_data
}
=
error
;
this
.
$Notice
.
error
({
title
:
_data
.
title
,
desc
:
_data
.
message
});
reject
(
error
);
});
});
}
/**
* 工作流启动
*
* @param {*} [data={}]
* @returns {Promise<any>}
* @memberof NewForm
*/
protected
async
wfstart
(
data
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
!
this
.
WFStartAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'WFCIDEditView视图表单WFStartAction参数未配置'
});
return
;
}
const
_this
:
any
=
this
;
const
arg
:
any
=
data
[
0
];
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
post
:
Promise
<
any
>
=
Object
.
is
(
data
.
srfuf
,
'1'
)?
this
.
service
.
update
(
this
.
updateAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
):
this
.
service
.
add
(
this
.
createAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
post
.
then
((
response
:
any
)
=>
{
const
arg
:
any
=
response
.
data
;
if
(
this
.
viewparams
){
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
}
const
result
:
Promise
<
any
>
=
this
.
service
.
wfstart
(
_this
.
WFStartAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
result
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
''
,
desc
:
'工作流启动失败, '
+
response
.
info
});
return
;
}
this
.
$Notice
.
info
({
title
:
''
,
desc
:
'工作流启动成功'
});
resolve
(
response
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
reject
(
response
);
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
reject
(
response
);
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @returns {Promise<any>}
* @memberof NewForm
*/
protected
async
wfsubmit
(
data
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
!
this
.
WFSubmitAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZOrganizationOptionView视图表单WFSubmitAction参数未配置'
});
return
;
}
const
_this
:
any
=
this
;
const
arg
:
any
=
data
[
0
];
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
if
(
!
arg
.
ibzorganization
||
Object
.
is
(
arg
.
ibzorganization
,
''
))
{
return
;
}
const
post
:
Promise
<
any
>
=
Object
.
is
(
arg
.
srfuf
,
'1'
)?
this
.
service
.
update
(
this
.
updateAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
):
this
.
service
.
add
(
this
.
createAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
post
.
then
((
response
:
any
)
=>
{
const
arg
:
any
=
response
.
data
;
if
(
this
.
viewparams
){
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
}
const
result
:
Promise
<
any
>
=
this
.
service
.
wfsubmit
(
_this
.
WFSubmitAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
result
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
''
,
desc
:
'工作流提交失败, '
+
response
.
info
});
return
;
}
this
.
$Notice
.
info
({
title
:
''
,
desc
:
'工作流提交成功'
});
resolve
(
response
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
reject
(
response
);
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
reject
(
response
);
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
})
})
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof NewForm
*/
protected
updateFormItems
(
mode
:
string
,
data
:
any
=
{},
updateDetails
:
string
[],
showloading
?:
boolean
):
void
{
if
(
!
mode
||
(
mode
&&
Object
.
is
(
mode
,
''
)))
{
return
;
}
const
arg
:
any
=
{
...
data
};
Object
.
assign
(
arg
,
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
=
response
.
data
;
const
_data
:
any
=
{};
updateDetails
.
forEach
((
name
:
string
)
=>
{
if
(
!
data
.
hasOwnProperty
(
name
))
{
return
;
}
Object
.
assign
(
_data
,
{
[
name
]:
data
[
name
]
});
});
this
.
setFormEnableCond
(
_data
);
this
.
fillForm
(
_data
,
'updateFormItem'
);
this
.
formLogic
({
name
:
''
,
newVal
:
null
,
oldVal
:
null
});
this
.
dataChang
.
next
(
JSON
.
stringify
(
this
.
data
));
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'updateformitem'
,
ufimode
:
arg
.
srfufimode
,
data
:
_data
});
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof NewForm
*/
protected
onEnter
(
$event
:
any
):
void
{
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof NewForm
*/
protected
saveAndExit
(
data
:
any
[]):
Promise
<
any
>
{
let
_this
=
this
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
arg
:
any
=
{};
if
(
data
&&
data
.
length
>
0
){
Object
.
assign
(
arg
,
data
[
0
]);
}
_this
.
currentAction
=
"saveAndExit"
;
_this
.
save
([
arg
]).
then
((
res
)
=>
{
if
(
res
){
_this
.
closeView
(
res
.
data
);
}
resolve
(
res
);
}).
catch
((
error
)
=>
{
reject
(
error
);
})
})
}
/**
* 保存并新建
*
* @param {any[]} args
* @memberof NewForm
*/
protected
saveAndNew
(
data
:
any
[]):
Promise
<
any
>
{
let
_this
=
this
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
arg
:
any
=
{};
if
(
data
&&
data
.
length
>
0
){
Object
.
assign
(
arg
,
data
[
0
]);
}
_this
.
currentAction
=
"saveAndNew"
;
_this
.
save
([
arg
]).
then
((
res
)
=>
{
_this
.
ResetData
(
res
);
_this
.
loadDraft
({});
}).
catch
((
error
)
=>
{
reject
(
error
);
})
})
}
/**
* 删除并退出
*
* @param {any[]} args
* @memberof NewForm
*/
protected
removeAndExit
(
data
:
any
[]):
Promise
<
any
>
{
let
_this
=
this
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
arg
:
any
=
{};
if
(
data
&&
data
.
length
>
0
){
Object
.
assign
(
arg
,
data
[
0
]);
}
_this
.
remove
([
arg
]).
then
((
res
)
=>
{
if
(
res
){
_this
.
closeView
(
res
.
data
);
}
resolve
(
res
);
}).
catch
((
error
)
=>
{
reject
(
error
);
})
})
}
/**
* 关系界面数据保存完成
*
* @param {any} $event
* @memberof NewForm
*/
protected
drdatasaved
(
$event
:
any
){
let
_this
=
this
;
this
.
drcounter
--
;
if
(
this
.
drcounter
>
0
){
return
;
}
this
.
save
(
this
.
drsaveopt
,
undefined
,
false
).
then
((
res
)
=>
{
this
.
saveState
(
res
);
this
.
drsaveopt
=
{};
if
(
Object
.
is
(
_this
.
currentAction
,
"saveAndNew"
)){
_this
.
ResetData
(
res
);
_this
.
loadDraft
({});
}
else
if
(
Object
.
is
(
_this
.
currentAction
,
"saveAndExit"
)){
if
(
res
){
_this
.
closeView
(
res
.
data
);
}
}
});
}
/**
* 新建默认值
* @memberof NewForm
*/
public
createDefault
(){
}
}
</
script
>
<
style
lang=
'less'
>
@import './new-form-form.less';
</
style
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/new-form-form/new-form-form-model.ts
0 → 100644
浏览文件 @
0ebf83eb
/**
* NewForm 部件模型
*
* @export
* @class NewFormModel
*/
export
default
class
NewFormModel
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof NewFormModel
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'srfwfmemo'
,
prop
:
'srfwfmemo'
,
dataType
:
'TEXT'
,
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name
:
'srffrontuf'
,
prop
:
'srffrontuf'
,
dataType
:
'TEXT'
,
},
{
name
:
'srfupdatedate'
,
prop
:
'updatedate'
,
dataType
:
'DATETIME'
,
},
{
name
:
'srforikey'
,
},
{
name
:
'srfkey'
,
prop
:
'orgid'
,
dataType
:
'TEXT'
,
},
{
name
:
'srfmajortext'
,
prop
:
'orgname'
,
dataType
:
'TEXT'
,
},
{
name
:
'srftempmode'
,
},
{
name
:
'srfuf'
,
},
{
name
:
'srfdeid'
,
},
{
name
:
'srfsourcekey'
,
},
{
name
:
'orgcode'
,
prop
:
'orgcode'
,
dataType
:
'TEXT'
,
},
{
name
:
'orgname'
,
prop
:
'orgname'
,
dataType
:
'TEXT'
,
},
{
name
:
'porgname'
,
prop
:
'porgname'
,
dataType
:
'PICKUPTEXT'
,
},
{
name
:
'orglevel'
,
prop
:
'orglevel'
,
dataType
:
'INT'
,
},
{
name
:
'shortname'
,
prop
:
'shortname'
,
dataType
:
'TEXT'
,
},
{
name
:
'showorder'
,
prop
:
'showorder'
,
dataType
:
'INT'
,
},
{
name
:
'orgid'
,
prop
:
'orgid'
,
dataType
:
'TEXT'
,
},
{
name
:
'porgid'
,
prop
:
'parentorgid'
,
dataType
:
'PICKUP'
,
},
{
name
:
'ibzorganization'
,
prop
:
'orgid'
,
dataType
:
'FONTKEY'
,
},
]
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/new-form-form/new-form-form-service.ts
0 → 100644
浏览文件 @
0ebf83eb
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
IBZOrganizationService
from
'@/service/ibzorganization/ibzorganization-service'
;
import
NewFormModel
from
'./new-form-form-model'
;
/**
* NewForm 部件服务对象
*
* @export
* @class NewFormService
*/
export
default
class
NewFormService
extends
ControlService
{
/**
* 单位机构服务对象
*
* @type {IBZOrganizationService}
* @memberof NewFormService
*/
public
appEntityService
:
IBZOrganizationService
=
new
IBZOrganizationService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof NewFormService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of NewFormService.
*
* @param {*} [opts={}]
* @memberof NewFormService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
NewFormModel
();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof NewFormService
*/
private
doItems
(
promise
:
Promise
<
any
>
,
deKeyField
:
string
,
deName
:
string
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
promise
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
data
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
item
[
deName
]
=
item
[
deKeyField
];
data
[
index
]
=
item
;
});
resolve
(
data
);
}
else
{
reject
([])
}
}).
catch
((
response
:
any
)
=>
{
reject
([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof NewFormService
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
if
(
Object
.
is
(
serviceName
,
'IBZOrganizationService'
)
&&
Object
.
is
(
interfaceName
,
'FetchDefault'
))
{
return
this
.
doItems
(
this
.
appEntityService
.
FetchDefault
(
JSON
.
parse
(
JSON
.
stringify
(
context
)),
data
,
isloading
),
'orgid'
,
'ibzorganization'
);
}
return
Promise
.
reject
([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
wfstart
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
data
=
this
.
handleWFData
(
data
);
context
=
this
.
handleRequestData
(
action
,
context
,
data
).
context
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
context
,
data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Create
(
context
,
data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
wfsubmit
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
data
=
this
.
handleWFData
(
data
,
true
);
context
=
this
.
handleRequestData
(
action
,
context
,
data
).
context
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
context
,
data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Create
(
context
,
data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
add
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Create
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
delete
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Remove
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
update
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Update
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
get
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
Get
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
loadDraft
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
//仿真主键数据
Data
.
orgid
=
Util
.
createUUID
();
Data
.
ibzorganization
=
Data
.
orgid
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
this
.
appEntityService
.
GetDraft
(
Context
,
Data
,
isloading
);
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
,
true
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@
Errorlog
public
frontLogic
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
result
:
Promise
<
any
>
;
const
_appEntityService
:
any
=
this
.
appEntityService
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
return
Promise
.
reject
({
status
:
500
,
data
:
{
title
:
'失败'
,
message
:
'系统异常'
}
});
}
result
.
then
((
response
)
=>
{
this
.
handleResponse
(
action
,
response
,
true
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof NewFormService
*/
public
handleRequestData
(
action
:
string
,
context
:
any
,
data
:
any
=
{}){
let
mode
:
any
=
this
.
getMode
();
if
(
!
mode
&&
mode
.
getDataItems
instanceof
Function
)
{
return
data
;
}
let
formItemItems
:
any
[]
=
mode
.
getDataItems
();
let
requestData
:
any
=
{};
formItemItems
.
forEach
((
item
:
any
)
=>
{
if
(
item
&&
item
.
dataType
&&
Object
.
is
(
item
.
dataType
,
'FONTKEY'
)){
if
(
item
&&
item
.
prop
){
requestData
[
item
.
prop
]
=
context
[
item
.
name
];
}
}
else
{
if
(
item
&&
item
.
prop
){
requestData
[
item
.
prop
]
=
data
[
item
.
name
];
}
}
});
if
(
data
&&
data
.
viewparams
){
Object
.
assign
(
requestData
,
data
.
viewparams
);
}
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
if
(
tempContext
&&
tempContext
.
srfsessionid
){
tempContext
.
srfsessionkey
=
tempContext
.
srfsessionid
;
delete
tempContext
.
srfsessionid
;
}
return
{
context
:
tempContext
,
data
:
requestData
};
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/new-form-form/new-form-form.less
0 → 100644
浏览文件 @
0ebf83eb
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-form {
overflow: auto;
> .ivu-row {
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/new-form-form/new-form-form.vue
0 → 100644
浏览文件 @
0ebf83eb
<
script
lang=
'tsx'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
NewFormBase
from
'./new-form-form-base.vue'
;
@
Component
({
components
:
{
}
})
export
default
class
NewForm
extends
NewFormBase
{
}
</
script
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app_web/src/widgets/ibzorganization/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
浏览文件 @
0ebf83eb
...
...
@@ -27,6 +27,9 @@ export default class PickupViewpickupviewpanelModel {
{
name
:
'parentorgid'
,
},
{
name
:
'porgname'
,
},
{
name
:
'shortname'
,
},
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/domain/IBZDepartment.java
浏览文件 @
0ebf83eb
...
...
@@ -69,6 +69,13 @@ public class IBZDepartment extends EntityMP implements Serializable {
@JSONField
(
name
=
"parentdeptid"
)
@JsonProperty
(
"parentdeptid"
)
private
String
parentdeptid
;
/**
* 上级部门
*/
@TableField
(
exist
=
false
)
@JSONField
(
name
=
"pdeptname"
)
@JsonProperty
(
"pdeptname"
)
private
String
pdeptname
;
/**
* 部门简称
*/
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/domain/IBZOrganization.java
浏览文件 @
0ebf83eb
...
...
@@ -62,6 +62,13 @@ public class IBZOrganization extends EntityMP implements Serializable {
@JSONField
(
name
=
"parentorgid"
)
@JsonProperty
(
"parentorgid"
)
private
String
parentorgid
;
/**
* 上级单位
*/
@TableField
(
exist
=
false
)
@JSONField
(
name
=
"porgname"
)
@JsonProperty
(
"porgname"
)
private
String
porgname
;
/**
* 单位简称
*/
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/filter/IBZDepartmentSearchContext.java
浏览文件 @
0ebf83eb
...
...
@@ -53,6 +53,20 @@ public class IBZDepartmentSearchContext extends QueryWrapperContext<IBZDepartmen
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_pdeptid_eq
)){
this
.
getSelectCond
().
eq
(
"pdeptid"
,
n_pdeptid_eq
);
}
}
private
String
n_pdeptname_eq
;
//[上级部门]
public
void
setN_pdeptname_eq
(
String
n_pdeptname_eq
)
{
this
.
n_pdeptname_eq
=
n_pdeptname_eq
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_pdeptname_eq
)){
this
.
getSelectCond
().
eq
(
"pdeptname"
,
n_pdeptname_eq
);
}
}
private
String
n_pdeptname_like
;
//[上级部门]
public
void
setN_pdeptname_like
(
String
n_pdeptname_like
)
{
this
.
n_pdeptname_like
=
n_pdeptname_like
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_pdeptname_like
)){
this
.
getSelectCond
().
like
(
"pdeptname"
,
n_pdeptname_like
);
}
}
private
String
n_bcode_like
;
//[业务编码]
public
void
setN_bcode_like
(
String
n_bcode_like
)
{
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/filter/IBZOrganizationSearchContext.java
浏览文件 @
0ebf83eb
...
...
@@ -53,6 +53,20 @@ public class IBZOrganizationSearchContext extends QueryWrapperContext<IBZOrganiz
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_porgid_eq
)){
this
.
getSelectCond
().
eq
(
"porgid"
,
n_porgid_eq
);
}
}
private
String
n_porgname_eq
;
//[上级单位]
public
void
setN_porgname_eq
(
String
n_porgname_eq
)
{
this
.
n_porgname_eq
=
n_porgname_eq
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_porgname_eq
)){
this
.
getSelectCond
().
eq
(
"porgname"
,
n_porgname_eq
);
}
}
private
String
n_porgname_like
;
//[上级单位]
public
void
setN_porgname_like
(
String
n_porgname_like
)
{
this
.
n_porgname_like
=
n_porgname_like
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_porgname_like
)){
this
.
getSelectCond
().
like
(
"porgname"
,
n_porgname_like
);
}
}
private
String
n_shortname_like
;
//[单位简称]
public
void
setN_shortname_like
(
String
n_shortname_like
)
{
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/service/impl/IBZDepartmentServiceImpl.java
浏览文件 @
0ebf83eb
...
...
@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[部门] 服务对象接口实现
*/
@Slf4j
@Service
@Service
(
"IBZDepartmentServiceImpl"
)
public
class
IBZDepartmentServiceImpl
extends
ServiceImpl
<
IBZDepartmentMapper
,
IBZDepartment
>
implements
IIBZDepartmentService
{
@Autowired
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/service/impl/IBZEmployeeServiceImpl.java
浏览文件 @
0ebf83eb
...
...
@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[人员] 服务对象接口实现
*/
@Slf4j
@Service
@Service
(
"IBZEmployeeServiceImpl"
)
public
class
IBZEmployeeServiceImpl
extends
ServiceImpl
<
IBZEmployeeMapper
,
IBZEmployee
>
implements
IIBZEmployeeService
{
private
int
batchSize
=
500
;
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/java/cn/ibizlab/core/ou/service/impl/IBZOrganizationServiceImpl.java
浏览文件 @
0ebf83eb
...
...
@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[单位机构] 服务对象接口实现
*/
@Slf4j
@Service
@Service
(
"IBZOrganizationServiceImpl"
)
public
class
IBZOrganizationServiceImpl
extends
ServiceImpl
<
IBZOrganizationMapper
,
IBZOrganization
>
implements
IIBZOrganizationService
{
@Autowired
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
0ebf83eb
...
...
@@ -2,7 +2,7 @@
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext=
"http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
>
<!--输出实体[IBZORG]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzorg-3
80
-1"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzorg-3
97
-1"
>
<createTable
tableName=
"IBZORG"
>
<column
name=
"ORGID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_IBZORG_ORGID"
/>
...
...
@@ -106,7 +106,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPT]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzdept-
499
-3"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzdept-
508
-3"
>
<createTable
tableName=
"IBZDEPT"
>
<column
name=
"DEPTID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_IBZDEPT_DEPTID"
/>
...
...
@@ -139,7 +139,7 @@
</changeSet>
<!--输出实体[IBZORG]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzorg-3
80
-4"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzorg-3
97
-4"
>
<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]外键关系 -->
...
...
@@ -150,10 +150,10 @@
<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>
<!--输出实体[IBZDEPT]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-
499
-7"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-
508
-7"
>
<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-
499
-8"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-
508
-8"
>
<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>
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/resources/mapper/ou/ibzdepartment/IBZDepartmentMapper.xml
浏览文件 @
0ebf83eb
...
...
@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select
id=
"selectById"
resultMap=
"IBZDepartmentResultMap"
databaseId=
"mysql"
>
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
) t1 where deptid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
1.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID
) t1 where deptid=#{id}]]>
</select>
<select
id=
"selectById"
resultMap=
"IBZDepartmentResultMap"
databaseId=
"postgresql"
>
<![CDATA[select t1.* from (SELECT t1.BCODE, t1.CREATEDATE, t1.DEPTCODE, t1.DEPTID, t1.DEPTLEVEL, t1.DEPTNAME, t1.ENABLE, t1.ORGID, t1.PDEPTID, t1.SHORTNAME, t1.SHOWORDER, t1.UPDATEDATE FROM IBZDEPT t1 ) t1 where deptid=#{id}]]>
...
...
@@ -50,7 +50,7 @@
<!--数据查询[Default]-->
<sql
id=
"Default"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
1.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
@@ -64,7 +64,7 @@
<!--数据查询[View]-->
<sql
id=
"View"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1
1.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
This diff is collapsed.
Click to expand it.
ibzou-core/src/main/resources/mapper/ou/ibzorganization/IBZOrganizationMapper.xml
浏览文件 @
0ebf83eb
...
...
@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select
id=
"selectById"
resultMap=
"IBZOrganizationResultMap"
databaseId=
"mysql"
>
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
) t1 where orgid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
1.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
) t1 where orgid=#{id}]]>
</select>
<select
id=
"selectById"
resultMap=
"IBZOrganizationResultMap"
databaseId=
"postgresql"
>
<![CDATA[select t1.* from (SELECT t1.CREATEDATE, t1.ENABLE, t1.ORGCODE, t1.ORGID, t1.ORGLEVEL, t1.ORGNAME, t1.PORGID, t1.SHORTNAME, t1.SHOWORDER, t1.UPDATEDATE FROM IBZORG t1 ) t1 where orgid=#{id}]]>
...
...
@@ -58,7 +58,7 @@
<!--数据查询[Default]-->
<sql
id=
"Default"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
1.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
@@ -72,7 +72,7 @@
<!--数据查询[SelectPOrg]-->
<sql
id=
"SelectPOrg"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
1.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
AND ( INSTR(#{srf.datacontext.orglevel} t1.ORGLEVEL)=1 )
]]>
...
...
@@ -80,7 +80,7 @@
<!--数据查询[SelectSOrg]-->
<sql
id=
"SelectSOrg"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
1.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
AND ( INSTR(t1.ORGLEVEL,#{srf.datacontext.orglevel} )
]]>
...
...
@@ -88,7 +88,7 @@
<!--数据查询[View]-->
<sql
id=
"View"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1
1.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
This diff is collapsed.
Click to expand it.
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/dto/IBZDepartmentDTO.java
浏览文件 @
0ebf83eb
...
...
@@ -63,6 +63,14 @@ public class IBZDepartmentDTO extends DTOBase implements Serializable {
@JsonProperty
(
"parentdeptid"
)
private
String
parentdeptid
;
/**
* 属性 [PDEPTNAME]
*
*/
@JSONField
(
name
=
"pdeptname"
)
@JsonProperty
(
"pdeptname"
)
private
String
pdeptname
;
/**
* 属性 [SHORTNAME]
*
...
...
This diff is collapsed.
Click to expand it.
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/dto/IBZOrganizationDTO.java
浏览文件 @
0ebf83eb
...
...
@@ -55,6 +55,14 @@ public class IBZOrganizationDTO extends DTOBase implements Serializable {
@JsonProperty
(
"parentorgid"
)
private
String
parentorgid
;
/**
* 属性 [PORGNAME]
*
*/
@JSONField
(
name
=
"porgname"
)
@JsonProperty
(
"porgname"
)
private
String
porgname
;
/**
* 属性 [SHORTNAME]
*
...
...
This diff is collapsed.
Click to expand it.
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/rest/IBZDepartmentResource.java
浏览文件 @
0ebf83eb
...
...
@@ -114,7 +114,6 @@ public class IBZDepartmentResource {
@PreAuthorize
(
"hasPermission('','READ',this.getEntity())"
)
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZDepartment"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdepartments/getdraft"
)
public
ResponseEntity
<
IBZDepartmentDTO
>
getDraft
()
{
...
...
This diff is collapsed.
Click to expand it.
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/rest/IBZEmployeeResource.java
浏览文件 @
0ebf83eb
...
...
@@ -168,7 +168,6 @@ public class IBZEmployeeResource {
@PreAuthorize
(
"hasPermission('','READ',this.getEntity())"
)
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZEmployee"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzemployees/getdraft"
)
public
ResponseEntity
<
IBZEmployeeDTO
>
getDraft
()
{
...
...
This diff is collapsed.
Click to expand it.
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/rest/IBZOrganizationResource.java
浏览文件 @
0ebf83eb
...
...
@@ -155,7 +155,6 @@ public class IBZOrganizationResource {
@PreAuthorize
(
"hasPermission('','READ',this.getEntity())"
)
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZOrganization"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzorganizations/getdraft"
)
public
ResponseEntity
<
IBZOrganizationDTO
>
getDraft
()
{
...
...
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZOUFallback.java
浏览文件 @
0ebf83eb
...
...
@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
public
class
IBZOUFallback
implements
IBZOUFeignClient
{
@Override
public
JSONObject
getOrgInfo
(
String
orgLevel
)
{
public
JSONObject
getOrgInfo
(
String
loginName
)
{
return
null
;
}
}
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZOUFeignClient.java
浏览文件 @
0ebf83eb
...
...
@@ -11,9 +11,9 @@ public interface IBZOUFeignClient
/**
* 从ou中获取当前上下级组织、部门信息
* @param
orgLevel
* @param
loginName 登录名
* @return
*/
@GetMapping
(
value
=
"/ibzou/org/{
orglevel
}"
)
JSONObject
getOrgInfo
(
@PathVariable
(
"
orglevel"
)
String
orgLevel
);
@GetMapping
(
value
=
"/ibzou/org/{
loginname
}"
)
JSONObject
getOrgInfo
(
@PathVariable
(
"
loginname"
)
String
loginName
);
}
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZUAAFallback.java
浏览文件 @
0ebf83eb
...
...
@@ -8,7 +8,7 @@ import java.util.Map;
public
class
IBZUAAFallback
implements
IBZUAAFeignClient
{
@Override
public
JSONObject
getUserPermissionData
(
String
userId
,
String
systemId
)
{
public
JSONObject
getUserPermissionData
(
String
loginName
,
String
systemId
)
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZUAAFeignClient.java
浏览文件 @
0ebf83eb
...
...
@@ -11,12 +11,12 @@ public interface IBZUAAFeignClient
/**
* 从uaa中获取当前用户权限
* @param
userId
* @param
loginName
* @param systemId
* @return
*/
@GetMapping
(
value
=
"/uaa/permission/{
userid
}"
)
JSONObject
getUserPermissionData
(
@PathVariable
(
"
userid"
)
String
userId
,
@RequestParam
(
"systemid"
)
String
systemId
);
@GetMapping
(
value
=
"/uaa/permission/{
loginname
}"
)
JSONObject
getUserPermissionData
(
@PathVariable
(
"
loginname"
)
String
loginName
,
@RequestParam
(
"systemid"
)
String
systemId
);
/**
* 推送系统权限数据到uaa
...
...
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/domain/FileItem.java
0 → 100644
浏览文件 @
0ebf83eb
package
cn
.
ibizlab
.
util
.
domain
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
@Data
@JsonInclude
(
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@AllArgsConstructor
public
class
FileItem
{
private
String
id
;
private
String
name
;
private
long
size
;
private
String
ext
;
}
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
浏览文件 @
0ebf83eb
...
...
@@ -21,7 +21,7 @@ import java.io.IOException;
/**
* 权限:向uaa同步当前系统菜单、权限资源任务类
*/
//
@Component //开启此类需要保证Main中开启了feign :EnableFeignClients
@Component
//开启此类需要保证Main中开启了feign :EnableFeignClients
public
class
PermissionSyncJob
implements
ApplicationRunner
{
private
Log
log
=
LogFactory
.
getLog
(
PermissionSyncJob
.
class
);
...
...
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/rest/FileController.java
0 → 100644
浏览文件 @
0ebf83eb
package
cn
.
ibizlab
.
util
.
rest
;
import
cn.ibizlab.util.domain.FileItem
;
import
cn.ibizlab.util.service.FileService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
@Slf4j
public
class
FileController
{
@Autowired
private
FileService
fileService
;
@PostMapping
(
value
=
"${ibiz.uploadpath.path:ibizutil/upload}"
)
public
ResponseEntity
<
FileItem
>
upload
(
@RequestParam
(
"file"
)
MultipartFile
multipartFile
){
return
ResponseEntity
.
ok
().
body
(
fileService
.
saveFile
(
multipartFile
));
}
private
final
String
defaultdownloadpath
=
"ibizutil/download/{id}"
;
protected
String
getDefaultdownloadpath
(){
return
defaultdownloadpath
;
}
@GetMapping
(
value
=
"${ibiz.file.downloadpath:"
+
defaultdownloadpath
+
"}"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
void
download
(
@PathVariable
String
id
,
HttpServletResponse
response
){
File
file
=
fileService
.
getFile
(
id
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
getFileName
(
file
.
getName
()));
this
.
sendRespose
(
response
,
file
);
}
protected
void
sendRespose
(
HttpServletResponse
response
,
File
file
){
BufferedInputStream
bis
=
null
;
BufferedOutputStream
bos
=
null
;
try
{
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
file
));
bos
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
byte
[]
buff
=
new
byte
[
2048
];
int
bytesRead
;
while
(-
1
!=
(
bytesRead
=
bis
.
read
(
buff
,
0
,
buff
.
length
)))
{
bos
.
write
(
buff
,
0
,
bytesRead
);
}
}
catch
(
Exception
e
)
{
//throw e;
}
finally
{
if
(
bis
!=
null
)
{
try
{
bis
.
close
();
}
catch
(
IOException
e
)
{
}
}
if
(
bos
!=
null
)
{
try
{
bos
.
close
();
}
catch
(
IOException
e
)
{
}
}
}
}
protected
String
getFileName
(
String
fileName
){
try
{
return
new
String
(
fileName
.
getBytes
(
"utf-8"
),
"iso8859-1"
);
//防止中文乱码
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
fileName
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/security/AuthPermissionEvaluator.java
浏览文件 @
0ebf83eb
...
...
@@ -4,14 +4,19 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.util.annotation.DEField
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.enums.DEPredefinedFieldType
;
import
cn.ibizlab.util.filter.QueryWrapperContext
;
import
cn.ibizlab.util.helper.DEFieldCacheMap
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.access.PermissionEvaluator
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.Serializable
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -31,147 +36,149 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* 表格权限检查 :用于检查当前用户是否拥有表格数据的读取、删除权限
*
* @param authentication
* @param
obj_a
ction 表格行为,如:[READ,DELETE]
* @param grid
_p
aram 表格参数,如:当前表格所处实体(EntityName)、表格删除的数据主键(srfkeys)
* @param
deA
ction 表格行为,如:[READ,DELETE]
* @param grid
P
aram 表格参数,如:当前表格所处实体(EntityName)、表格删除的数据主键(srfkeys)
* @return true/false true则允许当前行为,false拒绝行为
*/
@Override
public
boolean
hasPermission
(
Authentication
authentication
,
Object
obj_action
,
Object
grid_p
aram
)
{
public
boolean
hasPermission
(
Authentication
authentication
,
Object
deAction
,
Object
gridP
aram
)
{
//未开启权限校验、超级管理员则不进行权限检查
if
(
AuthenticationUser
.
getAuthenticationUser
().
getSuperuser
()==
1
||
!
enablePermissionValid
)
return
true
;
//系统没开启权限、超级管理员 两种情况不进行权限检查
return
true
;
String
action
=
""
;
if
(
deAction
instanceof
String
)
action
=
(
String
)
deAction
;
if
(
StringUtils
.
isEmpty
(
action
))
return
false
;
//获取当前用户权限列表
JSONObject
userPermission
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
if
(
userPermission
==
null
)
return
false
;
try
{
String
action
=
""
;
List
gridParamList
=
(
ArrayList
)
gridParam
;
if
(
action
.
equals
(
"DELETE"
)){
//grid delete
//准备参数
Object
srfKey
=
gridParamList
.
get
(
0
);
EntityBase
entity
=
(
EntityBase
)
gridParamList
.
get
(
1
);
String
entityName
=
entity
.
getClass
().
getSimpleName
();
if
(
obj_action
instanceof
String
)
action
=
(
String
)
obj_action
;
//获取实体行为权限信息
JSONObject
permissionList
=
userPermission
.
getJSONObject
(
"deActionPermission"
)
;
if
(
StringUtils
.
isEmpty
(
action
))
//检查是否有操作权限[create.update.delete.read]
if
(!
validHasPermission
(
permissionList
,
entityName
,
action
)){
return
false
;
}
//检查是否有数据权限[单行删除]
ServiceImpl
service
=
SpringContextHolder
.
getBean
(
String
.
format
(
"%s%s"
,
entityName
,
"ServiceImpl"
));
//获取实体service对象
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取组织、部门预置属性
String
permissionSQL
=
getPermissionSQLById
(
permissionList
,
entityName
,
action
,
srfKey
,
permissionField
);
//获取权限SQL
if
(
StringUtils
.
isEmpty
(
permissionSQL
))
return
false
;
QueryWrapper
permissionWrapper
=
getPermissionWrapper
(
permissionSQL
);
//构造权限条件
return
testDataAccess
(
service
,
permissionWrapper
);
//执行权限检查
}
else
{
//grid fetch
//准备参数
Object
searchContext
=
gridParamList
.
get
(
0
);
String
dataSet
=
String
.
valueOf
(
gridParamList
.
get
(
1
));
EntityBase
entity
=
(
EntityBase
)
gridParamList
.
get
(
2
);
String
entityName
=
entity
.
getClass
().
getSimpleName
();
JSONObject
permissionList
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
//获取权限列表
//获取数据集权限信息
JSONObject
permissionList
=
userPermission
.
getJSONObject
(
"deDataSetPermission"
);
if
(
permissionList
==
null
)
if
(
StringUtils
.
isEmpty
(
entityName
)||
StringUtils
.
isEmpty
(
dataSet
)||
StringUtils
.
isEmpty
(
action
)
)
return
false
;
List
param_list
=
(
ArrayList
)
grid_param
;
if
(
obj_action
.
equals
(
"DELETE"
)){
//表格删除权限校验
Object
srfkey
=
param_list
.
get
(
0
);
EntityBase
cur_entity
=
(
EntityBase
)
param_list
.
get
(
1
);
String
entityName
=
cur_entity
.
getClass
().
getSimpleName
();
ServiceImpl
service
=
SpringContextHolder
.
getBean
(
String
.
format
(
"%s%s"
,
getBeanName
(
entityName
),
"ServiceImpl"
));
//获取当前实体service
JSONObject
formDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-form"
);
//由于表格删除是不跟着dataSet走,所以此处走form获取权限
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
cur_entity
);
//获取系统预置属性列表
String
selectCond
=
generatePermissionSQLForm
(
formDataAbility
,
entityName
,
action
,
srfkey
,
permissionField
);
//拼接权限条件
if
(
StringUtils
.
isEmpty
(
selectCond
))
return
false
;
QueryWrapper
permissionCond
=
getPermissionCond
(
selectCond
,
permissionField
);
return
testDataAccess
(
service
,
permissionCond
);
//执行权限检查
}
else
{
//表格查询权限校验
Object
searchContext
=
param_list
.
get
(
0
);
String
dataSet
=
String
.
valueOf
(
param_list
.
get
(
1
));
EntityBase
cur_entity
=
(
EntityBase
)
param_list
.
get
(
2
);
String
entityName
=
cur_entity
.
getClass
().
getSimpleName
();
if
(
StringUtils
.
isEmpty
(
entityName
)||
StringUtils
.
isEmpty
(
dataSet
)||
StringUtils
.
isEmpty
(
action
))
return
false
;
JSONObject
gridDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-grid"
);
//获取表格的权限数据
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
cur_entity
);
//获取系统预置属性列表
String
selectCond
=
generatePermissionSQLGrid
(
gridDataAbility
,
entityName
,
action
,
dataSet
,
permissionField
,
null
);
//拼接权限条件
if
(
StringUtils
.
isEmpty
(
selectCond
))
return
false
;
filterDataAccess
(
searchContext
,
selectCond
);
//过滤出权限内的数据
//检查是否有操作权限[create.update.delete.read]
if
(!
validHasPermission
(
permissionList
,
entityName
,
dataSet
,
action
)){
return
false
;
}
return
true
;
}
catch
(
Exception
e
){
throw
new
RuntimeException
(
"系统在进行权限检查时出现异常,原因为:"
+
e
);
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取组织、部门预置属性
String
permissionSQL
=
getPermissionSQLByList
(
permissionList
,
entityName
,
action
,
dataSet
,
permissionField
);
//获取权限SQL
if
(
StringUtils
.
isEmpty
(
permissionSQL
))
return
false
;
fillPermissionSQL
(
searchContext
,
permissionSQL
);
//将权限SQL添加到searchContext中,过滤出权限内数据
}
return
true
;
}
/**
* 表单权限检查 :用于检查当前用户是否拥有表单的新建、编辑、删除权限
*
* @param authentication
* @param srf
k
ey 当前操作数据的主键
* @param srf
K
ey 当前操作数据的主键
* @param action 当前操作行为:如:[READ、UPDATE、DELETE]
* @param cur_entity 当前操作的实体对象
* @return true/false true则允许当前行为,false拒绝行为
*/
@Override
public
boolean
hasPermission
(
Authentication
authentication
,
Serializable
srf
k
ey
,
String
action
,
Object
cur_entity
)
{
public
boolean
hasPermission
(
Authentication
authentication
,
Serializable
srf
K
ey
,
String
action
,
Object
cur_entity
)
{
//未开启权限校验、超级管理员则不进行权限检查
if
(
AuthenticationUser
.
getAuthenticationUser
().
getSuperuser
()==
1
||
!
enablePermissionValid
)
return
true
;
//系统没开启权限、超级管理员 两种情况不进行权限检查
boolean
isPermission
;
return
true
;
EntityBase
entity
=
null
;
if
(
cur_entity
instanceof
EntityBase
)
entity
=
(
EntityBase
)
cur_entity
;
if
(
StringUtils
.
isEmpty
(
entity
))
return
false
;
try
{
String
entityName
=
entity
.
getClass
().
getSimpleName
();
//实体名
if
(
action
.
equals
(
"CREATE"
)){
//表单新建权限校验
JSONObject
permissionList
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
//获取权限列表
JSONObject
formDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-form"
);
//获取表单的权限数据
return
isFormCreatePermission
(
formDataAbility
,
entityName
,
action
);
//拼接权限条件
JSONObject
userPermission
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
JSONObject
permissionList
=
userPermission
.
getJSONObject
(
"deActionPermission"
);
String
entityName
=
entity
.
getClass
().
getSimpleName
();
if
(
action
.
equals
(
"CREATE"
)){
return
validHasPermission
(
permissionList
,
entityName
,
action
);
}
else
{
//拥有全部数据访问权限时,则跳过权限检查
if
(
isAllData
(
permissionList
,
entityName
,
action
)){
return
true
;
}
else
{
//表单编辑、查询权限校验
ServiceImpl
service
=
SpringContextHolder
.
getBean
(
String
.
format
(
"%s%s"
,
getBeanName
(
entityName
),
"ServiceImpl"
));
//获取当前实体service
JSONObject
permissionList
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
//获取权限列表
JSONObject
formDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-form"
);
//获取表单的权限数据
if
(
isAllData
(
formDataAbility
,
entityName
,
action
)){
//若为全部数据则直接返回,不再进行校验
return
true
;
}
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取系统预置属性
String
selectCond
=
generatePermissionSQLForm
(
formDataAbility
,
entityName
,
action
,
srfkey
,
permissionField
);
//根据uaa中分配的权限拼接where条件
if
(
StringUtils
.
isEmpty
(
selectCond
))
return
false
;
QueryWrapper
permissionCond
=
getPermissionCond
(
selectCond
,
permissionField
);
isPermission
=
testDataAccess
(
service
,
permissionCond
);
//执行权限检查
//检查是否有操作权限[create.update.delete.read]
if
(!
validHasPermission
(
permissionList
,
entityName
,
action
)){
return
false
;
}
}
catch
(
Exception
e
){
throw
new
RuntimeException
(
"系统在进行权限检查时出现异常,原因为:"
+
e
);
//检查是否有数据权限
ServiceImpl
service
=
SpringContextHolder
.
getBean
(
String
.
format
(
"%s%s"
,
entityName
,
"ServiceImpl"
));
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取组织、部门预置属性
String
permissionSQL
=
getPermissionSQLById
(
permissionList
,
entityName
,
action
,
srfKey
,
permissionField
);
//获取权限SQL
if
(
StringUtils
.
isEmpty
(
permissionSQL
))
return
false
;
QueryWrapper
permissionWrapper
=
getPermissionWrapper
(
permissionSQL
);
//构造权限条件
return
testDataAccess
(
service
,
permissionWrapper
);
//执行权限检查
}
return
isPermission
;
}
/**
*
判断是否包含
全部数据
* @param
formDataAbility
*
是否为
全部数据
* @param
permissionList
* @param entityName
* @param action
* @return
*/
private
boolean
isAllData
(
JSONObject
formDataAbility
,
String
entityName
,
String
action
)
{
private
boolean
isAllData
(
JSONObject
permissionList
,
String
entityName
,
String
action
)
{
if
(
formDataAbility
==
null
)
if
(
permissionList
==
null
)
return
false
;
if
(!
formDataAbility
.
containsKey
(
entityName
))
if
(!
permissionList
.
containsKey
(
entityName
))
return
false
;
JSONObject
entityObj
=
formDataAbility
.
getJSONObject
(
entityName
);
//获取实体
if
(!
entityObj
.
containsKey
(
action
))
return
false
;
JSONArray
entityOperation
=
entityObj
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
entityOperation
.
size
()==
0
)
return
false
;
if
(
entityOperation
.
contains
(
"ALL"
)){
//全部数据
JSONObject
entity
=
permissionList
.
getJSONObject
(
entityName
);
if
(
entity
.
containsKey
(
action
)
&&
entity
.
getJSONArray
(
action
).
contains
(
"ALL"
))
return
true
;
}
return
false
;
return
false
;
}
/**
...
...
@@ -179,40 +186,27 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @param gridDataAbility
* @param entityName
* @param action
* @param dataSet
* @param dataSet
Name
* @param permissionField
* @param srfkey
* @return
*/
private
String
generatePermissionSQLGrid
(
JSONObject
gridDataAbility
,
String
entityName
,
String
action
,
String
dataSet
,
Map
<
String
,
String
>
permissionField
,
Object
srfkey
){
if
(
gridDataAbility
==
null
)
return
null
;
if
(!
gridDataAbility
.
containsKey
(
entityName
))
return
null
;
JSONObject
entityObj
=
gridDataAbility
.
getJSONObject
(
entityName
);
//获取实体
if
(!
entityObj
.
containsKey
(
dataSet
))
return
null
;
JSONObject
dedatasetObject
=
entityObj
.
getJSONObject
(
dataSet
);
//获取实体数据集
if
(!
dedatasetObject
.
containsKey
(
action
))
return
null
;
JSONArray
entityOperation
=
dedatasetObject
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
entityOperation
.
size
()==
0
)
return
null
;
private
String
getPermissionSQLByList
(
JSONObject
gridDataAbility
,
String
entityName
,
String
action
,
String
dataSetName
,
Map
<
String
,
String
>
permissionField
){
if
(
StringUtils
.
isEmpty
(
srfkey
))
return
getPermissionCond
(
entityOperation
,
permissionField
);
//拼接权限条件-查询
else
return
String
.
format
(
" (%s) AND (%sid='%s')"
,
getPermissionCond
(
entityOperation
,
permissionField
),
srfkey
);
//拼接权限条件-删除
JSONObject
entity
=
gridDataAbility
.
getJSONObject
(
entityName
);
//获取实体
JSONObject
dataSet
=
entity
.
getJSONObject
(
dataSetName
);
//获取实体数据集
JSONArray
opprivList
=
dataSet
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
opprivList
.
size
()==
0
)
return
null
;
return
getPermissionSQL
(
opprivList
,
permissionField
);
//拼接权限条件-查询
}
/**
*
表格拼接权限条件,过滤出权限数据
*
填充权限SQL
* @param targetDomainObject
* @param permissionCond
* @throws Exception
*/
private
void
filterDataAccess
(
Object
targetDomainObject
,
String
permissionCond
)
throws
Exception
{
private
void
fillPermissionSQL
(
Object
targetDomainObject
,
String
permissionCond
){
if
(
targetDomainObject
instanceof
QueryWrapperContext
){
QueryWrapperContext
queryWrapperContext
=
(
QueryWrapperContext
)
targetDomainObject
;
QueryWrapper
queryWrapper
=
queryWrapperContext
.
getSelectCond
();
...
...
@@ -220,53 +214,79 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* 校验是否有访问实体行为能力
* @param permissionList 权限列表
* @param entityName 实体名称
* @param action 操作行为
* @return
*/
private
boolean
validHasPermission
(
JSONObject
permissionList
,
String
entityName
,
String
action
){
boolean
hasPermission
=
false
;
if
(
permissionList
==
null
)
return
false
;
if
(!
permissionList
.
containsKey
(
entityName
))
return
false
;
JSONObject
entity
=
permissionList
.
getJSONObject
(
entityName
);
if
(
entity
.
containsKey
(
action
)){
hasPermission
=
true
;
}
return
hasPermission
;
}
/**
*
拼接表单数据查询条件
* @param
formDataAbility
*
校验是否有访问数据集能力
* @param
permissionList
* @param entityName
* @param dataSetName
* @param action
* @param srfkey
* @param permissionField
* @return
*/
private
String
generatePermissionSQLForm
(
JSONObject
formDataAbility
,
String
entityName
,
String
action
,
Object
srfkey
,
Map
<
String
,
String
>
permissionField
){
if
(
formDataAbility
==
null
)
return
null
;
if
(!
formDataAbility
.
containsKey
(
entityName
))
return
null
;
JSONObject
entityObj
=
formDataAbility
.
getJSONObject
(
entityName
);
//获取实体
if
(!
entityObj
.
containsKey
(
action
))
return
null
;
JSONArray
entityOperation
=
entityObj
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
entityOperation
.
size
()==
0
)
return
null
;
String
resultCond
=
getPermissionCond
(
entityOperation
,
permissionField
);
if
(
StringUtils
.
isEmpty
(
srfkey
))
return
String
.
format
(
" (%s)"
,
resultCond
,
entityName
.
toLowerCase
());
//拼接权限条件-新建
else
return
String
.
format
(
" (%s) AND (%sid='%s')"
,
resultCond
,
entityName
.
toLowerCase
(),
srfkey
);
//拼接权限条件-编辑
private
boolean
validHasPermission
(
JSONObject
permissionList
,
String
entityName
,
String
dataSetName
,
String
action
){
boolean
hasPermission
=
false
;
if
(
permissionList
==
null
)
return
false
;
if
(!
permissionList
.
containsKey
(
entityName
))
return
false
;
JSONObject
entity
=
permissionList
.
getJSONObject
(
entityName
);
if
(!
entity
.
containsKey
(
dataSetName
))
return
false
;
JSONObject
dataSet
=
entity
.
getJSONObject
(
dataSetName
);
//获取实体数据集
if
(
dataSet
.
containsKey
(
action
)){
hasPermission
=
true
;
}
return
hasPermission
;
}
/**
*
判断当前用户是否拥有建立表单数据权限
*
获取单条权限数据SQL
* @param formDataAbility
* @param entityName
* @param targetType
* @param action
* @param srfKey
* @param permissionField
* @return
*/
private
boolean
isFormCreatePermission
(
JSONObject
formDataAbility
,
String
entityName
,
String
targetType
){
if
(
formDataAbility
==
null
)
return
false
;
if
(!
formDataAbility
.
containsKey
(
entityName
))
return
false
;
JSONObject
entityObj
=
formDataAbility
.
getJSONObject
(
entityName
);
//获取实体
if
(!
entityObj
.
containsKey
(
targetType
))
return
false
;
return
true
;
private
String
getPermissionSQLById
(
JSONObject
formDataAbility
,
String
entityName
,
String
action
,
Object
srfKey
,
Map
<
String
,
String
>
permissionField
){
JSONObject
entity
=
formDataAbility
.
getJSONObject
(
entityName
);
//获取实体
JSONArray
opprivList
=
entity
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
opprivList
.
size
()==
0
)
return
null
;
String
permissionSQL
=
getPermissionSQL
(
opprivList
,
permissionField
);
String
keyField
=
permissionField
.
get
(
"keyfield"
);
if
(
StringUtils
.
isEmpty
(
keyField
)){
throw
new
RuntimeException
(
"权限校验失败,请检查当前实体中是否已经配置主键属性!"
);
}
return
String
.
format
(
" (%s) AND (%s='%s')"
,
permissionSQL
,
keyField
,
srfKey
);
//拼接权限条件-编辑
}
/**
* 表单权限检查
* @param service
...
...
@@ -274,25 +294,28 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @return
*/
private
boolean
testDataAccess
(
ServiceImpl
service
,
QueryWrapper
permissionCond
){
boolean
isPermission
=
false
;
List
list
=
service
.
list
(
permissionCond
);
if
(
list
.
size
()>
0
)
isPermission
=
true
;
boolean
isPermission
=
false
;
List
list
=
service
.
list
(
permissionCond
);
if
(
list
.
size
()>
0
)
isPermission
=
true
;
return
isPermission
;
}
/**
*
拼接权限条件(表单/表格)共用
* @param
entityOperation
*
获取权限SQL
* @param
oppriList
* @param permissionField
* @return
*/
private
String
getPermissionCond
(
JSONArray
entityOperation
,
Map
<
String
,
String
>
permissionField
){
private
String
getPermissionSQL
(
JSONArray
oppriList
,
Map
<
String
,
String
>
permissionField
){
String
nPermissionSQL
=
"1<>1"
;
String
orgField
=
permissionField
.
get
(
"orgfield"
);
String
orgDeptField
=
permissionField
.
get
(
"orgsecfield"
);
String
createManField
=
permissionField
.
get
(
"createmanfield"
);
StringBuffer
permissionSQL
=
new
StringBuffer
();
AuthenticationUser
authenticationUser
=
AuthenticationUser
.
getAuthenticationUser
();
JSONObject
userInfo
=
authenticationUser
.
getOrgInfo
();
JSONObject
orgObject
=
userInfo
.
getJSONObject
(
"org"
);
...
...
@@ -302,61 +325,55 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
JSONArray
orgDeptParent
=
orgDeptObject
.
getJSONArray
(
"porgdept"
);
JSONArray
orgDeptChild
=
orgDeptObject
.
getJSONArray
(
"sorgdept"
);
for
(
int
i
=
0
;
i
<
entityOperation
.
size
();
i
++){
if
(
i
>
0
&&
(!
StringUtils
.
isEmpty
(
permissionSQL
.
toString
())))
permissionSQL
.
append
(
"OR"
);
String
permissionCond
=
entityOperation
.
getString
(
i
);
//权限配置条件
for
(
int
i
=
0
;
i
<
oppriList
.
size
();
i
++){
permissionSQL
.
append
(
"OR"
);
String
permissionCond
=
oppriList
.
getString
(
i
);
//权限配置条件
if
(
permissionCond
.
equals
(
"CURORG"
)){
//本单位
permissionSQL
.
append
(
String
.
format
(
"(%s='%s')"
,
orgField
,
AuthenticationUser
.
getAuthenticationUser
().
getOrgid
()));
}
if
(
permissionCond
.
equals
(
"SORG"
)){
//下级单位
permissionSQL
.
append
(
String
.
format
(
" %s in(%s) "
,
orgField
,
formatStringArr
(
orgChild
)));
}
if
(
permissionCond
.
equals
(
"PORG"
)){
//上级单位
else
if
(
permissionCond
.
equals
(
"PORG"
)){
//上级单位
permissionSQL
.
append
(
String
.
format
(
" %s in(%s) "
,
orgField
,
formatStringArr
(
orgParent
)));
}
if
(
permissionCond
.
equals
(
"CREATEMAN"
)){
//建立人
permissionSQL
.
append
(
String
.
format
(
"
(createman='%s')"
,
AuthenticationUser
.
getAuthenticationUser
().
getUserid
(
)));
else
if
(
permissionCond
.
equals
(
"SORG"
)){
//下级单位
permissionSQL
.
append
(
String
.
format
(
"
%s in(%s) "
,
orgField
,
formatStringArr
(
orgChild
)));
}
if
(
permissionCond
.
equals
(
"CURORGDEPT"
)){
//本部门
permissionSQL
.
append
(
String
.
format
(
"(
orgsecid='%s')"
,
AuthenticationUser
.
getAuthenticationUser
().
getMdept
id
()));
else
if
(
permissionCond
.
equals
(
"CREATEMAN"
)){
//建立人
permissionSQL
.
append
(
String
.
format
(
"(
%s='%s')"
,
createManField
,
AuthenticationUser
.
getAuthenticationUser
().
getUser
id
()));
}
if
(
permissionCond
.
equals
(
"SORGDEPT"
)){
//下级
部门
permissionSQL
.
append
(
String
.
format
(
"
%s in (%s) "
,
orgDeptField
,
formatStringArr
(
orgDeptChild
)));
else
if
(
permissionCond
.
equals
(
"CURORGDEPT"
)){
//本
部门
permissionSQL
.
append
(
String
.
format
(
"
(%s='%s')"
,
orgDeptField
,
AuthenticationUser
.
getAuthenticationUser
().
getMdeptid
(
)));
}
if
(
permissionCond
.
equals
(
"PORGDEPT"
)){
//上级部门
else
if
(
permissionCond
.
equals
(
"PORGDEPT"
)){
//上级部门
permissionSQL
.
append
(
String
.
format
(
" %s in (%s) "
,
orgDeptField
,
formatStringArr
(
orgDeptParent
)));
}
if
(
permissionCond
.
equals
(
"ALL"
)){
//全部数据
else
if
(
permissionCond
.
equals
(
"SORGDEPT"
)){
//下级部门
permissionSQL
.
append
(
String
.
format
(
" %s in (%s) "
,
orgDeptField
,
formatStringArr
(
orgDeptChild
)));
}
else
if
(
permissionCond
.
equals
(
"ALL"
)){
//全部数据
permissionSQL
.
append
(
"(1=1)"
);
}
}
else
{
permissionSQL
.
append
(
nPermissionSQL
);
}
}
if
(
StringUtils
.
isEmpty
(
permissionSQL
.
toString
()))
return
""
;
String
resultCond
=
permissionSQL
.
toString
();
if
(
resultCond
.
endsWith
(
"OR"
)){
resultCond
=
resultCond
.
substring
(
0
,
resultCond
.
lastIndexOf
(
"OR"
));
}
String
resultCond
=
parseResult
(
permissionSQL
,
"OR"
);
return
resultCond
;
}
/**
*
拼接权限查询条件(表单/表格)共用
*
构造 wrapper
* @param whereCond
* @param permissionField
* @return
*/
private
QueryWrapper
getPermissionCond
(
String
whereCond
,
Map
<
String
,
String
>
permissionField
){
QueryWrapper
allPermissionCond
=
new
QueryWrapper
();
if
(
StringUtils
.
isEmpty
(
whereCond
))
return
allPermissionCond
;
allPermissionCond
.
apply
(
whereCond
);
private
QueryWrapper
getPermissionWrapper
(
String
whereCond
){
return
allPermissionCond
;
QueryWrapper
permissionWrapper
=
new
QueryWrapper
();
if
(!
StringUtils
.
isEmpty
(
whereCond
)){
permissionWrapper
.
apply
(
whereCond
);
}
return
permissionWrapper
;
}
/**
...
...
@@ -365,47 +382,78 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @return
*/
private
Map
<
String
,
String
>
getPermissionField
(
EntityBase
entityBase
){
Map
<
String
,
String
>
permissionFiled
=
new
HashMap
<>();
String
orgField
=
"orgid"
;
//组织权限默认值
String
orgsecField
=
"orgsecid"
;
//部门权限默认值
// Map<Field, PreField> preFields= entityBase.SearchPreField(); //从缓存中获取当前类预置属性
// //寻找实体权限属性
// for (Map.Entry<Field,PreField> entry : preFields.entrySet()){
// Field prefield=entry.getKey();//获取注解字段
// PreField fieldAnnotation=entry.getValue();//获取注解值
// PredefinedType prefieldType=fieldAnnotation.preType();
// if(prefieldType==PredefinedType.ORGID)//用户配置系统预置属性-组织机构标识
// orgField=prefield.getName();
// if(prefieldType==PredefinedType.ORGSECTORID)//用户配置系统预置属性-部门标识
// orgsecField=prefield.getName();
// }
String
orgField
=
"orgid"
;
//组织属性
String
orgDeptField
=
"orgsecid"
;
//部门属性
String
createManField
=
"createman"
;
//创建人属性
String
keyField
=
""
;
//主键属性
DEFieldCacheMap
.
getFieldMap
(
entityBase
.
getClass
().
getName
());
Map
<
Field
,
DEField
>
preFields
=
SearchDEField
(
entityBase
.
getClass
().
getName
());
//从缓存中获取当前类预置属性
for
(
Map
.
Entry
<
Field
,
DEField
>
entry
:
preFields
.
entrySet
()){
Field
preField
=
entry
.
getKey
();
//获取注解字段
DEField
fieldAnnotation
=
entry
.
getValue
();
//获取注解值
DEPredefinedFieldType
prefieldType
=
fieldAnnotation
.
preType
();
if
(
prefieldType
==
prefieldType
.
ORGID
)
//用户配置系统预置属性-组织机构标识
orgField
=
preField
.
getName
();
if
(
prefieldType
==
prefieldType
.
ORGSECTORID
)
//用户配置系统预置属性-部门标识
orgDeptField
=
preField
.
getName
();
if
(
fieldAnnotation
.
isKeyField
())
//用户配置系统预置属性-部门标识
keyField
=
preField
.
getName
();
}
permissionFiled
.
put
(
"orgfield"
,
orgField
);
permissionFiled
.
put
(
"orgsecfield"
,
orgsecField
);
permissionFiled
.
put
(
"orgsecfield"
,
orgDeptField
);
permissionFiled
.
put
(
"createmanfield"
,
createManField
);
permissionFiled
.
put
(
"keyfield"
,
keyField
);
return
permissionFiled
;
}
/**
*
获取bean名称
* @param className
*
获取含有@DEField注解的实体属性
* @param className
do对象类名
* @return
*/
private
String
getBeanName
(
String
className
)
{
if
(
Character
.
isLowerCase
(
className
.
charAt
(
0
)))
{
return
className
;
}
else
{
return
(
new
StringBuilder
()).
append
(
Character
.
toLowerCase
(
className
.
charAt
(
0
))).
append
(
className
.
substring
(
1
)).
toString
();
private
Map
<
Field
,
DEField
>
SearchDEField
(
String
className
){
List
<
Field
>
fields
=
DEFieldCacheMap
.
getFields
(
className
);
Map
<
Field
,
DEField
>
deFieldMap
=
new
HashMap
<>();
for
(
Field
field:
fields
){
DEField
deField
=
field
.
getAnnotation
(
DEField
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
deField
))
{
deFieldMap
.
put
(
field
,
deField
);
}
}
return
deFieldMap
;
}
/**
* 转换[a,b]格式字符串到 'a','b'格式
*
* @return
*/
private
String
formatStringArr
(
JSONArray
array
)
{
String
[]
arr
=
array
.
toArray
(
new
String
[
array
.
size
()]);
return
"'"
+
String
.
join
(
"','"
,
arr
)
+
"'"
;
}
/**
* 格式转换
*
* @param cond
* @param operator
* @return
*/
private
String
parseResult
(
StringBuffer
cond
,
String
operator
)
{
String
resultCond
=
cond
.
toString
();
if
(
resultCond
.
startsWith
(
operator
))
resultCond
=
resultCond
.
replaceFirst
(
operator
,
""
);
if
(
resultCond
.
endsWith
(
operator
))
resultCond
=
resultCond
.
substring
(
0
,
resultCond
.
lastIndexOf
(
operator
));
return
resultCond
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/security/AuthenticationUser.java
浏览文件 @
0ebf83eb
...
...
@@ -62,7 +62,8 @@ public class AuthenticationUser implements UserDetails
private
int
superuser
;
@JsonIgnore
private
JSONObject
permisionList
;
private
String
levelcode
;
//单位级别编码
private
String
orglevel
;
//单位级别
private
String
deptlevel
;
//部门级别
@JsonIgnore
private
Map
<
String
,
String
>
userSessionParam
;
//用户自定义session值
@JsonIgnore
...
...
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/service/FileService.java
0 → 100644
浏览文件 @
0ebf83eb
package
cn
.
ibizlab
.
util
.
service
;
import
cn.ibizlab.util.domain.FileItem
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
public
interface
FileService
{
FileItem
saveFile
(
MultipartFile
multipartFile
);
File
getFile
(
String
fileid
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/service/SimpleFileService.java
0 → 100644
浏览文件 @
0ebf83eb
package
cn
.
ibizlab
.
util
.
service
;
import
cn.ibizlab.util.domain.FileItem
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.FileCopyUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.util.UUID
;
@Primary
@Slf4j
@Service
public
class
SimpleFileService
implements
FileService
{
@Value
(
"${ibiz.filePath:/app/file/}"
)
private
String
fileRoot
;
@Override
public
FileItem
saveFile
(
MultipartFile
multipartFile
)
{
FileItem
item
=
null
;
// 获取文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
// 获取文件后缀
String
extname
=
"."
+
getExtensionName
(
fileName
);
// 用uuid作为文件名,防止生成的临时文件重复
String
fileid
=
UUID
.
randomUUID
().
toString
();
String
fileFullPath
=
this
.
fileRoot
+
"ibztuit"
+
File
.
separator
+
fileid
+
File
.
separator
+
fileName
;
File
file
=
new
File
(
fileFullPath
);
File
parent
=
new
File
(
file
.
getParent
());
if
(!
parent
.
exists
())
parent
.
mkdirs
();
try
{
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
()
,
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
(
int
)
multipartFile
.
getSize
()
,
extname
);
}
catch
(
IOException
e
)
{
throw
new
InternalServerErrorException
(
"文件上传失败"
);
}
return
item
;
}
@Override
public
File
getFile
(
String
fileid
)
{
String
dirpath
=
this
.
fileRoot
+
"ibztuit"
+
File
.
separator
+
fileid
;
File
parent
=
new
File
(
dirpath
);
if
(
parent
.
exists
()
&&
parent
.
isDirectory
()
&&
parent
.
listFiles
().
length
>
0
)
{
return
parent
.
listFiles
()[
0
];
}
throw
new
InternalServerErrorException
(
"文件未找到"
);
}
/**
* 获取文件扩展名
* @param filename
* @return
*/
public
static
String
getExtensionName
(
String
filename
)
{
if
((
filename
!=
null
)
&&
(
filename
.
length
()
>
0
))
{
int
dot
=
filename
.
lastIndexOf
(
'.'
);
if
((
dot
>-
1
)
&&
(
dot
<
(
filename
.
length
()
-
1
)))
{
return
filename
.
substring
(
dot
+
1
);
}
}
return
filename
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/java/cn/ibizlab/util/service/SimpleUserService.java
浏览文件 @
0ebf83eb
...
...
@@ -60,7 +60,6 @@ public class SimpleUserService implements AuthenticationUserService{
user
.
setOrgcode
(
domains
);
user
.
setOrgname
(
domains
);
testPermissionData
(
user
);
setUserPermission
(
user
);
setUserOrgInfo
(
user
);
...
...
@@ -91,7 +90,7 @@ public class SimpleUserService implements AuthenticationUserService{
*/
private
void
setUserPermission
(
AuthenticationUser
user
)
{
if
(
enablePermissionValid
){
JSONObject
permission
=
uaaFeignClient
.
getUserPermissionData
(
user
.
get
Userid
(),
systemid
);
JSONObject
permission
=
uaaFeignClient
.
getUserPermissionData
(
user
.
get
Loginname
(),
systemid
);
user
.
setPermisionList
(
permission
);
}
}
...
...
@@ -102,18 +101,11 @@ public class SimpleUserService implements AuthenticationUserService{
*/
private
void
setUserOrgInfo
(
AuthenticationUser
user
)
{
if
(
enablePermissionValid
)
{
user
.
setOrgInfo
(
ouFeignClient
.
getOrgInfo
(
user
.
getLevelcode
()));
JSONObject
orgInfo
=
ouFeignClient
.
getOrgInfo
(
user
.
getLoginname
());
if
(
orgInfo
==
null
)
throw
new
RuntimeException
(
"获取用户信息失败,请检查用户中心[IBZOU]中是否存在当前用户!"
);
user
.
setOrgInfo
(
orgInfo
);
}
}
/**
* 测试数据
* @param user
*/
private
void
testPermissionData
(
AuthenticationUser
user
){
user
.
setLevelcode
(
"4501"
);
user
.
setUserid
(
"4fb71d8997d4505d2748ad2bdc471969"
);
this
.
systemid
=
"2C40DFCD-0DF5-47BF-91A5-C45F810B0001"
;
}
}
This diff is collapsed.
Click to expand it.
ibzou-util/src/main/resources/application-sys.yml
浏览文件 @
0ebf83eb
...
...
@@ -60,3 +60,7 @@ logging:
ribbon
:
ReadTimeout
:
60000
ConnectTimeout
:
60000
#系统是否开启权限验证
ibiz
:
enablePermissionValid
:
false
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录