UNPKG

efview

Version:

A high quality Service UI components Library with Vue.js

1,192 lines (1,158 loc) 124 kB
export default { name:'contract', methods:{ // 初期化字典 initUserDict() { let obj = {}; obj.COMPANY = this.getCompany(); obj.SETTLEDAY = this.getSettleDay(); obj.CODECHARGEDEFTYPE = this.getCodeChargeDefType(); let setmode = this.getSetmode(); obj.BCONTBD_SETMODE = []; obj.BCONTQS_SETMODE = []; if (setmode) { setmode.forEach(el => { if (el.isqs === 'N') { obj.BCONTBD_SETMODE.push(el); } if (el.isqs === 'Y') { obj.BCONTQS_SETMODE.push(el); } }); } if (obj.SETTLEDAY) { obj.SETTLEDAY.forEach((el) => { el.code = Number(el.code); }); } return obj; }, // 初期化界面 customInit() { this.expirysdatename = this.getManaPara('00', 'EXPIRYSDATE'); this.gbname = this.getManaPara('00', 'GBNAME'); // 固定租金 this.CODECHARGEDEF_RENT = '3'; if (this.globalConfig.dictData.GOODS_TAXRATE) { this.globalConfig.dictData.GOODS_TAXRATE.forEach(el => { el.code = Number(el.code); }); } let self = this; let globruleList = this.getGrobruleList('goods,contno'); if (globruleList) { for (let pro in globruleList) { //获取商品规则 if (globruleList[pro].ruleid === 'goods') { self.gbidRulemode = globruleList[pro].rulemode; } //获取商品规则 if (globruleList[pro].ruleid === 'contno') { self.contnoRulemode = globruleList[pro].rulemode; } } } this.uiconfig.detailConfig.billDetailConfig.items.some(el => { if (el.name === 'bcontgoods') { el.items.some(el2=> { if (el2.name === 'gbid') { if (self.gbidRulemode === '1') { el2.readOnly = true; el2.required = false; } else { el2.readOnly = false; el2.required = true; } return true; } }); return true; } }); this.uiconfig.detailConfig.formsConfig.items.some(el => { if (el.name === 'base') { el.items.some(el2=> { if (el2.name === 'contno') { if (self.contnoRulemode === '1') { el2.readOnly = true; el2.required = false; } else { el2.readOnly = false; el2.required = true; } return true; } }); return true; } }); }, isRealNum(val){ // 先判定是否为number if(typeof val !== 'number'){ return false; } if(!isNaN(val)){ return true; }else{ return false; } }, accAdd(arg1, arg2) { let r1, r2, m; try { r1 = arg1.toString().split('.')[1].length; } catch (e) { r1 = 0; } try { r2 = arg2.toString().split('.')[1].length; } catch (e) { r2 = 0; } m = Math.pow(10, Math.max(r1, r2)); return (arg1 * m + arg2 * m) / m; }, // 判断商铺是否已被其它明细引用 checkSpidUse (sbid) { let data = this.$refs.layout.getForm().getData(); let flag = false; let checkDetail = ['bcontbd', 'bcontcycfee','bcontcharge','bcontgoods']; checkDetail.some(el => { if (data[el] && data[el].length > 0) { let name = this.getDetailTitle(el); data[el].some((el2, index) => { if (el2.spid && (el2.spid === sbid || el2.spid.toLowerCase() === 'all')) { let rowNum = index + 1; this.alert('商铺已被' +name + '第' + rowNum + '行明细的商铺[' + el2.spid_name + ']所引用不能修改或删除,请检查 '); flag = true; return true; } }); if (flag) { return true; } } }); if (flag) { return true; } else { return false; } }, // 判断明细是否有数据 isDetail() { let data = this.$refs.layout.getForm().getData(); if (data.bcontmanaframe && data.bcontmanaframe.length > 0) { return false; } if (data.bcontbd && data.bcontbd.length > 0) { return false; } if (data.bcontqs && data.bcontqs.length > 0) { return false; } if (data.bcontcycfee && data.bcontcycfee.length > 0) { return false; } if (data.bcontdeposit && data.bcontdeposit.length > 0) { return false; } if (data.bcontcharge && data.bcontcharge.length > 0) { return false; } if (data.bcontoverduefine && data.bcontoverduefine.length > 0) { return false; } if (data.bcontgoods && data.bcontgoods.length > 0) { return false; } return true; }, // 计算两个日期之间的月数 getMonthNumber(sdate, edate) { let slist = sdate.split('-'); let elist = edate.split('-'); let year1 = Number(slist[0]); let year2 = Number(elist[0]); let month1 = Number(slist[1]); let month2 = Number(elist[1]); let day1 = Number(slist[2]); let day2 = Number(elist[2]); let len = (year2 - year1) * 12 + (month2 - month1); var day = day2 -day1; if (day >= 0) { len += 1; } return len; }, // 获取明细的最小时间 与 最大时间 getMinMaxDate(data, sname, ename) { let para = {}; if (data && data.length > 0) { data.forEach((el, index) => { let tsdate = ''; let tedate = ''; if (el[sname]) { tsdate = el[sname].substring(0, 10); } if (el[ename]) { tedate = el[ename].substring(0, 10); } if (index === 0) { para.sdate = tsdate; para.edate = tedate; para.snum = index + 1; para.enum = index + 1; } else { if (tsdate && para.sdate >= tsdate) { para.sdate = tsdate; para.snum = index + 1; } if (tedate && para.edate <= tedate) { para.edate = tedate; para.enum = index + 1; } } }); } return para; }, //所有明细的最小时间与最大时间 getAllMinMaxDate() { let list = []; let data = this.$refs.layout.getForm().getData(); if (data.bcontbd && data.bcontbd.length > 0) { let para = this.getMinMaxDate(data.bcontbd,'cbsdate', 'cbedate'); para.sname = this.getDetailTitle('bcontbd'); para.ename = para.sname; list.push(para); } if (data.bcontqs && data.bcontqs.length > 0) { let para = this.getMinMaxDate(data.bcontqs,'cbsdate', 'cbedate'); para.sname = this.getDetailTitle('bcontqs'); para.ename = para.sname; list.push(para); } if (data.bcontcycfee && data.bcontcycfee.length > 0) { let para = this.getMinMaxDate(data.bcontcycfee,'cbsdate', 'cbedate'); para.sname = this.getDetailTitle('bcontcycfee'); para.ename = para.sname; list.push(para); } if (data.bcontcharge && data.bcontcharge.length > 0) { let para = this.getMinMaxDate(data.bcontcharge,'ccsdate', 'ccedate'); para.sname = this.getDetailTitle('bcontcharge'); para.ename = para.sname; list.push(para); } if (data.bcontgoodskl && data.bcontgoodskl.length > 0) { let obj = {}; data.bcontgoodskl.forEach(el => { if (!obj[el.gbid]) { obj[el.gbid] = []; } obj[el.gbid].push(el); }); for (let pro in obj) { let para = this.getMinMaxDate(obj[pro],'sdate', 'edate'); para.sname = '商品编码['+pro+']例外扣率'; para.ename = para.sname; list.push(para); } } let para = {}; list.forEach((el,index) => { if (index === 0) { Object.assign(para, el); } else { if (para.sdate >= el.sdate) { para.sdate = el.sdate; para.sname = el.sname; para.snum = el.snum; } if (para.edate <= el.edate) { para.edate = el.edate; para.ename = el.ename; para.enum = el.enum; } } }); return para; }, // 获取商铺的建筑面积,套内面积 getArea(code) { let para = {}; para.spbuildarea = 0; //建筑面积 para.splettarea = 0; //套内面积 para.leasablearea = 0; //可出租面积 let data = this.getDetail('bcontmanaframe').getData(); if (data && data.length > 0) { data.some(el => { if (code.toLowerCase() === 'all') { para.spbuildarea = this.accAdd(para.spbuildarea, el.spbuildarea); para.splettarea = this.accAdd(para.splettarea, el.splettarea); para.leasablearea = this.accAdd(para.leasablearea, el.leasablearea); } else { if (code === el.spid) { para.spbuildarea = this.accAdd(para.spbuildarea, el.spbuildarea); para.splettarea = this.accAdd(para.splettarea, el.splettarea); para.leasablearea = this.accAdd(para.leasablearea, el.leasablearea); return true; } } }); } return para; }, // 明细商铺可选ALL的查询之前处理 commonSpidSearchBefore(e, gridname, sdatename, edatename) { if (e.text && e.text.toLowerCase() === 'all') { let obj = {}; obj.spid = 'ALL'; obj.spid_name = '[ALL]所有'; let temp = {}; temp.data = []; temp.data.push({spid:'ALL'}); let form = Object.assign({}, e.form); form.spid ='ALL'; if (this.checkCommonSpid(gridname, form, sdatename, edatename)) { e.formObject.setValue('spid','ALL'); e.formObject.setValue('spid_name','[ALL]所有'); } else { e.text = e.oldText; } return false; } if (!e.searchParam) { e.searchParam = {}; } let data = this.getDetail('bcontmanaframe').getData(); let list = []; data.forEach(el => { list.push(el.spid); }); e.searchParam.spid = {'$in': list}; return true; }, //获取相同类型的结算方式 getSetModeCode(setmodecode) { let setModeData = this.$Method.copy(this.globalConfig.dictData.CONTRACT_SETMODE); let pro1 = ''; let setModeStr = []; if (setModeData && setModeData.length > 0) { let index = setModeData.findIndex(el => el.code === setmodecode); if (index > -1) { pro1 = setModeData[index].pro1; setModeData.forEach(el => { if (el.pro1 === pro1) { setModeStr.push(el); } }); } } return setModeStr; }, // 时间的相关check checkDetailDate(gridname,form, sdatename, edatename,checkflag, msg,tempData) { let formsdate = this.getForm('base').getValue('cmeffdate').substring(0,10); let formedate = this.getForm('base').getValue('cmlapdate').substring(0,10); let sdate = form[sdatename]; let edate = form[edatename]; let data = []; if (tempData) { data = tempData; } else { data = this.getDetail(gridname).getData(true); } let curl = 0; let flag = false; /*if (gridname === 'bcontbd') { if (form.setmode) { setmode = this.getSetModeCode(form.setmode); } }*/ if (checkflag === 'sdate' && sdate) { sdate = sdate.substring(0,10); if (sdate < formsdate) { this.alert('开始日期不能小于合同的生效日期'); return false; } if (sdate > formedate) { this.alert('开始日期不能大于合同的失效日期'); return false; } if (edate) { if (sdate > edate) { this.alert('开始日期不能大于结束日期'); return false; } } data.some((el,index) => { if (form.index === undefined || (form.index !== undefined && el.index !== form.index)) { if (gridname === 'bcontgoodskl') { if (form.gbid === el.gbid) { if (sdate >= el[sdatename].substring(0,10) && sdate <= el[edatename].substring(0,10)) { curl = index + 1; this.alert('开始日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (edate && sdate <= el[sdatename].substring(0,10) && edate >= el[sdatename].substring(0,10)) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (edate && sdate <= el[edatename].substring(0,10) && edate >= el[edatename].substring(0,10)) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } else { if (form.spid.toLowerCase() === 'all' || el.spid.toLowerCase()== 'all' || form.spid === el.spid) { if (sdate >= el[sdatename].substring(0,10) && sdate <= el[edatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('开始日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('开始日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } if (edate && sdate <= el[sdatename].substring(0,10) && edate >= el[sdatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } if (edate && sdate <= el[edatename].substring(0,10) && edate >= el[edatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } } } } }); if (flag) { return false; } } if (checkflag === 'edate' && edate) { edate = edate.substring(0,10); if (edate > formedate) { this.alert('结束日期不能大于合同的失效日期'); return false; } if (edate < formsdate) { this.alert('结束日期不能小于合同的失效日期'); return false; } if (sdate) { sdate = sdate.substring(0,10); if (edate < sdate) { this.alert('结束日期不能小于开始日期'); return false; } } let flag = false; data.some((el,index) => { if (form.index === undefined || (form.index !== undefined && el.index !== form.index)) { if (gridname === 'bcontgoodskl') { if (form.gbid === el.gbid) { if (edate >= el[sdatename].substring(0,10) && edate <= el[edatename].substring(0,10)){ curl = index + 1; this.alert('结束日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (sdate && sdate <= el[sdatename].substring(0,10) && edate >= el[sdatename].substring(0,10)) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (sdate && sdate <= el[edatename].substring(0,10) && edate >= el[edatename].substring(0,10)) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } else { if (form.spid.toLowerCase() === 'all' || el.spid.toLowerCase()== 'all' || form.spid === el.spid) { if (edate >= el[sdatename].substring(0,10) && edate <= el[edatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('结束日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('结束日期与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } if (sdate && sdate <= el[sdatename].substring(0,10) && edate >= el[sdatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } if (sdate && sdate <= el[edatename].substring(0,10) && edate >= el[edatename].substring(0,10)) { if (gridname === 'bcontbd' || gridname === 'bcontqs') { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } if (gridname === 'bcontcycfee' || gridname === 'bcontcharge') { if (form.cccode === el.cccode) { curl = index + 1; this.alert('与第' + curl + '行的时间存在交叉,请重新输入' + msg); flag = true; return true; } } } } } } }); if (flag) { return false; } } return true; }, // 获取合同押金费用项实收金额和是否生成结算 getDepositRecamountAndJsflag(contno, billkey) { let result = {}; let _self = this; let searchParam = { contno: contno, billkey: billkey, }; _self.synchroPost(_self.OmdUrl.settle, 'mall.settle.supchargelist.getDepositRecamount', searchParam, function (data) { if (data) { result = data; } }, null); return result; }, // 获取面积基数 getCcarea(ccdeftype) { let ccarea = 'R'; let _self = this; let searchParam = { ccdeftype: ccdeftype, }; _self.synchroPost(_self.OmdUrl.mallmdm, 'mall.mdm.codecharge.search', searchParam, function (data) { if (data && data.codecharge && data.codecharge.length > 0) { ccarea = data.codecharge[0].ccarea; } }, null); return ccarea; }, // 计算租金单位 monthPrice(form) { let spid = form.spid; let ccarea = this.getCcarea(this.CODECHARGEDEF_RENT); let cycunit = form.cycunit; let rentprice = form.rentprice; let para = {}; para.data = '0'; let temp = this.getArea(spid); let area = 1; let monthprice = 0; if (ccarea === 'B') { area = Number(temp.spbuildarea);//建筑面积 } else if (ccarea === 'R') { area = Number(temp.splettarea); //套内面积 } else if (ccarea === 'L') { area = Number(temp.leasablearea); //可出租面积 } if (cycunit === '3') { monthprice = rentprice * 30.5; } else if (cycunit === '4') { monthprice = rentprice * area * 30.5; } else if (cycunit === '1') { monthprice = rentprice; } else if (cycunit === '2') { monthprice = rentprice * area; } else if (cycunit === '5') { monthprice = rentprice / 12; } else { monthprice = 0; } return Number(monthprice).toFixed(2); }, // 结算方式check checkSetModeCycunit(form) { if (form.setmode === '21' || form.setmode === '25' || form.setmode === '28') { if (form.cycunit != '1' && form.cycunit != '3' && form.cycunit != '5') { this.alert('当前【租金单位】只能选择 [1 天/平米]或 [3 天]或 [5 区间段],请检查'); return false; } } if (form.setmode === '27') { if (form.cycunit === '5' || form.cycunit === '10') { this.alert('结算方式为阶梯租金时,租金单位不能选择区间段或年'); return false; } } return true; }, // 超额销售check checkCbsum(form, value) { if (Number(value) === 0) { return true; } let arr2 = [0, 0, 0, 0, 0, 0]; if (this.isRealNum(Number(form.cbsum1))) { arr2[0] = Number(form.cbsum1); } if (this.isRealNum(Number(form.cbsum2))) { arr2[1] = Number(form.cbsum2); } if (this.isRealNum(Number(form.cbsum3))) { arr2[2] = Number(form.cbsum3); } if (this.isRealNum(Number(form.cbsum4))) { arr2[3] = Number(form.cbsum4); } if (this.isRealNum(Number(form.cbsum5))) { arr2[4] = Number(form.cbsum5); } if (this.isRealNum(Number(form.cbsum6))) { arr2[5] = Number(form.cbsum6); } let resulttemp2 = this.cdsumisins(arr2, arr2.length); if (!resulttemp2.flag) { this.alert('超额销售' + (resulttemp2.max + 1) + '必须大于超额销售' + (resulttemp2.min + 1) + ',请检查!'); return false; } return true; }, // 判断超额销售是否逐级递增 cdsumisins(arr, len) { if (len <= 1) { return {flag: true}; } else { for (let i = len; i > 0; i--){ if (arr[i - 1] !== 0) { return this.recursion(arr, i); } } return {flag: true}; } }, recursion(arr, len) { if (len <= 1) { return {flag: true}; } else { if ((arr[len - 1] > arr[len - 2]) && (this.recursion(arr, len - 1)).flag) { return {flag: true}; } else if (arr[len - 1] <= arr[len - 2]) { return { flag: false, min: len - 2, max: len - 1 }; } else { return this.recursion(arr, len - 1); } } }, // 明细商铺相关check checkCommonSpid(gridname,form, sdatename, edatename, msg) { let flag = false; let data = this.getDetail(gridname).getData(true); data.some(el => { if (!form.index || (form.index && el.index !== form.index)) { if (this.checkDetial(form, el,sdatename, edatename, gridname)) { this.alert('已经存在相同的明细,请重新选择' + msg); flag = true; return true; } } }); if (flag) { return false; } else { return true; } }, checkDetial(newform, oldform, sdatename, edatename,flag) { if (newform[sdatename]) { newform[sdatename] = newform[sdatename].substring(0,10); } if (newform[edatename]) { newform[edatename] = newform[edatename].substring(0,10); } if (oldform[sdatename]) { oldform[sdatename] = oldform[sdatename].substring(0,10); } if (oldform[edatename]) { oldform[edatename] = oldform[edatename].substring(0,10); } if ((newform.spid.toLowerCase() === 'all'|| newform.spid === oldform.spid || oldform.spid.toLowerCase() === 'all') && newform[sdatename] === oldform[sdatename] && newform[edatename] === oldform[edatename] ) { if(flag === 'bcontcycfee' || flag === 'bcontcharge') { if (newform.cccode === oldform.cccode) { return true; } } else { return true; } } return false; }, // 检查要变更的合同 checkUpdateContract(obj) { let flag = false; let self = this; let postdata = {}; postdata.contno = obj.contno; self.synchroPost(self.OmdUrl.mall, 'mall.work.bcont.checkUptContno', postdata, function (data) { if (data.flag === '2') { self.alert('合同号[' + postdata.contno + ']存在未审核的' + data.msg + '['+ data.billno + '],请重新输入合同号'); flag = true; self.hideLoading(); } else if (data.flag === '3') { self.alert('合同号[' + postdata.contno + ']已失效,请重新输入合同号'); flag = true; self.hideLoading(); } }, null); return flag; }, // 生成合同变更单 createUpdateContract(obj) { let ph_key = ''; let postdata = {}; postdata.contno = obj.contno; let self = this; self.synchroPost(self.OmdUrl.mall, 'mall.work.bcont.addUptCont', postdata, function (data) { if (data.flag === '1') { self.alert('合同号[' + postdata.contno + ']不存在,请重新选择合同号'); self.hideLoading(); } else if (data.flag === '2') { self.alert('合同号[' + postdata.contno + ']存在未审核的' + data.msg + '[' + data.billno + '],请重新选择合同号'); self.hideLoading(); } else if (data.flag === '3') { self.alert('合同号[' + postdata.contno + ']已失效,请重新选择合同号'); self.hideLoading(); } else { ph_key = data.ph_key; } }, null); return ph_key; }, // 获取黙认的商品名称 getGbname() { let gbname = ''; if (this.gbname) { if (this.gbname.indexOf('||') > 0) { let templist = this.gbname.split('||'); templist.forEach(el => { gbname = this.getCommonGbname(el, gbname); }); } else { gbname = this.getCommonGbname(this.gbname, gbname); } } return gbname; }, // 获取商品编码 getGbid () { let para = {}; let gbid = ''; let _self = this; _self.synchroPost(_self.OmdUrl.mall, 'mall.work.goods.getAutoGbid', para, function (data) { if (data && data.gbid) { gbid = data.gbid; } }, null); return gbid; }, // 判断商品编码是否存在 checkGbid(gbid) { let para = {}; para.gbid = gbid; let flag = false; let _self = this; _self.synchroPost(_self.OmdUrl.mall, 'mall.work.goods.checkGbid', para, function (data) { if (data && data.flag === 'Y') { flag = true; } }, null); return flag; }, getCommonGbname(el, gbname) { if (el === 'SBID') { let sbidname = this.getForm('base').getValue('sbid_name'); if (sbidname) { let list = sbidname.split(']'); if (list.length > 1) { gbname += list[1]; } } } else if (el === 'SBDZ') { let sbdz = this.getForm('base').getValue('sbdz'); if (sbdz){ gbname += sbdz; } } else if (el === 'PPCODE') { let ppcode_name = this.getForm('base').getValue('ppcode_name'); if (ppcode_name){ let list2 = ppcode_name.split(']'); if (list2.length > 1) { gbname += list2[1]; } } } else if (el === 'MID') { let mcid_name = this.getForm('base').getValue('mcid_name'); if (mcid_name){ let list3 = mcid_name.split(']'); if (list3.length > 1) { gbname += list3[1]; } } } return gbname; }, // 变更单删除商品时检查商品是否已存在 checkContgoodsFlag(gbid, contno) { let para = {}; para.gbid = gbid; para.contno = contno; let flag = false; let _self = this; _self.synchroPost(_self.OmdUrl.mall, 'mall.work.contevent.checkContGoodsFlag', para, function (data) { if (data && data.ret === 'Y') { flag = true; } }, null); return flag; }, //删除明细行时检查费用是否使用 checkFeeFlag (ph_key) { let para = {}; para.ph_key = ph_key; let flag = false; let _self = this; _self.synchroPost(_self.OmdUrl.mall, 'mall.work.contevent.checkFeeFlag', para, function (data) { if (data && data.ret === 'Y') { flag = true; } }, null); return flag; }, // 删除处理check delRowCommon(e) { if (e.form.uph_key) { if (this.checkFeeFlag(e.form.uph_key)) { let curIndex = e.index + 1; this.alert('第' + curIndex+ '行的费用已经被使用,不能删除,请检查'); return false; } if (e.gridObject.config.name === 'bcontcharge') { if (!this.checkDetailSdateByContnoItmeMaxdate(e.form)) { let curIndex = e.index + 1; this.alert('第' + curIndex+ '行的费用已经被使用,不能删除,请检查'); return false; } } } return true; }, /** 基础信息 */ muidSearchBefore() { if (!this.isDetail()) { this.alert('明细存在数据,门店不可修改!'); return false; } return true; }, muidSetDataBefore(e) { this.getForm('base').setValue('sbid',''); this.getForm('base').setValue('sbid_name',''); this.getForm('base').setValue('sbdz',''); this.getForm('base').setValue('ppcode',''); this.getForm('base').setValue('ppcode_name',''); this.getForm('base').setValue('mcid',''); this.getForm('base').setValue('mcid_name',''); this.getForm('base').setValue('muid_name', ''); if (e.data && e.data.length > 0) { this.getForm('base').setValue('muid_name', e.data[0].muid_name); } return true; }, sbidSearchBefore(e) { let muid = this.getForm('base').getValue('muid'); if (!muid) { this.alert('请先选择门店'); return false; } if (!e.searchParam) { e.searchParam = {}; } e.searchParam['supmkt:muid'] = muid; e.searchParam.sbtype = '1'; e.searchParam.sbstatus = {'<>': 'D'}; e.searchParam.sbwmid5 = 'Y'; return true; }, sbidSetDataBefore(e) { this.getForm('base').setValue('sbdz',''); this.getForm('base').setValue('ppcode', ''); this.getForm('base').setValue('ppcode_name',''); this.getForm('base').setValue('mcid',''); this.getForm('base').setValue('mcid_name',''); this.getForm('base').setValue('sbid_name', ''); if(e.data && e.data.length > 0) { this.getForm('base').setValue('sbid_name', e.data[0].sbid_name); this.getForm('base').setValue('sbdz', e.data[0].sbdz); this.getForm('base').setValue('ppcode', e.data[0].ppcode); this.getForm('base').setValue('ppcode_name', e.data[0].ppcode_name); this.getForm('base').setValue('mcid', e.data[0].mcid); this.getForm('base').setValue('mcid_name', e.data[0].mcid_name); } return true; }, contnoChanged(e) { let obj = {}; if (e.value) { obj.contno = e.value; if (e.form.ph_key) { obj.ph_key = { '<>': e.form.ph_key }; } if (this.checkDuplicate(obj)) { this.alert('合同号[' + e.value + ']已存在'); return false; } } return true; }, ppcodeSearchBefore(e) { let sbid = this.getForm('base').getValue('sbid'); if (!sbid) { this.alert('请先选择商户'); return false; } if (!e.searchParam) { e.searchParam = {}; } e.searchParam.sbid = sbid; return true; }, ppcodeSetDataBefore(e) { this.getForm('base').setValue('mcid',''); this.getForm('base').setValue('mcid_name',''); this.getForm('base').setValue('ppcode_name', ''); if (e.data && e.data.length > 0) { this.getForm('base').setValue('ppcode_name', e.data[0].ppcode_name); this.getForm('base').setValue('mcid', e.data[0].ppmcid); this.getForm('base').setValue('mcid_name', e.data[0].ppmcid_name); } return true; }, mcidSearchBefore(e) { let ppcode = this.getForm('base').getValue('ppcode'); if (!ppcode) { this.alert('请先选择品牌'); return false; } if (!e.searchParam) { e.searchParam = {}; } e.searchParam.ppcode = ppcode; return true; }, onFromSdateChange (e) { if (e.value && e.form.cmlapdate) { let form = Object.assign({},e.form); let sdate = e.value; let edate = e.form.cmlapdate.substring(0,10); form.cmeffdate = e.value; if (!this.onCommonFromData(sdate, edate, form)) { return false; } if (!this.checkBcontmanaframeSpidDataCross(form)) { return false; } } return true; }, onFromEdateChange(e) { if (e.value && e.form.cmeffdate) { let form = Object.assign({},e.form); let sdate = e.form.cmeffdate.substring(0,10); let edate = e.value; form.cmlapdate = e.value; if (!this.onCommonFromData(sdate, edate, form)) { return false; } if (!this.checkBcontmanaframeSpidDataCross(form)) { return false; } } return true; }, checkBcontmanaframeSpidDataCross(form) { let temp = {}; let bcontmanaframeData = this.getDetail('bcontmanaframe').getData(); if (form.cmeffdate && form.cmlapdate && bcontmanaframeData.length > 0) { let cmeffdate = form.cmeffdate.substring(0,10); let cmlapdate = form.cmlapdate.substring(0,10); let contno = form.contno; let searchParam = { spids: bcontmanaframeData, cmsdate: cmeffdate, cmedate: cmlapdate }; if (contno) { searchParam.contno = contno; } let _self = this; _self.synchroPost(_self.OmdUrl.mall, 'mall.work.contevent.searchEffSpContBySpids', searchParam, function (data) { if (data && data.contno) { temp = data; } }, null); if (temp.contno) { this.alert('此合同商铺[' + temp.spid + ']的有效日期与合同[' + temp.contno + ']中商铺有效日期存在交叉,请重新输入商铺!'); return false; } } return true; }, onCommonFromData(sdate, edate, form) { if (sdate > edate) { this.alert('失效日期不能小于生效日期'); return false; } if (form.retreatdate) { let retreatdate = form.retreatdate.substring(0,10); if (retreatdate > edate) { this.alert('失效日期不能小于撤场日期'); return false; } if (retreatdate < sdate) { this.alert('生效日期不能大于撤场日期'); return false; } } let para = this.getAllMinMaxDate(); if (JSON.stringify(para) !== '{}') { if (sdate > para.sdate) { this.alert('生效日期不能大于' + para.sname + '的第' + para.snum + '行的开始日期(' + para.sdate + ')'); return false; } if (edate < para.edate) { this.alert('失效日期不能小于' + para.ename + '的第' + para.enum + '行的结束日期(' + para.edate + ')'); return false; } } let mm = this.getMonthNumber(sdate, edate); if (this.expirysdatename && this.expirysdatename !== 'cmlapdate') { if (form[this.expirysdatename]) { sdate = form[this.expirysdatename].substring(0,10); mm = this.getMonthNumber(sdate, edate); } } this.$nextTick(() => { this.getForm('base').setValue('signmons', mm); }); return true; }, onDeliverydateChange(e) { if (this.expirysdatename === 'deliverydate') { let sdate = e.value; let edate = ''; if (e.form['cmlapdate']) { edate = e.form['cmlapdate'].substring(0,10); let mm = this.getMonthNumber(sdate, edate); this.$nextTick(() => { this.getForm('base').setValue('signmons', mm); }); } } return true; }, /** 商铺信息 */ checkBcontmanaframe() { let data = this.getDetail('bcontmanaframe').getData(); if (data.length === 0 || !data[0].spid) { this.alert('请先添加' + this.getDetailTitle('bcontmanaframe')); return false; } return true; }, bcontmanaframeAddRowBefore() { let flag = this.$refs.layout.getForm().checkValidate(); if (flag) { this.alert('请输入必填项'); return false; } let row = {}; row = this.AddRowBeforeBase(row); return row; }, /** 新增明细前默认基本信息 */ AddRowBeforeBase(row) { let newrow = Object.assign({},row); newrow.muid = this.getForm('base').getValue('muid'); newrow.contno = this.getForm('base').getValue('contno'); newrow.modflag = 'I'; return newrow; }, /** 新增明细前默认商铺信息 */ AddRowBeforeSpid(row) { let newrow = Obj