Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
4ff52e21
提交
4ff52e21
编写于
4月 22, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
8d0456b4
变更
54
隐藏空白字符变更
内嵌
并排
正在显示
54 个修改的文件
包含
7873 行增加
和
118 行删除
+7873
-118
en-US.ts
app_web/src/locale/lang/en-US.ts
+1
-1
zh-CN.ts
app_web/src/locale/lang/zh-CN.ts
+1
-1
ibzdict-item_en_US.ts
app_web/src/locale/lanres/ibzdict-item/ibzdict-item_en_US.ts
+185
-0
ibzdict-item_zh_CN.ts
app_web/src/locale/lanres/ibzdict-item/ibzdict-item_zh_CN.ts
+184
-0
ibzdict-items.ts
app_web/src/mock/entity/ibzdict-items/ibzdict-items.ts
+571
-0
index.ts
app_web/src/mock/index.ts
+1
-1
ibzdict-item-edit-view-base.vue
...ct/ibzdict-item-edit-view/ibzdict-item-edit-view-base.vue
+44
-17
ibzdict-item-edit-view.vue
...es/dict/ibzdict-item-edit-view/ibzdict-item-edit-view.vue
+1
-1
ibzdict-item-grid-view-base.vue
...ct/ibzdict-item-grid-view/ibzdict-item-grid-view-base.vue
+51
-20
ibzdict-item-grid-view.vue
...es/dict/ibzdict-item-grid-view/ibzdict-item-grid-view.vue
+2
-2
codelist-service.ts
app_web/src/service/app/codelist-service.ts
+28
-10
entity-service-register.ts
app_web/src/service/entity-service-register.ts
+1
-1
ibzdict-item-service-base.ts
...web/src/service/ibzdict-item/ibzdict-item-service-base.ts
+201
-0
ibzdict-item-service.ts
app_web/src/service/ibzdict-item/ibzdict-item-service.ts
+25
-0
default.less
app_web/src/styles/default.less
+0
-2
ibzdict-item-ui-service-base.ts
...rc/uiservice/ibzdict-item/ibzdict-item-ui-service-base.ts
+212
-0
ibzdict-item-ui-service.ts
...web/src/uiservice/ibzdict-item/ibzdict-item-ui-service.ts
+21
-0
ui-service-register.ts
app_web/src/uiservice/ui-service-register.ts
+1
-1
default-searchform-base.vue
...zdict-item/default-searchform/default-searchform-base.vue
+757
-0
default-searchform-model.ts
...zdict-item/default-searchform/default-searchform-model.ts
+35
-0
default-searchform-service.ts
...ict-item/default-searchform/default-searchform-service.ts
+366
-0
default-searchform.less
...s/ibzdict-item/default-searchform/default-searchform.less
+40
-0
default-searchform.vue
...ts/ibzdict-item/default-searchform/default-searchform.vue
+14
-0
main-form-base.vue
...web/src/widgets/ibzdict-item/main-form/main-form-base.vue
+1691
-0
main-form-model.ts
...web/src/widgets/ibzdict-item/main-form/main-form-model.ts
+105
-0
main-form-service.ts
...b/src/widgets/ibzdict-item/main-form/main-form-service.ts
+366
-0
main-form.less
app_web/src/widgets/ibzdict-item/main-form/main-form.less
+49
-0
main-form.vue
app_web/src/widgets/ibzdict-item/main-form/main-form.vue
+14
-0
main-grid-base.vue
...web/src/widgets/ibzdict-item/main-grid/main-grid-base.vue
+1375
-0
main-grid-model.ts
...web/src/widgets/ibzdict-item/main-grid/main-grid-model.ts
+128
-0
main-grid-service.ts
...b/src/widgets/ibzdict-item/main-grid/main-grid-service.ts
+318
-0
main-grid.less
app_web/src/widgets/ibzdict-item/main-grid/main-grid.less
+71
-0
main-grid.vue
app_web/src/widgets/ibzdict-item/main-grid/main-grid.vue
+14
-0
main-grid-base.vue
app_web/src/widgets/ibzdict/main-grid/main-grid-base.vue
+1
-1
main-grid.less
app_web/src/widgets/ibzdict/main-grid/main-grid.less
+5
-2
webSecurityConfig.java
...rc/main/java/cn/ibizlab/web/config/webSecurityConfig.java
+152
-0
AuthenticationController.java
...in/java/cn/ibizlab/web/rest/AuthenticationController.java
+31
-30
webApplication.java
...-app-web/src/main/java/cn/ibizlab/web/webApplication.java
+9
-8
application-web-prod.yml
...zdict-app-web/src/main/resources/application-web-prod.yml
+25
-0
pom.xml
ibzdict-dependencies/pom.xml
+22
-0
dictapiSecurityConfig.java
...java/cn/ibizlab/dictapi/config/dictapiSecurityConfig.java
+118
-0
ibzdictdictapiApplication.java
...in/java/cn/ibizlab/dictapi/ibzdictdictapiApplication.java
+5
-1
IBZDictItemResource.java
...ain/java/cn/ibizlab/dictapi/rest/IBZDictItemResource.java
+68
-0
pom.xml
ibzdict-util/pom.xml
+10
-0
DEFieldDefaultValueAspect.java
...ava/cn/ibizlab/util/aspect/DEFieldDefaultValueAspect.java
+51
-16
IBZUSER.java
...ct-util/src/main/java/cn/ibizlab/util/domain/IBZUSER.java
+114
-0
SearchContextBase.java
...c/main/java/cn/ibizlab/util/filter/SearchContextBase.java
+5
-3
IBZUSERMapper.java
...l/src/main/java/cn/ibizlab/util/mapper/IBZUSERMapper.java
+8
-0
AuthTokenUtil.java
...src/main/java/cn/ibizlab/util/security/AuthTokenUtil.java
+170
-0
AuthenticationEntryPoint.java
...va/cn/ibizlab/util/security/AuthenticationEntryPoint.java
+27
-0
AuthorizationTokenFilter.java
...va/cn/ibizlab/util/security/AuthorizationTokenFilter.java
+68
-0
AuthenticationUserService.java
...va/cn/ibizlab/util/service/AuthenticationUserService.java
+18
-0
IBZUSERService.java
...src/main/java/cn/ibizlab/util/service/IBZUSERService.java
+29
-0
IBZUSERServiceImpl.java
...main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
+64
-0
未找到文件。
app_web/src/locale/lang/en-US.ts
浏览文件 @
4ff52e21
import
ibzdictitem_en_US
from
'@locale/lanres/ibzdict
item/ibzdict
item_en_US'
;
import
ibzdictitem_en_US
from
'@locale/lanres/ibzdict
-item/ibzdict-
item_en_US'
;
import
ibzdict_en_US
from
'@locale/lanres/ibzdict/ibzdict_en_US'
;
import
ibzdict_en_US
from
'@locale/lanres/ibzdict/ibzdict_en_US'
;
import
components_en_US
from
'@locale/lanres/components/components_en_US'
;
import
components_en_US
from
'@locale/lanres/components/components_en_US'
;
import
codelist_en_US
from
'@locale/lanres/codelist/codelist_en_US'
;
import
codelist_en_US
from
'@locale/lanres/codelist/codelist_en_US'
;
...
...
app_web/src/locale/lang/zh-CN.ts
浏览文件 @
4ff52e21
import
ibzdictitem_zh_CN
from
'@locale/lanres/ibzdict
item/ibzdict
item_zh_CN'
;
import
ibzdictitem_zh_CN
from
'@locale/lanres/ibzdict
-item/ibzdict-
item_zh_CN'
;
import
ibzdict_zh_CN
from
'@locale/lanres/ibzdict/ibzdict_zh_CN'
;
import
ibzdict_zh_CN
from
'@locale/lanres/ibzdict/ibzdict_zh_CN'
;
import
components_zh_CN
from
'@locale/lanres/components/components_zh_CN'
;
import
components_zh_CN
from
'@locale/lanres/components/components_zh_CN'
;
import
codelist_zh_CN
from
'@locale/lanres/codelist/codelist_zh_CN'
;
import
codelist_zh_CN
from
'@locale/lanres/codelist/codelist_zh_CN'
;
...
...
app_web/src/locale/lanres/ibzdict-item/ibzdict-item_en_US.ts
0 → 100644
浏览文件 @
4ff52e21
export
default
{
views
:
{
gridview
:
{
caption
:
"字典项目"
,
title
:
'字典项目'
,
},
editview
:
{
caption
:
"字典项目"
,
title
:
'字典项目'
,
},
},
main_form
:
{
details
:
{
group1
:
"字典项目基本信息"
,
formpage1
:
"基本信息"
,
srfupdatedate
:
"更新时间"
,
srforikey
:
""
,
srfkey
:
"字典项目标识"
,
srfmajortext
:
"栏目显示值"
,
srftempmode
:
""
,
srfuf
:
""
,
srfdeid
:
""
,
srfsourcekey
:
""
,
dictid
:
"字典标识"
,
ibzdictitemname
:
"栏目显示值"
,
dictitemval
:
"栏目值"
,
pitemval
:
"父栏目值"
,
itemfilter
:
"过滤项"
,
itemcls
:
"栏目样式"
,
itemicon
:
"图标"
,
showorder
:
"排序"
,
ibzdictitemid
:
"字典项目标识"
,
},
uiactions
:
{
},
},
main_grid
:
{
columns
:
{
ibzdictitemname
:
"栏目显示值"
,
dictitemval
:
"栏目值"
,
pitemval
:
"父栏目值"
,
itemfilter
:
"过滤项"
,
itemcls
:
"栏目样式"
,
itemicon
:
"图标"
,
showorder
:
"排序"
,
updatedate
:
"更新时间"
,
},
uiactions
:
{
},
},
default_searchform
:
{
details
:
{
formpage1
:
"常规条件"
,
n_ibzdictitemname_like
:
"栏目显示值(文本包含(%))"
,
n_dictitemval_like
:
"栏目值(文本包含(%))"
,
},
uiactions
:
{
},
},
gridviewtoolbar_toolbar
:
{
tbitem3
:
{
caption
:
"New"
,
tip
:
"New"
,
},
tbitem4
:
{
caption
:
"Edit"
,
tip
:
"Edit"
,
},
tbitem6
:
{
caption
:
"Copy"
,
tip
:
"Copy"
,
},
tbitem7
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem8
:
{
caption
:
"Remove"
,
tip
:
"Remove"
,
},
tbitem9
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem13
:
{
caption
:
"Export"
,
tip
:
"Export"
,
},
tbitem10
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem16
:
{
caption
:
"其它"
,
tip
:
"其它"
,
},
tbitem21
:
{
caption
:
"Export Data Model"
,
tip
:
"导出数据模型"
,
},
tbitem23
:
{
caption
:
"数据导入"
,
tip
:
"数据导入"
,
},
tbitem17
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem19
:
{
caption
:
"Filter"
,
tip
:
"Filter"
,
},
tbitem18
:
{
caption
:
"Help"
,
tip
:
"Help"
,
},
},
editviewtoolbar_toolbar
:
{
tbitem3
:
{
caption
:
"Save"
,
tip
:
"Save"
,
},
tbitem4
:
{
caption
:
"Save And New"
,
tip
:
"Save And New"
,
},
tbitem5
:
{
caption
:
"Save And Close"
,
tip
:
"Save And Close"
,
},
tbitem6
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem7
:
{
caption
:
"Remove And Close"
,
tip
:
"Remove And Close"
,
},
tbitem8
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem12
:
{
caption
:
"New"
,
tip
:
"New"
,
},
tbitem13
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem14
:
{
caption
:
"Copy"
,
tip
:
"Copy"
,
},
tbitem16
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem23
:
{
caption
:
"第一个记录"
,
tip
:
"第一个记录"
,
},
tbitem24
:
{
caption
:
"上一个记录"
,
tip
:
"上一个记录"
,
},
tbitem25
:
{
caption
:
"下一个记录"
,
tip
:
"下一个记录"
,
},
tbitem26
:
{
caption
:
"最后一个记录"
,
tip
:
"最后一个记录"
,
},
tbitem21
:
{
caption
:
"-"
,
tip
:
""
,
},
tbitem22
:
{
caption
:
"Help"
,
tip
:
"Help"
,
},
},
};
\ No newline at end of file
app_web/src/locale/lanres/ibzdict-item/ibzdict-item_zh_CN.ts
0 → 100644
浏览文件 @
4ff52e21
export
default
{
views
:
{
gridview
:
{
caption
:
'字典项目'
,
title
:
'字典项目'
,
},
editview
:
{
caption
:
'字典项目'
,
title
:
'字典项目'
,
},
},
main_form
:
{
details
:
{
group1
:
'字典项目基本信息'
,
formpage1
:
'基本信息'
,
srfupdatedate
:
'更新时间'
,
srforikey
:
''
,
srfkey
:
'字典项目标识'
,
srfmajortext
:
'栏目显示值'
,
srftempmode
:
''
,
srfuf
:
''
,
srfdeid
:
''
,
srfsourcekey
:
''
,
dictid
:
'字典标识'
,
ibzdictitemname
:
'栏目显示值'
,
dictitemval
:
'栏目值'
,
pitemval
:
'父栏目值'
,
itemfilter
:
'过滤项'
,
itemcls
:
'栏目样式'
,
itemicon
:
'图标'
,
showorder
:
'排序'
,
ibzdictitemid
:
'字典项目标识'
,
},
uiactions
:
{
},
},
main_grid
:
{
columns
:
{
ibzdictitemname
:
'栏目显示值'
,
dictitemval
:
'栏目值'
,
pitemval
:
'父栏目值'
,
itemfilter
:
'过滤项'
,
itemcls
:
'栏目样式'
,
itemicon
:
'图标'
,
showorder
:
'排序'
,
updatedate
:
'更新时间'
,
},
uiactions
:
{
},
},
default_searchform
:
{
details
:
{
formpage1
:
'常规条件'
,
n_ibzdictitemname_like
:
'栏目显示值(文本包含(%))'
,
n_dictitemval_like
:
'栏目值(文本包含(%))'
,
},
uiactions
:
{
},
},
gridviewtoolbar_toolbar
:
{
tbitem3
:
{
caption
:
'新建'
,
tip
:
'新建'
,
},
tbitem4
:
{
caption
:
'编辑'
,
tip
:
'编辑'
,
},
tbitem6
:
{
caption
:
'拷贝'
,
tip
:
'拷贝'
,
},
tbitem7
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem8
:
{
caption
:
'删除'
,
tip
:
'删除'
,
},
tbitem9
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem13
:
{
caption
:
'导出'
,
tip
:
'导出'
,
},
tbitem10
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem16
:
{
caption
:
'其它'
,
tip
:
'其它'
,
},
tbitem21
:
{
caption
:
'导出数据模型'
,
tip
:
'导出数据模型'
,
},
tbitem23
:
{
caption
:
'数据导入'
,
tip
:
'数据导入'
,
},
tbitem17
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem19
:
{
caption
:
'过滤'
,
tip
:
'过滤'
,
},
tbitem18
:
{
caption
:
'帮助'
,
tip
:
'帮助'
,
},
},
editviewtoolbar_toolbar
:
{
tbitem3
:
{
caption
:
'保存'
,
tip
:
'保存'
,
},
tbitem4
:
{
caption
:
'保存并新建'
,
tip
:
'保存并新建'
,
},
tbitem5
:
{
caption
:
'保存并关闭'
,
tip
:
'保存并关闭'
,
},
tbitem6
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem7
:
{
caption
:
'删除并关闭'
,
tip
:
'删除并关闭'
,
},
tbitem8
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem12
:
{
caption
:
'新建'
,
tip
:
'新建'
,
},
tbitem13
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem14
:
{
caption
:
'拷贝'
,
tip
:
'拷贝'
,
},
tbitem16
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem23
:
{
caption
:
'第一个记录'
,
tip
:
'第一个记录'
,
},
tbitem24
:
{
caption
:
'上一个记录'
,
tip
:
'上一个记录'
,
},
tbitem25
:
{
caption
:
'下一个记录'
,
tip
:
'下一个记录'
,
},
tbitem26
:
{
caption
:
'最后一个记录'
,
tip
:
'最后一个记录'
,
},
tbitem21
:
{
caption
:
'-'
,
tip
:
''
,
},
tbitem22
:
{
caption
:
'帮助'
,
tip
:
'帮助'
,
},
},
};
\ No newline at end of file
app_web/src/mock/entity/ibzdict-items/ibzdict-items.ts
0 → 100644
浏览文件 @
4ff52e21
import
qs
from
'qs'
;
import
{
MockAdapter
}
from
'@/mock/mock-adapter'
;
const
mock
=
MockAdapter
.
getInstance
();
// 模拟数据
const
mockDatas
:
Array
<
any
>
=
[
];
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Select"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// GetDraft
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdictitems
\/
getdraft$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: GetDraft"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
// GetDraft
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdictitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Save"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'itemid'
]
==
tempValue
[
'itemid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdictitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: CheckKey"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
checkkey$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'itemid'
]
==
tempValue
[
'itemid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Create
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdictitems
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Create"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
mockDatas
[
0
]);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
mockDatas
[
0
]];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// Update
mock
.
onPut
(
new
RegExp
(
/^
\/
ibzdictitems
\/?([
a-zA-Z0-9
\-\;]{0,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Update"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'itemid'
]
==
tempValue
[
'itemid'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
];
let
tempValue
:
any
=
{};
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/
fetchdefault$/
).
exec
(
config
.
url
);
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
if
(
items
.
length
>
0
&&
paramArray
.
length
>
0
)
{
paramArray
.
forEach
((
paramkey
:
any
)
=>
{
if
(
tempValue
[
paramkey
]
&&
tempValue
[
paramkey
].
indexOf
(
";"
)
>
0
)
{
let
keysGrounp
:
Array
<
any
>
=
tempValue
[
paramkey
].
split
(
new
RegExp
(
/
[\;]
/
));
let
tempArray
:
Array
<
any
>
=
[];
keysGrounp
.
forEach
((
singlekey
:
any
)
=>
{
let
_items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
singlekey
});
if
(
_items
.
length
>
0
){
tempArray
.
push
(...
_items
);
}
})
items
=
tempArray
;
}
else
{
items
=
items
.
filter
((
item
:
any
)
=>
{
return
item
[
paramkey
]
==
tempValue
[
paramkey
]
});
}
})
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
items
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
items
];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdictitems
\/
fetchdefault$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
mockDatas
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
mockDatas
?
mockDatas
:
[]];
});
// FetchDefault
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdictitems
\/
fetchdefault
(\?[\w
-.
/
?%&=,
]
*
)
*$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: FetchDefault"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
if
(
config
.
url
.
includes
(
'page'
)){
let
url
=
config
.
url
.
split
(
'?'
)[
1
];
let
params
=
qs
.
parse
(
url
);
Object
.
assign
(
config
,
params
);
}
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
let
total
=
mockDatas
.
length
;
let
records
:
Array
<
any
>
=
[];
if
(
!
config
.
page
||
!
config
.
size
){
records
=
mockDatas
;
}
else
{
if
((
config
.
page
-
1
)
*
config
.
size
<
total
){
records
=
mockDatas
.
slice
(
config
.
page
,
config
.
size
);
}
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
records
?
records
:
[]);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
records
?
records
:
[]];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Get
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Get"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'dictid'
,
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdicts
\/([
a-zA-Z0-9
\-\;]{1,35})\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
// Remove
mock
.
onDelete
(
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdictitem 方法: Remove"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'itemid'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ibzdictitems
\/([
a-zA-Z0-9
\-\;]{1,35})
$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
let
items
=
mockDatas
?
mockDatas
:
[];
let
_items
=
items
.
find
((
item
:
any
)
=>
Object
.
is
(
item
.
itemid
,
tempValue
.
itemid
));
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
_items
?
_items
:{});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
_items
?
_items
:{}];
});
app_web/src/mock/index.ts
浏览文件 @
4ff52e21
...
@@ -7,5 +7,5 @@ import './login/login';
...
@@ -7,5 +7,5 @@ import './login/login';
import
'./upload/upload'
;
import
'./upload/upload'
;
// 实体级接口对象
// 实体级接口对象
import
'./entity/ibzdict
items/ibzdict
items'
;
import
'./entity/ibzdict
-items/ibzdict-
items'
;
import
'./entity/ibzdicts/ibzdicts'
;
import
'./entity/ibzdicts/ibzdicts'
;
app_web/src/pages/dict/ibzdict-item-edit-view/ibzdict-item-edit-view-base.vue
浏览文件 @
4ff52e21
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
{
Subject
}
from
'rxjs'
;
import
{
Subject
}
from
'rxjs'
;
import
IBZD
ICTITEMService
from
'@/service/ibzdictitem/ibzdict
item-service'
;
import
IBZD
ictItemService
from
'@/service/ibzdict-item/ibzdict-
item-service'
;
import
EditViewEngine
from
'@engine/view/edit-view-engine'
;
import
EditViewEngine
from
'@engine/view/edit-view-engine'
;
...
@@ -140,10 +140,10 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -140,10 +140,10 @@ export default class IBZDictItemEditViewBase extends Vue {
/**
/**
* 实体服务对象
* 实体服务对象
*
*
* @type {IBZD
ICTITEM
Service}
* @type {IBZD
ictItem
Service}
* @memberof IBZDictItemEditViewBase
* @memberof IBZDictItemEditViewBase
*/
*/
protected
appEntityService
:
IBZD
ICTITEMService
=
new
IBZDICTITEM
Service
;
protected
appEntityService
:
IBZD
ictItemService
=
new
IBZDictItem
Service
;
/**
/**
...
@@ -667,7 +667,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -667,7 +667,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Save
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Save
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -693,7 +693,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -693,7 +693,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
SaveAndNew
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
SaveAndNew
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -719,7 +719,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -719,7 +719,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
SaveAndExit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
SaveAndExit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -745,7 +745,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -745,7 +745,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
RemoveAndExit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
RemoveAndExit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -771,7 +771,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -771,7 +771,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
SaveAndStart
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
SaveAndStart
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -797,7 +797,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -797,7 +797,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
ViewWFStep
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
ViewWFStep
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -823,7 +823,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -823,7 +823,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
New
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
New
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -849,7 +849,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -849,7 +849,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Copy
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Copy
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -875,7 +875,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -875,7 +875,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Print
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Print
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -901,7 +901,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -901,7 +901,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
FirstRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
FirstRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -927,7 +927,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -927,7 +927,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
PrevRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
PrevRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -953,7 +953,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -953,7 +953,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
NextRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
NextRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -979,7 +979,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -979,7 +979,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
LastRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
LastRecord
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1005,7 +1005,7 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -1005,7 +1005,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Help
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Help
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1346,6 +1346,33 @@ export default class IBZDictItemEditViewBase extends Vue {
...
@@ -1346,6 +1346,33 @@ export default class IBZDictItemEditViewBase extends Vue {
}
}
}
}
/**
* 销毁视图回调
*
* @memberof IBZDictItemEditViewBase
*/
protected
destroyed
(){
this
.
afterDestroyed
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZDictItemEditViewBase
*/
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
);
}
})
}
}
}
}
}
</
script
>
</
script
>
...
...
app_web/src/pages/dict/ibzdict-item-edit-view/ibzdict-item-edit-view.vue
浏览文件 @
4ff52e21
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
Component
}
from
'vue-property-decorator'
;
import
{
Component
}
from
'vue-property-decorator'
;
import
IBZDictItemEditViewBase
from
'./ibzdict-item-edit-view-base.vue'
;
import
IBZDictItemEditViewBase
from
'./ibzdict-item-edit-view-base.vue'
;
import
view_form
from
'@widgets/ibzdictitem/main-form/main-form.vue'
;
import
view_form
from
'@widgets/ibzdict
-
item/main-form/main-form.vue'
;
@
Component
({
@
Component
({
components
:
{
components
:
{
view_form
,
view_form
,
...
...
app_web/src/pages/dict/ibzdict-item-grid-view/ibzdict-item-grid-view-base.vue
浏览文件 @
4ff52e21
...
@@ -147,7 +147,7 @@
...
@@ -147,7 +147,7 @@
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
Vue
,
Component
,
Prop
,
Provide
,
Emit
,
Watch
}
from
'vue-property-decorator'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
{
Subject
}
from
'rxjs'
;
import
{
Subject
}
from
'rxjs'
;
import
IBZD
ICTITEMService
from
'@/service/ibzdictitem/ibzdict
item-service'
;
import
IBZD
ictItemService
from
'@/service/ibzdict-item/ibzdict-
item-service'
;
import
GridViewEngine
from
'@engine/view/grid-view-engine'
;
import
GridViewEngine
from
'@engine/view/grid-view-engine'
;
...
@@ -162,10 +162,10 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -162,10 +162,10 @@ export default class IBZDictItemGridViewBase extends Vue {
/**
/**
* 实体服务对象
* 实体服务对象
*
*
* @type {IBZD
ICTITEM
Service}
* @type {IBZD
ictItem
Service}
* @memberof IBZDictItemGridViewBase
* @memberof IBZDictItemGridViewBase
*/
*/
protected
appEntityService
:
IBZD
ICTITEMService
=
new
IBZDICTITEM
Service
;
protected
appEntityService
:
IBZD
ictItemService
=
new
IBZDictItem
Service
;
/**
/**
...
@@ -761,7 +761,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -761,7 +761,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
New
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
New
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -787,7 +787,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -787,7 +787,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Edit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Edit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -813,7 +813,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -813,7 +813,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
View
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
View
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -839,7 +839,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -839,7 +839,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Copy
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Copy
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -865,7 +865,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -865,7 +865,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
ToggleRowEdit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
ToggleRowEdit
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -891,7 +891,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -891,7 +891,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
NewRow
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
NewRow
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -917,7 +917,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -917,7 +917,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Remove
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Remove
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -943,7 +943,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -943,7 +943,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
ExportExcel
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
ExportExcel
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -969,7 +969,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -969,7 +969,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Print
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Print
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -995,7 +995,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -995,7 +995,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
ExportModel
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
ExportModel
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1021,7 +1021,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1021,7 +1021,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Import
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Import
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1047,7 +1047,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1047,7 +1047,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
ToggleFilter
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
ToggleFilter
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1073,7 +1073,7 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1073,7 +1073,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas
=
[...
xData
.
getDatas
()];
datas
=
[...
xData
.
getDatas
()];
}
}
// 界面行为
// 界面行为
this
.
Help
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ICTITEM
"
);
this
.
Help
(
datas
,
contextJO
,
paramJO
,
$event
,
xData
,
this
,
"IBZD
ictItem
"
);
}
}
/**
/**
...
@@ -1093,9 +1093,11 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1093,9 +1093,11 @@ export default class IBZDictItemGridViewBase extends Vue {
Object
.
assign
(
curViewParam
,
args
[
0
]);
Object
.
assign
(
curViewParam
,
args
[
0
]);
}
}
let
deResParameters
:
any
[]
=
[];
let
deResParameters
:
any
[]
=
[];
deResParameters
=
[
if
(
curViewParam
.
ibzdict
&&
true
){
deResParameters
=
[
{
pathName
:
'ibzdicts'
,
parameterName
:
'ibzdict'
},
{
pathName
:
'ibzdicts'
,
parameterName
:
'ibzdict'
},
];
]
}
const
parameters
:
any
[]
=
[
const
parameters
:
any
[]
=
[
{
pathName
:
'ibzdictitems'
,
parameterName
:
'ibzdictitem'
},
{
pathName
:
'ibzdictitems'
,
parameterName
:
'ibzdictitem'
},
{
pathName
:
'editview'
,
parameterName
:
'editview'
},
{
pathName
:
'editview'
,
parameterName
:
'editview'
},
...
@@ -1128,9 +1130,11 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1128,9 +1130,11 @@ export default class IBZDictItemGridViewBase extends Vue {
Object
.
assign
(
curViewParam
,
args
[
0
]);
Object
.
assign
(
curViewParam
,
args
[
0
]);
}
}
let
deResParameters
:
any
[]
=
[];
let
deResParameters
:
any
[]
=
[];
deResParameters
=
[
if
(
curViewParam
.
ibzdict
&&
true
){
deResParameters
=
[
{
pathName
:
'ibzdicts'
,
parameterName
:
'ibzdict'
},
{
pathName
:
'ibzdicts'
,
parameterName
:
'ibzdict'
},
];
]
}
const
parameters
:
any
[]
=
[
const
parameters
:
any
[]
=
[
{
pathName
:
'ibzdictitems'
,
parameterName
:
'ibzdictitem'
},
{
pathName
:
'ibzdictitems'
,
parameterName
:
'ibzdictitem'
},
{
pathName
:
'editview'
,
parameterName
:
'editview'
},
{
pathName
:
'editview'
,
parameterName
:
'editview'
},
...
@@ -1419,6 +1423,33 @@ export default class IBZDictItemGridViewBase extends Vue {
...
@@ -1419,6 +1423,33 @@ export default class IBZDictItemGridViewBase extends Vue {
}
}
}
}
/**
* 销毁视图回调
*
* @memberof IBZDictItemGridViewBase
*/
protected
destroyed
(){
this
.
afterDestroyed
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZDictItemGridViewBase
*/
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
);
}
})
}
}
}
/**
/**
* 是否单选
* 是否单选
*
*
...
...
app_web/src/pages/dict/ibzdict-item-grid-view/ibzdict-item-grid-view.vue
浏览文件 @
4ff52e21
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
import
{
Component
}
from
'vue-property-decorator'
;
import
{
Component
}
from
'vue-property-decorator'
;
import
IBZDictItemGridViewBase
from
'./ibzdict-item-grid-view-base.vue'
;
import
IBZDictItemGridViewBase
from
'./ibzdict-item-grid-view-base.vue'
;
import
view_grid
from
'@widgets/ibzdictitem/main-grid/main-grid.vue'
;
import
view_grid
from
'@widgets/ibzdict
-
item/main-grid/main-grid.vue'
;
import
view_searchform
from
'@widgets/ibzdictitem/default-searchform/default-searchform.vue'
;
import
view_searchform
from
'@widgets/ibzdict
-
item/default-searchform/default-searchform.vue'
;
@
Component
({
@
Component
({
components
:
{
components
:
{
view_grid
,
view_grid
,
...
...
app_web/src/service/app/codelist-service.ts
浏览文件 @
4ff52e21
...
@@ -32,6 +32,15 @@ export default class CodeListService {
...
@@ -32,6 +32,15 @@ export default class CodeListService {
}
}
/**
* 动态代码表缓存(加载中)
*
* @type {Map<string,any>}
* @memberof CodeListService
*/
public
static
codelistCache
:
Map
<
string
,
any
>
=
new
Map
();
/**
/**
* 获取动态代码表
* 获取动态代码表
*
*
...
@@ -51,16 +60,25 @@ export default class CodeListService {
...
@@ -51,16 +60,25 @@ export default class CodeListService {
}
}
}
}
if
(
_this
[
tag
])
{
if
(
_this
[
tag
])
{
_this
[
tag
].
getItems
(
context
,
data
,
isloading
).
then
((
result
:
any
)
=>
{
const
callback
:
Function
=
(
tag
:
string
,
promise
:
Promise
<
any
>
)
=>
{
if
(
result
.
length
>
0
){
promise
.
then
((
result
:
any
)
=>
{
_this
.
$store
.
commit
(
'updateCodeList'
,{
srfkey
:
tag
,
items
:
result
});
if
(
result
.
length
>
0
){
return
resolve
(
result
);
_this
.
$store
.
commit
(
'updateCodeList'
,{
srfkey
:
tag
,
items
:
result
});
}
else
{
return
resolve
(
result
);
return
resolve
([]);
}
else
{
}
return
resolve
([]);
}).
catch
((
result
:
any
)
=>
{
}
return
reject
(
result
);
}).
catch
((
result
:
any
)
=>
{
})
return
reject
(
result
);
})
}
if
(
CodeListService
.
codelistCache
.
get
(
tag
)){
callback
(
tag
,
CodeListService
.
codelistCache
.
get
(
tag
));
}
else
{
let
result
:
Promise
<
any
>
=
_this
[
tag
].
getItems
(
context
,
data
,
isloading
);
CodeListService
.
codelistCache
.
set
(
tag
,
result
);
callback
(
tag
,
result
);
}
}
}
}
else
{
}
else
{
if
(
_this
[
tag
])
{
if
(
_this
[
tag
])
{
...
...
app_web/src/service/entity-service-register.ts
浏览文件 @
4ff52e21
...
@@ -39,7 +39,7 @@ export class EntityServiceRegister {
...
@@ -39,7 +39,7 @@ export class EntityServiceRegister {
* @memberof EntityServiceRegister
* @memberof EntityServiceRegister
*/
*/
protected
init
():
void
{
protected
init
():
void
{
this
.
allEntityService
.
set
(
'ibzdictitem'
,
()
=>
import
(
'@/service/ibzdict
item/ibzdict
item-service'
));
this
.
allEntityService
.
set
(
'ibzdictitem'
,
()
=>
import
(
'@/service/ibzdict
-item/ibzdict-
item-service'
));
this
.
allEntityService
.
set
(
'ibzdict'
,
()
=>
import
(
'@/service/ibzdict/ibzdict-service'
));
this
.
allEntityService
.
set
(
'ibzdict'
,
()
=>
import
(
'@/service/ibzdict/ibzdict-service'
));
}
}
...
...
app_web/src/service/ibzdict-item/ibzdict-item-service-base.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Http
,
Util
}
from
'@/utils'
;
import
EntityService
from
'../entity-service'
;
/**
* 字典项目服务对象基类
*
* @export
* @class IBZDictItemServiceBase
* @extends {EntityServie}
*/
export
default
class
IBZDictItemServiceBase
extends
EntityService
{
/**
* Creates an instance of IBZDictItemServiceBase.
*
* @param {*} [opts={}]
* @memberof IBZDictItemServiceBase
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
/**
* 初始化基础数据
*
* @memberof IBZDictItemServiceBase
*/
public
initBasicData
(){
this
.
APPLYDEKEY
=
'ibzdictitem'
;
this
.
APPDEKEY
=
'itemid'
;
this
.
APPDENAME
=
'ibzdictitems'
;
this
.
APPDETEXT
=
'itemname'
;
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Select
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
get
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
/select`
,
isloading
);
}
return
Http
.
getInstance
().
get
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
/select`
,
isloading
);
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Get
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
get
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
isloading
);
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
isloading
);
return
res
;
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
GetDraft
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
true
){
return
Http
.
getInstance
().
get
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/getdraft`
,
isloading
);
}
let
res
:
any
=
await
Http
.
getInstance
().
get
(
`/ibzdictitems/getdraft`
,
isloading
);
res
.
data
.
ibzdictitem
=
data
.
ibzdictitem
;
return
res
;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Save
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
post
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
/save`
,
data
,
isloading
);
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
/save`
,
data
,
isloading
);
return
res
;
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
CheckKey
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
post
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
/checkkey`
,
data
,
isloading
);
}
return
Http
.
getInstance
().
post
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
/checkkey`
,
data
,
isloading
);
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Remove
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
delete
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
isloading
);
}
return
Http
.
getInstance
().
delete
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
isloading
);
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Create
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
true
){
data
[
this
.
APPDEKEY
]
=
null
;
return
Http
.
getInstance
().
post
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems`
,
data
,
isloading
);
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
data
[
this
.
APPDEKEY
]
=
null
;
let
tempContext
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
context
));
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/ibzdictitems`
,
data
,
isloading
);
return
res
;
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
Update
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
context
.
ibzdictitem
){
return
Http
.
getInstance
().
put
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
data
,
isloading
);
}
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
put
(
`/ibzdictitems/
${
context
.
ibzdictitem
}
`
,
data
,
isloading
);
return
res
;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public
async
FetchDefault
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
ibzdict
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/ibzdicts/
${
context
.
ibzdict
}
/ibzdictitems/fetchdefault`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
Http
.
getInstance
().
get
(
`/ibzdictitems/fetchdefault`
,
tempData
,
isloading
);
}
}
\ No newline at end of file
app_web/src/service/ibzdict-item/ibzdict-item-service.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Http
,
Util
}
from
'@/utils'
;
import
IBZDictItemServiceBase
from
'./ibzdict-item-service-base'
;
/**
* 字典项目服务对象
*
* @export
* @class IBZDictItemService
* @extends {IBZDictItemServiceBase}
*/
export
default
class
IBZDictItemService
extends
IBZDictItemServiceBase
{
/**
* Creates an instance of IBZDictItemService.
*
* @param {*} [opts={}]
* @memberof IBZDictItemService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
}
\ No newline at end of file
app_web/src/styles/default.less
浏览文件 @
4ff52e21
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
.ivu-card-body .grid>.el-table .el-table__header-wrapper thead>tr th {
.ivu-card-body .grid>.el-table .el-table__header-wrapper thead>tr th {
background: rgb(245,245,245);
background: rgb(245,245,245);
border-right: 1px solid rgb(250,250,250);
border-right: 1px solid rgb(250,250,250);
text-align: center;
}
}
.el-table td, .el-table th.is-leaf {
.el-table td, .el-table th.is-leaf {
border-bottom: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
...
@@ -42,7 +41,6 @@
...
@@ -42,7 +41,6 @@
.grid .el-table__body-wrapper .el-table__row td{
.grid .el-table__body-wrapper .el-table__row td{
border-left: 1px solid rgb(245,245,245);
border-left: 1px solid rgb(245,245,245);
border-top: 1px solid rgb(245,245,245);
border-top: 1px solid rgb(245,245,245);
text-align: center;
}
}
.el-table--enable-row-hover .el-table__body tr:hover>td {
.el-table--enable-row-hover .el-table__body tr:hover>td {
background-color: #badfffba !important;
background-color: #badfffba !important;
...
...
app_web/src/uiservice/ibzdict-item/ibzdict-item-ui-service-base.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Environment
}
from
'@/environments/environment'
;
import
{
UIActionTool
,
Util
}
from
'@/utils'
;
import
UIService
from
'../ui-service'
;
import
{
Subject
}
from
'rxjs'
;
import
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
/**
* 字典项目UI服务对象基类
*
* @export
* @class IBZDictItemUIServiceBase
*/
export
default
class
IBZDictItemUIServiceBase
extends
UIService
{
/**
* 是否支持工作流
*
* @memberof IBZDictItemUIServiceBase
*/
protected
isEnableWorkflow
:
boolean
=
false
;
/**
* 当前UI服务对应的数据服务对象
*
* @memberof IBZDictItemUIServiceBase
*/
protected
dataService
:
IBZDictItemService
=
new
IBZDictItemService
();
/**
* 所有关联视图
*
* @memberof IBZDictItemUIServiceBase
*/
protected
allViewMap
:
Map
<
string
,
Object
>
=
new
Map
();
/**
* 状态值
*
* @memberof IBZDictItemUIServiceBase
*/
protected
stateValue
:
number
=
0
;
/**
* 状态属性
*
* @memberof IBZDictItemUIServiceBase
*/
protected
stateField
:
string
=
""
;
/**
* 主状态属性集合
*
* @memberof IBZDictItemUIServiceBase
*/
protected
mainStateFields
:
Array
<
any
>
=
[];
/**
* 主状态集合Map
*
* @memberof IBZDictItemUIServiceBase
*/
protected
allDeMainStateMap
:
Map
<
string
,
string
>
=
new
Map
();
/**
* Creates an instance of IBZDictItemUIServiceBase.
*
* @param {*} [opts={}]
* @memberof IBZDictItemUIServiceBase
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
initViewMap
();
this
.
initDeMainStateMap
();
}
/**
* 初始化视图Map
*
* @memberof IBZDictItemUIServiceBase
*/
public
initViewMap
(){
this
.
allViewMap
.
set
(
'MDATAVIEW:'
,{
viewname
:
'gridview'
,
srfappde
:
'ibzdictitems'
});
this
.
allViewMap
.
set
(
'EDITVIEW:'
,{
viewname
:
'editview'
,
srfappde
:
'ibzdictitems'
});
}
/**
* 初始化主状态集合
*
* @memberof IBZDictItemUIServiceBase
*/
public
initDeMainStateMap
(){
}
/**
* 获取指定数据的重定向页面
*
* @param srfkey 数据主键
* @param isEnableWorkflow 重定向视图是否需要处理流程中的数据
* @memberof IBZDictItemUIServiceBase
*/
public
async
getRDAppView
(
srfkey
:
string
,
isEnableWorkflow
:
boolean
){
this
.
isEnableWorkflow
=
isEnableWorkflow
;
// 进行数据查询
let
result
:
any
=
await
this
.
dataService
.
Get
({
ibzdictitem
:
srfkey
});
const
curData
:
any
=
result
.
data
;
//判断当前数据模式,默认为true,todo
const
iRealDEModel
:
boolean
=
true
;
let
bDataInWF
:
boolean
=
false
;
let
bWFMode
:
any
=
false
;
// 计算数据模式
if
(
this
.
isEnableWorkflow
)
{
bDataInWF
=
await
this
.
dataService
.
testDataInWF
({
stateValue
:
this
.
stateValue
,
stateField
:
this
.
stateField
},
curData
);
if
(
bDataInWF
)
{
bDataInWF
=
true
;
bWFMode
=
await
this
.
dataService
.
testUserExistWorklist
(
null
,
curData
);
}
}
let
strPDTViewParam
:
string
=
await
this
.
getDESDDEViewPDTParam
(
curData
,
bDataInWF
,
bWFMode
);
//若不是当前数据模式,处理strPDTViewParam,todo
//查找视图
//返回视图
return
this
.
allViewMap
.
get
(
strPDTViewParam
);
}
/**
* 获取实际的数据类型
*
* @memberof IBZDictItemUIServiceBase
*/
protected
getRealDEType
(
entity
:
any
){
}
/**
* 获取实体单数据实体视图预定义参数
*
* @param curData 当前数据
* @param bDataInWF 是否有数据在工作流中
* @param bWFMode 是否工作流模式
* @memberof IBZDictItemUIServiceBase
*/
protected
async
getDESDDEViewPDTParam
(
curData
:
any
,
bDataInWF
:
boolean
,
bWFMode
:
boolean
){
let
strPDTParam
:
string
=
''
;
if
(
bDataInWF
)
{
// 判断数据是否在流程中
}
//多表单,todo
const
isEnableMultiForm
:
boolean
=
false
;
const
multiFormDEField
:
string
|
null
=
null
;
if
(
isEnableMultiForm
&&
multiFormDEField
)
{
const
objFormValue
:
string
=
curData
[
multiFormDEField
];
if
(
!
Environment
.
isAppMode
){
return
'MOBEDITVIEW'
+
objFormValue
;
}
return
'EDITVIEW'
+
objFormValue
;
}
if
(
!
Environment
.
isAppMode
){
if
(
this
.
getDEMainStateTag
(
curData
)){
return
`MOBEDITVIEW:MSTAG:
${
await
this
.
getDEMainStateTag
(
curData
)}
`
;
}
return
'MOBEDITVIEW:'
;
}
if
(
this
.
getDEMainStateTag
(
curData
)){
return
`EDITVIEW:MSTAG:
${
await
this
.
getDEMainStateTag
(
curData
)}
`
;
}
return
'EDITVIEW:'
;
}
/**
* 获取数据对象的主状态标识
*
* @param curData 当前数据
* @memberof IBZDictItemUIServiceBase
*/
protected
async
getDEMainStateTag
(
curData
:
any
){
if
(
this
.
mainStateFields
.
length
===
0
)
return
null
;
this
.
mainStateFields
.
forEach
((
singleMainField
:
any
)
=>
{
if
(
!
(
singleMainField
in
curData
)){
console
.
error
(
`当前数据对象不包含属性singleMainField,可能会发生错误`
);
}
})
let
strTag
:
String
=
""
;
for
(
let
i
=
0
;
i
<=
1
;
i
++
)
{
let
strTag
:
string
=
(
curData
[
this
.
mainStateFields
[
0
]])?(
i
==
0
)
?
curData
[
this
.
mainStateFields
[
0
]]
:
""
:
""
;
if
(
this
.
mainStateFields
.
length
>=
2
)
{
for
(
let
j
=
0
;
j
<=
1
;
j
++
)
{
let
strTag2
:
string
=
(
curData
[
this
.
mainStateFields
[
1
]])?
`
${
strTag
}
__
${(
j
==
0
)
?
curData
[
this
.
mainStateFields
[
1
]]
:
""
}
`
:
strTag
;
if
(
this
.
mainStateFields
.
length
>=
3
)
{
for
(
let
k
=
0
;
k
<=
1
;
k
++
)
{
let
strTag3
:
string
=
(
curData
[
this
.
mainStateFields
[
2
]])?
`
${
strTag2
}
__
${(
k
==
0
)
?
curData
[
this
.
mainStateFields
[
2
]]
:
""
}
`
:
strTag2
;
// 判断是否存在
return
this
.
allDeMainStateMap
.
get
(
strTag3
);
}
}
else
{
return
this
.
allDeMainStateMap
.
get
(
strTag2
);
}
}
}
else
{
return
this
.
allDeMainStateMap
.
get
(
strTag
);
}
}
return
null
;
}
}
\ No newline at end of file
app_web/src/uiservice/ibzdict-item/ibzdict-item-ui-service.ts
0 → 100644
浏览文件 @
4ff52e21
import
IBZDictItemUIServiceBase
from
'./ibzdict-item-ui-service-base'
;
/**
* 字典项目UI服务对象
*
* @export
* @class IBZDictItemUIService
*/
export
default
class
IBZDictItemUIService
extends
IBZDictItemUIServiceBase
{
/**
* Creates an instance of IBZDictItemUIService.
*
* @param {*} [opts={}]
* @memberof IBZDictItemUIService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
}
}
\ No newline at end of file
app_web/src/uiservice/ui-service-register.ts
浏览文件 @
4ff52e21
...
@@ -39,7 +39,7 @@ export class UIServiceRegister {
...
@@ -39,7 +39,7 @@ export class UIServiceRegister {
* @memberof UIServiceRegister
* @memberof UIServiceRegister
*/
*/
protected
init
():
void
{
protected
init
():
void
{
this
.
allUIService
.
set
(
'ibzdictitem'
,
()
=>
import
(
'@/uiservice/ibzdict
item/ibzdict
item-ui-service'
));
this
.
allUIService
.
set
(
'ibzdictitem'
,
()
=>
import
(
'@/uiservice/ibzdict
-item/ibzdict-
item-ui-service'
));
this
.
allUIService
.
set
(
'ibzdict'
,
()
=>
import
(
'@/uiservice/ibzdict/ibzdict-ui-service'
));
this
.
allUIService
.
set
(
'ibzdict'
,
()
=>
import
(
'@/uiservice/ibzdict/ibzdict-ui-service'
));
}
}
...
...
app_web/src/widgets/ibzdict-item/default-searchform/default-searchform-base.vue
0 → 100644
浏览文件 @
4ff52e21
<
template
>
<i-form
:model=
"this.data"
class=
'app-search-form'
ref=
'searchform'
style=
""
>
<input
style=
"display:none;"
/>
<row
>
<i-col
v-show=
"detailsModel.n_ibzdictitemname_like.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item
name=
'n_ibzdictitemname_like'
:itemRules=
"this.rules.n_ibzdictitemname_like"
class=
''
:caption=
"$t('ibzdictitem.default_searchform.details.n_ibzdictitemname_like')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.n_ibzdictitemname_like.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.n_ibzdictitemname_like"
@
enter=
"onEnter($event)"
:disabled=
"detailsModel.n_ibzdictitemname_like.disabled"
type=
'text'
style=
"width:100px;"
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.n_dictitemval_like.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item
name=
'n_dictitemval_like'
:itemRules=
"this.rules.n_dictitemval_like"
class=
''
:caption=
"$t('ibzdictitem.default_searchform.details.n_dictitemval_like')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.n_dictitemval_like.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.n_dictitemval_like"
@
enter=
"onEnter($event)"
:disabled=
"detailsModel.n_dictitemval_like.disabled"
type=
'text'
style=
"width:100px;"
></input-box>
</app-form-item>
</i-col>
</row>
<row
v-show=
"Object.keys(data).length>0"
>
<i-col
:md=
"
{ span: 4, offset: 20 }" :sm="{ span: 4, offset: 20 }" :lg="{ span: 4, offset: 20 }">
<i-button
class=
'search_reset'
size=
"default"
type=
"primary"
@
click=
"onSearch"
>
{{
$t
(
'app.searchButton.search'
)
}}
</i-button>
<i-button
class=
'search_reset'
size=
"default"
@
click=
"onReset"
>
{{
this
.
$t
(
'app.searchButton.reset'
)
}}
</i-button>
</i-col>
</row>
</i-form>
</
template
>
<
script
lang=
'ts'
>
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
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
DefaultService
from
'./default-searchform-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
DefaultBase
extends
Vue
implements
ControlInterface
{
/**
* 名称
*
* @type {string}
* @memberof Default
*/
@
Prop
()
protected
name
?:
string
;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Default
*/
@
Prop
()
protected
viewState
!
:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof Default
*/
@
Prop
()
protected
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof Default
*/
@
Prop
()
protected
viewparams
:
any
;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof Default
*/
protected
viewStateEvent
:
Subscription
|
undefined
;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Default
*/
protected
getControlType
():
string
{
return
'SEARCHFORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Default
*/
protected
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 建构部件服务对象
*
* @type {DefaultService}
* @memberof Default
*/
protected
service
:
DefaultService
=
new
DefaultService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {IBZDictItemService}
* @memberof Default
*/
protected
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
$store
});
/**
* 关闭视图
*
* @param {any} args
* @memberof Default
*/
protected
closeView
(
args
:
any
):
void
{
let
_this
:
any
=
this
;
_this
.
$emit
(
'closeview'
,
[
args
]);
}
/**
* 计数器刷新
*
* @memberof Default
*/
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 DefaultBase
*/
public
getDatas
():
any
[]
{
return
[
this
.
data
];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof DefaultBase
*/
public
getData
():
any
{
return
this
.
data
;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof DefaultBase
*/
@
Prop
({
default
:
true
})
protected
showBusyIndicator
?:
boolean
;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof DefaultBase
*/
@
Prop
()
protected
loaddraftAction
!
:
string
;
/**
* 部件行为--load
*
* @type {string}
* @memberof DefaultBase
*/
@
Prop
()
protected
loadAction
!
:
string
;
/**
* 视图标识
*
* @type {string}
* @memberof DefaultBase
*/
@
Prop
()
protected
viewtag
!
:
string
;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof DefaultBase
*/
protected
formState
:
Subject
<
any
>
=
new
Subject
();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof DefaultBase
*/
protected
ignorefieldvaluechange
:
boolean
=
false
;
/**
* 数据变化
*
* @private
* @type {Subject<any>}
* @memberof DefaultBase
*/
private
dataChang
:
Subject
<
any
>
=
new
Subject
();
/**
* 视图状态事件
*
* @private
* @type {(Subscription | undefined)}
* @memberof DefaultBase
*/
private
dataChangEvent
:
Subscription
|
undefined
;
/**
* 原始数据
*
* @private
* @type {*}
* @memberof DefaultBase
*/
private
oldData
:
any
=
{};
/**
* 表单数据对象
*
* @type {*}
* @memberof DefaultBase
*/
protected
data
:
any
=
{
n_ibzdictitemname_like
:
null
,
n_dictitemval_like
:
null
,
};
/**
* 属性值规则
*
* @type {*}
* @memberof DefaultBase
*/
protected
rules
:
any
=
{
n_ibzdictitemname_like
:
[
{
type
:
'string'
,
message
:
'栏目显示值(文本包含(%)) 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'栏目显示值(文本包含(%)) 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'栏目显示值(文本包含(%)) 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'栏目显示值(文本包含(%)) 值不能为空'
,
trigger
:
'blur'
},
],
n_dictitemval_like
:
[
{
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 DefaultBase
*/
protected
detailsModel
:
any
=
{
formpage1
:
new
FormPageModel
({
caption
:
'常规条件'
,
detailType
:
'FORMPAGE'
,
name
:
'formpage1'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
})
,
n_ibzdictitemname_like
:
new
FormItemModel
({
caption
:
'栏目显示值(文本包含(%))'
,
detailType
:
'FORMITEM'
,
name
:
'n_ibzdictitemname_like'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
n_dictitemval_like
:
new
FormItemModel
({
caption
:
'栏目值(文本包含(%))'
,
detailType
:
'FORMITEM'
,
name
:
'n_dictitemval_like'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
};
/**
* 监控表单属性 n_ibzdictitemname_like 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DefaultBase
*/
@
Watch
(
'data.n_ibzdictitemname_like'
)
onN_ibzdictitemname_likeChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'n_ibzdictitemname_like'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 n_dictitemval_like 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DefaultBase
*/
@
Watch
(
'data.n_dictitemval_like'
)
onN_dictitemval_likeChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'n_dictitemval_like'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 重置表单项值
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
private
resetFormData
({
name
,
newVal
,
oldVal
}:
{
name
:
string
,
newVal
:
any
,
oldVal
:
any
}):
void
{
}
/**
* 表单逻辑
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
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 DefaultBase
*/
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={}]
* @memberof DefaultBase
*/
private
onFormLoad
(
data
:
any
=
{}):
void
{
this
.
setFormEnableCond
(
data
);
this
.
fillForm
(
data
);
this
.
formLogic
({
name
:
''
,
newVal
:
null
,
oldVal
:
null
});
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @memberof DefaultBase
*/
protected
fillForm
(
_datas
:
any
=
{}):
void
{
this
.
ignorefieldvaluechange
=
true
;
Object
.
keys
(
_datas
).
forEach
((
name
:
string
)
=>
{
if
(
this
.
data
.
hasOwnProperty
(
name
))
{
this
.
data
[
name
]
=
_datas
[
name
];
}
});
this
.
$nextTick
(
function
()
{
this
.
ignorefieldvaluechange
=
false
;
})
}
/**
* 设置表单项是否启用
*
* @protected
* @param {*} data
* @memberof DefaultBase
*/
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 DefaultBase
*/
private
resetDraftFormStates
():
void
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
form
)
{
form
.
resetFields
();
}
}
/**
* 重置校验结果
*
* @memberof DefaultBase
*/
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 DefaultBase
*/
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 DefaultBase
*/
protected
formValidateStatus
():
boolean
{
const
form
:
any
=
this
.
$refs
.
searchform
;
let
validatestate
:
boolean
=
true
;
form
.
validate
((
valid
:
boolean
)
=>
{
validatestate
=
valid
?
true
:
false
;
});
return
validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof DefaultBase
*/
protected
getValues
():
any
{
return
this
.
data
;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DefaultBase
*/
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 DefaultBase
*/
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 DefaultBase
*/
protected
groupUIActionClick
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
const
item
:
any
=
$event
.
item
;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof DefaultBase
*/
protected
created
():
void
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof DefaultBase
*/
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
);
}
});
}
}
/**
* vue 生命周期
*
* @memberof DefaultBase
*/
protected
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DefaultBase
*/
protected
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
if
(
this
.
dataChangEvent
)
{
this
.
dataChangEvent
.
unsubscribe
();
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof DefaultBase
*/
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 DefaultBase
*/
private
load
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
loadAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图搜索表单loadAction参数未配置'
});
return
;
}
const
arg
:
any
=
{
...
opt
};
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
get
:
Promise
<
any
>
=
this
.
service
.
get
(
this
.
loadAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
get
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
this
.
onFormLoad
(
data
);
this
.
$emit
(
'load'
,
data
);
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'load'
,
data
:
data
});
});
}
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
const
{
data
:
_data
}
=
response
;
this
.
$Notice
.
error
({
title
:
_data
.
title
,
desc
:
_data
.
message
});
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof DefaultBase
*/
protected
loadDraft
(
opt
:
any
=
{},
mode
?:
string
):
void
{
if
(
!
this
.
loaddraftAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图搜索表单loaddraftAction参数未配置'
});
return
;
}
const
arg
:
any
=
{
...
opt
}
;
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
let
post
:
Promise
<
any
>
=
this
.
service
.
loadDraft
(
this
.
loaddraftAction
,
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
.
resetDraftFormStates
();
this
.
onFormLoad
(
data
);
setTimeout
(()
=>
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
form
)
{
form
.
fields
.
forEach
((
field
:
any
)
=>
{
field
.
validateMessage
=
""
;
field
.
validateState
=
""
;
field
.
validateStatus
=
false
;
});
}
});
if
(
Object
.
is
(
mode
,
'RESET'
)){
if
(
!
this
.
formValidateStatus
())
{
return
;
}
}
this
.
$emit
(
'load'
,
data
);
this
.
$nextTick
(()
=>
{
this
.
formState
.
next
({
type
:
'load'
,
data
:
data
});
});
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
return
;
}
const
{
data
:
_data
}
=
response
;
this
.
$Notice
.
error
({
title
:
_data
.
title
,
desc
:
_data
.
message
});
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof DefaultBase
*/
protected
updateFormItems
(
mode
:
string
,
data
:
any
=
{},
updateDetails
:
string
[],
showloading
?:
boolean
):
void
{
}
/**
* 回车事件
*
* @param {*} $event
* @memberof DefaultBase
*/
protected
onEnter
(
$event
:
any
):
void
{
if
(
!
this
.
formValidateStatus
())
{
return
;
}
this
.
$emit
(
'load'
,
this
.
data
);
}
/**
* 搜索
*
* @memberof DefaultBase
*/
protected
onSearch
()
{
if
(
!
this
.
formValidateStatus
())
{
return
;
}
this
.
$emit
(
'load'
,
this
.
data
);
}
/**
* 重置
*
* @memberof DefaultBase
*/
protected
onReset
()
{
this
.
loadDraft
({},
'RESET'
);
}
}
</
script
>
<
style
lang=
'less'
>
@import './default-searchform.less';
</
style
>
\ No newline at end of file
app_web/src/widgets/ibzdict-item/default-searchform/default-searchform-model.ts
0 → 100644
浏览文件 @
4ff52e21
/**
* Default 部件模型
*
* @export
* @class DefaultModel
*/
export
default
class
DefaultModel
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof DefaultModel
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'srfwfmemo'
,
prop
:
'srfwfmemo'
,
dataType
:
'TEXT'
,
},
{
name
:
'n_ibzdictitemname_like'
,
prop
:
'itemname'
,
dataType
:
'TEXT'
,
},
{
name
:
'n_dictitemval_like'
,
prop
:
'itemval'
,
dataType
:
'TEXT'
,
},
]
}
}
\ No newline at end of file
app_web/src/widgets/ibzdict-item/default-searchform/default-searchform-service.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
DefaultModel
from
'./default-searchform-model'
;
/**
* Default 部件服务对象
*
* @export
* @class DefaultService
*/
export
default
class
DefaultService
extends
ControlService
{
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof DefaultService
*/
public
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DefaultService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of DefaultService.
*
* @param {*} [opts={}]
* @memberof DefaultService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
DefaultModel
();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DefaultService
*/
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 DefaultService
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
return
Promise
.
reject
([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@
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 DefaultService
*/
@
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 DefaultService
*/
@
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 DefaultService
*/
@
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 DefaultService
*/
@
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 DefaultService
*/
@
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 DefaultService
*/
@
Errorlog
public
loadDraft
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
//仿真主键数据
Data
.
itemid
=
Util
.
createUUID
();
Data
.
ibzdictitem
=
Data
.
itemid
;
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 DefaultService
*/
@
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 DefaultService
*/
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
app_web/src/widgets/ibzdict-item/default-searchform/default-searchform.less
0 → 100644
浏览文件 @
4ff52e21
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-search-form {
padding: 0 14px;
.search_reset {
margin-right: 12px;
}
}
.app-search-form-flex {
height: 100%;
> .ivu-row {
height: 100%;
> .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%;
}
}
}
// this is less
app_web/src/widgets/ibzdict-item/default-searchform/default-searchform.vue
0 → 100644
浏览文件 @
4ff52e21
<
script
lang=
'ts'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
DefaultBase
from
'./default-searchform-base.vue'
;
@
Component
({
components
:
{
}
})
export
default
class
Default
extends
DefaultBase
{
}
</
script
>
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-form/main-form-base.vue
0 → 100644
浏览文件 @
4ff52e21
<
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('ibzdictitem.main_form.details.group1')"
:isShowCaption=
"false"
uiStyle=
"DEFAULT"
:titleBarCloseMode=
"0"
:isInfoGroupMode=
"false"
>
<row>
<i-col
v-show=
"detailsModel.ibzdictitemname.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'ibzdictitemname'
:itemRules=
"this.rules.ibzdictitemname"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.ibzdictitemname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.ibzdictitemname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.ibzdictitemname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.ibzdictitemname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.dictitemval.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'dictitemval'
:itemRules=
"this.rules.dictitemval"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.dictitemval')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.dictitemval.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.dictitemval"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.dictitemval.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.pitemval.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'pitemval'
:itemRules=
"this.rules.pitemval"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.pitemval')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.pitemval.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.pitemval"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.pitemval.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.itemfilter.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'itemfilter'
:itemRules=
"this.rules.itemfilter"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.itemfilter')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.itemfilter.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.itemfilter"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.itemfilter.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.itemcls.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'itemcls'
:itemRules=
"this.rules.itemcls"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.itemcls')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.itemcls.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.itemcls"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.itemcls.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.itemicon.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'itemicon'
:itemRules=
"this.rules.itemicon"
class=
''
:caption=
"$t('ibzdictitem.main_form.details.itemicon')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.itemicon.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<input-box
v-model=
"data.itemicon"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.itemicon.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.showorder.visible"
:style=
"
{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item
name=
'showorder'
:itemRules=
"this.rules.showorder"
class=
''
:caption=
"$t('ibzdictitem.main_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=
'ts'
>
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
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
MainService
from
'./main-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
MainBase
extends
Vue
implements
ControlInterface
{
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
name
?:
string
;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@
Prop
()
protected
viewState
!
:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@
Prop
()
protected
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@
Prop
()
protected
viewparams
:
any
;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof Main
*/
protected
viewStateEvent
:
Subscription
|
undefined
;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
protected
getControlType
():
string
{
return
'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
protected
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
protected
service
:
MainService
=
new
MainService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {IBZDictItemService}
* @memberof Main
*/
protected
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
$store
});
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
protected
closeView
(
args
:
any
):
void
{
let
_this
:
any
=
this
;
_this
.
$emit
(
'closeview'
,
[
args
]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
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 Main
*/
public
getDatas
():
any
[]
{
return
[
this
.
data
];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public
getData
():
any
{
return
this
.
data
;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Main
*/
@
Prop
({
default
:
false
})
protected
autosave
?:
boolean
;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@
Prop
({
default
:
true
})
protected
showBusyIndicator
?:
boolean
;
/**
* 部件行为--submit
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
WFSubmitAction
!
:
string
;
/**
* 部件行为--start
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
WFStartAction
!
:
string
;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
updateAction
!
:
string
;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
removeAction
!
:
string
;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
loaddraftAction
!
:
string
;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
loadAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
createAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
searchAction
!
:
string
;
/**
* 视图标识
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
viewtag
!
:
string
;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof Main
*/
protected
formState
:
Subject
<
any
>
=
new
Subject
();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof Main
*/
protected
ignorefieldvaluechange
:
boolean
=
false
;
/**
* 数据变化
*
* @private
* @type {Subject<any>}
* @memberof Main
*/
private
dataChang
:
Subject
<
any
>
=
new
Subject
();
/**
* 视图状态事件
*
* @private
* @type {(Subscription | undefined)}
* @memberof Main
*/
private
dataChangEvent
:
Subscription
|
undefined
;
/**
* 原始数据
*
* @private
* @type {*}
* @memberof Main
*/
private
oldData
:
any
=
{};
/**
* 表单数据对象
*
* @type {*}
* @memberof Main
*/
protected
data
:
any
=
{
srfupdatedate
:
null
,
srforikey
:
null
,
srfkey
:
null
,
srfmajortext
:
null
,
srftempmode
:
null
,
srfuf
:
null
,
srfdeid
:
null
,
srfsourcekey
:
null
,
dictid
:
null
,
ibzdictitemname
:
null
,
dictitemval
:
null
,
pitemval
:
null
,
itemfilter
:
null
,
itemcls
:
null
,
itemicon
:
null
,
showorder
:
null
,
ibzdictitemid
:
null
,
ibzdictitem
:
null
,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof Main
*/
protected
currentAction
:
string
=
""
;
/**
* 关系界面计数器
*
* @type {number}
* @memberof Main
*/
protected
drcounter
:
number
=
0
;
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof Main
*/
protected
saveState
:
any
;
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
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'
},
],
dictid
:
[
{
type
:
'string'
,
message
:
'字典标识 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'字典标识 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'字典标识 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'字典标识 值不能为空'
,
trigger
:
'blur'
},
],
ibzdictitemname
:
[
{
type
:
'string'
,
message
:
'栏目显示值 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'栏目显示值 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
true
,
type
:
'string'
,
message
:
'栏目显示值 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'栏目显示值 值不能为空'
,
trigger
:
'blur'
},
],
dictitemval
:
[
{
type
:
'string'
,
message
:
'栏目值 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'栏目值 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
true
,
type
:
'string'
,
message
:
'栏目值 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'栏目值 值不能为空'
,
trigger
:
'blur'
},
],
pitemval
:
[
{
type
:
'string'
,
message
:
'父栏目值 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'父栏目值 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'父栏目值 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'父栏目值 值不能为空'
,
trigger
:
'blur'
},
],
itemfilter
:
[
{
type
:
'string'
,
message
:
'过滤项 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'过滤项 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'过滤项 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'过滤项 值不能为空'
,
trigger
:
'blur'
},
],
itemcls
:
[
{
type
:
'string'
,
message
:
'栏目样式 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'栏目样式 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'栏目样式 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'栏目样式 值不能为空'
,
trigger
:
'blur'
},
],
itemicon
:
[
{
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'
},
],
ibzdictitemid
:
[
{
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 Main
*/
protected
detailsModel
:
any
=
{
group1
:
new
FormGroupPanelModel
({
caption
:
'字典项目基本信息'
,
detailType
:
'GROUPPANEL'
,
name
:
'group1'
,
visible
:
true
,
isShowCaption
:
false
,
form
:
this
,
uiActionGroup
:
{
caption
:
''
,
langbase
:
'ibzdictitem.main_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
:
3
})
,
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
})
,
dictid
:
new
FormItemModel
({
caption
:
'字典标识'
,
detailType
:
'FORMITEM'
,
name
:
'dictid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
ibzdictitemname
:
new
FormItemModel
({
caption
:
'栏目显示值'
,
detailType
:
'FORMITEM'
,
name
:
'ibzdictitemname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
dictitemval
:
new
FormItemModel
({
caption
:
'栏目值'
,
detailType
:
'FORMITEM'
,
name
:
'dictitemval'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
pitemval
:
new
FormItemModel
({
caption
:
'父栏目值'
,
detailType
:
'FORMITEM'
,
name
:
'pitemval'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
itemfilter
:
new
FormItemModel
({
caption
:
'过滤项'
,
detailType
:
'FORMITEM'
,
name
:
'itemfilter'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
itemcls
:
new
FormItemModel
({
caption
:
'栏目样式'
,
detailType
:
'FORMITEM'
,
name
:
'itemcls'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
itemicon
:
new
FormItemModel
({
caption
:
'图标'
,
detailType
:
'FORMITEM'
,
name
:
'itemicon'
,
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
})
,
ibzdictitemid
:
new
FormItemModel
({
caption
:
'字典项目标识'
,
detailType
:
'FORMITEM'
,
name
:
'ibzdictitemid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfupdatedate'
)
onSrfupdatedateChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfupdatedate'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srforikey'
)
onSrforikeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srforikey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfkey'
)
onSrfkeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfkey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfmajortext'
)
onSrfmajortextChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfmajortext'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srftempmode'
)
onSrftempmodeChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srftempmode'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfuf'
)
onSrfufChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfuf'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfdeid'
)
onSrfdeidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfdeid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.srfsourcekey'
)
onSrfsourcekeyChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'srfsourcekey'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 dictid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.dictid'
)
onDictidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'dictid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 ibzdictitemname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.ibzdictitemname'
)
onIbzdictitemnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'ibzdictitemname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 dictitemval 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.dictitemval'
)
onDictitemvalChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'dictitemval'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 pitemval 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.pitemval'
)
onPitemvalChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'pitemval'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 itemfilter 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.itemfilter'
)
onItemfilterChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'itemfilter'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 itemcls 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.itemcls'
)
onItemclsChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'itemcls'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 itemicon 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.itemicon'
)
onItemiconChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'itemicon'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 showorder 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.showorder'
)
onShoworderChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'showorder'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 ibzdictitemid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.ibzdictitemid'
)
onIbzdictitemidChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'ibzdictitemid'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 重置表单项值
*
* @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
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 Main
*/
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 Main
*/
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 Main
*/
private
onFormLoad
(
data
:
any
=
{},
action
:
string
):
void
{
if
(
Object
.
is
(
action
,
"save"
)
||
Object
.
is
(
action
,
"autoSave"
))
// 更新context的实体主键
if
(
data
.
ibzdictitem
){
Object
.
assign
(
this
.
context
,{
ibzdictitem
:
data
.
ibzdictitem
})
}
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 Main
*/
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 Main
*/
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 Main
*/
private
resetDraftFormStates
():
void
{
const
form
:
any
=
this
.
$refs
.
form
;
if
(
form
)
{
form
.
resetFields
();
}
}
/**
* 重置校验结果
*
* @memberof Main
*/
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 Main
*/
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 Main
*/
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 Main
*/
protected
getValues
():
any
{
return
this
.
data
;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
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 Main
*/
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 Main
*/
protected
groupUIActionClick
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
const
item
:
any
=
$event
.
item
;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof Main
*/
protected
created
():
void
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
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 Main
*/
protected
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
protected
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
if
(
this
.
dataChangEvent
)
{
this
.
dataChangEvent
.
unsubscribe
();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Main
*/
protected
copy
(
arg
:
any
=
{}):
void
{
this
.
loadDraft
(
arg
);
}
/**
*打印
*@memberof @memberof Main
*/
protected
print
(){
let
_this
:
any
=
this
;
_this
.
$print
({
id
:
'form'
,
popTitle
:
'主编辑表单'
});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
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 Main
*/
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 Main
*/
private
load
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
loadAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemEditView视图表单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 Main
*/
protected
loadDraft
(
opt
:
any
=
{}):
void
{
if
(
!
this
.
loaddraftAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemEditView视图表单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
.
ibzdictitem
){
Object
.
assign
(
this
.
context
,{
ibzdictitem
:
data
.
ibzdictitem
})
}
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 Main
*/
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
:
'IBZDictItemEditView视图表单'
+
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 Main
*/
protected
async
save
(
opt
:
any
=
{},
showResultInfo
?:
boolean
,
ifStateNext
:
boolean
=
true
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
showResultInfo
=
showResultInfo
===
undefined
?
true
:
false
;
opt
.
saveEmit
=
opt
.
saveEmit
===
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
.
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
:
'IBZDictItemEditView视图表单'
+
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'
);
if
(
!
opt
.
saveEmit
){
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
:
'IBZDictItemEditView视图表单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 Main
*/
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 Main
*/
protected
async
wfsubmit
(
data
:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
!
this
.
WFSubmitAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemEditView视图表单WFSubmitAction参数未配置'
});
return
;
}
const
_this
:
any
=
this
;
const
arg
:
any
=
data
[
0
];
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
if
(
!
arg
.
ibzdictitem
||
Object
.
is
(
arg
.
ibzdictitem
,
''
))
{
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 Main
*/
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 Main
*/
protected
onEnter
(
$event
:
any
):
void
{
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof Main
*/
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 Main
*/
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 Main
*/
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 Main
*/
protected
drdatasaved
(
$event
:
any
){
let
_this
=
this
;
this
.
drcounter
--
;
if
(
this
.
drcounter
>
0
){
return
;
}
this
.
save
({},
undefined
,
false
).
then
((
res
)
=>
{
this
.
saveState
(
res
);
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 Main
*/
public
createDefault
(){
}
}
</
script
>
<
style
lang=
'less'
>
@import './main-form.less';
</
style
>
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-form/main-form-model.ts
0 → 100644
浏览文件 @
4ff52e21
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export
default
class
MainModel
{
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainModel
*/
public
getDataItems
():
any
[]
{
return
[
{
name
:
'srfwfmemo'
,
prop
:
'srfwfmemo'
,
dataType
:
'TEXT'
,
},
{
name
:
'srfupdatedate'
,
prop
:
'updatedate'
,
dataType
:
'DATETIME'
,
},
{
name
:
'srforikey'
,
},
{
name
:
'srfkey'
,
prop
:
'itemid'
,
dataType
:
'GUID'
,
},
{
name
:
'srfmajortext'
,
prop
:
'itemname'
,
dataType
:
'TEXT'
,
},
{
name
:
'srftempmode'
,
},
{
name
:
'srfuf'
,
},
{
name
:
'srfdeid'
,
},
{
name
:
'srfsourcekey'
,
},
{
name
:
'dictid'
,
prop
:
'dictid'
,
dataType
:
'PICKUP'
,
},
{
name
:
'ibzdictitemname'
,
prop
:
'itemname'
,
dataType
:
'TEXT'
,
},
{
name
:
'dictitemval'
,
prop
:
'itemval'
,
dataType
:
'TEXT'
,
},
{
name
:
'pitemval'
,
prop
:
'pitemval'
,
dataType
:
'TEXT'
,
},
{
name
:
'itemfilter'
,
prop
:
'itemfilter'
,
dataType
:
'TEXT'
,
},
{
name
:
'itemcls'
,
prop
:
'itemcls'
,
dataType
:
'TEXT'
,
},
{
name
:
'itemicon'
,
prop
:
'itemicon'
,
dataType
:
'TEXT'
,
},
{
name
:
'showorder'
,
prop
:
'showorder'
,
dataType
:
'INT'
,
},
{
name
:
'ibzdictitemid'
,
prop
:
'itemid'
,
dataType
:
'GUID'
,
},
{
name
:
'ibzdictitem'
,
prop
:
'itemid'
,
dataType
:
'FONTKEY'
,
},
]
}
}
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-form/main-form-service.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
MainModel
from
'./main-form-model'
;
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export
default
class
MainService
extends
ControlService
{
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof MainService
*/
public
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
MainModel
();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
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 MainService
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
return
Promise
.
reject
([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@
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 MainService
*/
@
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 MainService
*/
@
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 MainService
*/
@
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 MainService
*/
@
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 MainService
*/
@
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 MainService
*/
@
Errorlog
public
loadDraft
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
);
//仿真主键数据
Data
.
itemid
=
Util
.
createUUID
();
Data
.
ibzdictitem
=
Data
.
itemid
;
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 MainService
*/
@
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 MainService
*/
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
app_web/src/widgets/ibzdict-item/main-form/main-form.less
0 → 100644
浏览文件 @
4ff52e21
.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: 10px;
}
}
// this is less
app_web/src/widgets/ibzdict-item/main-form/main-form.vue
0 → 100644
浏览文件 @
4ff52e21
<
script
lang=
'ts'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
MainBase
from
'./main-form-base.vue'
;
@
Component
({
components
:
{
}
})
export
default
class
Main
extends
MainBase
{
}
</
script
>
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-grid/main-grid-base.vue
0 → 100644
浏览文件 @
4ff52e21
<
template
>
<div
class=
'grid'
style=
"height:100%;"
>
<el-table
v-if=
"isDisplay === true"
:default-sort=
"
{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"
@sort-change="onSortChange($event)"
:border="isDragendCol"
:height="isEnablePagingBar
&&
items.length > 0 ? 'calc(100% - 50px)' : '100%'"
:highlight-current-row ="isSingleSelect"
:row-class-name="getRowClassName"
@row-click="rowClick($event)"
@select-all="selectAll($event)"
@select="select($event)"
@row-class-name="onRowClassName($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template
v-if=
"!isSingleSelect"
>
<el-table-column
align=
"center"
type=
'selection'
:width=
"checkboxColWidth"
></el-table-column>
</
template
>
<
template
v-if=
"getColumnState('ibzdictitemname')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'ibzdictitemname'"
:label=
"$t('ibzdictitem.main_grid.columns.ibzdictitemname')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
ibzdictitemname
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('dictitemval')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'dictitemval'"
:label=
"$t('ibzdictitem.main_grid.columns.dictitemval')"
:width=
"200"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
dictitemval
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('pitemval')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'pitemval'"
:label=
"$t('ibzdictitem.main_grid.columns.pitemval')"
:width=
"200"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
pitemval
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('itemfilter')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'itemfilter'"
:label=
"$t('ibzdictitem.main_grid.columns.itemfilter')"
:width=
"100"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
itemfilter
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('itemcls')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'itemcls'"
:label=
"$t('ibzdictitem.main_grid.columns.itemcls')"
:width=
"100"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
itemcls
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('itemicon')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'itemicon'"
:label=
"$t('ibzdictitem.main_grid.columns.itemicon')"
:width=
"100"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
itemicon
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('showorder')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'showorder'"
:label=
"$t('ibzdictitem.main_grid.columns.showorder')"
:width=
"100"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<span>
{{
row
.
showorder
}}
</span>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"getColumnState('updatedate')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'updatedate'"
:label=
"$t('ibzdictitem.main_grid.columns.updatedate')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<app-format-data
format=
"YYYY-MM-DD hh:mm:ss"
:data=
"row.updatedate"
></app-format-data>
</
template
>
</el-table-column>
</template>
<
template
v-if=
"adaptiveState"
>
<el-table-column></el-table-column>
</
template
>
</el-table>
<row
class=
'grid-pagination'
v-show=
"items.length > 0"
>
<page
class=
'pull-right'
@
on-change=
"pageOnChange($event)"
@
on-page-size-change=
"onPageSizeChange($event)"
:transfer=
"true"
:total=
"totalrow"
show-sizer
:current=
"curPage"
:page-size=
"limit"
:page-size-opts=
"[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]"
show-elevator
show-total
>
<span>
<span
class=
"page-column"
>
<poptip
transfer
placement=
"top-start"
>
<i-button
icon=
"md-menu"
>
{{$t('app.gridpage.choicecolumns')}}
</i-button>
<div
slot=
"content"
>
<
template
v-for=
"col in allColumns"
>
<div
:key=
"col.name"
><el-checkbox
v-model=
"col.show"
@
change=
"onColChange()"
>
{{
$t
(
col
.
langtag
)
}}
</el-checkbox></div>
</
template
>
</div>
</poptip>
</span>
<span
class=
"page-button"
><i-button
icon=
"md-refresh"
:title=
"$t('app.gridpage.refresh')"
@
click=
"pageRefresh()"
></i-button></span>
<span>
{{$t('app.gridpage.show')}}
<span>
<
template
v-if=
"items.length === 1"
>
1
</
template
>
<
template
v-else
>
<span>
{{
(
curPage
-
1
)
*
limit
+
1
}}
-
{{
totalrow
>
curPage
*
limit
?
curPage
*
limit
:
totalrow
}}
</span>
</
template
>
</span>
{{$t('app.gridpage.records')}},{{$t('app.gridpage.totle')}}
{{totalrow}}
{{$t('app.gridpage.records')}}
</span>
</span>
</page>
</row>
</div>
</template>
<
script
lang=
'ts'
>
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
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
MainService
from
'./main-grid-service'
;
import
CodeListService
from
"@service/app/codelist-service"
;
@
Component
({
components
:
{
}
})
export
default
class
MainBase
extends
Vue
implements
ControlInterface
{
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
name
?:
string
;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@
Prop
()
protected
viewState
!
:
Subject
<
ViewState
>
;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@
Prop
()
protected
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@
Prop
()
protected
viewparams
:
any
;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof Main
*/
protected
viewStateEvent
:
Subscription
|
undefined
;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
protected
getControlType
():
string
{
return
'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
protected
counterServiceArray
:
Array
<
any
>
=
[];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
protected
service
:
MainService
=
new
MainService
({
$store
:
this
.
$store
});
/**
* 实体服务对象
*
* @type {IBZDictItemService}
* @memberof Main
*/
protected
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
$store
});
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
protected
closeView
(
args
:
any
):
void
{
let
_this
:
any
=
this
;
_this
.
$emit
(
'closeview'
,
[
args
]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
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
();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Main
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public
getDatas
():
any
[]
{
return
this
.
selections
;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public
getData
():
any
{
return
this
.
selections
[
0
];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof Main
*/
@
Prop
()
protected
newdata
:
any
;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof Main
*/
@
Prop
()
protected
opendata
:
any
;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@
Prop
({
default
:
true
})
protected
showBusyIndicator
?:
boolean
;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
updateAction
!
:
string
;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
fetchAction
!
:
string
;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
removeAction
!
:
string
;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
loadAction
!
:
string
;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
loaddraftAction
!
:
string
;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
createAction
!
:
string
;
/**
* 当前页
*
* @type {number}
* @memberof Main
*/
protected
curPage
:
number
=
1
;
/**
* 数据
*
* @type {any[]}
* @memberof Main
*/
protected
items
:
any
[]
=
[];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof Main
*/
protected
isEnablePagingBar
:
boolean
=
true
;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof Main
*/
protected
isNoSort
:
boolean
=
false
;
/**
* 排序方向
*
* @type {string}
* @memberof Main
*/
protected
minorSortDir
:
string
=
''
;
/**
* 排序字段
*
* @type {string}
* @memberof Main
*/
protected
minorSortPSDEF
:
string
=
''
;
/**
* 分页条数
*
* @type {number}
* @memberof Main
*/
protected
limit
:
number
=
20
;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof Main
*/
protected
isHideHeader
:
boolean
=
false
;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof Main
*/
@
Prop
({
default
:
false
})
protected
isSelectFirstDefault
!
:
boolean
;
/**
* 是否单选
*
* @type {boolean}
* @memberof Main
*/
@
Prop
()
protected
isSingleSelect
?:
boolean
;
/**
* 选中数据字符串
*
* @type {string}
* @memberof Main
*/
@
Prop
()
protected
selectedData
?:
string
;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainTree
*/
@
Watch
(
'selectedData'
)
public
onValueChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
selections
=
[];
if
(
this
.
selectedData
){
const
refs
:
any
=
this
.
$refs
;
if
(
refs
.
multipleTable
)
{
refs
.
multipleTable
.
clearSelection
();
JSON
.
parse
(
this
.
selectedData
).
forEach
((
selection
:
any
)
=>
{
let
selectedItem
=
this
.
items
.
find
((
item
:
any
)
=>
{
return
Object
.
is
(
item
.
srfkey
,
selection
.
srfkey
);
});
if
(
selectedItem
){
this
.
rowClick
(
selectedItem
);
}
});
}
}
}
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof Main
*/
@
Prop
({
default
:
2
})
protected
gridRowActiveMode
!
:
number
;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
@
Prop
({
default
:
false
})
protected
isOpenEdit
!
:
boolean
;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
protected
actualIsOpenEdit
:
boolean
=
this
.
isOpenEdit
;
/**
* 总条数
*
* @type {number}
* @memberof Main
*/
protected
totalrow
:
number
=
0
;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
protected
selections
:
any
[]
=
[];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
protected
stopRowClick
:
boolean
=
false
;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof Main
*/
protected
isDisplay
:
boolean
=
true
;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
protected
refresh
(
args
:
any
[]):
void
{
this
.
load
();
}
/**
* 选项框列宽
*
* @type {number}
* @memberof AppIndex
*/
protected
checkboxColWidth
:
number
=
80
;
/**
* 是否允许拖动列宽
*
* @type {boolean}
* @memberof AppEmbedPicker
*/
protected
isDragendCol
:
boolean
=
true
;
/**
* 所有列成员
*
* @type {any[]}
* @memberof Main
*/
protected
allColumns
:
any
[]
=
[
{
name
:
'ibzdictitemname'
,
label
:
'栏目显示值'
,
langtag
:
'ibzdictitem.main_grid.columns.ibzdictitemname'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'dictitemval'
,
label
:
'栏目值'
,
langtag
:
'ibzdictitem.main_grid.columns.dictitemval'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'pitemval'
,
label
:
'父栏目值'
,
langtag
:
'ibzdictitem.main_grid.columns.pitemval'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'itemfilter'
,
label
:
'过滤项'
,
langtag
:
'ibzdictitem.main_grid.columns.itemfilter'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'itemcls'
,
label
:
'栏目样式'
,
langtag
:
'ibzdictitem.main_grid.columns.itemcls'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'itemicon'
,
label
:
'图标'
,
langtag
:
'ibzdictitem.main_grid.columns.itemicon'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'showorder'
,
label
:
'排序'
,
langtag
:
'ibzdictitem.main_grid.columns.showorder'
,
show
:
true
,
util
:
'PX'
},
{
name
:
'updatedate'
,
label
:
'更新时间'
,
langtag
:
'ibzdictitem.main_grid.columns.updatedate'
,
show
:
true
,
util
:
'PX'
},
]
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
protected
rules
:
any
=
{
srfkey
:
[
{
required
:
false
,
validator
:
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
return
(
rule
.
required
&&
(
value
===
null
||
value
===
undefined
||
value
===
""
))
?
false
:
true
;},
message
:
'字典项目标识 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
validator
:
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
return
(
rule
.
required
&&
(
value
===
null
||
value
===
undefined
||
value
===
""
))
?
false
:
true
;},
message
:
'字典项目标识 值不能为空'
,
trigger
:
'blur'
},
],
}
/**
* 表格数据加载
*
* @param {*} [arg={}]
* @memberof Main
*/
protected
load
(
opt
:
any
=
{},
pageReset
:
boolean
=
false
):
void
{
if
(
!
this
.
fetchAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图表格fetchAction参数未配置'
});
return
;
}
if
(
pageReset
){
this
.
curPage
=
1
;
}
const
arg
:
any
=
{...
opt
};
const
page
:
any
=
{};
if
(
this
.
isEnablePagingBar
)
{
Object
.
assign
(
page
,
{
page
:
this
.
curPage
-
1
,
size
:
this
.
limit
});
}
// 设置排序
if
(
!
this
.
isNoSort
&&
!
Object
.
is
(
this
.
minorSortDir
,
''
)
&&
!
Object
.
is
(
this
.
minorSortPSDEF
,
''
))
{
const
sort
:
string
=
this
.
minorSortPSDEF
+
","
+
this
.
minorSortDir
;
Object
.
assign
(
page
,
{
sort
:
sort
});
}
Object
.
assign
(
arg
,
page
);
const
parentdata
:
any
=
{};
this
.
$emit
(
'beforeload'
,
parentdata
);
Object
.
assign
(
arg
,
parentdata
);
Object
.
assign
(
arg
,{
viewparams
:
this
.
viewparams
});
const
post
:
Promise
<
any
>
=
this
.
service
.
search
(
this
.
fetchAction
,
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
:
any
=
response
.
data
;
this
.
totalrow
=
response
.
total
;
this
.
items
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
// 清空selections
this
.
selections
=
[];
this
.
$emit
(
'load'
,
this
.
items
);
// 设置默认选中
let
_this
=
this
;
setTimeout
(()
=>
{
if
(
_this
.
isSelectFirstDefault
){
_this
.
rowClick
(
_this
.
items
[
0
]);
}
if
(
_this
.
selectedData
){
const
refs
:
any
=
_this
.
$refs
;
if
(
refs
.
multipleTable
)
{
refs
.
multipleTable
.
clearSelection
();
JSON
.
parse
(
_this
.
selectedData
).
forEach
((
selection
:
any
)
=>
{
let
selectedItem
=
_this
.
items
.
find
((
item
:
any
)
=>
{
return
Object
.
is
(
item
.
srfkey
,
selection
.
srfkey
);
});
if
(
selectedItem
){
_this
.
rowClick
(
selectedItem
);
}
});
}
}
},
300
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
errorMessage
});
});
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof Main
*/
protected
async
remove
(
datas
:
any
[]):
Promise
<
any
>
{
if
(
!
this
.
removeAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图表格removeAction参数未配置'
});
return
;
}
let
_datas
:
any
[]
=
[];
datas
.
forEach
((
record
:
any
,
index
:
number
)
=>
{
if
(
!
record
.
srfkey
)
{
this
.
items
.
some
((
val
:
any
,
num
:
number
)
=>
{
if
(
JSON
.
stringify
(
val
)
==
JSON
.
stringify
(
record
)){
this
.
items
.
splice
(
num
,
1
);
return
true
;
}
});
}
else
{
_datas
.
push
(
datas
[
index
]);
}
});
if
(
_datas
.
length
===
0
)
{
return
;
}
let
dataInfo
=
''
;
_datas
.
forEach
((
record
:
any
,
index
:
number
)
=>
{
let
srfmajortext
=
record
.
itemname
;
if
(
index
<
5
)
{
if
(
!
Object
.
is
(
dataInfo
,
''
))
{
dataInfo
+=
'、'
;
}
dataInfo
+=
srfmajortext
;
}
else
{
return
false
;
}
});
if
(
_datas
.
length
<
5
)
{
dataInfo
=
dataInfo
+
' 共'
+
_datas
.
length
+
'条数据'
;
}
else
{
dataInfo
=
dataInfo
+
'...'
+
' 共'
+
_datas
.
length
+
'条数据'
;
}
const
removeData
=
()
=>
{
let
keys
:
any
[]
=
[];
_datas
.
forEach
((
data
:
any
)
=>
{
keys
.
push
(
data
.
srfkey
);
});
const
context
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
));
const
post
:
Promise
<
any
>
=
this
.
service
.
delete
(
this
.
removeAction
,
Object
.
assign
(
context
,{
ibzdictitem
:
keys
.
join
(
';'
)
}),
Object
.
assign
({
itemid
:
keys
.
join
(
';'
)
},{
viewparams
:
this
.
viewparams
}),
this
.
showBusyIndicator
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
post
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
''
,
desc
:
'删除数据失败,'
+
response
.
info
});
return
;
}
else
{
this
.
$Notice
.
success
({
title
:
''
,
desc
:
'删除成功!'
});
}
//删除items中已删除的项
console
.
log
(
this
.
items
);
_datas
.
forEach
((
data
:
any
)
=>
{
this
.
items
.
some
((
item
:
any
,
index
:
number
)
=>
{
if
(
Object
.
is
(
item
.
srfkey
,
data
.
srfkey
)){
this
.
items
.
splice
(
index
,
1
);
return
true
;
}
});
});
this
.
totalrow
-=
_datas
.
length
;
this
.
$emit
(
'remove'
,
null
);
this
.
selections
=
[];
resolve
(
response
);
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
if
(
!
response
||
!
response
.
status
||
!
response
.
data
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
reject
(
response
);
return
;
}
reject
(
response
);
});
});
}
dataInfo
=
dataInfo
.
replace
(
/
[
null
]
/g
,
''
).
replace
(
/
[
undefined
]
/g
,
''
);
this
.
$Modal
.
confirm
({
title
:
'警告'
,
content
:
'确认要删除 '
+
dataInfo
+
',删除操作将不可恢复?'
,
onOk
:
()
=>
{
removeData
();
},
onCancel
:
()
=>
{
}
});
return
removeData
;
}
/**
* 批量添加
*
* @param {*} [arg={}]
* @memberof Main
*/
protected
addBatch
(
arg
:
any
=
{}):
void
{
if
(
!
this
.
fetchAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图表格fetchAction参数未配置'
});
return
;
}
if
(
!
arg
){
arg
=
{};
}
console
.
error
(
"批量添加未实现"
);
}
/**
* 数据导入
*
* @param {*} data
* @memberof Main
*/
public
importExcel
(
data
:
any
=
{}):
void
{
//导入excel
const
importDataModel
:
any
=
{
}
if
(
Object
.
keys
(
importDataModel
).
length
==
0
){
this
.
$Notice
.
warning
({
'title'
:
(
this
.
$t
(
"app.utilview.warning"
)
as
string
),
'desc'
:
(
this
.
$t
(
"app.utilview.info"
)
as
string
)
});
return
;
}
const
view
:
any
=
{
viewname
:
'app-data-upload'
,
title
:
this
.
$t
(
"app.utilview.importview"
),
width
:
900
,
height
:
700
}
let
container
:
Subject
<
any
>
=
this
.
$appmodal
.
openModal
(
view
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
importDataModel
);
container
.
subscribe
((
result
:
any
)
=>
{
if
(
Object
.
is
(
result
.
ret
,
'OK'
)){
this
.
refresh
(
result
.
datas
);
}
});
}
/**
* 数据导出
*
* @param {*} data
* @memberof Main
*/
protected
exportExcel
(
data
:
any
=
{}):
void
{
// 导出Excel
const
doExport
=
async
(
_data
:
any
)
=>
{
const
tHeader
:
Array
<
any
>
=
[];
const
filterVal
:
Array
<
any
>
=
[];
this
.
allColumns
.
forEach
((
item
:
any
)
=>
{
item
.
show
&&
item
.
label
?
tHeader
.
push
(
this
.
$t
(
item
.
langtag
))
:
""
;
item
.
show
&&
item
.
name
?
filterVal
.
push
(
item
.
name
)
:
""
;
});
const
data
=
await
this
.
formatExcelData
(
filterVal
,
_data
);
this
.
$export
.
exportExcel
().
then
((
excel
:
any
)
=>
{
excel
.
export_json_to_excel
({
header
:
tHeader
,
//表头 必填
data
,
//具体数据 必填
filename
:
"字典项目表"
,
//非必填
autoWidth
:
true
,
//非必填
bookType
:
"xlsx"
//非必填
});
});
};
const
page
:
any
=
{};
// 设置page,size
if
(
Object
.
is
(
data
.
type
,
'maxRowCount'
))
{
Object
.
assign
(
page
,
{
page
:
0
,
size
:
data
.
maxRowCount
});
}
else
if
(
Object
.
is
(
data
.
type
,
'activatedPage'
))
{
try
{
doExport
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
items
)));
}
catch
(
error
)
{
console
.
error
(
error
);
}
return
;
}
// 设置排序
if
(
!
this
.
isNoSort
&&
!
Object
.
is
(
this
.
minorSortDir
,
''
)
&&
!
Object
.
is
(
this
.
minorSortPSDEF
,
''
))
{
const
sort
:
string
=
this
.
minorSortPSDEF
+
","
+
this
.
minorSortDir
;
Object
.
assign
(
page
,
{
sort
:
sort
});
}
const
arg
:
any
=
{};
Object
.
assign
(
arg
,
page
);
// 获取query,搜索表单,viewparams等父数据
const
parentdata
:
any
=
{};
this
.
$emit
(
'beforeload'
,
parentdata
);
Object
.
assign
(
arg
,
parentdata
);
const
post
:
Promise
<
any
>
=
this
.
service
.
search
(
this
.
fetchAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
arg
,
this
.
showBusyIndicator
);
post
.
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
''
,
desc
:
'数据导出失败,'
+
response
.
info
});
return
;
}
try
{
doExport
(
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
)));
}
catch
(
error
)
{
console
.
error
(
error
);
}
}).
catch
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
401
)
{
return
;
}
this
.
$Notice
.
error
({
title
:
''
,
desc
:
'数据导出失败'
});
});
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @returns {[]}
* @memberof Main
*/
public
async
formatExcelData
(
filterVal
:
any
,
jsonData
:
any
)
{
let
codelistColumns
:
Array
<
any
>
=
[
];
let
_this
=
this
;
for
(
const
codelist
of
codelistColumns
)
{
// 动态代码表处理
if
(
Object
.
is
(
codelist
.
codelistType
,
"DYNAMIC"
))
{
let
items
=
await
_this
.
codeListService
.
getItems
(
codelist
.
srfkey
);
jsonData
.
forEach
((
row
:
any
)
=>
{
row
[
codelist
.
name
]
=
_this
.
getCodelistValue
(
items
,
row
[
codelist
.
name
],
codelist
);
});
// 静态处理
}
else
if
(
Object
.
is
(
codelist
.
codelistType
,
"STATIC"
)){
let
items
=
await
_this
.
$store
.
getters
.
getCodeListItems
(
codelist
.
srfkey
);
jsonData
.
forEach
((
row
:
any
)
=>
{
row
[
codelist
.
name
]
=
_this
.
getCodelistValue
(
items
,
row
[
codelist
.
name
],
codelist
);
});
}
}
return
jsonData
.
map
((
v
:
any
)
=>
filterVal
.
map
((
j
:
any
)
=>
v
[
j
]))
}
/**
* 解析代码表和vlaue,设置items
*
* @private
* @param {any[]} items 代码表数据
* @param {*} value
* @returns {*}
* @memberof Main
*/
private
getCodelistValue
(
items
:
any
[],
value
:
any
,
codelist
:
any
,){
if
(
!
value
){
return
this
.
$t
(
'codelist.'
+
codelist
.
srfkey
+
'.empty'
);
}
if
(
items
)
{
let
result
:
any
=
[];
if
(
Object
.
is
(
codelist
.
renderMode
,
"number"
)){
items
.
map
((
_item
:
any
,
index
:
number
)
=>
{
const
nValue
=
parseInt
((
value
as
any
),
10
);
const
codevalue
=
_item
.
value
;
if
((
parseInt
(
codevalue
,
10
)
&
nValue
)
>
0
){
result
.
push
(
_item
);
}
});
}
else
if
(
Object
.
is
(
codelist
.
renderMode
,
"string"
)){
const
arrayValue
:
Array
<
any
>
=
(
value
as
any
).
split
(
codelist
.
valueSeparator
);
arrayValue
.
map
((
value
:
any
,
index
:
number
)
=>
{
result
.
push
([]);
let
values
:
any
[]
=
Object
.
is
(
this
.
$util
.
typeOf
(
value
),
'number'
)
?
[
value
]
:
[...(
value
as
any
).
split
(
codelist
.
valueSeparator
)];
values
.
map
((
val
:
any
,
num
:
number
)
=>
{
const
item
=
this
.
getItem
(
items
,
val
,
codelist
);
if
(
item
){
result
[
index
].
push
(
item
);
}
});
});
}
else
{
let
values
:
any
[]
=
Object
.
is
(
this
.
$util
.
typeOf
(
value
),
'number'
)
?
[
value
]
:
[...(
value
as
any
).
split
(
codelist
.
valueSeparator
)];
values
.
map
((
value
:
any
,
index
:
number
)
=>
{
const
item
=
this
.
getItem
(
items
,
value
,
codelist
);
if
(
item
){
result
.
push
(
item
);
}
});
}
// 设置items
if
(
result
.
length
!=
0
){
return
result
.
join
(
codelist
.
valueSeparator
);
}
else
{
return
value
;
}
}
}
/**
* 获取代码项
*
* @private
* @param {any[]} items
* @param {*} value
* @returns {*}
* @memberof Main
*/
private
getItem
(
items
:
any
[],
value
:
any
,
codelist
:
any
):
any
{
const
arr
:
Array
<
any
>
=
items
.
filter
(
item
=>
{
return
item
.
value
==
value
});
if
(
arr
.
length
!==
1
)
{
return
undefined
;
}
if
(
Object
.
is
(
codelist
.
codelistType
,
'STATIC'
)){
return
this
.
$t
(
'codelist.'
+
codelist
.
srfkey
+
'.'
+
arr
[
0
].
value
);
}
else
{
return
arr
[
0
].
text
;
}
}
/**
* 生命周期
*
* @memberof Main
*/
protected
created
():
void
{
this
.
afterCreated
();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
protected
afterCreated
(){
this
.
setColState
();
if
(
this
.
viewState
)
{
this
.
viewStateEvent
=
this
.
viewState
.
subscribe
(({
tag
,
action
,
data
})
=>
{
if
(
!
Object
.
is
(
tag
,
this
.
name
))
{
return
;
}
if
(
Object
.
is
(
'load'
,
action
))
{
this
.
load
(
data
);
}
if
(
Object
.
is
(
'remove'
,
action
))
{
this
.
remove
(
data
);
}
if
(
Object
.
is
(
'save'
,
action
))
{
this
.
save
(
data
);
}
});
}
}
/**
* vue 生命周期
*
* @memberof Main
*/
protected
destroyed
()
{
this
.
afterDestroy
();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
protected
afterDestroy
()
{
if
(
this
.
viewStateEvent
)
{
this
.
viewStateEvent
.
unsubscribe
();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof Main
*/
protected
getSelection
():
any
[]
{
return
this
.
selections
;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
rowDBLClick
(
$event
:
any
):
void
{
if
(
!
$event
||
this
.
actualIsOpenEdit
||
Object
.
is
(
this
.
gridRowActiveMode
,
0
))
{
return
;
}
this
.
selections
=
[];
this
.
selections
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
$event
)));
const
refs
:
any
=
this
.
$refs
;
if
(
refs
.
multipleTable
)
{
refs
.
multipleTable
.
clearSelection
();
refs
.
multipleTable
.
toggleRowSelection
(
$event
);
}
this
.
$emit
(
'rowdblclick'
,
this
.
selections
);
this
.
$emit
(
'selectionchange'
,
this
.
selections
);
}
/**
* 复选框数据选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
select
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
this
.
selections
=
[];
this
.
selections
=
[...
JSON
.
parse
(
JSON
.
stringify
(
$event
))];
this
.
$emit
(
'selectionchange'
,
this
.
selections
);
}
/**
* 复选框数据全部选中
*
* @param {*} $event
* @memberof Main
*/
protected
selectAll
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
this
.
selections
=
[];
this
.
selections
=
[...
JSON
.
parse
(
JSON
.
stringify
(
$event
))];
this
.
$emit
(
'selectionchange'
,
this
.
selections
);
}
/**
* 行单击选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
rowClick
(
$event
:
any
,
ifAlways
:
boolean
=
false
):
void
{
if
(
!
ifAlways
&&
(
!
$event
||
this
.
actualIsOpenEdit
))
{
return
;
}
if
(
this
.
stopRowClick
)
{
this
.
stopRowClick
=
false
;
return
;
}
if
(
this
.
isSingleSelect
){
this
.
selections
=
[];
}
// 已选中则删除,没选中则添加
let
selectIndex
=
this
.
selections
.
findIndex
((
item
:
any
)
=>
{
return
Object
.
is
(
item
.
ibzdictitem
,
$event
.
ibzdictitem
);
});
if
(
Object
.
is
(
selectIndex
,
-
1
)){
this
.
selections
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
$event
)));
}
else
{
this
.
selections
.
splice
(
selectIndex
,
1
);
}
const
refs
:
any
=
this
.
$refs
;
if
(
refs
.
multipleTable
)
{
if
(
this
.
isSingleSelect
){
refs
.
multipleTable
.
clearSelection
();
refs
.
multipleTable
.
setCurrentRow
(
$event
);
}
else
{
refs
.
multipleTable
.
toggleRowSelection
(
$event
);
}
}
this
.
$emit
(
'selectionchange'
,
this
.
selections
);
}
/**
* 页面变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
pageOnChange
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
if
(
$event
===
this
.
curPage
)
{
return
;
}
this
.
curPage
=
$event
;
this
.
load
({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
onPageSizeChange
(
$event
:
any
):
void
{
if
(
!
$event
)
{
return
;
}
if
(
$event
===
this
.
limit
)
{
return
;
}
this
.
limit
=
$event
;
if
(
this
.
curPage
===
1
)
{
this
.
load
({});
}
}
/**
* 分页刷新
*
* @memberof Main
*/
protected
pageRefresh
():
void
{
this
.
load
({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof Main
*/
protected
onSortChange
({
column
,
prop
,
order
}:
{
column
:
any
,
prop
:
any
,
order
:
any
}):
void
{
const
dir
=
Object
.
is
(
order
,
'ascending'
)
?
'asc'
:
Object
.
is
(
order
,
'descending'
)
?
'desc'
:
''
;
if
(
Object
.
is
(
dir
,
this
.
minorSortDir
)
&&
Object
.
is
(
this
.
minorSortPSDEF
,
prop
))
{
return
;
}
this
.
minorSortDir
=
dir
;
this
.
minorSortPSDEF
=
prop
?
prop
:
''
;
this
.
load
({});
}
/**
* 表格行选中样式
*
* @param {{ row: any, rowIndex: any }} { row, rowIndex }
* @returns {string}
* @memberof Main
*/
protected
onRowClassName
({
row
,
rowIndex
}:
{
row
:
any
,
rowIndex
:
any
}):
string
{
const
index
=
this
.
selections
.
findIndex
((
select
:
any
)
=>
Object
.
is
(
select
.
srfkey
,
row
.
srfkey
));
return
index
!==
-
1
?
'grid-row-select'
:
''
;
}
/**
* 界面行为
*
* @param {*} row
* @param {*} tag
* @param {*} $event
* @memberof Main
*/
protected
uiAction
(
row
:
any
,
tag
:
any
,
$event
:
any
)
{
this
.
rowClick
(
row
,
true
);
}
/**
* 设置列状态
*
* @memberof Main
*/
protected
setColState
()
{
const
_data
:
any
=
localStorage
.
getItem
(
'ibzdictitem_main_grid'
);
if
(
_data
)
{
let
columns
=
JSON
.
parse
(
_data
);
columns
.
forEach
((
col
:
any
)
=>
{
let
column
=
this
.
allColumns
.
find
((
item
)
=>
Object
.
is
(
col
.
name
,
item
.
name
));
if
(
column
)
{
Object
.
assign
(
column
,
col
);
}
});
}
}
/**
* 列变化
*
* @memberof Main
*/
protected
onColChange
()
{
localStorage
.
setItem
(
'ibzdictitem_main_grid'
,
JSON
.
stringify
(
this
.
allColumns
));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof Main
*/
protected
getColumnState
(
name
:
string
):
boolean
{
let
column
=
this
.
allColumns
.
find
((
col
:
any
)
=>
Object
.
is
(
name
,
col
.
name
)
);
return
column
.
show
?
true
:
false
;
}
/**
* 表格列是否自适应布局
*
* @readonly
* @type {boolean}
* @memberof Main
*/
get
adaptiveState
():
boolean
{
return
!
this
.
allColumns
.
find
((
column
:
any
)
=>
column
.
show
&&
Object
.
is
(
column
.
util
,
'STAR'
));
}
/**
* 保存
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected
save
(
args
:
any
[],
params
?:
any
,
$event
?:
any
,
xData
?:
any
):
void
{
let
_this
=
this
;
let
promises
:
any
=
[];
_this
.
items
.
forEach
((
item
:
any
)
=>
{
if
(
!
item
.
rowDataState
){
return
;
}
else
if
(
Object
.
is
(
item
.
rowDataState
,
'create'
)){
if
(
!
this
.
createAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图表格createAction参数未配置'
});
return
;
}
Object
.
assign
(
item
,{
viewparams
:
this
.
viewparams
});
promises
.
push
(
this
.
service
.
add
(
this
.
createAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
item
,
this
.
showBusyIndicator
));
}
else
if
(
Object
.
is
(
item
.
rowDataState
,
'update'
)){
if
(
!
this
.
updateAction
){
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'IBZDictItemGridView视图表格updateAction参数未配置'
});
return
;
}
Object
.
assign
(
item
,{
viewparams
:
this
.
viewparams
});
if
(
item
.
ibzdictitem
){
Object
.
assign
(
this
.
context
,{
ibzdictitem
:
item
.
ibzdictitem
})
}
promises
.
push
(
this
.
service
.
add
(
this
.
updateAction
,
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
)),
item
,
this
.
showBusyIndicator
));
}
});
Promise
.
all
(
promises
).
then
((
response
:
any
)
=>
{
this
.
$emit
(
'save'
,
response
);
this
.
$Notice
.
success
({
title
:
''
,
desc
:
'保存成功!'
});
this
.
refresh
([]);
}).
catch
((
response
:
any
)
=>
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'系统异常'
});
});
}
/**
* 获取对应行class
*
* @param {*} $args row 行数据,rowIndex 行索引
* @returns {void}
* @memberof Main
*/
protected
getRowClassName
(
args
:{
row
:
any
,
rowIndex
:
number
}){
let
isSelected
=
this
.
selections
.
some
((
item
:
any
)
=>
{
return
Object
.
is
(
item
.
ibzdictitem
,
args
.
row
.
ibzdictitem
);
});
return
isSelected
?
"grid-selected-row"
:
""
;
}
}
</
script
>
<
style
lang=
'less'
>
@import './main-grid.less';
</
style
>
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-grid/main-grid-model.ts
0 → 100644
浏览文件 @
4ff52e21
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export
default
class
MainModel
{
/**
* 是否是实体数据导出
*
* @returns {any[]}
* @memberof MainGridMode
*/
public
isDEExport
:
boolean
=
false
;
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainGridMode
*/
public
getDataItems
():
any
[]
{
if
(
this
.
isDEExport
){
return
[
]
}
else
{
return
[
{
name
:
'dictitemval'
,
prop
:
'itemval'
,
dataType
:
'TEXT'
,
},
{
name
:
'dictid'
,
prop
:
'dictid'
,
dataType
:
'PICKUP'
,
},
{
name
:
'showorder'
,
prop
:
'showorder'
,
dataType
:
'INT'
,
},
{
name
:
'pitemval'
,
prop
:
'pitemval'
,
dataType
:
'TEXT'
,
},
{
name
:
'updatedate'
,
prop
:
'updatedate'
,
dataType
:
'DATETIME'
,
},
{
name
:
'itemicon'
,
prop
:
'itemicon'
,
dataType
:
'TEXT'
,
},
{
name
:
'itemfilter'
,
prop
:
'itemfilter'
,
dataType
:
'TEXT'
,
},
{
name
:
'ibzdictitemname'
,
prop
:
'itemname'
,
dataType
:
'TEXT'
,
},
{
name
:
'srfmajortext'
,
prop
:
'itemname'
,
dataType
:
'TEXT'
,
},
{
name
:
'srfdataaccaction'
,
prop
:
'itemid'
,
dataType
:
'GUID'
,
},
{
name
:
'srfkey'
,
prop
:
'itemid'
,
dataType
:
'GUID'
,
},
{
name
:
'itemcls'
,
prop
:
'itemcls'
,
dataType
:
'TEXT'
,
},
{
name
:
'ibzdictitem'
,
prop
:
'itemid'
,
},
{
name
:
'n_ibzdictitemname_like'
,
prop
:
'n_ibzdictitemname_like'
,
dataType
:
'TEXT'
,
},
{
name
:
'n_dictitemval_like'
,
prop
:
'n_dictitemval_like'
,
dataType
:
'TEXT'
,
},
{
name
:
'size'
,
prop
:
'size'
},
{
name
:
'query'
,
prop
:
'query'
},
{
name
:
'page'
,
prop
:
'page'
},
{
name
:
'sort'
,
prop
:
'sort'
},
{
name
:
'srfparentdata'
,
prop
:
'srfparentdata'
}
]
}
}
}
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-grid/main-grid-service.ts
0 → 100644
浏览文件 @
4ff52e21
import
{
Http
,
Util
,
Errorlog
}
from
'@/utils'
;
import
ControlService
from
'@/widgets/control-service'
;
import
IBZDictItemService
from
'@/service/ibzdict-item/ibzdict-item-service'
;
import
MainModel
from
'./main-grid-model'
;
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export
default
class
MainService
extends
ControlService
{
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof MainService
*/
public
appEntityService
:
IBZDictItemService
=
new
IBZDictItemService
({
$store
:
this
.
getStore
()
});
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public
setTempMode
(){
this
.
isTempMode
=
false
;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor
(
opts
:
any
=
{})
{
super
(
opts
);
this
.
model
=
new
MainModel
();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
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 MainService
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
return
Promise
.
reject
([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@
Errorlog
public
add
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
result
:
Promise
<
any
>
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
_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 MainService
*/
@
Errorlog
public
delete
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
result
:
Promise
<
any
>
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
_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 MainService
*/
@
Errorlog
public
update
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
result
:
Promise
<
any
>
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Data
,
Context
,
isloading
);
}
else
{
result
=
_appEntityService
.
Update
(
Data
,
Context
,
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 MainService
*/
@
Errorlog
public
get
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
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
)
=>
{
//处理返回数据,补充判断标识
if
(
response
.
data
){
Object
.
assign
(
response
.
data
,{
srfuf
:
0
});
}
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@
Errorlog
public
search
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
_appEntityService
:
any
=
this
.
appEntityService
;
let
result
:
Promise
<
any
>
;
if
(
_appEntityService
[
action
]
&&
_appEntityService
[
action
]
instanceof
Function
)
{
result
=
_appEntityService
[
action
](
Context
,
Data
,
isloading
);
}
else
{
result
=
_appEntityService
.
FetchDefault
(
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 MainService
*/
@
Errorlog
public
loadDraft
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
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
)
=>
{
//处理返回数据,补充判断标识
if
(
response
.
data
){
Object
.
assign
(
response
.
data
,{
srfuf
:
'0'
});
//仿真主键数据
response
.
data
.
ibzdictitem
=
Util
.
createUUID
();
}
this
.
handleResponse
(
action
,
response
,
true
);
this
.
mergeDefaults
(
response
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public
mergeDefaults
(
response
:
any
=
{}){
if
(
response
.
data
){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@
Errorlog
public
frontLogic
(
action
:
string
,
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
const
{
data
:
Data
,
context
:
Context
}
=
this
.
handleRequestData
(
action
,
context
,
data
,
true
);
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
);
resolve
(
response
);
}).
catch
(
response
=>
{
reject
(
response
);
});
})
}
}
\ No newline at end of file
app_web/src/widgets/ibzdict-item/main-grid/main-grid.less
0 → 100644
浏览文件 @
4ff52e21
.grid {
flex-grow: 1;
height: 100%;
overflow: auto;
.el-table__body-wrapper::-webkit-scrollbar {
/*滚动条整体样式*/
width : 10px !important; /*高宽分别对应横竖滚动条的尺寸*/
height: 10px !important;
}
.el-table__body-wrapper::-webkit-scrollbar-thumb {
/*滚动条颜色*/
border-radius : 10px !important;
background-color: #cecece !important;
}
.el-table__body-wrapper::-webkit-scrollbar-track {
/*滚动条里面轨道*/
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background : #ededed !important;
border-radius: 10px !important;
}
/*表格文字过长省略*/
.el-table th>.cell, .el-table td>.cell{
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
.app-column-link, .app-format-data{
display: inline;
}
.el-table {
.el-tooltip{
.ivu-form-item{
margin-bottom: unset !important;
}
}
}
.grid-pagination {
height: 50px;
padding: 6px 0px;
.page-button {
button {
padding: 0;
font-size: 16px;
min-width: 32px;
height: 32px;
margin-right: 4px;
}
}
.page-column {
position: absolute;
left: 0;
}
}
.el-table__body-wrapper{
height: calc(100% - 43px) !important;
}
.el-table__empty-block{
height: auto !important;
}
}
.ivu-modal-content{
.footer{
.ivu-row{
text-align: right;
}
}
}
// this is less
app_web/src/widgets/ibzdict-item/main-grid/main-grid.vue
0 → 100644
浏览文件 @
4ff52e21
<
script
lang=
'ts'
>
import
{
Component
}
from
'vue-property-decorator'
;
import
MainBase
from
'./main-grid-base.vue'
;
@
Component
({
components
:
{
}
})
export
default
class
Main
extends
MainBase
{
}
</
script
>
\ No newline at end of file
app_web/src/widgets/ibzdict/main-grid/main-grid-base.vue
浏览文件 @
4ff52e21
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
@row-dblclick="rowDBLClick($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template
v-if=
"!isSingleSelect"
>
<template
v-if=
"!isSingleSelect"
>
<el-table-column
type=
'selection'
:width=
"checkboxColWidth"
></el-table-column>
<el-table-column
align=
"center"
type=
'selection'
:width=
"checkboxColWidth"
></el-table-column>
</
template
>
</
template
>
<
template
v-if=
"getColumnState('ibzdictid')"
>
<
template
v-if=
"getColumnState('ibzdictid')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'ibzdictid'"
:label=
"$t('ibzdict.main_grid.columns.ibzdictid')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
<el-table-column
show-overflow-tooltip
:prop=
"'ibzdictid'"
:label=
"$t('ibzdict.main_grid.columns.ibzdictid')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
...
...
app_web/src/widgets/ibzdict/main-grid/main-grid.less
浏览文件 @
4ff52e21
...
@@ -18,13 +18,16 @@
...
@@ -18,13 +18,16 @@
background : #ededed !important;
background : #ededed !important;
border-radius: 10px !important;
border-radius: 10px !important;
}
}
/*表
头
过长省略*/
/*表
格文字
过长省略*/
.el-table th>.cell{
.el-table th>.cell
, .el-table td>.cell
{
white-space: nowrap;
white-space: nowrap;
text-overflow: ellipsis;
text-overflow: ellipsis;
overflow: hidden;
overflow: hidden;
word-break: break-all;
word-break: break-all;
}
}
.app-column-link, .app-format-data{
display: inline;
}
.el-table {
.el-table {
.el-tooltip{
.el-tooltip{
.ivu-form-item{
.ivu-form-item{
...
...
ibzdict-app/ibzdict-app-web/src/main/java/cn/ibizlab/web/config/webSecurityConfig.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
web
.
config
;
import
cn.ibizlab.util.security.AuthenticationEntryPoint
;
import
cn.ibizlab.util.security.AuthorizationTokenFilter
;
import
cn.ibizlab.util.service.AuthenticationUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.core.GrantedAuthorityDefaults
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
;
@Configuration
@EnableWebSecurity
public
class
webSecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Autowired
private
AuthenticationEntryPoint
unauthorizedHandler
;
@Autowired
private
AuthenticationUserService
userDetailsService
;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter
authenticationTokenFilter
;
@Value
(
"${ibiz.jwt.header:Authorization}"
)
private
String
tokenHeader
;
@Value
(
"${ibiz.custompermitpath:custompermit}"
)
private
String
custompermitpath
;
@Value
(
"${ibiz.customanonymouspath:customanonymous}"
)
private
String
customanonymouspath
;
@Value
(
"${ibiz.auth.path:v7/login}"
)
private
String
loginPath
;
@Value
(
"${ibiz.file.uploadpath:ibzutil/upload}"
)
private
String
uploadpath
;
private
final
String
defaultdownloadpath
=
"util/download/{id}"
;
@Value
(
"${ibiz.file.downloadpath:"
+
defaultdownloadpath
+
"}"
)
private
String
downloadpath
;
@Value
(
"${ibiz.file.previewpath:ibzutil/preview}"
)
private
String
previewpath
;
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
userDetailsService
(
userDetailsService
)
.
passwordEncoder
(
passwordEncoderBean
());
}
@Bean
GrantedAuthorityDefaults
grantedAuthorityDefaults
()
{
// Remove the ROLE_ prefix
return
new
GrantedAuthorityDefaults
(
""
);
}
@Bean
public
PasswordEncoder
passwordEncoderBean
()
{
return
new
BCryptPasswordEncoder
();
}
@Bean
@Override
public
AuthenticationManager
authenticationManagerBean
()
throws
Exception
{
return
super
.
authenticationManagerBean
();
}
@Override
protected
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
httpSecurity
// 禁用 CSRF
.
csrf
().
disable
()
// 授权异常
.
exceptionHandling
().
authenticationEntryPoint
(
unauthorizedHandler
).
and
()
// 不创建会话
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
// 过滤请求
.
authorizeRequests
()
.
antMatchers
(
HttpMethod
.
GET
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/**/*.ico"
,
"/**/assets/**"
,
"/**/css/**"
,
"/**/fonts/**"
,
"/**/js/**"
,
"/**/img/**"
,
"/"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
POST
,
"/"
+
loginPath
).
permitAll
()
.
antMatchers
(
"/websocket/**"
).
permitAll
()
// 文件操作
.
antMatchers
(
"/"
+
downloadpath
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
custompermitpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
customanonymouspath
+
"/**"
).
anonymous
()
.
antMatchers
(
"/**/codelist/**"
).
permitAll
()
.
antMatchers
(
"/**/getappdata"
).
permitAll
()
// 系统监控
.
antMatchers
(
"/actuator/**"
).
anonymous
()
// swagger start
.
antMatchers
(
"/swagger-ui.html"
).
anonymous
()
.
antMatchers
(
"/swagger-resources/**"
).
anonymous
()
.
antMatchers
(
"/webjars/**"
).
anonymous
()
.
antMatchers
(
"/*/api-docs"
).
anonymous
()
// swagger end
// 接口限流测试
.
antMatchers
(
"/test/**"
).
anonymous
()
.
antMatchers
(
HttpMethod
.
OPTIONS
,
"/**"
).
anonymous
()
.
antMatchers
(
"/druid/**"
).
permitAll
()
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
httpSecurity
.
addFilterBefore
(
authenticationTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
}
}
ibzdict-app/ibzdict-app-web/src/main/java/cn/ibizlab/web/rest/AuthenticationController.java
浏览文件 @
4ff52e21
...
@@ -4,6 +4,8 @@ package cn.ibizlab.web.rest;
...
@@ -4,6 +4,8 @@ package cn.ibizlab.web.rest;
import
cn.ibizlab.util.security.AuthenticationInfo
;
import
cn.ibizlab.util.security.AuthenticationInfo
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.security.AuthorizationLogin
;
import
cn.ibizlab.util.security.AuthorizationLogin
;
import
cn.ibizlab.util.security.AuthTokenUtil
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -24,30 +26,29 @@ public class AuthenticationController
...
@@ -24,30 +26,29 @@ public class AuthenticationController
@Value
(
"${ibiz.jwt.header:Authorization}"
)
@Value
(
"${ibiz.jwt.header:Authorization}"
)
private
String
tokenHeader
;
private
String
tokenHeader
;
//
// @Autowired
// private AuthTokenUtil jwtTokenUtil;
//
// @Autowired
// @Qualifier("AuthenticationUserService")
// private UserDetailsService userDetailsService;
// @Autowired
@Autowired
// private IBZUSERService userService;
private
AuthTokenUtil
jwtTokenUtil
;
@Autowired
@Qualifier
(
"AuthenticationUserService"
)
private
UserDetailsService
userDetailsService
;
@Autowired
private
IBZUSERService
userService
;
@PostMapping
(
value
=
"${ibiz.auth.path:v7/login}"
)
@PostMapping
(
value
=
"${ibiz.auth.path:v7/login}"
)
public
ResponseEntity
<
AuthenticationInfo
>
login
(
@Validated
@RequestBody
AuthorizationLogin
authorizationLogin
){
public
ResponseEntity
<
AuthenticationInfo
>
login
(
@Validated
@RequestBody
AuthorizationLogin
authorizationLogin
){
// userService.resetByUsername(authorizationLogin.getUsername());
userService
.
resetByUsername
(
authorizationLogin
.
getUsername
());
String
userName
=
authorizationLogin
.
getUsername
();
final
AuthenticationUser
authuserdetail
=
(
AuthenticationUser
)
userDetailsService
.
loadUserByUsername
(
authorizationLogin
.
getUsername
());
AuthenticationUser
authuserdetail
=
new
AuthenticationUser
();
String
password
=
authorizationLogin
.
getPassword
();
authuserdetail
.
setUsername
(
"system"
);
if
(
pwencry
)
// String password = authorizationLogin.getPassword();
password
=
DigestUtils
.
md5DigestAsHex
(
authorizationLogin
.
getPassword
().
getBytes
());
// password = DigestUtils.md5DigestAsHex(String.format("%1$s||%2$s", userName, password).getBytes());
if
(!
authuserdetail
.
getPassword
().
equals
(
password
)){
// if(!authuserdetail.getPassword().equals( password )){
throw
new
RuntimeException
(
"用户名密码错误"
);
// throw new BadRequestAlertException("用户名密码错误",null,null);
}
// }
// 生成令牌
// 生成令牌
final
String
token
=
""
;
final
String
token
=
jwtTokenUtil
.
generateToken
(
authuserdetail
)
;
// 返回 token
// 返回 token
return
ResponseEntity
.
ok
().
body
(
new
AuthenticationInfo
(
token
,
authuserdetail
));
return
ResponseEntity
.
ok
().
body
(
new
AuthenticationInfo
(
token
,
authuserdetail
));
}
}
...
@@ -56,15 +57,15 @@ public class AuthenticationController
...
@@ -56,15 +57,15 @@ public class AuthenticationController
public
ResponseEntity
<
AuthenticationUser
>
getUserInfo
(){
public
ResponseEntity
<
AuthenticationUser
>
getUserInfo
(){
UserDetails
userDetails
=
(
UserDetails
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
UserDetails
userDetails
=
(
UserDetails
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
();
AuthenticationUser
authuserdetail
=
new
AuthenticationUser
();
AuthenticationUser
authuserdetail
=
new
AuthenticationUser
();
//
if(userDetails==null){
if
(
userDetails
==
null
){
// throw new BadRequestAlertException("未能获取用户信息",null,null
);
throw
new
RuntimeException
(
"未能获取用户信息"
);
//
}
}
//
else if(userDetails instanceof AuthenticationUser ) {
else
if
(
userDetails
instanceof
AuthenticationUser
)
{
//
authuserdetail= (AuthenticationUser)userDetails;
authuserdetail
=
(
AuthenticationUser
)
userDetails
;
//
}
}
//
else {
else
{
//
authuserdetail= (AuthenticationUser)userDetailsService.loadUserByUsername(userDetails.getUsername());
authuserdetail
=
(
AuthenticationUser
)
userDetailsService
.
loadUserByUsername
(
userDetails
.
getUsername
());
//
}
}
return
ResponseEntity
.
ok
().
body
(
authuserdetail
);
return
ResponseEntity
.
ok
().
body
(
authuserdetail
);
}
}
}
}
ibzdict-app/ibzdict-app-web/src/main/java/cn/ibizlab/web/webApplication.java
浏览文件 @
4ff52e21
...
@@ -2,17 +2,15 @@ package cn.ibizlab.web;
...
@@ -2,17 +2,15 @@ package cn.ibizlab.web;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.FeignClientsConfiguration
;
import
org.springframework.cloud.openfeign.FeignClientsConfiguration
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScans
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.
springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
org.
mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.
autoconfigure.jdbc.DataSourceAutoConfigur
ation
;
import
org.springframework.boot.
SpringApplic
ation
;
@Slf4j
@Slf4j
@Import
({
@Import
({
...
@@ -22,11 +20,14 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
...
@@ -22,11 +20,14 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@Configuration
@Configuration
@EnableFeignClients
@EnableFeignClients
@EnableZuulProxy
@EnableZuulProxy
@SpringBootApplication
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
})
public
class
webApplication
extends
WebMvcConfigurerAdapter
{
@MapperScan
(
"cn.ibizlab.*.mapper"
)
@SpringBootApplication
(
exclude
=
{
org
.
springframework
.
boot
.
autoconfigure
.
security
.
servlet
.
SecurityAutoConfiguration
.
class
,
})
public
class
webApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplicationBuilder
builder
=
new
SpringApplicationBuilder
(
webApplication
.
class
);
SpringApplication
.
run
(
webApplication
.
class
,
args
);
builder
.
run
(
args
);
}
}
}
}
ibzdict-app/ibzdict-app-web/src/main/resources/application-web-prod.yml
浏览文件 @
4ff52e21
...
@@ -14,6 +14,29 @@ spring:
...
@@ -14,6 +14,29 @@ spring:
nacos
:
nacos
:
discovery
:
discovery
:
server-addr
:
172.16.102.211:8848
server-addr
:
172.16.102.211:8848
datasource
:
password
:
'
E6@8@7ce'
username
:
a_A_5ae9eb39a
url
:
jdbc:mysql://172.16.180.232:3306/a_A_5ae9eb39a?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
driver-class-name
:
com.mysql.jdbc.Driver
filters
:
stat,wall,log4j2
#配置初始化大小/最小/最大
initial-size
:
1
min-idle
:
1
max-active
:
20
#获取连接等待超时时间
max-wait
:
60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis
:
60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
sysapi
:
sysapi
:
defaultStripPrefix
:
false
defaultStripPrefix
:
false
...
@@ -28,6 +51,8 @@ zuul:
...
@@ -28,6 +51,8 @@ zuul:
path
:
/ibzdicts/**
path
:
/ibzdicts/**
serviceId
:
ibzdict-dictapi
serviceId
:
ibzdict-dictapi
stripPrefix
:
${sysapi.defaultStripPrefix}
stripPrefix
:
${sysapi.defaultStripPrefix}
sensitive-headers
:
-
Cookie,Set-Cookie,Authorization
ribbon
:
ribbon
:
ReadTimeout
:
60000
ReadTimeout
:
60000
...
...
ibzdict-dependencies/pom.xml
浏览文件 @
4ff52e21
...
@@ -58,6 +58,10 @@
...
@@ -58,6 +58,10 @@
<!--MapStruct高性能属性映射工具-->
<!--MapStruct高性能属性映射工具-->
<mapstruct.version>
1.3.0.Final
</mapstruct.version>
<mapstruct.version>
1.3.0.Final
</mapstruct.version>
<!--Java Web Token-->
<jsonwebtoken-jjwt.version>
0.9.1
</jsonwebtoken-jjwt.version>
</properties>
</properties>
<dependencyManagement>
<dependencyManagement>
...
@@ -200,6 +204,18 @@
...
@@ -200,6 +204,18 @@
<version>
${mapstruct.version}
</version>
<version>
${mapstruct.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-security
</artifactId>
<version>
${spring-cloud-security.version}
</version>
</dependency>
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
<version>
${jsonwebtoken-jjwt.version}
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
@@ -241,6 +257,12 @@
...
@@ -241,6 +257,12 @@
<artifactId>
httpclient
</artifactId>
<artifactId>
httpclient
</artifactId>
</dependency>
</dependency>
<!-- MySQL驱动包 -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- Error -->
<!-- Error -->
<!-- Security -->
<!-- Security -->
...
...
ibzdict-provider/ibzdict-provider-dictapi/src/main/java/cn/ibizlab/dictapi/config/dictapiSecurityConfig.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
dictapi
.
config
;
import
cn.ibizlab.util.security.AuthenticationEntryPoint
;
import
cn.ibizlab.util.security.AuthorizationTokenFilter
;
import
cn.ibizlab.util.service.AuthenticationUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.core.GrantedAuthorityDefaults
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
;
@Configuration
@EnableWebSecurity
public
class
dictapiSecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Autowired
private
AuthenticationEntryPoint
unauthorizedHandler
;
@Autowired
private
AuthenticationUserService
userDetailsService
;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter
authenticationTokenFilter
;
@Value
(
"${ibiz.jwt.header:Authorization}"
)
private
String
tokenHeader
;
@Value
(
"${ibiz.custompermitpath:custompermit}"
)
private
String
custompermitpath
;
@Value
(
"${ibiz.customanonymouspath:customanonymous}"
)
private
String
customanonymouspath
;
@Value
(
"${ibiz.auth.path:v7/login}"
)
private
String
loginPath
;
@Value
(
"${ibiz.file.uploadpath:ibzutil/upload}"
)
private
String
uploadpath
;
private
final
String
defaultdownloadpath
=
"util/download/{id}"
;
@Value
(
"${ibiz.file.downloadpath:"
+
defaultdownloadpath
+
"}"
)
private
String
downloadpath
;
@Value
(
"${ibiz.file.previewpath:ibzutil/preview}"
)
private
String
previewpath
;
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
userDetailsService
(
userDetailsService
)
.
passwordEncoder
(
passwordEncoderBean
());
}
@Bean
GrantedAuthorityDefaults
grantedAuthorityDefaults
()
{
// Remove the ROLE_ prefix
return
new
GrantedAuthorityDefaults
(
""
);
}
@Bean
public
PasswordEncoder
passwordEncoderBean
()
{
return
new
BCryptPasswordEncoder
();
}
@Bean
@Override
public
AuthenticationManager
authenticationManagerBean
()
throws
Exception
{
return
super
.
authenticationManagerBean
();
}
@Override
protected
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
httpSecurity
// 禁用 CSRF
.
csrf
().
disable
()
// 授权异常
.
exceptionHandling
().
authenticationEntryPoint
(
unauthorizedHandler
).
and
()
// 不创建会话
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
// 过滤请求
.
authorizeRequests
()
.
antMatchers
(
HttpMethod
.
GET
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/**/*.ico"
,
"/**/assets/**"
,
"/**/css/**"
,
"/**/fonts/**"
,
"/**/js/**"
,
"/**/img/**"
,
"/"
).
permitAll
()
// 所有请求都无需认证
.
anyRequest
().
permitAll
()
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
httpSecurity
.
addFilterBefore
(
authenticationTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
}
}
ibzdict-provider/ibzdict-provider-dictapi/src/main/java/cn/ibizlab/dictapi/ibzdictdictapiApplication.java
浏览文件 @
4ff52e21
...
@@ -8,6 +8,7 @@ import org.springframework.context.annotation.ComponentScan;
...
@@ -8,6 +8,7 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.mybatis.spring.annotation.MapperScan
;
@Slf4j
@Slf4j
@EnableDiscoveryClient
@EnableDiscoveryClient
...
@@ -15,7 +16,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -15,7 +16,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@EnableTransactionManagement
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
})
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
})
@EnableMongoRepositories
(
basePackages
=
{
"cn.ibizlab"
})
@EnableMongoRepositories
(
basePackages
=
{
"cn.ibizlab"
})
@SpringBootApplication
@MapperScan
(
"cn.ibizlab.*.mapper"
)
@SpringBootApplication
(
exclude
=
{
org
.
springframework
.
boot
.
autoconfigure
.
security
.
servlet
.
SecurityAutoConfiguration
.
class
,
})
public
class
ibzdictdictapiApplication
{
public
class
ibzdictdictapiApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
ibzdict-provider/ibzdict-provider-dictapi/src/main/java/cn/ibizlab/dictapi/rest/IBZDictItemResource.java
浏览文件 @
4ff52e21
...
@@ -51,6 +51,74 @@ public class IBZDictItemResource {
...
@@ -51,6 +51,74 @@ public class IBZDictItemResource {
@Lazy
@Lazy
private
IBZDictItemMapping
ibzdictitemMapping
;
private
IBZDictItemMapping
ibzdictitemMapping
;
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Get"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdictitems/{ibzdictitem_id}"
)
public
ResponseEntity
<
IBZDictItemDTO
>
get
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItem
domain
=
ibzdictitemService
.
get
(
ibzdictitem_id
);
IBZDictItemDTO
dto
=
ibzdictitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZDictItem"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdictitems/getdraft"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemMapping
.
toDto
(
ibzdictitemService
.
getDraft
(
new
IBZDictItem
())));
}
@ApiOperation
(
value
=
"Save"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdictitems/{ibzdictitem_id}/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemService
.
save
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
)));
}
@ApiOperation
(
value
=
"CheckKey"
,
tags
=
{
"IBZDictItem"
},
notes
=
"CheckKey"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdictitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemService
.
checkKey
(
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
)));
}
@ApiOperation
(
value
=
"Remove"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Remove"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemService
.
remove
(
ibzdictitem_id
));
}
@ApiOperation
(
value
=
"Create"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Create"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ibzdictitems"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
create
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
);
ibzdictitemService
.
create
(
domain
);
IBZDictItemDTO
dto
=
ibzdictitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"Update"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Update"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
update
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
ibzdictitemMapping
.
toDomain
(
ibzdictitemdto
);
domain
.
setItemid
(
ibzdictitem_id
);
ibzdictitemService
.
update
(
domain
);
IBZDictItemDTO
dto
=
ibzdictitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
//9
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"IBZDictItem"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/ibzdictitems/fetchdefault"
)
public
ResponseEntity
<
List
<
IBZDictItemDTO
>>
fetchDefault
(
IBZDictItemSearchContext
context
)
{
Page
<
IBZDictItem
>
domains
=
ibzdictitemService
.
searchDefault
(
context
)
;
List
<
IBZDictItemDTO
>
list
=
ibzdictitemMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Get"
)
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Get"
)
...
...
ibzdict-util/pom.xml
浏览文件 @
4ff52e21
...
@@ -39,5 +39,15 @@
...
@@ -39,5 +39,15 @@
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
ibzdict-util/src/main/java/cn/ibizlab/util/aspect/DEFieldDefaultValueAspect.java
浏览文件 @
4ff52e21
...
@@ -4,11 +4,14 @@ import cn.ibizlab.util.annotation.DEField;
...
@@ -4,11 +4,14 @@ import cn.ibizlab.util.annotation.DEField;
import
cn.ibizlab.util.enums.DEFieldDefaultValueType
;
import
cn.ibizlab.util.enums.DEFieldDefaultValueType
;
import
cn.ibizlab.util.enums.DEPredefinedFieldType
;
import
cn.ibizlab.util.enums.DEPredefinedFieldType
;
import
cn.ibizlab.util.helper.DEFieldCacheMap
;
import
cn.ibizlab.util.helper.DEFieldCacheMap
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Before
;
import
org.springframework.cglib.beans.BeanMap
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.AlternativeJdkIdGenerator
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.beans.PropertyDescriptor
;
import
java.beans.PropertyDescriptor
;
...
@@ -174,7 +177,7 @@ public class DEFieldDefaultValueAspect
...
@@ -174,7 +177,7 @@ public class DEFieldDefaultValueAspect
//填充系统默认值
//填充系统默认值
if
(
deFieldType
!=
DEFieldDefaultValueType
.
NONE
||
(!
StringUtils
.
isEmpty
(
deFieldDefaultValue
))
){
if
(
deFieldType
!=
DEFieldDefaultValueType
.
NONE
||
(!
StringUtils
.
isEmpty
(
deFieldDefaultValue
))
){
fillFieldDefaultValue
(
fileName
,
deFieldType
,
deFieldDefaultValue
,
et
)
;
fillFieldDefaultValue
(
fileName
,
deFieldType
,
deFieldDefaultValue
,
et
,
fieldAnnotation
)
;
}
}
//填充系统预置属性
//填充系统预置属性
if
(
predefinedFieldType
!=
DEPredefinedFieldType
.
NONE
){
if
(
predefinedFieldType
!=
DEPredefinedFieldType
.
NONE
){
...
@@ -191,41 +194,63 @@ public class DEFieldDefaultValueAspect
...
@@ -191,41 +194,63 @@ public class DEFieldDefaultValueAspect
* @param et 当前实体对象
* @param et 当前实体对象
* @throws Exception
* @throws Exception
*/
*/
private
void
fillFieldDefaultValue
(
String
fileName
,
DEFieldDefaultValueType
deFieldType
,
String
deFieldDefaultValue
,
Object
et
)
throws
Exception
{
private
void
fillFieldDefaultValue
(
String
fileName
,
DEFieldDefaultValueType
deFieldType
,
String
deFieldDefaultValue
,
Object
et
,
DEField
fieldAnnotation
)
throws
Exception
{
AuthenticationUser
curUser
=
AuthenticationUser
.
getAuthenticationUser
();
BeanMap
beanMap
=
BeanMap
.
create
(
et
);
Object
fieldValue
=
beanMap
.
get
(
fileName
);
//获取当前所需填充属性的get、set方法及字段值
//获取当前所需填充属性的get、set方法及字段值
PropertyDescriptor
field
=
new
PropertyDescriptor
(
fileName
,
et
.
getClass
());
PropertyDescriptor
field
=
new
PropertyDescriptor
(
fileName
,
et
.
getClass
());
Method
fieldSetMethod
=
field
.
getWriteMethod
();
Method
fieldGetMethod
=
field
.
getReadMethod
();
Object
fieldValue
=
fieldGetMethod
.
invoke
(
et
);
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
fieldValue
)){
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
fieldValue
)){
//填充直接值及其余默认值类型
//填充直接值及其余默认值类型
if
(
(
deFieldType
==
DEFieldDefaultValueType
.
NONE
&&
!
StringUtils
.
isEmpty
(
deFieldDefaultValue
))
||
(
deFieldType
!=
DEFieldDefaultValueType
.
NONE
)
){
if
(
(
deFieldType
==
DEFieldDefaultValueType
.
NONE
&&
!
StringUtils
.
isEmpty
(
deFieldDefaultValue
))
||
(
deFieldType
!=
DEFieldDefaultValueType
.
NONE
)
){
switch
(
deFieldType
){
//根据注解给预置属性填充值
switch
(
deFieldType
){
case
SESSION:
case
SESSION:
String
sessionField
=
fieldAnnotation
.
defaultValue
();
if
(!
StringUtils
.
isEmpty
(
sessionField
)){
Object
sessionFieldValue
=
curUser
.
getSessionParams
().
get
(
sessionField
);
if
(!
ObjectUtils
.
isEmpty
(
sessionFieldValue
)){
beanMap
.
put
(
fileName
,
sessionFieldValue
);
}
}
break
;
break
;
case
APPLICATION:
case
APPLICATION:
//暂未实现
break
;
break
;
case
UNIQUEID:
case
UNIQUEID:
String
uuid
=(
new
AlternativeJdkIdGenerator
()).
generateId
().
toString
();
Object
objUuId
=
fieldValueConvert
(
uuid
,
field
);
beanMap
.
put
(
fileName
,
objUuId
);
break
;
break
;
case
CONTEXT:
case
CONTEXT:
//暂未实现
break
;
break
;
case
PARAM:
case
PARAM:
String
paramField
=
fieldAnnotation
.
defaultValue
();
if
(!
StringUtils
.
isEmpty
(
paramField
)){
Object
paramFieldValue
=
beanMap
.
get
(
paramField
);
if
(!
ObjectUtils
.
isEmpty
(
paramFieldValue
)){
beanMap
.
put
(
fileName
,
paramFieldValue
);
}
}
break
;
break
;
case
OPERATOR:
case
OPERATOR:
beanMap
.
put
(
fileName
,
curUser
.
getUserid
());
break
;
break
;
case
OPERATORNAME:
case
OPERATORNAME:
beanMap
.
put
(
fileName
,
curUser
.
getPersonname
());
break
;
break
;
case
CURTIME:
case
CURTIME:
beanMap
.
put
(
fileName
,
new
Timestamp
(
new
Date
().
getTime
()));
break
;
break
;
case
APPDATA:
case
APPDATA:
//暂未实现
break
;
break
;
case
NONE:
case
NONE:
//对字段值进行类型转换
Object
deFieldDefaultValueObj
=
fieldValueConvert
(
deFieldDefaultValue
,
field
);
Object
deFieldDefaultValueObj
=
fieldValueConvert
(
deFieldDefaultValue
,
field
);
fieldSetMethod
.
invoke
(
et
,
deFieldDefaultValueObj
);
beanMap
.
put
(
fileName
,
deFieldDefaultValueObj
);
break
;
break
;
}
}
}
}
...
@@ -243,14 +268,15 @@ public class DEFieldDefaultValueAspect
...
@@ -243,14 +268,15 @@ public class DEFieldDefaultValueAspect
*/
*/
private
void
fillPreFieldValue
(
String
fileName
,
DEPredefinedFieldType
preFieldType
,
Object
et
,
JoinPoint
joinPoint
,
DEField
fieldAnnotation
)
throws
Exception
{
private
void
fillPreFieldValue
(
String
fileName
,
DEPredefinedFieldType
preFieldType
,
Object
et
,
JoinPoint
joinPoint
,
DEField
fieldAnnotation
)
throws
Exception
{
AuthenticationUser
curUser
=
AuthenticationUser
.
getAuthenticationUser
();
BeanMap
beanMap
=
BeanMap
.
create
(
et
);
//当前操作行为
//当前操作行为
String
actionName
=
joinPoint
.
getSignature
().
getName
();
String
actionName
=
joinPoint
.
getSignature
().
getName
();
Object
fieldValue
=
beanMap
.
get
(
fileName
);
//获取当前所需填充属性的get、set方法及字段值
//获取当前所需填充属性的get、set方法及字段值
PropertyDescriptor
field
=
new
PropertyDescriptor
(
fileName
,
et
.
getClass
());
PropertyDescriptor
field
=
new
PropertyDescriptor
(
fileName
,
et
.
getClass
());
Method
fieldSetMethod
=
field
.
getWriteMethod
();
Method
fieldGetMethod
=
field
.
getReadMethod
();
Object
fieldValue
=
fieldGetMethod
.
invoke
(
et
);
//为预置属性进行赋值
//为预置属性进行赋值
if
(
(
actionName
.
equalsIgnoreCase
(
"create"
)
&&
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
fieldValue
)
)||
if
(
(
actionName
.
equalsIgnoreCase
(
"create"
)
&&
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
fieldValue
)
)||
...
@@ -259,31 +285,40 @@ public class DEFieldDefaultValueAspect
...
@@ -259,31 +285,40 @@ public class DEFieldDefaultValueAspect
switch
(
preFieldType
){
//根据注解给预置属性填充值
switch
(
preFieldType
){
//根据注解给预置属性填充值
case
CREATEMAN:
case
CREATEMAN:
beanMap
.
put
(
fileName
,
curUser
.
getUserid
());
break
;
break
;
case
CREATEMANNAME:
case
CREATEMANNAME:
beanMap
.
put
(
fileName
,
curUser
.
getPersonname
());
break
;
break
;
case
UPDATEMAN:
case
UPDATEMAN:
beanMap
.
put
(
fileName
,
curUser
.
getUserid
());
break
;
break
;
case
UPDATEMANNAME:
case
UPDATEMANNAME:
beanMap
.
put
(
fileName
,
curUser
.
getPersonname
());
break
;
break
;
case
CREATEDATE:
case
CREATEDATE:
fieldSetMethod
.
invoke
(
et
,
new
Timestamp
(
new
Date
().
getTime
()));
beanMap
.
put
(
fileName
,
new
Timestamp
(
new
Date
().
getTime
()));
break
;
break
;
case
UPDATEDATE:
case
UPDATEDATE:
fieldSetMethod
.
invoke
(
et
,
new
Timestamp
(
new
Date
().
getTime
()));
beanMap
.
put
(
fileName
,
new
Timestamp
(
new
Date
().
getTime
()));
break
;
case
ORGID:
case
ORGID:
beanMap
.
put
(
fileName
,
curUser
.
getOrgid
());
break
;
break
;
case
ORGNAME:
case
ORGNAME:
beanMap
.
put
(
fileName
,
curUser
.
getOrgname
());
break
;
break
;
case
ORGSECTORID:
case
ORGSECTORID:
beanMap
.
put
(
fileName
,
curUser
.
getMdeptid
());
break
;
break
;
case
ORGSECTORNAME:
case
ORGSECTORNAME:
beanMap
.
put
(
fileName
,
curUser
.
getMdeptname
());
break
;
break
;
case
LOGICVALID:
case
LOGICVALID:
String
logicValue
=
fieldAnnotation
.
logicval
();
String
logicValue
=
fieldAnnotation
.
logicval
();
Object
objLogicValue
=
fieldValueConvert
(
logicValue
,
field
);
Object
objLogicValue
=
fieldValueConvert
(
logicValue
,
field
);
if
(!
StringUtils
.
isEmpty
(
l
ogicValue
)){
if
(!
StringUtils
.
isEmpty
(
objL
ogicValue
)){
fieldSetMethod
.
invoke
(
et
,
objLogicValue
);
beanMap
.
put
(
fileName
,
objLogicValue
);
}
}
break
;
break
;
}
}
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/domain/IBZUSER.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
domain
;
import
java.sql.Timestamp
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Data
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
/**
* 实体[IBZUSER] 数据对象
*/
@TableName
(
value
=
"IBZUSER"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@Data
public
class
IBZUSER
implements
Serializable
{
@Size
(
min
=
0
,
max
=
100
,
message
=
"[用户标识]长度必须在[100]以内!"
)
@TableId
(
value
=
"userid"
,
type
=
IdType
.
INPUT
)
//指定主键生成策略
private
String
userid
;
@Size
(
min
=
0
,
max
=
200
,
message
=
"[用户全局名]长度必须在[200]以内!"
)
private
String
username
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[用户姓名]长度必须在[100]以内!"
)
private
String
personname
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[用户代码]长度必须在[100]以内!"
)
private
String
usercode
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[登录别名]长度必须在[100]以内!"
)
private
String
loginname
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[登录密码]长度必须在[100]以内!"
)
private
String
password
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[区属]长度必须在[100]以内!"
)
private
String
domains
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[主部门id]长度必须在[100]以内!"
)
private
String
mdeptid
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[主部门代码]长度必须在[100]以内!"
)
private
String
mdeptcode
;
@Size
(
min
=
0
,
max
=
200
,
message
=
"[主部门名称]长度必须在[200]以内!"
)
private
String
mdeptname
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[业务编码]长度必须在[100]以内!"
)
private
String
bcode
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[岗位id]长度必须在[100]以内!"
)
private
String
postid
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[岗位代码]长度必须在[100]以内!"
)
private
String
postcode
;
@Size
(
min
=
0
,
max
=
200
,
message
=
"[岗位名称]长度必须在[200]以内!"
)
private
String
postname
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[单位id]长度必须在[100]以内!"
)
private
String
orgid
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[单位代码]长度必须在[100]以内!"
)
private
String
orgcode
;
@Size
(
min
=
0
,
max
=
200
,
message
=
"[单位名称]长度必须在[200]以内!"
)
private
String
orgname
;
@Size
(
min
=
0
,
max
=
36
,
message
=
"[昵称]长度必须在[36]以内!"
)
private
String
nickname
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[邮箱]长度必须在[100]以内!"
)
private
String
email
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[通信账号]长度必须在[100]以内!"
)
private
String
avatar
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[联系电话]长度必须在[100]以内!"
)
private
String
phone
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[保留字段]长度必须在[100]以内!"
)
private
String
reserver
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[头像]长度必须在[100]以内!"
)
private
String
usericon
;
@Size
(
min
=
0
,
max
=
10
,
message
=
"[性别]长度必须在[10]以内!"
)
private
String
sex
;
private
Timestamp
birthday
;
@Size
(
min
=
0
,
max
=
36
,
message
=
"[证件号码]长度必须在[36]以内!"
)
private
String
certcode
;
@Size
(
min
=
0
,
max
=
200
,
message
=
"[地址]长度必须在[200]以内!"
)
private
String
addr
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[主题]长度必须在[100]以内!"
)
private
String
theme
;
@Size
(
min
=
0
,
max
=
100
,
message
=
"[语言]长度必须在[100]以内!"
)
private
String
lang
;
@Size
(
min
=
0
,
max
=
10
,
message
=
"[字号]长度必须在[10]以内!"
)
private
String
fontsize
;
@Size
(
min
=
0
,
max
=
500
,
message
=
"[备注]长度必须在[500]以内!"
)
private
String
memo
;
}
\ No newline at end of file
ibzdict-util/src/main/java/cn/ibizlab/util/filter/SearchContextBase.java
浏览文件 @
4ff52e21
...
@@ -2,7 +2,6 @@ package cn.ibizlab.util.filter;
...
@@ -2,7 +2,6 @@ package cn.ibizlab.util.filter;
import
com.fasterxml.jackson.annotation.JsonAnyGetter
;
import
com.fasterxml.jackson.annotation.JsonAnyGetter
;
import
com.fasterxml.jackson.annotation.JsonAnySetter
;
import
com.fasterxml.jackson.annotation.JsonAnySetter
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -10,6 +9,7 @@ import org.springframework.data.domain.PageRequest;
...
@@ -10,6 +9,7 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -59,8 +59,10 @@ public class SearchContextBase implements ISearchContext{
...
@@ -59,8 +59,10 @@ public class SearchContextBase implements ISearchContext{
* @return
* @return
*/
*/
public
Pageable
getPageable
()
{
public
Pageable
getPageable
()
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
,
pageSort
);
if
(
ObjectUtils
.
isEmpty
(
pageSort
))
return
pageable
;
return
PageRequest
.
of
(
page
,
size
);
else
return
PageRequest
.
of
(
page
,
size
,
pageSort
);
}
}
/**
/**
...
...
ibzdict-util/src/main/java/cn/ibizlab/util/mapper/IBZUSERMapper.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.ibizlab.util.domain.IBZUSER
;
public
interface
IBZUSERMapper
extends
BaseMapper
<
IBZUSER
>{
}
\ No newline at end of file
ibzdict-util/src/main/java/cn/ibizlab/util/security/AuthTokenUtil.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
security
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Clock
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
io.jsonwebtoken.impl.DefaultClock
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.stereotype.Component
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.function.Function
;
@Component
public
class
AuthTokenUtil
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3301605591108950415L
;
private
Clock
clock
=
DefaultClock
.
INSTANCE
;
@Value
(
"${ibiz.jwt.secret:ibzsecret}"
)
private
String
secret
;
@Value
(
"${ibiz.jwt.expiration:7200000}"
)
private
Long
expiration
;
@Value
(
"${ibiz.jwt.header:Authorization}"
)
private
String
tokenHeader
;
public
String
getUsernameFromToken
(
String
token
)
{
return
getClaimFromToken
(
token
,
Claims:
:
getSubject
);
}
public
Date
getIssuedAtDateFromToken
(
String
token
)
{
return
getClaimFromToken
(
token
,
Claims:
:
getIssuedAt
);
}
public
Date
getExpirationDateFromToken
(
String
token
)
{
return
getClaimFromToken
(
token
,
Claims:
:
getExpiration
);
}
public
<
T
>
T
getClaimFromToken
(
String
token
,
Function
<
Claims
,
T
>
claimsResolver
)
{
final
Claims
claims
=
getAllClaimsFromToken
(
token
);
return
claimsResolver
.
apply
(
claims
);
}
private
Claims
getAllClaimsFromToken
(
String
token
)
{
return
Jwts
.
parser
()
.
setSigningKey
(
secret
)
.
parseClaimsJws
(
token
)
.
getBody
();
}
private
Boolean
isTokenExpired
(
String
token
)
{
final
Date
expiration
=
getExpirationDateFromToken
(
token
);
return
expiration
.
before
(
clock
.
now
());
}
private
Boolean
isCreatedBeforeLastPasswordReset
(
Date
created
,
Date
lastPasswordReset
)
{
return
(
lastPasswordReset
!=
null
&&
created
.
before
(
lastPasswordReset
));
}
private
Boolean
ignoreTokenExpiration
(
String
token
)
{
// here you specify tokens, for that the expiration is ignored
return
false
;
}
public
String
generateToken
(
UserDetails
userDetails
)
{
Map
<
String
,
Object
>
claims
=
new
HashMap
<>();
return
doGenerateToken
(
claims
,
userDetails
.
getUsername
());
}
private
String
doGenerateToken
(
Map
<
String
,
Object
>
claims
,
String
subject
)
{
final
Date
createdDate
=
clock
.
now
();
final
Date
expirationDate
=
calculateExpirationDate
(
createdDate
);
return
Jwts
.
builder
()
.
setClaims
(
claims
)
.
setSubject
(
subject
)
.
setIssuedAt
(
createdDate
)
.
setExpiration
(
expirationDate
)
.
signWith
(
SignatureAlgorithm
.
HS512
,
secret
)
.
compact
();
}
public
Boolean
canTokenBeRefreshed
(
String
token
,
Date
lastPasswordReset
)
{
final
Date
created
=
getIssuedAtDateFromToken
(
token
);
return
!
isCreatedBeforeLastPasswordReset
(
created
,
lastPasswordReset
)
&&
(!
isTokenExpired
(
token
)
||
ignoreTokenExpiration
(
token
));
}
public
String
refreshToken
(
String
token
)
{
final
Date
createdDate
=
clock
.
now
();
final
Date
expirationDate
=
calculateExpirationDate
(
createdDate
);
final
Claims
claims
=
getAllClaimsFromToken
(
token
);
claims
.
setIssuedAt
(
createdDate
);
claims
.
setExpiration
(
expirationDate
);
return
Jwts
.
builder
()
.
setClaims
(
claims
)
.
signWith
(
SignatureAlgorithm
.
HS512
,
secret
)
.
compact
();
}
public
Boolean
validateToken
(
String
token
,
UserDetails
userDetails
)
{
AuthenticationUser
user
=
(
AuthenticationUser
)
userDetails
;
final
Date
created
=
getIssuedAtDateFromToken
(
token
);
return
(!
isTokenExpired
(
token
)
);
}
private
Date
calculateExpirationDate
(
Date
createdDate
)
{
return
new
Date
(
createdDate
.
getTime
()
+
expiration
);
}
/**
* Get the login of the current user.
*
* @return the login of the current user
*/
public
static
Optional
<
String
>
getCurrentUserLogin
()
{
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
return
Optional
.
ofNullable
(
securityContext
.
getAuthentication
())
.
map
(
authentication
->
{
if
(
authentication
.
getPrincipal
()
instanceof
UserDetails
)
{
UserDetails
springSecurityUser
=
(
UserDetails
)
authentication
.
getPrincipal
();
return
springSecurityUser
.
getUsername
();
}
else
if
(
authentication
.
getPrincipal
()
instanceof
String
)
{
return
(
String
)
authentication
.
getPrincipal
();
}
return
null
;
});
}
/**
* Check if a user is authenticated.
*
* @return true if the user is authenticated, false otherwise
*/
public
static
boolean
isAuthenticated
()
{
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
return
Optional
.
ofNullable
(
securityContext
.
getAuthentication
())
.
map
(
authentication
->
authentication
.
getAuthorities
().
stream
()
.
noneMatch
(
grantedAuthority
->
grantedAuthority
.
getAuthority
().
equals
(
"ANONYMOUS"
)))
.
orElse
(
false
);
}
/**
* If the current user has a specific authority (security role).
* <p>
* The name of this method comes from the isUserInRole() method in the Servlet API
*
* @param authority the authority to check
* @return true if the current user has the authority, false otherwise
*/
public
static
boolean
isCurrentUserInRole
(
String
authority
)
{
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
return
Optional
.
ofNullable
(
securityContext
.
getAuthentication
())
.
map
(
authentication
->
authentication
.
getAuthorities
().
stream
()
.
anyMatch
(
grantedAuthority
->
grantedAuthority
.
getAuthority
().
equals
(
authority
)))
.
orElse
(
false
);
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/security/AuthenticationEntryPoint.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
security
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.Serializable
;
@Component
public
class
AuthenticationEntryPoint
implements
org
.
springframework
.
security
.
web
.
AuthenticationEntryPoint
,
Serializable
{
private
static
final
long
serialVersionUID
=
-
8970718410437077606L
;
@Override
public
void
commence
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AuthenticationException
authException
)
throws
IOException
{
/**
* 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应
*/
response
.
sendError
(
HttpServletResponse
.
SC_UNAUTHORIZED
,
authException
==
null
?
"Unauthorized"
:
authException
.
getMessage
());
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/security/AuthorizationTokenFilter.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
security
;
import
io.jsonwebtoken.ExpiredJwtException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.web.authentication.WebAuthenticationDetailsSource
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.filter.OncePerRequestFilter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
@Slf4j
@Component
public
class
AuthorizationTokenFilter
extends
OncePerRequestFilter
{
private
final
UserDetailsService
userDetailsService
;
private
final
AuthTokenUtil
authTokenUtil
;
private
final
String
tokenHeader
;
public
AuthorizationTokenFilter
(
@Qualifier
(
"AuthenticationUserService"
)
UserDetailsService
userDetailsService
,
AuthTokenUtil
authTokenUtil
,
@Value
(
"${ibiz.jwt.header:Authorization}"
)
String
tokenHeader
)
{
this
.
userDetailsService
=
userDetailsService
;
this
.
authTokenUtil
=
authTokenUtil
;
this
.
tokenHeader
=
tokenHeader
;
}
@Override
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
ServletException
,
IOException
{
final
String
requestHeader
=
request
.
getHeader
(
this
.
tokenHeader
);
String
username
=
null
;
String
authToken
=
null
;
if
(
requestHeader
!=
null
&&
requestHeader
.
startsWith
(
"Bearer "
))
{
authToken
=
requestHeader
.
substring
(
7
);
try
{
username
=
authTokenUtil
.
getUsernameFromToken
(
authToken
);
}
catch
(
ExpiredJwtException
e
)
{
log
.
error
(
e
.
getMessage
());
}
}
if
(
username
!=
null
&&
SecurityContextHolder
.
getContext
().
getAuthentication
()
==
null
)
{
// It is not compelling necessary to load the use details from the database. You could also store the information
// in the token and read it from it. It's up to you ;)
UserDetails
userDetails
=
this
.
userDetailsService
.
loadUserByUsername
(
username
);
// For simple validation it is completely sufficient to just check the token integrity. You don't have to call
// the database compellingly. Again it's up to you ;)
if
(
authTokenUtil
.
validateToken
(
authToken
,
userDetails
))
{
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
authentication
.
setDetails
(
new
WebAuthenticationDetailsSource
().
buildDetails
(
request
));
log
.
info
(
"authorizated user '{}', setting security context"
,
username
);
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
}
}
chain
.
doFilter
(
request
,
response
);
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/service/AuthenticationUserService.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.stereotype.Service
;
@Service
(
"AuthenticationUserService"
)
public
class
AuthenticationUserService
implements
UserDetailsService
{
@Autowired
private
IBZUSERService
userService
;
@Override
public
UserDetails
loadUserByUsername
(
String
username
){
return
userService
.
getByUsername
(
username
);
}
}
ibzdict-util/src/main/java/cn/ibizlab/util/service/IBZUSERService.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
service
;
import
javax.annotation.Resource
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
cn.ibizlab.util.mapper.IBZUSERMapper
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
org.springframework.util.StringUtils
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
public
interface
IBZUSERService
extends
IService
<
IBZUSER
>
{
@Cacheable
(
value
=
"ibzdict_users"
,
key
=
"'getByUsername:'+#p0"
)
AuthenticationUser
getByUsername
(
String
username
);
@CacheEvict
(
value
=
"ibzdict_users"
,
key
=
"'getByUsername:'+#p0"
)
void
resetByUsername
(
String
username
);
AuthenticationUser
createUserDetails
(
IBZUSER
user
);
}
\ No newline at end of file
ibzdict-util/src/main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
0 → 100644
浏览文件 @
4ff52e21
package
cn
.
ibizlab
.
util
.
service
;
import
javax.annotation.Resource
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
cn.ibizlab.util.mapper.IBZUSERMapper
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
org.springframework.util.StringUtils
;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Service
public
class
IBZUSERServiceImpl
extends
ServiceImpl
<
IBZUSERMapper
,
IBZUSER
>
implements
IBZUSERService
{
@Resource
private
IBZUSERMapper
ibzuserMapper
;
public
AuthenticationUser
getByUsername
(
String
username
){
if
(
StringUtils
.
isEmpty
(
username
))
throw
new
UsernameNotFoundException
(
"用户名为空"
);
QueryWrapper
<
IBZUSER
>
conds
=
new
QueryWrapper
<
IBZUSER
>();
String
[]
data
=
username
.
split
(
"[|]"
);
String
loginname
=
""
;
String
domains
=
""
;
if
(
data
.
length
>
0
)
loginname
=
data
[
0
].
trim
();
if
(
data
.
length
>
1
)
domains
=
data
[
1
].
trim
();
if
(!
StringUtils
.
isEmpty
(
loginname
))
conds
.
eq
(
"loginname"
,
loginname
);
if
(!
StringUtils
.
isEmpty
(
domains
))
conds
.
eq
(
"domains"
,
domains
);
IBZUSER
user
=
this
.
getOne
(
conds
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"用户"
+
username
+
"未找到"
);
}
else
{
user
.
setUsername
(
username
);
return
createUserDetails
(
user
);
}
}
public
void
resetByUsername
(
String
username
)
{
}
public
AuthenticationUser
createUserDetails
(
IBZUSER
user
)
{
AuthenticationUser
userdatail
=
new
AuthenticationUser
();
BeanCopier
copier
=
BeanCopier
.
create
(
IBZUSER
.
class
,
AuthenticationUser
.
class
,
false
);
copier
.
copy
(
user
,
userdatail
,
null
);
return
userdatail
;
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录