可以在分组中设置一些全局配置选项

This commit is contained in:
GoEdgeLab
2021-09-22 19:39:38 +08:00
parent dd36ba5686
commit 765b030477
66 changed files with 1698 additions and 214 deletions

View File

@@ -1,14 +0,0 @@
{$layout "layout_popup"}
<h3>创建分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,37 +0,0 @@
{$layout}
<first-menu>
<menu-item href="/servers/components/groups" active="true">列表</menu-item>
<span class="item">|</span>
<a href="" class="item" @click.prevent="createGroup()">[创建]</a>
</first-menu>
<p class="comment" v-if="groups.length == 0">暂时还没有分组。</p>
<div v-show="groups.length > 0">
<div class="margin"></div>
<table class="ui table selectable celled" id="sortable-table">
<thead>
<tr>
<th style="width:3em"></th>
<th>分组名称</th>
<th class="center width10">服务数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td>{{group.name}}</td>
<td class="center">
<a :href="'/servers?groupId=' + group.id" v-if="group.countServers > 0">{{group.countServers}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a href="" @click.prevent="updateGroup(group.id)">修改</a> &nbsp; <a href="" @click.prevent="deleteGroup(group.id)">删除</a>
</td>
</tr>
</tbody>
</table>
</div>
<p v-if="groups.length > 0" class="comment">可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -1,53 +0,0 @@
Tea.context(function () {
this.$delay(function () {
let that = this
sortTable(function () {
let groupIds = []
document.querySelectorAll("*[data-group-id]").forEach(function (element) {
groupIds.push(element.getAttribute("data-group-id"))
})
that.$post("/servers/components/groups/sort")
.params({
groupIds: groupIds
})
.success(function () {
teaweb.successToast("保存成功")
})
})
})
this.createGroup = function () {
teaweb.popup("/servers/components/groups/createPopup", {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateGroup = function (groupId) {
teaweb.popup("/servers/components/groups/updatePopup?groupId=" + groupId, {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteGroup = function (groupId) {
let that = this
teaweb.confirm("确定要删除这个分组吗?", function () {
that.$post("/servers/components/groups/delete")
.params({
groupId: groupId
})
.success(function () {
teaweb.success("删除成功", function () {
teaweb.reload()
})
})
})
}
})

View File

@@ -1,22 +0,0 @@
{$layout "layout_popup"}
<h3>选择分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="groupId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">选择分组</td>
<td>
<div v-if="groups.length > 0">
<a href="" class="ui label small basic" v-for="group in groups" :class="{blue:group.id == groupId}" style="margin-bottom:0.5em" @click.prevent="selectGroup(group)">{{group.name}}</a>
<p class="comment">点击可已选中要使用的分组。</p>
</div>
<div v-else>
<p class="comment">暂时还没有可以使用的分组。</p>
</div>
</td>
</tr>
</table>
<submit-btn>确定</submit-btn>
</form>

View File

@@ -1,8 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
this.groupId = 0
this.selectGroup = function (group) {
this.groupId = group.id
}
})

View File

@@ -1,15 +0,0 @@
{$layout "layout_popup"}
<h3>修改分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus" v-model="group.name"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>