Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM-28
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
YM-28
Commits
c4cfbfed
Commit
c4cfbfed
authored
May 16, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
8297e29c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
6 deletions
+39
-6
form.component.html
src/app/form/form.component.html
+3
-3
form.component.ts
src/app/form/form.component.ts
+36
-3
No files found.
src/app/form/form.component.html
View file @
c4cfbfed
...
@@ -102,10 +102,10 @@
...
@@ -102,10 +102,10 @@
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
<nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
6
"
nzFor=
"{{j}}.
text
"
>
序号
</nz-form-label>
<nz-form-label
[
nzSpan
]="
6
"
nzFor=
"{{j}}.
index
"
>
序号
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<nz-form-control
[
nzSpan
]="
6
"
>
<
input
nz-input
type=
"text
"
id=
"{{j}}.index"
placeholder=
"请录入序号"
[(
ngModel
)]="
data
.
index
"
<
nz-input-number
[
nzMin
]="
1
"
id=
"{{j}}.index"
placeholder=
"请录入序号"
[(
ngModel
)]="
data
.
index
"
(
blur
)="
save
()"
>
(
ngModelChange
)="
saveIndex
(
data
)"
></nz-input-number
>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
<nz-form-item>
<nz-form-item>
...
...
src/app/form/form.component.ts
View file @
c4cfbfed
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
NzMessageService
}
from
'
ng-zorro-antd/message
'
@
Component
({
@
Component
({
selector
:
'
app-form
'
,
selector
:
'
app-form
'
,
...
@@ -15,7 +15,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -15,7 +15,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
item
;
item
;
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
,
private
message
:
NzMessageService
)
{
}
}
...
@@ -98,6 +98,39 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -98,6 +98,39 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
refresh
();
this
.
refresh
();
}
}
saveIndex
(
item
){
console
.
log
(
item
);
let
canSave
=
true
;
for
(
let
i
=
0
;
i
<
this
.
item
.
exercisesArr
.
length
;
++
i
){
let
exercises
=
this
.
item
.
exercisesArr
[
i
];
if
(
item
==
exercises
){
continue
;
}
else
if
(
exercises
.
index
==
item
.
index
){
canSave
=
false
;
break
;
}
}
console
.
log
(
canSave
);
if
(
canSave
){
this
.
save
();
}
else
{
let
id
=
this
.
message
.
error
(
'
已经存在相同的顺序号
'
,
{
nzDuration
:
0
}).
messageId
;
setTimeout
(()
=>
{
this
.
message
.
remove
(
id
);
},
2500
);
}
}
/**
/**
* 刷新 渲染页面
* 刷新 渲染页面
*/
*/
...
...
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