Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
VUE_R7_RES_iBizEAM
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBizEAM解决方案
VUE_R7_RES_iBizEAM
提交
91231104
提交
91231104
编写于
4月 28, 2020
作者:
chenxiang@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20200428
上级
dc874fdc
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
325 行增加
和
5 行删除
+325
-5
app-register.ts
src/app-register.ts
+2
-0
app-format-data.vue
src/components/app-format-data/app-format-data.vue
+40
-1
codelist.vue
src/components/codelist/codelist.vue
+1
-1
context-menu.less
src/components/context-menu/context-menu.less
+52
-0
context-menu.tsx
src/components/context-menu/context-menu.tsx
+226
-0
ViewBase.ts
src/crm-core/core/view/ViewBase.ts
+2
-2
index.ts
src/crm-core/index.ts
+1
-0
chart-series.ts
src/model/chart-detail/chart-series.ts
+1
-1
未找到文件。
src/app-register.ts
浏览文件 @
91231104
...
...
@@ -68,6 +68,7 @@ import DropDownListDynamic from './components/dropdown-list-dynamic/dropdown-lis
import
AppImagePreview
from
'./components/app-image-preview/app-image-preview.vue'
import
AppFormatData
from
'./components/app-format-data/app-format-data.vue'
import
AppUploadFileInfo
from
'./components/app-upload-file-info/app-upload-file-info.vue'
import
ContextMenu
from
'./components/context-menu/context-menu'
// 全局挂载UI实体服务注册中心
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
...
...
@@ -145,5 +146,6 @@ export const AppComponents = {
v
.
component
(
'app-image-preview'
,
AppImagePreview
);
v
.
component
(
'app-format-data'
,
AppFormatData
);
v
.
component
(
'app-upload-file-info'
,
AppUploadFileInfo
);
v
.
component
(
'context-menu'
,
ContextMenu
);
},
};
\ No newline at end of file
src/components/app-format-data/app-format-data.vue
浏览文件 @
91231104
...
...
@@ -17,6 +17,22 @@ export default class AppFormatData extends Vue {
*/
@
Prop
({
default
:
'YYYY-MM-DD HH:mm:ss'
})
public
format
?:
string
;
/**
* 类型格式
*
* @type {string}
* @memberof AppFormatData
*/
@
Prop
()
public
dataType
?:
string
;
/**
* 精度
*
* @type {string}
* @memberof AppFormatData
*/
@
Prop
({
default
:
'2'
})
public
precision
?:
string
;
/**
* 传入数据
*
...
...
@@ -32,7 +48,30 @@ export default class AppFormatData extends Vue {
*/
getcurValue
(){
if
(
this
.
data
){
if
(
this
.
format
){
if
(
Object
.
is
(
this
.
dataType
,
"DECIMAL"
)
||
Object
.
is
(
this
.
dataType
,
"FLOAT"
)
||
Object
.
is
(
this
.
dataType
,
"CURRENCY"
)){
let
number
=
Number
(
this
.
data
);
let
precision
=
Number
(
this
.
precision
);
if
(
Object
.
is
(
number
,
NaN
)){
return
this
.
data
;
}
else
{
let
result
=
""
;
if
(
Object
.
is
(
this
.
dataType
,
"CURRENCY"
)){
result
=
Number
(
number
.
toFixed
((
Object
.
is
(
precision
,
NaN
)
?
2
:
precision
))).
toLocaleString
(
'en-US'
);
}
else
{
result
=
number
.
toFixed
((
Object
.
is
(
precision
,
NaN
)
?
2
:
precision
));
}
let
index
=
result
.
indexOf
(
"."
);
let
fornum
=
(
Object
.
is
(
precision
,
NaN
)
?
2
:
precision
)
-
result
.
length
+
index
+
1
;
if
(
Object
.
is
(
index
,
-
1
)
&&
!
Object
.
is
(
precision
,
0
)){
result
+=
"."
;
}
for
(
let
i
=
0
;
i
<
fornum
;
i
++
)
{
result
+=
'0'
;
}
return
result
;
}
}
else
if
(
this
.
format
){
if
(
this
.
format
.
indexOf
(
'%1$t'
)
!==
-
1
){
return
moment
(
this
.
data
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
}
else
{
...
...
src/components/codelist/codelist.vue
浏览文件 @
91231104
...
...
@@ -167,7 +167,7 @@ export default class CodeList extends Vue {
}
});
}
else
{
let
values
:
any
[]
=
Object
.
is
(
_this
.
$util
.
typeOf
(
_this
.
value
),
'
NUM
'
)
?
[
_this
.
value
]
:
[...(
_this
.
value
as
any
).
split
(
_this
.
valueSeparator
)];
let
values
:
any
[]
=
Object
.
is
(
_this
.
$util
.
typeOf
(
_this
.
value
),
'
number
'
)
?
[
_this
.
value
]
:
[...(
_this
.
value
as
any
).
split
(
_this
.
valueSeparator
)];
values
.
map
((
value
:
any
,
index
:
number
)
=>
{
const
item
=
_this
.
getItem
(
items
,
value
);
if
(
item
){
...
...
src/components/context-menu/context-menu.less
0 → 100644
浏览文件 @
91231104
.context-menu-container {
// width: 100vw;
// height: 100vh;
// z-index: -10000;
// position: absolute;
// top: 0;
// left: 0;
line-height: 1;
.context-menu-content {
z-index: 10001;
position: absolute;
background: #FFF;
// border: 1px solid #e3e3e3;
}
.context-menus {
.context-menus-item {
list-style: none;
line-height: 36px;
padding: 0 13px;
margin: 0;
font-size: 14px;
color: #606266;
cursor: pointer;
outline: none;
display: flex;
.icon {
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
width: 20px;
margin-right: 8px;
}
}
.context-menus-item:hover {
background-color: #ecf5ff;
color: #66b1ff;
}
}
}
.context-menu {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
\ No newline at end of file
src/components/context-menu/context-menu.tsx
0 → 100644
浏览文件 @
91231104
class
ContextMenuService
{
/**
* 容器Dom对象
*
* @private
* @memberof ContextMenuService
*/
private
container
:
Element
|
undefined
;
/**
* Creates an instance of ContextMenuService.
* @memberof ContextMenuService
*/
constructor
()
{
document
.
addEventListener
(
'click'
,
()
=>
{
this
.
clearContainer
();
});
}
/**
* 设置容器
*
* @param {Element} container
* @memberof ContextMenuService
*/
public
setContainer
(
container
:
Element
)
{
if
(
container
)
{
this
.
clearContainer
();
this
.
container
=
container
;
}
else
{
console
.
error
(
'容器Dom节点不存在'
);
}
}
/**
* 清楚容器
*
* @memberof ContextMenuService
*/
public
clearContainer
()
{
if
(
this
.
container
)
{
this
.
container
.
remove
();
}
}
}
const
service
=
new
ContextMenuService
();
import
{
Vue
,
Component
,
Provide
,
Prop
,
Emit
}
from
'vue-property-decorator'
;
import
'./context-menu.less'
;
@
Component
({})
export
default
class
ContextMenu
extends
Vue
{
/**
* 设置右键菜单Class
*
* @type {string}
* @memberof ContextMenu
*/
@
Prop
()
public
contextMenuClass
?:
string
;
/**
* 设置右键菜单Style
*
* @type {*}
* @memberof ContextMenu
*/
@
Prop
()
public
contextMenuStyle
?:
any
;
/**
* 右键菜单数据,在调用renderContent时会传回去。
*
* @type {*}
* @memberof ContextMenu
*/
@
Prop
()
public
data
?:
any
;
/**
* 用于绘制右键菜单内容
*
* @type {any}
* @memberof ContextMenu
*/
@
Prop
()
public
renderContent
?:
any
;
/**
* 菜单数据
*
* @type {any[]}
* @memberof ContextMenu
*/
@
Prop
()
public
menus
?:
any
[]
/**
* 显示右键菜单
*
* @param {*} x x轴坐标
* @param {*} y y轴坐标
*/
public
showContextMenu
(
x
:
number
,
y
:
number
)
{
// 创建全屏覆盖容器
const
container
=
document
.
createElement
(
'div'
);
service
.
setContainer
(
container
);
container
.
oncontextmenu
=
()
=>
{
container
.
remove
();
};
document
.
body
.
appendChild
(
container
);
// 创建Vue实例挂载
const
mount
=
document
.
createElement
(
'div'
);
container
.
appendChild
(
mount
);
this
.
renderContextMenu
({
top
:
y
+
'px'
,
left
:
x
+
'px'
},
mount
,
container
);
}
/**
* 绘制菜单
*
* @param {*} position 菜单显示位置
* @param {*} mount Vue实例挂载
* @param {*} container 容器
* @returns
*/
public
renderContextMenu
(
position
:
any
,
mount
:
any
,
container
:
any
)
{
const
self
=
this
;
new
Vue
({
data
()
{
return
{
menus
:
self
.
menus
};
},
methods
:
{
destroy
(
$event
:
Event
)
{
container
.
remove
();
this
.
$destroy
();
$event
.
stopPropagation
();
},
onContextMenu
(
$event
:
any
)
{
$event
.
preventDefault
();
},
renderContent
()
{
let
menus
;
if
(
this
.
menus
)
{
menus
=
this
.
menus
.
map
((
item
)
=>
{
let
icon
;
if
(
item
.
icon
)
{
icon
=
<
img
src=
{
item
.
icon
}
/>;
}
if
(
item
.
iconcls
)
{
icon
=
<
i
class=
{
item
.
iconcls
}
></
i
>;
}
return
(
<
li
class=
'context-menus-item'
on
-
click=
{
()
=>
self
.
menuClick
(
item
,
self
.
data
)
}
>
{
icon
?
<
div
class=
"icon"
>
{
icon
}
</
div
>
:
null
}
<
div
class=
"text"
>
{
item
.
text
}
</
div
>
</
li
>
);
});
}
return
<
ul
class=
'context-menus'
>
{
menus
}
</
ul
>;
}
},
render
()
{
let
content
;
if
(
self
.
renderContent
)
{
content
=
self
.
renderContent
(
self
.
data
);
}
if
(
self
.
$slots
.
content
)
{
content
=
self
.
$slots
.
content
;
}
if
(
this
.
menus
)
{
content
=
this
.
renderContent
();
}
return
(
<
div
class=
'context-menu-container context-menu'
on
-
contextmenu=
{
(
$event
:
any
)
=>
this
.
onContextMenu
(
$event
)
}
on
-
click=
{
(
$event
:
Event
)
=>
this
.
destroy
(
$event
)
}
>
<
div
class=
'context-menu-content'
style=
{
position
}
>
{
content
}
</
div
>
</
div
>
);
}
}).
$mount
(
mount
);
}
/**
* 组件挂在完毕
*
* @memberof ContextMenu
*/
public
mounted
()
{
const
contextRef
:
any
=
this
.
$refs
.
context
;
if
(
contextRef
)
{
contextRef
.
oncontextmenu
=
(
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
this
.
showContextMenu
(
event
.
clientX
,
event
.
clientY
);
};
}
}
/**
* 菜单点击
*
* @param {*} data
* @memberof ContextMenu
*/
@
Emit
(
'menu-click'
)
public
menuClick
(
item
:
any
,
data
:
any
)
{
}
/**
* 绘制内容
*
* @returns
* @memberof ContextMenu
*/
public
render
()
{
return
(
<
div
class=
{
'context-menu-component '
+
this
.
contextMenuClass
}
style=
{
this
.
contextMenuStyle
}
ref=
'context'
>
{
this
.
$slots
.
default
}
</
div
>
);
}
}
\ No newline at end of file
src/crm-core/core/view/ViewBase.ts
浏览文件 @
91231104
...
...
@@ -115,7 +115,7 @@ export class ViewBase extends Vue {
@
Watch
(
'viewparam'
,
{
immediate
:
true
,
deep
:
true
})
protected
onParamData
(
newVal
:
any
,
oldVal
:
any
):
void
{
if
(
newVal
)
{
for
(
let
key
in
this
.
viewparams
)
{
for
(
const
key
in
this
.
viewparams
)
{
delete
this
.
viewparams
[
key
];
}
Object
.
assign
(
this
.
viewparams
,
JSON
.
parse
(
this
.
viewparam
));
...
...
@@ -239,7 +239,7 @@ export class ViewBase extends Vue {
* @memberof ViewBase
*/
protected
parseViewParam
():
void
{
for
(
let
key
in
this
.
context
)
{
for
(
const
key
in
this
.
context
)
{
delete
this
.
context
[
key
];
}
if
(
this
.
viewDefaultUsage
)
{
...
...
src/crm-core/index.ts
浏览文件 @
91231104
// 视图基类
export
{
ViewBase
}
from
'./core/view/ViewBase'
;
export
{
IndexViewBase
}
from
'./core/view/IndexViewBase'
;
export
{
GridViewBase
}
from
'./core/view/GridViewBase'
;
export
{
GridView9Base
}
from
'./core/view/GridView9Base'
;
...
...
src/model/chart-detail/chart-series.ts
浏览文件 @
91231104
...
...
@@ -133,7 +133,7 @@ export class ChartSeries {
this
.
type
=
!
Object
.
is
(
opts
.
type
,
''
)
?
opts
.
type
:
''
;
this
.
name
=
!
Object
.
is
(
opts
.
name
,
''
)
?
opts
.
name
:
''
;
this
.
caption
=
!
Object
.
is
(
opts
.
caption
,
''
)
?
opts
.
caption
:
''
;
this
.
seriesIdField
=
!
Object
.
is
(
opts
.
seriesIdField
,
''
)
?
opts
.
seriesId
Field
:
''
;
this
.
seriesIdField
=
(
opts
.
seriesIdField
&&
!
Object
.
is
(
opts
.
seriesIdField
,
''
))
?
opts
.
seriesIdField
:
(
opts
.
seriesNameField
&&
!
Object
.
is
(
opts
.
seriesNameField
,
''
))
?
opts
.
seriesName
Field
:
''
;
this
.
seriesNameField
=
!
Object
.
is
(
opts
.
seriesNameField
,
''
)
?
opts
.
seriesNameField
:
''
;
this
.
index
=
this
.
index
?
this
.
index
:
0
;
this
.
chart
=
opts
.
chart
?
opts
.
chart
:
null
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录