forked from verdnatura/salix-front
Merge branch 'dev' into 7354_ZoneMigration_End
This commit is contained in:
commit
a0aa902fe3
|
@ -87,6 +87,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
defaultTrim: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -198,6 +202,7 @@ async function save() {
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
|
formData.value = trimData(formData.value);
|
||||||
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
|
@ -256,6 +261,14 @@ function updateAndEmit(evt, val, res) {
|
||||||
emit(evt, state.get(modelValue), res);
|
emit(evt, state.get(modelValue), res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trimData(data) {
|
||||||
|
if (!$props.defaultTrim) return data;
|
||||||
|
for (const key in data) {
|
||||||
|
if (typeof data[key] == 'string') data[key] = data[key].trim();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
save,
|
save,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|
|
@ -325,7 +325,7 @@ defineExpose({
|
||||||
col?.columnFilter !== false &&
|
col?.columnFilter !== false &&
|
||||||
col?.name !== 'tableActions'
|
col?.name !== 'tableActions'
|
||||||
"
|
"
|
||||||
v-model="orders[col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
@ -419,7 +419,7 @@ defineExpose({
|
||||||
style="height: 30px"
|
style="height: 30px"
|
||||||
>
|
>
|
||||||
<VnTableOrder
|
<VnTableOrder
|
||||||
v-model="orders[col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:label="col?.label"
|
:label="col?.label"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
|
|
|
@ -50,7 +50,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('claim.attendedBy'),
|
label: t('claim.attendedBy'),
|
||||||
name: 'attendedBy',
|
name: 'attendedBy',
|
||||||
cardVisible: true,
|
orderBy: 'workerFk',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -63,6 +63,7 @@ const columns = computed(() => [
|
||||||
optionFilter: 'firstName',
|
optionFilter: 'firstName',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
Loading…
Reference in New Issue