Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -126,12 +126,16 @@
|
|||||||
dense
|
dense
|
||||||
filled
|
filled
|
||||||
use-input
|
use-input
|
||||||
|
fill-input
|
||||||
|
hide-selected
|
||||||
|
input-debounce="0"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
:options="productCodeSelectOptions"
|
:options="productCodeSelectOptions"
|
||||||
label="Eski Kod Sec"
|
label="Eski Kod Sec"
|
||||||
|
@filter="onFilterProductCode"
|
||||||
@update:model-value="val => onSelectProduct(props.row, val)"
|
@update:model-value="val => onSelectProduct(props.row, val)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -419,12 +423,36 @@ const newItemEntryModeOptions = [
|
|||||||
{ label: 'Eski Kod Sec', value: 'selected' },
|
{ label: 'Eski Kod Sec', value: 'selected' },
|
||||||
{ label: 'Yeni Kod Ekle', value: 'typed' }
|
{ label: 'Yeni Kod Ekle', value: 'typed' }
|
||||||
]
|
]
|
||||||
const productCodeSelectOptions = computed(() =>
|
const productCodeAllOptions = computed(() =>
|
||||||
(productOptions.value || []).map(p => {
|
(productOptions.value || []).map(p => {
|
||||||
const code = String(p?.ProductCode || '').trim().toUpperCase()
|
const code = String(p?.ProductCode || '').trim().toUpperCase()
|
||||||
return { label: code, value: code }
|
return { label: code, value: code }
|
||||||
}).filter(x => !!x.value && x.value.length === 13)
|
}).filter(x => !!x.value && x.value.length === 13)
|
||||||
)
|
)
|
||||||
|
const productCodeSelectOptions = ref([])
|
||||||
|
|
||||||
|
watch(
|
||||||
|
productCodeAllOptions,
|
||||||
|
(list) => {
|
||||||
|
productCodeSelectOptions.value = Array.isArray(list) ? [...list] : []
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
function onFilterProductCode (val, update) {
|
||||||
|
const needle = normalizeSearchText(val)
|
||||||
|
update(() => {
|
||||||
|
if (!needle) {
|
||||||
|
productCodeSelectOptions.value = [...productCodeAllOptions.value]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
productCodeSelectOptions.value = (productCodeAllOptions.value || []).filter(opt => {
|
||||||
|
const label = normalizeSearchText(opt?.label || '')
|
||||||
|
const value = normalizeSearchText(opt?.value || '')
|
||||||
|
return label.includes(needle) || value.includes(needle)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function applyNewItemVisualState (row, source = 'typed') {
|
function applyNewItemVisualState (row, source = 'typed') {
|
||||||
const info = store.classifyItemCode(row?.NewItemCode || '')
|
const info = store.classifyItemCode(row?.NewItemCode || '')
|
||||||
@@ -923,9 +951,7 @@ async function openAttributeDialog (itemCode) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const modeInfo = store.classifyItemCode(code)
|
const modeInfo = store.classifyItemCode(code)
|
||||||
const dbCurrent = modeInfo.mode === 'existing'
|
const dbCurrent = await store.fetchProductItemAttributes(code, 1, true)
|
||||||
? await store.fetchProductItemAttributes(code, 1)
|
|
||||||
: []
|
|
||||||
|
|
||||||
const dbMap = new Map(
|
const dbMap = new Map(
|
||||||
(dbCurrent || []).map(x => [
|
(dbCurrent || []).map(x => [
|
||||||
@@ -934,12 +960,22 @@ async function openAttributeDialog (itemCode) {
|
|||||||
]).filter(x => x[0] > 0)
|
]).filter(x => x[0] > 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
const baseRows = fromLookup.map(row => ({
|
const baseRows = fromLookup.map(row => {
|
||||||
...row,
|
const currentCode = dbMap.get(Number(row.AttributeTypeCodeNumber || 0)) || ''
|
||||||
AttributeCode: dbMap.get(Number(row.AttributeTypeCodeNumber || 0)) || ''
|
const currentOptions = Array.isArray(row.options) ? [...row.options] : []
|
||||||
}))
|
if (currentCode && !currentOptions.some(opt => String(opt?.value || '').trim() === currentCode)) {
|
||||||
|
currentOptions.unshift({ value: currentCode, label: `${currentCode} - (Mevcut)` })
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...row,
|
||||||
|
AttributeCode: currentCode,
|
||||||
|
AllOptions: currentOptions,
|
||||||
|
Options: [...currentOptions]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
attributeRows.value = Array.isArray(existingDraft) && existingDraft.length
|
const useDraft = modeInfo.mode !== 'existing' && Array.isArray(existingDraft) && existingDraft.length
|
||||||
|
attributeRows.value = useDraft
|
||||||
? JSON.parse(JSON.stringify(existingDraft))
|
? JSON.parse(JSON.stringify(existingDraft))
|
||||||
: JSON.parse(JSON.stringify(baseRows))
|
: JSON.parse(JSON.stringify(baseRows))
|
||||||
for (const row of (attributeRows.value || [])) {
|
for (const row of (attributeRows.value || [])) {
|
||||||
@@ -950,7 +986,7 @@ async function openAttributeDialog (itemCode) {
|
|||||||
row.Options = [...row.AllOptions]
|
row.Options = [...row.AllOptions]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((!existingDraft || !existingDraft.length) && baseRows.length) {
|
if ((!existingDraft || !existingDraft.length || modeInfo.mode === 'existing') && baseRows.length) {
|
||||||
store.setProductAttributeDraft(code, JSON.parse(JSON.stringify(baseRows)))
|
store.setProductAttributeDraft(code, JSON.parse(JSON.stringify(baseRows)))
|
||||||
}
|
}
|
||||||
attributeDialogOpen.value = true
|
attributeDialogOpen.value = true
|
||||||
|
|||||||
Reference in New Issue
Block a user