define(function (require, exports, module) { let BaseBiz = require('apps/rht/base/rhtBiz'); let rhtComm = require('apps/rht/comm/rhtComm'); let SetSysRefresh = require('./SetSysRefresh'); let service = require('./sys010102service'); let constValue = require('./const.js'); let interval=null; /** * 控制按钮的可用 * @param opCode 按钮编码 * @return [description] */ function Biz(vm) { //继承第一步,构造继承 BaseBiz.call(this, vm); } //继承第二步,方法继承 inherits(Biz, BaseBiz); let orgCode=Store.logOn.orgCode; let userId=Store.logOn.userId; let userCode=Store.logOn.userCode; let userName=Store.logOn.userName; //当前状态为非浏览状态或者当前行为空时,【设置】按钮不可用 Biz.prototype.getOpEnabled = function (opCode) { let isOk = this.super('getOpEnabled', opCode); if (!isOk) { return false; } let self = this; let curRow = this.dsMaster.currentRow; if (opCode == 'clear') { if (!curRow) return false; if (!this.isBrowser()) return false; } return true; }; Biz.prototype.doOp = function (opCode) { let self = this; let setSysRefresh = null; this.super('doOp'); //设置刷新条件,弹出窗体进行设置 if (opCode == 'setRefresh') { if (setSysRefresh) { setSysRefresh.open(); } else { let args = { callback: function (getTime,getisAutofresh) { //如果自动刷新 if (getisAutofresh) { if (interval!=null) { clearInterval(interval); interval=null; } // self.dsMaster.fixQuery = { // }; interval=setInterval(function(){self.opRouter("refresh")}, getTime*60*1000); } if (!getisAutofresh) { if (interval!=null) { clearInterval(interval); interval=null; } // self.dsMaster.fixQuery = { }; } //如果不自动刷新,刷新当前页面 self.opRouter("refresh"); } }; setSysRefresh = new SetSysRefresh(args); setSysRefresh.open(); } } //清除时调用java类进行删除数据 if (opCode == 'clear') { Store.messager.confirm("您确实要清除当前组织下的所有日结日志吗?", function(replace) { if (replace) { let retclearSysLog = service.clearSysLog(orgCode,orgCode); if (retclearSysLog.result !== 1) { Store.messager.warn(retclearSysLog.message); rhtComm.MWriteErrLog(orgCode,userId,userCode,userName,"","","查询结账历史记录","清除日结日志失败:"+retclearSysLog.message); return false; } self.dsmaster.search(); rhtComm.MWriteOprLog(orgCode,userId,userCode,userName,'','','查询结账历史记录',"清除日结日志成功。"); } }); } } //用户自定义查询条件 Biz.prototype.beforeDataSrcSearch = function (dataSrc, params) { if (dataSrc.uiObjCode == this.dsMaster.uiObjCode) { params.userExtSqlQuery = { plugin: "autoRefresh", data:{ accDate:constValue.getAccDate() } } } } //this.setInterval(refr); return Biz; })