高章伟
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
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
<apex:page controller="StraightBackAddressControllerX"  action="{!init}"  showHeader="false"   sidebar="true" id="allPage"  title="测试自定义页面01">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <script type="text/javascript">
        var winHeigth  = window.availHeight;//浏览器高度
        var winWidth  = window.availWidth;//浏览器宽度
        //$("body").css("heigth",winHeigth);
 
        window.onload = () => {
            document.getElementById("tab02").style.height  =  document.body.offsetHeight/2*1.3+'px';
            firstCheckBox();
        }
         //编辑按钮
        function onEditorJs(ObjId){
            onEditor(ObjId); 
        }
        //复制按钮
        function onCopyJs(ObjId){
            onCopy(ObjId);
        }
 
        //重新刷新列表数据
        function refreshData(){
            window.location.reload();
        }
        //保存方法
        function savaJs(){
            blockme();
            save();
        }
 
        //复选框选中修理单中已保存的收货地址
        function firstCheckBox(){
            var Repair_Address_ID = '{!Repair_Address_ID}';
            var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
            var rows = lawtable.rows;//获取所有行 
            for(var i=1; i < rows.length; i++){ 
                var InputObj = rows[i].cells[0].getElementsByTagName("input")[0];
                if(InputObj.value == Repair_Address_ID){
                    InputObj.checked = true;
                }
            }
        }
        //复选框选中触发事件
        function onCheckBoxJd(obj,checkId){
            //如果为true,那么其他的所有复选框必须为不选择状态
            if(obj.checked){
                var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
                var rows = lawtable.rows;//获取所有行 
                for(var i=1; i < rows.length; i++){ 
                    var InputObj = rows[i].cells[0].getElementsByTagName("input")[0];
                    if(obj != InputObj){
                        InputObj.checked = false;
                    }
                }
            }
        }
        //采用按钮
        function onAdoptJs(){
            var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
            var rows = lawtable.rows;//获取所有行 
            for(var i=1; i < rows.length; i++){ 
                var InputObj = rows[i].cells[0].getElementsByTagName("input")[0];
                if(InputObj.checked){
                    adoptSave(InputObj.value+"");
                    // closeandreloadJs();
                }
            }
            redirectPag();
        }
        //待开发  关闭当前窗口,并刷新父方法
        function closeandreloadJs(){
            //window.open('https://ocsm--stagefull.my.salesforce.com/a0J1m000000h0hT');
            //window.opener.top.location.reload();
            //window.top.close();
            blockme();
            redirectPag();
        }
        //刷新当前页面
        function refreshJs(){
            window.location.reload();
        }
    </script>
    <apex:form id="allForm">
        <!-- <div id="tab01"> -->
        <apex:actionFunction name="init" action="{!init}" rerender="oppBlock1,message" onComplete="unblockUI();"></apex:actionFunction>
        <apex:actionFunction name="redirectPag" action="{!redirectPag}" rerender="oppBlock1,message" onComplete="unblockUI();"></apex:actionFunction>
        <apex:actionFunction name="searchBtn" action="{!searchBtn}" rerender="oppBlock1,message" onComplete="unblockUI();"></apex:actionFunction>
        <apex:actionFunction name="adoptSave" action="{!adoptSave}" rerender="oppBlock2" onComplete="unblockUI();redirectPag();">
            <apex:param name="adoptId" assignTo="{!adoptId}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="save" action="{!save}" rerender="true" onComplete="refreshJs();"></apex:actionFunction>
        <apex:actionFunction name="onEditor" action="{!onEditor}" rerender="oppBlock2" onComplete="unblockUI();">
            <apex:param name="UpdId" assignTo="{!UpdId}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="onCopy" action="{!onCopy}" rerender="oppBlock2" onComplete="unblockUI();">
            <apex:param name="UpdId" assignTo="{!UpdId}" value="" />
        </apex:actionFunction>
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                 <table style="border-bottom-width: 0px; font-size:12px;width:100%">
                    <tr>
                        <td style="width: 10%">
                            <font>类&nbsp;型&nbsp;</font>&nbsp;
                            <apex:selectList id="numtextA1Id" value="{!numtextA1}" size="1" style="width:110px">
                                <apex:selectOptions value="{!optionType}"/>
                            </apex:selectList>
                        </td>
                        <td style="width: 15%">
                            <font>客&nbsp;户&nbsp;名&nbsp;</font>&nbsp;
                            <apex:inputText id="txtNameId" value="{!txtName}"/>
                        </td>
                        <td style="width: 15%">
                            <font>地&nbsp;址&nbsp;</font>&nbsp;
                            <apex:inputText id="txtAddressId" value="{!txtAddress}"/>
                        </td>
                        <td style="width: 10%">
                            <apex:commandButton action="{!searchBtn}"  rendered="true" value="检索" style="width:60px;background:#98c1fbf7"/>
                            &nbsp;&nbsp;
                            <apex:commandButton onclick="onAdoptJs();"  rendered="true" value="采用" style="width:60px;background:#98c1fbf7"/>
                        </td>
                        <td style="width: 50%">
                            &nbsp;
                        </td>
                      </tr>
                </table>
            </apex:pageBlock>
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
            <!-- </div> -->
            <div id="tab02" style="overflow-x: auto; overflow-y: auto;">
                <apex:pageBlock id="oppBlock1" tabStyle="Report">
                    <apex:pageblocksection title="列表" id="edmpdDetails" rendered="true" columns="1" >
                        <apex:outputPanel >
                        <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L" >
                           <thead>
                               <tr class="headerRow" height="30px"  align="center">
                                <!--标题 -->
                                <td style="">选择</td>
                                <td style="">类型</td>
                                <td style="">客户名</td>
                                <td style="">联系人</td>
                                <td style="">电话</td>
                                <td style="">省</td>
                                <td style="">市</td>
                                <td style="">详细地址</td>
                                <td style="">
                                    &nbsp;
                                </td>
                                </tr>
                            </thead>
                            <tbody>
                                <apex:repeat value="{!tableData}" var="or" id="oppTable">
                                    <tr>
                                        <td  align="center">
                                            <input type="checkbox" name="vehicle" onclick="onCheckBoxJd(this,'{!or.address.id}');" value="{!or.address.id}" />
                                        </td>
                                        <td  align="center">
                                            <apex:outputText value="{!or.address.Address_Classification__c}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.Customer__r.Name}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.Contacts__r.Name}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.Telephone__c}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.Province__r.Name}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.City__r.name}" />
                                        </td>
                                        <td align="center">
                                            <apex:outputText value="{!or.address.Detailed_Address__c}" />
                                        </td>
                                        <td align="center" style="width:100px">
                                            <apex:commandButton value=" 编辑 " onclick="onEditorJs('{!or.address.id}');return false;" style="background:#98c1fbf7"/>
                                            <apex:commandButton value=" 复制 " onclick="onCopyJs('{!or.address.id}');return false;" style="background: #98c1fbf7;"/>
                                        </td>
                                    </tr>
                                </apex:repeat>
                            </tbody>
                        </table>
                        </apex:outputPanel>
                    </apex:pageblocksection>
                </apex:pageBlock>
            </div>
            <div id="tab03">
            <apex:pageBlock id="oppBlock2" tabStyle="Report">
                <apex:pageblocksection title="编辑地址" id="UpdAddressId" rendered="true" columns="4">
                    <apex:inputfield value="{!insUpdData.Address_Classification__c}" required="false" id="Address_Classification__c" />
                    <apex:inputfield value="{!insUpdData.Customer__c}" id="Customer__r_Name" required="false"/>
                    <apex:inputfield value="{!insUpdData.Contacts__c}" id="Contacts__c" required="false"/>
                    <apex:inputfield value="{!insUpdData.Create_Contacts__c}" id="Create_Contacts__c" />
 
                    <apex:inputfield value="{!insUpdData.Province__c}" id="Province__r_Name" />
                    <apex:inputfield value="{!insUpdData.City__c}" id="City__r_name" />
                    <apex:inputfield value="{!insUpdData.Telephone__c}" id="Telephone__c" />
                    <apex:pageblockSectionItem />
                    <apex:inputfield value="{!insUpdData.Detailed_Address__c}" id="Detailed_Address__c" style="colspan:2"/>
                </apex:pageblocksection>
                <div style="text-align: center;">
                    <apex:commandButton value="保存" onclick="savaJs();return false;" rendered="true" />
                </div>
            </apex:pageBlock>
            </div>
        </apex:form>
  <script type="javascript/text">
 
  </script>
</apex:page>