任务列表搜索列表框优化刷新
This commit is contained in:
@@ -494,17 +494,22 @@ func (self *TaskController) Table() {
|
|||||||
limit = 30
|
limit = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
groupId, _ := self.GetInt("group_id", 0)
|
groupId, _ := self.GetInt("group_id", -1)
|
||||||
|
|
||||||
if groupId > 0 {
|
//0-全部,-1如果存在,n,如果不存在,0
|
||||||
self.Ctx.SetCookie("groupid", strconv.Itoa(groupId)+"|job")
|
|
||||||
} else {
|
if groupId == -1 {
|
||||||
|
groupId = 0
|
||||||
arr := strings.Split(self.Ctx.GetCookie("groupid"), "|")
|
arr := strings.Split(self.Ctx.GetCookie("groupid"), "|")
|
||||||
if len(arr) > 0 {
|
if len(arr) > 0 {
|
||||||
groupId, _ = strconv.Atoi(arr[0])
|
groupId, _ = strconv.Atoi(arr[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if groupId > 0 {
|
||||||
|
self.Ctx.SetCookie("groupid", strconv.Itoa(groupId)+"|job")
|
||||||
|
}
|
||||||
|
|
||||||
status, _ := self.GetInt("status")
|
status, _ := self.GetInt("status")
|
||||||
|
|
||||||
taskName := strings.TrimSpace(self.GetString("taskName"))
|
taskName := strings.TrimSpace(self.GetString("taskName"))
|
||||||
@@ -528,10 +533,8 @@ func (self *TaskController) Table() {
|
|||||||
ids := []int{0, 1}
|
ids := []int{0, 1}
|
||||||
filters = append(filters, "status__in", ids)
|
filters = append(filters, "status__in", ids)
|
||||||
}
|
}
|
||||||
|
//搜索全部
|
||||||
if groupId > 0 {
|
if groupId == 0 {
|
||||||
filters = append(filters, "group_id", groupId)
|
|
||||||
} else {
|
|
||||||
if self.userId != 1 {
|
if self.userId != 1 {
|
||||||
groups := strings.Split(self.taskGroups, ",")
|
groups := strings.Split(self.taskGroups, ",")
|
||||||
|
|
||||||
@@ -542,8 +545,9 @@ func (self *TaskController) Table() {
|
|||||||
}
|
}
|
||||||
filters = append(filters, "group_id__in", groupsIds)
|
filters = append(filters, "group_id__in", groupsIds)
|
||||||
}
|
}
|
||||||
|
} else if groupId > 0 {
|
||||||
|
filters = append(filters, "group_id", groupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if taskName != "" {
|
if taskName != "" {
|
||||||
filters = append(filters, "task_name__icontains", taskName)
|
filters = append(filters, "task_name__icontains", taskName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
{{/*<label class="layui-form-label">搜索选择框</label>*/}}
|
{{/*<label class="layui-form-label">搜索选择框</label>*/}}
|
||||||
<div class="layui-input-inline" style="text-align: left">
|
<div class="layui-input-inline" style="text-align: left">
|
||||||
<select name="modules" lay-verify="required" lay-filter="select_group" id="group_id" lay-search="">
|
<select name="modules" lay-verify="required" lay-filter="select_group" id="group_id" lay-search="">
|
||||||
<option value="">直接选择或搜索选择</option>
|
<option value="0">全部</option>
|
||||||
{{range $k, $v := .taskGroup}}
|
{{range $k, $v := .taskGroup}}
|
||||||
<option value="{{$k}}" {{if eq $k $.groupId}} selected {{end}}>{{$v}}</option>
|
<option value="{{$k}}" {{if eq $k $.groupId}} selected {{end}}>{{$v}}</option>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -88,10 +88,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
form.on('select(select_group)', function(data){
|
form.on('select(select_group)', function(data){
|
||||||
// console.log(data.elem); //得到select原始DOM对象
|
|
||||||
// console.log(data.value); //得到被选中的值
|
|
||||||
// console.log(data.othis); //得到美化后的DOM对象
|
|
||||||
$("#reload").click()
|
$("#reload").click()
|
||||||
|
form.render('select'); //刷新select选择框渲染
|
||||||
});
|
});
|
||||||
|
|
||||||
//监听工具条
|
//监听工具条
|
||||||
|
|||||||
Reference in New Issue
Block a user