| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>Consum_Select</fullName> | 
|     <availability>online</availability> | 
|     <displayType>massActionButton</displayType> | 
|     <linkType>javascript</linkType> | 
|     <masterLabel>分配</masterLabel> | 
|     <openType>onClickJavaScript</openType> | 
|     <protected>false</protected> | 
|     <requireRowSelection>true</requireRowSelection> | 
|     <url>{!RequireScript("/soap/ajax/51.0/connection.js")}  | 
| {!RequireScript("/soap/ajax/51.0/apex.js")}  | 
| {!RequireScript("/resource/CommonUtilJs")}  | 
| //2021-10-22 gwy 版本更改为51.0 | 
|     var buttons = document.getElementsByName('Consum_Select'.toLowerCase()); | 
|     for (var i=0; i<buttons.length; i++) { | 
|         buttons[i].className = "btnDisabled"; | 
|         buttons[i].disabled = true; | 
|     } | 
|   | 
| var ids = {!GETRECORDIDS($ObjectType.Consum_Apply_Equipment_Set__c)}; | 
|   | 
| if("{!Consum_Apply__c.Yi_loaner_arranged__c}" > 0) { | 
|     alert("出库之后不能点击分配按钮,如果有需要分配的明细请分单后继续操作"); | 
| } else if (ids.length < 1) { | 
|     alert("请选择耗材备品一览"); | 
| } else if (ids.length > 1) { | 
|     alert("请选择一条耗材备品一览"); | 
| } | 
| else { | 
| var soql = "select Id, Zan_Ding_Fen_Pei_Shu__c from Consum_Apply_Equipment_Set__c where Id='"  | 
| + ids[0] + "'";  | 
|         var allRecords = sforce.connection.query(soql).getArray("records");  | 
|     if (allRecords[0].Zan_Ding_Fen_Pei_Shu__c > 0) { | 
|         alert('请在默认分配后再做分配操作。'); | 
|     } | 
|     else { | 
|         window.open("/apex/ConsumSelect?recid=" + ids[0], "_top"); | 
|     } | 
| }</url> | 
| </WebLink> |