|
@@ -33,11 +33,18 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
- const data = {};
|
|
|
|
|
|
+ let {uuid} = this.$route.params;
|
|
|
|
+ let param = localStorage.getItem(uuid);
|
|
|
|
+ let jsonObj = {};
|
|
|
|
+ if( param ){
|
|
|
|
+ jsonObj= JSON.parse(param);
|
|
|
|
+ }
|
|
|
|
+ var data = {};
|
|
this.options.children.forEach(item => {
|
|
this.options.children.forEach(item => {
|
|
- data[item.field] = undefined;
|
|
|
|
|
|
+ item.value = jsonObj[item.field]||'';
|
|
|
|
+ data[item.field] = jsonObj[item.field]||undefined;
|
|
});
|
|
});
|
|
- this.formData = data;
|
|
|
|
|
|
+ this.formData = data||{};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
submit(){
|
|
submit(){
|
|
@@ -52,12 +59,12 @@ export default {
|
|
message: `请填写${errmsg}`,
|
|
message: `请填写${errmsg}`,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- let {uuid} = this.$route.params;
|
|
|
|
|
|
+ let {uuid} = this.$route.params;
|
|
if(this.loading) return;
|
|
if(this.loading) return;
|
|
this.loading = true;
|
|
this.loading = true;
|
|
const { formId, formName, formAction} = this.options;
|
|
const { formId, formName, formAction} = this.options;
|
|
let param = Object.assign({formId, formName, formAction, uuid}, this.formData );
|
|
let param = Object.assign({formId, formName, formAction, uuid}, this.formData );
|
|
-
|
|
|
|
|
|
+ localStorage.setItem( uuid, JSON.stringify(param) );
|
|
fetch(formAction || '', param ).then(() => {
|
|
fetch(formAction || '', param ).then(() => {
|
|
this.loading = false;
|
|
this.loading = false;
|
|
this.success = true;
|
|
this.success = true;
|