mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-02-08 06:05:36 +08:00
支持套餐相关操作
This commit is contained in:
33
web/public/js/components/server/user-selector.js
Normal file
33
web/public/js/components/server/user-selector.js
Normal file
@@ -0,0 +1,33 @@
|
||||
Vue.component("user-selector", {
|
||||
mounted: function () {
|
||||
let that = this
|
||||
|
||||
Tea.action("/servers/users/options")
|
||||
.post()
|
||||
.success(function (resp) {
|
||||
that.users = resp.data.users
|
||||
})
|
||||
},
|
||||
props: ["v-user-id"],
|
||||
data: function () {
|
||||
let userId = this.vUserId
|
||||
if (userId == null) {
|
||||
userId = 0
|
||||
}
|
||||
return {
|
||||
users: [],
|
||||
userId: userId
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
userId: function (v) {
|
||||
this.$emit("change", v)
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<select class="ui dropdown auto-width" name="userId" v-model="userId">
|
||||
<option value="0">[选择用户]</option>
|
||||
<option v-for="user in users" :value="user.id">{{user.fullname}} ({{user.username}})</option>
|
||||
</select>
|
||||
</div>`
|
||||
})
|
||||
@@ -4,22 +4,50 @@
|
||||
<div class="margin"></div>
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table selectable definition">
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">服务名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="60" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>选择用户</td>
|
||||
<td>
|
||||
<user-selector @change="changeUserId"></user-selector>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="plans.length > 0">
|
||||
<td>选择套餐</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="userPlanId">
|
||||
<option value="0">[选择套餐]</option>
|
||||
<option v-for="plan in plans" :value="plan.id">{{plan.name}}({{plan.dayTo}})</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>部署的集群 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<p class="comment">当前服务将会部署到所选集群的节点上。</p>
|
||||
<div v-if="userId == 0">
|
||||
<select class="ui dropdown auto-width" name="clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<p class="comment">当前服务将会部署到所选集群的节点上。</p>
|
||||
</div>
|
||||
<div v-else>跟随用户设置。</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 域名 -->
|
||||
<tr v-if="serverType == 'httpProxy' || serverType == 'httpWeb'">
|
||||
<td>绑定域名</td>
|
||||
<td>
|
||||
<server-name-box></server-name-box>
|
||||
<p class="comment">绑定后,才能通过域名可以访问不同的服务。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>服务类型 *</td>
|
||||
<td>
|
||||
@@ -36,15 +64,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 域名 -->
|
||||
<tr v-if="serverType == 'httpProxy' || serverType == 'httpWeb'">
|
||||
<td>绑定域名</td>
|
||||
<td>
|
||||
<server-name-box></server-name-box>
|
||||
<p class="comment">绑定后,才能通过域名可以访问不同的服务。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 证书 -->
|
||||
<tbody v-if="tlsProtocolName.length > 0">
|
||||
<tr>
|
||||
@@ -113,5 +132,6 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -46,4 +46,27 @@ Tea.context(function () {
|
||||
this.tlsProtocolName = "https"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
this.userId = 0
|
||||
this.plans = []
|
||||
|
||||
this.changeUserId = function (v) {
|
||||
this.userId = v
|
||||
|
||||
if (this.userId == 0) {
|
||||
this.plans = []
|
||||
return
|
||||
}
|
||||
|
||||
this.$post("/servers/users/plans")
|
||||
.params({
|
||||
userId: this.userId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.plans = resp.data.plans
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -19,6 +19,15 @@
|
||||
<input type="text" name="name" maxlength="60" ref="focus" v-model="server.name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="plans.length > 0">
|
||||
<td>选择套餐</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="userPlanId" v-model="userPlanId">
|
||||
<option value="0">[选择套餐]</option>
|
||||
<option v-for="plan in plans" :value="plan.id">{{plan.name}}({{plan.dayTo}})</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>部署的集群 *</td>
|
||||
<td>
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
this.userId = 0
|
||||
this.plans = []
|
||||
this.userPlanId = 0
|
||||
|
||||
if (this.userPlan != null) {
|
||||
this.userPlanId = this.userPlan.id
|
||||
}
|
||||
|
||||
this.changeUserId = function (v) {
|
||||
this.userId = v
|
||||
|
||||
if (this.userId == 0) {
|
||||
this.plans = []
|
||||
return
|
||||
}
|
||||
|
||||
this.$post("/servers/users/plans")
|
||||
.params({
|
||||
userId: this.userId,
|
||||
serverId: this.serverId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.plans = resp.data.plans
|
||||
})
|
||||
}
|
||||
|
||||
if (this.user != null) {
|
||||
this.changeUserId(this.user.id)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user