diff --git a/client/src/components/SchemaSubForm.vue b/client/src/components/SchemaSubForm.vue index 6e747b4..d3490da 100644 --- a/client/src/components/SchemaSubForm.vue +++ b/client/src/components/SchemaSubForm.vue @@ -335,7 +335,33 @@ export default { } else if (v.type === 'currentuser') { obj[v.name] = this.$store.state.user.fullname || this.$store.state.user.email } else if (v.type === 'currenttime') { - obj[v.name] = new Date() + if (v.property.hasOwnProperty('dateformatselect')) { + let fullDate = new Date() + const year = fullDate.getFullYear() + const month = fullDate.getMonth() + const date = fullDate.getDate() + const hour = fullDate.getHours() + const minute = fullDate.getMinutes() + const second = fullDate.getSeconds() + if (v.property.dateformatselect === 'A') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'B') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'C') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'D') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'E') { + obj[v.name] = date + '/' + month + '/' + year + } + if (v.property.dateformatselect === 'F') { + obj[v.name] = year + '/' + month + '/' + date + } + } } else if (v.type === 'boolean') { if ( v.property.defaultValue !== '' || @@ -408,7 +434,33 @@ export default { } else if (v.type === 'currentuser') { obj[v.name] = this.$store.state.user.fullname || this.$store.state.user.email } else if (v.type === 'currenttime') { - obj[v.name] = new Date() + if (v.property.hasOwnProperty('dateformatselect')) { + let fullDate = new Date() + const year = fullDate.getFullYear() + const month = fullDate.getMonth() + const date = fullDate.getDate() + const hour = fullDate.getHours() + const minute = fullDate.getMinutes() + const second = fullDate.getSeconds() + if (v.property.dateformatselect === 'A') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'B') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'C') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'D') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'E') { + obj[v.name] = date + '/' + month + '/' + year + } + if (v.property.dateformatselect === 'F') { + obj[v.name] = year + '/' + month + '/' + date + } + } } else if (v.type === 'boolean') { if ( v.property.defaultValue !== '' || @@ -512,7 +564,6 @@ export default { } }, mounted () { - console.log('--------------------------------', this.schemainstance.data[0].Fileattachment) this.oldFiles = this.schemainstance.data[0].Fileattachment.length }, created () {} diff --git a/client/src/components/SchemaView.vue b/client/src/components/SchemaView.vue index 745c931..827cc54 100644 --- a/client/src/components/SchemaView.vue +++ b/client/src/components/SchemaView.vue @@ -337,7 +337,33 @@ export default { } else if (v.type === 'currentuser') { obj[v.name] = this.$store.state.user.fullname || this.$store.state.user.email } else if (v.type === 'currenttime') { - obj[v.name] = new Date() + if (v.property.hasOwnProperty('dateformatselect')) { + let fullDate = new Date() + const year = fullDate.getFullYear() + const month = fullDate.getMonth() + const date = fullDate.getDate() + const hour = fullDate.getHours() + const minute = fullDate.getMinutes() + const second = fullDate.getSeconds() + if (v.property.dateformatselect === 'A') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'B') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'C') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'D') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'E') { + obj[v.name] = date + '/' + month + '/' + year + } + if (v.property.dateformatselect === 'F') { + obj[v.name] = year + '/' + month + '/' + date + } + } } else if (v.type === 'boolean') { if (v.property.defaultValue !== '' || v.property.defaultValue === 'true') { obj[v.name] = true @@ -463,7 +489,33 @@ export default { } else if (v.type === 'currentuser') { obj[v.name] = this.$store.state.user.fullname || this.$store.state.user.email } else if (v.type === 'currenttime') { - obj[v.name] = new Date() + if (v.property.hasOwnProperty('dateformatselect')) { + let fullDate = new Date() + const year = fullDate.getFullYear() + const month = fullDate.getMonth() + const date = fullDate.getDate() + const hour = fullDate.getHours() + const minute = fullDate.getMinutes() + const second = fullDate.getSeconds() + if (v.property.dateformatselect === 'A') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'B') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + } + if (v.property.dateformatselect === 'C') { + obj[v.name] = year + '/' + month + '/' + date + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'D') { + obj[v.name] = date + '/' + month + '/' + year + ' ' + hour + ':' + minute + ':' + second + } + if (v.property.dateformatselect === 'E') { + obj[v.name] = date + '/' + month + '/' + year + } + if (v.property.dateformatselect === 'F') { + obj[v.name] = year + '/' + month + '/' + date + } + } } else if (v.type === 'boolean') { if (v.property.defaultValue !== '' || v.property.defaultValue === 'true') { obj[v.name] = true diff --git a/client/src/pages/schema/New.vue b/client/src/pages/schema/New.vue index f28fd62..6d992b2 100644 --- a/client/src/pages/schema/New.vue +++ b/client/src/pages/schema/New.vue @@ -158,7 +158,7 @@ - + @@ -181,6 +181,11 @@ Optional + + + @@ -311,6 +316,33 @@ export default { } } return { + dateList: [ + { + value: 'A', + label: 'dd/mm/yyyy hh:mm' + }, + { + value: 'B', + label: 'yyyy/mm/dd hh:mm' + }, + { + value: 'C', + label: 'yyyy/mm/dd hh:mm:s' + }, + { + value: 'D', + label: 'dd/mm/yyyy hh:mm:s' + }, + { + value: 'E', + label: 'dd/mm/yyyy' + }, + { + value: 'F', + label: 'yyyy/mm/dd' + } + ], + model1: '', loading: false, formSchema: { title: '', @@ -332,7 +364,8 @@ export default { optional: true, options: [], IsArray: false, - isMultiple: true + isMultiple: true, + dateformatselect: '' }, notes: '' } @@ -455,7 +488,8 @@ export default { optional: true, options: [], IsArray: false, - isMultiple: true + isMultiple: true, + dateformatselect: '' }, notes: '' } @@ -551,7 +585,8 @@ export default { optional: true, options: [], IsArray: false, - isMultiple: true + isMultiple: true, + dateformatselect: '' }, notes: '' } @@ -580,7 +615,8 @@ export default { optional: true, options: [], IsArray: '', - isMultiple: true + isMultiple: true, + dateformatselect: '' }, notes: '' }) @@ -608,7 +644,7 @@ export default { 'dropdown': ['options', 'defaultValue', 'placeholder', 'optional'], 'file': ['optional', 'isMultiple'], 'currentuser': ['optional'], - 'currenttime': ['optional'] + 'currenttime': ['optional', 'dateformat'] } if (typePropertys[this.formSchema.entity[index].type] === undefined) {