高章伟
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
<apex:page controller="TransferApplySelectDetailSubController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
<head>
<title>受理批量更新</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
 
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
    function searchOppJs() {
        blockme();
 
        var cnt = j$('td.dataCellBorder1 input.rowchkcls').length;
        var isChanged = false;
        for (var i = 0; i < cnt; i++) {
            if (document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable:' + i + ':changeFlg').value == 1) {
                isChanged = true;
                break;
            }
        }
        if (isChanged) {
            if (window.confirm('画面上的数据有变化,要保存所做的变更吗?\n点击 [确定] 保存并检索\n点击 [取消] 只检索,放弃保存')) {
                saveAndSearch(1);
            } else {
                searchOpp();
            }
        } else {
            searchOpp();
        }
    }
</script>
</head>
    <apex:form id="allForm">
        <apex:actionFunction name="searchOpp" action="{!searchOpp}" rerender="allForm,checEventFrame" oncomplete="unblockUI();"/>
        <apex:actionFunction name="saveAndSearch" action="{!saveAndSearch}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
        <apex:actionFunction action="{!saveAndSearchPrevious}" name="saveAndSearchPrevious" rerender="allForm, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!saveAndSearchNext}" name="saveAndSearchNext" rerender="allForm, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!saveAndSearchGoPage}" name="saveAndSearchGoPage" rerender="allForm, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();"/>
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <table>
                    <tr>
                        <td colspan="1">关键字<apex:inputText value="{!keyword}"/> </td>
                        <td colspan="1">固定资产编号(Key)<apex:inputText value="{!assetnumber}" /></td>
                        <!-- //add by rentx 2021-05-07 start 1802 start 待受理完善备品信息-->
                        <td colspan="2">  备品信息是否已更新
                            <!-- <apex:inputCheckbox value="{!isPerfect}" /> -->
                        <apex:selectList value="{!isPerfect}" size="1">
                            <apex:selectOptions value="{!options}"/>
                        </apex:selectList>
                        </td>
                        <!-- //add by rentx 2021-05-07 start 1802 end -->
                        <td><apex:commandButton value="检索" onclick="searchOppJs(); return false;"/></td>
                        <td><apex:commandButton action="{!turnback}" value="返回" rerender="allForm,checEventFrame"/></td>
                        <!-- <td><apex:commandButton action="{!turnback}" value="批量导入" rerender="allForm,checEventFrame"/></td> -->
                    </tr>
                    <tr>
                        <td colspan="1">所在地区(本部)
                            <apex:selectList id="salesdepartmentOpts" size="1">
                                <apex:selectOptions value="{!salesdepartmentOpts}"/>
                            </apex:selectList>
                        </td>
                        <td colspan="1">所在地区(省)
                            <apex:selectList id="salesProvinceOpts" size="1">
                                <apex:selectOptions value="{!salesProvinceOpts}"/>
                            </apex:selectList>
                        </td>
                        <td colspan="1">备品分类
                            <apex:selectList id="equipmentTypeOpts" size="1">
                                <apex:selectOptions value="{!equipmentTypeOpts}"/>
                            </apex:selectList>
                        </td>
                        <td colspan="1">是否已受理完善备品信息
                            <input type="checkbox" id="isPerfect"/>
                        </td>
                        <td><apex:commandButton action="{!changeEdit}" value="编辑" onclick="blockme();" reRender="allForm,checEventFrame" oncomplete="unblockUI();"/></td>
                        <td><apex:commandButton value="适用" reRender="allForm" onclick="applyJs(); return false;"/></td>
                        <td><apex:commandButton action="{!savePage}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();" /></td>
                    </tr>
                </table>
                <div style="clear:both;"></div>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" isRadio="false" userCPaging="false"/>
        </apex:outputPanel>
    </apex:form>
 
    <apex:outputPanel id="checEventFrame">
      <script type="text/javascript">
            // 非集中以外的要去掉三个选项
            if('{!parentObj.RecordType.DeveloperName}'!='CenterToOther') {
                j$("select option[value='13.CTEC教育本部']").remove();
                j$("select option[value='14.医疗人才教育培训本部']").remove();
                j$("select option[value='15.医疗法规事务和质量管理本部']").remove();
            }
            j$("table#tableData tr.dataRow").each(function(index){
                // 非主体只可修改本部
                //20210512 update ljh 1832 start
                // 非主体只可修改本部 即一对一附属品 备品附属品
                //var accCheck ='';
                // if (index < j$("#tableData td.dataCellBorder1.col_Main_OneToOne__c span img").length) {
                //     accCheck = j$("#tableData td.dataCellBorder1.col_Main_OneToOne__c span img")[index].title;
                // }
                var accessoryCheck ='';
                var accessoryOneCheck ='';
                
                  
                if (index < j$("#tableData td.dataCellBorder1.col_Loaner_accsessary__c span img").length) {
                    accessoryCheck = j$("#tableData td.dataCellBorder1.col_Loaner_accsessary__c span img")[index].title;
                }
                if (index < j$("#tableData td.dataCellBorder1.col_OneToOneAccessory__c span img").length) {
                    accessoryOneCheck = j$("#tableData td.dataCellBorder1.col_OneToOneAccessory__c span img")[index].title;
                }
                //20210812 ljh 管理编码 start
                if(index < j$("tr.dataRow td.dataCellBorder1.col_EquipmentSet_Managment_Code_After__c input").length) {
                    j$("tr.dataRow td.dataCellBorder1.col_EquipmentSet_Managment_Code_After__c input")[index].disabled = true;
                }
                //20210812 ljh 管理编码 end   
                //if(accCheck != 'Checked' && accCheck != '选取的' && accCheck != 'チェック'){
                if((accessoryCheck == 'Checked' || accessoryCheck == '选取的' || accessoryCheck == 'チェック')
                    ||
                    (accessoryOneCheck == 'Checked' || accessoryOneCheck == '选取的' || accessoryOneCheck == 'チェック')
                    ){
                    if(index < j$("tr.dataRow td.dataCellBorder1.col_SalesProvince_After__c select").length) {
                        j$("tr.dataRow td.dataCellBorder1.col_SalesProvince_After__c select")[index].disabled = true;
                    }
                    if(index < j$("tr.dataRow td.dataCellBorder1.col_Equipment_Type_After__c select").length) {
                        j$("tr.dataRow td.dataCellBorder1.col_Equipment_Type_After__c select")[index].disabled = true;
                    }
                    if(index < j$("tr.dataRow td.dataCellBorder1.col_EquipmentSet_Managment_Code_After__c  input").length) {
                        j$("tr.dataRow td.dataCellBorder1.col_EquipmentSet_Managment_Code_After__c  input")[index].disabled = true;
                    }
                }
            });
      </script>
    </apex:outputPanel>
    <script type="text/javascript">
        // 适用按钮
        function applyJs() {
            var salesdepartment = document.getElementById('allPage:allForm:searchBlock:salesdepartmentOpts').value; // 所在地区本部
            var salessalesProvince = document.getElementById('allPage:allForm:searchBlock:salesProvinceOpts').value; // 所在地区省
            var equipmentType = document.getElementById('allPage:allForm:searchBlock:equipmentTypeOpts').value;  // 备品分类
            var isPerfect = document.getElementById('isPerfect').checked;  // 备品分类
 
            var salesdepartments = [];
            j$("td.dataCellBorder1.col_Salesdepartment_After__c").each(function() {
                salesdepartments.push(j$(this));
            });
            var salessalesProvinces = [];
            j$("td.dataCellBorder1.col_SalesProvince_After__c").each(function() {
                salessalesProvinces.push(j$(this));
            });
            var equipmentTypes = [];
            j$("td.dataCellBorder1.col_Equipment_Type_After__c").each(function() {
                equipmentTypes.push(j$(this));
            });
            var isPerfects = [];
            j$("td.dataCellBorder1.col_IsPerfect__c").each(function() {
                isPerfects.push(j$(this));
            });
            var currentPageRecordCount = j$("input.rowchkcls").length;
            for (var i = 0; i < currentPageRecordCount; i++) {
                var checked = j$("td.dataCellBorder1 input.rowchkcls")[i].checked;
                if (checked) {
                    if (salesdepartment != '' && typeof(salesdepartment) != "undefined") {
                        salesdepartments[i].find("select:enabled").val(salesdepartment);
                    }
                    if (salessalesProvince != '' && typeof(salessalesProvince) != "undefined") {
                        salessalesProvinces[i].find("select:enabled").val(salessalesProvince);
                    }
                    if (equipmentType != '' && typeof(equipmentType) != "undefined") {
                        equipmentTypes[i].find("select:enabled").val(equipmentType);
                    }
                    if (isPerfects[i].find("input:enabled").length > 0) {
                        isPerfects[i].find("input:enabled").prop('checked', isPerfect);
                    }
                }
            }
        }
        function onFieldChanged (inputfield, lineno) {
            document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + lineno + ':rowCheck').checked = true;
            setChangeFlg(lineno);
        }
    </script>
</apex:page>