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
import { LightningElement, track } from 'lwc';
import GetInspectById from '@salesforce/apex/EnquiryNoBiddingController.GetInspectById';
import SaveDataYB from '@salesforce/apex/EnquiryNoBiddingController.SaveDataYB';
import ChangeDataYB from '@salesforce/apex/EnquiryNoBiddingController.ChangeDataYB';
import GetIrresponsibleReason from '@salesforce/apex/EnquiryNoBiddingController.GetIrresponsibleReason';
 
import CheckOwnerRequest from '@salesforce/apex/EnquiryNoBiddingController.CheckOwner';
 
import GetTenderInformationById from '@salesforce/apex/EnquiryNoBiddingController.GetTenderInformationById';
 
 
import GetDataById from '@salesforce/apex/EnquiryNoBiddingController.GetDataById';
 
 
export default class TEnquiryNoBidding extends LightningElement {
 
 
 
    IsLoading = false;  //加载的标识
    //加载提示框
    OnLoading(flag){
            this.IsLoading = flag;
    }
 
 
 
//提示
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 = '' //不应标申请iD
    ParamOIdStr = '' //询价ID
    ParamPIdStr = '' //招投标ID
 
    
    connectedCallback(){
        this.OnLoading(true);
        
        var paramId =  this.getQueryVariable('id');
        var paramOId =  this.getQueryVariable('oid');
        var paramTId =  this.getQueryVariable('tid');
        // paramId = 'a4Y1m0000000dhGEAQ';
        // paramOId = '0061000000QL9M4AAL';
 
        this.ParamIdStr= paramId;
        this.ParamOIdStr = paramOId;
        this.ParamPIdStr = paramTId;
     
        debugger;
 
        this.GetIrresponsibleReasonFn();
       
        // Opp_Bid__c | Bidding_Project_Name_BidId__c
 
        if(this.ParamOIdStr !=undefined && this.ParamOIdStr!=false)
        {
            GetDataById({Id:this.ParamOIdStr}).then(response=>{
                var data = JSON.parse(response);
                console.warn(data);
                this.OpportunityObjec = data.tender == null?{}:data.tender;
                this.InspectData = data.enquiry == null?{}:data.enquiry ;
 
                this.check();
 
                setTimeout(()=>{
                    this.OnLoading(false);
                },1500);
            })
        }
    }
 
    check()
    {
        if(this.InspectData != undefined && this.InspectData != null && this.InspectData != {})
        {
            this.checkData(this.InspectData);
        }else{
            this.InspectData.irresponsibleReason__c = ''
            this.InspectData.InvolveBudgetAmount__c  = 0
            this.InspectData.RepsExtraContent__c  = ''
            this.InspectData.irresponsibleReasonOther__c  = ''
        }
        if(this.OpportunityObjec != undefined && this.OpportunityObjec != null && this.OpportunityObjec != {})
        {
            this.checkTender();
        }
    }
 
    OpportunityObjec = {}; //招投标的数据
 
    checkTender()
    {
        if (this.InspectData.InvolveBudgetAmount__c == null || this.InspectData.InvolveBudgetAmount__c  == 0) {
            if (this.OpportunityObjec.BudgetAmountNumber__c != null) {
                this.InspectData.InvolveBudgetAmount__c  =  this.OpportunityObjec.BudgetAmountNumber__c;
            }
        }
    }
  
    ShowText = '';
    IrresponsibleReasons = [];  //选项列表展示的列
    GetIrresponsibleReasonFn()
    {
        GetIrresponsibleReason().then(result=>{
            var response=JSON.parse(result);
            this.IrresponsibleReasons = response;
        })
 
    }
    @track InspectData = {}; //数据
    IsSQZButton = false;
    checkData(tempData)
    {   
 
        if (tempData.irresponsibleReason__c  != undefined && tempData.irresponsibleReason__c == '其他(可手动填写)') {
            this.otherShow = true;
        }else{
            this.otherShow = false; 
        }
        
        if (tempData.InvolveBudgetAmount__c  == undefined) {
            tempData.InvolveBudgetAmount__c = 0;
        }
 
        if (tempData.irresponsibleReason__c  == undefined) {
            tempData.irresponsibleReason__c = '';
        }
 
        if (tempData.RepsExtraContent__c  == undefined) {
            tempData.RepsExtraContent__c = '';
        }
        
        if (tempData.irresponsibleReasonOther__c  == undefined) {
            tempData.irresponsibleReasonOther__c = '';
        }
 
        if (tempData.NotBidApprovalStatus__c == '申请中'  || tempData.NotBidApprovalStatus__c == '批准' ) {
            setTimeout(()=>{
                this.DisabledSet();
            },1000);
        }
    }
 
   
    //输入框 未输入展示的值
    bxgLy ="slds-form-element"; //error = slds-form-element slds-has-error 
    bxgLyFlag = false;
 
    otherShow = false;  //是否是其他输入
    handleIrresponsibleReasonsFn(event)
    {
        var value = event.target.value;
        this.InspectData.irresponsibleReason__c = value;
        if (value == "其他(可手动填写)") {
            this.otherShow = true;
        }else{
            this.InspectData.irresponsibleReasonOther__c = '';
            this.otherShow = false;
        }
    }
 
 
     //输入框 未输入展示的值
    qtLy="slds-form-element";
    qtLyFlag = false;
    handleOtherIrrelevantFn(event)
    {
        var value = event.target.value;
        this.InspectData.irresponsibleReasonOther__c = value;
 
    }
  //输入框 未输入展示的值
    BCIsShow = true;
    handleBCSMFn(event)
    {
        var value = event.target.value;
        this.InspectData.RepsExtraContent__c = value;
 
    }
 
 
    //
    YSJEIsShow = true;
    InvolveBudgetAmount__c = '';
    handleYSJEFn(event)
    {
        var value = event.target.value;
        this.InvolveBudgetAmount__c = value;
        this.InspectData.InvolveBudgetAmount__c = value;
 
    }
 
    //数据保存方法
    saveFn(event,temp){
        if(!this.IsCheck){return;}
 
        this.IsCheck = false;
        
        debugger;
        var flag = true;
 
          
        if (this.InspectData.irresponsibleReason__c == undefined || this.InspectData.irresponsibleReason__c == '' ) {
            this.bxgLyFlag = true;
            flag = false;
        }else{
            this.bxgLyFlag = false;
        }
 
        if (this.InspectData.irresponsibleReason__c == "其他(可手动填写)" &&  (this.InspectData.irresponsibleReasonOther__c == undefined || this.InspectData.irresponsibleReasonOther__c == "" )) {
            this.qtLyFlag = true;
            flag = false;
        }else{
            this.qtLyFlag = false;
        }
 
        if (flag) {
            debugger;
 
            var IsInsert = this.InspectData.Id==undefined?"是":"否";
            if (temp == 1) {
                ChangeDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                    if (response.indexOf("成功") != -1) {
                        this.Alert("提交成功");
                        this.DisabledSet();
 
                        this.IsCheck = true;
 
 
                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                    }else{
                        this.Alert(response,true);
                        this.IsCheck = true;
                    }
                });
            }else
            {
                SaveDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("保存成功",false,true);
                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                        this.IsCheck = true;
                    }else{
                        this.Alert(response,true);
                        this.IsCheck = true;
                    }
                });
            }
        }
    }
    IsCheck  = true;
 
 
 
    CheckFn()
    {
        
        this.saveFn(null,1);
 
    }
 
 
 
 
    DisabledSet()
    {
        var inputs = this.template.querySelectorAll('input');
        inputs.forEach(fileInput=>{
            fileInput.disabled = true;
        })
        
        var buttons = this.template.querySelectorAll('button');
        buttons.forEach(fileInput=>{
            fileInput.disabled = true;
        })
 
        var combobox = this.template.querySelectorAll('lightning-combobox');
        combobox.forEach(box=>{
            box.disabled = true;
        })
       
 
    }
 
 
 
 
 
 
 
 
}