- corretto componente CDateTime
- aggiunto componente CDateTimeStartEnd
This commit is contained in:
@@ -16,6 +16,7 @@ import type { IColGridTable, IImgGallery, ISpecialField } from 'model';
|
||||
import { CMyChipList } from '../CMyChipList';
|
||||
import { CDate } from '../CDate';
|
||||
import { CDateTime } from '../CDateTime';
|
||||
import { CDateTimeStartEnd } from '../CDateTimeStartEnd';
|
||||
import { CLabel } from '../CLabel';
|
||||
import { CMyToggleList } from '../CMyToggleList';
|
||||
import { CMySelect } from '../CMySelect';
|
||||
@@ -110,11 +111,21 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
field2: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
subfield: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
subfield2: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
mysubsubkey: {
|
||||
type: String,
|
||||
required: false,
|
||||
@@ -229,6 +240,7 @@ export default defineComponent({
|
||||
components: {
|
||||
CMyChipList,
|
||||
CDateTime,
|
||||
CDateTimeStartEnd,
|
||||
CDate,
|
||||
CMyToggleList,
|
||||
CMySelect,
|
||||
@@ -250,6 +262,7 @@ export default defineComponent({
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
const myvalue = ref(null as any);
|
||||
const myvalue2 = ref(null as any);
|
||||
const myvalueprec = ref('false');
|
||||
const countryname = ref('');
|
||||
const visueditor = ref(false);
|
||||
@@ -391,6 +404,18 @@ export default defineComponent({
|
||||
props.mysubsubkey,
|
||||
props.specialField
|
||||
);
|
||||
myvalue2.value = getValDb(
|
||||
props.field2,
|
||||
props.serv,
|
||||
'',
|
||||
props.table,
|
||||
props.subfield2,
|
||||
props.id,
|
||||
props.idmain,
|
||||
props.indrec,
|
||||
'',
|
||||
props.specialField
|
||||
);
|
||||
} else {
|
||||
if (props.mycol && props.mycol.name) col.value = { ...props.mycol };
|
||||
}
|
||||
@@ -591,11 +616,14 @@ export default defineComponent({
|
||||
miorecord = myrow.value.arrvariazioni[0];
|
||||
}
|
||||
|
||||
if (props.field !== '') myvalue.value = miorecord[props.field];
|
||||
else {
|
||||
// @ts-ignore
|
||||
if (props.field !== '') {
|
||||
myvalue.value = miorecord[props.field];
|
||||
} else {
|
||||
myvalue.value = myrow.value;
|
||||
}
|
||||
if (props.field2 !== '') {
|
||||
myvalue2.value = miorecord[props.field2];
|
||||
}
|
||||
}
|
||||
// console.log('props.field', props.field, 'props.subfield', props.subfield, 'myvalue: ', myvalue)
|
||||
}
|
||||
@@ -700,6 +728,19 @@ export default defineComponent({
|
||||
async function SaveValueInt(newVal: any, valinitial: any) {
|
||||
console.log('SaveValueInt', newVal, valinitial);
|
||||
|
||||
let copynewval = { ...newVal };
|
||||
|
||||
let isEnd = false;
|
||||
|
||||
if (copynewval.which === 'start' || copynewval.which === 'end') {
|
||||
newVal = copynewval.current;
|
||||
valinitial = copynewval.prev;
|
||||
if (copynewval.which === 'end') {
|
||||
isEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (col.value.fieldtype === costanti.FieldType.verifica) {
|
||||
newVal.username = userStore.my.username;
|
||||
newVal.data = tools.getDateNow();
|
||||
@@ -724,14 +765,25 @@ export default defineComponent({
|
||||
console.log('newVal', newVal);
|
||||
|
||||
if (isFieldDb()) {
|
||||
await savefield(newVal, valinitial, $q);
|
||||
} else {
|
||||
// Update value in table memory
|
||||
if (props.subfield !== '') {
|
||||
if (myrow.value[props.field] === undefined) myrow.value[props.field] = {};
|
||||
myrow.value[props.field][props.subfield] = newVal;
|
||||
if (isEnd) {
|
||||
await savefield2(newVal, valinitial, $q);
|
||||
} else {
|
||||
if (props.field !== '') myrow.value[props.field] = newVal;
|
||||
await savefield(newVal, valinitial, $q);
|
||||
}
|
||||
} else {
|
||||
let subfield = props.subfield;
|
||||
let field = props.field;
|
||||
if (isEnd) {
|
||||
subfield = props.subfield2;
|
||||
field = props.field2;
|
||||
}
|
||||
|
||||
// Update value in table memory
|
||||
if (subfield !== '') {
|
||||
if (myrow.value[field] === undefined) myrow.value[field] = {};
|
||||
myrow.value[field][subfield] = newVal;
|
||||
} else {
|
||||
if (field !== '') myrow.value[field] = newVal;
|
||||
else {
|
||||
if (!props.isrec) {
|
||||
// @ts-ignore
|
||||
@@ -743,11 +795,12 @@ export default defineComponent({
|
||||
|
||||
console.log('SaveValueInt', newVal, valinitial);
|
||||
|
||||
emit('save', newVal, valinitial);
|
||||
emit('save', newVal, valinitial, copynewval.which!);
|
||||
}
|
||||
|
||||
async function savefield(value: any, initialval: any, myq: any) {
|
||||
if (!props.insertMode) {
|
||||
let ret = null;
|
||||
myvalue.value = value;
|
||||
return tools.saveInDBForTypes(
|
||||
myq,
|
||||
@@ -764,6 +817,25 @@ export default defineComponent({
|
||||
);
|
||||
}
|
||||
}
|
||||
async function savefield2(value: any, initialval: any, myq: any) {
|
||||
if (!props.insertMode) {
|
||||
let ret = null;
|
||||
myvalue2.value = value;
|
||||
return tools.saveInDBForTypes(
|
||||
myq,
|
||||
props.field2,
|
||||
myvalue2.value,
|
||||
props.type,
|
||||
props.serv,
|
||||
props.table,
|
||||
props.subfield2,
|
||||
props.id,
|
||||
props.indrec,
|
||||
props.mysubsubkey,
|
||||
props.specialField
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function annulla(val: any) {
|
||||
emit('annulla', true);
|
||||
@@ -1082,6 +1154,7 @@ export default defineComponent({
|
||||
|
||||
return {
|
||||
myvalue,
|
||||
myvalue2,
|
||||
countryname,
|
||||
visueditor,
|
||||
visuhtml,
|
||||
|
||||
Reference in New Issue
Block a user