zhaoke 1 vuosi sitten
vanhempi
commit
b807ee0adf
1 muutettua tiedostoa jossa 8 lisäystä ja 5 poistoa
  1. 8 5
      src/components/SimpleQuery/index.vue

+ 8 - 5
src/components/SimpleQuery/index.vue

@@ -102,7 +102,8 @@ export default {
       tableForm: {},
       tableOptions: {},
       queryContent: {},
-      formItemArr: []
+      formItemArr: [],
+      formItemVal: []
     }
   },
   computed: {
@@ -190,7 +191,6 @@ export default {
     //获取表单下拉数据
     changeSelect (code, data) {
       this.$emit('changeSelect', data)
-      if (code == 'passparameters') return
       const datas = this.$store.state.auth.authMsg
       if (!datas?.length) return
       const ndata = datas.filter(item => item.labelcode && item.pagecode == code)
@@ -231,10 +231,10 @@ export default {
           resultsKey.push(pagecode)
         }
         if (defaultvalue) {
-          this.tableForm[pagecode] = defaultvalue
+          this.formItemVal.push({ column: pagecode, value: defaultvalue, type: datatype })
         }
         if (datatype == 'date' || datatype == 'DATE') {
-          this.tableForm[pagecode] = parseTime(new Date(), '{y}-{m}-{d}')
+          this.formItemVal.push({ column: pagecode, value: defaultvalue, type: datatype })
         }
       })
       if (results?.length) {
@@ -242,6 +242,7 @@ export default {
       } else {
         this.formItemArr = formItemCopy
       }
+      this.formatForm(this.formItemVal)
     },
     //获取异步数据
     async getAnscyData (allResultKey, allResult, formItem) {
@@ -265,9 +266,11 @@ export default {
       const ndatas = [...array]
       const tableForm = {}
       ndatas.forEach(item => {
-        const { column, value } = item
+        const { column, value, type } = item
         if (value) {
           tableForm[column] = value
+        } else if (type == 'date' || type == 'DATE') {
+          tableForm[column] = parseTime(new Date(), '{y}-{m}-{d}')
         }
       })
       this.tableForm = tableForm