1.錯誤類型截圖.認繳注冊資本這列序列化出來的數據第一行是數字 1,第二行 ABC 是字符串,后台轉成Table的時候,會出現類型不統一.轉換報錯.

3.//獲取layuitable cache 此方法解決獲取到數據同一列出現不同類型問題。
<table id="Surplus_fundsFPList" lay-filter="Surplus_fundsFPList" style="width:100%;"></table>
//綁定數據別名
table3Ins = table.render({數據綁定});
//e:layui table對象, t:table3Ins
//獲取layuitable cache 此方法解決獲取到數據同一列出現不同類型問題。
function GetTableCache (e,t) {
if (!e||!t) return null;
var n = t.config;
var id = t.config.id;
var d = e.cache[id] == null ? n.data : e.cache[id];
for (var ic = 0; ic < n.cols.length; ic++) {
var c = n.cols[ic];
if (c && d) {
for (var i = 0; i < d.length; i++) {
for (var i_ = 0; i_ < c.length; i_++) {
var f = c[i_]; if (f.type && f.type == 'string') d[i][f.field] = d[i][f.field] ? '' + d[i][f.field] : '';
}
}
}
} return d;
}
4.使用方式.確定序列化這一列的類型
例如:{ field: 'Extraction_Unit', width: 140, title: '提取單位', align: 'center', type: 'string', edit: 'text' }
5.調用
var oldSurplus_fundsFPData = GetTableCache(table, 'Surplus_fundsFPList');
var Surplus_fundsFPDataJson = JSON.stringify(oldSurplus_fundsFPData);
