buli
2023-06-05 e9b970ea36eea5dcf93fd5b965bf13d7010ce0ad
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
import { LightningElement, track } from 'lwc';
import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById';
import SaveDataYB from '@salesforce/apex/InspectCheckController.SaveDataYB';
import ChangeDataYB from '@salesforce/apex/InspectCheckController.ChangeDataYB';
import GetIrresponsibleReason from '@salesforce/apex/InspectCheckController.GetIrresponsibleReason';
import GetproInvolvedManual from '@salesforce/apex/InspectCheckController.GetproInvolvedManual';
 
import CheckOwnerRequest from '@salesforce/apex/InspectCheckController.CheckOwner';
 
export default class Yb extends LightningElement {
 
//提示
Tongzhishow=false;  //提示显示的标识
SaveShowText="操作成功";  //提示显示的文本
TongzhiIcon = 'standard:account'  //提示显示的标签
IsLeftStyle = ""  //提示显示的样式
BgColorStyle = ""
Alert(content,error = false,left = false){
    this.SaveShowText = content;
    this.Tongzhishow = true;
    // setTimeout(()=>{
    //     this.Tongzhishow = false;
    //     this.SaveShowText = "";
    //     },3000)
    if (error) {
        this.TongzhiIcon = "standard:first_non_empty";
        this.BgColorStyle = "background-color:#f88568";
    }else{
        this.TongzhiIcon = "standard:account";
        this.BgColorStyle = "background-color:#69e669";
    }
    if (left) {
        this.IsLeftStyle = "left: 0.25rem;"
    }else{
        this.IsLeftStyle = ""
    }
}
 
CloseAlert()
{
    if (this.Tongzhishow == true) {
        this.Tongzhishow = false;
    }
    if (this.SaveShowText != "") {
        this.SaveShowText = "";
    }
    
}
 
    getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
                var pair = vars[i].split("=");
                if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
    ParamIdStr = ''
    connectedCallback(){
        var paramId =  this.getQueryVariable('id');
        if (paramId == null || paramId == '') {
            return ;
        }
        this.ParamIdStr= paramId;
        
        this.GetInspectByIdFn(paramId);
        // this.CheckOwner(paramId);
        this.GetIrresponsibleReasonFn();
        //20220913 you SWAG-CJ3DS5 start
        this.GetproInvolvedManualFn();
    }
 
    CheckResult = false;
    CheckOwner(Id)
    {
        debugger;
        CheckOwnerRequest({Id:Id}).then(result=>{
            var resultArr = result.split("==");
            if (resultArr[0] == resultArr[1]) {
                this.CheckResult = false;
            }else{
                this.CheckResult = true;
            }
            
            if (this.CheckResult) {
                this.InspectData.IsBid__c = '是';
                this.InspectData.irresponsibleReason__c = '';
                this.InspectData.irresponsibleReasonOther__c = '';
                //20220914 you SWAG-CJ3DS5 start
                this.InspectData.proInvolvedManual__c = '';
                this.InspectData.proInvolved__c = '';
                //20220914 you SWAG-CJ3DS5 end
                this.irresponsibleReasonShow = false;
                this.otherShow = false;
                this.IsBC= false;
                this.BCIsShow = false;
                this.YSJEIsShow = false;
                this.IsYSJE = false;
                this.IsSQZ = true;
            }else{
                this.IsSQZ = false;
            }
            // this.ShowText = result;
        })
    }
    ShowText = '';
    IrresponsibleReasons = [];  //选项列表展示的列
    GetIrresponsibleReasonFn()
    {
        GetIrresponsibleReason().then(result=>{
            var response=JSON.parse(result);
            this.IrresponsibleReasons = response;
        })
 
    }
    //20220913 you SWAG-CJ3DS5 start
    GetproInvolvedManuals = [];  //选项列表展示的列
    GetproInvolvedManualFn()
    {
        GetproInvolvedManual().then(result=>{
            var response=JSON.parse(result);
            this.GetproInvolvedManuals = response;
        })
 
    }
    //20220913 you SWAG-CJ3DS5 end
 
 
    @track InspectData = {}; //数据
    IsSQZ = false; //申请中的标识
    IsSQZButton = false;
    GetInspectByIdFn(Id)
    {
        GetInspectById({Id:Id}).then(result=>{
            var response=JSON.parse(result);
            if (response!=undefined && response.length == 1) {
                var tempData  = response[0];
                tempData.IsBid__c = '否';
                debugger;
                if (tempData.InvolveBudgetAmount__c != undefined) {
                    this.YSJEIsContent = tempData.InvolveBudgetAmount__c;
                }else
                {
                    if (tempData.BudgetAmountNumber__c != undefined) {
                        this.YSJEIsContent = tempData.BudgetAmountNumber__c;
                    }
                }
 
                if (tempData.proInvolved__c != undefined) {
                    this.SJCPIsContent = tempData.proInvolved__c;
                }else{
                    tempData.proInvolved__c = '';
                }
                //20220913 you SWAG-CJ3DS5 start
                // if (tempData.irresponsibleReason__c == "招标产品与我司不匹配") {
                //     this.SJCPIsShow = true;
                // }else{
                //     this.SJCPIsShow = false;
                // }GetproInvolvedManualShow
 
                if (tempData.irresponsibleReason__c == "招标产品与我司不匹配") {
                    this.GetproInvolvedManualShow = true;
                }else{
                    this.GetproInvolvedManualShow = false;
                }
                 if (tempData.proInvolvedManual__c == "其他") {
                    this.SJCPIsShow = true;
                }else{
                    this.SJCPIsShow = false;
                }
                 //20220913 you SWAG-CJ3DS5 end
                tempData.InvolveBudgetAmount__c =    this.YSJEIsContent ;
 
                if(this.YSJEIsContent == 0 || this.YSJEIsContent == '')
                {
                    this.YSJEIsShow = false;
                }
 
                if (tempData.IsBid__c  != undefined && tempData.IsBid__c == '否') {
                    this.irresponsibleReasonShow = true;
                    this.BCIsShow = true;
                    // this.YSJEIsShow = true;
                }else{
                    this.irresponsibleReasonShow = false;
                }
                if (tempData.IsBid__c  != undefined && tempData.IsBid__c == '否' && tempData.irresponsibleReason__c  != undefined && tempData.irresponsibleReason__c == '其他(可手动填写)') {
                    this.otherShow = true;
                }else{
                    this.otherShow = false;
                }
                
 
                if (tempData.irresponsibleReason__c  == undefined) {
                    tempData.irresponsibleReason__c = '';
                }
       
                if (tempData.RepsExtraContent__c  == undefined) {
                    tempData.RepsExtraContent__c = '';
                }
                
                if (tempData.irresponsibleReasonOther__c  == undefined) {
                    tempData.irresponsibleReasonOther__c = '';
                }
                //20220914 you SWAG-CJ3DS5 start
                if (tempData.proInvolvedManual__c  == undefined) {
                    tempData.proInvolvedManual__c = '';
                }
                if (tempData.proInvolved__c  == undefined) {
                    tempData.proInvolved__c = '';
                }
                //20220914 you SWAG-CJ3DS5 end
                debugger;
                if (tempData.NotBidApprovalStatus__c == '申请中') {
                    setTimeout(()=>{
                        this.IsSQZ = true;
                        this.IsSQZButton = true;
                        this.IsBC = true;
                        this.IsYSJE = true;
                        this.IsSJCP = true;
                    },1000)
              
                }
 
                this.InspectData =tempData;
            }
 
        })
    }
 
    
 
    IsBidArr=[
        {label :"是",value:"是"},
        {label :"否",value:"否"},
    ]
    //选项列表展示的列
    irresponsibleReasonShow = false; 
    handleChange(event) {
        var value = event.detail.value;
 
        this.InspectData.IsBid__c = value;
        if (value == "否") {
       
            this.irresponsibleReasonShow = true;
            this.BCIsShow = true;
            // this.YSJEIsShow = true;
            if(  this.InspectData.irresponsibleReason__c  != undefined &&  this.InspectData.irresponsibleReason__c == '其他(可手动填写)')
            {
                this.otherShow = true;
            }
            
        }else{
            // this.InspectData.irresponsibleReason__c = '';
            // this.InspectData.irresponsibleReasonOther__c = '';
            this.irresponsibleReasonShow = false;
            this.otherShow = false;
            this.IsBC= false;
            this.BCIsShow = false;
            this.YSJEIsShow = false;
            this.IsYSJE = false;
        }
    }
 
      //输入框 未输入展示的值
    bxgLy ="slds-form-element"; //error = slds-form-element slds-has-error 
    bxgLyFlag = false;
    
    otherShow = false;  //是否是其他输入
    handleIrresponsibleReasonsFn(event)
    {
        this.SJCPIsShow =false;//20220914 you SWAG-CJ3DS5
        var value = event.target.value;
        this.InspectData.irresponsibleReason__c = value;
        if (value == "其他(可手动填写)") {
            this.otherShow = true;
        }else{
            this.InspectData.irresponsibleReasonOther__c = '';
            this.otherShow = false;
            debugger;
        }
        //20220913 you SWAG-CJ3DS5 start
        // if (value == "招标产品与我司不匹配") {
        //     this.SJCPIsShow = true;
        // }else{
        //     this.SJCPIsShow = false;
        // }
        //20220913 you SWAG-CJ3DS5 start
        if (value == "招标产品与我司不匹配") {
            this.GetproInvolvedManualShow = true;
        }else{
            this.InspectData.proInvolvedManual__c = '';
            this.InspectData.proInvolved__c = '';
            this.GetproInvolvedManualShow = false;
        }
        //20220913 you SWAG-CJ3DS5 end
    }
     //20220913 you SWAG-CJ3DS5 start
    bxgLy1 ="slds-form-element"; //error = slds-form-element slds-has-error 
    handleIrresponsibleReasonsFn1(event)
    {
        var value = event.target.value;
        this.InspectData.proInvolvedManual__c = value;
        if (value == "其他") {
            this.SJCPIsShow = true;
        }else{
            this.InspectData.proInvolved__c = '';
            this.SJCPIsShow = false;
            debugger;
        }
    }
 //20220913 you SWAG-CJ3DS5 end
     //输入框 未输入展示的值
    qtLy="slds-form-element";
    qtLyFlag = false;
    //20220914 you SWAG-CJ3DS5 start
    qtLy1="slds-form-element";
    qtLyFlag1 = false;
    //20220914 you SWAG-CJ3DS5 end
    handleOtherIrrelevantFn(event)
    {
        var value = event.target.value;
        this.InspectData.irresponsibleReasonOther__c = value;
 
    }
  //输入框 未输入展示的值
    BCIsShow = false;
    IsBC = false;
    handleBCSMFn(event)
    {
        var value = event.target.value;
        this.InspectData.RepsExtraContent__c = value;
 
    }
 
 
    //
    YSJEIsShow = false;
    YSJEIsContent = '';
    IsYSJE = false;
    handleYSJEFn(event)
    {
        var value = event.target.value;
        this.YSJEIsContent = value;
        this.InspectData.InvolveBudgetAmount__c = value;
 
    }
 
    //涉及产品
    //
    SJCPIsShow = false;
    SJCPIsContent = '';
    IsSJCP = false;
    handleSJCPFN(event)
    {
        var value = event.target.value;
        this.SJCPIsContent = value;
        this.InspectData.proInvolved__c = value;
 
    }
    //数据保存方法
    saveFn(event,temp){
 
 
        var flag = true;
 
        if (this.InspectData.IsBid__c == "否" && (this.InspectData.irresponsibleReason__c == undefined || this.InspectData.irresponsibleReason__c == "" )) {
            this.bxgLy = "slds-form-element slds-has-error"
            this.bxgLyFlag = true;
            flag = false;
        }else{
            this.bxgLy = "slds-form-element"
            this.bxgLyFlag = false;
        }
 
 
        if (this.InspectData.irresponsibleReason__c == "其他(可手动填写)" &&  (this.InspectData.irresponsibleReasonOther__c == undefined || this.InspectData.irresponsibleReasonOther__c == "" )) {
            this.qtLy = "slds-form-element slds-has-error"
            this.qtLyFlag = true;
            flag = false;
        }else{
            this.qtLy = "slds-form-element"
            this.qtLyFlag = false;
        }
        //20220913 you SWAG-CJ3DS5 start
        if (this.InspectData.proInvolvedManual__c == "其他" &&  (this.InspectData.proInvolved__c == undefined || this.InspectData.proInvolved__c == "" )) {
            this.qtLy1 = "slds-form-element slds-has-error"
            this.qtLyFlag1 = true;
            flag = false;
        }else{
            this.qtL1y = "slds-form-element"
            this.qtLyFlag1 = false;
        }
        //20220913 you SWAG-CJ3DS5 end
        if (flag) {
            if (temp == 1) {
                ChangeDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("提交成功");
                        this.IsSQZ = true;
                        this.IsSQZButton = true;
                        this.IsBC = true;
                        this.IsYSJE = true;
                        window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    }else{
                        this.Alert(response,true);
                    }
                });
            }else
            {
                SaveDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("保存成功",false,true);
                        window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    }else{
                        this.Alert(response,true);
                    }
                });
            }
        }
    }
 
    CheckFn()
    {
        this.saveFn(null,1);
 
    }
}