Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

date filter #513

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions client/src/components/SchemaSubForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== '' ||
Expand Down Expand Up @@ -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 !== '' ||
Expand Down Expand Up @@ -512,7 +564,6 @@ export default {
}
},
mounted () {
console.log('--------------------------------', this.schemainstance.data[0].Fileattachment)
this.oldFiles = this.schemainstance.data[0].Fileattachment.length
},
created () {}
Expand Down
56 changes: 54 additions & 2 deletions client/src/components/SchemaView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
48 changes: 42 additions & 6 deletions client/src/pages/schema/New.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<DatePicker type="date" placeholder="Select date" v-model="item.property.maxdate"></DatePicker>
</Form-item>
<Form-item v-if="activatedProperty(index,'allowedValue')" label="Allowed Value" :label-width="80" class="no-margin">
<input-tag :tags="item.property.allowedValue"></input-tag>
<input-tag :tags="item.property.allowedValue"></input-tag>
</Form-item>
<Form-item v-if="activatedProperty(index,'options')" label="Options" :label-width="80" class="no-margin">
<input-tag :tags="item.property.options"></input-tag>
Expand All @@ -181,6 +181,11 @@
<Form-item v-if="activatedProperty(index,'optional')" label="" :label-width="80" class="no-margin">
<Checkbox v-model="item.property.optional">Optional</Checkbox>
</Form-item>
<Form-item v-if="activatedProperty(index,'dateformat')" label="Date" :label-width="80" class="no-margin">
<Select v-model="item.property.dateformatselect" style="width:200px; height: 150px">
<Option v-for="item in dateList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</Form-item>
</div>
</Poptip>
</div>
Expand Down Expand Up @@ -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: '',
Expand All @@ -332,7 +364,8 @@ export default {
optional: true,
options: [],
IsArray: false,
isMultiple: true
isMultiple: true,
dateformatselect: ''
},
notes: ''
}
Expand Down Expand Up @@ -455,7 +488,8 @@ export default {
optional: true,
options: [],
IsArray: false,
isMultiple: true
isMultiple: true,
dateformatselect: ''
},
notes: ''
}
Expand Down Expand Up @@ -551,7 +585,8 @@ export default {
optional: true,
options: [],
IsArray: false,
isMultiple: true
isMultiple: true,
dateformatselect: ''
},
notes: ''
}
Expand Down Expand Up @@ -580,7 +615,8 @@ export default {
optional: true,
options: [],
IsArray: '',
isMultiple: true
isMultiple: true,
dateformatselect: ''
},
notes: ''
})
Expand Down Expand Up @@ -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) {
Expand Down