Browse Source

查询模板预览修改

zhongxiaoyu 2 năm trước cách đây
mục cha
commit
7115badb44

+ 1 - 1
src/components/SimpleTable/index.vue

@@ -55,7 +55,7 @@
         :style="{ height: height }"
         class="no-column"
       >
-        查询模板列设置未完成
+        无数据
       </div>
     </template>
   </div>

+ 15 - 7
src/views/systemSettings/views/queryTemplate/queryTemplatePreview.vue

@@ -201,6 +201,7 @@
         <div class="title">
           <span>参数设置</span>
           <i
+            v-if="hasInit"
             class="el-icon-close"
             @click="dialogHide(1)"
           />
@@ -396,7 +397,8 @@ export default {
       basicParamList: [],
       basicParamForm: {},
       dataContent: [],
-      isBasic: false
+      isBasic: false,
+      hasInit: false
     }
   },
   watch: {
@@ -435,12 +437,12 @@ export default {
       this.isBasic = true
       this.basicParamList = Array.from({ length }).map((_, index) => {
         this.$set(this.basicParamForm, `basicParam${index}`, '')
-        this.dataContent.push(null)
         return {
           prop: `basicParam${index}`,
           label: `基础参数${index + 1}`
         }
       })
+      this.dialogShow(1)
     }
   },
   methods: {
@@ -449,13 +451,13 @@ export default {
         case 1:
           this.dialogBasicFlag = true
           this.$nextTick(() => {
-            this.$refs['dialogBasic'].focus()
+            this.$refs['dialogBasic']?.focus()
           })
           break
         default:
           this.dialogFlag = true
           this.$nextTick(() => {
-            this.$refs['dialog'].focus()
+            this.$refs['dialog']?.focus()
           })
           break
       }
@@ -463,7 +465,11 @@ export default {
     dialogHide(dialogIndex) {
       switch (dialogIndex) {
         case 1:
-          this.dialogBasicFlag = false
+          if (this.hasInit) {
+            this.dialogBasicFlag = false
+          } else {
+            this.$message.warning('请设置参数进行查询')
+          }
           break
         default:
           this.dialogFlag = false
@@ -569,6 +575,7 @@ export default {
     },
     basicQueryHandler() {
       this.dataContent = Object.values(this.basicParamForm).map(value => value || null)
+      this.hasInit = true
       this.dialogHide(1)
     },
     deleteParam(index) {
@@ -640,7 +647,8 @@ export default {
       try {
         const {
           code,
-          returnData: { columnSet, listValues }
+          returnData: { columnSet, listValues },
+          message
         } = await Query({
           id: this.queryTemplateID,
           needPage: ++this.page,
@@ -656,7 +664,7 @@ export default {
           this.tableData.push(...listValues)
         } else {
           this.page--
-          throw new Error('获取表格数据失败')
+          throw new Error(message ?? '获取表格数据失败')
         }
       } catch (error) {
         this.$message.error(error.message)