mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	网站服务列表增加用户筛选
This commit is contained in:
		@@ -27,6 +27,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	Keyword      string
 | 
			
		||||
	AuditingFlag int32
 | 
			
		||||
	CheckDNS     bool
 | 
			
		||||
	UserId       int64
 | 
			
		||||
 | 
			
		||||
	TrafficOutOrder string
 | 
			
		||||
}) {
 | 
			
		||||
@@ -36,6 +37,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	this.Data["auditingFlag"] = params.AuditingFlag
 | 
			
		||||
	this.Data["checkDNS"] = params.CheckDNS
 | 
			
		||||
	this.Data["hasOrder"] = len(params.TrafficOutOrder) > 0
 | 
			
		||||
	this.Data["userId"] = params.UserId
 | 
			
		||||
 | 
			
		||||
	isSearching := params.AuditingFlag == 1 || params.ClusterId > 0 || params.GroupId > 0 || len(params.Keyword) > 0
 | 
			
		||||
 | 
			
		||||
@@ -76,6 +78,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		ServerGroupId: params.GroupId,
 | 
			
		||||
		Keyword:       params.Keyword,
 | 
			
		||||
		AuditingFlag:  params.AuditingFlag,
 | 
			
		||||
		UserId:        params.UserId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
@@ -95,6 +98,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		AuditingFlag:   params.AuditingFlag,
 | 
			
		||||
		TrafficOutDesc: params.TrafficOutOrder == "desc",
 | 
			
		||||
		TrafficOutAsc:  params.TrafficOutOrder == "asc",
 | 
			
		||||
		UserId:         params.UserId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
@@ -288,5 +292,13 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["countNeedFixLogs"] = countNeedFixLogsResp.Count
 | 
			
		||||
 | 
			
		||||
	// 是否有用户
 | 
			
		||||
	countUsersResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["hasUsers"] = countUsersResp.Count > 0
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ func (this *OptionsAction) RunPost(params struct {
 | 
			
		||||
			"id":       user.Id,
 | 
			
		||||
			"fullname": user.Fullname,
 | 
			
		||||
			"username": user.Username,
 | 
			
		||||
			"name":     user.Fullname + "(" + user.Username + ")",
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["users"] = userMaps
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,4 @@
 | 
			
		||||
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
 | 
			
		||||
@@ -25,9 +16,6 @@ Vue.component("user-selector", {
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	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>
 | 
			
		||||
	<combo-box placeholder="选择用户" :data-url="'/servers/users/options'" :data-key="'users'" name="userId" :v-value="userId"></combo-box>
 | 
			
		||||
</div>`
 | 
			
		||||
})
 | 
			
		||||
@@ -26,20 +26,25 @@
 | 
			
		||||
                <option v-for="group in groups" :value="group.id">{{group.name}}</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field" v-if="hasUsers">
 | 
			
		||||
            <user-selector :v-user-id="userId"></user-selector>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <input type="text" name="keyword" style="width:10em" placeholder="关键词、域名等" v-model="keyword"/>
 | 
			
		||||
            <input type="text" name="keyword" style="width:14em" placeholder="关键词、域名、端口等" v-model="keyword"/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <button type="submit" class="ui button">搜索</button>
 | 
			
		||||
             
 | 
			
		||||
            <a href="/servers" v-if="clusterId > 0 || groupId > 0 || keyword.length > 0 || hasOrder">[清除条件]</a>
 | 
			
		||||
            <a href="/servers" v-if="clusterId > 0 || groupId > 0 || keyword.length > 0 || hasOrder || userId > 0">[清除条件]</a>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="ui fields inline" style="margin-top: 1em">
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <checkbox name="checkDNS" :v-value="1" v-model="checkDNS">检查域名解析</checkbox>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field" v-if="clusterId == 0 && groupId == 0 && keyword.length == 0 && latestServers.length > 0">
 | 
			
		||||
            <a href="" @click.prevent="showLatest()">常用<i class="icon angle" :class="{down: !latestVisible, up: latestVisible}"></i> </a>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <checkbox name="checkDNS" :v-value="1" v-model="checkDNS">检查域名解析</checkbox>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user