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.

109 lines
4.0 KiB

define(function (require, exports, module) {
let BaseBiz = require('apps/rht/base/rhtBiz');
let queryTpl = require('text!./custom-built-query.tpl')
let MyEdit = require('./myedit');
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
Biz.prototype.getCustomBuiltQuery = function() {
return queryTpl
};
Biz.prototype.initCompleted = function () {
this.super('initCompleted');
let self = this;
initDataListCheck(self);
};
function initDataListCheck(self) {
let $orgCode = self.getElement('.org-code');
let $orgWrapper = self.getElement('.org-code-wrapper')
$orgCode.textbox({
value: Store.logOn.inOrgCode
})
if ((Store.logOn.orgType == '1001') || (Store.logOn.orgType == '1002')){
$orgWrapper.show();
}
else{
$orgWrapper.hide();
}
}
//根据登录组织等拼装查询条件
Biz.prototype.beforeDataSrcSearch = function (dataSrc, params) {
let self = this;
self.dsMaster.setServerBiz('cn.qdhezheng.rht.app.stk.stk180614.SavePlugin');
self.dsPcInf.setServerBiz('cn.qdhezheng.rht.app.stk.stk180614.SavePlugin');
self.dsPcKc.setServerBiz('cn.qdhezheng.rht.app.stk.stk180614.SavePlugin');
};
Biz.prototype.beforeRefresh = function () {
let isOk = this.super('beforeRefresh');
let orgCode = this.getElement('.org-code').textbox('getValue');
let pluCode = this.getElement('.plu-code').textbox('getValue');
let barCode = this.getElement('.bar-code').textbox('getValue');
let clsCode = this.getElement('.cls-code').textbox('getValue');
if ((orgCode.length <= 0) && (pluCode.length <= 0) && (barCode.length <= 0) && (clsCode.length <= 0)){
Store.messager.err('您没有设置查询条件,数据量可能会比较大,查询速度可能会非常慢,<br>请先设置查询条件后再刷新!');
return false;
}
this.dsMaster.state = {
orgCode: orgCode,
pluCode: pluCode,
barCode: barCode,
clsCode: clsCode,
};
return isOk;
};
//增加右键菜单按钮并控制按钮状态
Biz.prototype.getContextMenus = function (ds, source) {
let menus = this.super("getContextMenus", ds, source)
if (ds.uiObjCode=="18063"){
menus.push({
text: '批次调整',
opCode: 'pctz',
disabled: (1 == 2)
});
}
return menus;
};
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
let self = this;
if (opCode == 'pctz') {
let tmpData = self.dsPcKc.getSelectedRows();
this.onpctz(tmpData);
}
};
//批次调整事件处理
Biz.prototype.onpctz = function (tmpData) {
if (tmpData.length != 2){
Store.messager.err("批次调整必须同时选择两个批次!");
return false;
}
else{
if (tmpData[0].OrgCode != tmpData[1].OrgCode){
Store.messager.err("批次调整必须选择同一组织!");
return false;
}
if (tmpData[0].DepID != tmpData[1].DepID){
Store.messager.err("批次调整必须选择同一部门!");
return false;
}
if (tmpData[0].CkCode != tmpData[1].CkCode){
Store.messager.err("批次调整必须选择同一仓库!");
return false;
}
let myEdit = new MyEdit(tmpData[0],tmpData[1]);
myEdit.callback=function(){
//self.opRouter('refresh');
};
myEdit.open();
}
return true;
};
return Biz;
});