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