You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
260 lines
8.7 KiB
260 lines
8.7 KiB
|
|
define(function (require, exports, module) {
|
|
let BaseWindow = require('system/views/pages/window');
|
|
let ProgressWindow = require('system/views/pages/progressbarwindow/progressbarwindow');
|
|
let tpl = require('text!./multiwindowdel.tpl');
|
|
|
|
let tempdata=null;
|
|
let isinit='0';
|
|
function Window(args) {
|
|
this.options = {
|
|
title: '结账历史查询',
|
|
content: tpl,
|
|
width: 872,
|
|
height: 600,
|
|
modal: true,
|
|
closed: false,
|
|
closable: false,
|
|
minimizable: false,
|
|
maximizable: false,
|
|
collapsible: false,
|
|
resizable: false,
|
|
data: null
|
|
}
|
|
|
|
this.args = args;
|
|
tempdata = args.data;
|
|
this.completed = args.completed
|
|
$.extend(this.options, args.opts || {});
|
|
BaseWindow.call(this, this.options);
|
|
|
|
this.dsMaster = new DataSource({
|
|
funcCode: this.args.biz.dsMaster.funcCode,
|
|
funcObjCode: this.args.uiObjCode,
|
|
isMultiPage: '1'
|
|
});
|
|
|
|
this.dsMaster.setServerBiz(args.serverBiz);
|
|
|
|
_.extend(this.dsMaster.fixQuery, args.fixQuery);
|
|
|
|
|
|
if (_.isArray(args.exists) && args.exists.length > 0) {
|
|
let keys = Object.keys(args.exists[0]);
|
|
let values = [];
|
|
for (let k = 0; k < args.exists.length; k++) {
|
|
let value = '';
|
|
for (let i = 0; i < keys.length; i++) {
|
|
value = value + '#' + args.exists[k][keys[i]];
|
|
}
|
|
;
|
|
values.push(value);
|
|
}
|
|
;
|
|
this.dsMaster.on('onCollectChanged', function (ds) {
|
|
if (ds.rows.length == 0) {
|
|
return;
|
|
}
|
|
|
|
for (let i = ds.rows.length - 1; i >= 0; i--) {
|
|
let row = ds.rows[i];
|
|
let str = '';
|
|
for (let j = 0; j < keys.length; j++) {
|
|
let key = keys[j];
|
|
str = str + '#' + row[key];
|
|
}
|
|
;
|
|
|
|
if (values.indexOf(str) > -1) {
|
|
ds.removeRow(row);
|
|
continue;
|
|
}
|
|
}
|
|
;
|
|
});
|
|
}
|
|
}
|
|
|
|
inherits(Window, BaseWindow);
|
|
|
|
Window.prototype.init = function () {
|
|
let self = this;
|
|
isinit='0';
|
|
let pluginParams = {
|
|
plugin: 'funcQueryProjectPlugin',
|
|
sync: true,
|
|
pluginData: {
|
|
funcCode: self.args.biz.dsMaster.funcCode
|
|
}
|
|
};
|
|
let resultData = Store.services.executeplugin(pluginParams);
|
|
|
|
//注册表格
|
|
let mainGrid = {
|
|
opts: {
|
|
editable: false,
|
|
pageSize: 50,
|
|
showCheckColumn: false
|
|
},
|
|
data: this.dsMaster
|
|
}
|
|
this.register('grid', 'grid_main', mainGrid);
|
|
//注册查询面板
|
|
let queryArgs = {
|
|
source: this.dsMaster,
|
|
data: resultData,
|
|
actions: {
|
|
querySchemeChanged: function () {
|
|
self.customerize(self.$container, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
this.register('querypanel', 'query_main', queryArgs);
|
|
}
|
|
|
|
Window.prototype.doOp = function (opCode) {
|
|
let self = this
|
|
let isHandled = false;
|
|
switch (opCode) {
|
|
case 'ok':
|
|
let rows = [];
|
|
if (this.dsMaster.rows != null){
|
|
for (let i = 0; i < this.dsMaster.rows.length; i++) {
|
|
let row = this.dsMaster.rows[i];
|
|
if (row.$is_sel) {
|
|
rows.push((row));
|
|
}
|
|
}
|
|
}
|
|
let _args = {};
|
|
_args.data = rows;
|
|
_args.sync = this.args.sync || true;
|
|
_args.iterator = this.args.itreator;
|
|
_args.completed = function() {
|
|
self.completed && self.completed(rows)
|
|
}
|
|
let pWindow = new ProgressWindow(_args);
|
|
this.close();
|
|
pWindow.open();
|
|
this.ok();
|
|
break;
|
|
case 'refresh':
|
|
this.dsMaster.defaultOrder = 'RptDate desc';
|
|
this.dsMaster.search();
|
|
//self.dsMaster.loadRows(tempdata);
|
|
break;
|
|
case 'del':
|
|
Store.messager.confirm('确认要删除选中数据?', function (r) {
|
|
if (r) {
|
|
let temps=self.dsMaster.getSelectedRows();
|
|
for (i=0;i<temps.length;i++){
|
|
let selRow = temps[i];
|
|
self.dsMaster.removeRow(selRow);
|
|
}
|
|
tempdata=self.dsMaster.rows;
|
|
//self.dsMaster.removeRow(self.dsMaster.currentRow);
|
|
}
|
|
})
|
|
break;
|
|
case 'reverse':
|
|
this.vm['grid_main'].toggleRowsSelection();
|
|
break;
|
|
case 'exit':
|
|
this.close();
|
|
default:
|
|
break;
|
|
}
|
|
};
|
|
|
|
Window.prototype.ok = function () {
|
|
if (this.args.callback) {
|
|
|
|
let rows = [];
|
|
for (let i = 0; i < this.dsMaster.rows.length; i++) {
|
|
let row = this.dsMaster.rows[i];
|
|
//if (row.$is_sel) {
|
|
rows.push((row));
|
|
// }
|
|
};
|
|
this.args.callback(rows);
|
|
}
|
|
|
|
this.close();
|
|
};
|
|
Window.prototype.customerize = function ($container, flag) {
|
|
if (isinit == '0'){
|
|
let self = this;
|
|
let queryid = this.vm.query_main.vmodel.$id;
|
|
let $qp = $('div[avalonctrl=' + queryid + ']');
|
|
let gridid = this.vm.grid_main.vmodel.$id;
|
|
let $gd = $('div[avalonctrl=' + gridid + ']');
|
|
let $wrapper = $container.find('.setting-container-wrapper');
|
|
let $content = self.getElement('.edp-multi-content');
|
|
let $qw = $container.find('.show-querys-wrapper');
|
|
let qpHeight = 0;
|
|
if (!flag) {
|
|
qpHeight = $wrapper.outerHeight() + $qw.outerHeight();
|
|
$qp.css('height', qpHeight);
|
|
$gd.css('height', $content.height() - qpHeight);
|
|
//self.dsMaster.search();
|
|
//self.dsMaster.loadRows(tempdata);
|
|
let btnOk = self.getElement('.btn-multi-ok');
|
|
btnOk.on('click', function () {
|
|
self.doOp('ok');
|
|
});
|
|
let btnDel = self.getElement('.btn-multi-del');
|
|
btnDel.on('click', function () {
|
|
self.doOp('del');
|
|
});
|
|
let btnRefresh = self.getElement('.btn-multi-refresh');
|
|
btnRefresh.on('click', function () {
|
|
self.doOp('refresh');
|
|
});
|
|
|
|
let btnReverse = self.getElement('.btn-multi-reverse');
|
|
btnReverse.on('click', function () {
|
|
self.doOp('reverse');
|
|
});
|
|
isinit='1';
|
|
/*
|
|
let btnExit = self.getElement('.btn-multi-exit');
|
|
btnExit.on('click', function() {
|
|
self.doOp('exit');
|
|
});
|
|
*/
|
|
} else {
|
|
qpHeight = 0;
|
|
if ($wrapper.outerHeight() === $qp.outerHeight()) {
|
|
qpHeight = $wrapper.outerHeight();
|
|
$qp.css('overflow', 'hidden');
|
|
} else {
|
|
qpHeight = $wrapper.outerHeight() + $qw.outerHeight();
|
|
}
|
|
$qp.css('height', qpHeight);
|
|
$gd.css('height', $content.height() - qpHeight);
|
|
Patch.tabs.resizeGrid($content);
|
|
}
|
|
}
|
|
};
|
|
|
|
Window.prototype.open = function () {
|
|
let self = this;
|
|
let code = this.dsMaster.uiObjCode;
|
|
let post_data = {
|
|
funcCode: '',
|
|
uiObjCodes: code
|
|
}
|
|
|
|
Store.services.getUiObjSchema(post_data, function (isOk, data) {
|
|
if (isOk) {
|
|
self.dsMaster.initUIObj(data[code]);
|
|
self.dsMaster.defaultOrder = 'RptDate desc';
|
|
self.dsMaster.search();
|
|
BaseWindow.prototype.open.call(self);
|
|
}
|
|
});
|
|
};
|
|
|
|
module.exports = Window;
|
|
}) |