refactor: 根据最新的lgbSelect重构Dicts Menus页面

This commit is contained in:
Argo Zhang 2019-07-26 13:18:36 +08:00
parent 0a943114eb
commit 21c8080a1f
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
3 changed files with 54 additions and 103 deletions

View File

@ -29,17 +29,12 @@
</div> </div>
<div class="form-group col-sm-6 col-md-auto"> <div class="form-group col-sm-6 col-md-auto">
<label class="control-label" for="txt_dict_define">字典类别</label> <label class="control-label" for="txt_dict_define">字典类别</label>
<div class="form-select" data-toggle="lgbSelect"> <input class="form-control" data-toggle="lgbSelect" />
<input type="hidden" data-toggle="lgbSelect" id="txt_dict_define" /> <select data-toggle="lgbSelect" class="d-none" id="txt_dict_define">
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="">全部</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="0">系统使用</option>
<div class="dropdown-menu-arrow"></div> <option value="1">自定义</option>
<div class="dropdown-menu"> </select>
<a class="dropdown-item" href="#" data-val="">全部</a>
<a class="dropdown-item" href="#" data-val="0">系统使用</a>
<a class="dropdown-item" href="#" data-val="1">自定义</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6 col-md-auto flex-sm-fill justify-content-sm-end align-self-sm-end"> <div class="form-group col-sm-6 col-md-auto flex-sm-fill justify-content-sm-end align-self-sm-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
@ -67,16 +62,11 @@
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="dictDefine">字典类型</label> <label class="control-label" for="dictDefine">字典类型</label>
<div class="form-select" data-toggle="lgbSelect"> <input class="form-control" data-toggle="lgbSelect" />
<input type="hidden" data-toggle="lgbSelect" id="dictDefine" data-default-val="1" /> <select data-toggle="lgbSelect" class="d-none" data-default-val="1" id="dictDefine">
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="0">系统使用</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="1">自定义</option>
<div class="dropdown-menu-arrow"></div> </select>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-val="0">系统使用</a>
<a class="dropdown-item" href="#" data-val="1">自定义</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="dictName">字典名称</label> <label class="control-label" for="dictName">字典名称</label>

View File

@ -43,47 +43,33 @@
</div> </div>
<div class="form-group col-sm-6 col-lg-auto"> <div class="form-group col-sm-6 col-lg-auto">
<label class="control-label" for="sel_menus_category">菜单类别</label> <label class="control-label" for="sel_menus_category">菜单类别</label>
<div class="form-select" data-toggle="lgbSelect"> <input class="form-control" data-toggle="lgbSelect" />
<input type="hidden" data-toggle="lgbSelect" id="sel_menus_category" /> <select data-toggle="lgbSelect" class="d-none" id="sel_menus_category">
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="">全部</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="0">系统菜单</option>
<div class="dropdown-menu-arrow"></div> <option value="1">外部菜单</option>
<div class="dropdown-menu"> </select>
<a class="dropdown-item" href="#" data-val="">全部</a>
<a class="dropdown-item" href="#" data-val="0">系统菜单</a>
<a class="dropdown-item" href="#" data-val="1">外部菜单</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6 col-lg-auto"> <div class="form-group col-sm-6 col-lg-auto">
<label class="control-label" for="sel_menus_res">菜单类型</label> <label class="control-label" for="sel_menus_res">菜单类型</label>
<div class="form-select" data-toggle="lgbSelect"> <input class="form-control" data-toggle="lgbSelect" />
<input type="hidden" data-toggle="lgbSelect" id="sel_menus_res" /> <select data-toggle="lgbSelect" class="d-none" id="sel_menus_res">
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="">全部</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="0">菜单</option>
<div class="dropdown-menu-arrow"></div> <option value="1">资源</option>
<div class="dropdown-menu"> <option value="2">按钮</option>
<a class="dropdown-item" href="#" data-val="">全部</a> </select>
<a class="dropdown-item" href="#" data-val="0">菜单</a>
<a class="dropdown-item" href="#" data-val="1">资源</a>
<a class="dropdown-item" href="#" data-val="2">按钮</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6 col-lg-auto"> <div class="form-group col-sm-6 col-lg-auto">
<label class="control-label" for="sel_app">所属应用</label> <label class="control-label" for="sel_app">所属应用</label>
<div class="form-select" data-toggle="lgbSelect"> <input class="form-control" data-toggle="lgbSelect" />
<input type="hidden" data-toggle="lgbSelect" id="sel_app" data-default-val="0" /> <select data-toggle="lgbSelect" class="d-none" id="sel_app">
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="">全部</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> @foreach (var kv in Model.Applications)
<div class="dropdown-menu-arrow"></div> {
<div class="dropdown-menu"> <option value="@kv.Key">@kv.Value</option>
@foreach (var kv in Model.Applications) }
{ </select>
<a class="dropdown-item" href="#" data-val="@kv.Key">@kv.Value</a>
}
</div>
</div>
</div> </div>
<div class="form-group col-sm-6 col-lg-auto flex-sm-fill justify-content-sm-end align-self-sm-end"> <div class="form-group col-sm-6 col-lg-auto flex-sm-fill justify-content-sm-end align-self-sm-end">
<button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button> <button type="button" id="btn_query" class="btn btn-primary btn-fill"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
@ -162,61 +148,36 @@
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="category">菜单类别</label> <label class="control-label" for="category">菜单类别</label>
<div class="form-select" data-toggle="lgbSelect"> <select data-toggle="lgbSelect" class="d-none" data-default-val="1" id="category">
<input type="hidden" data-toggle="lgbSelect" id="category" data-default-val="1" /> <option value="0">系统菜单</option>
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="1">外部菜单</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> </select>
<div class="dropdown-menu-arrow"></div>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-val="">全部</a>
<a class="dropdown-item" href="#" data-val="0">系统菜单</a>
<a class="dropdown-item" href="#" data-val="1">外部菜单</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="target">目标</label> <label class="control-label" for="target">目标</label>
<div class="form-select" data-toggle="lgbSelect"> <select data-toggle="lgbSelect" class="d-none" data-default-val="_self" id="target">
<input type="hidden" data-toggle="lgbSelect" id="target" data-default-val="_self" /> <option value="_self">本窗口</option>
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="_blank">新窗口</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="_parent">父级窗口</option>
<div class="dropdown-menu-arrow"></div> <option value="_top">顶级窗口</option>
<div class="dropdown-menu"> </select>
<a class="dropdown-item" href="#" data-val="_self">本窗口</a>
<a class="dropdown-item" href="#" data-val="_blank">新窗口</a>
<a class="dropdown-item" href="#" data-val="_parent">父级窗口</a>
<a class="dropdown-item" href="#" data-val="_top">顶级窗口</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="isRes">菜单类型</label> <label class="control-label" for="isRes">菜单类型</label>
<div class="form-select" data-toggle="lgbSelect"> <select data-toggle="lgbSelect" class="d-none" data-default-val="0" id="isRes">
<input type="hidden" data-toggle="lgbSelect" id="isRes" data-default-val="0" /> <option value="0">菜单</option>
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> <option value="1">资源</option>
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="2">按钮</option>
<div class="dropdown-menu-arrow"></div> </select>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-val="0">菜单</a>
<a class="dropdown-item" href="#" data-val="1">资源</a>
<a class="dropdown-item" href="#" data-val="2">按钮</a>
</div>
</div>
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="app">所属应用</label> <label class="control-label" for="app">所属应用</label>
<div class="form-select" data-toggle="lgbSelect"> <select data-toggle="lgbSelect" class="d-none" data-default-val="0" id="app">
<input type="hidden" data-toggle="lgbSelect" id="app" data-default-val="0" /> @foreach (var kv in Model.Applications)
<input type="text" readonly="readonly" class="form-control form-select-input" placeholder="请选择 ..."> {
<span class="form-select-append"><i class="fa fa-angle-up"></i></span> <option value="@kv.Key">@kv.Value</option>
<div class="dropdown-menu-arrow"></div> }
<div class="dropdown-menu"> </select>
@foreach (var kv in Model.Applications)
{
<a class="dropdown-item" href="#" data-val="@kv.Key">@kv.Value</a>
}
</div>
</div>
</div> </div>
</div> </div>
</form> </form>

View File

@ -420,7 +420,7 @@
else { else {
var data = []; var data = [];
this.lgbSelect('get', function (source) { data = source; }); this.lgbSelect('get', function (source) { data = source; });
var find = data.filter(function () { return this.value === value; }); var find = data.filter(function (item, index) { return item.value === value; });
if (find.length === 1) text = find[0].text; if (find.length === 1) text = find[0].text;
} }
} }