This commit is contained in:
@@ -54,9 +54,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
/* xxeslint-disable */
|
/* eslint-disable */
|
||||||
export default {
|
export default {
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
|
|
||||||
//check pre-requisites exist just in case
|
//check pre-requisites exist just in case
|
||||||
if (this.$gzdevmode()) {
|
if (this.$gzdevmode()) {
|
||||||
if (!this.$dayjs) {
|
if (!this.$dayjs) {
|
||||||
@@ -106,6 +107,7 @@ export default {
|
|||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
formatDate() {
|
formatDate() {
|
||||||
|
|
||||||
return this.value
|
return this.value
|
||||||
? this.$dayjs
|
? this.$dayjs
|
||||||
.utc(this.value)
|
.utc(this.value)
|
||||||
@@ -122,7 +124,9 @@ export default {
|
|||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
dateOnly: {
|
dateOnly: {
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
|
|
||||||
return this.$dayjs
|
return this.$dayjs
|
||||||
.utc(this.value)
|
.utc(this.value)
|
||||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||||
|
|||||||
@@ -337,7 +337,27 @@ export default {
|
|||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: {},
|
/*
|
||||||
|
this needs to have all properties set that *could* exist for a widget up front here in declaration
|
||||||
|
{"data":{"id":100,"concurrencyToken":2197,"name":"Handmade Cotton Chair 122","serial":100,"dollarAmount":811.47000,"active":true,"roles":8212,
|
||||||
|
"startDate":"2019-06-06T08:48:13.059631Z","endDate":"2019-06-06T12:38:30.654906Z",
|
||||||
|
"notes":"Minima qui assumenda.","count":0,"customFields":null,"tags":["indigo","brown","silver","gold"]}}
|
||||||
|
*/
|
||||||
|
obj: {
|
||||||
|
id: 0,
|
||||||
|
concurrencyToken: 0,
|
||||||
|
name: "",
|
||||||
|
serial: 0,
|
||||||
|
dollarAmount: 0,
|
||||||
|
active: false,
|
||||||
|
roles: 0,
|
||||||
|
startDate: "",
|
||||||
|
endDate: "",
|
||||||
|
notes: "",
|
||||||
|
count: 0,
|
||||||
|
customFields: [],
|
||||||
|
tags: []
|
||||||
|
},
|
||||||
formState: {
|
formState: {
|
||||||
ready: false,
|
ready: false,
|
||||||
dirty: false,
|
dirty: false,
|
||||||
@@ -441,7 +461,7 @@ export default {
|
|||||||
this.$gzapi
|
this.$gzapi
|
||||||
.upsert(url, this.obj)
|
.upsert(url, this.obj)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// debugger;
|
// debugger;
|
||||||
vm.formState.loading = false;
|
vm.formState.loading = false;
|
||||||
if (res.error != undefined) {
|
if (res.error != undefined) {
|
||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
@@ -451,6 +471,7 @@ export default {
|
|||||||
if (res.data.id) {
|
if (res.data.id) {
|
||||||
//Handle "post" of new record (CREATE)
|
//Handle "post" of new record (CREATE)
|
||||||
//wouldn't this be cleaner if it just opened the new record directly since the url still has zero in the id field??
|
//wouldn't this be cleaner if it just opened the new record directly since the url still has zero in the id field??
|
||||||
|
debugger;
|
||||||
vm.obj = res.data;
|
vm.obj = res.data;
|
||||||
vm.$gzform.setFormState({
|
vm.$gzform.setFormState({
|
||||||
vm: vm,
|
vm: vm,
|
||||||
@@ -459,7 +480,9 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero:
|
//change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero:
|
||||||
vm.$router.replace(vm.$route.fullPath.slice(0, -1) + res.data.id);
|
vm.$router.replace(
|
||||||
|
vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
//Handle "put" of an existing record (UPDATE)
|
//Handle "put" of an existing record (UPDATE)
|
||||||
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
||||||
|
|||||||
Reference in New Issue
Block a user