GWY
2022-05-16 a9baff8a4508c1850e650f68831d857b953eace4
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
<apex:page Controller="TydelikeACController" sidebar="false" action="{!init}" id="Page">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.NewQuoteEntryJS)}"/>
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
<script type="text/javascript">
    function searchTy1(){
        blockme();
        searchTy();
    }
    function OfSkrap(linenum) {
        var accName = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':aCName')).value();
        if(accName != ''){
            if(confirm('客户已经选择,请问真的删除吗?')==true){
                /*check();*/
                blockme();
                setOfSkrapBtn();
            }
        }else {
            if(confirm('是否删除?')==true){
                /*check();*/
                blockme();
                setOfSkrapBtn();
            }
        }
    }
    function OfSkrap1() {
        var bon = 0;
        var bom = 0;
        var tysize = j$(escapeVfId('linesize')).value();
        for (var i = 0; i < tysize; i++) {
            if (j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr('checked') == 'checked' && 
                j$(escapeVfId('Page:mainForm:lines:' + i + ':aCName')).value() != '') {
                bon += 1;
            }
            if (j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr('checked') == 'checked'){
                bom += 1;
            }
        }
        if (bom == 0) {
            alert('您没有选择需要批量删除的记录');
        }else if (bon == 0) {
                if(confirm('是否批量删除?')==true){
                    blockme();
                    setOfSkrapBtn();
                    for (var i = 0; i < tysize; i++) {
                        j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr("checked",false);
                    }
                }else {
                    for (var i = 0; i < tysize; i++) {
                        j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr("checked",false);
                    }
                }
            }else {
                if (bon == 1 && bom == 1) {
                    if(confirm('客户已经选择,请问真的批量删除吗?')==true){
                    blockme();
                    setOfSkrapBtn();
                    }else {
                        for (var i = 0; i < tysize; i++) {
                            j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr("checked",false);
                        } 
                    }
                }else {
                    alert('客户已经选择,且记录多于一条,不能批量删除');
                    for (var i = 0; i < tysize; i++) {
                       j$(escapeVfId('Page:mainForm:lines:' + i + ':aCbon')).attr("checked",false);
                    }
                }
            }
    }
    function gespoel() {
        window.top.location.reload();
    }
    function setall(linenum) {
        j$(escapeVfId('Page:mainForm:lines:' + linenum + ':aCbon')).attr("checked",true);
    }
    function setall1(linenum) {
        j$(escapeVfId('Page:mainForm:lines:' + linenum + ':aCbon')).attr("checked",false);
    }
    function breakId(linenum) {
        var baseUrl = '{!baseUrl}';
        var accName = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':aCName')).value();
        var tycoId = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':cooid')).value();
        var tyacId = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':acoid')).value();
        if (tycoId == '') {
            alert('没有可合并的联系人');
        }else if (accName == '') {
            alert('没有选择需要合并联系人的客户');
        }else{
            var url = baseUrl +'/apex/TydelikeCon?' + 
            'accName=' + encodeURIComponent(accName) + 
            '&tyacId=' + encodeURIComponent(tyacId) +
            '&tycoId=' + encodeURIComponent(tycoId);
            window.top.location.href = url;
        }
        
    }
    function createId(linenum) {
        var baseUrl = '{!baseUrl}';
        var tycoId = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':cooid')).value();
        var tyacId = j$(escapeVfId('Page:mainForm:lines:' + linenum + ':acoid')).value();
        if (tycoId == '') {
            var url = baseUrl +'/apex/TydelikeAcc?' + 
            'tyacId=' + encodeURIComponent(tyacId);
            window.top.location.href = url;
        }else {
            var url = baseUrl +'/apex/TydelikeAcc?' + 
            'tyacId=' + encodeURIComponent(tyacId) + 
            '&tycoId=' + encodeURIComponent(tycoId);
            window.top.location.href = url;
        }
        
    }
    
    </script>
 
    <style type="text/css">
        div#iframelike {
            color: #fff;
            height: 300px;
            overflow: auto;
        }
        div#iframelikeheader {
            color: #fff;
            height: 23px;
            overflow: auto;
        }
        .errorMessage{
            font-size: 15px;
            color:#FF0000;
        }
        input {
            font-size: 10.5px;
        }
        body {
            font-size: 10.5px;
        }
 
        hr {
            height: 15px;
            color: #fff;
            margin: 0px;
            padding: 0px;
            border: 0px;
        }
 
    </style>
 
    <apex:form id="mainForm">
        <apex:actionFunction name="setOfSkrapBtn" action="{!setOfSkrapBtn}" onComplete="unblockUI();gespoel();" rerender="mainForm,message,allPanel"></apex:actionFunction>
        <apex:actionFunction name="searchTy" action="{!searchTy}" onComplete="unblockUI();" rerender="mainForm,message,allPanel"></apex:actionFunction>
        <div style="width: 100%">
            <div class="errorMessage" style="margin-left: 39%">
                <span id="errorMessage">{!errorMessage}</span>
            </div>
        </div>
        <input type="hidden" id='linesize' value="{!datalineSize}"/>
        <apex:outputPanel id="allPanel">
 
        <table style="width:1280px;" border="0">
            <tr>
                <td style="text-align:right;width:35px;">联系人</td>
                <td class="dataCell" style="text-align:center;width:150px;">
                    <apex:inputText id="tycontactname" style="width:90%;text-align:center;" value="{!tycontactname}"/>
                </td>
 
                <td style="text-align:right;width:40px;">客户名称</td>
                <td class="dataCell" style="text-align:center;width:150px;">
                    <apex:inputText id="tycountname" style="width:90%;text-align:center;" value="{!tycountname}"/>
                </td>
 
                <td style="text-align:right;width:20px;">城市</td>
                <td class="dataCell" style="text-align:center;width:60px;">
                    <apex:inputText id="tycountcity" style="width:85%;text-align:center;" value="{!tycountcity}"/>
                </td>
 
                <td class="dataCell" style="text-align:left;width:50px;">
                    <apex:commandButton onclick="searchTy1();return false;" value="检索" rerender="mainForm">
                    </apex:commandButton>
                </td>
                <td class="dataCell" style="text-align:center;width:560px;"></td>
 
                <td class="dataCell" style="text-align:right;width:30px;">
                    <apex:commandButton onclick="OfSkrap1();return false;" value="批量删除" rerender="mainForm">
                    </apex:commandButton>
                </td>
            </tr>
        </table>
 
        <table style="width:1300px;" border="0">
            <tr>
                <th style="text-align:center;width:10px;">&nbsp;&nbsp;&nbsp;批量</th>
                <th style="text-align:center;width:210px;">{!$ObjectType.TydelikeAccount__c.fields.Name.label}</th>
                <th style="text-align:center;width:70px;">{!$ObjectType.TydelikeAccount__c.fields.TyCity__c.label}</th>
                <th style="text-align:center;width:150px;">{!$ObjectType.TydelikeAccount__c.fields.TyAddress__c.label}</th>
                <th style="text-align:center;width:75px;">{!$ObjectType.TydelikeAccount__c.fields.TyPostCode__c.label}</th>
                <th style="text-align:center;width:80px;">{!$ObjectType.TydelikeContact__c.fields.Name.label}</th>
                <th style="text-align:center;width:150px;">{!$ObjectType.TydelikeContact__c.fields.TyAddress__c.label}</th>
                <th style="text-align:center;width:75px;">{!$ObjectType.TydelikeContact__c.fields.TyPostcode__c.label}</th>
                <th style="text-align:center;width:120px;">{!$ObjectType.TydelikeContact__c.fields.TyPhoneD__c.label}</th>
                <th style="text-align:center;width:190px;">{!$ObjectType.TydelikeAccount__c.fields.Account1__c.label}</th>
                <th style="text-align:center;width:120px;">操 作</th>
            </tr>
        </table>
 
        <div id="iframelike" style="width:1338px;">
                <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0; width:1200px; border-collapse: collapse; table-layout: fixed;" border="0">
                    <apex:repeat value="{!dataLines}" var="line" id="lines">
                    <apex:outputPanel layout="none" rendered="{!IF(line.tyacof == true || line.tycoof == true, false, true)}">
                    <tr>
                        <apex:inputHidden id="acoid" value="{!line.tyacId}"/>
                        <apex:inputHidden id="cooid" value="{!line.tycoId}"/>
                        <apex:inputHidden id="tynum" value="{!line.lineNum}"/>
                        <apex:inputHidden id="accfs" value="{!line.tyacof}"/>
                        <apex:inputHidden id="acofs" value="{!line.tycoof}"/>
                        <apex:inputHidden id="acFax" value="{!line.tycofax}"/>
                        <apex:inputHidden id="baseUrl" value="{!baseUrl}"/>
                        <td class="dataCell" style="text-align:center;width:30px;">
                            <apex:inputCheckbox id="aCbon" style="width:25px;text-align:center;" value="{!line.bondel}"/>
                        </td>
                        <td class="dataCell" style="text-align:center;width:200px;">
                            <apex:outputText id="tAName" style="width:90%;text-align:center;" value="{!line.tyacName}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:75px;">
                            <apex:outputText id="tACity" style="width:90%;text-align:center;" value="{!line.tyaccity}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:140px;">
                            <apex:outputText id="tAAddress" style="width:90%;text-align:center;" value="{!line.tyacadd}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:70px;">
                            <apex:outputText id="tAPostCode" style="width:90%;text-align:center;" value="{!line.tyacpost}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:80px;">
                            <apex:outputText id="tYName" style="width:90%;text-align:center;" value="{!line.tycoName}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:145px;">
                            <apex:outputText id="tYAddress" style="width:90%;text-align:center;" value="{!line.tycoadd}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:70px;">
                            <apex:outputText id="tYPostcode" style="width:90%;text-align:center;" value="{!line.tycopost}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:110px;">
                            <apex:outputText id="tYPhoneD" style="width:90%;text-align:center;" value="{!line.tycophone}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:190px;">
                            <apex:inputField id="aCName" style="width:160px;text-align:left;" value="{!tya.Account1__c}"/>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:28px;">
                            <apex:commandButton value="合并" onclick="breakId({!line.lineNum}); return false;">
                            </apex:commandButton>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:28px;">
                            <apex:commandButton value="创建" onclick="createId({!line.lineNum}); return false;">   
                            </apex:commandButton>
                        </td>
 
                        <td class="dataCell" style="text-align:center;width:28px;">
                            <apex:commandButton onclick="setall({!line.lineNum}); OfSkrap({!line.lineNum}); setall1({!line.lineNum}); return false;" value="删除" rerender="mainForm">
                            </apex:commandButton>
                        </td>
 
                    </tr>
                </apex:outputPanel>
                </apex:repeat>
                </table>
            </div>
        </apex:outputPanel>
    </apex:form>
</apex:page>