Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
witiumCloud2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WitCloud
witiumCloud2
Commits
0f9101e3
Commit
0f9101e3
authored
Apr 24, 2019
by
van.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改表单验证
parent
3faec8f5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
21 deletions
+53
-21
topic-module-detail.component.html
...in/topic-module-detail/topic-module-detail.component.html
+2
-2
topic-module-detail.component.ts
...main/topic-module-detail/topic-module-detail.component.ts
+18
-1
topic-module-way.component.html
...app/main/topic-module-way/topic-module-way.component.html
+11
-11
topic-module-way.component.ts
src/app/main/topic-module-way/topic-module-way.component.ts
+16
-1
check.ts
src/app/service/check.ts
+6
-6
No files found.
src/app/main/topic-module-detail/topic-module-detail.component.html
View file @
0f9101e3
...
...
@@ -46,8 +46,8 @@
[
data
]="[{
a:
'
json
',
b:
0
},
{
a:
'
bin
',
b:
1
}]"
optL=
"a"
optV=
"b"
></app-search-select>
<app-search-select
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
probesModel
'
|
translate
"
[(
value
)]="
req
.
probesModelNo
"
[
data
]="
probesModels
"
optL=
"probesModelName"
optV=
"probesModelNo"
></app-search-select>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
dataInterval
'
|
translate
"
[(
value
)]="
req
.
dataInterval
"
></app-search-item>
<
app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
frequency
'
|
translate
"
[(
value
)]="
req
.
frequency
"
></app-search-item
>
<app-search-item
inModal=
"true"
[
label
]="'
dataInterval
'
|
translate
"
[(
value
)]="
req
.
dataInterval
"
></app-search-item>
<
!--<app-search-item isMust="true" inModal="true" [label]="'frequency' | translate" [(value)]="req.frequency"></app-search-item>--
>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
interval
'
|
translate
"
[(
value
)]="
req
.
interval
"
></app-search-item>
</ng-template>
<ng-template
#
foot1
>
...
...
src/app/main/topic-module-detail/topic-module-detail.component.ts
View file @
0f9101e3
...
...
@@ -4,6 +4,7 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-topic-module-detail'
,
...
...
@@ -21,9 +22,11 @@ export class TopicModuleDetailComponent implements OnInit {
isV
=
false
;
isUpdate
=
false
;
probesModels
=
[];
try
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
ac
:
ActivatedRoute
,
private
translate
:
TranslateService
,
private
router
:
Router
,
private
modalService
:
NzModalService
)
{
private
translate
:
TranslateService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -88,14 +91,20 @@ export class TopicModuleDetailComponent implements OnInit {
add
()
{
this
.
req
=
{};
this
.
req
.
frequency
=
0
;
this
.
isUpdate
=
false
;
this
.
try
=
{
field
:
[
'topicName'
,
'topicType'
,
'dataType'
,
'interval'
],
num
:
[
'dataType'
,
'interval'
,
'dataInterval'
]};
this
.
isV
=
true
;
}
update
(
one
)
{
this
.
isUpdate
=
true
;
this
.
req
=
{...
one
};
this
.
req
.
frequency
=
0
;
this
.
req
.
oldTopicName
=
one
.
topicName
;
this
.
try
=
{
field
:
[
'topicModelNo'
,
'topicName'
,
'topicType'
,
'dataType'
,
'interval'
],
num
:
[
'dataType'
,
'interval'
,
'dataInterval'
]};
this
.
isV
=
true
;
}
...
...
@@ -109,10 +118,18 @@ export class TopicModuleDetailComponent implements OnInit {
if
(
this
.
isUpdate
)
{
req
=
this
.
req
;
req
.
topicModelNo
=
this
.
topicModelNo
;
if
(
!
this
.
ck
.
formCheck
(
req
,
this
.
try
))
{
this
.
isLoading
=
false
;
return
false
;
}
this
.
api
.
topicModelInfo
.
updateTopicModelInfo
([
req
,
this
.
next
]);
}
else
{
req
.
topicModelNo
=
this
.
topicModelNo
;
req
.
addTopicModelForInfoVos
=
[
this
.
req
];
if
(
!
this
.
ck
.
formCheck
(
req
.
addTopicModelForInfoVos
[
0
],
this
.
try
))
{
this
.
isLoading
=
false
;
return
false
;
}
this
.
api
.
topicModelInfo
.
addTopicModelInfo
([
req
,
this
.
next
]);
}
}
...
...
src/app/main/topic-module-way/topic-module-way.component.html
View file @
0f9101e3
...
...
@@ -51,12 +51,12 @@
[
nzFooter
]="
foot1
"
[
nzTitle
]="
isUpdate
?
('
update
'
|
translate
)
:
('
add
'
|
translate
)"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con1
>
<div
class=
"half"
>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayName
'
|
translate
"
[(
value
)]="
req
.
name
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
per
'
|
translate
"
[(
value
)]="
req
.
unit
"
></app-search-item>
<app-search-item
nz-tooltip
nzTitle=
"此处输入为英文"
isMust=
"true"
inModal=
"true"
[
label
]="'
wayName
'
|
translate
"
[(
value
)]="
req
.
name
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
per
'
|
translate
"
[(
value
)]="
req
.
unit
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayDescription
'
|
translate
"
[(
value
)]="
req
.
description
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
max
'
|
translate
"
[(
value
)]="
req
.
rangeMax
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
alarmMax
'
|
translate
"
[(
value
)]="
req
.
alarmUp
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
alarmMaxMax
'
|
translate
"
[(
value
)]="
req
.
upperAlarmLimit
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
max
'
|
translate
"
[(
value
)]="
req
.
rangeMax
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
alarmMax
'
|
translate
"
[(
value
)]="
req
.
alarmUp
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
alarmMaxMax
'
|
translate
"
[(
value
)]="
req
.
upperAlarmLimit
"
></app-search-item>
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
><span
class=
"deleteFontColor"
>
*
</span>
{{'isAlarm' | translate}}
</div>
<div
class=
"item-input"
>
...
...
@@ -68,15 +68,15 @@
</div>
</div>
<div
class=
"half"
>
<app-search-item
inModal=
"true"
[
label
]="'
wayAlias
'
|
translate
"
[(
value
)]="
req
.
alias
"
></app-search-item>
<app-search-item
nz-tooltip
nzTitle=
"此处输入为英文"
isMust=
"true"
inModal=
"true"
[
label
]="'
wayAlias
'
|
translate
"
[(
value
)]="
req
.
alias
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayType
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
min
'
|
translate
"
[(
value
)]="
req
.
rangeMin
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
alarmMin
'
|
translate
"
[(
value
)]="
req
.
alarmDown
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
alarmMinMin
'
|
translate
"
[(
value
)]="
req
.
lowerAlarmLimit
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
alarmInterval
'
|
translate
"
[(
value
)]="
req
.
alarmInterval
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
min
'
|
translate
"
[(
value
)]="
req
.
rangeMin
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
alarmMin
'
|
translate
"
[(
value
)]="
req
.
alarmDown
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
alarmMinMin
'
|
translate
"
[(
value
)]="
req
.
lowerAlarmLimit
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
alarmInterval
'
|
translate
"
[(
value
)]="
req
.
alarmInterval
"
></app-search-item>
</div>
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
style=
"width: 149px;"
>
<span
class=
"deleteFontColor"
>
*
</span>
{{'wayInfo' | translate}}
</div>
<div
class=
"item-label"
style=
"width: 149px;"
>
{{'wayInfo' | translate}}
</div>
<div
class=
"item-input"
style=
"width: calc(100% - 158px);"
>
<textarea
nz-input
[(
ngModel
)]="
req
.
boxedart
"
></textarea>
</div>
...
...
src/app/main/topic-module-way/topic-module-way.component.ts
View file @
0f9101e3
...
...
@@ -4,6 +4,7 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-topic-module-way'
,
...
...
@@ -20,9 +21,11 @@ export class TopicModuleWayComponent implements OnInit {
topicName
=
''
;
isV
=
false
;
isUpdate
=
false
;
try
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
ac
:
ActivatedRoute
,
private
translate
:
TranslateService
,
private
router
:
Router
,
private
modalService
:
NzModalService
)
{
private
translate
:
TranslateService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -76,6 +79,10 @@ export class TopicModuleWayComponent implements OnInit {
this
.
req
=
{};
this
.
isUpdate
=
false
;
this
.
isV
=
true
;
this
.
try
=
{
field
:
[
'topicModelNo'
,
'topicName'
,
'name'
,
'alias'
,
'description'
,
'type'
,
'unit'
,
'isAlarm'
],
eng
:
[
'name'
,
'alias'
]
};
}
update
(
one
)
{
...
...
@@ -83,6 +90,10 @@ export class TopicModuleWayComponent implements OnInit {
this
.
req
=
{...
one
};
this
.
req
.
oldName
=
one
.
name
;
this
.
isV
=
true
;
this
.
try
=
{
field
:
[
'topicModelNo'
,
'topicName'
,
'name'
,
'alias'
,
'description'
,
'type'
,
'unit'
,
'isAlarm'
],
eng
:
[
'name'
,
'alias'
]
};
}
cancel
()
{
...
...
@@ -93,6 +104,10 @@ export class TopicModuleWayComponent implements OnInit {
this
.
isLoading
=
true
;
this
.
req
.
topicModelNo
=
this
.
topicModelNo
;
this
.
req
.
topicName
=
this
.
topicName
;
if
(
!
this
.
ck
.
formCheck
(
this
.
req
,
this
.
try
))
{
this
.
isLoading
=
false
;
return
false
;
}
if
(
this
.
isUpdate
)
{
this
.
api
.
topicConfigModel
.
updateTopicConfigModel
([
this
.
req
,
this
.
next
]);
}
else
{
...
...
src/app/service/check.ts
View file @
0f9101e3
...
...
@@ -58,7 +58,7 @@ export class CheckService {
}
private
checkTime
(
fieldStr
,
data
,
time
)
{
if
((
data
[
time
]
===
''
||
isUndefined
(
data
[
time
])
||
data
[
time
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
time
+
'-'
)
>
-
1
)
{
if
((
data
[
time
]
===
''
||
isUndefined
(
data
[
time
])
||
data
[
time
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
time
+
'-'
)
<=
-
1
)
{
return
true
;
}
if
(
data
[
time
]
&&
new
Date
(
data
[
time
]).
getTime
()
>
0
&&
new
Date
(
data
[
time
]).
getTime
().
toString
().
length
===
13
)
{
...
...
@@ -69,7 +69,7 @@ export class CheckService {
}
private
checkTel
(
fieldStr
,
data
,
tel
)
{
if
((
data
[
tel
]
===
''
||
isUndefined
(
data
[
tel
])
||
data
[
tel
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
tel
+
'-'
)
>
-
1
)
{
if
((
data
[
tel
]
===
''
||
isUndefined
(
data
[
tel
])
||
data
[
tel
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
tel
+
'-'
)
<=
-
1
)
{
return
true
;
}
const
reg
=
new
RegExp
(
'^1
\\
d{10}$'
);
...
...
@@ -81,7 +81,7 @@ export class CheckService {
}
private
checkMoney
(
fieldStr
,
data
,
money
)
{
if
((
data
[
money
]
===
''
||
isUndefined
(
data
[
money
])
||
data
[
money
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
money
+
'-'
)
>
-
1
)
{
if
((
data
[
money
]
===
''
||
isUndefined
(
data
[
money
])
||
data
[
money
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
money
+
'-'
)
<=
-
1
)
{
return
true
;
}
if
(
parseFloat
(
data
[
money
]).
toFixed
(
2
)
===
data
[
money
]
&&
parseInt
(
data
[
money
],
10
).
toString
().
length
<
8
)
{
...
...
@@ -92,7 +92,7 @@ export class CheckService {
}
private
checkNum
(
fieldStr
,
data
,
num
)
{
if
((
data
[
num
]
===
''
||
isUndefined
(
data
[
num
])
||
data
[
num
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
num
+
'-'
)
>
-
1
)
{
if
((
data
[
num
]
===
''
||
isUndefined
(
data
[
num
])
||
data
[
num
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
num
+
'-'
)
<=
-
1
)
{
return
true
;
}
const
reg
=
new
RegExp
(
'^[0-9]*$'
);
...
...
@@ -104,7 +104,7 @@ export class CheckService {
}
private
checkFloat2
(
fieldStr
,
data
,
float2
)
{
if
((
data
[
float2
]
===
''
||
isUndefined
(
data
[
float2
])
||
data
[
float2
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
float2
+
'-'
)
>
-
1
)
{
if
((
data
[
float2
]
===
''
||
isUndefined
(
data
[
float2
])
||
data
[
float2
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
float2
+
'-'
)
<=
-
1
)
{
return
true
;
}
if
(
parseFloat
(
data
[
float2
]).
toFixed
(
2
).
toString
()
===
data
[
float2
])
{
...
...
@@ -115,7 +115,7 @@ export class CheckService {
}
private
checkEng
(
fieldStr
,
data
,
eng
)
{
if
((
data
[
eng
]
===
''
||
isUndefined
(
data
[
eng
])
||
data
[
eng
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
eng
+
'-'
)
>
-
1
)
{
if
((
data
[
eng
]
===
''
||
isUndefined
(
data
[
eng
])
||
data
[
eng
]
===
null
)
&&
fieldStr
.
indexOf
(
'-'
+
eng
+
'-'
)
<=
-
1
)
{
return
true
;
}
const
reg
=
new
RegExp
(
'^[a-zA-Z]*$'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment