涂煌豪
2022-04-08 c40d6d0f9aba576bf9af5961db86cde85c8ca566
force-app/main/default/pages/SelectAssetEstimateVM.page
@@ -57,7 +57,17 @@
            return false;  
        }
    }
        return true;
    // 先款后修-提交报价时如果是先款对象进行提示 thh 20220408 start
    var FirstParagraphEnd = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
    if(FirstParagraphEnd){
        if (confirm('本次签约经销商是先款对象,请确认是否提交报价?')) {
         return true;
        }else{
            return false;
        }
    }
    // 先款后修-提交报价时如果是先款对象进行提示 thh 20220408 end
    return true;
}
//add by gwy 2021-01-27 end 提交时的提示框
@@ -134,6 +144,7 @@
        var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
        if (target != '医院') {
            j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).attr("disabled", true);
            j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd')).attr("disabled", true);
        }
    }
    if ('{!DecideBtnDisabled}' == 'false') {
@@ -266,8 +277,16 @@
function checkAll(checker) {
    var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val();
    for (var i = 0; i < cnt; i++) {
        if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
        //2021-11-30 fy add LJPH-C8W8FV 置顶 start
        //if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
        //    continue;
        //}else{
        //    document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked;
        //}
        //2021-11-30 fy add LJPH-C8W8FV 置顶 end
    if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
            break;
        }
        document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked;
@@ -325,42 +344,8 @@
    refreshAsset(cnt);
}
function checkContractEstiStartDate(val, cnt) {
    if (val == null || val == "") {
        return;
    }
    for (var i = 0; i < cnt; i++) {
        var instaldate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':InstallDate')).text();
        if (instaldate != null && instaldate != '') {
            var listprice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
            var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
            if (isnew == "true") {
                listprice = listprice / {!isNewPriceAdj};
            }
            var startdate = new Date(val);
            startdate.setMonth(startdate.getMonth() + isNewAddMonth);
            instaldate = new Date(instaldate);
            if (startdate < instaldate) {
                listprice = listprice * {!isNewPriceAdj};
                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice));
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',true);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('true');
            } else {
                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice));
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',false);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('false');
            }
        }
    }
    refreshAsset(cnt);
}
function refreshAsset(cnt) {
    // alert(cnt);
    // 提交后就页面不计算了
    var isDisabled = {!PageDisabled};
    // 合同总理
@@ -458,7 +443,7 @@
                    }
                    //最后结束日+1年
                    lastendDate.setMonth(lastendDate.getMonth() + 12);
                    if (Date.parse(contractStartDate) > Date.parse(lastendDate)) {
                    if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) {
                        oyearCount ++;
                    }
                    // 取联动价格
@@ -544,7 +529,7 @@
            } else {
                strMoney = month * strMoney + month2 * strMoney;
            }
            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
            var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
            if(b != ''){
                conCCount ++;
@@ -769,13 +754,16 @@
function resetDealer() {
    var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
    var obj = document.getElementById('allPage:allForm:allBlock:contract:dealer');
    var obj2 = document.getElementById('allPage:allForm:allBlock:contract:FirstParagraphEnd');
    var obj_lkwgt = document.getElementById('allPage:allForm:allBlock:contract:dealer_lkwgt');
    if (target == '医院') {
        obj.style.display = "none";
        obj2.style.display = "none";
        obj_lkwgt.style.display = "none";
    } else {
        obj.style.display = "block";
        obj_lkwgt.style.display = "block";
        obj2.style.display = "block";
    }
}
@@ -1177,7 +1165,86 @@
        alert('合同期最长只能选择60个月!');
        return 0;
    }
}
    //获取经销商的先款标识
    function onChDealerUpdateJs(oBj){
        //获取 报价提交对象  是否为经销商
        var estimateTarget = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget'))[0].value;
        if(estimateTarget == '经销商'){
            //判断经销商名是否为空
            var dealerValue = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).val();
            if(dealerValue != ''){
                //获取经销商名的id
                var dealerId = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer_lkid')).val();
                //由于salesforce的查找字段是可以输入的,所以判断他如果为空或者为 000000000000000 的时候,传的参数就位经销商中文名,其他情况传id
                if(dealerId != '' && dealerId != '000000000000000'){
                    onChDealerUpdate(dealerId);
                }else{
                    onChDealerUpdate(dealerValue);
                }
            }else{
                onChDealerUpdate('');
                //j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked = false;
            }
        }
    }
    //如果选择的经销商为先款对象,那么做一下提示
    function hintAccount(){
        var xkChecked = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
        if(xkChecked){
            alert('请注意,当前经销商为先款对象。');
        }
    }
//LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  start
//合同开始日预定日默认为上期合同1结束日的第2天
// function DefaultStartDate(){
//     //上期合同1结束日
//     var LastContractEndDate;
//     var LastContractEndDate2;  //日期格式
//     var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val();
//     for (var i = 0; i < cnt; i++){
//         LastContractEndDate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value();
//          //或者换隐藏标签Maintenance_Contract__r.Past_Contract_end_day__c
//         LastContractEndDate2 = LastContractEndDate;
//         if(LastContractEndDate != null && LastContractEndDate != ''){
//             break;
//         }
//     }
//     if(LastContractEndDate != null && LastContractEndDate != ''){
//         //上期合同1结束日的第2天
//         LastContractEndDate += " 00:00:00";//设置为当天凌晨12点
//         LastContractEndDate = Date.parse(new Date(LastContractEndDate))/1000;//转换为时间戳
//         LastContractEndDate += (86400) * 1;//修改后的时间戳
//         var newDate = new Date(parseInt(LastContractEndDate) * 1000);//转换为时间
//         var LastContractEndDate1 = newDate.getFullYear() + '/' + (newDate.getMonth() + 1) + '/' + newDate.getDate();;
//         //获取当前日期(currentdate)
//         var date1 = new Date();
//         var seperator = "/";
//         var year = date1.getFullYear();
//         var month = date1.getMonth() + 1;
//         var day = date1.getDate();
//         if (month >= 1 && month <= 9) {
//             month = "0" + month;
//         }
//         if (day >= 0 && day <= 9) {
//             day = "0" + day;
//         }
//         var currentdate = year + seperator + month + seperator + day;
//         //上期合同尚未结束 , 开始预定日
//         if(currentdate < LastContractEndDate2){
//             document.getElementById("allPage:allForm:allBlock:contract:startdate").value = LastContractEndDate1;
//         }
//     }
// }
//LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  end
</script>
<apex:form id="allForm">
    <apex:inputHidden id="alertStringValue" value="{!alertString}" />
@@ -1197,6 +1264,10 @@
    <apex:actionFunction name="decide" action="{!decide}" rerender="allForm" oncomplete="unblockUI();"/>
    <apex:actionFunction name="decideCancle" action="{!decideCancle}" rerender="allForm" oncomplete="unblockUI();"/>
    <apex:inputHidden id="oldDecideContractDate" value="{!OldContractStartDate}" />
    <!-- 经销商发生变化的change时间 -->
    <apex:actionFunction name="onChDealerUpdate" action="{!onChDealerUpdate}" rerender="contract" onComplete="hintAccount();">
        <apex:param name="checkDealerId" assignTo="{!checkDealerId}" value="" />
    </apex:actionFunction>
    <input type="hidden" id="oldContractDate" value="{!estimate.Contract_Start_Date__c}" />
<script type="text/javascript">
//j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('false');
@@ -1311,10 +1382,10 @@
                    </td>
                    <td> </td>
                </tr>
            </table>
            </apex:outputPanel>
        <apex:outputPanel >
        <table align="center" width="100%"  style="border-collapse:separate; border-spacing:0px 10px" >
            <tr>    
                <td width="50%" align="right"> <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">合同询价编码</label> </td>
@@ -1350,9 +1421,15 @@
  
                <td  width="50%" align="right">  
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 经销商名</label></td>
                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" /> </td>
            <!-- update     wangweipeng             2021/12/04         start -->
                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" onchange="onChDealerUpdateJs(this);return false;" style="float: left;"/> </td>
            </tr>
            <tr>
                <td  width="50%" align="right">
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 先款标识(经销商)</label></td>
                <td width="50%" align="left" > <apex:inputCheckbox value="{!estimate.Is_RecognitionModel__c}" id="FirstParagraphEnd" onClick="return false;" /> </td>
            </tr>
            <!-- update     wangweipeng             2021/12/04         end -->
        </table>
        <script type="text/javascript">
            j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).children('option[value=]').remove();
@@ -1513,38 +1590,6 @@
                                    <!-- 20200103 Gzw 计算实际报价金额 end -->
                                </td>
                                <!-- 实绩联动价格计算 end -->
                                <!-- 隐藏合同月数
                                <td class="dataCell" width="90px" style="text-align:right" >
                                    <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_Range__c}" rendered="{!Not(ar.IsManual)}" id="lastContRange" />
                                </td>-->
                                <!-- <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.Asset_Owner__c}" rendered="{!Not(ar.IsManual)}" />
                                </td>
                                <td class="dataCell" width="90px" style="text-align:right" >
                                    <apex:outputField value="{!ar.rec.Accumulation_Repair_Amount__c}" rendered="{!Not(ar.IsManual)}" />
                                </td> -->
                                <!--<td class="dataCell" width="90px" style="text-align:right" >-->
                                    <!-- 隐藏服务合同价格
                                    <apex:outputText value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPrice" style="padding-right:3px;" />
                                    <apex:outputPanel layout="none" rendered="{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.createable}" >
                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPriceHidden"/>
                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price_Page__c}" id="assetListPricePageHidden" />
                                    </apex:outputPanel>
                                    <apex:outputPanel layout="none" rendered="{!Not($ObjectType.Maintenance_Contract_Asset_Estimate__c.createable)}" >
                                        <input type="hidden" value="{!ar.mcae.Estimate_List_Price__c}" id="allPage:allForm:allBlock:assetSection:assetTable:{!Text(cnt-1)}:assetListPriceHidden"/>
                                    </apex:outputPanel>-->
                                <!--</td>-->
                                <!--<td>
                                    <apex:outputText value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXT" />
                                    <apex:inputHidden value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXTHidden" />
                                </td>-->
                                <td class="dataCell" width="70px" style="text-align:right" >
                                    <apex:inputField value="{!ar.mcae.Repair_Price__c}" id="repairPrice" style="ime-mode: disabled; width:95%; text-align:right;" onchange="refreshAsset({!productCount});"/>
                                </td>
@@ -1552,6 +1597,13 @@
                                    <apex:inputField value="{!ar.mcae.Comment__c}" id="comment" style="width:95%;"/>
                                </td>
                            </tr>
                            <!-- LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  start  -->
                            <!-- <script>
                                DefaultStartDate();
                            </script> -->
                            <!-- LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  end  -->
                            <apex:variable value="{!cnt + 1}" var="cnt" />
                        </apex:repeat>