This commit is contained in:
@@ -54,9 +54,10 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* xxeslint-disable */
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
beforeCreate() {
|
||||
|
||||
//check pre-requisites exist just in case
|
||||
if (this.$gzdevmode()) {
|
||||
if (!this.$dayjs) {
|
||||
@@ -106,6 +107,7 @@ export default {
|
||||
: "";
|
||||
},
|
||||
formatDate() {
|
||||
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
.utc(this.value)
|
||||
@@ -122,7 +124,9 @@ export default {
|
||||
: "";
|
||||
},
|
||||
dateOnly: {
|
||||
|
||||
get() {
|
||||
|
||||
return this.$dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
|
||||
@@ -337,7 +337,27 @@ export default {
|
||||
components: {},
|
||||
data() {
|
||||
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: {
|
||||
ready: false,
|
||||
dirty: false,
|
||||
@@ -441,7 +461,7 @@ export default {
|
||||
this.$gzapi
|
||||
.upsert(url, this.obj)
|
||||
.then(res => {
|
||||
// debugger;
|
||||
// debugger;
|
||||
vm.formState.loading = false;
|
||||
if (res.error != undefined) {
|
||||
vm.formState.serverError = res.error;
|
||||
@@ -451,6 +471,7 @@ export default {
|
||||
if (res.data.id) {
|
||||
//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??
|
||||
debugger;
|
||||
vm.obj = res.data;
|
||||
vm.$gzform.setFormState({
|
||||
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:
|
||||
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 {
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
||||
|
||||
Reference in New Issue
Block a user