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">
|
||||
import { storeToRefs } from 'pinia';
|
||||
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 { reactive, ref, watch } from 'vue';
|
||||
import { useQuotationPayment } from 'src/stores/quotations';
|
||||
|
|
@ -61,9 +66,9 @@ watch(
|
|||
paymentId: v.id,
|
||||
file: [],
|
||||
}));
|
||||
console.log(ret);
|
||||
console.log(paymentData.value);
|
||||
console.log(slipFile.value);
|
||||
// console.log(ret);
|
||||
// console.log(paymentData.value);
|
||||
// console.log(slipFile.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -470,12 +475,11 @@ watch(
|
|||
class="app-text-muted"
|
||||
/>
|
||||
<article class="col column q-pl-md">
|
||||
{{ console.log(file) }}
|
||||
<span>{{ file.name }}</span>
|
||||
<span class="text-caption app-text-muted-2">
|
||||
{{ file.size }} •
|
||||
{{ convertFileSize(file.size) }} •
|
||||
<q-spinner-ios
|
||||
v-if="i % 2 === 0"
|
||||
v-if="false"
|
||||
class="q-mx-xs"
|
||||
color="primary"
|
||||
size="1.5em"
|
||||
|
|
@ -486,7 +490,7 @@ watch(
|
|||
color="positive"
|
||||
size="1rem"
|
||||
/>
|
||||
Uploading...
|
||||
{{ false ? `Uploading...` : 'Completed' }}
|
||||
</span>
|
||||
</article>
|
||||
<q-btn
|
||||
|
|
|
|||
|
|
@ -445,4 +445,17 @@ export function commaInput(text: string): string {
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue