99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

前端手冊(cè)

2019-03-30 14:36 更新

前端組件

若依封裝了一些常用的JS組件方法。

名稱 代碼 介紹
表格 $.table 表格封裝處理
表格樹(shù) $.treeTable 表格樹(shù)封裝處理
表單 $.form 表單封裝處理
彈出層 $.modal 彈出層封裝處理
操作 $.operate 操作封裝處理
校驗(yàn) $.validate 校驗(yàn)封裝處理
樹(shù)插件 $.tree 樹(shù)插件封裝處理
通用方法 $.common 通用方法封裝處理

通用方法

支持屬性

方法 參數(shù) 介紹
$.table.init(); options(選項(xiàng)參數(shù)) 初始化表格參數(shù)
$.table.search(); formId(表單ID) 搜索-默認(rèn)第一個(gè)form
$.table.exportExcel(); formId(表單ID) 導(dǎo)出-默認(rèn)第一個(gè)form
$.table.importExcel(); formId(表單ID) 導(dǎo)入-默認(rèn)importForm
$.table.importTemplate(); formId(表單ID) 摸版下載
$.table.refresh(); 無(wú) 刷新表格
$.table.selectColumns(); column(查詢列值) 查詢表格指定列值
$.table.selectFirstColumns(); 無(wú) 查詢表格首列值
$.table.destroy(); tableId(表格ID) 銷毀表格-默認(rèn)options.id
$.table.serialNumber(); index(序號(hào)) 序列號(hào)生成
$.table.dropdownToggle(); value(內(nèi)容) 下拉按鈕切換
$.table.showColumn(); column(列值) 顯示表格特定的列
$.table.hideColumn(); column(列值) 隱藏表格特定的列
$.table.tooltip(); value(內(nèi)容), length(截取長(zhǎng)度) 超出指定長(zhǎng)度浮動(dòng)提示
$.table.selectDictLabel(); datas(字典列表), value(當(dāng)前值) 回顯數(shù)據(jù)字典
$.treeTable.init(); options(選項(xiàng)參數(shù)) 初始化表格樹(shù)參數(shù)
$.treeTable.search(); formId(表單ID) 搜索-默認(rèn)第一個(gè)form
$.treeTable.refresh(); 無(wú) 刷新表格樹(shù)
$.form.reset(); formId(表單ID) 表單重置
$.form.selectCheckeds(); name(name名稱) 獲取選中復(fù)選框項(xiàng)
$.form.selectSelects(); name(id名稱) 獲取選中下拉框項(xiàng)
$.modal.icon type(圖標(biāo)類型) 顯示圖標(biāo)
$.modal.msg content(內(nèi)容), type(圖標(biāo)類型) 消息提示
$.modal.msgError(); content(內(nèi)容) 錯(cuò)誤消息
$.modal.msgSuccess(); content(內(nèi)容) 成功消息
$.modal.msgWarning(); content(內(nèi)容) 警告消息
$.modal.alert content(內(nèi)容), type(圖標(biāo)類型) 消息提示
$.modal.msgReload msg(消息), type(圖標(biāo)類型) 消息提示并刷新父窗體
$.modal.alertError(); content(內(nèi)容) 錯(cuò)誤提示
$.modal.alertSuccess(); content(內(nèi)容) 成功提示
$.modal.alertWarning(); content(內(nèi)容) 警告提示
$.modal.close(); 無(wú) 關(guān)閉窗體
$.modal.closeAll 無(wú) 關(guān)閉全部窗體
$.modal.confirm(); content(內(nèi)容), callBack(回調(diào)函數(shù)) 確認(rèn)窗體
$.modal.open(); title, url, width, height, callBack(回調(diào)函數(shù)) 彈出層指定寬度
$.modal.openOptions(); options(選項(xiàng)參數(shù)) 彈出層指定參數(shù)選項(xiàng)
$.modal.openFull(); title, url, width, height 彈出層全屏
$.modal.openTab title(標(biāo)題), url(地址) 選卡頁(yè)方式打開(kāi)
$.modal.disable 無(wú) 禁用按鈕
$.modal.enable 無(wú) 啟用按鈕
$.modal.loading(); message(提示消息) 打開(kāi)遮罩層
$.modal.closeLoading(); 無(wú) 關(guān)閉遮罩層
$.modal.reload(); 無(wú) 重新加載
$.operate.submit(); url, type, dataType, data 提交數(shù)據(jù)
$.operate.post(); url(地址), data(數(shù)據(jù)) post方式請(qǐng)求提交數(shù)據(jù)
$.operate.get(); url(地址) get請(qǐng)求傳輸數(shù)據(jù)
$.operate.detail(); id(數(shù)據(jù)ID) 詳細(xì)信息
$.operate.remove(); id(數(shù)據(jù)ID) 刪除信息
$.operate.removeAll(); 無(wú) 批量刪除信息
$.operate.clean(); 無(wú) 清空信息
$.operate.add(); id(數(shù)據(jù)ID) 添加信息
$.operate.addTab(); id(數(shù)據(jù)ID) 添加信息(選項(xiàng)卡方式)
$.operate.addFull(); id(數(shù)據(jù)ID) 添加信息 全屏
$.operate.addUrl(); id(數(shù)據(jù)ID) 添加訪問(wèn)地址
$.operate.edit(); id(數(shù)據(jù)ID) 修改信息
$.operate.editTab(); id(數(shù)據(jù)ID) 修改信息(選項(xiàng)卡方式)
$.operate.editFull(); id(數(shù)據(jù)ID) 修改信息 全屏
$.operate.editUrl(); id(數(shù)據(jù)ID) 修改訪問(wèn)地址
$.operate.save(); url(地址), data(數(shù)據(jù)) 保存信息
$.operate.saveTab(); url(地址), data(數(shù)據(jù)) 保存選項(xiàng)卡信息
$.operate.ajaxSuccess(); result(返回結(jié)果) 保存結(jié)果彈出msg刷新table表格
$.operate.saveSuccess(); result(返回結(jié)果) 保存結(jié)果提示msg
$.operate.successCallback(); result(返回結(jié)果) 成功回調(diào)執(zhí)行事件(靜默更新)
$.operate.successTabCallback(); result(返回結(jié)果) 選項(xiàng)卡成功回調(diào)執(zhí)行事件(靜默更新)
$.validate.unique(); value(返回標(biāo)識(shí)) 判斷返回標(biāo)識(shí)是否唯一
$.validate.form(); formId(表單ID) 表單驗(yàn)證-默認(rèn)第一個(gè)form
$.tree.init(); options(選項(xiàng)參數(shù)) 初始化樹(shù)結(jié)構(gòu)
$.tree.searchNode(); 無(wú) 搜索節(jié)點(diǎn)
$.tree.selectByIdName(); treeId, treeName, node 根據(jù)Id和Name選中指定節(jié)點(diǎn)
$.tree.showAllNode(); nodes(全部節(jié)點(diǎn)數(shù)據(jù)) 顯示所有節(jié)點(diǎn)
$.tree.hideAllNode(); nodes(全部節(jié)點(diǎn)數(shù)據(jù)) 隱藏所有節(jié)點(diǎn)
$.tree.showParent(); treeNode(節(jié)點(diǎn)數(shù)據(jù)) 顯示所有父節(jié)點(diǎn)
$.tree.showChildren(); treeNode(節(jié)點(diǎn)數(shù)據(jù)) 顯示所有孩子節(jié)點(diǎn)
$.tree.updateNodes(); nodeList(全部節(jié)點(diǎn)數(shù)據(jù)) 更新節(jié)點(diǎn)狀態(tài)
$.tree.getCheckedNodes(); column(列值) 獲取當(dāng)前被勾選集合
$.tree.notAllowParents(); _tree(樹(shù)對(duì)象) 不允許根父節(jié)點(diǎn)選擇
$.tree.toggleSearch(); 無(wú) 隱藏/顯示搜索欄
$.tree.collapse(); 無(wú) 樹(shù)折疊
$.tree.expand(); 無(wú) 樹(shù)展開(kāi)
$.common.isEmpty(); value(值) 判斷字符串是否為空
$.common.isNotEmpty(); value(值) 判斷一個(gè)字符串是否為非空串
$.common.nullToStr(); value(值) 空對(duì)象轉(zhuǎn)字符串
$.common.visible(); value(值) 是否顯示數(shù)據(jù) 為空默認(rèn)為顯示
$.common.trim(); value(值) 空格截取
$.common.random(); min(最?。? max(最大) 指定隨機(jī)數(shù)返回
$.common.startWith(); value(值), start(開(kāi)始值) 判斷字符串是否是以start開(kāi)頭
$.common.endWith(); value(值), end(結(jié)束值) 判斷字符串是否是以end結(jié)尾

表格使用

表格組件基于bootstrap table組件進(jìn)行封裝,輕松實(shí)現(xiàn)數(shù)據(jù)表格。

  • 表格初始化 $.table.init

表的各項(xiàng)(Table options )

參數(shù) 類型 默認(rèn)值 描述
url String Null 請(qǐng)求后臺(tái)的URL
uniqueId String Null 指定唯一列屬性  配合刪除/修改使用 未指定則使用表格行首列
createUrl String Null 新增URL 配合使用 $.operate.add(),$.operate.addTab()
updateUrl String Null 修改URL 配合使用 $.operate.edit(),$.operate.editTab()
removeUrl String Null 刪除URL 配合使用 $.operate.remove()
exportUrl String Null 導(dǎo)出URL 配合使用 $.table.exportExcel()
importUrl String Null 導(dǎo)入U(xiǎn)RL 配合使用 $.table.importExcel()
detailUrl String Null 詳細(xì)URL 配合使用 $.operate.detail()
cleanUrl String Null 清空URL 配合使用 $.operate.clean()
importTemplateUrl String Null 摸版URL 配合使用 $.table.importTemplate()
height String undefined 表格的高度
striped String false 是否顯示行間隔色
sortName String Null 排序列名稱
sortOrder String Null 排序方式 asc 或者 desc
pagination Boolean true 默認(rèn)為true表格的底部工具欄會(huì)顯示分頁(yè)條,設(shè)為false不顯示
pageSize int 10 每頁(yè)的記錄行數(shù)(*)
id String bootstrap-table 表格ID屬性
toolbar String toolbar 表格工具欄ID屬性
escape Boolean false 是否轉(zhuǎn)義HTML字符串
showFooter Boolean false 默認(rèn)為false隱藏表尾,設(shè)為true顯示
sidePagination String server server啟用服務(wù)端分頁(yè)client客戶端分頁(yè)
search Boolean true 默認(rèn)為true顯示搜索框功能,設(shè)為false隱藏
showSearch Boolean true 默認(rèn)為true顯示檢索信息,設(shè)為false隱藏
showPageGo Boolean false 默認(rèn)為false不顯示跳轉(zhuǎn)頁(yè),設(shè)為true顯示
showRefresh Boolean true 默認(rèn)為true顯示刷新按鈕,設(shè)為false隱藏
showColumns Boolean true 默認(rèn)為true顯示某列下拉菜單,設(shè)為false隱藏
showToggle Boolean true 默認(rèn)為true顯示視圖切換按鈕,設(shè)為false隱藏
showExport Boolean true 默認(rèn)為true顯示導(dǎo)出文件按鈕,設(shè)為false隱藏
clickToSelect Boolean false 默認(rèn)為false不啟用點(diǎn)擊選中行,設(shè)為true啟用
fixedColumns Boolean false 默認(rèn)為false禁用凍結(jié)列,設(shè)為true啟用凍結(jié)列(左側(cè))
fixedNumber int 0 凍結(jié)列的個(gè)數(shù),當(dāng)fixedColumns設(shè)為true有效(左側(cè))
rightFixedColumns Boolean false 默認(rèn)為false禁用凍結(jié)列,設(shè)為true啟用凍結(jié)列(右側(cè))
rightFixedNumber int 0 凍結(jié)列的個(gè)數(shù),當(dāng)fixedColumns設(shè)為true有效(右側(cè))
params Array Null 當(dāng)請(qǐng)求數(shù)據(jù)時(shí),你可以通過(guò)修改queryParams向服務(wù)器發(fā)送參數(shù)
columns Array Null 默認(rèn)空數(shù)組,在JS里面定義 參考列的各項(xiàng)(Column options )
responseHandler Array Null 在加載服務(wù)器發(fā)送來(lái)的數(shù)據(jù)之前,處理數(shù)據(jù)的格式
onLoadSuccess Array Null 當(dāng)所有數(shù)據(jù)被加載時(shí)觸發(fā)處理函數(shù)

列的各項(xiàng)(Column options )

參數(shù) 類型 默認(rèn)值 描述
radio Boolean false 默認(rèn)false不顯示radio(單選按鈕),設(shè)為true則顯示,radio寬度是固定的
checkbox Boolean false 默認(rèn)false不顯示checkbox(復(fù)選框),設(shè)為true則顯示,checkbox的每列寬度已固定
field String Null 是每列的字段名,不是表頭所顯示的名字,通過(guò)這個(gè)字段名可以給其賦值,相當(dāng)于key,表內(nèi)唯一
title String Null 這個(gè)是表頭所顯示的名字,不唯一,如果你喜歡,可以把所有表頭都設(shè)為相同的名字
titleTooltip String true 當(dāng)懸浮在某控件上,出現(xiàn)提示 - 參考 Bootstrap 提示工具(Tooltip)插件
class boolean false 表格列樣式
rowspan Number true 每格所占的行數(shù)
colspan Number true 每格所占的列數(shù)
align String true 每格內(nèi)數(shù)據(jù)的對(duì)齊方式,有:left(靠左)、right(靠右)、center(居中)
halign String true table header(表頭)的對(duì)齊方式,有:left(靠左)、right(靠右)、center(居中)
falign String true table footer(表腳,的對(duì)齊方式,有:left(靠左)、right(靠右)、center(居中)
valign String true 每格數(shù)據(jù)的對(duì)齊方式,有:top(靠上)、middle(居中)、bottom(靠下)
width Number Null 每列的寬度。如果沒(méi)有自定義寬度自適應(yīng)
sortable Boolean false 默認(rèn)false就默認(rèn)顯示,設(shè)為true則會(huì)被排序
order String asc 默認(rèn)的排序方式為"asc(升序)",也可以設(shè)為"desc(降序)"。
visible Boolean true 默認(rèn)為true顯示該列,設(shè)為false則隱藏該列
cardVisible Boolean true 默認(rèn)為true顯示該列,設(shè)為false則隱藏。
switchable Boolean true 默認(rèn)為true顯示該列,設(shè)為false則禁用列項(xiàng)目的選項(xiàng)卡。
clickToSelect Boolean true 默認(rèn)true不響應(yīng),設(shè)為false則當(dāng)點(diǎn)擊此行的某處時(shí),不會(huì)自動(dòng)選中此行的checkbox(復(fù)選框)或radiobox(單選按鈕)
formatter Function Null 某格的數(shù)據(jù)轉(zhuǎn)換函數(shù),需要三個(gè)參數(shù): -value: field(字段名) -row:行的數(shù)據(jù)  -index:行的(索引)index
footerFormatter Function Null 某格的數(shù)據(jù)轉(zhuǎn)換函數(shù),需要一個(gè)參數(shù): -data: 所有行數(shù)據(jù)的數(shù)組 函數(shù)需要返回(return)footer某格內(nèi)所要顯示的字符串的格式
events Object Null 當(dāng)某格使用formatter函數(shù)時(shí),事件監(jiān)聽(tīng)會(huì)響應(yīng),需要四個(gè)參數(shù): -event:-value:字段名 -row:行數(shù)據(jù) -index:此行的index
sorter Function Null 自定義的排序函數(shù),實(shí)現(xiàn)本地排序,需要兩個(gè)參數(shù): - a:第一個(gè)字段名  - b:第二個(gè)字段名
sortName String Null 排序列名稱
cellStyle Function Null 對(duì)某列中顯示樣式改變
searchable Boolean true 默認(rèn)true,表示此列數(shù)據(jù)可被查詢
searchFormatter Boolean true 默認(rèn)true,可使用格式化的數(shù)據(jù)查詢
escape Boolean false 是否轉(zhuǎn)義HTML字符串

  • 表單搜索 $.table.search
    <a onclick="$.table.search();">搜索</a>

  • 表格數(shù)據(jù)導(dǎo)出 $.table.exportExcel
    <a onclick="$.table.exportExcel();">導(dǎo)出</a>

  • 數(shù)據(jù)模板下載 $.table.importTemplate
    <a onclick="$.table.importTemplate();">下載模板</a>

  • 表格數(shù)據(jù)導(dǎo)入 $.table.importExcel
    <a onclick="$.table.importExcel();">導(dǎo)入</a>
    <form id="importForm" enctype="multipart/form-data" class="mt20 mb10" style="display: none;">
    <div class="col-xs-offset-1">
        <input type="file" id="file" name="file"/>
        <div class="mt10 pt5">
            <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登錄賬戶已經(jīng)存在,更新這條數(shù)據(jù)。"> 是否更新已經(jīng)存在的用戶數(shù)據(jù)
               <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下載模板</a>
        </div>
        <font color="red" class="pull-left mt10">
            提示:僅允許導(dǎo)入“xls”或“xlsx”格式文件!
        </font>
    </div>
    </form>

  • 表格銷毀 $.table.destroy
    <a onclick="$.table.destroy();">銷毀</a>

  • 表格數(shù)據(jù)刷新 $.table.refresh
    <a onclick="$.table.refresh();">刷新</a>

  • 選擇表格行具體列 $.table.selectColumns
    var loginName = $.table.selectColumns("loginName");

  • 選擇表格行首列 $.table.selectFirstColumns
    var firstColumn = $.table.selectFirstColumns();

  • 顯示表格特定的列 $.table.showColumn
    $.table.showColumn("userName");

  • 隱藏表格特定的列 $.table.hideColumn
    $.table.hideColumn("userName");

  • 序列號(hào)生成 $.table.serialNumber
    {
    title: "序號(hào)",
    formatter: function (value, row, index) {
        return $.table.serialNumber(index);
    }
    },

  • 超出指定長(zhǎng)度浮動(dòng)提示 $.table.tooltip
    {
    field: 'remark',
    title: '備注',
    align: 'center',
    formatter: function(value, row, index) {
        return $.table.tooltip(value);
    }
    },

  • 回顯數(shù)據(jù)字典 $.table.selectDictLabel
    var datas = [[${@dict.getType('sys_common_status')}]];
    {
    field: 'status',
    title: '用戶狀態(tài)',
    align: 'center',
    formatter: function(value, row, index) {
        return $.table.selectDictLabel(datas, value);
    }
    },

  • 下拉按鈕切換 $.table.dropdownToggle
    formatter: function(value, row, index) {
    var actions = [];
    actions.push('<a class="' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit"></i>編輯</a>');
    actions.push('<a class="' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.deptId + '\')"><i class="fa fa-trash"></i>刪除</a>');
    actions.push('<a class="' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus"></i>添加下級(jí)部門</a>');
    return $.table.dropdownToggle(actions.join(''));
    }

彈層使用

彈層組件目前基于layer組件進(jìn)行封裝,提供了彈出、消息、提示、確認(rèn)、遮罩處理等功能。

  • 提供成功、警告和錯(cuò)誤等反饋信息
    $.modal.msg("默認(rèn)反饋");
    $.modal.msgError("錯(cuò)誤反饋");
    $.modal.msgSuccess("成功反饋");
    $.modal.msgWarning("警告反饋");

  • 提供成功、警告和錯(cuò)誤等提示信息
    $.modal.alert("默認(rèn)提示");
    $.modal.alertError("錯(cuò)誤提示");
    $.modal.alertSuccess("成功提示");
    $.modal.alertWarning("警告提示");
    $.modal.confirm("確認(rèn)信息", function() {});

  • 提供彈出層信息
    // title 標(biāo)題 url 請(qǐng)求鏈接 width 寬度 height 高度 options 選項(xiàng)
    $.modal.open(title, url, width, height);
    $.modal.openTab(title, url);
    $.modal.openOptions(options);
    $.modal.openFull(title, url, width, height);
    $.modal.close();
    $.modal.closeAll();
    $.modal.reload();

  • 提供遮罩層信息
    $.modal.loading("正在導(dǎo)出數(shù)據(jù),請(qǐng)稍后...");
    $.modal.closeLoading();

權(quán)限使用

使用thymeleaf模板整合了shiro標(biāo)簽 - 界面可以直接使用。(此處簡(jiǎn)單介紹兩個(gè),更多請(qǐng)參考官方文檔)

<a href="#" shiro:hasPermission="system:user:add">包含權(quán)限字符串才能看到</a>
<a href="#" shiro:hasRole="admin">管理員才能看到</a>

如果需要在JS中使用權(quán)限,使用封裝方法

var addFlag = [[${@permission.hasPermi('system:user:add')}]];
<a class="btn btn-success btn-xs ' + editFlag + '">包含權(quán)限字符串才能看到</a>

字典使用

配置好相關(guān)的數(shù)據(jù)字典信息即可正常使用(系統(tǒng)管理-字典管理)

<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  <option value="">所有</option>
  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
  </option>
</select>

如果在想Table表格數(shù)據(jù)使用字典,使用formatter格式化

// 獲取數(shù)據(jù)字典數(shù)據(jù)
var datas = [[${@dict.getType('sys_normal_disable')}]];


// 格式化數(shù)據(jù)字典
formatter: function(value, row, index) {
    return $.table.selectDictLabel(datas, value);
}

參數(shù)使用

配置好相關(guān)的參數(shù)信息即可正常使用(系統(tǒng)管理-參數(shù)管理)

<body th:classappend="${@config.getKey('sys.index.skinName')}">

如果需要在JS中使用參數(shù),使用封裝方法

var skinName = [[${@config.getKey('sys.index.skinName')}]];
$("#id").val(skinName);
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)