buli
2023-05-04 d4a4ce824f3b2f3a335a3ad8e8c9efb3b37d630f
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
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init  from '@salesforce/apex/QISReportController.initForlexCreateRepairButton';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import { updateRecord } from 'lightning/uiRecordApi';
 
export default class lexCreateRepair extends LightningElement {
    @api recordId;
    IsLoading = true;
    typeflag = false;
    newflag = false;
    qisReportId='';
    name='';
    qisRecordTypeId='';
    err='';
    accParentId='';
    accParentRecordTypeId='';
    accParentParentFSEGIMainLeader='';
    accParentParentFSEGIMainLeaderWorkLocation='';
    accParentParentFSESPMainLeader='';
    accParentParentFSESPMainLeaderWorkLocation='';
    WorkLocation='';
    accrecordId='';
    oCMjudgement='';
    nextaction='';
    specialfollow='';
    comment='';
    isUsedForTheOpera='';
    UseFailProductFinish='';
    failuerSituation='';
    sourceOnCall='';
    hospitalId='';
    departmentClassId='';
    hospitalDepartment='';
    nonyushohinId='';
    ownerId='';
    faliourdate='';
    sourceforrepair='';
    repairSalesPointProvinceChina='';
    trableoccurdaYcollect='';
    damageForDocOrPat='';
    relationWithTheProblem='';
    reportForGoz='';
    whichProject='';
    operaName='';
    breakORFallOff='';
    setusageproduct='';
    afterFailureInformation='';
    delay15Min='';
    informationFrom='';
    failureQInHospital='';
    ownername='';
    hospitalname = '';
    departmentClassname = '';
    hospitalDepartmentname = '';
    nonyushohinIdname = '';
    sourceOnCallname = '';
 
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
             console.log(111);
             console.log(currentPageReference);
 
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             console.log("str");
             console.log(str);
             this.recordId = str;
           }
         }
    }
 
    connectedCallback () {
        init({
            recordId: this.recordId
        }).then(result => {
            this.IsLoading = false;
            this.qisReportId = result.Id;
            this.oCMjudgement = result.oCMjudgement;
            this.nextaction = result.nextaction;
            this.ownername = result.ownername;
            this.specialfollow = result.specialfollow;
            this.qisRecordTypeId = result.qisRecordTypeId;
            this.accParentId = result.accParentId;
            this.comment = result.comment;
            if (result.sourceOnCall!=null) {
                this.sourceOnCall = result.sourceOnCall;
                this.sourceOnCallname = result.sourceOnCallname;
            }
            this.name = result.name;
            this.hospitalId = result.hospitalId;
            this.hospitalname = result.hospitalname;
            this.departmentClassname = result.departmentClassname;
            this.departmentClassId = result.departmentClassId;
            this.hospitalDepartment = result.hospitalDepartment;
            this.nonyushohinId = result.nonyushohinId;
            this.ownerId = result.ownerId;
            this.faliourdate = result.faliourdate;
            this.sourceforrepair = result.sourceforrepair;
            this.repairSalesPointProvinceChina = result.repairSalesPointProvinceChina;
            this.trableoccurdaYcollect = result.trableoccurdaYcollect;
            this.damageForDocOrPat = result.damageForDocOrPat;
            this.relationWithTheProblem = result.relationWithTheProblem;
            this.reportForGoz = result.reportForGoz;
            this.whichProject = result.whichProject;
            this.operaName = result.operaName;
            this.breakORFallOff = result.breakORFallOff;
            this.setusageproduct = result.setusageproduct;
            this.afterFailureInformation = result.afterFailureInformation;
            this.delay15Min = result.delay15Min;
            this.informationFrom = result.informationFrom;
            this.failureQInHospital = result.failureQInHospital;
            this.failuerSituation = result.failuerSituation;
            this.isUsedForTheOpera = result.isUsedForTheOpera;
            this.accParentRecordTypeId = result.accParentRecordTypeId;
            this.accParentParentFSEGIMainLeader = result.accParentParentFSEGIMainLeader;
            this.accParentParentFSEGIMainLeaderWorkLocation = result.accParentParentFSEGIMainLeaderWorkLocation;
            this.accParentParentFSESPMainLeader = result.accParentParentFSESPMainLeader;
            this.accParentParentFSESPMainLeaderWorkLocation = result.accParentParentFSESPMainLeaderWorkLocation;
             if (this.qisRecordTypeId != '01210000000RLWc' && this.qisRecordTypeId != '01210000000RLWh') {
                 this.typeflag = true;
             }
             if (this.accParentId != null) {
                 if (this.accParentRecordTypeId != null) {
                     this.accrecordId = this.accParentRecordTypeId.substring(0,15);
                     if (this.accrecordId == '01210000000QemL' || this.accrecordId == '01210000000QezZ' || this.accrecordId == '01210000000QemQ') {
                         if (this.accParentParentFSEGIMainLeader != null) {
                             this.WorkLocation = this.accParentParentFSEGIMainLeaderWorkLocation;
                         }
                     }else if(this.accrecordId == '01210000000Qeze' || this.accrecordId == '01210000000Qezj' || this.accrecordId == '01210000000Qezt'|| this.accrecordId == '01210000000Qezo'|| this.accrecordId == '01210000000Qezy'){
                         if (this.accParentParentFSESPMainLeader != null) {
                             this.WorkLocation = this.accParentParentFSESPMainLeaderWorkLocation;
                         }
                     }
                 }
             }
             if ((this.oCMjudgement == '质量问题' && this.nextaction == '无偿维修') ||
                 (this.oCMjudgement == '质量问题' && this.nextaction == '有偿维修' && this.specialfollow == '0') || 
                 (this.oCMjudgement == '非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == '1') || 
                 (this.oCMjudgement == '非质量问题' && this.nextaction == '有偿维修' && this.specialfollow == '0') || 
                 (this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == '1') || 
                 (this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '有偿维修+无偿维修' && this.specialfollow == '0') || 
                 (this.oCMjudgement == '现象未发现' && this.nextaction == '无偿维修' && this.specialfollow == '1') || 
                 (this.oCMjudgement == '现象未发现' && this.nextaction == '有偿维修' && this.specialfollow == '0')) {
                 this.newflag = true;
             }
             console.log('this.newflag = '+this.newflag);
             console.log('this.typeflag = '+this.typeflag);
             if ( this.newflag && this.typeflag) {
                 if (this.isUsedForTheOpera == 'YES') {
                     this.UseFailProductFinish = '是';
                 }else if(this.isUsedForTheOpera == 'NO-用替代品完成了'){
                     this.UseFailProductFinish = '否-用替代品完成';
                 }else if(this.isUsedForTheOpera == 'NO-用其他公司的同类产品完成了'){
                     this.UseFailProductFinish = '否-用其他公司的同类产品完成';
                 }else if(this.isUsedForTheOpera == 'NO-手术中止'){
                     this.UseFailProductFinish = '否-手术中止';
                 }
                 if ('使用前准备' == this.failuerSituation) {
                     this.failuerSituation = '使用前准备-患者未麻醉';
                 }
                 var url = '';
                     url = "/a0J/e?" +
                        "CF00N10000002FIJU_lkid="+this.sourceOnCall+"&" +
                        "CF00N10000002FIJU="+this.sourceOnCallname+"&" +
                        "CF00N10000002FIJZ_lkid="+this.qisReportId+"&" +
                        "CF00N10000002FIJZ="+this.name+"&" +
                        "CF00N10000002Dx66_lkid="+this.hospitalId+"&" +
                        "CF00N10000002Dx66="+this.hospitalname+"&" +
                        "CF00N10000002Dx5t_lkid="+this.departmentClassId+"&" +
                        "CF00N10000002Dx5t="+this.departmentClassname+"&" +
                        "CF00N10000002Dx5n_lkid="+this.hospitalDepartment+"&" +
                        "CF00N10000002Dx5n="+this.hospitalDepartmentname+"&" +
                        "CF00N10000002Dx1X_lkid="+this.nonyushohinId+"&" +
                        "CF00N10000002Dx1X="+this.nonyushohinIdname+"&" +
                        "CF00N10000002EMHw_lkid="+this.ownerId+"&" +
                        "CF00N10000002EMHw="+this.ownername+"&" +
                        "00N10000002Dx5y="+this.faliourdate+"&" +
                        "00N10000002Dx6I="+this.comment+"&" +
                        "00N10000002FH86="+this.sourceforrepair+"&" +
                        "00N10000006P6Rn="+this.repairSalesPointProvinceChina+"&" +
                        "00N10000008rsVQ="+this.trableoccurdaYcollect+"&" +
                        "00N10000008rsW7="+this.damageForDocOrPat+"&"+
                        "00N10000008rsVw="+this.relationWithTheProblem+"&"+
                        "00N10000008rsW2="+this.reportForGoz+"&"+
                        "00N10000008rsW6="+this.whichProject+"&"+
                        "00N10000008rsVk="+this.operaName+"&" +
                        "00N10000008rsVN="+this.breakORFallOff+"&"+
                        "00N10000008rsW4="+this.setusageproduct+"&" +
                        "00N10000008rsVL="+this.afterFailureInformation+"&" +
                        "00N10000008rsVR="+this.delay15Min+"&"+
                        "00N10000008rsVZ="+this.informationFrom+"&"+
                        "00N10000008rsVT="+this.failureQInHospital+"&" +
                        "00N10000008rsVv="+this.failuerSituation+"&"+
                        "00N10000008rsW5="+this.UseFailProductFinish+ "&" +
                        "00N10000006P6SM="+this.WorkLocation+ "&" +
                        "retURL=%2F"+this.qisReportId;
                        window.open(url, "_blank");
                        this.dispatchEvent(new CloseActionScreenEvent());
             }else{
                 const evt = new ShowToastEvent({
                        title : '该QIS不能新建修理',
                        message: '',
                        variant: 'error'
                    });
                    this.dispatchEvent(evt);
                this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             }
        }).catch(error => {
            
            const evt = new ShowToastEvent({
                        title : '发生错误',
                        message: '',
                        variant: 'error'
                    });
                    this.dispatchEvent(evt);
 
            this.dispatchEvent(new CloseActionScreenEvent());
            console.log('error='+error);
             return;
        }).finally(() => {
            
        }); 
    }
}