Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
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
platform
hp-smart
Commits
c24e7588
Commit
c24e7588
authored
Mar 05, 2024
by
wancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产计划前端校验优化
parent
c85d2d39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
60 deletions
+86
-60
ServiceHPSC003.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003.java
+1
-0
HPSC003.js
src/main/webapp/HP/SC/HPSC003.js
+85
-60
No files found.
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003.java
View file @
c24e7588
...
@@ -121,6 +121,7 @@ public class ServiceHPSC003 extends ServiceBase {
...
@@ -121,6 +121,7 @@ public class ServiceHPSC003 extends ServiceBase {
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
HPSC003
.
fromMap
(
map
);
HPSC003
.
fromMap
(
map
);
HPSC003
.
setPlanCompletionDate
(
DateUtils
.
formatShort
(
HPSC003
.
getPlanCompletionDate
()));
DaoUtils
.
update
(
"HPSC003.update"
,
HPSC003
.
toMap
());
DaoUtils
.
update
(
"HPSC003.update"
,
HPSC003
.
toMap
());
}
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
...
...
src/main/webapp/HP/SC/HPSC003.js
View file @
c24e7588
...
@@ -40,6 +40,14 @@ $(function () {
...
@@ -40,6 +40,14 @@ $(function () {
return
template
;
return
template
;
}
}
}],
}],
onSave
:
function
(
e
)
{
// 阻止默认请求,使用自定义保存
e
.
preventDefault
();
let
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
saveResult
(
btnNode
);
},
onSuccess
:
function
(
e
)
{
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'update'
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'update'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'insert'
)
{
||
e
.
eiInfo
.
extAttr
.
methodName
==
'insert'
)
{
...
@@ -72,68 +80,12 @@ $(function () {
...
@@ -72,68 +80,12 @@ $(function () {
// delete: true, // 显示删除按钮
// delete: true, // 显示删除按钮
},
},
onSave
:
function
(
e
)
{
onSave
:
function
(
e
)
{
var
rowCount
=
detailGrid
.
getCheckedRows
();
// 阻止默认请求,使用自定义保存
// 检验是否选中数据
e
.
preventDefault
();
if
(
rowCount
==
null
||
rowCount
==
""
)
{
let
btnNode
=
$
(
this
);
NotificationUtil
({
msg
:
'请选择一条或多条数据'
},
"warning"
);
}
let
flag
=
false
;
for
(
let
i
=
0
;
i
<
rowCount
.
length
;
i
++
)
{
let
startT
=
new
Date
(
rowCount
[
i
].
planCommentDate
).
getTime
();
let
endT
=
new
Date
(
rowCount
[
i
].
planCompletionDate
).
getTime
();
if
(
startT
>
endT
)
{
flag
=
true
;
break
}
}
if
(
flag
){
NotificationUtil
({
msg
:
'计划结束时间不能小于计划开始时间'
},
"warning"
);
return
false
;
}
var
btnNode
=
$
(
this
);
//禁用按钮
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
btnNode
.
attr
(
"disabled"
,
true
);
IPLAT
.
submitNode
(
$
(
"#HPSC003"
),
"HPSC003"
,
"updatePlanDetail"
,
{
saveDetail
(
btnNode
);
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
==
-
1
)
{
NotificationUtil
(
ei
,
"error"
);
}
else
{
NotificationUtil
({
msg
:
'修改成功'
});
// 绑定grid
detailGrid
.
setEiInfo
(
ei
);
resultGrid
.
dataSource
.
page
(
resultGrid
.
dataSource
.
_page
);
}
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
},
onFail
:
function
(
ei
)
{
// onFail 表示失败回调函数
// 发生异常
console
.
log
(
ei
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
}
});
},
afterEdit
:
function
(
e
)
{
if
(
e
.
field
===
"planCompletionDate"
)
{
let
startT
=
new
Date
(
e
.
model
.
planCommentDate
).
getTime
();
let
endT
=
new
Date
(
e
.
model
.
planCompletionDate
).
getTime
();
if
(
startT
>
endT
)
{
e
.
preventDefault
();
NotificationUtil
({
msg
:
'计划结束时间不能小于计划开始时间'
},
"warning"
);
}
}
},
},
columns
:
[{
columns
:
[{
field
:
"operator"
,
field
:
"operator"
,
...
@@ -282,3 +234,76 @@ function check_time(model,rows){
...
@@ -282,3 +234,76 @@ function check_time(model,rows){
}
}
return
true
;
return
true
;
}
}
/**
* 保存汇总
*/
function
saveResult
(
btn
)
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
planCompletionDate
=
item
.
get
(
"planCompletionDate"
);
if
(
isBlank
(
planCompletionDate
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
计划结束时间
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPSC003"
,
"update"
,
true
);
//释放禁用按钮
btn
.
attr
(
"disabled"
,
false
);
}
});
}
}
/**
* 保存明细
*/
function
saveDetail
(
btn
)
{
let
rows
=
detailGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
planCommentDate
=
item
.
get
(
"planCommentDate"
);
let
planCompletionDate
=
item
.
get
(
"planCompletionDate"
);
if
(
isBlank
(
planCommentDate
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
计划开始时间
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
planCompletionDate
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
计划结束时间
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
let
startT
=
new
Date
(
planCommentDate
).
getTime
();
let
endT
=
new
Date
(
planCompletionDate
).
getTime
();
if
(
startT
>
endT
)
{
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
计划开始时间
\"
不能大于
\"
计划结束时间
\"
!"
);
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"detail"
,
"HPSC003"
,
"updatePlanDetail"
,
true
);
//释放禁用按钮
btn
.
attr
(
"disabled"
,
false
);
}
});
}
}
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