Files
EdgeAdmin/web/views/@default/nodes/create.js

79 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-07-29 19:34:54 +08:00
Tea.context(function () {
2020-08-21 21:09:42 +08:00
this.success = NotifySuccess("保存成功", "/nodes");
// IP地址相关
this.ipAddresses = [];
// 添加IP地址
this.addIPAddress = function () {
teaweb.popup("/nodes/ipAddresses/createPopup", {
callback: function (resp) {
this.ipAddresses.push(resp.data.ipAddress);
}
})
};
// 修改地址
this.updateIPAddress = function (index, address) {
teaweb.popup("/nodes/ipAddresses/updatePopup?addressId=" + address.id, {
callback: function (resp) {
Vue.set(this.ipAddresses, index, resp.data.ipAddress);
}
})
}
// 删除IP地址
this.removeIPAddress = function (index) {
this.ipAddresses.$remove(index);
};
// 授权相关
2020-07-30 22:41:35 +08:00
this.grantId = 0;
this.grant = null;
2020-08-21 21:09:42 +08:00
// 选择授权
2020-07-30 22:41:35 +08:00
this.selectGrant = function () {
var that = this;
teaweb.popup("/nodes/grants/selectPopup", {
callback: function (resp) {
that.grantId = resp.data.grant.id;
if (that.grantId > 0) {
that.grant = resp.data.grant;
}
}
});
};
2020-08-21 21:09:42 +08:00
// 创建授权
2020-07-30 22:41:35 +08:00
this.createGrant = function () {
teaweb.popup("/nodes/grants/createPopup", {
height: "31em",
callback: function (resp) {
2020-08-21 21:09:42 +08:00
this.grantId = resp.data.grant.id;
if (this.grantId > 0) {
this.grant = resp.data.grant;
2020-07-30 22:41:35 +08:00
}
}
});
};
2020-08-21 21:09:42 +08:00
// 修改授权
this.updateGrant = function () {
if (this.grant == null) {
window.location.reload();
return;
}
teaweb.popup("/nodes/grants/updatePopup?grantId=" + this.grant.id, {
height: "31em",
callback: function (resp) {
this.grant = resp.data.grant;
}
})
};
// 删除已选择授权
2020-07-30 22:41:35 +08:00
this.removeGrant = function () {
this.grant = null;
this.grantId = 0;
};
2020-07-29 19:34:54 +08:00
});