| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- Ext.define('saas.util.FormUtil', {
- BaseUtil: Ext.create('saas.util.BaseUtil'),
- // 请求页面组件接口模板
- baseUrl: 'http://192.168.0.181:8560/api/ui/co_view/config?name={xtype}',
- // 模板替换正则
- urlRe: /(.*){xtype}(.*)/g,
-
- /**
- * 获得form的字段配置
- * @param form: form组件
- * @param url: url
- */
- setItems: function(form) {
- var me = this,
- xtype = form.xtype,
- url = me.baseUrl.replace(me.urlRe, '$1' + xtype);
-
- this.BaseUtil.request({url, })
- .then(function(response) {
- var res = Ext.decode(response.responseText);
- if(res.success) {
- var config = res.data, items = [];
- if(config) {
- items = config.items,
- form.addItems(items);
- }
- form.fireEvent('afterSetItems', form, items);
- }
- })
- .catch(function(response) {
- console.error(response);
- });
- },
- loadData: function(form) {
- }
- });
|