define(function (require, exports, module) { let BaseBiz = require('apps/rht/base/rhtBiz'); let Service = require('./dst200101service'); let MdYhInf = require('./mdyhinf'); let YhErrInf = require('./yherrinf'); /** * 控制按钮的可用 * @param opCode 按钮编码 * @return [description] */ function Biz(vm) { //继承第一步,构造继承 BaseBiz.call(this, vm); vm.remark ='' } //继承第二步,方法继承 inherits(Biz, BaseBiz); let dataList = null; //根据登录组织等拼装查询条件 Biz.prototype.beforeDataSrcSearch = function (dataSrc, params) { let self = this; self.setServerBiz('cn.qdhezheng.rht.app.dst.dst200101.SavePlugin'); }; //校验小数精度 Biz.prototype.getPrecision = function (dataSrc, dr, dc, defaultPrecision) { if (dataSrc.uiObjCode == this.dsDetail.uiObjCode) { //把这里改成需要控制的字段 if (dc.fieldName == 'QrCount') { return TypeUtil.toInt(dr['R_DotDecimal']); } } return this.super('getPrecision', dataSrc, dr, dc, defaultPrecision); }; //字段变化触发事件 Biz.prototype.fieldChanged = function (dataSrc, dr, dc) { if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) { switch (dc.fieldName) { case 'Remark': this.fieldChangedRemark(dataSrc, dr, dc); break; } } if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) { switch (dc.fieldName) { case 'QrCount': this.fieldChangedQrCount(dataSrc, dr, dc); break; } } this.super('fieldChanged'); }; //Remark 字段变化执行事件 Biz.prototype.fieldChangedRemark = function (dataSrc, dr, dc) { let sRemarkBillNo = dr ? TypeUtil.toString(dr['RemarkBillNo']) : ''; if (sRemarkBillNo.length > 0){ dr.setColumnError(dc.fieldName, "备注信息已写入配送单,不能修改!"); return false; } return true; }; //QrCount 字段变化执行事件 Biz.prototype.fieldChangedQrCount = function (dataSrc, dr, dc) { let sPluCode = dr ? TypeUtil.toString(dr['PluCode']) : ''; if (sPluCode === '') return false; let curHRow = this.dsMaster.currentRow; let sBillNo = curHRow ? TypeUtil.toString(curHRow['BillNo']) : ''; let ret= Service.getSlideMenuData("DoOnDetailCalcRule","QrCount", sBillNo,"","","",""); if (ret.result !== 1) { Store.messager.err(ret.message); return false; } return true; }; //按钮事件控制 Biz.prototype.doOp = function (opCode) { if (opCode == 'myedit') { this.opRouter('edit'); } if (opCode == 'pass') { this.onpass("1"); } if (opCode == 'nopass') { this.onpass("2"); } if (opCode == 'showinf') { this.onshowinf(); } if (opCode == 'mdyhinf') { this.onmdyhinf(); } if (opCode == 'yherrinf') { this.onyherrinf(); } }; //控制主界面按钮状态 Biz.prototype.getOpEnabled = function (opCode) { let isOk = this.super('getOpEnabled', opCode); if (!isOk) { return false; } let curRow = this.dsMaster.currentRow; if (opCode == 'myedit'){ if (!curRow) return false; if (this.isEdit()) return false; } if ((opCode == 'pass') || (opCode == 'nopass')) { if (!curRow) return false; if (this.isEdit()) return false; } return true; }; //确认/作废公共事件处理 Biz.prototype.onpass = function (sType) { let sTypeName ="确认"; if (sType == "2"){ sTypeName ="作废"; } //弹出是否确认提交对话框 if (!Store.confirm("确认要对选中数据进行"+sTypeName+"处理吗?")) { return false; } let curHRow = this.dsMaster.currentRow; let sBillNo = curHRow ? TypeUtil.toString(curHRow['BillNo']) : ''; let arrBillNo = new Array(); let iPass = 0; if (this.dsMaster.getSelectedRows().length <= 0){ if (sBillNo.length > 0){ let sZbOrgCode = curHRow ? TypeUtil.toString(curHRow['ZbOrgCode']) : ''; if (sZbOrgCode != Store.logOn.orgCode){ Store.messager.err("所选单据("+sBillNo+")不是向本组织要货的要货数据,本组织不能确认或作废,请检查!"); return false; } arrBillNo[0] = sBillNo; iPass = iPass +1; } } else{ //只处理符合条件的单据 for (let i=0;i