fix(05): slip file display
This commit is contained in:
parent
8d87368a7c
commit
2abdc093a1
2 changed files with 25 additions and 8 deletions
|
|
@ -1,7 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useConfigStore } from 'stores/config';
|
import { useConfigStore } from 'stores/config';
|
||||||
import { formatNumberDecimal, commaInput, deleteItem } from 'stores/utils';
|
import {
|
||||||
|
formatNumberDecimal,
|
||||||
|
commaInput,
|
||||||
|
deleteItem,
|
||||||
|
convertFileSize,
|
||||||
|
} from 'stores/utils';
|
||||||
import DialogForm from 'src/components/DialogForm.vue';
|
import DialogForm from 'src/components/DialogForm.vue';
|
||||||
import { reactive, ref, watch } from 'vue';
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { useQuotationPayment } from 'src/stores/quotations';
|
import { useQuotationPayment } from 'src/stores/quotations';
|
||||||
|
|
@ -61,9 +66,9 @@ watch(
|
||||||
paymentId: v.id,
|
paymentId: v.id,
|
||||||
file: [],
|
file: [],
|
||||||
}));
|
}));
|
||||||
console.log(ret);
|
// console.log(ret);
|
||||||
console.log(paymentData.value);
|
// console.log(paymentData.value);
|
||||||
console.log(slipFile.value);
|
// console.log(slipFile.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -470,12 +475,11 @@ watch(
|
||||||
class="app-text-muted"
|
class="app-text-muted"
|
||||||
/>
|
/>
|
||||||
<article class="col column q-pl-md">
|
<article class="col column q-pl-md">
|
||||||
{{ console.log(file) }}
|
|
||||||
<span>{{ file.name }}</span>
|
<span>{{ file.name }}</span>
|
||||||
<span class="text-caption app-text-muted-2">
|
<span class="text-caption app-text-muted-2">
|
||||||
{{ file.size }} •
|
{{ convertFileSize(file.size) }} •
|
||||||
<q-spinner-ios
|
<q-spinner-ios
|
||||||
v-if="i % 2 === 0"
|
v-if="false"
|
||||||
class="q-mx-xs"
|
class="q-mx-xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="1.5em"
|
size="1.5em"
|
||||||
|
|
@ -486,7 +490,7 @@ watch(
|
||||||
color="positive"
|
color="positive"
|
||||||
size="1rem"
|
size="1rem"
|
||||||
/>
|
/>
|
||||||
Uploading...
|
{{ false ? `Uploading...` : 'Completed' }}
|
||||||
</span>
|
</span>
|
||||||
</article>
|
</article>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
|
||||||
|
|
@ -445,4 +445,17 @@ export function commaInput(text: string): string {
|
||||||
return integerPart + (decimalPart ? `.${decimalPart}` : '');
|
return integerPart + (decimalPart ? `.${decimalPart}` : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function convertFileSize(size: number): string {
|
||||||
|
if (size === undefined) return 'Unknow size';
|
||||||
|
|
||||||
|
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
let sizeNumber = typeof size === 'string' ? parseFloat(size) : size;
|
||||||
|
while (sizeNumber >= 1024 && i++ < units.length - 1) {
|
||||||
|
sizeNumber /= 1024;
|
||||||
|
}
|
||||||
|
return sizeNumber.toFixed(2) + ' ' + units[i];
|
||||||
|
}
|
||||||
|
|
||||||
export default useUtilsStore;
|
export default useUtilsStore;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue