mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt progress
This commit is contained in:
parent
b896e34ac7
commit
d0044e0b43
@ -157,6 +157,9 @@ table td {
|
|||||||
max-width:1200px;
|
max-width:1200px;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
table td.done {
|
||||||
|
background-color:green;
|
||||||
|
}
|
||||||
table td:hover {
|
table td:hover {
|
||||||
background-color:red;
|
background-color:red;
|
||||||
}
|
}
|
||||||
|
@ -12,17 +12,24 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
|||||||
can.run(msg._event, ["search", "Footer.onaction.ncmd"])
|
can.run(msg._event, ["search", "Footer.onaction.ncmd"])
|
||||||
},
|
},
|
||||||
_progress: function(can, sub, conf, msg, cmds, cb, silent) {
|
_progress: function(can, sub, conf, msg, cmds, cb, silent) {
|
||||||
if (msg.Append("size") != "" && msg.Append("size") == msg.Append("total")) {
|
var size = msg.Append("size") || msg.Append("count")
|
||||||
|
if (size != "" && size == msg.Append("total")) {
|
||||||
return typeof cb == "function" && cb(msg)
|
return typeof cb == "function" && cb(msg)
|
||||||
}
|
}
|
||||||
can.user.toast(can, {
|
can.user.toast(can, {
|
||||||
width: 400,
|
width: 400,
|
||||||
title: conf.name+" "+msg.Append("step")+"% ", duration: 1100,
|
title: conf.name+" "+msg.Append("step")+"% ", duration: 1100,
|
||||||
text: "执行进度: "+can.base.Size(msg.Append("size")||0)+"/"+can.base.Size(msg.Append("total")||"1000")+"\n"+msg.Append("name"),
|
text: "执行进度: "+can.base.Size(size||0)+"/"+can.base.Size(msg.Append("total")||"1000")+"\n"+msg.Append("name"),
|
||||||
progress: parseInt(msg.Append("step")),
|
progress: parseInt(msg.Append("step")),
|
||||||
})
|
})
|
||||||
|
can.page.Select(can, sub._output, "td", function(td) {
|
||||||
|
if (td.innerText == msg.Option("name")) {
|
||||||
|
can.page.ClassList.add(can, td, "done")
|
||||||
|
}
|
||||||
|
})
|
||||||
can.Timer(1000, function() {
|
can.Timer(1000, function() {
|
||||||
var res = sub.request({})
|
var res = sub.request({})
|
||||||
|
res.Option("_progress", msg.Option("_progress"))
|
||||||
sub.run(res._event, cmds, cb, silent)
|
sub.run(res._event, cmds, cb, silent)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -87,14 +87,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
},
|
},
|
||||||
_process: function(can, msg) {
|
_process: function(can, msg) {
|
||||||
var process = msg.Option("_process") || can.Conf("feature")["_process"]
|
var process = msg.Option("_process") || can.Conf("feature")["_process"]
|
||||||
var cb = can.onaction[process]; typeof cb == "function" && cb(can, msg)
|
var cb = can.onaction[process]; return typeof cb == "function" && cb(can, msg)
|
||||||
return
|
|
||||||
if (can.onimport._progress(can, msg)) {
|
|
||||||
return true
|
|
||||||
}; can.onimport._refresh(can, msg)
|
|
||||||
},
|
},
|
||||||
_progress: function(can, msg) {
|
_progress: function(can, msg) {
|
||||||
return
|
|
||||||
var progress = msg.Option("_progress") || can.Conf("feature")["_progress"]
|
var progress = msg.Option("_progress") || can.Conf("feature")["_progress"]
|
||||||
if (progress) {
|
if (progress) {
|
||||||
can.page.Select(can, can._output, "td", function(td) {
|
can.page.Select(can, can._output, "td", function(td) {
|
||||||
@ -102,6 +97,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
can.page.Modify(can, td, {style: {"background-color": "green"}})
|
can.page.Modify(can, td, {style: {"background-color": "green"}})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// can.Timer(1000, function() { can.run() })
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user