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.
213 lines
5.8 KiB
213 lines
5.8 KiB
|
|
define(function (require, exports, module) {
|
|
let Window = require('system/views/pages/window');
|
|
let tpl = require('text!./addwindow.tpl');
|
|
let rhtComm = require('apps/rht/comm/rhtComm');
|
|
|
|
function BatchPdWindow(args) {
|
|
this.options = {
|
|
title: '批量选择数据',
|
|
content: tpl,
|
|
width: 800,
|
|
height: 536,
|
|
modal: true,
|
|
closed: true,
|
|
closable: true,
|
|
minimizable: false,
|
|
maximizable: false,
|
|
collapsible: false,
|
|
resizable: false,
|
|
data: null
|
|
}
|
|
|
|
this.args = args;
|
|
Window.call(this, this.options);
|
|
|
|
let uiObjCode = this.args.uiObjCode;
|
|
this.dsMaster = new DataSource({
|
|
funcCode: this.args.funcCode,
|
|
funcObjCode: uiObjCode,
|
|
isMultiPage: '0'
|
|
});
|
|
|
|
this.dsMaster.setServerBiz(args.serverBiz)
|
|
_.extend(this.dsMaster.fixQuery, args.fixQuery);
|
|
}
|
|
|
|
inherits(BatchPdWindow, Window);
|
|
|
|
BatchPdWindow.prototype.init = function () {
|
|
let self = this;
|
|
|
|
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: 5000,
|
|
enablePager: self.args.enablePager || false,
|
|
showCheckColumn: true
|
|
},
|
|
data: this.dsMaster,
|
|
actions: {
|
|
onDblClick: function (e, args) {
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
let mainToolBar = {
|
|
opts: {},
|
|
data: [{
|
|
opCode: 'close',
|
|
caption: '关闭',
|
|
parentOp: '',
|
|
opClass: 'close'
|
|
}, {
|
|
opCode: 'save',
|
|
caption: '汇总',
|
|
parentOp: '',
|
|
opClass: 'save'
|
|
}, {
|
|
opCode: 'refresh',
|
|
caption: '刷新',
|
|
parentOp: '',
|
|
opClass: 'refresh'
|
|
}, {
|
|
opCode: 'selectAll',
|
|
caption: '全选',
|
|
parentOp: '',
|
|
opClass: 'selectAll'
|
|
}, {
|
|
opCode: 'unselectAll',
|
|
caption: '全不选',
|
|
parentOp: '',
|
|
opClass: 'unselectAll'
|
|
}, {
|
|
opCode: 'inverseSelect',
|
|
caption: '反选',
|
|
parentOp: '',
|
|
opClass: 'inverseSelect'
|
|
}],
|
|
actions: {
|
|
click: function (opCode) {
|
|
self.doOp(opCode);
|
|
}
|
|
}
|
|
};
|
|
|
|
this.register('grid', 'grid_main', mainGrid);
|
|
this.register('toolbar', 'toolbar_main', mainToolBar);//注册查询面板
|
|
let queryArgs = {
|
|
source: this.dsMaster,
|
|
data: resultData,
|
|
actions: {
|
|
querySchemeChanged: function () {
|
|
self.customerize(self.$container, 1);
|
|
},
|
|
search: function() {
|
|
self.dsMaster.search()
|
|
}
|
|
}
|
|
}
|
|
|
|
this.register('querypanel', 'query_main', queryArgs);
|
|
};
|
|
|
|
BatchPdWindow.prototype.doOp = function (opCode) {
|
|
switch (opCode) {
|
|
case 'save':
|
|
this.save();
|
|
break;
|
|
case 'close':
|
|
this.close();
|
|
break;
|
|
case 'refresh':
|
|
this.refresh();
|
|
break;
|
|
case 'selectAll':
|
|
this.selectAll()
|
|
break;
|
|
case 'unselectAll':
|
|
this.unselectAll()
|
|
break
|
|
case 'inverseSelect':
|
|
this.inverseSelect()
|
|
break
|
|
}
|
|
};
|
|
|
|
BatchPdWindow.prototype.selectAll = function () {
|
|
this.dsMaster.rows.forEach(r => {
|
|
r['$is_sel'] = true
|
|
})
|
|
|
|
this.vm.grid_main.updateSelection()
|
|
}
|
|
|
|
BatchPdWindow.prototype.unselectAll = function () {
|
|
this.dsMaster.rows.forEach(r => {
|
|
r['$is_sel'] = false
|
|
})
|
|
this.vm.grid_main.updateSelection()
|
|
}
|
|
|
|
BatchPdWindow.prototype.inverseSelect = function () {
|
|
this.dsMaster.rows.forEach(r => {
|
|
r['$is_sel'] = !r['$is_sel']
|
|
})
|
|
this.vm.grid_main.updateSelection()
|
|
}
|
|
|
|
BatchPdWindow.prototype.save = function () {
|
|
let self = this
|
|
let shzDate = self.$hzDate.textbox('getValue');
|
|
if (self.args.callback) {
|
|
self.args.callback(self.dsMaster.getSelectedRows(),shzDate)
|
|
}
|
|
self.close();
|
|
}
|
|
|
|
BatchPdWindow.prototype.refresh = function () {
|
|
this.dsMaster.search();
|
|
};
|
|
|
|
BatchPdWindow.prototype.customerize = function ($container) {
|
|
if (this.args.autoRefresh) {
|
|
this.refresh();
|
|
}
|
|
|
|
this.$hzDate = this.getElement('.hzDate')
|
|
this.$hzDate.datebox({
|
|
value: rhtComm.GetServerDate(0)
|
|
})
|
|
};
|
|
|
|
BatchPdWindow.prototype.open = function () {
|
|
let self = this;
|
|
let code = this.dsMaster.uiObjCode;
|
|
let post_data = {
|
|
funcCode: self.args.biz.getFuncCode(),
|
|
uiObjCodes: code
|
|
}
|
|
|
|
Store.services.getUiObjSchema(post_data, function (isOk, data) {
|
|
if (isOk) {
|
|
self.dsMaster.initUIObj(data[code]);
|
|
self.dsMaster.isShowSelCol = true
|
|
self.dsMaster.funcCode = self.args.biz.getFuncCode();
|
|
Window.prototype.open.call(self);
|
|
}
|
|
});
|
|
};
|
|
|
|
return BatchPdWindow;
|
|
}
|
|
); |