refactor: link request
This commit is contained in:
parent
5c3c8f3d6a
commit
15d30f3349
1 changed files with 24 additions and 7 deletions
|
|
@ -20,7 +20,7 @@ const columns = [
|
||||||
field: (e: RequestData & { _index: number }) => e._index + 1,
|
field: (e: RequestData & { _index: number }) => e._index + 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'code',
|
name: '#codeRequest',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
label: 'quotation.tableColumnsRequest.code',
|
label: 'quotation.tableColumnsRequest.code',
|
||||||
field: (v: RequestData) => v.code,
|
field: (v: RequestData) => v.code,
|
||||||
|
|
@ -35,7 +35,7 @@ const columns = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'requestDataStatus',
|
name: '#requestDataStatus',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: 'general.status',
|
label: 'general.status',
|
||||||
field: (v: RequestData) => v.requestDataStatus,
|
field: (v: RequestData) => v.requestDataStatus,
|
||||||
|
|
@ -47,6 +47,11 @@ const emits = defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const open = defineModel<boolean>('open', { default: false });
|
const open = defineModel<boolean>('open', { default: false });
|
||||||
|
|
||||||
|
function goToRequestList(id: string) {
|
||||||
|
const url = new URL(`/request-list/${id}`, window.location.origin);
|
||||||
|
window.open(url.toString(), '_blank');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -73,9 +78,7 @@ const open = defineModel<boolean>('open', { default: false });
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<q-th v-for="col in columns" :key="col.name" :props="props">
|
<q-th v-for="col in columns" :key="col.name" :props="props">
|
||||||
<template v-if="!col.name.startsWith('#')">
|
{{ $t(col.label) }}
|
||||||
{{ $t(col.label) }}
|
|
||||||
</template>
|
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -88,7 +91,7 @@ const open = defineModel<boolean>('open', { default: false });
|
||||||
<q-tr :class="{ dark: $q.dark.isActive }" class="text-center">
|
<q-tr :class="{ dark: $q.dark.isActive }" class="text-center">
|
||||||
<q-td v-for="col in columns" :align="col.align">
|
<q-td v-for="col in columns" :align="col.align">
|
||||||
<!-- NOTE: custom column will starts with # -->
|
<!-- NOTE: custom column will starts with # -->
|
||||||
<template v-if="col.name !== 'requestDataStatus'">
|
<template v-if="!col.name.startsWith('#')">
|
||||||
<span>
|
<span>
|
||||||
{{
|
{{
|
||||||
typeof col.field === 'string'
|
typeof col.field === 'string'
|
||||||
|
|
@ -98,7 +101,16 @@ const open = defineModel<boolean>('open', { default: false });
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<template v-if="col.name === '#codeRequest'">
|
||||||
|
<span
|
||||||
|
class="cursor-pointer link"
|
||||||
|
@click="goToRequestList(props.row.id)"
|
||||||
|
>
|
||||||
|
{{ props.row.code }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="col.name === '#requestDataStatus'">
|
||||||
<span>
|
<span>
|
||||||
<BadgeComponent
|
<BadgeComponent
|
||||||
:hsla-color="
|
:hsla-color="
|
||||||
|
|
@ -125,6 +137,11 @@ const open = defineModel<boolean>('open', { default: false });
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.link {
|
||||||
|
color: hsl(var(--info-bg));
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.selectable-item {
|
.selectable-item {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue