fastui 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +11 -6
- data/app/assets/javascripts/fastui/app/view/DataFieldFactory.js +61 -0
- data/app/assets/javascripts/fastui/app/view/GridColumnFactory.js +164 -0
- data/app/assets/javascripts/fastui/app/view/VCustomForm.js +1 -0
- data/app/assets/javascripts/fastui/app/view/VForm.js +43 -49
- data/app/assets/javascripts/fastui/app/view/VGrid.js +10 -123
- data/app/assets/javascripts/fastui/app/view/VMenu.js +1 -1
- data/app/assets/javascripts/fastui/app/view/VSearchWindow.js +10 -10
- data/app/assets/javascripts/fastui/app/view/VTab.js +1 -1
- data/app/assets/javascripts/fastui/app/view/VTreeGrid.js +8 -85
- data/app/assets/javascripts/fastui/app/view/vfield/{VBool.js → VBoolean.js} +1 -1
- data/app/assets/javascripts/fastui/app/view/vfield/VFieldFactory.js +19 -9
- data/app/assets/javascripts/fastui/app/view/vfield/{VHtmlEditor.js → VHtml.js} +2 -1
- data/app/assets/javascripts/fastui/app/view/vfield/VInteger.js +20 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VList.js +35 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VLookup.js +2 -2
- data/app/assets/javascripts/fastui/app/view/vfield/VNumber.js +1 -0
- data/app/assets/javascripts/fastui/app/view/vfield/{VTextArea.js → VString.js} +3 -4
- data/app/assets/javascripts/fastui/app/view/vfield/VTable.js +50 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VText.js +4 -1
- data/app/assets/javascripts/fastui/app/view/vfield/VTreeCombobox.js +78 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VType.js +83 -5
- data/app/assets/javascripts/fastui/application.js +1 -0
- data/app/assets/javascripts/fastui/extjs4/locale/ext-lang-zh_CN.js +7 -27
- data/app/assets/javascripts/fastui/fastui.js +2 -0
- data/app/controllers/fastui/m_list_items_controller.rb +1 -1
- data/app/controllers/fastui/m_menu_items_controller.rb +1 -1
- data/app/controllers/fastui/m_orgs_controller.rb +2 -2
- data/app/models/fastui/m_menu_item.rb +3 -0
- data/app/models/fastui/m_org.rb +3 -0
- data/lib/fastui/version.rb +1 -1
- metadata +11 -6
- data/app/assets/javascripts/fastui/app/view/VVWindow.js +0 -72
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODhjZmNmMWJiNjM0OWQ3ZjlhMjllYzIyMjQ5MGFmM2NmODQ0NDZhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTU2OWI1NjkyOGQwNDI3MThkZWI1NTc3ODNkNzJkYWNmYzllOTUwZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTAzODgzYWZjODc4ZmM1ODhkNDFlODQwY2FlMDY2M2VlY2QwYTcyNjM4ODJk
|
10
|
+
NGYyOGQ2MDcxODk0Yzg3ZmE0ZGRkYmYyZWU5MWM0ODVkZjJmNWFkNjI0N2Vj
|
11
|
+
NTM1ZTE4YTlkMTY0MzliNmMzNTcyYWVlZDAxYzFlYTk5Y2EwZTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDM2NGZiOWJlYzk2YmYyNmFkMzU4OGRhMGEyY2NmNTlkMjMyMDk5NTk3ZGMx
|
14
|
+
NjJjMzFlMWYxZWQxZDBkNGY2NDM0NzdiNThiZDM0ZmVmYTE1MjM3MWEzZGJl
|
15
|
+
N2MxOWJmNzQ5NjNjMWUzMTAwMzkyYjkxODFlNGM3ODdjMzQ1MjI=
|
data/README.md
CHANGED
@@ -13,15 +13,20 @@ By default your view is configured in the file config/initializers/fastui_config
|
|
13
13
|
Fastui::View.instance.config do |conf|
|
14
14
|
conf.win :m_list, title: '数据字典', window_kind: 'maintain' do |w|
|
15
15
|
w.tab :m_list, title: '枚举', entity:'Fastui::MList', members:[
|
16
|
-
{name:'id', title: 'ID', datatype:'
|
17
|
-
{name:'title', title: '标题', datatype:'
|
16
|
+
{name:'id', title: 'ID', datatype:'VInteger', readonly: true},
|
17
|
+
{name:'title', title: '标题', datatype:'VString'},
|
18
18
|
{name:'print_text', title: '打印文本', datatype:'VText'},
|
19
|
-
{name:'name', title: '标识', datatype:'
|
19
|
+
{name:'name', title: '标识', datatype:'VString'},
|
20
|
+
{name: 'entity_kind', title: '实体种类', datatype: 'VRadio'},
|
21
|
+
{name: 'seq', title: '排序', datatype: 'VInteger'},
|
22
|
+
{name: 'is_active', title: '是否激活', datatype: 'VBool'},
|
23
|
+
{name: 'note', title: '备注', datatype: 'VText'},
|
24
|
+
{name: 'help', title: '帮助', datatype: 'VHtml', display: 'form'}
|
20
25
|
]
|
21
26
|
w.tab :m_list_item, title:'枚举项', entity:'Fastui::MListItem', included_tab: 'm_list', members:[
|
22
|
-
{name:'id', title: 'ID', datatype:'
|
23
|
-
{name:'title', title: '标题', datatype:'
|
24
|
-
{name:'print_text', title: '打印文本', datatype:'
|
27
|
+
{name:'id', title: 'ID', datatype:'VInteger', readonly: true},
|
28
|
+
{name:'title', title: '标题', datatype:'VString'},
|
29
|
+
{name:'print_text', title: '打印文本', datatype:'VString'},
|
25
30
|
{name:'name', title: '标识', datatype:'VText'}
|
26
31
|
]
|
27
32
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Ext.define('FastUI.view.DataFieldFactory', {
|
2
|
+
singleton: true,
|
3
|
+
|
4
|
+
buildField:function(fields, field){
|
5
|
+
switch (field.datatype) {
|
6
|
+
case 'VTreeCombobox':
|
7
|
+
fields.push({
|
8
|
+
name: field.name.replace('_id', ''),
|
9
|
+
type: 'auto'
|
10
|
+
});
|
11
|
+
break;
|
12
|
+
|
13
|
+
case 'VTable':
|
14
|
+
fields.push({
|
15
|
+
name: field.name.replace('_id', ''),
|
16
|
+
type: 'auto'
|
17
|
+
});
|
18
|
+
break;
|
19
|
+
|
20
|
+
case 'VLookup':
|
21
|
+
fields.push({
|
22
|
+
name: field.name.replace('_id', ''),
|
23
|
+
type: 'auto'
|
24
|
+
});
|
25
|
+
break;
|
26
|
+
|
27
|
+
case 'VSingleChoice':
|
28
|
+
fields.push({
|
29
|
+
name: field.name.replace('_id', ''),
|
30
|
+
type: 'auto'
|
31
|
+
});
|
32
|
+
break;
|
33
|
+
|
34
|
+
case 'VList':
|
35
|
+
fields.push({
|
36
|
+
name: field.name.replace('_id', ''),
|
37
|
+
type: 'auto'
|
38
|
+
});
|
39
|
+
break;
|
40
|
+
|
41
|
+
case 'VGroup':
|
42
|
+
Ext.each(field.members, function(member){
|
43
|
+
this.buildField(fields,member);
|
44
|
+
},this);
|
45
|
+
break;
|
46
|
+
|
47
|
+
|
48
|
+
default:
|
49
|
+
if(Array.isArray(field)){
|
50
|
+
Ext.each(field, function(f){
|
51
|
+
this.buildField(fields,f);
|
52
|
+
},this);
|
53
|
+
}else{
|
54
|
+
fields.push({
|
55
|
+
name: field.name,
|
56
|
+
type: 'auto'
|
57
|
+
});
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
});
|
@@ -0,0 +1,164 @@
|
|
1
|
+
Ext.define('FastUI.view.GridColumnFactory', {
|
2
|
+
singleton: true,
|
3
|
+
|
4
|
+
buildColumn: function(columns, column){
|
5
|
+
column.datatype = column.datatype || '';
|
6
|
+
switch (column.datatype) {
|
7
|
+
case 'VTree':
|
8
|
+
columns.push({
|
9
|
+
text: column.title,
|
10
|
+
dataIndex: column.name,
|
11
|
+
xtype: 'treecolumn',
|
12
|
+
flex: 2.5
|
13
|
+
});
|
14
|
+
break;
|
15
|
+
|
16
|
+
case 'VTreeCombobox':
|
17
|
+
var entity = column.name.replace('_id', '');
|
18
|
+
columns.push({
|
19
|
+
text: column.title,
|
20
|
+
dataIndex: column.name,
|
21
|
+
display: column.display || 'all',
|
22
|
+
xtype: 'templatecolumn',
|
23
|
+
tpl: new Ext.XTemplate('<tpl for="' + entity + '">', '{title}', '</tpl>')
|
24
|
+
});
|
25
|
+
break;
|
26
|
+
|
27
|
+
case 'VTable':
|
28
|
+
var entity = column.name.replace('_id', '');
|
29
|
+
columns.push({
|
30
|
+
text: column.title,
|
31
|
+
dataIndex: column.name,
|
32
|
+
display: column.display || 'all',
|
33
|
+
xtype: 'templatecolumn',
|
34
|
+
tpl: new Ext.XTemplate('<tpl for="' + entity + '">', '{title}', '</tpl>')
|
35
|
+
});
|
36
|
+
break;
|
37
|
+
|
38
|
+
case 'VLookup':
|
39
|
+
var entity = column.name.replace('_id', '');
|
40
|
+
columns.push({
|
41
|
+
text: column.title,
|
42
|
+
dataIndex: column.name,
|
43
|
+
display: column.display || 'all',
|
44
|
+
xtype: 'templatecolumn',
|
45
|
+
tpl: new Ext.XTemplate('<tpl for="' + entity + '">', '{title}', '</tpl>')
|
46
|
+
});
|
47
|
+
break;
|
48
|
+
|
49
|
+
case 'MultipleChoice':
|
50
|
+
var plur_entity = column.name.replace('_ids', '').pluralize();
|
51
|
+
columns.push({
|
52
|
+
text: column.title,
|
53
|
+
dataIndex: column.name,
|
54
|
+
display: column.display || 'all',
|
55
|
+
xtype: 'templatecolumn',
|
56
|
+
tpl: new Ext.XTemplate('<tpl for="' + plur_entity + '">', '{title}', '</tpl>')
|
57
|
+
});
|
58
|
+
break;
|
59
|
+
|
60
|
+
case 'VSingleChoice':
|
61
|
+
columns.push({
|
62
|
+
text: column.title,
|
63
|
+
dataIndex: column.name,
|
64
|
+
display: column.display || 'all',
|
65
|
+
renderer: function(val) {
|
66
|
+
var list_store = FastUI.store.MListMgr.getStore(column.name);
|
67
|
+
var index = list_store.findExact('name', val);
|
68
|
+
if (index > -1) {
|
69
|
+
var rs = list_store.getAt(index).data;
|
70
|
+
return rs.title;
|
71
|
+
}
|
72
|
+
return "";
|
73
|
+
}
|
74
|
+
});
|
75
|
+
break;
|
76
|
+
|
77
|
+
case 'VList':
|
78
|
+
columns.push({
|
79
|
+
text: column.title,
|
80
|
+
dataIndex: column.name,
|
81
|
+
display: column.display || 'all',
|
82
|
+
renderer: function(val) {
|
83
|
+
var list_store = FastUI.store.MListMgr.getStore(column.name);
|
84
|
+
var index = list_store.findExact('name', val);
|
85
|
+
if (index > -1) {
|
86
|
+
var rs = list_store.getAt(index).data;
|
87
|
+
return rs.title;
|
88
|
+
}
|
89
|
+
return "";
|
90
|
+
}
|
91
|
+
});
|
92
|
+
break;
|
93
|
+
|
94
|
+
case 'VRadio':
|
95
|
+
columns.push({
|
96
|
+
text: column.title,
|
97
|
+
dataIndex: column.name,
|
98
|
+
display: column.display || 'all',
|
99
|
+
renderer: function(val) {
|
100
|
+
var list_store = FastUI.store.MListMgr.getStore(column.name);
|
101
|
+
var index = list_store.findExact('name', val);
|
102
|
+
if (index > -1) {
|
103
|
+
var rs = list_store.getAt(index).data;
|
104
|
+
return rs.title;
|
105
|
+
}
|
106
|
+
return "";
|
107
|
+
}
|
108
|
+
});
|
109
|
+
break;
|
110
|
+
|
111
|
+
case 'VSexSelect':
|
112
|
+
columns.push({
|
113
|
+
text: column.title,
|
114
|
+
dataIndex: column.name,
|
115
|
+
display: column.display || 'all',
|
116
|
+
renderer: function (val) {
|
117
|
+
return val ? '男' : '女'
|
118
|
+
}
|
119
|
+
});
|
120
|
+
break;
|
121
|
+
|
122
|
+
case 'VBoolean':
|
123
|
+
columns.push({
|
124
|
+
text: column.title,
|
125
|
+
dataIndex: column.name,
|
126
|
+
display: column.display || 'all',
|
127
|
+
renderer: function (val) {
|
128
|
+
return val ? '√' : '×';
|
129
|
+
}
|
130
|
+
});
|
131
|
+
break;
|
132
|
+
|
133
|
+
case 'VYesOrNo':
|
134
|
+
columns.push({
|
135
|
+
text: column.title,
|
136
|
+
dataIndex: column.name,
|
137
|
+
display: column.display || 'all',
|
138
|
+
renderer: function (val) {
|
139
|
+
return val ? '是' : '否';
|
140
|
+
}
|
141
|
+
});
|
142
|
+
break;
|
143
|
+
|
144
|
+
case 'VGroup':
|
145
|
+
Ext.each(column.members, function (member) {
|
146
|
+
this.buildColumn(columns, member);
|
147
|
+
},this);
|
148
|
+
break;
|
149
|
+
|
150
|
+
default:
|
151
|
+
if(Array.isArray(column)){
|
152
|
+
Ext.each(column, function(c){
|
153
|
+
this.buildColumn(columns, c);
|
154
|
+
},this);
|
155
|
+
}else{
|
156
|
+
columns.push({
|
157
|
+
text: column.title,
|
158
|
+
dataIndex: column.name,
|
159
|
+
display: column.display || 'all'
|
160
|
+
});
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
});
|
@@ -1,36 +1,41 @@
|
|
1
1
|
Ext.define('FastUI.view.VForm', {
|
2
|
-
extend:'Ext.form.Panel',
|
2
|
+
extend: 'Ext.form.Panel',
|
3
3
|
requires: ['FastUI.view.vfield.VFieldFactory'],
|
4
|
-
tab:{},
|
5
|
-
|
6
|
-
|
4
|
+
tab: {},
|
5
|
+
successText:'Success',
|
6
|
+
failureText:'Failed',
|
7
|
+
invalidText:'Invalid',
|
7
8
|
|
9
|
+
bodyPadding: 5,
|
10
|
+
layout: 'anchor',
|
8
11
|
fieldDefaults: {
|
9
12
|
labelAlign: 'right',
|
10
13
|
labelWidth: 100,
|
11
14
|
//anchor: '60%'
|
12
15
|
width: 650
|
13
16
|
},
|
14
|
-
defaultType:'textfield',
|
15
|
-
border:false,
|
16
|
-
initComponent:function () {
|
17
|
+
defaultType: 'textfield',
|
18
|
+
border: false,
|
19
|
+
initComponent: function () {
|
17
20
|
this.title = this.getValue('title');
|
18
21
|
this.items = this.getFFields();
|
19
22
|
this.callParent();
|
20
23
|
},
|
21
|
-
getValue:function(key){
|
24
|
+
getValue: function (key) {
|
22
25
|
return this.tab.valueObject[key];
|
23
26
|
},
|
24
|
-
getMEntity:function(){
|
27
|
+
getMEntity: function () {
|
25
28
|
return this.tab.valueObject.entity;
|
26
29
|
},
|
27
|
-
getFFields:function () {
|
30
|
+
getFFields: function () {
|
28
31
|
var fields = [];
|
29
32
|
Ext.each(this.getValue('members'), function (member) {
|
30
33
|
member.readonly = member.readonly || false;
|
31
34
|
member.display = member.display || 'all';
|
32
|
-
|
33
|
-
|
35
|
+
member.vtype = member.vtype || '';
|
36
|
+
|
37
|
+
if (member.display == 'all' || member.display == 'form') {
|
38
|
+
fields.push(FastUI.view.vfield.VFieldFactory.buildField(member, this.tab.winCtx, this.tab.winId, this.tab.rest));
|
34
39
|
}
|
35
40
|
}, this);
|
36
41
|
return fields;
|
@@ -45,10 +50,10 @@ Ext.define('FastUI.view.VForm', {
|
|
45
50
|
setAutoFields: function (form) {
|
46
51
|
var temp = {};
|
47
52
|
var logic = "";
|
48
|
-
Ext.each(this.getValue('
|
49
|
-
if (
|
50
|
-
logic = this.winCtx.parseCtx(this.winId,
|
51
|
-
temp[this.tab.rest.getTableName() + '[' +
|
53
|
+
Ext.each(this.getValue('members'), function (member) {
|
54
|
+
if (member.default_logic) {
|
55
|
+
logic = this.tab.winCtx.parseCtx(this.tab.winId, member.default_logic);
|
56
|
+
temp[this.tab.rest.getTableName() + '[' + member.name + ']'] = Ext.decode(logic);
|
52
57
|
}
|
53
58
|
}, this);
|
54
59
|
form.setValues(temp);
|
@@ -68,12 +73,8 @@ Ext.define('FastUI.view.VForm', {
|
|
68
73
|
var k, o = {};
|
69
74
|
for (k in data) {
|
70
75
|
if (k.match(/_id$/)) {
|
71
|
-
var attr = data[k.replace('_id', '')];
|
72
|
-
|
73
|
-
if (attr && attr.title) {
|
74
|
-
title = attr.title
|
75
|
-
}
|
76
|
-
o[this.tab.rest.getTableName() + '[' + k + ']'] = {id: data[k], title: title};
|
76
|
+
var attr = data[k.replace('_id', '')] || data[k];
|
77
|
+
o[this.tab.rest.getTableName() + '[' + k + ']'] = attr;
|
77
78
|
} else if (k.match(/_ids$/)) {
|
78
79
|
o[this.tab.rest.getTableName() + '[' + k + '][]'] = data[k];
|
79
80
|
}
|
@@ -83,35 +84,28 @@ Ext.define('FastUI.view.VForm', {
|
|
83
84
|
}
|
84
85
|
// alert(Ext.encode(o));
|
85
86
|
form.setValues(o);
|
86
|
-
},
|
87
|
+
},
|
88
|
+
failure: function (response,action) {
|
89
|
+
Ext.Msg.alert(this.failureText, action.result.msg);
|
90
|
+
},
|
91
|
+
scope: this
|
87
92
|
});
|
88
93
|
},
|
89
94
|
cmdSave: function () {
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
},
|
106
|
-
constructAjaxRequest: function (options) {
|
107
|
-
return Ext.Ajax.request({
|
108
|
-
url: options.url,
|
109
|
-
method: options.method,
|
110
|
-
params: options.params,
|
111
|
-
success: options.success,
|
112
|
-
failure: options.failure,
|
113
|
-
scope: options.scope
|
114
|
-
});
|
95
|
+
var form = this.getForm();
|
96
|
+
if (form.isValid()) { // make sure the form contains valid data before submitting
|
97
|
+
form.submit({
|
98
|
+
success: function (form, action) {
|
99
|
+
this.tab.vgrid.store.reload();
|
100
|
+
Ext.Msg.alert(this.successText, action.result.msg);
|
101
|
+
},
|
102
|
+
failure: function (form, action) {
|
103
|
+
Ext.Msg.alert(this.failureText, action.result.msg);
|
104
|
+
},
|
105
|
+
scope: this
|
106
|
+
});
|
107
|
+
} else { // display error alert if the data is invalid
|
108
|
+
Ext.Msg.alert(this.invalidText, 'Please correct form errors.')
|
109
|
+
}
|
115
110
|
}
|
116
|
-
|
117
111
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Ext.define('FastUI.view.VGrid', {
|
2
2
|
extend: 'Ext.grid.Panel',
|
3
|
-
requires: ['FastUI.store.MListMgr'],
|
3
|
+
requires: ['FastUI.store.MListMgr', 'FastUI.view.vfield.VFieldFactory','FastUI.view.DataFieldFactory', 'FastUI.view.GridColumnFactory'],
|
4
4
|
tab: {},
|
5
5
|
selType: 'rowmodel',
|
6
6
|
multiSelect: false,
|
@@ -30,8 +30,8 @@ Ext.define('FastUI.view.VGrid', {
|
|
30
30
|
//alert(this.tab.rest.getKey() + '='+ record.get('id'));
|
31
31
|
this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getKey(), record.get('id'));
|
32
32
|
this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getTitle(), record.get('title'));
|
33
|
-
if (record.get('
|
34
|
-
this.tab.winCtx.setWinCtx(this.tab.winId, '
|
33
|
+
if (record.get('entity')) {
|
34
|
+
this.tab.winCtx.setWinCtx(this.tab.winId, 'entity', record.get('entity'));
|
35
35
|
}
|
36
36
|
this.tab.getBtn('edit').enable();
|
37
37
|
this.tab.getBtn('del').enable();
|
@@ -79,137 +79,24 @@ Ext.define('FastUI.view.VGrid', {
|
|
79
79
|
getMColumns: function () {
|
80
80
|
return this.tab.valueObject.members || [];
|
81
81
|
},
|
82
|
-
buildField:function(fields, field){
|
83
|
-
field.datatype = field.datatype || '';
|
84
|
-
switch (field.datatype) {
|
85
|
-
case 'VLookup':
|
86
|
-
fields.push({
|
87
|
-
name: field.name.replace('_id', ''),
|
88
|
-
type: 'auto'
|
89
|
-
});
|
90
|
-
break;
|
91
82
|
|
92
|
-
case 'VSingleChoice':
|
93
|
-
fields.push({
|
94
|
-
name: field.name.replace('_id', ''),
|
95
|
-
type: 'auto'
|
96
|
-
});
|
97
|
-
break;
|
98
|
-
|
99
|
-
case 'VGroup':
|
100
|
-
Ext.each(field.members, function(member){
|
101
|
-
this.buildField(fields,member);
|
102
|
-
},this);
|
103
|
-
break;
|
104
|
-
|
105
|
-
default:
|
106
|
-
if(Array.isArray(field)){
|
107
|
-
Ext.each(field, function(f){
|
108
|
-
this.buildField(fields,f);
|
109
|
-
},this);
|
110
|
-
}else{
|
111
|
-
fields.push({
|
112
|
-
name: field.name,
|
113
|
-
type: 'auto'
|
114
|
-
});
|
115
|
-
}
|
116
|
-
}
|
117
|
-
},
|
118
83
|
getGFields: function () {
|
119
84
|
var fields = [];
|
120
85
|
Ext.each(this.getMColumns(), function (column) {
|
121
|
-
this.buildField(fields, column);
|
86
|
+
//this.buildField(fields, column);
|
87
|
+
FastUI.view.DataFieldFactory.buildField(fields,column);
|
88
|
+
//fields.push(FastUI.view.vfield.VFieldFactory.buildField(column, this.tab.winCtx, this.tab.winId, this.tab.rest).data());
|
122
89
|
}, this);
|
123
90
|
return fields;
|
124
91
|
},
|
125
|
-
buildColumn: function(columns, column){
|
126
|
-
column.datatype = column.datatype || '';
|
127
|
-
switch (column.datatype) {
|
128
|
-
case 'VLookup':
|
129
|
-
var entity = column.name.replace('_id', '');
|
130
|
-
columns.push({
|
131
|
-
text: column.title,
|
132
|
-
dataIndex: column.name,
|
133
|
-
display: column.display || 'all',
|
134
|
-
xtype: 'templatecolumn',
|
135
|
-
tpl: new Ext.XTemplate('<tpl for="' + entity + '">', '{title}', '</tpl>')
|
136
|
-
});
|
137
|
-
break;
|
138
|
-
|
139
|
-
case 'MultipleChoice':
|
140
|
-
var plur_entity = column.name.replace('_ids', '').pluralize();
|
141
|
-
columns.push({
|
142
|
-
text: column.title,
|
143
|
-
dataIndex: column.name,
|
144
|
-
display: column.display || 'all',
|
145
|
-
xtype: 'templatecolumn',
|
146
|
-
tpl: new Ext.XTemplate('<tpl for="' + plur_entity + '">', '{title}', '</tpl>')
|
147
|
-
});
|
148
|
-
break;
|
149
|
-
|
150
|
-
case 'VSingleChoice':
|
151
|
-
columns.push({
|
152
|
-
text: column.title,
|
153
|
-
dataIndex: column.name,
|
154
|
-
display: column.display || 'all',
|
155
|
-
renderer: function(val) {
|
156
|
-
var list_store = FastUI.store.MListMgr.getStore(column.name);
|
157
|
-
var index = list_store.findExact('name', val);
|
158
|
-
if (index > -1) {
|
159
|
-
var rs = list_store.getAt(index).data;
|
160
|
-
return rs.title;
|
161
|
-
}
|
162
|
-
return "";
|
163
|
-
}
|
164
|
-
});
|
165
|
-
break;
|
166
92
|
|
167
|
-
case 'VSexSelect':
|
168
|
-
columns.push({
|
169
|
-
text: column.title,
|
170
|
-
dataIndex: column.name,
|
171
|
-
display: column.display || 'all',
|
172
|
-
renderer: function (val) {
|
173
|
-
return val ? '男' : '女'
|
174
|
-
}
|
175
|
-
});
|
176
|
-
break;
|
177
|
-
|
178
|
-
case 'VYesOrNo':
|
179
|
-
columns.push({
|
180
|
-
text: column.title,
|
181
|
-
dataIndex: column.name,
|
182
|
-
display: column.display || 'all',
|
183
|
-
renderer: function (val) {
|
184
|
-
return val ? '是' : '否';
|
185
|
-
}
|
186
|
-
});
|
187
|
-
break;
|
188
|
-
|
189
|
-
case 'VGroup':
|
190
|
-
Ext.each(column.members, function (member) {
|
191
|
-
this.buildColumn(columns, member);
|
192
|
-
},this);
|
193
|
-
break;
|
194
|
-
|
195
|
-
default:
|
196
|
-
if(Array.isArray(column)){
|
197
|
-
Ext.each(column, function(c){
|
198
|
-
this.buildColumn(columns, c);
|
199
|
-
},this);
|
200
|
-
}else{
|
201
|
-
columns.push({
|
202
|
-
text: column.title,
|
203
|
-
dataIndex: column.name,
|
204
|
-
display: column.display || 'all'
|
205
|
-
});
|
206
|
-
}
|
207
|
-
}
|
208
|
-
},
|
209
93
|
getGColumns: function () {
|
210
94
|
var columns = [];
|
211
95
|
Ext.each(this.getMColumns(), function (column) {
|
212
|
-
this.buildColumn(columns,column);
|
96
|
+
//this.buildColumn(columns,column);
|
97
|
+
FastUI.view.GridColumnFactory.buildColumn(columns, column);
|
98
|
+
//alert('ss');
|
99
|
+
//columns.push(FastUI.view.vfield.VFieldFactory.buildField(column, this.tab.winCtx, this.tab.winId, this.tab.rest).column());
|
213
100
|
}, this);
|
214
101
|
return columns;
|
215
102
|
}
|
@@ -18,7 +18,7 @@ Ext.define('FastUI.view.VMenu', {
|
|
18
18
|
initComponent: function(){
|
19
19
|
this.store = Ext.create('Ext.data.TreeStore', {
|
20
20
|
autoLoad:true,
|
21
|
-
fields:['id', {name:'text', mapping:'title'},
|
21
|
+
fields:['id', {name:'text', mapping:'title'},'leaf','expanded', 'window'],
|
22
22
|
proxy:{
|
23
23
|
type:'ajax',
|
24
24
|
url:'/fastui/m_menu_items.json',
|
@@ -4,11 +4,11 @@ Ext.define('FastUI.view.VSearchWindow', {
|
|
4
4
|
height:300,
|
5
5
|
width:600,
|
6
6
|
layout:'fit',
|
7
|
-
|
7
|
+
lookup:{},
|
8
8
|
|
9
9
|
initComponent:function () {
|
10
|
-
|
11
10
|
this.title = this.getValue('title');
|
11
|
+
|
12
12
|
this.items = {
|
13
13
|
xtype: 'grid',
|
14
14
|
border: false,
|
@@ -16,14 +16,14 @@ Ext.define('FastUI.view.VSearchWindow', {
|
|
16
16
|
{header:'ID', dataIndex:'id'},
|
17
17
|
{header:'Title', dataIndex:'title'}
|
18
18
|
],
|
19
|
-
store: this.getStore(),
|
19
|
+
store: this.getStore(),
|
20
20
|
listeners:{
|
21
21
|
itemclick:function (grid, record, item, index, e, eOpts) {
|
22
22
|
var id = record.get('id');
|
23
|
-
if (!this.
|
24
|
-
this.
|
23
|
+
if (!this.lookup.store.getById(id)){
|
24
|
+
this.lookup.store.add({id:id,title:record.get('title')});
|
25
25
|
}
|
26
|
-
this.
|
26
|
+
this.lookup.setValue(id);
|
27
27
|
},
|
28
28
|
scope:this
|
29
29
|
}
|
@@ -33,14 +33,14 @@ Ext.define('FastUI.view.VSearchWindow', {
|
|
33
33
|
this.callParent();
|
34
34
|
},
|
35
35
|
getValue:function (key) {
|
36
|
-
return this.
|
36
|
+
return this.lookup.valueObject[key];
|
37
37
|
},
|
38
38
|
getMEntity:function(){
|
39
|
-
return this.
|
39
|
+
return this.lookup.valueObject.ref.entity;
|
40
40
|
},
|
41
41
|
|
42
42
|
// getDataType:function(){
|
43
|
-
// return this.this.
|
43
|
+
// return this.this.lookup.valueObject.class_name
|
44
44
|
// },
|
45
45
|
|
46
46
|
searchPanel:function () {
|
@@ -76,7 +76,7 @@ Ext.define('FastUI.view.VSearchWindow', {
|
|
76
76
|
// var s = "{m_window_id:${m_window_id}}";
|
77
77
|
var s = this.getValue('filter');
|
78
78
|
if(s == '') return '';
|
79
|
-
s = this.
|
79
|
+
s = this.lookup.winCtx.parseCtx(this.lookup.winId,s);
|
80
80
|
return Ext.decode(s);
|
81
81
|
},
|
82
82
|
getStore:function () {
|