demo.html
9.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<div id="ngridtable" class="page out" data-title="表格插件">
<div class="page-content">
<div id="ngridtable-header"></div>
<div id="ngridtable-a"></div>
</div>
</div>
<script>
require(["NavHeader", "NGridTable"], function(NavHeader, NGridTable) {
var _u = require("mUtil");
var hasClsPicker = typeof clsPicker !== "undefined";
if(!hasClsPicker) {
new NavHeader({
el: "ngridtable-header",
container : "#ngridtable",
option: {
title:"表格插件",
smallTitle:"ngridtable",
isFixedTop: true
}
}).render();
}
new NGridTable({
el: "ngridtable-a",
option: {
dataSource: {
type: 'mock',//数据来源类型:cube/mock/url/api四种
searchid: -999,
mockData: [
{ "id": "1", "name": "杨文元", "age": "43", "birthday": "1976-02-20"},
{ "id": "2", "name": "刘长庚", "age": "45", "birthday": "1978-03-26"},
{ "id": "3", "name": "付蕾", "age": "34", "birthday": "1985-08-09"}
],
urlConfig: {
path: '/mobilemode/mobile/demo/plugin/UrlGridTable/data.jsp',
formats: {
DATAS: "datas",
TOTAL_SIZE: "totalSize",
STATUS_CODE: {
key: "",
value: ""
},
ERROR_MSG: ""
}
},
apiConfig: {
api: {
id: "4ff3c2114b484c9b888c32554c38cc7b",
name: "文档列表"
},
request: {
params: {
query: [
{name: "categoryid", value: ""},
{name: "searchKey", value: "{search_key}"},
{name: "pageNo", value: "{page_no}"},
{name: "pageSize", value: "{page_size}"}
],
body: {}
},
path: "/X-WEV-DocList",
type: "GET"
},
response: {
type: "HTML",
formats: {
DATAS: "datas",
TOTAL_SIZE: "totalSize",
STATUS_CODE: {
key: "status",
value: 1
},
ERROR_MSG: "errMsg"
}
}
},
},
pageStart: 1,
pageSize: !hasClsPicker ? 10 : 1,
showSet: {
common: [//通用,但是建模查询不适用,可单独为每种类型指定view,类型详见dataSource的type字段
],
mock: [
{id: "1", text: "ID", field: "{id}", width: "30"},
{id: "2", text: "名称", field: "{name}", width: "100"},
{id: "3", text: "年龄", field: "{age}", width: "100"},
{id: "4", text: "生日", field: "{birthday}", width: "150"}
],
cube: [
{text:"单行文本框", field: {fieldid: "6528", fielddesc: "{dxwbk}"}, width:"100"},
{text:"单行文本整数", field:{fieldid: "6529", fielddesc: "{dxwbzs}"}, width:"80"},
{text:"单行文本浮点数", field:{fieldid: "6530", fielddesc: "{dxwbfds}"}, width:"80"},
{text:"多行文本", field:{fieldid: "6533", fielddesc: "{dxwb}"}, width:"80"},
{text:"人力资源浏览框", field:{fieldid: "6534", fielddesc: "{rlzyllk}"}, width:"80"},
{text:"部门浏览框", field:{fieldid: "6535", fielddesc: "{bmllk}"}, width:"80"},
{text:"单行文本金额千分位", field:{fieldid: "6532", fielddesc: "{dxwbjeqfw}"}, width:"80"}
],
url: [
{id: "1", text:"公司名称", field:"<span style=\"color:rgba(0,0,0,.65);\">{name}</span>", width:"100"},
{id: "2", text:"预算科目", field:"{catogary}", width:"80"},
{id: "3", text:"一季度", field:"{first}", width:"80"},
{id: "4", text:"二季度", field:"{second}", width:"80"},
{id: "5", text:"三季度", field:"{third}", width:"80"},
{id: "6", text:"四季度", field:"{fourth}", width:"80"}
],
api: [
{text:"文档标题", field:"{subject}", width:"100"},
{text:"所有者", field:"{owner}", width:"80"},
{text:"创建时间", field:"{createtime}", width:"80"},
{text:"修改时间", field:"{modifytime}", width:"80"},
{text:"文档图片", field:"{img}", width:"80"}
]
},
quickSearch: {
hide: false, //是否隐藏查询
tip: "请输入关键字",
fields: [] //指定查询列,支持id和name两个属性,若传明细表字段名称需加上前缀d1,如d1.name
},
advancedSearch: {
enable: true,
title: '高级检索',
fields: [
{fieldid: 6528, showname: '单行文本框'}
]
},
btns : [
{
type: 1,//1文字 2图片
text: "新增",
click: function(){
Mobile_NS.msg("点击自定义按钮");
}
},
{
type: 2,
icon: "/mobilemode/piclibrary/02-E9_017afd/addition.png",
click: function(){
Mobile_NS.msg("点击自定义图片按钮");
}
}
],
summation: {
group: false,
groupTitle: "小计",
total: true,
totalTitle: "总计",
column: {
automatic: false,
cols: ["3"]//对应显示字段中的id
}
},
options: {
width : "100%",
fixedColumn : 1, //锁定列数
readonly : false,//是否数据只读
},
callback: {
click : function(data){
var dataid = data.id;
$u("/mobilemode/mobile/demo/plugin/NGridTable/detail.html?billid="+dataid, true);
}
},
onload: function(){
var _u = require("mUtil");
var hasClsPicker = typeof clsPicker !== "undefined";
if (!hasClsPicker) return;
_u.vetically("#ngridtable-a");
clsPicker.golalSetting({
container: ".wev-comp-NGridTable",
type: "NGridTable"
});
new clsPicker({
selector: ".wev-search",
text: ".wev-search",
lineYSkew: 75,
skew: [20, 0.9],
position: "top right"
});
new clsPicker({
selector: ".wev-placeholder-inner",
text: ".wev-placeholder-inner",
lineYSkew: 45,
skew: [10, 0.6],
position: "top right"
});
new clsPicker({
selector: ".wev-ngridtable-content-wrapper table>thead>tr>th",
text: " ",
lineYSkew: 0,
skew: ["", 2.2],
position: "top right"
});
new clsPicker({
selector: ".btn",
text: ".btn",
lineYSkew: 15,
skew: ["", 0.6],
position: "top left"
});
setTimeout(function(){
new clsPicker({
selector: ".wev-pagination",
lineYSkew: 80,
skew: [10, ""]
});
new clsPicker({
selector: ".wev-pagination-detail",
lineYSkew: 50
});
new clsPicker({
selector: ".wev-pagination-btn",
skew: [1.1, 10],
lineYSkew: 30,
});
}, 1000);
}
}
}).render();
});
</script>