| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /**
- * Created by zhouy on 2018/10/18.
- */
- Ext.define('saas.view.document.address.DataList', {
- extend: 'saas.view.document.kind.Kind',
- xtype: 'document-address-datalist',
- viewModel: 'document-address-datalist',
- controller:'document-address-datalist',
- defaultType:'address',
- windowType:'document-address-window',
- _openUrl:'/api/document/address/setDefault',
- tbar: ['->',{
- xtype:'button',
- text:'新增',
- listeners: {
- click: 'onAdd'
- }
- },{
- xtype:'button',
- text:'刷新',
- listeners: {
- click: 'onRefresh'
- }
- }],
- etc:{
- address:{
- columns: [{
- text: '地址名称',
- dataIndex: 'ad_address',
- flex: 1
- },{
- text: '采购默认地址',
- dataIndex: 'ad_default',
- width:160,
- xtype: 'actioncolumn',
- align : 'center',
- items: [{
- iconCls:'',
- getClass: function(v, meta, rec) {
- if(rec.get('ad_default')==1){
- return 'x-grid-checkcolumn-checked-btn';
- }else{
- return 'x-grid-checkcolumn-btn';
- }
- },
- handler: function(view, rowIndex, colIndex) {
- var rec = view.getStore().getAt(rowIndex);
- var type=rec.get('ad_default')==1?true:false;
- if(type){
- saas.util.BaseUtil.showErrorToast('请启用其它未设置的地址');
- return;
- }
- // 启用
- var form = this.ownerCt.ownerCt.ownerCt;
- var grid = this.ownerCt.ownerCt;
- saas.util.BaseUtil.request({
- url: form._openUrl+'/'+rec.get('id'),
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- saas.util.BaseUtil.showSuccessToast('操作成功');
- grid.store.load();
- }
- })
- .catch(function(e) {
- saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
- });
- }
- }]
- }],
- keyField:'id',
- reqUrl: '/api/document/address/save',
- delUrl: '/api/document/address/delete'
- },
- },
- listeners:{
- afterrender:function(p){
- p.getViewModel().setData({title:'采购交货地址'});
- }
- }
- })
|