| 123456789101112131415161718192021222324252627282930313233 |
- 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}',
-
- /**
- * 获得form的字段配置
- * @param form: form组件
- * @param url: url
- */
- getFormItems: function(form) {
- var me = this,
- xtype = form.xtype,
- reg = /(.*){xtype}(.*)/g,
- url = me.baseUrl.replace(reg, '$1' + xtype);
-
- this.BaseUtil.request({url})
- .then(function(response) {
- var res = Ext.decode(response.responseText);
- if(res.success) {
- var config = res.data;
- form.add(config.items);
- }
- })
- .catch(function(response) {
- console.log(response);
- });
- }
- });
|