From 6684c2bf412d5c84400bb8ae6a7768fa3b15ce3d Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Tue, 8 Nov 2016 17:38:56 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E6=96=B0=E5=A2=9EJS=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/admin/static/js/template/table.js | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/public/admin/static/js/template/table.js b/public/admin/static/js/template/table.js index 157dfa2..2839710 100644 --- a/public/admin/static/js/template/table.js +++ b/public/admin/static/js/template/table.js @@ -2,7 +2,14 @@ * Created by 7d-vision on 2016/11/7. */ (function ($) { - + /** + * 创建表格HTML字符串 + * 1、严重依赖Bootstrap的样式 + * 2、严格的Json数据格式 + * 3、如果有右侧操作按钮的话会默认自动加入{field:"action",info:"操作"}所以字段名不支持使用action,action是关键字 + * @param tableObj + * @returns {string} + */ $.buildTable = function ( tableObj ) { var tableHtml = '
'; if( tableObj.rightButton && tableObj.rightButton.length ){ @@ -105,6 +112,12 @@ return dataListHtml; } + /** + * 创建按钮 + * @param buttonValue 按钮属性对象 + * @param dataValue 当前行数据对象 + * @returns {string} + */ function createButton( buttonValue, dataValue ) { var paramStr = '', buttonStr = ''; if( buttonValue.confirm ){ @@ -121,6 +134,13 @@ return buttonStr; } + /** + * 预处理显示信息 + * @param styleList 当前字段对应的规则对象 + * @param dataValue 当前行数据对象 + * @param fieldName 需要处理的数据的字段名 + * @returns {*} + */ function prepareInfo( styleList, dataValue, fieldName ) { var detailInfo; if( styleList['info'] && styleList['info'].length ){ @@ -131,6 +151,12 @@ return detailInfo; } + /** + * 预处理参数信息 + * @param styleList 当前字段对应的规则对象 + * @param dataValue 当前行数据对象 + * @returns {string} + */ function prepareParamStr( styleList, dataValue ) { var paramStr = ''; if( styleList['param'].length ){