/** * querypanel适配器 * 2016-12-20 修改添加判断column是否显示根据dispPosition判断 */ define(function(require, exports, module) { var QueryPanel = require('../views/widgets/querypanel/querypanel'); // var queryClolumns = require('../data/querycolumns.json'); function QueryPanelAdapter(args) { this.pageId = args.pageId; this.container = args.container; this.columns = args.data; this.opts = args.opts; this.init(); } QueryPanelAdapter.prototype.init = function() { var args = { rptParas: this.rptParas, rptParaFormats: this.rptParaFormats, currentFormat: this.currentFormat }; // var columns = makeQueryColumns(args); // var columns = JSON.parse(queryClolumns); var columns = this.columns; if (this.opts.needFilter) { columns = this.columns.filter(function(item) { return item.procParaType === '1' && item.dispName !== null && item.dispPosition === '0'; }); } columns = _.sortBy(columns, 'dispIndex'); this.querypanel = new QueryPanel({ container: this.container, columns: columns, opts: this.opts }); }; QueryPanelAdapter.prototype.getQueryParams = function() { return this.querypanel.getQueryParams(); }; QueryPanelAdapter.prototype.getAllQueryParams = function() { return this.querypanel.getAllQueryParams(); }; QueryPanelAdapter.prototype.checkRequiredEditors = function() { return this.querypanel.checkRequiredEditors(); }; function makeQueryColumns(args) { var _queryColumns = []; var rptParas = args.rptParas, rptParaFormats = args.rptParaFormats; rptParas = _.sortBy(rptParas, 'dispIndex'); for (var i = 0; i < rptParas.length; i++) { var rptParaFormat = _.where(rptParaFormats, { rptFormatID: args.currentFormat.rptFormatID, fieldName: rptParas[i].fieldName })[0]; if (undefined !== rptParaFormat) { var _tempColumn = _.extend(rptParas[i], rptParaFormat); _queryColumns.push(_tempColumn) } } return _queryColumns; } return QueryPanelAdapter; });