|
|
//const SetOverType = require('./setovertype');
|
|
|
|
|
|
define(function (require, exports, module) {
|
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
|
let Service = require('./sys010111service');
|
|
|
let queryWindow = require("apps/rht/sys/sys010111/multiwindowdel");
|
|
|
let SetOverType = require('apps/rht/sys/sys010111/setovertype');
|
|
|
/**
|
|
|
* 控制按钮的可用
|
|
|
* @param opCode 按钮编码
|
|
|
* @return [description]
|
|
|
*/
|
|
|
|
|
|
function Biz(vm) {
|
|
|
//继承第一步,构造继承
|
|
|
BaseBiz.call(this, vm);
|
|
|
}
|
|
|
|
|
|
//继承第二步,方法继承
|
|
|
inherits(Biz, BaseBiz);
|
|
|
|
|
|
let tempData = null;
|
|
|
|
|
|
/*
|
|
|
控制按钮操作
|
|
|
*/
|
|
|
//按钮事件控制
|
|
|
Biz.prototype.doOp = function (opCode) {
|
|
|
if (opCode == 'issale') {
|
|
|
this.onsetsale("1");
|
|
|
}
|
|
|
if (opCode == 'nosale') {
|
|
|
this.onsetsale("0");
|
|
|
}
|
|
|
if (opCode == 'doover') {
|
|
|
this.doover("2");
|
|
|
}
|
|
|
if (opCode == 'overtype') {
|
|
|
let dhead = this.dsMaster;
|
|
|
this.doovertype(this, dhead);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//控制主界面按钮状态
|
|
|
Biz.prototype.getOpEnabled = function (opCode) {
|
|
|
let isOk = this.super('getOpEnabled', opCode);
|
|
|
if (!isOk) {
|
|
|
return false;
|
|
|
}
|
|
|
let masterRow = this.dsMaster.currentRow;
|
|
|
let sIsEnable = masterRow ? TypeUtil.toString(masterRow['UsPos']) : '';
|
|
|
let sOverType = masterRow ? TypeUtil.toString(masterRow['OverType']) : '';
|
|
|
if (opCode == 'issale'){
|
|
|
if (this.isEdit())
|
|
|
return false;
|
|
|
if (!masterRow)
|
|
|
return false;
|
|
|
if (sIsEnable == '1')
|
|
|
return false;
|
|
|
}
|
|
|
if (opCode == 'nosale'){
|
|
|
if (this.isEdit())
|
|
|
return false;
|
|
|
if (!masterRow)
|
|
|
return false;
|
|
|
if (sIsEnable == '0')
|
|
|
return false;
|
|
|
}
|
|
|
if (opCode == 'edit'){
|
|
|
if (this.isEdit())
|
|
|
return false;
|
|
|
if (!masterRow)
|
|
|
return false;
|
|
|
if (sIsEnable == '0')
|
|
|
return false;
|
|
|
}
|
|
|
if (opCode == 'overtype'){
|
|
|
if (this.isEdit())
|
|
|
return false;
|
|
|
if (!masterRow)
|
|
|
return false;
|
|
|
}
|
|
|
if (opCode == 'doover'){
|
|
|
if (this.isEdit())
|
|
|
return false;
|
|
|
if (!masterRow)
|
|
|
return false;
|
|
|
if (sOverType != '1')
|
|
|
return false;
|
|
|
if (sIsEnable == '0')
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
|
|
|
Biz.prototype.onsetsale = function (optype) {
|
|
|
self = this;
|
|
|
let curRow = self.dsMaster.currentRow;
|
|
|
let orgCode = curRow.OrgCode;
|
|
|
|
|
|
if (curRow) {
|
|
|
let ret = Service.getSlideMenuData("actExecute",optype, orgCode, "", "", "", "");
|
|
|
if (ret.result !== 1) {
|
|
|
Store.messager.err(ret.message);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
Biz.prototype.doover = function (optype) {
|
|
|
self = this;
|
|
|
let curRow = self.dsMaster.currentRow;
|
|
|
let orgCode = curRow.OrgCode;
|
|
|
let rptDate = curRow.RptDate_Mis;
|
|
|
let tmpdate = TypeUtil.toDate(rptDate);
|
|
|
tmpdate.setDate(tmpdate.getDate()+1);
|
|
|
rptDate = tmpdate.format('yyyy-MM-dd');
|
|
|
if (curRow) {
|
|
|
let ret = Service.getSlideMenuData("actExecute",'doOver', orgCode, rptDate, "1", "", "");
|
|
|
|
|
|
if (ret.result !== 1) {
|
|
|
Store.messager.err(ret.message);
|
|
|
return false;
|
|
|
}
|
|
|
else{
|
|
|
Store.messager.tip(ret.message);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
Biz.prototype.doovertype = function (biz, ds, dr) {
|
|
|
let setOverType = new SetOverType(ds.currentRow);
|
|
|
setOverType.callback=function(){
|
|
|
biz.dsMaster.updateRow();
|
|
|
};
|
|
|
setOverType.open();
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取显示菜单内容
|
|
|
* @param {object} ds 对应的数据源
|
|
|
* @param source 菜单触发位置
|
|
|
* @return {array}
|
|
|
*/
|
|
|
Biz.prototype.getContextMenus = function (ds, source) {
|
|
|
|
|
|
let edit = ds.getEditable();
|
|
|
let ms = this.super('getContextMenus', ds, source);
|
|
|
if (ds.uiObjCode == '1036'){
|
|
|
ms.push({
|
|
|
text: '台结历史',
|
|
|
opCode: 'onoverlistview',
|
|
|
disabled: edit
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
return ms;
|
|
|
};
|
|
|
|
|
|
Biz.prototype.onoverlistview = function () {
|
|
|
let self = this;
|
|
|
let detailRow = self.dsDetail.currentRow;
|
|
|
let sOrgCode = detailRow ? TypeUtil.toString(detailRow['OrgCode']) : '';
|
|
|
let sPosNo = detailRow ? TypeUtil.toString(detailRow['PosNo']) : '';
|
|
|
//定义多选窗口界面
|
|
|
let exists = new Array();
|
|
|
let param={
|
|
|
exists: exists,
|
|
|
uiObjCode: '1037',
|
|
|
biz: self,
|
|
|
pk: "OrgCode,PosNo,RptDate",
|
|
|
fixQuery: {
|
|
|
'OrgCode': sOrgCode,
|
|
|
'PosNo': sPosNo
|
|
|
},
|
|
|
data:tempData,
|
|
|
showCheckColumn: false,
|
|
|
funcCode: self.FuncCode,
|
|
|
ds: tempData,
|
|
|
callback: function (rows) {
|
|
|
tempData = rows;
|
|
|
}
|
|
|
};
|
|
|
//new多选窗体 并打开
|
|
|
let myWindow = new queryWindow(param);
|
|
|
myWindow.open();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
*校验时间格式
|
|
|
*/
|
|
|
Biz.prototype.checkDateTime = function (str) {
|
|
|
let a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
|
|
|
if (a == null) {
|
|
|
return false;
|
|
|
}
|
|
|
if (a[1]>24 || a[3]>60 || a[4]>60)
|
|
|
{
|
|
|
return false
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
Biz.prototype.beforeSave = function() {
|
|
|
|
|
|
let self = this;
|
|
|
for (let j = 0; j < self.dsDetail.rows.length; j++) {
|
|
|
let _nwRow = self.dsDetail.rows[j];
|
|
|
let overtime = _nwRow['OverTime'];
|
|
|
let posType = _nwRow['PosType'];
|
|
|
let overType = _nwRow['OverType'];
|
|
|
let isOk = self.checkDateTime(overtime);
|
|
|
if (!isOk){
|
|
|
Store.messager.tip('[结账时间]请输入正确的时间格式!如:22:30:00');
|
|
|
return false;
|
|
|
}
|
|
|
if (posType=='3'){
|
|
|
if (overType != '3'){
|
|
|
Store.messager.tip('小程序类型的销售终端,需要设置结账方式为[3-不需要结账]');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return this.super('beforeSave');
|
|
|
}
|
|
|
module.exports = Biz;
|
|
|
}); |