解决新增编辑隧道时重复提交问题
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
- 2026-07-04 v0.26.35
|
||||
- 修复:
|
||||
- HTTP 代理在 SVN 客户端无法正常检出 [#336](https://github.com/yisier/nps/issues/336)
|
||||
- 新增/编辑隧道时无提示且不跳转,重复点击会产生多条记录 [#334](https://github.com/yisier/nps/issues/334)
|
||||
- 优化:
|
||||
- 隧道、域名解析编辑页的客户端 ID 改为下拉选择 [#334](https://github.com/yisier/nps/issues/334)
|
||||
|
||||
- 2026-06-04 v0.26.34
|
||||
- 新增:
|
||||
|
||||
@@ -132,25 +132,29 @@ var chartdatas = {};
|
||||
var postsubmit;
|
||||
|
||||
function langreply(langstr) {
|
||||
if (!languages || !languages['content'] || !languages['content']['reply']) return langstr;
|
||||
var langobj = languages['content']['reply'][langstr.replace(/[\s,\.\?]*/g,"").toLowerCase()];
|
||||
if ($.type(langobj) == 'undefined') return langstr
|
||||
langobj = (langobj[languages['current']] || langobj[languages['default']] || langstr);
|
||||
return langobj
|
||||
}
|
||||
|
||||
var nps_submitting = false;
|
||||
function submitform(action, url, postdata) {
|
||||
if (nps_submitting) return;
|
||||
postsubmit = false;
|
||||
switch (action) {
|
||||
case 'start':
|
||||
case 'stop':
|
||||
case 'delete':
|
||||
case 'copy':
|
||||
var langobj = languages['content']['confirm'][action];
|
||||
action = (langobj[languages['current']] || langobj[languages['default']] || 'Are you sure you want to ' + action + ' it?');
|
||||
if (! confirm(action)) return;
|
||||
var confirmObj = (languages && languages['content'] && languages['content']['confirm']) ? languages['content']['confirm'][action] : null;
|
||||
var confirmMsg = (confirmObj && (confirmObj[languages['current']] || confirmObj[languages['default']])) || ('Are you sure you want to ' + action + ' it?');
|
||||
if (! confirm(confirmMsg)) return;
|
||||
postsubmit = true;
|
||||
case 'add':
|
||||
case 'edit':
|
||||
nps_submitting = true;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
@@ -164,10 +168,14 @@ function submitform(action, url, postdata) {
|
||||
window.location.href= document.referrer
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
nps_submitting = false;
|
||||
}
|
||||
});
|
||||
return;
|
||||
case 'global':
|
||||
nps_submitting = true;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
@@ -177,6 +185,9 @@ function submitform(action, url, postdata) {
|
||||
if (res.status) {
|
||||
document.location.reload();
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
nps_submitting = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
<div class="form-group" id="client_id">
|
||||
<label class="col-sm-2 control-label font-bold" langtag="word-clientid"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text"
|
||||
name="client_id" placeholder="" langtag="word-clientid">
|
||||
<select class="form-control" name="client_id" placeholder="" id="nps_client_id"
|
||||
langtag="word-belongclient"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,5 +170,27 @@
|
||||
$("#use_client").on("change", function () {
|
||||
resetForm()
|
||||
})
|
||||
|
||||
getClientList()
|
||||
})
|
||||
|
||||
function getClientList() {
|
||||
$("select[name='client_id']").empty();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/client/list", // 服务器数据的加载地址
|
||||
data: {order: "asc", offset: 0, limit: 999},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data && data.rows.length > 0) {
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
var option = "<option value=\"" + data.rows[i].Id + "\"";
|
||||
option += ">" + data.rows[i].Id + '-' + data.rows[i].Remark + "</option>"; //动态添加数据
|
||||
$("select[name='client_id']").append(option);
|
||||
$("select[name='client_id']").find("option[value='{{.t.Client.Id}}']").attr("selected", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label font-bold" langtag="word-clientid"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Client.Id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
|
||||
<select class="form-control" name="client_id" placeholder=""
|
||||
langtag="word-belongclient"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -178,6 +179,28 @@
|
||||
$("#AutoHttps").css("display", "none")
|
||||
}
|
||||
})
|
||||
|
||||
getClientList();
|
||||
})
|
||||
|
||||
function getClientList() {
|
||||
$("select[name='client_id']").empty();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/client/list", // 服务器数据的加载地址
|
||||
data: {order: "asc", offset: 0, limit: 999},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data && data.rows.length > 0) {
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
var option = "<option value=\"" + data.rows[i].Id + "\"";
|
||||
option += ">" + data.rows[i].Id + '-' + data.rows[i].Remark + "</option>"; //动态添加数据
|
||||
$("select[name='client_id']").append(option);
|
||||
$("select[name='client_id']").find("option[value='{{.h.Client.Id}}']").attr("selected", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user