Browse Source

新增format
上传uuid

y595705120 2 years ago
parent
commit
ea56a9d4b7
2 changed files with 9 additions and 6 deletions
  1. 5 3
      src/components/form/datetime.vue
  2. 4 3
      src/components/form/index.vue

+ 5 - 3
src/components/form/datetime.vue

@@ -34,17 +34,19 @@ export default {
     }
   },
   props: {
-    value: Date,
+    value: [Date, String]
   },
   filters: {
     format(dataTime){
       if(!dataTime) return '';
-      return dayjs(dataTime).format('YYYY-MM-DD HH:mm');
+      let formatStr = 'YYYY-MM-DD HH:mm'
+      return dayjs(dataTime).format( formatStr );
     }
   },
   methods: {
     handleChange(value){
-      this.$emit('update:value', value);
+      let formatStr = this.options && this.options.format||'YYYY-MM-DD HH:mm'
+      this.$emit('update:value',  dayjs(value).format(formatStr));
     },
     confirmDate(value){
       this.handleChange(value);

+ 4 - 3
src/components/form/index.vue

@@ -52,12 +52,13 @@ export default {
           message: `请填写${errmsg}`,
         })
       }
-
+       let {uuid} = this.$route.params;
       if(this.loading) return;
       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 );
 
-      fetch(formAction || '', { formId, formName, formAction, data: this.formData }).then(() => {
+      fetch(formAction || '', param ).then(() => {
         this.loading = false;
         this.success = true;
         Dialog.alert({