Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
2772f799
提交
2772f799
编写于
9月 17, 2020
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加视图消息组和视图消息组件
上级
2e27d86b
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
342 行增加
和
0 行删除
+342
-0
app-register.ts
src/app-register.ts
+4
-0
app-alert-group.vue
src/components/app-alert-group/app-alert-group.vue
+85
-0
app-alert.less
src/components/app-alert/app-alert.less
+13
-0
app-alert.vue
src/components/app-alert/app-alert.vue
+240
-0
未找到文件。
src/app-register.ts
浏览文件 @
2772f799
...
...
@@ -94,6 +94,8 @@ import DiskFileUpload from './components/disk-file-upload/disk-file-upload.vue'
import
AvueCustomForm
from
'./components/avue-custom-form/avue-custom-form.vue'
import
DiskImageUpload
from
'./components/disk-image-upload/disk-image-upload.vue'
import
AppFormPart
from
'./components/app-form-part/app-form-part.vue'
import
AppAlert
from
'./components/app-alert/app-alert.vue'
import
AppAlertGroup
from
'./components/app-alert-group/app-alert-group.vue'
// 全局挂载UI实体服务注册中心
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
...
...
@@ -203,5 +205,7 @@ export const AppComponents = {
v
.
component
(
'avue-custom-form'
,
AvueCustomForm
);
v
.
component
(
'disk-image-upload'
,
DiskImageUpload
);
v
.
component
(
'app-form-part'
,
AppFormPart
);
v
.
component
(
'app-alert'
,
AppAlert
);
v
.
component
(
'app-alert-group'
,
AppAlertGroup
);
},
};
\ No newline at end of file
src/components/app-alert-group/app-alert-group.vue
0 → 100644
浏览文件 @
2772f799
<
template
>
<div
class=
"app-alert-group"
>
<template
v-for=
"(item, index) in items"
>
<app-alert
:key=
"index"
:tag=
"item.tag"
:index=
"index"
:position=
"item.position"
/>
</
template
>
</div>
</template>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Prop
}
from
'vue-property-decorator'
;
import
ViewMessageGroupService
from
'../../message/view-message-group-service'
;
@
Component
({})
export
default
class
AppAlertGroup
extends
Vue
{
/**
* 视图消息组服务
*
* @type {any}
* @memberof AppAlertGroup
*/
public
viewMessageGroupService
=
ViewMessageGroupService
.
getInstance
();
/**
* 视图消息组tag
*
* @type {any}
* @memberof AppAlertGroup
*/
@
Prop
()
infoGroup
:
any
;
/**
* 视图消息组显示位置
*
* @type {any}
* @memberof AppAlertGroup
*/
@
Prop
()
position
:
any
;
/**
* 当前位置视图消息集合
*
* @type {any}
* @memberof AppAlertGroup
*/
public
items
:
any
[]
=
[];
/**
* Vue生命周期
*
* @memberof AppAlertGroup
*/
public
created
()
{
if
(
this
.
infoGroup
)
{
this
.
getItems
();
}
}
/**
* 获取当前位置视图消息集合
*
* @memberof AppAlertGroup
*/
public
getItems
()
{
this
.
viewMessageGroupService
.
getViewMessageDetailsByTag
(
this
.
infoGroup
).
then
((
response
:
any
)
=>
{
if
(
response
)
{
response
.
forEach
((
data
:
any
)
=>
{
if
(
this
.
position
&&
Object
.
is
(
this
.
position
,
data
.
position
))
{
this
.
items
.
push
(
data
);
}
if
(
Object
.
is
(
'TOP'
,
this
.
position
)
&&
Object
.
is
(
'POP'
,
data
.
position
))
{
this
.
items
.
push
(
data
);
}
})
}
}).
catch
(
error
=>
{
console
.
log
(
error
);
});
}
}
</
script
>
\ No newline at end of file
src/components/app-alert/app-alert.less
0 → 100644
浏览文件 @
2772f799
.el-message {
.el-message__content {
.title {
padding-bottom: 10px;
}
}
}
.app-alert-group {
.el-alert {
margin: 5px 0px;
}
}
\ No newline at end of file
src/components/app-alert/app-alert.vue
0 → 100644
浏览文件 @
2772f799
<
template
>
<el-alert
v-if=
"hasContent"
v-show=
"showState"
:title=
"title"
:description=
"message"
:type=
"type"
:closable=
"closable"
@
close=
"alertClose"
>
</el-alert>
</
template
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Prop
}
from
'vue-property-decorator'
;
import
ViewMessageService
from
'../../message/view-message-service'
;
@
Component
({})
export
default
class
AppAlert
extends
Vue
{
/**
* 视图消息标识
*
* @type {any}
* @memberof AppAlert
*/
@
Prop
()
tag
:
any
;
/**
* 显示位置
*
* @type {any}
* @memberof AppAlert
*/
@
Prop
()
position
:
any
;
/**
* 视图消息显示次序
*
* @type {any}
* @memberof AppAlert
*/
@
Prop
()
index
:
any
;
/**
* 视图消息对象
*
* @type {any}
* @memberof AppAlert
*/
public
data
:
any
=
{};
/**
* 视图消息标题
*
* @type {any}
* @memberof AppAlert
*/
public
title
:
string
=
''
;
/**
* 视图消息内容
*
* @type {any}
* @memberof AppAlert
*/
public
message
:
string
=
''
;
/**
* 视图消息类型
*
* @type {any}
* @memberof AppAlert
*/
public
type
:
string
=
''
;
/**
* 视图消息关闭模式
*
* @type {any}
* @memberof AppAlert
*/
public
closeMode
:
any
=
''
;
/**
* 视图消息是否可关闭
*
* @type {boolean}
* @memberof AppAlert
*/
public
closable
:
boolean
=
true
;
/**
* 是否显示
*
* @type {boolean}
* @memberof AppAlert
*/
public
showState
:
boolean
=
true
;
/**
* 视图消息服务
*
* @type {ViewMessageService}
* @memberof AppAlert
*/
public
viewMessageService
=
ViewMessageService
.
getInstance
();
/**
* 是否存在内容
*
* @type {boolean}
* @memberof AppAlert
*/
public
hasContent
:
boolean
=
true
;
/**
* Vue生命周期
*
* @memberof AppAlert
*/
public
created
()
{
this
.
getData
().
then
((
result
:
any
)
=>
{
if
(
this
.
data
)
{
this
.
afterCreated
();
}
})
}
/**
* 组件创建之前
*
* @memberof AppAlert
*/
public
afterCreated
()
{
let
flag
:
boolean
=
true
;
// 不存在内容则不显示
if
(
!
this
.
data
.
content
&&
!
this
.
data
.
title
)
{
this
.
hasContent
=
false
;
return
;
}
// 视图消息是否支持删除
if
(
!
this
.
data
.
isEnableRemove
)
{
this
.
closable
=
false
;
}
flag
=
this
.
handleCloseMode
(
flag
);
this
.
handlePosition
(
flag
);
}
/**
* 获取视图消息对象
*
* @memberof AppAlert
*/
public
async
getData
()
{
let
tempData
:
any
;
let
response
:
any
=
await
this
.
viewMessageService
.
getViewMessageByTag
(
this
.
tag
,
null
,
null
)
if
(
response
)
{
tempData
=
response
[
0
];
if
(
tempData
.
type
)
{
if
(
Object
.
is
(
'WARN'
,
tempData
.
type
))
{
tempData
.
type
=
"warning"
;
}
if
(
Object
.
is
(
"ERROR"
,
tempData
.
type
))
{
tempData
.
type
=
"error"
;
}
}
else
{
tempData
.
type
=
"info"
;
}
this
.
data
=
tempData
;
}
}
/**
* 处理关闭模式
*
* @param flag 默认删除标记
* @memberof AppAlert
*/
public
handleCloseMode
(
flag
:
boolean
)
{
if
(
this
.
data
.
closeMode
)
{
if
(
Object
.
is
(
'default'
,
this
.
data
.
closeMode
))
{
const
id
=
this
.
$store
.
getters
.
getViewMessage
(
this
.
data
.
codename
);
if
(
id
)
{
this
.
showState
=
false
;
flag
=
false
;
}
}
if
(
Object
.
is
(
'notclose'
,
this
.
data
.
closeMode
))
{
this
.
closable
=
false
;
}
}
return
flag
;
}
/**
* 处理显示位置
*
* @memberof AppAlert
*/
public
handlePosition
(
flag
:
boolean
)
{
if
(
this
.
data
.
position
)
{
if
(
flag
&&
Object
.
is
(
'POP'
,
this
.
data
.
position
))
{
this
.
showState
=
false
;
setTimeout
(()
=>
{
this
.
$message
({
dangerouslyUseHTMLString
:
true
,
message
:
"<p class='title'><strong>"
+
this
.
data
.
title
+
"</strong></p><p>"
+
this
.
data
.
content
+
"</p>"
,
type
:
this
.
data
.
type
,
showClose
:
this
.
closable
,
onClose
:
this
.
alertClose
,
})
},
Number
(
this
.
index
)
*
1000
)
}
else
{
this
.
title
=
this
.
data
.
title
;
this
.
message
=
this
.
data
.
content
;
this
.
type
=
this
.
data
.
type
;
}
}
}
/**
* 视图消息关闭
*
* @memberof AppAlert
*/
public
alertClose
()
{
if
(
this
.
data
.
closeMode
&&
Object
.
is
(
"default"
,
this
.
data
.
closeMode
))
{
const
args
=
{
tag
:
this
.
data
.
codename
,
id
:
this
.
data
.
id
};
this
.
$store
.
commit
(
'addViewMessage'
,
args
);
}
}
}
</
script
>
<
style
lang=
"less"
>
@import './app-alert.less';
</
style
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录