高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
<apex:page controller="StraightBackAddressController"  action="{!init}"  showHeader="false"   sidebar="true" id="allPage"  title="直返收货地址">
    <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 checkedTrue;
        window.onload = () => {
            document.getElementById("tab01").style.height  =  screen.availHeight*0.07+'px';
            document.getElementById("tab02").style.height  =  screen.availHeight*0.53+'px';
            document.getElementById("tab03").style.height  =  screen.availHeight*0.25+'px';
        }
         //编辑按钮
         function onEditorJs(ObjId){
            onEditor(ObjId); 
         }
        //复制按钮
        function onCopyJs(ObjId){
            if(ObjId == ''){
                onCopy('空');//设置为空,便于后端做数据处理
            }else{
                onCopy(ObjId);
            }
        }
        //保存方法
        function savaJs(){
            blockme();
            save();
        }
 
        //复选框选中触发事件
        //obj  当前对象   checkIndex  当前点击的第几行
        function onCheckBoxJd(obj,checkIndex){
            //如果为true,那么其他的所有复选框必须为不选择状态
            if(obj.checked){
                checkedTrue = checkIndex;
                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;
                    }
                }
            }else{
                checkedTrue = null;
            }
        }
        function searchBtnJs(){
            blockme();
            searchBtn();
        }
        //采用按钮
        function onAdoptJs(objId){
            if(objId != null){
                //判断当前修理单是否已经申请修理
                var uploadTime = '{!FSEApplyForRepairTime}';
                if(uploadTime != 'null'){
                    var prompt  = '由于当前修理单已申请修理,请问是否采用并上传数据到SAP?';
                    if(confirm(prompt)){
                        blockme();
                        adoptSave(objId+"",true);
                    }
                }else{
                    adoptSave(objId+"",false);
                }
            } 
        }
       /* function onAdoptJs(){
            if(checkedTrue != null){
                blockme();
                var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
                var rows = lawtable.rows;//获取所有行 
                var InputObj = rows[checkedTrue].cells[0].getElementsByTagName("input")[0];
                if(InputObj.checked){
                    //判断当前修理单是否已经申请修理
                    var uploadTime = '{!FSEApplyForRepairTime}';
                    if(uploadTime != null){
                        var prompt  = '由于当前修理单已申请修理,请问是否采用并上传数据到SAP?';
                        if(confirm(prompt)){
                            adoptSave(InputObj.value+"",true);
                        }else{
                            adoptSave(InputObj.value+"",false);
                        }
                    }else{
                        adoptSave(InputObj.value+"",false);
                    }
                }
            }else{
                alert('请选中你要采用的地址!');
                return false;
            }
        }*/
        //返回父页面
        function sendBackJs(){
            redirectPag();
        }
        //刷新当前页面
        function refreshJs(){
            window.location.reload();
        }
    </script>
    <apex:form id="allForm">
        <div id="tab01">
            <!-- 页面数据初始化方法 -->
            <apex:actionFunction name="init" action="{!init}" rerender="oppBlock1,message,checEventFrame" onComplete="unblockUI();"></apex:actionFunction>
            <!-- 检索数据查询方法 -->
            <apex:actionFunction name="searchBtn" action="{!searchBtn}" rerender="oppBlock1,message,checEventFrame" onComplete="unblockUI();"></apex:actionFunction>
            <!-- 采用方法 -->
            <apex:actionFunction name="adoptSave" action="{!adoptSave}" rerender="oppBlock2,message" onComplete="unblockUI();">
                <apex:param name="adoptId" assignTo="{!adoptId}" value="" />
                <apex:param name="isUpload" assignTo="{!isUpload}" value="" />
            </apex:actionFunction>
            <!-- 保存和修改方法 -->
            <apex:actionFunction name="save" action="{!save}" rerender="oppBlock2,message" onComplete="unblockUI();{!IF(isSearchBtn,'searchBtnJs()',false)}"></apex:actionFunction>
            <!-- 点击修改按钮获取修改数据方法 -->
            <apex:actionFunction name="onEditor" action="{!onEditor}" rerender="oppBlock2,checEventFrame" onComplete="unblockUI();">
                <apex:param name="UpdId" assignTo="{!UpdId}" value="" />
            </apex:actionFunction>
            <!-- 复制方法 -->
            <apex:actionFunction name="onCopy" action="{!onCopy}" rerender="oppBlock2,checEventFrame" onComplete="unblockUI();">
                <apex:param name="UpdId" assignTo="{!UpdId}" value="" />
            </apex:actionFunction>
            <!-- 返回父页面 -->
            <apex:actionFunction name="redirectPag" action="{!redirectPag}" rerender="true" onComplete="unblockUI();"></apex:actionFunction>
        <apex:pageBlock id="searchBlock" tabStyle="Report">
            <table style="border-bottom-width: 0px; font-size:12px;width:100%">
                <tr>
                    <td style="width: 15%">
                        <font>类&nbsp;型&nbsp;</font>&nbsp;
                            <!-- <apex:selectList id="numtextA1Id" value="{!numtextA1}" size="1" style="width:110px">
                                <apex:selectOptions value="{!optionType}"/>
                            </apex:selectList> -->
                            <apex:inputField value="{!optionAddressClassification.Address_Classification__c}" id="AddressClassificationId"/>
                        </td>
                        <td style="width: 20%">
                            <font>客&nbsp;户&nbsp;名&nbsp;</font>&nbsp;
                            <apex:inputText id="txtNameId" value="{!txtName}"/>
                            <a class="inlineEditUndoLink" title="清空" href="#" onclick="document.getElementById('allPage:allForm:searchBlock:txtNameId').value = '';document.getElementById('allPage:allForm:searchBlock:txtNameId').focus();" style="display: inline;">
                                <img width="16px" height="16px" src="/img/s.gif" alt="清空" class="inlineEditUndo"/>
                            </a>
                        </td>
                        <td style="width: 20%">
                            <font>地&nbsp;址&nbsp;</font>&nbsp;
                            <apex:inputText id="txtAddressId" value="{!txtAddress}"/>
                            <a class="inlineEditUndoLink" title="清空" href="#" onclick="document.getElementById('allPage:allForm:searchBlock:txtAddressId').value = '';document.getElementById('allPage:allForm:searchBlock:txtAddressId').focus(); " style="display: inline;">
                                <img width="16px" height="16px" src="/s.gif" alt="清空" class="inlineEditUndo"/>
                            </a>
                        </td>
                        <td style="width: 20%">
                            <apex:commandButton onclick="searchBtnJs();return false;"  rendered="true" value="检索" style="width:60px;"/>
                            &nbsp;&nbsp;
                            <!-- <apex:commandButton onclick="onAdoptJs();return false;"  rendered="true" value="采用" style="width:60px;background:#98c1fbf7"/>
                            &nbsp;&nbsp; -->
                            <apex:commandButton onclick="sendBackJs();return false;"  rendered="true" value="返回" style="width:60px;"/>
                        </td>
                        <td style="width: 25%">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
            
        </div>
        <div>
            <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="">详细地址</td>
                                    <td style="" colspan="3">
                                        操作
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                                <apex:variable value="{!0}" var="cnt" />
                                <apex:repeat value="{!tableData}" var="or" id="oppTable">
                                    <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 align="center" style="vertical-align: inherit;width:25px;border-width: 0px 1px 1px 0px;">
                                            {!cnt+1}
                                        </td>
                                        <td  align="center"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputText value="{!or.address.Address_Classification__c}" />
                                        </td>
                                        <td align="left"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputfield value="{!or.address.Customer__c}" />
                                        </td>
                                        <td align="left"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputfield value="{!or.address.Contacts__c}" />
                                        </td>
                                        <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputText value="{!or.address.Telephone__c}" />
                                        </td>
                                        <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputText value="{!or.address.ZipCode__c}" />
                                        </td>
                                        <td align="center" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputfield value="{!or.address.Province__c}" />
                                        </td>
                                        <td align="center" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputfield value="{!or.address.City__c}" />
                                        </td>
                                        <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                            <apex:outputText value="{!or.address.Detailed_Address__c}" />
                                        </td>
                                        <td align="center" style="vertical-align: inherit;width:30px;">
                                            <apex:commandButton value=" 编辑 " onclick="onEditorJs('{!or.address.id}');return false;" style="background:#98c1fbf7;display:{!or.canEdit};"/>
                                        </td>
                                        <td align="center" style="vertical-align: inherit;width:30px;">
                                            <apex:commandButton value=" 复制 " onclick="onCopyJs('{!or.address.id}');return false;" style="background: #98c1fbf7;display:{!or.canCopy};"/>
                                        </td>
                                        <td align="center" style="vertical-align: inherit;width:30px;">
                                            <apex:commandButton value=" 采用 " onclick="onAdoptJs('{!or.address.id}');return false;" style="background: #98c1fbf7;display:{!or.canAdopt};"/>
                                        </td>
                                    </tr>
                                    <apex:variable value="{!cnt + 1}" var="cnt" />
                                </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}" 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" required="false"/>
 
                    <apex:inputfield value="{!insUpdData.Province__c}" id="Province__r_Name" style="" />
                    <apex:inputfield value="{!insUpdData.City__c}" id="City__r_name" />
                    <apex:inputfield value="{!insUpdData.Telephone__c}" id="Telephone__c" />
                    <apex:inputfield value="{!insUpdData.ZipCode__c}" id="ZipCode__c" />
                    <!-- <apex:pageblockSectionItem /> -->
                    <!-- <apex:inputTextarea value="{!insUpdData.Detailed_Address__c}" id="Detailed_Address__c" style="resize:vertical;width: 90%" rows="3" cols="3"/> -->
                    <apex:inputfield value="{!insUpdData.Detailed_Address__c}" id="Detailed_Address__c" style="resize:vertical;width: 98%"/>
                </apex:pageblocksection>
 
                <div style="text-align: center;">
                    <apex:commandButton value="保存" onclick="savaJs();return false;" rendered="true" />
                </div>
            </apex:pageBlock>
        </div>
    </apex:form>
    <apex:outputPanel id="checEventFrame">
      <script type="text/javascript">
            j$("select option[value='办事处']")[1].remove();
        </script>
    </apex:outputPanel>
    <script type="javascript/text">
 
    </script>
</apex:page>