高章伟
2023-03-03 d8dc84a3d56df839895f1c417a4d9cbee763d262
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>RentalApplyDiscountApproval</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>备品减价申请</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)}
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)}
 
var foo = function() {
        
        var power = &apos;{!$Profile.Id}&apos;;
    // 2B2_备品中心检测&amp;仓库管理  00e10000000xnoY
    if(power!=&apos;00e10000000xnoY&apos;){
        //alert(&apos;对不起,您没有权限提交此申请!&apos;);
        //return;
    }
 
    var status = &apos;{!Repair_Quotation__c.Rental_Apply_Discount_Status__c}&apos;;
    if (status==&apos;审批中&apos;) {
        alert(&quot;审批提交成功,当前正在审批请勿再提交!&quot;);
        return;
    }
    if (status==&apos;批准&apos;) {
        alert(&quot;审批已批准,请勿再提交!&quot;);
        return;
    }
    if (status==&apos;草案中&apos; || status==&apos;&apos; || status == &apos;驳回&apos;) {
        if ({!Repair_Quotation__c.Loaner_repair_sys__c}) {
            var q = new sforce.SObject(&quot;Repair_Quotation__c&quot;);
            q.Id = &quot;{!Repair_Quotation__c.Id}&quot;;
            q.Rental_Apply_Discount_Status__c = &quot;已提交&quot;;
            var result = sforce.connection.update([q]);
            var messages = getConnectDMLErrorMessages(result);
            if (messages.length &gt; 0) {
                alert(&quot;提交失败&quot; + messages.join(&quot;\n&quot;));
                return;
            }
        } else {
            alert(&quot;请先填写备品减价金额!&quot;);
            return;
        }
    }
 
 
    location.reload();
}
foo();</url>
</WebLink>