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.
144 lines
4.7 KiB
144 lines
4.7 KiB
define(function(require, exports, module) {
|
|
var BaseBiz = require('system/base/biz');
|
|
var utils = require('apps/edp/frd/frd004/utils');
|
|
var SelectOp = require('apps/edp/frd/frd004/selectop');
|
|
var FuncScriptwin = require('apps/edp/frd/frd004/funcScriptwin');
|
|
|
|
function Biz(dict) {
|
|
BaseBiz.call(this, dict);
|
|
}
|
|
|
|
inherits(Biz, BaseBiz);
|
|
|
|
Biz.prototype.initialize = function() {
|
|
this.dsMaster.onlySaveCurrent = true;
|
|
};
|
|
|
|
function copyDataToDataSrc(ds, data) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
var row = data[i];
|
|
var newRow = ds.newRow();
|
|
newRow.loadData(row);
|
|
ds.addRow(newRow);
|
|
}
|
|
}
|
|
|
|
Biz.prototype.doOp = function(opCode) {
|
|
var self = this;
|
|
if (opCode == 'operate' || opCode == 'object' || opCode == 'copy' || opCode == 'res') {
|
|
var args = {
|
|
callback: function(funcCode) {
|
|
switch (opCode) {
|
|
case 'operate':
|
|
utils.getFuncOpByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncOp, data);
|
|
});
|
|
break;
|
|
case 'object':
|
|
utils.getFuncObjByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncObj, data);
|
|
});
|
|
break;
|
|
case 'res':
|
|
utils.getFuncResByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncRes, data);
|
|
});
|
|
break;
|
|
case 'copy':
|
|
utils.getFuncObjByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncObj, data);
|
|
utils.getFuncOpByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncOp, data);
|
|
utils.getFuncResByTpl(funcCode, function(data) {
|
|
copyDataToDataSrc(self.dsFuncRes, data);
|
|
});
|
|
});
|
|
});
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
var dlg = new SelectOp(args);
|
|
dlg.open();
|
|
return;
|
|
}
|
|
if (opCode == 'exportScriptOracle' || opCode == 'exportScriptMySql') {
|
|
self.dsMaster.loadDetails(function(isOk) {
|
|
if (isOk) {
|
|
self.script(opCode);
|
|
}
|
|
});
|
|
}
|
|
|
|
this.super('doOp', opCode);
|
|
}
|
|
|
|
Biz.prototype.script = function(opCode) {
|
|
var self = this;
|
|
var dbType = '';
|
|
if (opCode === 'exportScriptOracle') {
|
|
dbType = 'oracle';
|
|
} else if (opCode === 'exportScriptMySql') {
|
|
dbType = 'mysql'
|
|
} else {
|
|
Store.messager.warn('只能导出oracle、mysql脚本');
|
|
return;
|
|
}
|
|
|
|
var script = new FuncScriptwin({
|
|
dsMaster: self.dsMaster,
|
|
dsFuncObj: self.dsFuncObj,
|
|
dsFuncOp: self.dsFuncOp,
|
|
dsFuncRec: self.dsFuncRes,
|
|
dsFuncOrgRight: self.dsFuncOrgRight,
|
|
scriptType: '0',
|
|
dbType: dbType
|
|
});
|
|
script.open();
|
|
};
|
|
|
|
Biz.prototype.getOpEnabled = function(opCode) {
|
|
if (opCode == 'export') {
|
|
return this.isEdit();
|
|
}
|
|
|
|
return this.super('getOpEnabled', opCode);
|
|
};
|
|
|
|
Biz.prototype.initCompleted = function() {
|
|
this.super('initCompleted');
|
|
var self = this;
|
|
Store.bizDao.getData('000002', {}, function(isOk, data) {
|
|
if (isOk) {
|
|
var treedata = [];
|
|
treedata.push({
|
|
id: '*',
|
|
pId: '',
|
|
value: '*',
|
|
name: '全部',
|
|
colName: 'ModuleCode',
|
|
open: true
|
|
});
|
|
for (var i = 0; i < data.length; i++) {
|
|
var row = data[i];
|
|
treedata.push({
|
|
id: row['modulecode'],
|
|
pId: '*',
|
|
value: row['modulecode'],
|
|
name: row['modulename'],
|
|
colName: 'ModuleCode'
|
|
})
|
|
}
|
|
|
|
self.callView('setTreeData', treedata);
|
|
}
|
|
});
|
|
}
|
|
|
|
Biz.prototype.getTreeTitle = function() {
|
|
return ''
|
|
};
|
|
|
|
return Biz;
|
|
}) |