buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/pages/SetPersonalTarget.page
@@ -1,11 +1,22 @@
<apex:page id="Page" showHeader="false" sidebar="false" Controller="SetPersonalTargetController" action="{!init}">
<apex:page id="Page" showHeader="false" sidebar="false" Controller="SetPersonalTargetController" action="{!init}" lightningStylesheets="true">
<head>
<title>部门担当者目标设定(医院担当)</title>
    
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.jqueryTableFix)}"/>
<!-- <apex:includeScript value="{!URLFOR($Resource.jqueryTableFix)}"/> -->
<style>
    body input[type="text"], .slds-vf-scope input[type="text"] {
        padding: 0;
    }
    table > tbody > tr > th, .slds-vf-scope .listViewport table > tr > td, .slds-vf-scope .listViewport table > tr > th {
        padding: .2rem;
    }
    #Page\:Form\:editBlock > div.pbBody {
        height: 400px;
    }
</style>
<script type="text/javascript">
//CHAN-BDQBLX  20210125 you start 
@@ -77,12 +88,15 @@
        datarows -= 2;
    }
    var allSum = 0;
    var cols = [0, 0, 0, 0, 0, 0, 0, 0];
    //DB202303443108 20230407 you start 增加一个0
    var cols = [0, 0, 0, 0, 0, 0, 0, 0, 0];
    //DB202303443108 20230407 you start
    // 行
    for (var i = 0; i < datarows; i++) {
        var rowSum = 0;
        // 列
        for (var j = 0; j < 8; j++) {
        //DB202303443108 20230407 you start  8改成9 因为变成了9列
        for (var j = 0; j < 9; j++) {
            var amount = 0;
            
            var raw = j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + i + ':amountRepeat:' + j + ':inAmountValue')).value();
@@ -96,7 +110,7 @@
        j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + i + ':totalrow')).text(toNumComma(rowSum));
    }
    // 列
    for (var j = 0; j < 8; j++) {
    for (var j = 0; j < 9; j++) {
        j$(escapeVfId('totalcol' + j)).text(toNumComma(cols[j]));
    }
    // 総計
@@ -155,6 +169,15 @@
    } else {
        prev(false);
    }
}
function checkOwner(val, id, rownum) {
    // changeFlgセット
    j$(escapeVfId('Page:Form:dataBlock:changeFlg')).val(1);
    var ids = id.split(":");
    var isChangedid = ids[0] + ":" + ids[1] + ":" + ids[2] + ":" + ids[3] + ":" + ids[4] + ":isChanged";
    console.log('zheli:'+isChangedid);
    j$(escapeVfId(isChangedid)).val("1");
    j$(escapeVfId(id))[0].style.background="#FFFF33";
}
function searchByDptJs() {
@@ -259,7 +282,7 @@
    <apex:outputPanel id="MessageP">
        <apex:pagemessages />
    </apex:outputPanel>
<font style="font-size:15px;font-weight:700;">录入担当者各自的目标&nbsp;(注:请输入含税金额)</font>
<font style="font-size:15px;font-weight:700;">录入担当者各自的目标 (注:请输入含税金额)</font>
    <!--CHAN-BDQBLX  20210125 you start -->
     <apex:actionFunction name="exportcsv" action="{!exportBycsv}"/>
     <apex:actionFunction name="passToController" action="{!importCSVFile}" rerender="Form, MessageP" oncomplete="unblockUI();">
@@ -290,7 +313,7 @@
            <apex:outputPanel id="popupBox" layout="block">
                <input type="file" id="file_input" name="attFile" accept=".csv" /><br/>
                <center>
                    <apex:commandButton value="确认" onclick="remoteLocationPost(); return false;" style="width: 20%; margin: 20px 10px 0px 10px" />
                    <apex:commandButton value="确认" onclick="remoteLocationPost(); return false;" style="width: 20%;"/>
                    <apex:commandButton value="取消" onclick="popupBox.hide();" style="width: 20%; margin: 20px 10px 0px 10px" />
                </center>
            </apex:outputPanel>
@@ -301,13 +324,16 @@
        <table id="ConditionTable" border="0" width="100%">
            <tr>
                <!-- <apex:outputPanel rendered="{!loginUser.ProfileId == $Label.ProfileId_SystemAdmin}" layout="none"> -->
                <td width="170">本部&nbsp;<apex:selectList id="accTypeOptsId" value="{!salesDpt}" size="1" style="width:120px;" disabled="{!!(loginUser.ProfileId == $Label.ProfileId_SystemAdmin || loginUser.ProfileId == $Label.ProfileId_103 || loginUser.ProfileId == $Label.ProfileId_2s6dashboard )}" onchange="searchByDptJs();return false;"><apex:selectOptions value="{!salesDptOpts}" />
                     <!--<apex:inputHidden id="salesDptOpts1" value="{!salesDptOpts}" />-->
                <!--DB202303443108 20230410 you start-->
                <td width="170">本部 <apex:selectList id="accTypeOptsId" value="{!salesDpt}" size="1" style="width:120px;" disabled="{!!(loginUser.ProfileId == $Label.ProfileId_SystemAdmin || loginUser.ProfileId == $Label.ProfileId_103 || loginUser.ProfileId == $Label.ProfileId_2s6dashboard )}" onchange="searchByDptJs();return false;"><apex:selectOptions value="{!salesDptOpts}" />
                        <!--<apex:inputHidden id="salesDptOpts1" value="{!salesDptOpts}" />-->
                </apex:selectList>
                 
                </td>
                <!-- </apex:outputPanel> -->
                <td width="179">省&nbsp;<apex:inputField id="province" value="{!loginUser.Province__c}" style="width:140px;" onchange="searchByProvinceJs();return false;"></apex:inputField>
                <!--DB202303443108 20230410 you end -->
                <td width="179">省 <apex:inputField id="province" value="{!loginUser.Province__c}" style="width:140px;" onchange="searchByProvinceJs();return false;"></apex:inputField>
                <script type="text/javascript">
                    var isadmin = {!(loginUser.ProfileId == $Label.ProfileId_SystemAdmin || loginUser.ProfileId == $Label.ProfileId_103 || loginUser.ProfileId == $Label.ProfileId_2s6dashboard)};
                    if (!isadmin) {
@@ -315,19 +341,21 @@
                    }
                </script>
                </td>
                <td width="300">
                    职种&nbsp;<apex:selectList id="jobCategory" value="{!loginUser.Job_Category__c}" size="1" style="width:80px;" onchange="searchByFilterJs();return false;">
                <td width="350">
                    <!--DB202303443108 20230407 you start-->
                    SFDC职种 <apex:selectList id="jobCategory" value="{!loginUser.SFDCPosition_C__c}" size="1" style="width:80px;" onchange="searchByFilterJs();return false;">
                        <apex:selectOptions value="{!userJobCategorys}"/>
                    </apex:selectList>&nbsp;&nbsp;&nbsp;
                    医院担当&nbsp;
                    </apex:selectList>
                    <!--DB202303443108 20230407 you end-->
                    医院担当
                    <apex:selectList value="{!productUser}" id="productUserid" size="1" style="width:100px;" onchange="searchByFilterJs();return false;">
                        <apex:selectOptions value="{!productUserOptions}"/>
                    </apex:selectList>&nbsp;&nbsp;&nbsp;
                    </apex:selectList>
                </td>
                <td width="60"><apex:inputCheckBox id="checkAll" value="{!checkAll}" onchange="checkAll(this);return false;"/><apex:outputLabel value="全选" for="checkAll"/></td>
                <td width="60"><apex:inputCheckBox id="checkAll" value="{!checkAll}" onchange="checkAll(this);return false;" selected="true"/><apex:outputLabel value="全选" for="checkAll"/></td>
                <td>
                    <apex:repeat value="{!plist}" var="p" id="postRepeat">
                        <apex:inputCheckBox value="{!p.check}" id="post" onchange="searchByFilterJs();return false;"/><apex:outputLabel value="{!p.positionName}" for="post"/>&nbsp;&nbsp;&nbsp;
                        <apex:inputCheckBox value="{!p.check}" id="post" onchange="searchByFilterJs();return false;"/><apex:outputLabel value="{!p.positionName}" for="post"/>
                    </apex:repeat>
                </td>
                <!-- 20220613 WLIG-CER9NQ you 页面中拿掉改成batch执行
@@ -337,11 +365,11 @@
                </td>
               -->
                <!--CHAN-BDQBLX  20210125 you start -->
                <td width="80">
                <td width="108">
                    <apex:commandbutton onclick="exportJs();return false;" id="export" value="导出数据模板">
                </apex:commandbutton>
                </td>
                 <td width="40">
                 <td width="60">
                    <apex:commandButton onclick="openPopupCSV(); return false;" value="导入" rerender="Form"/>
                </td>
                <!--CHAN-BDQBLX  20210125 you end -->
@@ -373,21 +401,25 @@
        <!-- バック側にパラメータを増やしたくないため、1になれないパラメータを入れます -->
        <!-- ここの値は1かどうかの判断のみで使います -->
        <apex:inputHidden id="changeFlg" value="{!saveFlg}"/>
        <table class="list" style="border-bottom-width: 0px;" border="0" cellspacing="0" cellpadding="0" id="MainTable">
        <table class="list" style="border-bottom-width: 0px;width:100%;" border="0" cellspacing="0" cellpadding="0" id="MainTable">
            <thead>
                <tr class="headerRow">
                    <th width="70px" class="headerRow  booleanColumn">本部</th>
                    <th width="70px" class="headerRow  booleanColumn">省</th>
                    <th class="headerRow  booleanColumn">角色</th>
                    <th width="70px" class="headerRow  booleanColumn">担当</th>
                    <th width="70px" class="headerRow  booleanColumn" style="min-width: 70px;">本部</th>
                    <th width="70px" class="headerRow  booleanColumn" style="min-width: 70px;">省</th>
                    <!--<th class="headerRow  booleanColumn">角色</th>-->
                    <th width="70px" class="headerRow  booleanColumn" style="min-width: 70px;">担当</th>
                    <th width="70px" class="headerRow  booleanColumn">HR通用职级</th>  <!-- 20220517 lt SWAG-CD28H3 Update -->
                    <th width="70px" class="headerRow  booleanColumn">负责<br/>产品分类(主)</th>
                    <!--wangweipeng  20210615-->
                    <th width="70px" class="headerRow  booleanColumn">负责<br/>产品分类(兼)</th>
                    <th width="70px" class="headerRow  booleanColumn" style="min-width: 70px;">目标类型</th>
                    <apex:repeat value="{!opportunity_category}" var="oc" id="opportunityCategoryRepeat">
                        <th width="75px" class="headerRow  booleanColumn"><apex:outputText id="categoryValue" value="{!oc}"></apex:outputText></th>
                    </apex:repeat>
                    <th width="85" class="headerRow  booleanColumn" style="background-color:#AAAACC;">合计</th>
                    <!-- 20230510 ljh start -->
                    <th width="70px" class="headerRow  booleanColumn"  style="min-width: 70px;">备注</th>
                    <!-- 20230510 ljh end -->
                </tr>
            </thead>
            <tbody>
@@ -395,10 +427,11 @@
                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" bgcolor="#AAAACC">
                    <td class="dataCell"></td>
                    <td class="dataCell"></td>
                    <td class="dataCell"></td>
                    <!--暂时隐藏<td class="dataCell"></td>-->
                    <td class="dataCell"></td>
                    <td class="dataCell"></td>
                    <!--wangweipeng  20210615-->
                    <td class="dataCell"></td>
                    <td class="dataCell"></td>
                    <td class="dataCell" style="text-align:center;">合计</td>
                    <td class="dataCell" style="text-align:right;" id="totalcol0"></td>
@@ -409,22 +442,38 @@
                    <td class="dataCell" style="text-align:right;" id="totalcol5"></td>
                    <td class="dataCell" style="text-align:right;" id="totalcol6"></td>
                    <td class="dataCell" style="text-align:right;" id="totalcol7"></td>
                    <!--DB202303443108 20230407 you start-->
                    <td class="dataCell" style="text-align:right;" id="totalcol8"></td>
                    <!--DB202303443108 20230407 you end-->
                    <td class="dataCell" style="text-align:right;" id="totalAll"></td>
                    <!-- 20230510 ljh start -->
                    <td class="dataCell" style="text-align:right;" id="totalcol9"></td>
                    <!-- 20230510 ljh end -->
                </tr>
                <apex:repeat value="{!dataBeans}" var="dbs" id="dbRepeat">
                    <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}">
                        <td class="dataCell">{!dbs.user.Salesdepartment__c}</td>
                        <td class="dataCell">{!dbs.user.Salesdepartment__c}<!--{!dbs.user.Dept__c}--></td>
                        <td class="dataCell">{!dbs.user.Province__c}</td>
                        <td class="dataCell">{!dbs.user.UserRole.Name}</td>
                        <!--暂时隐藏<td class="dataCell">{!dbs.user.UserRole.Name}</td>-->
                        <td class="dataCell">{!dbs.user.Alias}</td>
                        <td class="dataCell">{!dbs.user.HR_Post__c}</td> <!-- 20220517 lt SWAG-CD28H3 Update -->
                        <td class="dataCell" style="word-wrap:break-word;max-width:70px;">{!SUBSTITUTE(dbs.user.Product_specialist_incharge_product__c, ";", "; ")}</td>
                        <td class="dataCell" style="word-wrap:break-word;">{!SUBSTITUTE(dbs.user.Product_specialist_incharge_product__c, ";", "; ")}</td>
                        <!--wangweipeng  20210615-->
                        <td class="dataCell" style="word-wrap:break-word;max-width:70px;">{!SUBSTITUTE(dbs.user.Responsible_for_Products_Concurrently__c, ";", "; ")}</td>
                        <td class="dataCell" style="word-wrap:break-word;">{!SUBSTITUTE(dbs.user.Responsible_for_Products_Concurrently__c, ";", "; ")}</td>
                         <td class="dataCell"> <apex:inputField id="inTargetType" value="{!dbs.opportunity.TargetType__c}" style="width:100%;text-align:left;" onchange="checkOwner(this.value, this.id, {!cnt});"></apex:inputField>
                                <script type="text/javascript">
                                    var ispast = {!isPast};
                                    if (ispast) {
                                        j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + {!cnt-1} + ':inTargetType')).attr("disabled",true);
                                    }
                                    //j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + {!cnt-1} + ':inTargetType')).val('个人');
                                </script>
                        </td>
                        <apex:variable value="{!1}" var="cnt2" />
                        <apex:repeat value="{!dbs.amount}" var="amount" id="amountRepeat">
                            <td class="dataCell" style="text-align:right;">
                                <apex:inputField id="inAmountValue" value="{!amount.Amount}" style="width:92%; text-align:right;" onchange="checkMoney(this.value, this.id);"></apex:inputField>
                                <apex:inputField id="inAmountValue" value="{!amount.Amount}" style="width:100%; text-align:right;" onchange="checkMoney(this.value, this.id);"></apex:inputField>
                                <script type="text/javascript">
                                    var ispast = {!isPast};
                                    if (ispast) {
@@ -435,11 +484,23 @@
                            <apex:variable value="{!cnt2 + 1}" var="cnt2" />
                        </apex:repeat>
                        <td class="dataCell" style="text-align:right; background-color:#AAAACC;">
                            <apex:outputText id="totalrow" style="width:92%;" value="{0,number,#,##0.00}">
                            <apex:outputText id="totalrow" style="width:100%;" value="{0,number,#,##0.00}">
                                <apex:param value="" />
                            </apex:outputText>
                            <apex:inputHidden id="isChanged" value="{!dbs.isChanged}"/>
                        </td>
                        <!-- 20230510 ljh start -->
                        <td class="dataCell" style="word-wrap:break-word;">
                        <apex:inputField id="inRemarks" value="{!dbs.opportunity.remarks__c}" style="width:100%;text-alig:left;" onchange="checkOwner(this.value, this.id, {!cnt});"  onkeyup="if(value.length>15)value=value.slice(0,15)"/>
                            <script type="text/javascript">
                                var ispast = {!isPast};
                                if (ispast) {
                                    j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + {!cnt-1} + ':inRemarks')).attr("disabled",true);
                                }
                            </script>
                        <!-- 春眠不觉晓处处闻啼鸟夜来风雨声 -->
                        </td>
                        <!-- 20230510 ljh end -->
                    </tr>
                    <apex:variable value="{!cnt + 1}" var="cnt" />
                </apex:repeat>
@@ -447,10 +508,12 @@
        </table>
<script type="text/javascript">
j$(function() {
    var blockHeight = j$(window).innerHeight() - j$(escapeVfId('Page:Form:headBlock')).height() - 60;
    j$(escapeVfId('MainTable')).tablefix({height: blockHeight, fixRows: 2, fixCols: 0});
    // var blockHeight = j$(window).innerHeight() - j$(escapeVfId('Page:Form:headBlock')).height() - 60;
    // j$(escapeVfId('MainTable')).tablefix({height: blockHeight, fixRows: 2, fixCols: 0});
});
calc();
</script>
    </apex:pageBlock>
</apex:form>