Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
e96ca706
提交
e96ca706
编写于
1月 05, 2022
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新core内容
上级
299622d4
变更
11
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
142 行增加
和
131 行删除
+142
-131
index.ts
...es/templ/r7/app_{{apps}}/src/core/modules/common/index.ts
+1
-120
ui-base.ts
.../templ/r7/app_{{apps}}/src/core/modules/common/ui-base.ts
+95
-0
editor-base.ts
...pl/r7/app_{{apps}}/src/core/modules/editor/editor-base.ts
+2
-2
view-base.ts
...pp_{{apps}}/src/core/modules/views/view-base/view-base.ts
+3
-3
control-base.ts
...s}}/src/core/modules/widgets/control-base/control-base.ts
+3
-3
entity-service.ts
...{apps}}/src/core/service/entity-service/entity-service.ts
+0
-0
index.ts
.../r7/app_{{apps}}/src/core/service/entity-service/index.ts
+1
-0
index.ts
...es/templ/r7/app_{{apps}}/src/core/service/entity/index.ts
+0
-1
index.ts
...resources/templ/r7/app_{{apps}}/src/core/service/index.ts
+2
-2
index.ts
...empl/r7/app_{{apps}}/src/core/service/ui-service/index.ts
+1
-0
ui-util.ts
...ources/templ/r7/app_{{apps}}/src/core/utils/ui/ui-util.ts
+34
-0
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/common/index.ts
浏览文件 @
e96ca706
import
{
IContext
,
IParam
}
from
'@core'
;
import
{
Ref
}
from
'vue'
;
import
{
deepCopy
}
from
'../../utils'
;
export
*
from
'./ui-base'
;
/**
* 为源响应式对象上的某个属性新创建一个单向的Ref,类似于vue的toRef但区别在于,修改返回的Ref,不会影响源响应对象的该属性。而源响应对象上的属性值变化会响应式影响到返回的Ref
*
* @param object 源响应对象,可以是ref对象,也可以是reactive对象
* @param key 响应对象上的属性的key值
*
* ```ts
* const object = ref({foo: 1});
* // 或者 const object = reactive({foo: 1})
* const foo = toOneWayRef(object, 'foo');
* foo.value = 2;
* console.log(object.foo) // 1
* console.log(foo.value) // 2
* object.foo = 3
* console.log(object.foo) // 3
* console.log(foo.value) // 3
* ```
* ps:如果要维持props的父对于props修改的响应性,props必须是Ref
* ```ts
* const father = reactive({ props: { foo: 1 }})
* const props = toRef(father,'props');
* const foo = toOneWayRef(props, 'foo');
* const foo1 = toOneWayRef(props.value,'foo')
* father.props = {foo: 3}
* console.log(father.props.foo) // 3
* console.log(foo.value) // 3
* console.log(foo1.value) // 1
* ```
*
*/
export
function
toOneWayRef
<
T
extends
object
,
K
extends
keyof
T
>
(
object
:
Ref
<
T
>
|
T
,
key
:
K
):
Ref
<
T
[
K
]
>
{
// 创建空的Ref
const
propertyRef
:
Ref
<
T
[
K
]
>
=
ref
({})
as
any
;
// 用watch来监听源响应对象的key属性,并建立单向响应
watch
(
()
=>
isRef
(
object
)
?
(
object
.
value
as
T
)[
key
]
:
object
[
key
],
(
newVal
:
any
,
oldVal
:
any
)
=>
{
// 用immediate来初始化最初的值,用deepCopy来切断与源值的关联
propertyRef
.
value
=
deepCopy
(
newVal
)
as
T
[
K
];
},
{
immediate
:
true
,
deep
:
true
,
},
);
return
propertyRef
;
}
/**
* @description 使用上下文参数逻辑块
* @export
* @param {Record<any, any>} props
*/
export
function
useContextParams
(
props
:
Record
<
any
,
any
>
)
{
const
{
contextProp
,
viewParamsProp
}
=
toRefs
(
props
);
// 维护上下文并监控其变化
const
context
:
Ref
<
IContext
>
=
ref
({});
watch
(
contextProp
,
(
newVal
:
any
,
oldVal
:
any
)
=>
{
context
.
value
=
deepCopy
(
newVal
||
{});
},
{
immediate
:
true
,
deep
:
true
,
}
);
// 维护视图参数并监控其变化
const
viewParams
:
Ref
<
IParam
>
=
ref
({});
watch
(
viewParamsProp
,
(
newVal
:
any
,
oldVal
:
any
)
=>
{
viewParams
.
value
=
deepCopy
(
newVal
||
{});
},
{
immediate
:
true
,
deep
:
true
,
}
);
return
{
context
,
viewParams
};
}
/**
* @description 值规则校验
* @export
* @param {Record<any, any>} props
*/
export
async
function
verifyRules
(
_rule
:
any
,
value
:
any
,
condition
:
any
)
{
//常规规则
if
(
Object
.
is
(
condition
.
Type
,
'SIMPLE'
))
{
//todo
// 数值范围
}
else
if
(
Object
.
is
(
condition
.
Type
,
'VALUERANGE2'
))
{
if
(
!
value
)
{
return
;
}
if
(
!
Number
.
isInteger
(
value
))
{
return
Promise
.
reject
(
'请输入数值!'
);
}
else
{
if
(
condition
.
includeMinValue
&&
Object
.
is
(
value
,
condition
.
minValue
))
{
return
Promise
.
resolve
();
}
else
if
(
condition
.
includeMaxValue
&&
Object
.
is
(
value
,
condition
.
maxValue
))
{
return
Promise
.
resolve
();
}
else
if
(
value
>
condition
.
minValue
&&
value
<
condition
.
maxValue
)
{
return
Promise
.
resolve
();
}
}
// 正则式
}
else
if
(
Object
.
is
(
condition
.
Type
,
'REGEX'
))
{
// 长度
}
else
if
(
Object
.
is
(
condition
.
Type
,
'STRINGLENGTH'
))
{
// 系统值规则
}
else
if
(
Object
.
is
(
condition
.
Type
,
'SYSVALUERULE'
))
{
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/common/ui-base.ts
0 → 100644
浏览文件 @
e96ca706
import
{
Ref
}
from
'vue'
;
import
{
IContext
,
IParam
}
from
'@core'
;
import
{
deepCopy
}
from
'../../utils'
;
/**
* @description 界面基类
* @export
* @class UIBase
*/
export
class
UIBase
{
/**
* 为源响应式对象上的某个属性新创建一个单向的Ref,类似于vue的toRef但区别在于,修改返回的Ref,不会影响源响应对象的该属性。而源响应对象上的属性值变化会响应式影响到返回的Ref
*
* @param object 源响应对象,可以是ref对象,也可以是reactive对象
* @param key 响应对象上的属性的key值
*
* ```ts
* const object = ref({foo: 1});
* // 或者 const object = reactive({foo: 1})
* const foo = toOneWayRef(object, 'foo');
* foo.value = 2;
* console.log(object.foo) // 1
* console.log(foo.value) // 2
* object.foo = 3
* console.log(object.foo) // 3
* console.log(foo.value) // 3
* ```
* ps:如果要维持props的父对于props修改的响应性,props必须是Ref
* ```ts
* const father = reactive({ props: { foo: 1 }})
* const props = toRef(father,'props');
* const foo = toOneWayRef(props, 'foo');
* const foo1 = toOneWayRef(props.value,'foo')
* father.props = {foo: 3}
* console.log(father.props.foo) // 3
* console.log(foo.value) // 3
* console.log(foo1.value) // 1
* ```
*
*/
public
static
toOneWayRef
<
T
extends
object
,
K
extends
keyof
T
>
(
object
:
Ref
<
T
>
|
T
,
key
:
K
):
Ref
<
T
[
K
]
>
{
// 创建空的Ref
const
propertyRef
:
Ref
<
T
[
K
]
>
=
ref
({})
as
any
;
// 用watch来监听源响应对象的key属性,并建立单向响应
watch
(
()
=>
isRef
(
object
)
?
(
object
.
value
as
T
)[
key
]
:
object
[
key
],
(
newVal
:
any
,
oldVal
:
any
)
=>
{
// 用immediate来初始化最初的值,用deepCopy来切断与源值的关联
propertyRef
.
value
=
deepCopy
(
newVal
)
as
T
[
K
];
},
{
immediate
:
true
,
deep
:
true
,
},
);
return
propertyRef
;
}
/**
* @description 使用上下文参数逻辑块
* @export
* @param {Record<any, any>} props
*/
public
static
useContextParams
(
props
:
Record
<
any
,
any
>
)
{
const
{
contextProp
,
viewParamsProp
}
=
toRefs
(
props
);
// 维护上下文并监控其变化
const
context
:
Ref
<
IContext
>
=
ref
({});
watch
(
contextProp
,
(
newVal
:
any
,
oldVal
:
any
)
=>
{
context
.
value
=
deepCopy
(
newVal
||
{});
},
{
immediate
:
true
,
deep
:
true
,
}
);
// 维护视图参数并监控其变化
const
viewParams
:
Ref
<
IParam
>
=
ref
({});
watch
(
viewParamsProp
,
(
newVal
:
any
,
oldVal
:
any
)
=>
{
viewParams
.
value
=
deepCopy
(
newVal
||
{});
},
{
immediate
:
true
,
deep
:
true
,
}
);
return
{
context
,
viewParams
};
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/editor/editor-base.ts
浏览文件 @
e96ca706
import
{
toRefs
}
from
'vue'
;
import
{
UIUtil
,
IParam
,
useContextParams
}
from
'@core'
;
import
{
UIUtil
,
IParam
,
UIBase
}
from
'@core'
;
/**
* @description 部件基类
* @export
...
...
@@ -15,7 +15,7 @@ export class EditorBase {
*/
public
handleEditorNavParams
(
props
:
Record
<
string
,
any
>
)
{
const
{
localContext
,
localParam
,
data
}
=
toRefs
(
props
);
const
{
context
,
viewParams
}
=
useContextParams
(
props
);
const
{
context
,
viewParams
}
=
UIBase
.
useContextParams
(
props
);
const
navParams
=
{
navContext
:
context
.
value
,
navViewParam
:
viewParams
.
value
,
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/view-base/view-base.ts
浏览文件 @
e96ca706
import
{
Ref
}
from
'vue'
;
import
{
useRoute
}
from
'vue-router'
;
import
{
ViewPropsBase
,
ViewStateBase
,
toOneWayRef
,
IParam
}
from
'@core'
;
import
{
ViewPropsBase
,
ViewStateBase
,
UIBase
,
IParam
}
from
'@core'
;
/**
* @description 视图基类
...
...
@@ -74,8 +74,8 @@ export class ViewBase {
* @memberof ViewBase
*/
public
useViewContextParams
(
props
:
ViewPropsBase
)
{
const
context
=
toOneWayRef
(
props
,
'context'
);
const
viewParams
=
toOneWayRef
(
props
,
'viewParams'
);
const
context
=
UIBase
.
toOneWayRef
(
props
,
'context'
);
const
viewParams
=
UIBase
.
toOneWayRef
(
props
,
'viewParams'
);
// 导航视图参数处理
this
.
handleViewContextParams
(
props
,
context
,
viewParams
);
watch
(
context
,
(
newVal
:
any
,
oldVal
:
any
)
=>
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/control-base/control-base.ts
浏览文件 @
e96ca706
import
{
ControlPropsBase
,
ControlStateBase
,
toOneWayRef
}
from
'@core'
;
import
{
ControlPropsBase
,
ControlStateBase
,
UIBase
}
from
'@core'
;
import
{
RouteLocationNormalizedLoaded
,
Router
,
useRoute
,
useRouter
}
from
'vue-router'
;
/**
...
...
@@ -64,8 +64,8 @@ export class ControlBase {
* @memberof ControlBase
*/
public
useControlContextParams
(
props
:
ControlPropsBase
)
{
const
context
=
toOneWayRef
(
props
,
'context'
);
const
viewParams
=
toOneWayRef
(
props
,
'viewParams'
);
const
context
=
UIBase
.
toOneWayRef
(
props
,
'context'
);
const
viewParams
=
UIBase
.
toOneWayRef
(
props
,
'viewParams'
);
// 把Ref赋值到State上进行解包
this
.
controlState
.
context
=
context
;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity/entity-service.ts
→
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity
-service
/entity-service.ts
浏览文件 @
e96ca706
文件已移动
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity-service/index.ts
0 → 100644
浏览文件 @
e96ca706
export
{
EntityService
}
from
'./entity-service'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity/index.ts
已删除
100644 → 0
浏览文件 @
299622d4
export
*
from
'./entity-service'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/index.ts
浏览文件 @
e96ca706
export
*
from
'./control-service'
export
*
from
'./entity'
export
*
from
'./ui-service/ui-service-base'
\ No newline at end of file
export
*
from
'./entity-service'
export
*
from
'./ui-service'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/ui-service/index.ts
0 → 100644
浏览文件 @
e96ca706
export
{
UIServiceBase
}
from
'./ui-service-base'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/ui-util.ts
浏览文件 @
e96ca706
...
...
@@ -93,4 +93,38 @@ export class UIUtil {
}
return
_data
;
}
/**
* @description 值规则校验
* @export
* @param {Record<any, any>} props
*/
public
static
async
verifyRules
(
_rule
:
any
,
value
:
any
,
condition
:
any
)
{
//常规规则
if
(
Object
.
is
(
condition
.
Type
,
'SIMPLE'
))
{
//todo
// 数值范围
}
else
if
(
Object
.
is
(
condition
.
Type
,
'VALUERANGE2'
))
{
if
(
!
value
)
{
return
;
}
if
(
!
Number
.
isInteger
(
value
))
{
return
Promise
.
reject
(
'请输入数值!'
);
}
else
{
if
(
condition
.
includeMinValue
&&
Object
.
is
(
value
,
condition
.
minValue
))
{
return
Promise
.
resolve
();
}
else
if
(
condition
.
includeMaxValue
&&
Object
.
is
(
value
,
condition
.
maxValue
))
{
return
Promise
.
resolve
();
}
else
if
(
value
>
condition
.
minValue
&&
value
<
condition
.
maxValue
)
{
return
Promise
.
resolve
();
}
}
// 正则式
}
else
if
(
Object
.
is
(
condition
.
Type
,
'REGEX'
))
{
// 长度
}
else
if
(
Object
.
is
(
condition
.
Type
,
'STRINGLENGTH'
))
{
// 系统值规则
}
else
if
(
Object
.
is
(
condition
.
Type
,
'SYSVALUERULE'
))
{
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录