buli
2022-04-06 2d4a8d2dcad5a17127d2c73c48ddc4b67ec79448
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<apex:page controller="BmeWorkController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
<head>
<title>BME工作跟进</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.BmeWorkJs)}"/>
 
<!-- 20220222 PI改造 by Bright--start -->
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
<!-- 20220222 PI改造 by Bright--end -->
 
<style>
    td .dateFormat  {
        display: none;
    }
    div.inline { float:left; }
    .clearBoth { clear:both; }
div.reportBlock table.list {
  width:auto;
}
div#out_Div { /* ここにヘッダを格納 */
  position:relative;
  overflow: hidden;
  float:left;
  width:0%;
}
div#out_Div_L {
  position:relative;
  overflow:hidden;
  float:left;
  width:99%;
}
div#in_Div {/* tbodyが入っている。ここがスクロール対象*/
  position:relative;
  overflow: auto;  /*スクロールバー*/
  float:left;
  width:0%;
  height: 500px; /* tbodyを表示する高さ、後でjsにて調整 */
}
div#in_Div_L {
  position:relative;
  overflow:auto;
  float:left;
  width:100%;
  height: 600px;
}
body .pbBody table.list tr.headerRow td {
  box-sizing: border-box;
  text-align:center;font-weight:normal;
  padding:0px 0px 0px 1px;
}
body .pbBody table.list tr.headerRow td.header1 {
  text-align:center;font-weight:normal;
  padding:0px 0px 0px 0px;
}
body .pbBody table.list tr.dataRow td {
  box-sizing: border-box;
  padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
}
body .pbBody table.list tr.dataRow td.dataCellBorder  {
  /* いらない、使っていない */
  padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
}
body .pbBody table.list tr.dataRow td.dataCellBorder1 {
  padding:0px 0px 0px 1px;
  border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;
}
@-moz-document url-prefix() {
body .pbBody table.list tr.dataRow td.dataCellBorder1 {padding:0px 0px 0px 0px; border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;}
}
table.list td {width:170px; }
table.list td select {width:95%;}
table.list td input {width:95%;}
table.list td textarea {
  height:50px;
  width:90%;
}
body .pbBody table.list tr.headerRow td.colViewing {
  /* デフォルト値、最小化アイコンを表示 */
  background-image:url('{!URLFOR($Resource.IconResizeMinus_5)}') ;
  background-repeat:no-repeat;
}
body .pbBody table.list tr.headerRow td.colUnHideIcon {
  /* 最大化アイコンを表示 */
  background-image:url('{!URLFOR($Resource.IconResizePlus_5)}');
  background-repeat:no-repeat;
}
body .pbBody table.list tr.headerRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
body .pbBody table.list tr.dataRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
 
.decrypt{position: absolute;top: 0;left: 100%;display: none;text-align: left;
    padding-left: 5px;}
a:hover .decrypt{display: block;width: 100px}
 
</style>
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
function setChangeFlgRight(cnt) {
    document.getElementById('allPage:allForm:oppBlock:oppTable:' + cnt + ':changeFlgRt').value = 1;
}
function setChangeFlg(cnt) {
    document.getElementById('allPage:allForm:oppBlock:oppTable:' + cnt + ':changeFlg').value = 1;
}
</script>
</head>
    <apex:form id="allForm">
        <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allPanel" oncomplete="afterSaveAndSearch();">
             <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
         <apex:actionFunction name="saveAndSort" action="{!save}" rerender="allPanel" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
            <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="searchOpp" action="{!chick}" rerender="allPanel" oncomplete="afterSearchOpp();"/>
        <apex:actionFunction name="sortTable" action="{!sortTable}" rerender="allPanel" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <table style="border-bottom-width: 0px; font-size:12px;">
                    <tr>
                        <td width="150px">
                            <apex:commandButton onclick="blockme()" oncomplete="unblockUI();" action="{!save}" value="保存"  style="height:30px;width:50px;"/>&nbsp;&nbsp;
                            <apex:commandButton value="检索" onclick="NewSearch();return false;" style="height:30px;width:70px;"/>
                        </td>
                        <td width="1000px">
                            <apex:pageMessages />
                        </td>
                    </tr>
                </table>
                <table style="border-bottom-width: 0px; font-size:12px;">
                  <tr>
                      <td width="200px">
                            <font>数&nbsp;据&nbsp;字&nbsp;段&nbsp;</font>&nbsp;
                            <apex:selectList value="{!numtextA1}" size="1" style="width:110px"><apex:selectOptions value="{!textOpts}"/></apex:selectList>
                        </td>
                        <td width="130px">
                            <apex:selectList value="{!numtextA2}" size="1" style="width:110px"><apex:selectOptions value="{!firstOpts}"/></apex:selectList>
                        </td>
                         <td width="200px">
                          <apex:inputText style="width:150px" value="{!numtextA}"/>
                        </td>
                        <td width="200px">
                            <font>数&nbsp;据&nbsp;字&nbsp;段&nbsp;</font>&nbsp;
                            <apex:selectList value="{!numtextB1}" size="1" style="width:110px"><apex:selectOptions value="{!textOpts01}"/></apex:selectList>
                        </td>
                        <td width="130px">  
                            <apex:selectList value="{!numtextB2}" size="1" style="width:110px"><apex:selectOptions value="{!equalOpts}"/></apex:selectList>
                        </td>
                         <td width="200px">
                          <apex:inputText style="width:150px" value="{!numtextB}"/>
                        </td>
                    </tr>
                    <tr>
                      <td width="200px">
                            <font>数&nbsp;据&nbsp;字&nbsp;段&nbsp;</font>&nbsp;
                            <apex:selectList value="{!numtextC1}" size="1" style="width:110px"><apex:selectOptions value="{!textOpts02}"/></apex:selectList>
                        </td>
                        <td width="130px">  
                            <apex:selectList value="{!numtextC2}" size="1" style="width:110px"><apex:selectOptions value="{!equalOpts2}"/></apex:selectList>
                        </td>
                         <td width="200px">
                          <apex:inputHidden id="AwsDataIds" value="{!AwsDataIds}"/>
                          <apex:inputText id="numtextC" style="width:150px" value="{!numtextC}"/>
                        </td>
                        <td width="200px">
                            <font>数&nbsp;据&nbsp;字&nbsp;段&nbsp;</font>&nbsp;
                            <apex:selectList value="{!numtextD1}" size="1" style="width:110px"><apex:selectOptions value="{!textOpts03}"/></apex:selectList>
                        </td>
                        <td width="130px">
                            <apex:selectList value="{!numtextD2}" size="1" style="width:110px"><apex:selectOptions value="{!equalOpts}"/></apex:selectList>
                        </td>
                         <td width="200px">
                          <apex:inputText style="width:150px" value="{!numtextD}"/>
                        </td>
                        <td width="230px">显示&nbsp;
                          <apex:selectList value="{!limits}" size="1" onchange="NewSearch();return false;">
                          <apex:selectOptions value="{!limitOpts}"/></apex:selectList> 条数据
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
            <apex:pageBlock id="oppBlock" tabStyle="Report">
                <apex:outputPanel >
                    <apex:inputHidden id="oppCount" value="{!oppCount}"/>
                    <div id="out_Div_L">
                        <table class="list" style="border-bottom-width: 0px;   width:2000px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L">
                           <tr class="headerRow" height="30px">
                            <td/>
                            <td/>
                            <td/>
                            <td/>
                            <apex:variable value="{!0}" var="cnt" />
                            <apex:repeat value="{!titleRight}" var="t">
                             
                              <td style="background-color: antiquewhite; border-left-color: antiquewhite; border-right-color: antiquewhite;font-size: 18px;font-weight: 1000;">
                                 <apex:outputPanel rendered="{!IF(cnt == 3, 'true', 'false')}">
                                  每月填写
                                </apex:outputPanel>
                              </td>
                             <apex:variable value="{!cnt + 1}" var="cnt" />
                          </apex:repeat>
 
                          <apex:variable value="{!0}" var="cnt" />
                          <apex:repeat value="{!titleLeft}" var="t">
                            <td style="background-color: rgb(226,239,218); antiquewhite; border-left-color:  rgb(226,239,218); border-right-color:  rgb(226,239,218);font-size: 18px;font-weight: 1000;">
                                <apex:outputPanel rendered="{!IF(cnt == 1, 'true', 'false')}">
                                  每年填写
                                </apex:outputPanel>
                            </td>
                            <apex:variable value="{!cnt + 1}" var="cnt" />
                          </apex:repeat>
                           </tr>
                            <tr class="headerRow" height="30px">
                              <!-- 客户人员表****联系人字段****不更改 -->
                              <td><a href="#" onclick="sortTableJs_Account('{!0}');return false;" style="text-decoration: underline;">培训名称</a></td>
                              <td><a href="#" onclick="sortTableJs_Account('{!1}');return false;" style="text-decoration: underline;">培训主担当</a></td>
                              <td><a href="#" onclick="sortTableJs_Account('{!2}');return false;" style="text-decoration: underline;">访问人名</a></td>
                              <td><a href="#" onclick="sortTableJs_Account('{!3}');return false;" style="text-decoration: underline;">医院科室</a></td>
                              <!-- 周会会议管理表****每月填写****字段集 -->
                              <apex:variable value="{!0}" var="cnt" />
                              <apex:repeat value="{!titleRight}" var="t">
                                  <td style="background-color: antiquewhite;" >
                                         <apex:outputText value="{!t}" style="background-color: antiquewhite;"/>
                                   </td>
                                  <apex:variable value="{!cnt + 1}" var="cnt" />
                              </apex:repeat>
                              <!-- 周会会议管理表****每年填写****字段集 -->
                              <apex:variable value="{!4}" var="cnt" />
                              <apex:repeat value="{!titleLeft}" var="t">
                                  <td style="background-color: rgb(226,239,218);">
                                      <a href="#" onclick="sortTableJs_Account('{!cnt}');return false;" style="text-decoration: underline;">
                                        <apex:outputText value="{!t}" style="background-color: rgb(226,239,218);"/>
                                      </a>
                                  </td>
                                  <apex:variable value="{!cnt + 1}" var="cnt" />
                              </apex:repeat>
                            </tr>
                        </table>
                    </div>
                    <div style="clear:both;height:0px;"></div>
                    <div id="in_Div_L">
                        <table class="list" bgcolor="#00FF00" style="border-bottom-width: 0px;width:2000px; font-size:11px;border-spacing:0;" border="" id="tableData_L">
                          <apex:variable value="{!1}" var="cntA00" />
                            <apex:repeat value="{!oppRecords}" var="or" id="oppTable">
                              <!-- <tr> -->
                                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                                <!-- +++++++++++++++++客户人员表****联系人字段****不更改+++++++++++++++++ -->
                                  <td>
                                    <apex:outputField value="{!or.con.Campaign__c}"/>
                                  </td>
                                  <td align="center">
                                    <apex:outputLink value="/{!or.con.CampaignOwnerID__c}" target="LINK_{!or.con.CampaignOwnerID__c}">
                                    <apex:outputField value="{!or.con.CampaignOwnerName__c}" />
                                    </apex:outputLink>
                                  </td>
                                  <td align="center" >
                                    
                                    <a style="position: relative" href="/{!or.con.Id}" aws-data-id="{!or.con.AWS_Data_Id__c}" title=""><span>{!or.con.MedicalStaff_Full_name__c}</span><span class="decrypt"></span></a>
                                    
                                  </td>
                                  <td>
                                    <apex:outputField value="{!or.con.Accountid}"/>
                                  </td>
                                <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 
                                  <apex:repeat value="{!columnsRightApi}" var="c">
                                    <td style="background-color: antiquewhite;">
                                      <apex:inputField id="A02" style="background-color: antiquewhite;" value="{!or.Agcmmc[c[0]]}" onchange="setChangeFlg('{!or.lineNo}')"/>
                                    </td>
                                  </apex:repeat>
                                   <apex:repeat value="{!columnsLeftApi}" var="c">
                                    <td  style="background-color: rgb(226,239,218);" >
                                      <apex:inputField id="A03"  style="background-color: rgb(226,239,218);" value="{!or.con[c[0]]}" onchange="setChangeFlgRight('{!or.lineNo}')"/>
                                    </td>
                                  </apex:repeat>
                                  <!-- =============================================================== -->
                                    <td id="cell_Scroll" class="col_Scroll" >
                                      <apex:inputHidden value="{!or.changeFlg}" id="changeFlg"/>
                                      <apex:inputHidden value="{!or.changeFlgRt}" id="changeFlgRt"/>
                                      <script type="text/javascript">
                                          if ("{!or.canEdit}" == "false") {
                                              var right = j$("#tableData").find("tr").eq({!cnt-1});
                                              var rightline = j$(right).find("td");
                                              for (var i=0; i<rightline.length; i++) {
                                                  j$(rightline[i]).find("input").each(function(){
                                                      j$(this).attr("disabled",true);
                                                  });
                                                  j$(rightline[i]).find("a").each(function(){
                                                      j$(this).attr("href","#");
                                                  });
                                              }
                                          }
                                          if ("{!or.hasError}" == "true") {
                                              var left = j$("#tableData_L").find("tr").eq({!cnt-1});
                                              var leftFirst = j$(left).find("td").eq(1);
                                              j$(leftFirst).css("background-color", "gray");
                                          }
                                          if ("{!or.hasFieldError}" == "true") {
                                              var left = j$("#tableData_L").find("tr").eq({!cnt-1});
                                              var leftFirst = j$(left).find("td").eq(1);
                                              j$(leftFirst).css("background-color", "red");
                                          }
                                      </script>
                                    </td>
                                  <!-- ========================================================================= -->
                              </tr>
                            <apex:variable value="{!cnt + 1}" var="cntA00" />
                          </apex:repeat>
                        </table>
                    </div>
                    <div id="in_Div">
                        <table class="list" style="border-bottom-width: 0px;width:2000px; font-size:11px; border-spacing:0;" border="" id="tableData">
                        </table>
                    </div>
                </apex:outputPanel>
            </apex:pageBlock>
            <script type="text/javascript">
              j$(function() {
                  var tableWidth = 0;
                  j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
                      var colClass = getColClassName(this);
                      if (colClass != 'col_Scroll') {
                          var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
                          tableWidth += headerCol.width();
                      }
                  });
                  j$('table#tableData').css('width', (tableWidth + 2) + 'px');
                  j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
                  // list の headerRow の tdに toggleWidth() を追加
                  bindTdToggleWidth();
              });
              var elements = document.getElementsByTagName("select");
              for (i = 0; i < elements.length; i++) {
                  var id = elements[i].id;
                  if (id.length > 5 && id.substring(id.length - 5, id.length) == 'mlktp') {
                      elements[i].style.display = "none";
                  }
              }
              var tbl_l = document.getElementById("tableData_L");
              var input_l = tbl_l.getElementsByTagName("input");
              for (i = 0; i < input_l.length; i++) {
                  var id = input_l[i].id + '_lkid';
                  if (document.getElementById(id) != null) {
                      input_l[i].style.width = "75%";
                  }
              }
              var tbl = document.getElementById("tableData");
              var input = tbl.getElementsByTagName("input");
              for (i = 0; i < input.length; i++) {
                  var id = input[i].id + '_lkid';
                  if (document.getElementById(id) != null) {
                      input[i].style.width = "75%";
                  }
              }
 
              AWSService.sfSessionId = '{!GETSESSIONID()}';
              var staticResource = JSON.parse('{!staticResource}');
 
              document.body.onload = function(){
                NewSearch();
              }
              var awsdata_map={};
              function NewSearch(){
 
                // 如果有填写姓名,先去aws查询,再用awsdataid查询后台,如果没有填写直接查询后台
                awsdata_map={};
                let e = document.getElementById("allPage:allForm:searchBlock:numtextC");
                if(e && e.value){
                  blockme();
                  AWSService.search(staticResource.searchUrl,JSON.stringify({
                    "contactName":e.value
                  }),function(data){
                    unblockUI();
                    if(data.object && data.object.length > 0){
                      let aws_data_ids = [];
                      for(let d of data.object){
                        if(d.dataId){
                          awsdata_map[d.dataId] = d;
                          aws_data_ids.push(d.dataId);
                        }
                      }
                      document.getElementById("allPage:allForm:searchBlock:AwsDataIds").value = aws_data_ids.join(";");
                    }else{
                      document.getElementById("allPage:allForm:searchBlock:AwsDataIds").value = new Date().getTime();
                    }
                    searchOppJs_Account_copy();
                  },staticResource.token);
                }else{
                  searchOppJs_Account_copy();
                }
 
              }
 
              function afterSearchOpp(){
                DecryptContactName(()=>unblockUI());
              }
 
              function afterSaveAndSearch(){
                DecryptContactName(()=>unblockUI());
              }
 
              function DecryptContactName(callback){
              
                let no_in_ids = [];
                j$("[aws-data-id]").each(function(i,e){
                  let id = e.getAttribute("aws-data-id");
                  if(!(id && awsdata_map.hasOwnProperty(id))){
                    no_in_ids.push(id);
                  }
                });
                if(no_in_ids.length>0){
                  AWSService.search(staticResource.searchUrl,JSON.stringify({
                    "dataIds":no_in_ids
                  }),function(data){
                    if(data.object && data.object.length > 0){
                      for(let d of data.object){
                        if(d.dataId){
                          awsdata_map[d.dataId] = d;
                        }
                      }
                    }
                    BindToTile();
                    if(callback)callback();
                  },staticResource.token);
                }
                else{
                  BindToTile();
                  if(callback)callback();
                }
              }
 
              function BindToTile(){
                j$("[aws-data-id]").each(function(i,e){
                  let id = e.getAttribute("aws-data-id");
                  if(id && awsdata_map.hasOwnProperty(id) && awsdata_map[id].medicalStaffFullName){
                    j$(e).find(".decrypt").html(awsdata_map[id].medicalStaffFullName);
                  }
                });
              }
              
            </script>
        </apex:outputPanel>
    </apex:form>
</apex:page>