Ver código fonte

修改简易查询默认值

zhaoke 1 ano atrás
pai
commit
c29ce6643f
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8 2
      src/components/SimpleQuery/index.vue

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

@@ -82,7 +82,7 @@
 <script>
 import PublicPageForm from '@/components/publicPageForm'
 import { Query } from "@/api/webApi"
-
+import { parseTime } from '@/utils'
 export default {
   name: 'SimpleQuery',
   props: {
@@ -221,12 +221,18 @@ export default {
       const formItemCopy = _.cloneDeep(formItem)
       const results = []
       const resultsKey = []
-      formItemCopy.map(({ dropdownlist, datatype, pagecode, defaultparameters }) => {
+      formItemCopy.map(({ dropdownlist, datatype, pagecode, defaultparameters, defaultvalue }) => {
         if (((datatype == 'select' || datatype == 'SELECT') && (dropdownlist || dropdownlist == 0) && dropdownlist != "")) {
           const datacontent = defaultparameters ? { filter: this.formatDefault(defaultparameters) } : { filter: { 1: 1 } }
           results.push(Query({ serviceid: dropdownlist, datacontent, event: '0', page: 1, size: 9999 }))
           resultsKey.push(pagecode)
         }
+        if (defaultvalue) {
+          this.tableForm[pagecode] = defaultvalue
+        }
+        if (datatype == 'date' || datatype == 'DATE') {
+          this.tableForm[pagecode] = parseTime(new Date(), '{y}-{m}-{d}')
+        }
       })
       if (results?.length) {
         this.getAnscyData(resultsKey, results, formItemCopy)