123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- /**
- * Created by zhouy on 2018/10/18.
- */
- Ext.define('trade.saas.view.document.warehouse.DataList', {
- extend: 'saas.view.document.kind.Kind',
- xtype: 'document-warehouse-datalist',
- viewModel: 'document-warehouse-datalist',
- defaultType:'warehouse',
- windowType:'document-warehouse-window',
- _openUrl:'/api/document/warehouse/open',
- _closeUrl:'/api/document/warehouse/close',
- tbar: ['->',{
- xtype:'button',
- text:'新增',
- listeners: {
- click: 'onAdd'
- }
- },{
- xtype:'button',
- text:'刷新',
- listeners: {
- click: 'onRefresh'
- }
- }],
- etc:{
- warehouse:{
- columns: [{
- text: '仓库编号',
- dataIndex: 'wh_code',
- width: 150
- },{
- text: '仓库名称',
- dataIndex: 'wh_description',
- width: 200
- },{
- text: '仓库类型',
- dataIndex: 'wh_type',
- width: 110
- },{
- text: '仓库状态码',
- dataIndex: 'wh_status',
- hidden:true,
- },{
- text: '仓库状态',
- dataIndex: 'wh_statuscode',
- width:90,
- xtype: 'actioncolumn',
- align : 'center',
- items: [{
- iconCls:'',
- getClass: function(v, meta, rec) {
- if(rec.get('wh_statuscode')=='ENABLE'){
- 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('wh_statuscode')=='ENABLE'?true:false;
- // 禁用/启用
- var form = this.ownerCt.ownerCt.ownerCt;
- var grid = this.ownerCt.ownerCt;
- saas.util.BaseUtil.request({
- url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
- params: '',
- 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/warehouse/save',
- delUrl: '/api/document/warehouse/delete'
- }
- },
- listeners:{
- afterrender:function(p){
- p.getViewModel().setData({title:'仓库'});
- }
- }
- })
|