19626
2023-06-06 b28b7983fd65d7e3da0e6a57ba1754899f036971
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
<!--
 * @Description: 
 * @version: 
 * @Author: chen jing wu
 * @Date: 2023-04-20 17:16:48
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-06-06 14:00:41
-->
<template>
    
    <template if:true={isCreateOrEdit}>
        <lightning-card id="my-element1" class="card"  variant="Narrow" data-id="my-card">
            <div style="padding: 0 20px">
                <lightning-layout>
                    <lightning-layout-item>
                        <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;">失单报告编辑页面</div>
                    </lightning-layout-item>
                    <div style="margin-left: 550px;">
                        <lightning-layout-item  size="12">
                            <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button>
                            <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button>
                            <lightning-button label="返回询价" onclick={cancel}></lightning-button>
                        </lightning-layout-item>
                    </div>
                </lightning-layout>
                <div style="margin-top: 5px">
                    <lightning-layout>
                        <lightning-layout-item size="3" padding="around-small">
                            <div class="slds-form_horizontal my-combobox">
                                <label class="slds-form-element__label">失单类型:</label>
                                <lightning-combobox name="progress" value={LostReport.lostReport.LostType__c} options={RecordTypeOptions} 
                                    onchange={handleLostTypeChange} class="searchField" required>
                                </lightning-combobox>
                            </div>   
                        </lightning-layout-item>
                        <lightning-layout-item size="4" padding="around-small">
                            <div style="padding: 10px 3px;font: 16px;">失单总金额(元):{LostReport.lostReport.LostTotalAmount__c}</div>
                        </lightning-layout-item>
                        <lightning-layout-item size="3" padding="around-small">
                            <div style="padding: 10px 3px;font: 16px;">包含超声:{LostReport.lostReport.InclusionUltrasound__c}</div>
                        </lightning-layout-item>
                        <lightning-layout-item size="3" padding="around-small">
                            <div style="padding: 10px 3px;font: 16px;">状态:{LostReport.lostReport.Report_Status__c}</div>
                        </lightning-layout-item>
                    </lightning-layout>
                        <lightning-accordion allow-multiple-sections-open class="myAccordion">
                                <template for:each={LostReport.LostBrands} for:item="brand" for:index="i">
                                    <li key={brand.index}>
                                        <lightning-accordion-section class="" data-id={i} name="失单品牌" label="失单品牌">
                                            <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button>
                                            <lightning-button name={i} label="删除" onclick={deleteBrandJs} disabled={isBrandCount2}></lightning-button>
                                            <lightning-layout>
                                                <lightning-layout-item size="4" padding="around-small">
                                                    <template if:true={isEdit}>
                                                        <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " placeholder={brand.lostBrand.Lost_By_Company__c} required></c-multi-select-combobox>
                                                    </template>
                                                    <template if:false={isEdit}>
                                                        <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " required></c-multi-select-combobox>
                                                    </template> 
                                                </lightning-layout-item>
                                                <lightning-layout-item flexibility="auto" padding="around-small">
                                                    <lightning-combobox name={i} label="失单原因(主):" value={brand.lostBrand.Lost_reason_main__c} options={columns2} 
                                                    onchange={handleLostReasonMainChange} class="searchField" required></lightning-combobox>
                                                </lightning-layout-item>
                                                <lightning-layout-item flexibility="auto" padding="around-small">
                                                    <lightning-combobox name={i} label="失单原因(次):" value={brand.lostBrand.Lost_Reason_Sub__c} options={columns2} 
                                                    onchange={handleLostReasonSubChange} class="searchField"></lightning-combobox>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                            <lightning-layout> 
                                                <lightning-layout-item size="4" padding="horizontal-small">
                                                    <lightning-input name={i} data-id="Lost_By_Company_Mannual" value={brand.lostBrand.Lost_By_Company_Mannual__c} type="text" label="失单品牌(手动): " class="searchField" onchange={handleLostByCompanyMannualChange}></lightning-input>
                                                </lightning-layout-item>
                                                <lightning-layout-item size="4" padding="horizontal-small">
                                                    <lightning-input data-id="TotalAmount" name={i} value={brand.lostBrand.LostPrice__c} type="number" label="失单金额(元): " class="searchField" onchange={handleLostPriceOutChange} required></lightning-input>
                                                </lightning-layout-item>
                                                <lightning-layout-item size="4" padding="horizontal-small">
                                                    <lightning-record-edit-form
                                                        object-api-name='PCLLostBrand__c'
                                                        record-id=''
                                                    >
                                                        <lightning-input-field value={brand.lostBrand.Agency__c} name={i} field-name='Agency__c' onchange={handleAgencyOutChange} required> </lightning-input-field>
                                                    </lightning-record-edit-form>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                            <lightning-layout>
                                                <lightning-layout-item size="4" padding="horizontal-small">
                                                    <lightning-input name={i} value={brand.lostBrand.AgencyMannual__c} type="text" label="中标经销商(手动):" class="searchField" onchange={handleAgencyMannualOutChange}></lightning-input>                                                         
                                                </lightning-layout-item>
                                    
                                            </lightning-layout>
                                            <lightning-layout>
                                                <lightning-layout-item flexibility="auto" padding="around-small">
                                                    <template if:true={isInit}>
                                                        <div class="slds-card__body slds-card__body_inner">
                                                            <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-var-m-bottom_large"> 
                                                                <thead>
                                                                    <tr class="slds-text-title_caps">
                                                                            <th><div class="slds-truncate">失单品牌</div></th>
                                                                            <th><div class="slds-truncate">失单对手型号</div></th>
                                                                            <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单数量</div></th>
                                                                            <th><div class="slds-truncate">失单对手型号(手动)</div></th>
                                                                            <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单产品类别</div></th>
                                                                            <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单产品区分</div></th>
                                                                            <th></th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                    <template for:each={brand.LostProducts} for:item="product" for:index="j">
                                                                        <tr class="inputRows" key={product}>
                                                                            <td>
                                                                               <lightning-combobox placeholder={product.LostProductss.LostBrandName__c} data-id={i} class="BrandName" name={j} title={i} options={brandOptions} value={product.LostProductss.LostBrandName__c} onchange={handleLostBrandNameChange} read-only="true"></lightning-combobox> 
                                                                            </td>
                                                                            <td>
                                                                                <!-- <lightning-record-edit-form
                                                                                object-api-name='PCLLostProduct__c'
                                                                                >
                                                                                    <lightning-input-field class="LostProduct" data-id={i} title={i} value={product.LostProductss.LostProduct__c} name={j} field-name='LostProduct__c' onchange={handleLostProductChange} variant="label-hidden"> </lightning-input-field>
                                                                                </lightning-record-edit-form>  -->
                                                                                <template if:true={isEdit}>
                                                                                    <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected} init-value={product.productName}></c-lex-lookup-lwc>
                                                                                </template>
                                                                                <template if:false={isEdit}>
                                                                                    <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected}></c-lex-lookup-lwc>
                                                                                </template>
                                                                            </td>
                                                                            <td>
                                                                               <lightning-input class="Quantity" title={i} name={j} value={product.LostProductss.Quantity__c} onchange={handleQuantityChange}></lightning-input>
                                                                            </td>
                                                                            <td>
                                                                                <lightning-input class="LostProductMannual" title={i} name={j} value={product.LostProductss.LostProductMannual__c} onchange={handleLostProductMannualChange}></lightning-input>
                                                                            </td>
                                                                            <td>
                                                                                <lightning-combobox class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox> 
                                                                            </td>
                                                                            <td>
                                                                                <lightning-combobox class="ProductCategory" data-id={i} placeholder="--无--" title={i} name={j} options={product.productOptions} value={product.LostProductss.ProductCategory__c} onchange={handleProductCategoryChange} read-only="true"></lightning-combobox> 
                                                                            </td>
                            
                                                                            <td>
                                                                                <lightning-button-icon name={i} icon-name="utility:add" value={j} variant="bare" onclick={addRow}></lightning-button-icon>
                                                                            </td>
                                                                            <td>
                                                                                <lightning-button-icon class="deleteButton" data-id={i} name={i} icon-name="utility:delete" value={j} variant="bare" onclick={removeRow}></lightning-button-icon>
                                                                            </td>
                                                                        </tr>
                                                                    </template>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </template>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                        </lightning-accordion-section>
                                    </li>
                                </template>
                        </lightning-accordion>
                        <lightning-layout style="margin-top: 20px;">
                            <div class="slds-align_absolute-center">
                                <lightning-layout-item size="12">
                                    <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button>
                                    <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button>
                                    <lightning-button label="返回询价" onclick={cancel}></lightning-button>
                                </lightning-layout-item>
                            </div>
                        </lightning-layout>
                </div>
            </div>   
        </lightning-card>
    </template>
    <template if:true={isView}>
            <lightning-card id="my-element2" class="card"  variant="Narrow" data-id="my-card">
                <div style="padding: 0 20px">
                    <lightning-layout>
                        <lightning-layout-item>
                            <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;">失单报告查看页面</div>
                        </lightning-layout-item>
                        <div style="margin-left: 550px;">
                            <lightning-layout-item  size="12">
                                <lightning-button label="提交" onclick={submitJs}></lightning-button>
                                <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button>
                                <lightning-button label="返回询价" onclick={cancel}></lightning-button>
                            </lightning-layout-item>
                        </div>
                    </lightning-layout>
                    <div style="margin-top: 5px">
                        <lightning-layout>
                            <lightning-layout-item size="1">
                                <label>失单类型:</label>
                            </lightning-layout-item>
                            <lightning-layout-item size="1">
                                <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy">
                                    <lightning-output-field field-name="LostType__c" variant="label-hidden"></lightning-output-field>
                                </lightning-record-view-form> 
                            </lightning-layout-item>
                            <lightning-layout-item size="1"></lightning-layout-item>
                            <lightning-layout-item size="2">
                                <label>失单总金额(元):</label>
                            </lightning-layout-item>
                            <lightning-layout-item size="1">
                                <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy">
                                    <lightning-output-field field-name="LostTotalAmount__c" variant="label-hidden"></lightning-output-field>
                                </lightning-record-view-form> 
                            </lightning-layout-item>
                            <lightning-layout-item size="1"></lightning-layout-item>
                            <lightning-layout-item size="1">
                                <label>包含超声:</label>
                            </lightning-layout-item>
                            <lightning-layout-item size="1">
                                <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy">
                                    <lightning-output-field field-name="InclusionUltrasound__c" variant="label-hidden"></lightning-output-field>
                                </lightning-record-view-form> 
                            </lightning-layout-item>
                            <lightning-layout-item size="1"></lightning-layout-item>
                            <lightning-layout-item size="1">
                                <label>状态:</label>
                            </lightning-layout-item>
                            <lightning-layout-item size="1">
                                <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy">
                                    <lightning-output-field field-name="Report_Status__c" variant="label-hidden"></lightning-output-field>
                                </lightning-record-view-form> 
                            </lightning-layout-item> 
                        </lightning-layout>
                            <lightning-accordion allow-multiple-sections-open class="myAccordion">
                                    <template for:each={LostReport.LostBrands} for:item="brand" for:index="i">
                                        <li key={brand.index}>
                                            <lightning-accordion-section class="text-container" data-id={i} name="失单品牌" label="失单品牌">
                                                <lightning-layout>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>失单品牌:</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="Lost_By_Company__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>失单原因(主):</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="Lost_reason_main__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>失单原因(次):</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="Lost_Reason_Sub__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form>
                                                    </lightning-layout-item>
                                                </lightning-layout>
                                                <lightning-layout> 
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>失单品牌(手动):</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="Lost_By_Company_Mannual__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>失单金额(元):</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="LostPrice__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>中标经销商:</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="Agency__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                </lightning-layout>
                                                <lightning-layout>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <label>中标经销商(手动):</label>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;">
                                                        <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy">
                                                            <lightning-output-field field-name="AgencyMannual__c" variant="label-hidden"></lightning-output-field>
                                                        </lightning-record-view-form> 
                                                    </lightning-layout-item>
                                                </lightning-layout>
                                                <lightning-layout>
                                                    <lightning-layout-item flexibility="auto" padding="around-small">
                                                        <template if:true={isInit}>
                                                            <lightning-datatable hide-checkbox-column="true" key-field="is" columns={columns3} data={getData}></lightning-datatable>
                                                        </template>
                                                    </lightning-layout-item>
                                                </lightning-layout>
                                            </lightning-accordion-section>
                                        </li>
                                    </template>
                            </lightning-accordion>
                            <lightning-layout style="margin-top: 20px;">
                                <div class="slds-align_absolute-center">
                                    <lightning-layout-item size="12">
                                        <lightning-button label="提交" onclick={submitJs}></lightning-button>
                                        <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button>
                                        <lightning-button label="返回询价" onclick={cancel}></lightning-button>
                                    </lightning-layout-item>
                                </div>
                            </lightning-layout>
                    </div>
                </div>   
            </lightning-card>
    </template>
</template>