高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
<apex:page id="Page" standardController="Product2" extensions="OrderSearchProductController" sidebar="false" showHeader="false" >
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <head>
        <script type="text/javascript">
            function selectAll() {
                var checklist = j$("input[name='checklist']");
                var all = j$(escapeVfId("checkAll"));
                for(var i = 0; i < checklist.length; i++){
                    if (all[0].checked == true) {
                        checklist[i].checked = true;
                    } else {
                        checklist[i].checked = false;
                    }
                }
            }
            function searchHospitalJs() {
                blockme();
                searchHospital();
            }
            var QuoteEntryMaxLine = 200;
            function setProductList() {
 
                var nextLine = top.window.opener.getLastLineNoNext(window.opener.document);
                //alert('nextLine'+nextLine);
                var hasCheckedCnt = 0;
                var checklist = j$("input[name='checklist']");
                
                for(var i=0; i<checklist.length; i++){
                    if (checklist[i].checked) {
                        hasCheckedCnt++;
                        if (nextLine < QuoteEntryMaxLine) {
                            SetProductId(nextLine, i);
                            //alert(i);
                            nextLine++;
                        } else {
                            alert('Over Max Line ' + QuoteEntryMaxLine);
                            return false;
                        }
                    }
                }
                if (hasCheckedCnt == 0) {
                    alert('请至少选择一个产品进行追加。');
                    return false;
                }
                // window.opener.addrowJS();
                // window.opener.location.reload();
                // window.opener.top.location.SaveJs();
                top.window.close();
            }
            function SetProductId(lineno, i) {
 
                var Asset_Model_No = j$(escapeVfId("Page:mainForm:SearchResult:productInfoList:"+ i +":Asset_Model_No")).text();
                var Name = j$(escapeVfId("Page:mainForm:SearchResult:productInfoList:"+ i +":Name")).text();
                var SFDA_Expiration_Date = j$(escapeVfId("Page:mainForm:SearchResult:productInfoList:"+ i +":SFDA_Expiration_Date")).text();
                var Packing_list_manual = j$(escapeVfId("Page:mainForm:SearchResult:productInfoList:"+ i +":Packing_list_manual")).text();
                var ProIdHidden1 = j$(escapeVfId("Page:mainForm:SearchResult:productInfoList:"+ i +":ProIdHidden")).value();
 
                // alert(SFDA_Expiration_Date);
                var strDateTime = SFDA_Expiration_Date;
                var myDate = new Date(strDateTime);
                var myDateStr = myDate.toLocaleString().substring(0, 8);
                // alert(myDate.toLocaleString());
 
                // fxk
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":NameHidden")).attr('value',Name);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":SFDAHidden")).attr('value',myDateStr);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":PackingHidden")).attr('value',Packing_list_manual);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":ProIdHidden")).attr('value',ProIdHidden1);
 
                // fxk
 
                //lt 20211029 start
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":proModel")).text(Asset_Model_No);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":Name")).text(Name);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":SFDA_Expiration_Date")).text(SFDA_Expiration_Date);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":Packing_list_manual")).text(Packing_list_manual);
 
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":proModel")).attr('value',Asset_Model_No);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":Name")).attr('value',Name);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":SFDA_Expiration_Date")).attr('value',SFDA_Expiration_Date);
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":Packing_list_manual")).attr('value',Packing_list_manual);
 
                //No  //20211103 lt
                window.opener.j$(escapeVfId("Page:mainForm:productInfoList:"+ lineno +":indexNo")).text(parseInt(lineno)+1);
 
                //lt 20211029 end
            }
 
        </script>
        <style type="text/css">
            div#iframelike {
                color: #fff;
                height: 200px;
                overflow-y: auto;
                overflow-x: hidden;
            }
            .pure-table {
                border-collapse: collapse; 
                border-spacing: 0; 
                empty-cells: show;
                border: 1px solid #cbcbcb;
                width: 100%;
            }
            .pure-table-horizontal th,.pure-table-horizontal td {
                border-width: 0 0 1px 0;
                border-bottom: 1px solid #cbcbcb;
            }
    
            .pure-table-horizontal tbody>tr:last-child>td {
                border-bottom-width: 0;
            }
        </style>
    </head>
 
    <body>
        <apex:form id="mainForm">
            <apex:outputPanel id="message">
                <apex:pageMessages ></apex:pageMessages>
            </apex:outputPanel>
 
            <apex:actionFunction name="searchHospital" action="{!searchHospital}" rerender="SearchResult" onComplete="unblockUI();">
            </apex:actionFunction>
 
            <apex:outputPanel id="listsTable">
                <apex:pageBlock id="idSearchSetProduct" title="产品检索">
                    <table style="width:900px;" border="0">
                        <tr>
                               <th>{!$Label.Asset_No}</th>
                               <td><apex:inputText id="ProModel" value="{!ProModel}" style="width:200px" required="false"/></td>
                            <td>
                                <apex:commandButton value="检索" action="{!searchHospital}" style="width:100px;height:30px;" />
                                &nbsp;&nbsp;&nbsp;
                                <!-- disabled="{!Hascl}" lt add 没有产品时 不可点击追加按钮 -->
                                <apex:commandButton value="追加" style="width:100px;height:30px;" disabled="{!Hascl}" rerender="dummy" onclick="setProductList();return false;"/>
                            </td>
                        </tr>
                    </table>
                </apex:pageBlock>
                <apex:pageBlock id="SearchResult" title="检索结果">
                        <table id="theTable_header" class="pure-table pure-table-horizontal" border="1" style=" border-collapse:collapse; table-layout:fixed;">
                            <tr>
                                <th style="text-align:left;width:5%;"><input type="checkbox" id="checkAll" onclick="selectAll()" style="width:10px;"/>{!$Label.Selected}</th>
                                <!-- 20211029 lt add start -->
                                <th style="text-align:left;width:20%;">产品型号</th>
                                <th style="text-align:left;width:45%;">产品名称</th>
                                <th style="text-align:left;width:20%;">效期</th>
                                <!-- 20211029 lt add end -->
 
                                <th style="text-align:left;width:10%;">{!$ObjectType.Product2.fields.Packing_list_manual__c.label}</th>
                            </tr>
                        </table>
                    <div id="iframelike">
                        <table id="theTable_body" class="pure-table pure-table-horizontal" border="1" style=" border-collapse:collapse; table-layout:fixed;">
                                <apex:repeat value="{!productInfoList}" var="pros" id="productInfoList">
                                    <tr>
                                        <td class="dataCell" style="width:5%;text-align:left;">
                                            <input type="checkbox" name="checklist" style="width:10px"/>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        </td>
                                        <td class="dataCell" style="text-align:left;width:20%;">
                                            <apex:inputHidden id="ProIdHidden" value="{!pros.pro.Id}"/>
                                           <apex:outputField id="Asset_Model_No" value="{!pros.pro.Asset_Model_No__c}"/>
                                        </td>
                                        <td class="dataCell" style="text-align:left;width:45%;">
                                           <apex:outputField id="Name" value="{!pros.pro.Name}"/>
                                        </td>
                                        <td class="dataCell" style="text-align:left;width:20%;">
                                           <apex:outputField id="SFDA_Expiration_Date" value="{!pros.pro.SFDA_Expiration_Date__c}"/>
                                        </td>
                                        <td class="dataCell" style="text-align:left;width:10%;">
                                           <apex:outputField id="Packing_list_manual" value="{!pros.pro.Packing_list_manual__c}"/>
                                        </td>
                                    </tr>
                                </apex:repeat>
                        </table>
                    </div>
                </apex:pageBlock>
            </apex:outputPanel>
        </apex:form>
    </body>
</apex:page>