|
|
|
|
/**
|
|
|
|
|
* 打印设置窗口定义文件
|
|
|
|
|
* @description [description]
|
|
|
|
|
* @version 1.0
|
|
|
|
|
*/
|
|
|
|
|
define(function(require, exports, module) {
|
|
|
|
|
var Window = require('../window/window');
|
|
|
|
|
var tpl = require('./printwindow.tpl');
|
|
|
|
|
var toolbuttons = require('../../../data/printwindow/toolbuttons.json');
|
|
|
|
|
var printColumns = require('../../../data/printwindow/columns.json');
|
|
|
|
|
var printDatas = require('../../../data/printwindow/data.json');
|
|
|
|
|
var ToolbarAdapter = require('../../../adapter/toolbarAdapter');
|
|
|
|
|
var GridAdapter = require('../../../adapter/datagridAdapter');
|
|
|
|
|
var moment = require('vendor/moment/moment.min');
|
|
|
|
|
|
|
|
|
|
var self = null;
|
|
|
|
|
// var PrintLoader = require('../printloader/printloader');
|
|
|
|
|
require('./printwindow.css');
|
|
|
|
|
|
|
|
|
|
function PrintWindow(args) {
|
|
|
|
|
this.options = {
|
|
|
|
|
title: '打印设置',
|
|
|
|
|
content: tpl,
|
|
|
|
|
top: window.scrollY + 100,
|
|
|
|
|
width: 860,
|
|
|
|
|
height: 600,
|
|
|
|
|
modal: true,
|
|
|
|
|
closed: true,
|
|
|
|
|
closable: true,
|
|
|
|
|
draggable: true,
|
|
|
|
|
data: null,
|
|
|
|
|
onClose: function() {
|
|
|
|
|
if (args.cb && typeof args.cb == 'function') {
|
|
|
|
|
args.cb();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self = this;
|
|
|
|
|
this.args = args;
|
|
|
|
|
this.id = createGuid();
|
|
|
|
|
_.extend(this.options, args.options || {});
|
|
|
|
|
Window.call(this, this.options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inherits(PrintWindow, Window);
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.customerize = function($container) {
|
|
|
|
|
this.toolContainer = this.getElement('.fdpr-print-toolbar');
|
|
|
|
|
this.gridContainer = this.getElement('.edp-print-main');
|
|
|
|
|
this.initToolbar();
|
|
|
|
|
this.initGrid();
|
|
|
|
|
this.setVkEvent();
|
|
|
|
|
this.getPrnData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.setVkEvent = function() {
|
|
|
|
|
self.$container.on('focus', 'input', function(e) {
|
|
|
|
|
var fieldName = $(e.target).closest('td[field]').attr('field');
|
|
|
|
|
if(fieldName === 'orgcode') {
|
|
|
|
|
window.openVK(e.target, '1');
|
|
|
|
|
} else if(fieldName === 'prnname' || fieldName === 'remark') {
|
|
|
|
|
window.openVK(e.target, '2');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
self.$container.on('blur', 'input', function(e) {
|
|
|
|
|
window.closeVK(e);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.init = function() {
|
|
|
|
|
self.getColumnSchema();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.getColumnSchema = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
var params = {'op':'schema', 'sync': true};
|
|
|
|
|
var result = ER.services.setPrn(params);
|
|
|
|
|
var columns = [];
|
|
|
|
|
if (result.isSuccess) {
|
|
|
|
|
columns = _.sortBy(result.columns, 'dispIndex');
|
|
|
|
|
columns = _.where(columns, {'isViewable': true})
|
|
|
|
|
}
|
|
|
|
|
self.gridColumns = [makeGridColumns(columns)];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function makeGridColumns(columns) {
|
|
|
|
|
var returnData = [];
|
|
|
|
|
var width = (1 / columns.length) * 100 + '%';
|
|
|
|
|
for (var i = 0;i < columns.length; i++) {
|
|
|
|
|
var tempCol = columns[i];
|
|
|
|
|
var columnData = {
|
|
|
|
|
'sortable': false,
|
|
|
|
|
'field': tempCol.fieldName,
|
|
|
|
|
'align': '',
|
|
|
|
|
'width': width,
|
|
|
|
|
'width1': width,
|
|
|
|
|
'rowspan': 1,
|
|
|
|
|
'colspan': 1,
|
|
|
|
|
'title': tempCol.dispName
|
|
|
|
|
};
|
|
|
|
|
if (tempCol.isEditable) {
|
|
|
|
|
if ( tempCol.fieldName == 'isenabled' || tempCol.fieldName == 'isdefault') {
|
|
|
|
|
columnData.editor = {
|
|
|
|
|
type: 'checkbox',
|
|
|
|
|
options:{on:'是',off:'否'}
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
columnData.editor = {
|
|
|
|
|
type: 'text'
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
returnData.push(columnData);
|
|
|
|
|
}
|
|
|
|
|
return returnData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.getPrnData = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
var params = {
|
|
|
|
|
'op': 'search',
|
|
|
|
|
'rptId': self.args.printObj.rptId
|
|
|
|
|
}
|
|
|
|
|
ER.services.setPrn(params, function(isok, data) {
|
|
|
|
|
if (isok) {
|
|
|
|
|
makeCheckBoxTransfer(data);
|
|
|
|
|
self.gridadp.loadData(data.rows)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.saveData = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
self.failedNo = self.failedNo || '';
|
|
|
|
|
var data = this.$grid.datagrid('getData');
|
|
|
|
|
for (var i = 0; i < data.rows.length; i++) {
|
|
|
|
|
var _row = data.rows[i];
|
|
|
|
|
if ( $.trim(_row['prnname']) == '') {
|
|
|
|
|
ER.messager.err('格式名称不能为空!')
|
|
|
|
|
if (self.failedNo.indexOf(str) < 0) {
|
|
|
|
|
self.failedNo += str;
|
|
|
|
|
}
|
|
|
|
|
reject();
|
|
|
|
|
self.editStatus = true;
|
|
|
|
|
self.setBtnDisable();
|
|
|
|
|
self.setBtnEnable(self.btnsac);
|
|
|
|
|
self.$container.find('td[field="prnname"]:eq('+ (i + 1) +')').click();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_row.isdefault = (_row.isdefault == "是" ? '1' : '0');
|
|
|
|
|
_row.isenabled = (_row.isenabled == "是" ? '1' : '0');
|
|
|
|
|
_row.rptid = self.args.printObj.rptId;
|
|
|
|
|
}
|
|
|
|
|
var originRows = $.extend([], data.rows, true);
|
|
|
|
|
data.rows = _.filter(data.rows, function(item) {
|
|
|
|
|
return item.$state ? true : false;
|
|
|
|
|
})
|
|
|
|
|
for (var i = 0; i < data.rows.length; i++) {
|
|
|
|
|
var str = '-' + data.rows[i]['serialno'] + '-';
|
|
|
|
|
|
|
|
|
|
// if (self.failedNo.indexOf(str) > -1) {
|
|
|
|
|
// data.rows[i]['$state'] = 'added';
|
|
|
|
|
// self.failedNo.replace(str, '');
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
var params = {
|
|
|
|
|
'op':'save',
|
|
|
|
|
'rows':data.rows,
|
|
|
|
|
'deleteRows':[],
|
|
|
|
|
'rptId': self.args.printObj.rptId
|
|
|
|
|
}
|
|
|
|
|
self.setBtnEnable(self.allBtns);
|
|
|
|
|
ER.services.setPrn(params, function(isok, data1) {
|
|
|
|
|
if (isok) {
|
|
|
|
|
ER.messager.tip('保存成功!');
|
|
|
|
|
makeCheckBoxTransfer(data1);
|
|
|
|
|
if(data1 && data1.rows) {
|
|
|
|
|
self.gridadp.loadData(data1.rows)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function makeCheckBoxTransfer(data) {
|
|
|
|
|
if (data && data.rows) {
|
|
|
|
|
for (var i = 0; i < data.rows.length; i++) {
|
|
|
|
|
data.rows[i].isdefault = (data.rows[i].isdefault == "0" ? '否' : '是');
|
|
|
|
|
data.rows[i].isenabled = (data.rows[i].isenabled == "0" ? '否' : '是');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.makeColumnEditor = function(data) {
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
// if ()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.initToolbar = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
this.tooladp = new ToolbarAdapter({
|
|
|
|
|
pageId: self.id,
|
|
|
|
|
container: this.toolContainer,
|
|
|
|
|
buttons: JSON.parse(toolbuttons),
|
|
|
|
|
menuButtons: [],
|
|
|
|
|
actions: {
|
|
|
|
|
click: function(opcode) {
|
|
|
|
|
self.opRouter(opcode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.tooladp.init();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.initGrid = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
var columns = self.gridColumns;
|
|
|
|
|
// var columns = JSON.parse(printColumns);
|
|
|
|
|
self.makeColumnEditor(columns);
|
|
|
|
|
self.gridadp = new GridAdapter({
|
|
|
|
|
id: self.id,
|
|
|
|
|
selfColumn: true,
|
|
|
|
|
name: '',
|
|
|
|
|
opts: {},
|
|
|
|
|
data: {
|
|
|
|
|
columns: columns
|
|
|
|
|
},
|
|
|
|
|
actions: {
|
|
|
|
|
onClickCell: onClickCell,
|
|
|
|
|
onBeforeEdit: onBeforeEdit,
|
|
|
|
|
onEndEdit: onEndEdit
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
self.gridadp.makeGridProperties({
|
|
|
|
|
height: 430,
|
|
|
|
|
showFooter: false,
|
|
|
|
|
rownumbers: true,
|
|
|
|
|
ctrlSelect: false,
|
|
|
|
|
singleSelect: true
|
|
|
|
|
});
|
|
|
|
|
self.gridadp.init(self.gridContainer);
|
|
|
|
|
self.gridadp.fitColumns();
|
|
|
|
|
// self.gridadp.loadData(JSON.parse(printDatas));
|
|
|
|
|
self.$grid = self.gridadp.grid.$grid;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.opRouter = function(opcode) {
|
|
|
|
|
var allBtns = this.allBtns = ['printadd', 'printedit', 'printdelete', 'refresh', 'printsave', 'printcancle', 'printpreview', 'printprint', 'printset'];
|
|
|
|
|
var btnsac = this.btnsac = ['printsave', 'printcancle'];
|
|
|
|
|
var self = this;
|
|
|
|
|
switch(opcode) {
|
|
|
|
|
case 'printadd':
|
|
|
|
|
self.addStatus = true;
|
|
|
|
|
self.setBtnDisable();
|
|
|
|
|
self.setBtnEnable(btnsac);
|
|
|
|
|
append();
|
|
|
|
|
break;
|
|
|
|
|
case 'printedit':
|
|
|
|
|
self.editStatus = true;
|
|
|
|
|
self.setBtnDisable();
|
|
|
|
|
self.setBtnEnable(btnsac);
|
|
|
|
|
break;
|
|
|
|
|
case 'printdelete':
|
|
|
|
|
removeit();
|
|
|
|
|
break;
|
|
|
|
|
case 'refresh':
|
|
|
|
|
self.getPrnData();
|
|
|
|
|
break;
|
|
|
|
|
case 'printsave':
|
|
|
|
|
self.editStatus = false;
|
|
|
|
|
self.addStatus = false;
|
|
|
|
|
accept();
|
|
|
|
|
self.saveData();
|
|
|
|
|
break;
|
|
|
|
|
case 'printcancle':
|
|
|
|
|
self.editStatus = false;
|
|
|
|
|
reject();
|
|
|
|
|
self.setBtnEnable(allBtns);
|
|
|
|
|
break;
|
|
|
|
|
case 'printpreview':
|
|
|
|
|
self.preview();
|
|
|
|
|
// getChanges();
|
|
|
|
|
break;
|
|
|
|
|
case 'printprint':
|
|
|
|
|
self.print();
|
|
|
|
|
break;
|
|
|
|
|
case 'printset':
|
|
|
|
|
self.setting();
|
|
|
|
|
break;
|
|
|
|
|
case 'quitprintset':
|
|
|
|
|
self.close();
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.setBtnEnable = function(buttons) {
|
|
|
|
|
var self = this;
|
|
|
|
|
for (var i = 0; i < buttons.length; i++) {
|
|
|
|
|
self.tooladp.enable(buttons[i]);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.setBtnDisable = function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
var buttons = ['printadd', 'printedit', 'printdelete', 'refresh', 'printsave', 'printcancle', 'printpreview', 'printprint', 'printset'];
|
|
|
|
|
for (var i = 0; i < buttons.length; i++) {
|
|
|
|
|
self.tooladp.disable(buttons[i]);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.open = function() {
|
|
|
|
|
Window.prototype.open.call(this);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.removeItem = function(rows) {
|
|
|
|
|
var params = {
|
|
|
|
|
'op':'save',
|
|
|
|
|
'rows': [],
|
|
|
|
|
'deleteRows':rows,
|
|
|
|
|
'rptId': self.args.printObj.rptId
|
|
|
|
|
}
|
|
|
|
|
ER.services.setPrn(params, function(isok, data) {
|
|
|
|
|
if (isok) {
|
|
|
|
|
ER.messager.tip('删除成功!');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onBeforeEdit(index, row) {
|
|
|
|
|
var rptObj = self.args.printObj;
|
|
|
|
|
row.rptcode = row.rptcode || rptObj.rptCode + (rptObj.rptName ? rptObj.rptName : '');
|
|
|
|
|
row.$state = self.addStatus ? 'added' : 'modified';
|
|
|
|
|
row.lrdate = moment().format('YYYY-MM-DD HH:mm:ss')// ER.services.getData()[0].sysdate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var editIndex = undefined;
|
|
|
|
|
function endEditing(){
|
|
|
|
|
if (editIndex == undefined){return true}
|
|
|
|
|
if (self.$grid.datagrid('validateRow', editIndex)){
|
|
|
|
|
self.$grid.datagrid('endEdit', editIndex);
|
|
|
|
|
editIndex = undefined;
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function onClickCell(index, field){
|
|
|
|
|
if (!self.editStatus) return;
|
|
|
|
|
if (editIndex != index){
|
|
|
|
|
if (endEditing()){
|
|
|
|
|
self.$grid.datagrid('selectRow', index);
|
|
|
|
|
self.$grid.datagrid('beginEdit', index);
|
|
|
|
|
var ed = self.$grid.datagrid('getEditor', {index:index,field:field});
|
|
|
|
|
if (ed){
|
|
|
|
|
($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus();
|
|
|
|
|
}
|
|
|
|
|
editIndex = index;
|
|
|
|
|
} else {
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
self.$grid.datagrid('selectRow', editIndex);
|
|
|
|
|
},0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function onEndEdit(index, row){
|
|
|
|
|
var keys = Object.keys(row);
|
|
|
|
|
keys.splice(0, 1);
|
|
|
|
|
var ed = self.$grid.datagrid('getEditor', {
|
|
|
|
|
index: index,
|
|
|
|
|
field: keys[index]
|
|
|
|
|
});
|
|
|
|
|
if (ed) {
|
|
|
|
|
row[keys[index]] = ed.target.val();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function append(){
|
|
|
|
|
var rptObj = self.args.printObj;
|
|
|
|
|
var rows = self.$grid.datagrid('getData').rows;
|
|
|
|
|
var max = 0;
|
|
|
|
|
for (var i = 0; i < rows.length; i++) {
|
|
|
|
|
var _temp = parseInt(rows[i].serialno);
|
|
|
|
|
if (_temp > max) max = _temp;
|
|
|
|
|
}
|
|
|
|
|
self.index = max + 1;
|
|
|
|
|
if (endEditing()){
|
|
|
|
|
self.$grid.datagrid('appendRow',{
|
|
|
|
|
$state: 'added',
|
|
|
|
|
rptcode: rptObj.rptCode + (rptObj.rptName ? rptObj.rptName : ''),
|
|
|
|
|
serialno: self.index,
|
|
|
|
|
crtusercode: ER.Cache.logon.userCode,
|
|
|
|
|
lrdate: moment().format('YYYY-MM-DD HH:mm:ss')// ER.services.getData()[0].sysdate;
|
|
|
|
|
});
|
|
|
|
|
editIndex = self.$grid.datagrid('getRows').length-1;
|
|
|
|
|
self.$grid.datagrid('selectRow', editIndex)
|
|
|
|
|
.datagrid('beginEdit', editIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function removeit(){
|
|
|
|
|
var selRows = self.gridadp.getSelected();
|
|
|
|
|
if(!selRows) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
self.removeItem([selRows]);
|
|
|
|
|
}
|
|
|
|
|
var ronIndex = self.$grid.datagrid('getRowIndex', selRows)
|
|
|
|
|
self.$grid.datagrid('cancelEdit', ronIndex)
|
|
|
|
|
.datagrid('deleteRow', ronIndex);
|
|
|
|
|
editIndex = undefined;
|
|
|
|
|
}
|
|
|
|
|
function accept(){
|
|
|
|
|
if (endEditing()){
|
|
|
|
|
self.$grid.datagrid('acceptChanges');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function reject(){
|
|
|
|
|
self.$grid.datagrid('rejectChanges');
|
|
|
|
|
editIndex = undefined;
|
|
|
|
|
}
|
|
|
|
|
function getChanges(){
|
|
|
|
|
var rows = self.$grid.datagrid('getChanges');
|
|
|
|
|
alert(rows.length+' rows are changed!');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
|
PrintWindow.prototype.preview = function() {
|
|
|
|
|
var row = self.gridadp.getSelected();
|
|
|
|
|
if (row) {
|
|
|
|
|
try {
|
|
|
|
|
this.activePrinter(1);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.activePrinter = function(mod) {
|
|
|
|
|
var self = this;
|
|
|
|
|
var row = self.gridadp.getSelected();
|
|
|
|
|
// FDP.silent = true;
|
|
|
|
|
try {
|
|
|
|
|
var pd = self.getPrintData();
|
|
|
|
|
var pv = self.getPrintVariables();
|
|
|
|
|
ER.services.print(self.args.printObj.rptId, row.serialno, mod, pd, pv);
|
|
|
|
|
return;
|
|
|
|
|
} finally {
|
|
|
|
|
// FDP.silent = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.getPrintData = function() {
|
|
|
|
|
var ds = this.args.printObj;
|
|
|
|
|
var data = {
|
|
|
|
|
uiObjCode: ds.uiObjCode,
|
|
|
|
|
uiObjName: ds.uiObjName || '打印报表',
|
|
|
|
|
isMaster: true,
|
|
|
|
|
fieldList: [],
|
|
|
|
|
forPrint: []
|
|
|
|
|
};
|
|
|
|
|
var columns = this.args.columns;
|
|
|
|
|
for (var i = 0; i < columns.length; i++) {
|
|
|
|
|
var col = columns[i];
|
|
|
|
|
data.fieldList.push({
|
|
|
|
|
fieldName: col.fieldName,
|
|
|
|
|
fieldDes: col.dispName,
|
|
|
|
|
dataType: col.dataType,
|
|
|
|
|
dataWidth: col.headerWidth,
|
|
|
|
|
dataDec: col.dataDec
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
var fArrayData = [];
|
|
|
|
|
for (var k = 0; k < this.args.selectRows.length; k++) {
|
|
|
|
|
var tempData = {};
|
|
|
|
|
for (var j = 0; j < data.fieldList.length; j++) {
|
|
|
|
|
var fieldName = data.fieldList[j].fieldName;
|
|
|
|
|
tempData[fieldName] = this.args.selectRows[k][fieldName];
|
|
|
|
|
}
|
|
|
|
|
fArrayData.push(tempData);
|
|
|
|
|
}
|
|
|
|
|
data.forPrint = data.forPrint.concat(fArrayData);
|
|
|
|
|
return [data];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.getPrintVariables = function() {
|
|
|
|
|
var data = _.extend(this.args.qParams, ER.Cache.logon);
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.print = function() {
|
|
|
|
|
var row = self.gridadp.getSelected();
|
|
|
|
|
if (row) {
|
|
|
|
|
try {
|
|
|
|
|
this.activePrinter(0);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.setting = function() {
|
|
|
|
|
var row = self.gridadp.getSelected();
|
|
|
|
|
if (row) {
|
|
|
|
|
try {
|
|
|
|
|
this.activePrinter(2);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.download = function() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintWindow.prototype.exit = function() {
|
|
|
|
|
this.close();
|
|
|
|
|
// delete avalon.vmodels['fdp_print_toolbar'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取本业务的层列明细表数据
|
|
|
|
|
* @param {[type]} funcData [功能编码]
|
|
|
|
|
* @param {[type]} code [数据源]
|
|
|
|
|
* @param {[type]} data [数据]
|
|
|
|
|
* @param {[type]} self [description]
|
|
|
|
|
* @param {Function} callback [description]
|
|
|
|
|
*/
|
|
|
|
|
function loadData(funcData, code, data, win, callback) {
|
|
|
|
|
var codes = code.split(';');
|
|
|
|
|
var datasets = [];
|
|
|
|
|
for (var c in codes) {
|
|
|
|
|
win[codes[c]] = new DataSource({
|
|
|
|
|
'funcObjCode': codes[c],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
win[codes[c]].initUIObj(data[codes[c]]);
|
|
|
|
|
win[codes[c]].funcCode = funcData.funcCode;
|
|
|
|
|
if (0 < _.where(win[codes[c]].columns, {
|
|
|
|
|
'fieldName': 'FunCode'
|
|
|
|
|
}).length) {
|
|
|
|
|
win[codes[c]].fixQuery = {
|
|
|
|
|
FunCode: funcData.funCode
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
datasets.push(win[codes[c]]);
|
|
|
|
|
}
|
|
|
|
|
FDP.bizDao.getDataSet(datasets, function(isok, result) {
|
|
|
|
|
if (isok) {
|
|
|
|
|
if (callback) {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
FDP.messager.err('获取打印格式数据源数据错误,请重试。');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [设置是否允许编辑或者新增行]
|
|
|
|
|
* @param {[type]} win [当前窗口]
|
|
|
|
|
* @param {Boolean} isEnable [布尔类型,是否允许增加或编辑]
|
|
|
|
|
*/
|
|
|
|
|
function setEnableAddRow(win, isEnable) {
|
|
|
|
|
win.vm.grid_main.setOptions({
|
|
|
|
|
editable: isEnable,
|
|
|
|
|
enableAddRow: false
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return PrintWindow;
|
|
|
|
|
});
|