|
|
@@ -29,23 +29,11 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
gridexporter: true
|
|
|
},
|
|
|
tbar: [{
|
|
|
- xtype: 'hidden',
|
|
|
- name: 'wh_id',
|
|
|
- bind:'{wh_id}',
|
|
|
- fieldLabel: 'wh_id'
|
|
|
- },{
|
|
|
- xtype: 'hidden',
|
|
|
- name: 'wh_code',
|
|
|
- fieldLabel: 'wh_code'
|
|
|
- },{
|
|
|
xtype: 'warehouseDbfindTrigger',
|
|
|
name: 'wh_description',
|
|
|
+ bind: '{form.wh_description}',
|
|
|
emptyText: '仓库',
|
|
|
dbfinds:[{
|
|
|
- from:'id',to:'wh_id',ignore:true
|
|
|
- }, {
|
|
|
- from:'wh_code',to:'wh_code'
|
|
|
- }, {
|
|
|
from:'wh_description',to:'wh_description'
|
|
|
}],
|
|
|
width:150,
|
|
|
@@ -54,32 +42,25 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
xtype : "remotecombo",
|
|
|
storeUrl:'/api/document/producttype/getCombo',
|
|
|
name : "pr_kind",
|
|
|
- bind:'{pr_kind}',
|
|
|
+ bind: '{form.pr_kind}',
|
|
|
emptyText : "类型",
|
|
|
hiddenBtn:true,
|
|
|
allowBlank : false,
|
|
|
width:150
|
|
|
},{
|
|
|
- xtype: 'hidden',
|
|
|
- name: 'pr_id',
|
|
|
- bind:'{pr_id}',
|
|
|
- fieldLabel: 'pr_id'
|
|
|
- },{
|
|
|
- xtype: 'hidden',
|
|
|
- name: 'pr_code',
|
|
|
- fieldLabel: 'pr_code'
|
|
|
- },{
|
|
|
- xtype: 'productDbfindTrigger',
|
|
|
+ // xtype: 'productDbfindTrigger',
|
|
|
+ xtype: 'textfield',
|
|
|
name: 'pr_detail',
|
|
|
emptyText:'输入物料编号或名称',
|
|
|
width:200,
|
|
|
- dbfinds:[{
|
|
|
- from:'id',to:'pr_id',ignore:true
|
|
|
- },{
|
|
|
- from:'pr_code',to:'pr_code',
|
|
|
- }, {
|
|
|
- from:'pr_detail',to:'pr_detail'
|
|
|
- }]
|
|
|
+ bind: '{form.pr_detail}',
|
|
|
+ getCondition: function(value) {
|
|
|
+ if(value) {
|
|
|
+ return 'pr_detail like %' + value + '% or pr_code like%' + value + '%';
|
|
|
+ }else {
|
|
|
+ return '1 = 1';
|
|
|
+ }
|
|
|
+ }
|
|
|
},{
|
|
|
cls:'x-formpanel-btn-blue',
|
|
|
xtype:'button',
|
|
|
@@ -235,8 +216,6 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
}
|
|
|
}],
|
|
|
|
|
|
- condition:'',
|
|
|
-
|
|
|
listeners:{
|
|
|
boxready: function(grid, width, height, eOpts) {
|
|
|
var store = grid.getStore(),
|
|
|
@@ -288,7 +267,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
},
|
|
|
listeners: {
|
|
|
beforeload: function (store, op) {
|
|
|
- var condition = me.condition;
|
|
|
+ var condition = me.getConditions();
|
|
|
if (Ext.isEmpty(condition)) {
|
|
|
condition = "";
|
|
|
}
|
|
|
@@ -315,6 +294,27 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
},
|
|
|
|
|
|
listeners: {
|
|
|
+ beforerender: function(grid) {
|
|
|
+ var tbar = grid.dockedItems.items[2];
|
|
|
+ var fields = tbar.items.items;
|
|
|
+ var items = [];
|
|
|
+
|
|
|
+ Ext.each(fields, function(f, index){
|
|
|
+ items.push(f);
|
|
|
+ f.enableKeyEvents = true;
|
|
|
+ f.on && f.on({
|
|
|
+ keydown: {
|
|
|
+ fn: function(th, e, eOpts) {
|
|
|
+ if(e.keyCode == 13) {
|
|
|
+ grid.store.load();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ grid.formItems = items;
|
|
|
+ },
|
|
|
boxready: function(grid, width, height, eOpts) {
|
|
|
var store = grid.getStore(),
|
|
|
gridBodyBox = grid.body.dom.getBoundingClientRect(),
|
|
|
@@ -329,83 +329,46 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
/**
|
|
|
* 获得过滤条件
|
|
|
*/
|
|
|
- getConditions: function(moreQuery) {
|
|
|
+ getConditions: function() {
|
|
|
var me = this,
|
|
|
- formItems = me.queryFormItems,
|
|
|
- moreQueryFormItems = me.moreQueryFormItems,
|
|
|
+ formItems = me.formItems,
|
|
|
viewModel = me.getViewModel(),
|
|
|
viewModelData = viewModel.getData(),
|
|
|
bindItems = viewModelData['form'],
|
|
|
- moreItems = viewModelData['moreForm'],
|
|
|
condition,
|
|
|
conditions = [];
|
|
|
|
|
|
- if(moreQuery) {
|
|
|
- for(k in moreItems) {
|
|
|
- var item = Ext.Array.findBy(moreQueryFormItems, function(i) {
|
|
|
- return i.name == k;
|
|
|
- });
|
|
|
- var field = item.name,
|
|
|
- func = item.getCondition,
|
|
|
- value = moreItems[k],
|
|
|
- condition;
|
|
|
-
|
|
|
- if(typeof func == 'function') {
|
|
|
- condition = {
|
|
|
- type: 'condition',
|
|
|
- value: func(value)
|
|
|
- }
|
|
|
- }else {
|
|
|
- var xtype = item.xtype || 'textfield',
|
|
|
- type = item.fieldType || me.getDefaultFieldType(xtype),
|
|
|
- operation = item.operation || me.getDefaultFieldOperation(xtype),
|
|
|
- conditionValue = me.getConditionValue(xtype, value);
|
|
|
-
|
|
|
- if(!conditionValue) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- condition = {
|
|
|
- type: type,
|
|
|
- field: field,
|
|
|
- operation: operation,
|
|
|
- value: conditionValue
|
|
|
- }
|
|
|
+ for(k in bindItems) {
|
|
|
+ var item = Ext.Array.findBy(formItems, function(i) {
|
|
|
+ return i.name == k;
|
|
|
+ });
|
|
|
+ var field = item.name,
|
|
|
+ func = item.getCondition,
|
|
|
+ value = bindItems[k],
|
|
|
+ condition;
|
|
|
+
|
|
|
+ if(typeof func == 'function') {
|
|
|
+ condition = {
|
|
|
+ type: 'condition',
|
|
|
+ value: func(value)
|
|
|
}
|
|
|
- conditions.push(condition);
|
|
|
- }
|
|
|
- }else {
|
|
|
- for(k in bindItems) {
|
|
|
- var item = Ext.Array.findBy(formItems, function(i) {
|
|
|
- return i.name == k;
|
|
|
- });
|
|
|
- var field = item.name,
|
|
|
- func = item.getCondition,
|
|
|
- value = bindItems[k],
|
|
|
- condition;
|
|
|
+ }else {
|
|
|
+ var xtype = item.xtype || 'textfield',
|
|
|
+ type = item.fieldType || me.getDefaultFieldType(xtype),
|
|
|
+ operation = item.operation || me.getDefaultFieldOperation(xtype),
|
|
|
+ conditionValue = me.getConditionValue(xtype, value);
|
|
|
|
|
|
- if(typeof func == 'function') {
|
|
|
- condition = {
|
|
|
- type: 'condition',
|
|
|
- value: func(value)
|
|
|
- }
|
|
|
- }else {
|
|
|
- var xtype = item.xtype || 'textfield',
|
|
|
- type = item.fieldType || me.getDefaultFieldType(xtype),
|
|
|
- operation = item.operation || me.getDefaultFieldOperation(xtype),
|
|
|
- conditionValue = me.getConditionValue(xtype, value);
|
|
|
-
|
|
|
- if(!conditionValue) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- condition = {
|
|
|
- type: type,
|
|
|
- field: field,
|
|
|
- operation: operation,
|
|
|
- value: conditionValue
|
|
|
- }
|
|
|
+ if(!conditionValue) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ condition = {
|
|
|
+ type: type,
|
|
|
+ field: field,
|
|
|
+ operation: operation,
|
|
|
+ value: conditionValue
|
|
|
}
|
|
|
- conditions.push(condition);
|
|
|
}
|
|
|
+ conditions.push(condition);
|
|
|
}
|
|
|
|
|
|
return conditions;
|
|
|
@@ -515,18 +478,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
onbuild:function(){
|
|
|
var me =this;
|
|
|
var grid = me;
|
|
|
- var tbar = me.dockedItems.items[2];
|
|
|
- var data;
|
|
|
- grid.condition = '';
|
|
|
- var items = [];
|
|
|
- var fields = tbar.items.items.map(f => f.name);
|
|
|
- Ext.each(fields, function(f, index){
|
|
|
- var field = tbar.down('[name='+f+']');
|
|
|
- if(field){
|
|
|
- items.push(field);
|
|
|
- }
|
|
|
- });
|
|
|
- grid.condition = grid.getCondition(items);
|
|
|
+ grid.condition = grid.getConditions(me.formItems);
|
|
|
|
|
|
var data = grid.condition;
|
|
|
param = {
|
|
|
@@ -545,14 +497,14 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
})
|
|
|
.catch(function(res) {
|
|
|
console.error(res);
|
|
|
- saas.util.BaseUtil.showToast('保存失败: ' + res.message);
|
|
|
+ saas.util.BaseUtil.showErrorToast('保存失败: ' + res.message);
|
|
|
});
|
|
|
},
|
|
|
onSave:function(){
|
|
|
var me = this,
|
|
|
gridData = me.getDirtyData();
|
|
|
if(gridData==null){
|
|
|
- saas.util.BaseUtil.showToast('未修改数据');
|
|
|
+ saas.util.BaseUtil.showErrorToast('未修改数据');
|
|
|
}
|
|
|
saas.util.BaseUtil.request({
|
|
|
url: me.saveUrl,
|
|
|
@@ -566,7 +518,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
|
|
|
})
|
|
|
.catch(function(res) {
|
|
|
console.error(res);
|
|
|
- saas.util.BaseUtil.showToast('保存失败: ' + res.message);
|
|
|
+ saas.util.BaseUtil.showErrorToast('保存失败: ' + res.message);
|
|
|
});
|
|
|
},
|
|
|
getDirtyData: function() {
|