refactor: update product structure in task list and enhance key usage in v-for loops
This commit is contained in:
parent
a66347414a
commit
6df79dae80
1 changed files with 23 additions and 12 deletions
|
|
@ -51,7 +51,7 @@ const bankList = ref<BankBook[]>([]);
|
|||
const worker = ref<Employee[]>([]);
|
||||
const taskListGroup = ref<
|
||||
{
|
||||
product: RequestWork['productService']['product'];
|
||||
product: RequestWork['productService'];
|
||||
list: RequestWork[];
|
||||
}[]
|
||||
>([]);
|
||||
|
|
@ -59,7 +59,7 @@ const taskListGroup = ref<
|
|||
const elements = ref<HTMLElement[]>([]);
|
||||
const chunks = ref<
|
||||
{
|
||||
product: RequestWork['productService']['product'];
|
||||
product: RequestWork['productService'];
|
||||
list: RequestWork[];
|
||||
}[][]
|
||||
>([[]]);
|
||||
|
|
@ -112,6 +112,7 @@ async function getAttachment(quotationId: string) {
|
|||
}
|
||||
|
||||
async function assignData() {
|
||||
console.log(taskListGroup.value);
|
||||
for (let i = 0; i < taskListGroup.value.length; i++) {
|
||||
let el = elements.value.at(-1);
|
||||
|
||||
|
|
@ -269,7 +270,7 @@ function print() {
|
|||
<PrintButton solid @click="print" />
|
||||
</div>
|
||||
<div class="row justify-between container color-debit-note">
|
||||
<section class="content" v-for="chunk in chunks">
|
||||
<section class="content" v-for="(chunk, i) in chunks" :key="i">
|
||||
<ViewHeader
|
||||
v-if="!!branch && !!customer && !!details"
|
||||
:branch="branch"
|
||||
|
|
@ -300,23 +301,31 @@ function print() {
|
|||
<th>{{ $t('preview.pricePerUnit') }}</th>
|
||||
<th>{{ $t('preview.value') }}</th>
|
||||
</tr>
|
||||
<tr v-for="(v, i) in chunk">
|
||||
{{ console.log(chunks) }}
|
||||
{{ console.log(chunk) }}
|
||||
<tr v-for="(v, i) in chunk" :key="i">
|
||||
<td class="text-center">{{ i + 1 }}</td>
|
||||
<td>{{ v.product.code }}</td>
|
||||
<td>{{ v.product.name }}</td>
|
||||
<td>{{ v.product.product.code }}</td>
|
||||
<td>{{ v.product.product.name }}</td>
|
||||
<td style="text-align: center">
|
||||
{{
|
||||
formatNumberDecimal(
|
||||
calcPricePerUnit(v.product) +
|
||||
(v.product.calcVat
|
||||
? calcPricePerUnit(v.product) * (config?.vat || 0.07)
|
||||
calcPricePerUnit(v.product.product) +
|
||||
(v.product.product.calcVat
|
||||
? calcPricePerUnit(v.product.product) *
|
||||
(config?.vat || 0.07)
|
||||
: 0),
|
||||
2,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{{ formatNumberDecimal(calcPrice(v.product, v.list.length), 2) }}
|
||||
{{
|
||||
formatNumberDecimal(
|
||||
calcPrice(v.product.product, v.list.length),
|
||||
2,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
@ -513,14 +522,16 @@ function print() {
|
|||
</section>
|
||||
|
||||
<section
|
||||
v-for="item in attachmentList.filter((v) => v.isImage)"
|
||||
v-for="(item, i) in attachmentList.filter((v) => v.isImage)"
|
||||
:key="i"
|
||||
class="content"
|
||||
>
|
||||
<q-img :src="item.url" />
|
||||
</section>
|
||||
|
||||
<ViewPDF
|
||||
v-for="item in attachmentList.filter((v) => v.isPDF)"
|
||||
v-for="(item, i) in attachmentList.filter((v) => v.isPDF)"
|
||||
:key="i"
|
||||
:url="item.url"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue