fastui 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +53 -0
- data/Rakefile +40 -0
- data/app/assets/images/fastui/application/application.png +0 -0
- data/app/assets/images/fastui/application/application_add.png +0 -0
- data/app/assets/images/fastui/application/application_cascade.png +0 -0
- data/app/assets/images/fastui/application/application_delete.png +0 -0
- data/app/assets/images/fastui/application/application_double.png +0 -0
- data/app/assets/images/fastui/application/application_edit.png +0 -0
- data/app/assets/images/fastui/application/application_error.png +0 -0
- data/app/assets/images/fastui/application/application_form.png +0 -0
- data/app/assets/images/fastui/application/application_form_add.png +0 -0
- data/app/assets/images/fastui/application/application_form_delete.png +0 -0
- data/app/assets/images/fastui/application/application_form_edit.png +0 -0
- data/app/assets/images/fastui/application/application_form_magnify.png +0 -0
- data/app/assets/images/fastui/application/application_get.png +0 -0
- data/app/assets/images/fastui/application/application_go.png +0 -0
- data/app/assets/images/fastui/application/application_home.png +0 -0
- data/app/assets/images/fastui/application/application_key.png +0 -0
- data/app/assets/images/fastui/application/application_lightning.png +0 -0
- data/app/assets/images/fastui/application/application_link.png +0 -0
- data/app/assets/images/fastui/application/application_osx.png +0 -0
- data/app/assets/images/fastui/application/application_osx_terminal.png +0 -0
- data/app/assets/images/fastui/application/application_put.png +0 -0
- data/app/assets/images/fastui/application/application_side_boxes.png +0 -0
- data/app/assets/images/fastui/application/application_side_contract.png +0 -0
- data/app/assets/images/fastui/application/application_side_expand.png +0 -0
- data/app/assets/images/fastui/application/application_side_list.png +0 -0
- data/app/assets/images/fastui/application/application_side_tree.png +0 -0
- data/app/assets/images/fastui/application/application_split.png +0 -0
- data/app/assets/images/fastui/application/application_tile_horizontal.png +0 -0
- data/app/assets/images/fastui/application/application_tile_vertical.png +0 -0
- data/app/assets/images/fastui/application/application_view_columns.png +0 -0
- data/app/assets/images/fastui/application/application_view_detail.png +0 -0
- data/app/assets/images/fastui/application/application_view_gallery.png +0 -0
- data/app/assets/images/fastui/application/application_view_icons.png +0 -0
- data/app/assets/images/fastui/application/application_view_list.png +0 -0
- data/app/assets/images/fastui/application/application_view_tile.png +0 -0
- data/app/assets/images/fastui/application/application_xp.png +0 -0
- data/app/assets/images/fastui/application/application_xp_terminal.png +0 -0
- data/app/assets/images/fastui/arrow/accept.png +0 -0
- data/app/assets/images/fastui/arrow/add.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_branch.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_divide.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_down.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_in.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_inout.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_join.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_left.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_merge.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_out.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_redo.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_refresh.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_refresh_small.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_rotate_anticlockwise.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_rotate_clockwise.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_switch.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_turn_left.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_turn_right.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_undo.png +0 -0
- data/app/assets/images/fastui/arrow/arrow_up.png +0 -0
- data/app/assets/images/fastui/arrow/cross.png +0 -0
- data/app/assets/images/fastui/cross.png +0 -0
- data/app/assets/images/fastui/key_go.png +0 -0
- data/app/assets/images/fastui/list1211.png +0 -0
- data/app/assets/images/fastui/loading.gif +0 -0
- data/app/assets/images/fastui/lock.png +0 -0
- data/app/assets/images/fastui/locked.png +0 -0
- data/app/assets/images/fastui/table/help.png +0 -0
- data/app/assets/images/fastui/table/table.png +0 -0
- data/app/assets/images/fastui/table/table_add.png +0 -0
- data/app/assets/images/fastui/table/table_delete.png +0 -0
- data/app/assets/images/fastui/table/table_edit.png +0 -0
- data/app/assets/images/fastui/table/table_save.png +0 -0
- data/app/assets/images/fastui/upload.png +0 -0
- data/app/assets/javascripts/fastui/app/Ctx.js +33 -0
- data/app/assets/javascripts/fastui/app/Env.js +38 -0
- data/app/assets/javascripts/fastui/app/Evaluator.js +6 -0
- data/app/assets/javascripts/fastui/app/inflection.js +656 -0
- data/app/assets/javascripts/fastui/app/store/MListMgr.js +34 -0
- data/app/assets/javascripts/fastui/app/store/MWindowMgr.js +27 -0
- data/app/assets/javascripts/fastui/app/view/FormFactory.js +11 -0
- data/app/assets/javascripts/fastui/app/view/Rest.js +40 -0
- data/app/assets/javascripts/fastui/app/view/VCommentForm.js +53 -0
- data/app/assets/javascripts/fastui/app/view/VCriteria.js +25 -0
- data/app/assets/javascripts/fastui/app/view/VCustomForm.js +34 -0
- data/app/assets/javascripts/fastui/app/view/VCustomTab.js +266 -0
- data/app/assets/javascripts/fastui/app/view/VForm.js +117 -0
- data/app/assets/javascripts/fastui/app/view/VGrid.js +172 -0
- data/app/assets/javascripts/fastui/app/view/VHelpWindow.js +21 -0
- data/app/assets/javascripts/fastui/app/view/VLoginForm.js +101 -0
- data/app/assets/javascripts/fastui/app/view/VLoginWindow.js +73 -0
- data/app/assets/javascripts/fastui/app/view/VMenu.js +75 -0
- data/app/assets/javascripts/fastui/app/view/VSearchWindow.js +102 -0
- data/app/assets/javascripts/fastui/app/view/VTab.js +293 -0
- data/app/assets/javascripts/fastui/app/view/VToolbar.js +23 -0
- data/app/assets/javascripts/fastui/app/view/VTreeGrid.js +158 -0
- data/app/assets/javascripts/fastui/app/view/VVWindow.js +72 -0
- data/app/assets/javascripts/fastui/app/view/VWindow.js +52 -0
- data/app/assets/javascripts/fastui/app/view/Viewport.js +54 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VCheckBox.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VCheckboxGroup.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VDate.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VFieldFactory.js +77 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VFile.js +22 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VHtmlEditor.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VLongComboBox.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VLookup.js +45 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VMultipleChoice.js +46 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VNumber.js +18 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VSexSelect.js +30 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VSingleChoice.js +35 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VText.js +17 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VTextArea.js +19 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VTree.js +17 -0
- data/app/assets/javascripts/fastui/app/view/vfield/VYesOrNo.js +30 -0
- data/app/assets/javascripts/fastui/application.js +18 -0
- data/app/assets/javascripts/fastui/data/mwindows.json +7 -0
- data/app/assets/javascripts/fastui/data/updateMWindows.json +4 -0
- data/app/assets/javascripts/fastui/extjs4/locale/ext-lang-zh_CN.js +304 -0
- data/app/assets/javascripts/fastui/fastui.js +23 -0
- data/app/assets/stylesheets/fastui/admin.css +95 -0
- data/app/assets/stylesheets/fastui/application.css +14 -0
- data/app/controllers/fastui/admin_controller.rb +9 -0
- data/app/controllers/fastui/application_controller.rb +19 -0
- data/app/controllers/fastui/m_list_items_controller.rb +64 -0
- data/app/controllers/fastui/m_lists_controller.rb +58 -0
- data/app/controllers/fastui/m_menu_items_controller.rb +69 -0
- data/app/controllers/fastui/m_menus_controller.rb +58 -0
- data/app/controllers/fastui/m_orgs_controller.rb +62 -0
- data/app/controllers/fastui/m_people_controller.rb +89 -0
- data/app/controllers/fastui/m_roles_controller.rb +61 -0
- data/app/controllers/fastui/m_views_controller.rb +18 -0
- data/app/controllers/fastui/sessions_controller.rb +42 -0
- data/app/helpers/fastui/admin_helper.rb +4 -0
- data/app/helpers/fastui/application_helper.rb +4 -0
- data/app/models/fastui/acl.rb +21 -0
- data/app/models/fastui/ctx.rb +15 -0
- data/app/models/fastui/env.rb +16 -0
- data/app/models/fastui/m_acl_entry.rb +5 -0
- data/app/models/fastui/m_list.rb +6 -0
- data/app/models/fastui/m_list_item.rb +8 -0
- data/app/models/fastui/m_menu.rb +10 -0
- data/app/models/fastui/m_menu_item.rb +11 -0
- data/app/models/fastui/m_object.rb +41 -0
- data/app/models/fastui/m_org.rb +16 -0
- data/app/models/fastui/m_person.rb +21 -0
- data/app/models/fastui/m_relationship.rb +9 -0
- data/app/models/fastui/m_role.rb +11 -0
- data/app/models/fastui/user_authenticator.rb +18 -0
- data/app/views/fastui/admin/index.html.erb +2 -0
- data/app/views/layouts/fastui/application.html.erb +22 -0
- data/config/routes.rb +19 -0
- data/db/migrate/20121017013727_create_fastui_m_menu_items.rb +28 -0
- data/db/migrate/20121017014112_create_fastui_m_menus.rb +20 -0
- data/db/migrate/20121017024943_create_fastui_m_orgs.rb +26 -0
- data/db/migrate/20121017025014_create_fastui_m_people.rb +24 -0
- data/db/migrate/20121204021053_create_fastui_m_roles.rb +22 -0
- data/db/migrate/20121204061207_create_fastui_m_relationships.rb +25 -0
- data/db/migrate/20121211062955_create_fastui_m_lists.rb +23 -0
- data/db/migrate/20121211074436_create_fastui_m_list_items.rb +21 -0
- data/db/migrate/20121217020606_create_fastui_m_acl_entries.rb +22 -0
- data/lib/fastui/engine.rb +8 -0
- data/lib/fastui/m_model.rb +26 -0
- data/lib/fastui/tab.rb +26 -0
- data/lib/fastui/version.rb +3 -0
- data/lib/fastui/view.rb +32 -0
- data/lib/fastui/window.rb +43 -0
- data/lib/fastui.rb +8 -0
- data/lib/generators/fastui/USAGE +21 -0
- data/lib/generators/fastui/install_generator.rb +31 -0
- data/lib/generators/fastui/templates/fastui_config.erb +77 -0
- data/lib/tasks/create_sys_data.rake +11 -0
- data/lib/tasks/fastui_tasks.rake +707 -0
- data/lib/tasks/loading_data.rake +28 -0
- metadata +276 -0
@@ -0,0 +1,293 @@
|
|
1
|
+
Ext.define('FastUI.view.VTab', {
|
2
|
+
extend: 'Ext.Panel',
|
3
|
+
requires: ['FastUI.view.FormFactory'],
|
4
|
+
alias: 'widget.vtab',
|
5
|
+
valueObject: {},
|
6
|
+
winId: 0,
|
7
|
+
winCtx: {},
|
8
|
+
layout: "card",
|
9
|
+
border: false,
|
10
|
+
initComponent: function () {
|
11
|
+
this.id = 'tab-' + this.getValue('name');
|
12
|
+
this.grid_kind = this.getValue('grid_kind');
|
13
|
+
this.title = this.getValue('title');
|
14
|
+
this.form_kind = this.getValue('form_kind');
|
15
|
+
this.rest = Ext.create('FastUI.view.Rest', this.getMEntity());
|
16
|
+
this.tbar = Ext.create('Ext.toolbar.Toolbar', {
|
17
|
+
id: this.id + 'tbar',
|
18
|
+
defaults: {
|
19
|
+
scale: 'small' //scale: 'large'
|
20
|
+
},
|
21
|
+
items: [
|
22
|
+
{
|
23
|
+
id: this.id + 'new',
|
24
|
+
text: '新建',
|
25
|
+
iconCls: 'fastui-btn-new',
|
26
|
+
handler: function () {
|
27
|
+
// this.cmdCreate();
|
28
|
+
this.getForm();
|
29
|
+
this.vform.cmdCreate();
|
30
|
+
this.getLayout().setActiveItem(this.vform.id);
|
31
|
+
|
32
|
+
this.getBtn('save').enable();
|
33
|
+
this.getBtn('edit').disable();
|
34
|
+
},
|
35
|
+
scope: this
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: this.id + 'edit',
|
39
|
+
text: '编辑',
|
40
|
+
disabled: true,
|
41
|
+
iconCls: 'fastui-btn-edit',
|
42
|
+
handler: function () {
|
43
|
+
this.getForm();
|
44
|
+
this.vform.cmdEdit();
|
45
|
+
this.getLayout().setActiveItem(this.vform.id);
|
46
|
+
|
47
|
+
// this.cmdEdit();
|
48
|
+
this.getBtn('save').enable();
|
49
|
+
},
|
50
|
+
scope: this
|
51
|
+
},
|
52
|
+
{
|
53
|
+
id: this.id + 'list',
|
54
|
+
text: '列表',
|
55
|
+
iconCls: 'fastui-btn-list',
|
56
|
+
handler: function () {
|
57
|
+
this.cmdList();
|
58
|
+
this.getBtn('save').disable();
|
59
|
+
this.getBtn('new').enable();
|
60
|
+
this.getBtn('edit').enable();
|
61
|
+
},
|
62
|
+
scope: this
|
63
|
+
},
|
64
|
+
{
|
65
|
+
id: this.id + 'save',
|
66
|
+
text: '保存',
|
67
|
+
disabled: true,
|
68
|
+
iconCls: 'fastui-btn-save',
|
69
|
+
handler: function () {
|
70
|
+
// this.cmdSave();
|
71
|
+
this.getForm();
|
72
|
+
this.vform.cmdSave();
|
73
|
+
this.vgrid.store.reload();
|
74
|
+
this.getLayout().setActiveItem(this.vgrid.id);
|
75
|
+
this.getBtn('save').disable();
|
76
|
+
},
|
77
|
+
scope: this
|
78
|
+
},
|
79
|
+
{
|
80
|
+
id: this.id + 'del',
|
81
|
+
text: '删除',
|
82
|
+
disabled: true,
|
83
|
+
iconCls: 'fastui-btn-del',
|
84
|
+
handler: function () {
|
85
|
+
this.cmdDelete();
|
86
|
+
this.getBtn('edit').disable();
|
87
|
+
},
|
88
|
+
scope: this
|
89
|
+
},
|
90
|
+
{
|
91
|
+
id: this.id + 'help',
|
92
|
+
text: '帮助',
|
93
|
+
iconCls: 'fastui-btn-help',
|
94
|
+
handler: function () {
|
95
|
+
this.cmdHelp();
|
96
|
+
},
|
97
|
+
scope: this
|
98
|
+
}
|
99
|
+
]
|
100
|
+
});
|
101
|
+
//FastUI.Env.setTabCtx(FastUI.Env.getWinCtx('winNo','win_id'),'tabNo','tab_id',this.id);
|
102
|
+
this.callParent();
|
103
|
+
},
|
104
|
+
getBtn: function (name) {
|
105
|
+
return this.getDockedComponent(this.id + 'tbar').items.get(this.id + name);
|
106
|
+
},
|
107
|
+
getValue: function (key) {
|
108
|
+
return this.valueObject[key] || '';
|
109
|
+
},
|
110
|
+
getMEntity: function () {
|
111
|
+
return this.valueObject.entity;
|
112
|
+
},
|
113
|
+
listeners: {
|
114
|
+
activate: function (tab, opts) {
|
115
|
+
this.cmdList();
|
116
|
+
}
|
117
|
+
},
|
118
|
+
getParams: function () {
|
119
|
+
var p = {};
|
120
|
+
var tab = Ext.getCmp('tab-' + this.getValue('included_tab'));
|
121
|
+
if (tab) {
|
122
|
+
//p[tab.rest.getKey()] = tab.getSelectedId();
|
123
|
+
//alert( tab.rest.getKey());
|
124
|
+
p[tab.rest.getKey()] = this.winCtx.getWinCtx(this.winId, tab.rest.getKey());
|
125
|
+
}
|
126
|
+
return p;
|
127
|
+
},
|
128
|
+
getVGrid: function () {
|
129
|
+
if (!this.vgrid) {
|
130
|
+
if (this.grid_kind == 'VTreeGrid') {
|
131
|
+
this.vgrid = Ext.create('FastUI.view.VTreeGrid', {tab: this});
|
132
|
+
} else {
|
133
|
+
this.vgrid = Ext.create('FastUI.view.VGrid', {tab: this});
|
134
|
+
}
|
135
|
+
this.add(this.vgrid);
|
136
|
+
} else {
|
137
|
+
if (this.grid_kind != 'VTreeGrid') {
|
138
|
+
var params1 = this.vgrid.store.getProxy().extraParams;
|
139
|
+
var params2 = this.getParams();
|
140
|
+
if (!Ext.Object.equals(params1, params2)) {
|
141
|
+
this.vgrid.store.getProxy().extraParams = params2;
|
142
|
+
this.vgrid.store.reload();
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
return this.vgrid;
|
147
|
+
},
|
148
|
+
getSelectedId: function () {
|
149
|
+
return this.getVGrid().selectedId();
|
150
|
+
},
|
151
|
+
cmdList: function () {
|
152
|
+
var grid = this.getVGrid();
|
153
|
+
this.getLayout().setActiveItem(grid.id);
|
154
|
+
},
|
155
|
+
getForm: function () {
|
156
|
+
if (!this.vform) {
|
157
|
+
this.vform = FastUI.view.FormFactory.createForm(this.form_kind, this);
|
158
|
+
this.add(this.vform);
|
159
|
+
}
|
160
|
+
return this.vform.getForm();
|
161
|
+
// if (this.form_kind == '') {
|
162
|
+
// if (!this.vform) {
|
163
|
+
// this.vform = Ext.create('FastUI.view.VForm', {tab: this});
|
164
|
+
// this.add(this.vform);
|
165
|
+
// }
|
166
|
+
// } else {
|
167
|
+
// this.vform = Ext.create('FastUI.view.' + this.form_kind, {tab: arguments.length == 0 ? this : arguments[0]});
|
168
|
+
// }
|
169
|
+
|
170
|
+
|
171
|
+
},
|
172
|
+
// cmdCreate: function () {
|
173
|
+
// var form = this.getForm();
|
174
|
+
// form.url = this.rest.createPath();
|
175
|
+
// form.method = 'POST';
|
176
|
+
// form.reset();
|
177
|
+
//// if (this.form_kind == '') {
|
178
|
+
// this.setAutoFields(form);
|
179
|
+
//// }
|
180
|
+
// this.getLayout().setActiveItem(this.vform.id);
|
181
|
+
// },
|
182
|
+
// setAutoFields: function (form) {
|
183
|
+
// var temp = {};
|
184
|
+
// var logic = "";
|
185
|
+
// Ext.each(this.getValue('m_fields'), function (mfield) {
|
186
|
+
// if (mfield.default_logic && mfield.default_logic.length > 0) {
|
187
|
+
// logic = this.winCtx.parseCtx(this.winId, mfield.default_logic);
|
188
|
+
// temp[this.rest.getTableName() + '[' + mfield.m_property.name + ']'] = Ext.decode(logic);
|
189
|
+
// }
|
190
|
+
// }, this);
|
191
|
+
// form.setValues(temp);
|
192
|
+
// },
|
193
|
+
// cmdEdit: function () {
|
194
|
+
// var id = this.getVGrid().selectedId();
|
195
|
+
//// if (this.form_kind == '') {
|
196
|
+
// var form = this.getForm();
|
197
|
+
// form.url = this.rest.updatePath(id);
|
198
|
+
// form.method = 'PUT';
|
199
|
+
// this.setEditValues(id, form);
|
200
|
+
// this.getLayout().setActiveItem(this.vform.id);
|
201
|
+
//// } else {
|
202
|
+
//// Ext.Ajax.request({
|
203
|
+
//// url: this.rest.editPath(id),
|
204
|
+
//// success: function (response) {
|
205
|
+
//// this.getForm(Ext.decode(response.responseText));
|
206
|
+
//// this.getLayout().setActiveItem(this.vform.id);
|
207
|
+
//// }.bind(this)
|
208
|
+
//// });
|
209
|
+
//// }
|
210
|
+
//// this.getLayout().setActiveItem(this.vform.id);
|
211
|
+
// },
|
212
|
+
// setEditValues: function (id, form) {
|
213
|
+
// Ext.Ajax.request({
|
214
|
+
// url: this.rest.editPath(id),
|
215
|
+
// success: function (response) {
|
216
|
+
// var data = Ext.decode(response.responseText);
|
217
|
+
// var k, o = {};
|
218
|
+
// for (k in data) {
|
219
|
+
// if (k.match(/_id$/)) {
|
220
|
+
// var attr = data[k.replace('_id', '')];
|
221
|
+
// var title = data[k];
|
222
|
+
// if (attr && attr.title) {
|
223
|
+
// title = attr.title
|
224
|
+
// }
|
225
|
+
// o[this.rest.getTableName() + '[' + k + ']'] = {id: data[k], title: title};
|
226
|
+
// } else if (k.match(/_ids$/)) {
|
227
|
+
// o[this.rest.getTableName() + '[' + k + '][]'] = data[k];
|
228
|
+
// }
|
229
|
+
// else {
|
230
|
+
// o[this.rest.getTableName() + '[' + k + ']'] = data[k];
|
231
|
+
// }
|
232
|
+
// }
|
233
|
+
//// alert(Ext.encode(o));
|
234
|
+
// form.setValues(o);
|
235
|
+
// }, scope: this
|
236
|
+
// });
|
237
|
+
// },
|
238
|
+
cmdDelete: function () {
|
239
|
+
var id = this.getVGrid().selectedId();
|
240
|
+
Ext.MessageBox.confirm('提示', '确定要删除此记录吗?', function (btn) {
|
241
|
+
if (btn == 'yes') {
|
242
|
+
this.constructAjaxRequest({
|
243
|
+
url: this.rest.deletePath(id),
|
244
|
+
method: 'DELETE',
|
245
|
+
success: function () {
|
246
|
+
this.vgrid.store.reload();
|
247
|
+
this.getLayout().setActiveItem(this.vgrid.id);
|
248
|
+
Ext.MessageBox.alert("提示", "操作成功!")
|
249
|
+
},
|
250
|
+
failure: function () {
|
251
|
+
Ext.MessageBox.alert("提示", "操作失败!")
|
252
|
+
},
|
253
|
+
scope: this
|
254
|
+
});
|
255
|
+
}
|
256
|
+
}, this);
|
257
|
+
},
|
258
|
+
cmdHelp: function () {
|
259
|
+
var helpWindow = Ext.create('FastUI.view.VHelpWindow', {html: this.getValue('help')});
|
260
|
+
helpWindow.show();
|
261
|
+
},
|
262
|
+
// cmdSave: function () {
|
263
|
+
// if (this.vform) {
|
264
|
+
// var form = this.getForm();
|
265
|
+
// if (form.isValid()) {
|
266
|
+
// this.constructAjaxRequest({
|
267
|
+
// url: form.url,
|
268
|
+
// method: form.method,
|
269
|
+
// params: form.getValues(false, false, false),
|
270
|
+
// success: function () {
|
271
|
+
// this.vgrid.store.reload();
|
272
|
+
// this.getLayout().setActiveItem(this.vgrid.id);
|
273
|
+
// Ext.MessageBox.alert("提示", "操作成功!")
|
274
|
+
// },
|
275
|
+
// failure: function () {
|
276
|
+
// Ext.MessageBox.alert("提示", "操作失败!")
|
277
|
+
// },
|
278
|
+
// scope: this
|
279
|
+
// });
|
280
|
+
// }
|
281
|
+
// }
|
282
|
+
// },
|
283
|
+
constructAjaxRequest: function (options) {
|
284
|
+
return Ext.Ajax.request({
|
285
|
+
url: options.url,
|
286
|
+
method: options.method,
|
287
|
+
params: options.params,
|
288
|
+
success: options.success,
|
289
|
+
failure: options.failure,
|
290
|
+
scope: options.scope
|
291
|
+
});
|
292
|
+
}
|
293
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Ext.define('FastUI.view.VToolbar', {
|
2
|
+
extend:'Ext.toolbar.Toolbar',
|
3
|
+
valueObject:{},
|
4
|
+
winId:0,
|
5
|
+
winCtx:{},
|
6
|
+
initComponent:function () {
|
7
|
+
this.items = [
|
8
|
+
{
|
9
|
+
text: 'Button'
|
10
|
+
},
|
11
|
+
{
|
12
|
+
xtype: 'splitbutton',
|
13
|
+
text : 'Split Button'
|
14
|
+
},
|
15
|
+
'->',
|
16
|
+
{
|
17
|
+
xtype : 'textfield',
|
18
|
+
name : 'field1',
|
19
|
+
emptyText: 'enter search term'
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
});
|
@@ -0,0 +1,158 @@
|
|
1
|
+
Ext.define('FastUI.view.VTreeGrid', {
|
2
|
+
extend: 'Ext.tree.Panel',
|
3
|
+
requires: ['FastUI.store.MListMgr'],
|
4
|
+
collapsible: true,
|
5
|
+
useArrows: true,
|
6
|
+
rootVisible: false,
|
7
|
+
multiSelect: false,
|
8
|
+
singleExpand: true,
|
9
|
+
border: false,
|
10
|
+
initComponent: function () {
|
11
|
+
this.title = this.getValue('title');
|
12
|
+
this.columns = this.getTreeGColumns();
|
13
|
+
this.store = this.getTreeGStore();
|
14
|
+
this.callParent();
|
15
|
+
},
|
16
|
+
listeners:{
|
17
|
+
itemclick:function (view, record, item, index, e, eOpts) {
|
18
|
+
this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getKey(), record.get('id'));
|
19
|
+
this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getTitle(), record.get('title'));
|
20
|
+
if (record.get('m_entity_id')) {
|
21
|
+
this.tab.winCtx.setWinCtx(this.tab.winId, 'm_entity_id', record.get('m_entity_id'));
|
22
|
+
}
|
23
|
+
this.tab.getBtn('edit').enable();
|
24
|
+
this.tab.getBtn('del').enable();
|
25
|
+
}
|
26
|
+
},
|
27
|
+
selectedId: function () {
|
28
|
+
var id = 0;
|
29
|
+
var records = this.getSelectionModel().getSelection();
|
30
|
+
if (!Ext.isEmpty(records)) {
|
31
|
+
id = records[0].get('id');
|
32
|
+
}
|
33
|
+
return id;
|
34
|
+
},
|
35
|
+
getValue: function (key) {
|
36
|
+
return this.tab.valueObject[key] || '';
|
37
|
+
},
|
38
|
+
|
39
|
+
getTreeGStore: function () {
|
40
|
+
return new Ext.data.TreeStore({
|
41
|
+
autoLoad: true,
|
42
|
+
proxy:{
|
43
|
+
type: 'ajax',
|
44
|
+
url: this.tab.rest.indexPath(),
|
45
|
+
reader:{
|
46
|
+
type:'json',
|
47
|
+
root:'',
|
48
|
+
record:''
|
49
|
+
//successProperty:''
|
50
|
+
}
|
51
|
+
},
|
52
|
+
root: {
|
53
|
+
name:'Root',
|
54
|
+
expanded: true
|
55
|
+
},
|
56
|
+
fields: this.getTreeGFields()
|
57
|
+
})
|
58
|
+
},
|
59
|
+
getMColumns: function () {
|
60
|
+
return this.tab.valueObject.members || [];
|
61
|
+
},
|
62
|
+
getTreeGFields: function () {
|
63
|
+
var fields = [];
|
64
|
+
Ext.each(this.getMColumns(), function (column) {
|
65
|
+
var field = {
|
66
|
+
name: column.name,
|
67
|
+
type: 'auto'
|
68
|
+
};
|
69
|
+
switch (column.datatype) {
|
70
|
+
case 'VLookup':
|
71
|
+
var entity = {
|
72
|
+
name: column.name.replace('_id', ''),
|
73
|
+
type: 'auto'
|
74
|
+
};
|
75
|
+
fields.push(entity);
|
76
|
+
}
|
77
|
+
fields.push(field);
|
78
|
+
}, this);
|
79
|
+
return fields;
|
80
|
+
},
|
81
|
+
getTreeGColumns: function () {
|
82
|
+
var columns = [];
|
83
|
+
Ext.each(this.getMColumns(), function (column) {
|
84
|
+
switch (column.datatype) {
|
85
|
+
case 'VTree':
|
86
|
+
columns.push({
|
87
|
+
text: column.title,
|
88
|
+
xtype: 'treecolumn',
|
89
|
+
flex: 2.5,
|
90
|
+
dataIndex: column.name
|
91
|
+
});
|
92
|
+
break;
|
93
|
+
|
94
|
+
case 'VLookup':
|
95
|
+
var entity = column.name.replace('_id', '');
|
96
|
+
columns.push({
|
97
|
+
text: column.title,
|
98
|
+
xtype: 'templatecolumn',
|
99
|
+
dataIndex: column.name,
|
100
|
+
tpl: new Ext.XTemplate(
|
101
|
+
'<tpl for="' + entity + '">',
|
102
|
+
'{title}',
|
103
|
+
'</tpl>'
|
104
|
+
)
|
105
|
+
});
|
106
|
+
break;
|
107
|
+
|
108
|
+
case 'VSingleChoice':
|
109
|
+
var list_store = FastUI.store.MListMgr.getStore(column.name);
|
110
|
+
columns.push({
|
111
|
+
text: column.title,
|
112
|
+
dataIndex: column.name,
|
113
|
+
renderer: function (val) {
|
114
|
+
var index = list_store.findExact('name', val);
|
115
|
+
if (index > -1) {
|
116
|
+
var rs = list_store.getAt(index).data;
|
117
|
+
return rs.title;
|
118
|
+
}
|
119
|
+
return "";
|
120
|
+
}
|
121
|
+
});
|
122
|
+
break;
|
123
|
+
|
124
|
+
case 'VSexSelect':
|
125
|
+
columns.push({
|
126
|
+
text: column.title,
|
127
|
+
dataIndex: column.name,
|
128
|
+
renderer: function (val) {
|
129
|
+
return val ? '男' : '女'
|
130
|
+
}
|
131
|
+
});
|
132
|
+
break;
|
133
|
+
|
134
|
+
case 'VYesOrNo':
|
135
|
+
columns.push({
|
136
|
+
text: column.title,
|
137
|
+
dataIndex: column.name,
|
138
|
+
renderer: function (val) {
|
139
|
+
return val ? '是' : '否';
|
140
|
+
}
|
141
|
+
});
|
142
|
+
break;
|
143
|
+
|
144
|
+
default:
|
145
|
+
columns.push({
|
146
|
+
text: column.title,
|
147
|
+
dataIndex: column.name
|
148
|
+
});
|
149
|
+
break;
|
150
|
+
}
|
151
|
+
|
152
|
+
}, this);
|
153
|
+
return columns;
|
154
|
+
}
|
155
|
+
});
|
156
|
+
|
157
|
+
|
158
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
Ext.define('FastUI.view.VVWindow', {
|
2
|
+
extend:'Ext.ux.tab.VerticalPanel',
|
3
|
+
alias:'widget.vvwindow',
|
4
|
+
valueObject: {},
|
5
|
+
closable: true,
|
6
|
+
activeTab:0,
|
7
|
+
plain:true,
|
8
|
+
border:false,
|
9
|
+
//bodyStyle: 'padding-left: 2px',
|
10
|
+
defaults:{autoScroll:true, border: false},
|
11
|
+
tabsConfig:{
|
12
|
+
width:130,
|
13
|
+
textAlign:'left',
|
14
|
+
marginTop:50 /* Push the tab strip down 30px from top. If not set, defaults to 0.*/
|
15
|
+
},
|
16
|
+
|
17
|
+
initComponent:function () {
|
18
|
+
this.winCtx = FastUI.Env.getCtx();
|
19
|
+
this.title = this.getValue('title');
|
20
|
+
this.subs = [];
|
21
|
+
this.callParent();
|
22
|
+
},
|
23
|
+
getValue:function(key){
|
24
|
+
return this.valueObject[key];
|
25
|
+
},
|
26
|
+
getTabValues:function(){
|
27
|
+
return this.valueObject.m_tabs;
|
28
|
+
},
|
29
|
+
listeners:{
|
30
|
+
beforerender:function (vwindow, opts) {
|
31
|
+
this.loadTabs(vwindow, opts);
|
32
|
+
}
|
33
|
+
},
|
34
|
+
loadTabs:function (vwindow, opts) {
|
35
|
+
vwindow.getSubTabs(0,'');
|
36
|
+
Ext.each(vwindow.subs, function (mtab) {
|
37
|
+
// var vTab ;
|
38
|
+
// switch(vwindow.getValue('window_kind')){
|
39
|
+
// case 'maintain':
|
40
|
+
// vTab = Ext.create('FastUI.view.VTab', {
|
41
|
+
// valueObject: mtab,
|
42
|
+
// winId:vwindow.id,
|
43
|
+
// winCtx: vwindow.winCtx
|
44
|
+
// });
|
45
|
+
// break;
|
46
|
+
// case 'custom':
|
47
|
+
// vTab = Ext.create('FastUI.view.VCustomTab', {
|
48
|
+
// valueObject: mtab,
|
49
|
+
// winId:vwindow.id,
|
50
|
+
// winCtx: vwindow.winCtx
|
51
|
+
// });
|
52
|
+
// break;
|
53
|
+
// }
|
54
|
+
var vTab = Ext.create('FastUI.view.VTab', {
|
55
|
+
valueObject: mtab,
|
56
|
+
winId:vwindow.id,
|
57
|
+
winCtx: vwindow.winCtx
|
58
|
+
});
|
59
|
+
vwindow.add(vTab);
|
60
|
+
});
|
61
|
+
},
|
62
|
+
getSubTabs:function(pid,level){
|
63
|
+
Ext.each(this.getTabValues(),function(tab){
|
64
|
+
if(tab.included_tab_id == pid){
|
65
|
+
tab.level = level;
|
66
|
+
this.subs.push(tab);
|
67
|
+
this.getSubTabs(tab.id,level + ' ');
|
68
|
+
}
|
69
|
+
},this);
|
70
|
+
}
|
71
|
+
|
72
|
+
});
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Ext.define('FastUI.view.VWindow', {
|
2
|
+
extend:'Ext.TabPanel',
|
3
|
+
requires:['FastUI.Env'],
|
4
|
+
alias:'widget.vwindow',
|
5
|
+
valueObject: {},
|
6
|
+
activeTab: 0,
|
7
|
+
closable: true,
|
8
|
+
tabPosition : "left",
|
9
|
+
border:true,
|
10
|
+
initComponent:function(){
|
11
|
+
this.winCtx = FastUI.Env.getCtx();
|
12
|
+
this.title = this.getValue('title');
|
13
|
+
this.subs = [];
|
14
|
+
this.callParent();
|
15
|
+
},
|
16
|
+
getValue:function(key){
|
17
|
+
return this.valueObject[key];
|
18
|
+
},
|
19
|
+
getTabValues:function(){
|
20
|
+
return this.valueObject.tabs;
|
21
|
+
},
|
22
|
+
listeners:{
|
23
|
+
afterrender: function(vwindow, opts) {
|
24
|
+
|
25
|
+
},
|
26
|
+
beforerender:function (vwindow, opts) {
|
27
|
+
this.loadTabs(vwindow, opts);
|
28
|
+
}
|
29
|
+
},
|
30
|
+
loadTabs:function (vwindow, opts) {
|
31
|
+
//vwindow.getSubTabs(0,'');
|
32
|
+
Ext.each(vwindow.getTabValues(), function (mtab) {
|
33
|
+
var vTab = Ext.create('FastUI.view.VTab', {
|
34
|
+
valueObject: mtab,
|
35
|
+
winId:vwindow.id,
|
36
|
+
winCtx: vwindow.winCtx
|
37
|
+
});
|
38
|
+
vwindow.add(vTab);
|
39
|
+
});
|
40
|
+
vwindow.setActiveTab(0);
|
41
|
+
},
|
42
|
+
getSubTabs:function(pid,level){
|
43
|
+
Ext.each(this.getTabValues(),function(tab){
|
44
|
+
if(tab.included_tab == pid){
|
45
|
+
tab.level = level;
|
46
|
+
this.subs.push(tab);
|
47
|
+
this.getSubTabs(tab.id,level + ' ');
|
48
|
+
}
|
49
|
+
},this);
|
50
|
+
}
|
51
|
+
});
|
52
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Ext.define('FastUI.view.Viewport', {
|
2
|
+
extend:'Ext.container.Viewport',
|
3
|
+
id:'port',
|
4
|
+
layout:'border',
|
5
|
+
items:[
|
6
|
+
{
|
7
|
+
height:43,
|
8
|
+
html:"<div class=\'fastui-header\'><span class=\'caption\'>"+ app_project +"</span><span class=\'version\'>("+ app_version +")</span></div>",
|
9
|
+
region:"north",
|
10
|
+
split:true,
|
11
|
+
xtype:"component"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
region:"west",
|
15
|
+
activeTab:0,
|
16
|
+
collapseMode:"mini",
|
17
|
+
collapsible:true,
|
18
|
+
split:true,
|
19
|
+
width:295,
|
20
|
+
defaults:{border:false},
|
21
|
+
items:[Ext.create('FastUI.view.VMenu'),{title:'帮助',iconCls:'fastui-btn-help'}],
|
22
|
+
xtype:"tabpanel"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
region:"south",
|
26
|
+
border:false,
|
27
|
+
height:28,
|
28
|
+
items:[{xtype:"tbfill"},{style:"font-weight:bold",text:app_copyright ,xtype:"tbtext"}],
|
29
|
+
xtype:"toolbar"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
id:'mycenter',
|
33
|
+
region: 'center',
|
34
|
+
xtype: 'tabpanel', // TabPanel itself has no title
|
35
|
+
activeTab: 0, // First tab active by default
|
36
|
+
//maskOnDisable: false,
|
37
|
+
|
38
|
+
items: [{
|
39
|
+
title: '首页',
|
40
|
+
iconCls:'fastui-home',
|
41
|
+
border:false,
|
42
|
+
|
43
|
+
html: 'The first tab\'s content. Others may be added dynamically'
|
44
|
+
}]
|
45
|
+
}
|
46
|
+
],
|
47
|
+
listeners: {
|
48
|
+
afterrender: function() {
|
49
|
+
var mask = Ext.get('fastui-loading');
|
50
|
+
mask.fadeOut({callback: function(){ mask.destroy(); }});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
});
|
54
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Ext.define('FastUI.view.vfield.VCheckBox',{
|
2
|
+
extend: 'Ext.form.field.CheckBox',
|
3
|
+
|
4
|
+
valueObject: {},
|
5
|
+
winCtx:{},
|
6
|
+
winId:0,
|
7
|
+
rest:{},
|
8
|
+
|
9
|
+
initComponent:function(){
|
10
|
+
this.fieldLabel = this.getFValue('title');
|
11
|
+
this.name = this.rest.getTableName() + '[' + this.getFValue('m_property').name + ']';
|
12
|
+
this.disabled = this.getFValue('is_readonly');
|
13
|
+
this.allowBlank = true;
|
14
|
+
this.callParent();
|
15
|
+
},
|
16
|
+
getFValue:function (key) {
|
17
|
+
return this.valueObject[key];
|
18
|
+
}
|
19
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Ext.define('FastUI.view.vfield.VCheckboxGroup',{
|
2
|
+
extend: 'Ext.form.VCheckboxGroup',
|
3
|
+
|
4
|
+
valueObject: {},
|
5
|
+
winCtx:{},
|
6
|
+
winId:0,
|
7
|
+
rest:{},
|
8
|
+
|
9
|
+
initComponent:function(){
|
10
|
+
this.fieldLabel = this.getFValue('title');
|
11
|
+
this.name = this.rest.getTableName() + '[' + this.getFValue('m_property').name + ']';
|
12
|
+
this.disabled = this.getFValue('is_readonly');
|
13
|
+
this.allowBlank = true;
|
14
|
+
this.callParent();
|
15
|
+
},
|
16
|
+
getFValue:function (key) {
|
17
|
+
return this.valueObject[key];
|
18
|
+
}
|
19
|
+
});
|