Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
50b498ea
提交
50b498ea
编写于
11月 09, 2022
作者:
Shine-zwj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新
上级
9692ced5
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
100 行增加
和
125 行删除
+100
-125
app-panel-field.vue
src/components/app-panel-field/app-panel-field.vue
+100
-125
未找到文件。
src/components/app-panel-field/app-panel-field.vue
浏览文件 @
50b498ea
<
template
>
<div
:class=
"classes"
>
<div
v-if=
"Object.is(labelPos,'NONE') || !labelPos"
class=
"editor"
>
<div
:class=
"valueCheck == true ?'':'editorstyle'"
>
<slot
></slot>
<span
:class=
"error ? 'errorstyle':''"
>
{{
error
}}
</span>
</div>
</div>
<div
v-if=
"!Object.is(labelPos,'NONE')"
class=
"app-panel-field-label"
>
<span
v-if=
"required"
style=
"color:red;"
>
*
</span>
{{
isEmptyCaption
?
''
:
caption
}}
</div>
<div
v-if=
"Object.is(labelPos,'BOTTOM') || Object.is(labelPos,'TOP') || Object.is(labelPos,'LEFT') || Object.is(labelPos,'RIGHT')"
class=
"editor"
>
<div
:class=
"valueCheck == true ?'':'editorstyle'"
>
<slot
></slot>
<span
:class=
"error ? 'errorstyle':''"
>
{{
error
}}
</span>
</div>
</div>
<div
:class=
"curClassName"
:style=
"curStyle"
>
<div
v-if=
"Object.is(labelPos, 'NONE') || !labelPos"
class=
"editor"
>
<div
:class=
"valueCheck == true ? '' : 'editorstyle'"
>
<slot></slot>
<span
:class=
"error ? 'errorstyle' : ''"
>
{{
error
}}
</span>
</div>
</div>
<div
v-if=
"!Object.is(labelPos, 'NONE')"
class=
"app-panel-field-label"
>
<span
v-if=
"required"
style=
"color: red"
>
*
</span>
<span
v-if=
"showCaption"
>
{{
caption
}}
</span>
</div>
<div
v-if=
"
Object.is(labelPos, 'BOTTOM') ||
Object.is(labelPos, 'TOP') ||
Object.is(labelPos, 'LEFT') ||
Object.is(labelPos, 'RIGHT')
"
class=
"editor"
>
<div
:class=
"valueCheck == true ? '' : 'editorstyle'"
>
<slot></slot>
<span
:class=
"error ? 'errorstyle' : ''"
>
{{
error
}}
</span>
</div>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Prop
,
Watch
}
from
"vue-property-decorator"
;
...
...
@@ -29,113 +37,130 @@ export default class AppPanelField extends Vue {
* @type {string}
* @memberof AppPanelField
*/
@
Prop
()
public
caption
!
:
string
;
@
Prop
()
public
name
!
:
string
;
/**
*
错误信息
*
标题
*
* @type {string}
* @memberof AppPanelField
*/
@
Prop
()
public
error
?
:
string
;
@
Prop
()
public
caption
!
:
string
;
/**
*
标签位置
*
下标
*
* @type {
(string | 'BOTTOM' | 'LEFT' | 'NONE' | 'RIGHT' | 'TOP')
}
* @type {
string
}
* @memberof AppPanelField
*/
@
Prop
()
public
labelPos
?:
|
string
|
"BOTTOM"
|
"LEFT"
|
"NONE"
|
"RIGHT"
|
"TOP"
;
@
Prop
({
default
:
0
})
public
index
?:
number
;
/**
*
标签是否空白
*
编辑器值
*
* @type {
boolean
}
* @type {
any
}
* @memberof AppPanelField
*/
@
Prop
()
public
isEmptyCaption
?:
boolean
;
@
Prop
()
public
value
!
:
any
;
/**
*
列表项名称
*
布局模型详情
*
* @type {
string
}
* @type {
*
}
* @memberof AppPanelField
*/
@
Prop
()
public
name
!
:
string
;
@
Prop
()
public
layoutModelDetails
!
:
any
;
/**
*
面板数据
*
项名称
*
* @type {any}
* @memberof AppPanelField
*/
@
Prop
()
public
data
!
:
any
;
get
itemName
()
{
return
this
.
index
?
`
${
this
.
name
}
_
${
this
.
index
}
`
:
this
.
name
;
}
/**
*
编辑器值
*
显示标题
*
* @type {any}
* @memberof AppPanelField
*/
@
Prop
()
public
value
!
:
any
;
get
showCaption
()
{
const
layoutModel
=
this
.
layoutModelDetails
[
this
.
itemName
];
if
(
layoutModel
)
{
return
layoutModel
.
isShowCaption
;
}
}
/**
*
值规则
*
类名
*
* @type {string}
* @memberof AppPanelField
*/
@
Prop
()
public
itemRules
!
:
any
;
get
curClassName
()
{
const
layoutModel
=
this
.
layoutModelDetails
[
this
.
itemName
];
if
(
layoutModel
)
{
let
posClass
=
""
;
switch
(
layoutModel
.
labelPos
)
{
case
"TOP"
:
posClass
=
"label-top"
;
break
;
case
"LEFT"
:
posClass
=
"label-left"
;
break
;
case
"BOTTOM"
:
posClass
=
"label-bottom"
;
break
;
case
"RIGHT"
:
posClass
=
"label-right"
;
break
;
case
"NONE"
:
posClass
=
"label-none"
;
break
;
}
return
`app-panel-field
${
posClass
}
${
this
.
itemName
}
${
layoutModel
.
sysCss
}
`
;
}
}
/**
*
是否必填
*
样式
*
* @type {boolean}
* @memberof AppPanelField
*/
public
required
:
boolean
=
false
;
get
curStyle
()
{
const
layoutModel
=
this
.
layoutModelDetails
[
this
.
itemName
];
if
(
layoutModel
)
{
return
layoutModel
.
getElementStyle
();
}
}
/**
*
值规则数组
*
标签位置
*
* @type {any[]}
* @memberof AppPanelField
*/
public
rules
:
any
[]
=
[];
get
labelPos
()
{
const
layoutModel
=
this
.
layoutModelDetails
[
this
.
itemName
];
if
(
layoutModel
)
{
return
layoutModel
.
labelPos
||
"LEFT"
;
}
return
"LEFT"
;
}
/**
*
值规则监控
*
必填
*
* @param {*} newVal
* @param {*} oldVal
* @memberof AppPanelField
*/
@
Watch
(
"itemRules"
,
{
deep
:
true
})
onItemRulesChange
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
newVal
)
{
try
{
this
.
rules
=
[];
const
_rules
:
any
[]
=
newVal
;
this
.
rules
=
[...
_rules
];
this
.
rules
.
some
((
rule
:
any
)
=>
{
if
(
rule
.
hasOwnProperty
(
"required"
))
{
this
.
required
=
rule
.
required
;
return
true
;
}
return
false
;
});
}
catch
(
error
)
{}
get
required
()
{
const
layoutModel
=
this
.
layoutModelDetails
[
this
.
itemName
];
if
(
layoutModel
)
{
return
layoutModel
.
required
;
}
}
/**
*
编辑器样式
*
值校验
*
* @type {boolean}
* @memberof AppPanelField
...
...
@@ -150,61 +175,11 @@ export default class AppPanelField extends Vue {
* @memberof AppPanelField
*/
@
Watch
(
"value"
)
ItemValueRules
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
this
.
required
&&
!
newVal
)
{
this
.
valueCheck
=
false
;
}
else
{
this
.
valueCheck
=
true
;
}
}
/**
* 计算样式
*
* @readonly
* @type {string []}
* @memberof AppPanelField
*/
get
classes
():
string
[]
{
let
posClass
=
""
;
switch
(
this
.
labelPos
)
{
case
"TOP"
:
posClass
=
"label-top"
;
break
;
case
"LEFT"
:
posClass
=
"label-left"
;
break
;
case
"BOTTOM"
:
posClass
=
"label-bottom"
;
break
;
case
"RIGHT"
:
posClass
=
"label-right"
;
break
;
case
"NONE"
:
posClass
=
"label-none"
;
break
;
}
return
[
"app-panel-field"
,
posClass
];
}
/**
* vue 生命周期
*
* @memberof AppPanelField
*/
public
mounted
()
{
if
(
this
.
itemRules
)
{
try
{
const
_rules
:
any
[]
=
this
.
itemRules
;
this
.
rules
=
[...
_rules
];
this
.
rules
.
some
((
rule
:
any
)
=>
{
if
(
rule
.
hasOwnProperty
(
"required"
))
{
this
.
required
=
rule
.
required
;
return
true
;
}
return
false
;
});
}
catch
(
error
)
{}
itemValueRules
(
newVal
:
any
,
oldVal
:
any
)
{
if
(
this
.
required
&&
!
newVal
)
{
this
.
valueCheck
=
false
;
}
else
{
this
.
valueCheck
=
true
;
}
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录