|
|
@@ -113,7 +113,36 @@ Ext.define('saas.view.document.uusetting.UUSetting', {
|
|
|
}
|
|
|
}, '->', {
|
|
|
xtype: 'textfield',
|
|
|
- emptyText: '输入编号/名称'
|
|
|
+ name: 'vendorkind',
|
|
|
+ hidden: false,
|
|
|
+ emptyText: '输入供应商编号或名称',
|
|
|
+ getCondition: function(value) {
|
|
|
+ return ' (ve_code like\'%' + value + '%\' or ve_name like \'%'+value+'%\' ) ';
|
|
|
+ },
|
|
|
+ enableKeyEvents: true,
|
|
|
+ listeners: {
|
|
|
+ keydown: function(th, e, eOpts) {
|
|
|
+ if(e.keyCode == 13) {
|
|
|
+ me.getController().onQuery();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 'customerkind',
|
|
|
+ hidden: true,
|
|
|
+ emptyText: '输入客户编号或名称',
|
|
|
+ getCondition: function(value) {
|
|
|
+ return ' (cu_code like\'%' + value + '%\' or cu_name like \'%'+value+'%\' ) ';
|
|
|
+ },
|
|
|
+ enableKeyEvents: true,
|
|
|
+ listeners: {
|
|
|
+ keydown: function(th, e, eOpts) {
|
|
|
+ if(e.keyCode == 13) {
|
|
|
+ me.getController().onQuery();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
text: '查询',
|
|
|
@@ -135,15 +164,7 @@ Ext.define('saas.view.document.uusetting.UUSetting', {
|
|
|
displayInfo: true,
|
|
|
bind: {
|
|
|
store: '{vendorkind}',
|
|
|
- },
|
|
|
- items: [{
|
|
|
- iconCls: 'x-sa sa-setting',
|
|
|
- text: '列设置',
|
|
|
- handler: 'onColSetting',
|
|
|
- bind: {
|
|
|
- hidden: '{!configurable || !isAdmin}'
|
|
|
- }
|
|
|
- }]
|
|
|
+ }
|
|
|
}],
|
|
|
listeners:{
|
|
|
boxready: 'onBoxReady',
|
|
|
@@ -155,6 +176,139 @@ Ext.define('saas.view.document.uusetting.UUSetting', {
|
|
|
me.callParent(arguments);
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 获得过滤条件
|
|
|
+ */
|
|
|
+ getConditions: function() {
|
|
|
+ var me = this,
|
|
|
+ items = me.dockedItems.items[0].query('[xtype=textfield]'),
|
|
|
+ conditions = [];
|
|
|
+
|
|
|
+ for(let i = 0; i < items.length; i++) {
|
|
|
+ var item = items[i];
|
|
|
+ var field = item.name,
|
|
|
+ func = item.getCondition,
|
|
|
+ value = item.value,
|
|
|
+ condition;
|
|
|
+
|
|
|
+ if(!item.isVisible()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(value !== undefined && value !== null && value !== ''){
|
|
|
+ if(typeof func == 'function') {
|
|
|
+ condition = {
|
|
|
+ type: 'condition',
|
|
|
+ value: func(value)
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ var type = item.fieldType || me.getDefaultFieldType(item),
|
|
|
+ operation = item.operation || me.getDefaultFieldOperation(item),
|
|
|
+ conditionValue = me.getConditionValue(item, value);
|
|
|
+
|
|
|
+ if(conditionValue === undefined && conditionValue === null && conditionValue === '') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ condition = {
|
|
|
+ type: type,
|
|
|
+ field: field,
|
|
|
+ operation: operation,
|
|
|
+ value: conditionValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ conditions.push(condition);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return conditions;
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 只要arr1和arr2中存在相同项即返回真
|
|
|
+ */
|
|
|
+ isContainsAny: function (arr1, arr2) {
|
|
|
+ for (var i = 0; i < arr2.length; i++) {
|
|
|
+ var a2 = arr2[i];
|
|
|
+ if (!!arr1.find(function (a1) {
|
|
|
+ return a1 == a2
|
|
|
+ })) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+
|
|
|
+ getDefaultFieldType: function (field) {
|
|
|
+ var me = this,
|
|
|
+ xtypes = field.getXTypes().split('/'),
|
|
|
+ type;
|
|
|
+
|
|
|
+ if (me.isContainsAny(xtypes, ['numberfield'])) {
|
|
|
+ type = 'number';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['datefield', 'condatefield', 'conmonthfield'])) {
|
|
|
+ type = 'date';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
|
|
|
+ type = 'enum';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['combobox', 'multicombo', 'combo', 'radiofield', 'radio'])) {
|
|
|
+ type = 'enum';
|
|
|
+ } else {
|
|
|
+ type = 'string';
|
|
|
+ }
|
|
|
+
|
|
|
+ return type;
|
|
|
+ },
|
|
|
+
|
|
|
+ getDefaultFieldOperation: function (field) {
|
|
|
+ var me = this,
|
|
|
+ xtypes = field.getXTypes().split('/'),
|
|
|
+ operation;
|
|
|
+
|
|
|
+ if (me.isContainsAny(xtypes, ['numberfield', 'datefield', 'dbfindtrigger'])) {
|
|
|
+ operation = '=';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['condatefield', 'conmonthfield'])) {
|
|
|
+ operation = 'between';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['multidbfindtrigger', 'combobox', 'multicombo', 'combo'])) {
|
|
|
+ operation = 'in';
|
|
|
+ } else {
|
|
|
+ operation = 'like';
|
|
|
+ }
|
|
|
+
|
|
|
+ return operation;
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理部分字段值
|
|
|
+ */
|
|
|
+ getConditionValue: function (field, value) {
|
|
|
+ var me = this,
|
|
|
+ xtypes = field.getXTypes().split('/'),
|
|
|
+ conditionValue;
|
|
|
+ if (me.isContainsAny(xtypes, ['datefield'])) {
|
|
|
+ conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
|
|
|
+ } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
|
|
|
+ var from = value.from,
|
|
|
+ to = value.to;
|
|
|
+
|
|
|
+ conditionValue = from + ',' + to;
|
|
|
+ } else if (me.isContainsAny(xtypes, ['condatefield'])) {
|
|
|
+ var from = value.from,
|
|
|
+ to = value.to;
|
|
|
+
|
|
|
+ conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
|
|
|
+ } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
|
|
|
+ conditionValue = value;
|
|
|
+ } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
|
|
|
+ conditionValue = '\'' + value + '\'';
|
|
|
+ } else if (me.isContainsAny(xtypes, ['multicombo'])) {
|
|
|
+ conditionValue = value.map ? value.map(function (v) {
|
|
|
+ return '\'' + v.value + '\'';
|
|
|
+ }).join(',') : '';
|
|
|
+ } else {
|
|
|
+ conditionValue = value;
|
|
|
+ }
|
|
|
+
|
|
|
+ return conditionValue;
|
|
|
+ },
|
|
|
+
|
|
|
refresh: function() {
|
|
|
var store = this.down('grid').store;
|
|
|
store.load();
|