refactor: refs #7356 requested changes
This commit is contained in:
parent
b2b613a1d4
commit
78e074d2fb
|
@ -8,15 +8,29 @@ const $props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
find: {
|
find: {
|
||||||
type: String,
|
type: [String, Array],
|
||||||
default: null,
|
default: null,
|
||||||
|
description: 'search in row to add default options',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const options = ref([]);
|
const options = ref([]);
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const { url } = useAttrs();
|
const { url, optionValue, optionLabel } = useAttrs();
|
||||||
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||||
if (findBy) options.value = [$props.row[findBy]];
|
if (!findBy || !$props.row) return;
|
||||||
|
// is array
|
||||||
|
if (Array.isArray(findBy)) {
|
||||||
|
const [id, name] = findBy;
|
||||||
|
if (!$props.row[id] || !$props.row[name]) return;
|
||||||
|
return (options.value = [
|
||||||
|
{
|
||||||
|
[optionValue ?? 'id']: $props.row[id],
|
||||||
|
[optionLabel ?? 'name']: $props.row[name],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// is string
|
||||||
|
if ($props.row[findBy]) options.value = [$props.row[findBy]];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'state',
|
name: 'state',
|
||||||
label: t('ticketList.state'),
|
label: t('ticketList.state'),
|
||||||
cardVisible: true,
|
|
||||||
chip: {
|
chip: {
|
||||||
condition: () => true,
|
condition: () => true,
|
||||||
color: (row) => {
|
color: (row) => {
|
||||||
|
@ -54,9 +53,6 @@ const columns = computed(() => [
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { onMounted, ref, computed, onUnmounted } from 'vue';
|
import { onMounted, ref, computed, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnSelectCache from 'src/components/common/VnSelectCache.vue';
|
||||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
@ -17,7 +18,6 @@ const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const agencyModesOptions = ref([]);
|
|
||||||
const allColumnNames = ref([]);
|
const allColumnNames = ref([]);
|
||||||
|
|
||||||
const arrayData = useArrayData('WeeklyTickets');
|
const arrayData = useArrayData('WeeklyTickets');
|
||||||
|
@ -91,10 +91,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
},
|
},
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -219,15 +215,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #column-agencyModeFk="{ row }">
|
<template #column-agencyModeFk="{ row }">
|
||||||
<VnSelect
|
<VnSelectCache
|
||||||
url="AgencyModes/isActive"
|
url="AgencyModes/isActive"
|
||||||
:options="agencyModesOptions"
|
:row="row"
|
||||||
hide-selected
|
:find="['agencyModeFk', 'agencyModeName']"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="row.agencyModeFk"
|
v-model="row.agencyModeFk"
|
||||||
@update:model-value="onUpdate(row.ticketFk, 'agencyModeFk', $event)"
|
@update:model-value="onUpdate(row.ticketFk, 'agencyModeFk', $event)"
|
||||||
/>
|
>
|
||||||
|
{{ console.log('row: ', row) }}
|
||||||
|
</VnSelectCache>
|
||||||
</template>
|
</template>
|
||||||
<template #column-clientFk="{ row }">
|
<template #column-clientFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
Loading…
Reference in New Issue