/** * Created by zhouy on 2018/10/18. */ Ext.define('saas.view.document.kind.Kind', { extend: 'Ext.panel.Panel', xtype: 'document-kind', autoScroll: true, layout:'fit', controller:'document-kind', viewModel: { type: 'document-kind' }, defaultType:'', requires: [ 'Ext.button.Segmented' ], tbar: [{ xtype: 'segmentedbutton', reference: 'dataKind', value: 'customerkind', bind:'{segmented}', items: [{ text: '客户', value: 'customerkind' }, { text: '供应商', value: 'vendorkind' }, { text: '商品', value: 'productkind' }, { text: '收支', value: 'inoutkind' }], listeners: { toggle: 'onKindToggle' } },'->', { xtype:'button', text:'新增', listeners: { click: 'onAdd' } },{ xtype:'button', text:'刷新', listeners: { click: 'onRefresh' } }], items:[{ xtype:'grid', reference: 'document-kind-Grid', margin: '10 0 0 0', flex: 1, frame:true, bind:{ selection: '{selectedCompany}' }, listeners:{ render:'loadDefualt' } }], etc:{ customerkind:{ columns: [{ text: '客户类型', dataIndex: 'ck_name', flex: 1 }], keyField:'id', reqUrl:basePath + 'document/customerkind/save', delUrl:basePath + 'document/customerkind/delete' }, vendorkind:{ columns: [{ text: '供应商类型', dataIndex: 'vk_name', flex: 1 }], keyField:'id', reqUrl:basePath + 'document/vendorkind/save', delUrl:basePath + 'document/vendorkind/delete' }, productkind:{ columns: [{ text: '物料类型', dataIndex: 'pt_name', flex: 1 }], keyField:'id', reqUrl:basePath + 'document/producttype/save', delUrl:basePath + 'document/producttype/delete' }, productbrand:{ columns: [{ text: '物料品牌', dataIndex: 'pb_name', flex: 1 }], keyField:'id', reqUrl:basePath + 'document/productbrand/save', delUrl:basePath + 'document/productbrand/delete' }, bankinformation:{ columns: [{ text: '账户编号', dataIndex: 'bk_bankcode', flex: 1 },{ text: '账户名称', dataIndex: 'bk_bankname', flex: 1 },{ xtype:'datecolumn', text: '日期', dataIndex: 'bk_date', flex: 1 },{ text: '账户类型', dataIndex: 'bk_type', flex: 1 },{ text: '账户期初金额', dataIndex: 'bk_beginamount', flex: 1 },{ text: '账户期末余额', dataIndex: 'bk_thisamount', flex: 1 }], keyField:'id', reqUrl: basePath + 'document/bankinformation/save', delUrl: basePath + 'document/bankinformation/delete' }, inoutkind:{ columns: [{ text: '收支类型', dataIndex: 'ft_name', flex: 1 }], keyField:'id', reqUrl: basePath + 'document/fundinouttype/save', delUrl: basePath + 'document/fundinouttype/delete' }, storeinformation:{ columns: [{ text: '仓库编号', dataIndex: 'wh_code', width: 200 },{ text: '仓库名称', dataIndex: 'wh_description', width: 200 },{ text: '仓库状态码', dataIndex: 'wh_status', width: 0 },{ text: '仓库状态', dataIndex: 'wh_statuscode', width:90, xtype: 'actioncolumn', align : 'center', items: [{ icon:basePath + 'resource/images/16/lock_bg.png', tooltip: '锁定', iconCls:'', getClass: function(v, meta, rec) { if(rec.get('wh_statuscode')=='OPEN'){ this.items[0].tooltip = '不启用'; return 'x-grid-checkcolumn-checked'; }else{ this.items[0].tooltip = '启用'; return 'x-grid-checkcolumn'; } }, handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); var type=rec.get('wh_statuscode')=='OPEN'?true:false; // 禁用/启用 var form = this.ownerCt.ownerCt.ownerCt; var grid = this.ownerCt.ownerCt; form.BaseUtil.request({ url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'), params: '', method: 'POST', }) .then(function(localJson) { if(localJson.success){ showToast('操作成功'); grid.store.load(); } }) .catch(function(res) { console.error(res); showToast('操作失败: ' + res.message); }); } }] }], keyField:'id', reqUrl: basePath + 'document/warehouse/save', delUrl: basePath + 'document/warehouse/delete' } } })