Răsfoiți Sursa

高级查询收藏和取消修改

zhaoke 1 an în urmă
părinte
comite
187c6528db
2 a modificat fișierele cu 22 adăugiri și 11 ștergeri
  1. 15 10
      src/components/AdvancedQuery/index.vue
  2. 7 1
      src/views/tablePage/index.vue

+ 15 - 10
src/components/AdvancedQuery/index.vue

@@ -140,8 +140,8 @@ export default {
   data () {
     return {
       queryContent: [],
-      catchOptions: JSON.parse(localStorage.getItem('catchOptions')) || [],
-      catchOptionsAll: [JSON.parse(localStorage.getItem('catchOptions'))] || [],
+      catchOptions: JSON.parse(localStorage.getItem(this.$route.path)) || [],
+      catchOptionsAll: [JSON.parse(localStorage.getItem(this.$route.path))] || [],
       flightDate: new Array(2).fill(parseTime(new Date(), '{y}-{m}-{d}')),
       paramsForm: {
         params: [],
@@ -277,7 +277,7 @@ export default {
         this.addParamsHandler()
       }
     },
-    advancedQueryHandler () {
+    advancedQueryHandler (Jump = false) {
       try {
         this.$refs['paramsForm'].validate(valid => {
           if (!valid) {
@@ -323,7 +323,9 @@ export default {
           queryContent.push(obj)
         }
         this.queryContent = queryContent
-        this.sendColData()
+        if (!Jump) {
+          this.sendColData()
+        }
       } catch (error) {
         error.message && this.$message.error(error.message)
       }
@@ -399,9 +401,11 @@ export default {
       }
     },
     deleteParam (rowIndex) {
-      this.paramsTableCols[2].inputType.splice(rowIndex, 1)
-      this.paramsForm.params.splice(rowIndex, 1)
-      this.paramsForm.disabled.splice(rowIndex, 1)
+      if (this.paramsTableCols[2].inputType.length > 1 && this.paramsForm.params.length > 1) {
+        this.paramsTableCols[2].inputType.splice(rowIndex, 1)
+        this.paramsForm.params.splice(rowIndex, 1)
+        this.paramsForm.disabled.splice(rowIndex, 1)
+      }
     },
     toggle (rowIndex) {
       const { connector } = this.paramsForm.params[rowIndex]
@@ -423,7 +427,7 @@ export default {
     },
     //收藏
     advancedQueryCollect () {
-      this.advancedQueryHandler()
+      this.advancedQueryHandler(true)
       if (!this.queryContent.length) return
       this.$prompt('请输入收藏标题', '收藏', {
         confirmButtonText: '确定',
@@ -438,7 +442,8 @@ export default {
           itemVal: this.catchOptionsAll?.at(-1)
         }
         this.catchOptions.push(catchItem)
-        localStorage.setItem('catchOptions', JSON.stringify(this.catchOptions))
+        localStorage.setItem(this.$route.path, JSON.stringify(this.catchOptions))
+        this.$message.success('收藏成功')
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -452,7 +457,7 @@ export default {
       catchCopy.splice(index, 1)
       this.catchOptionsAll = []
       this.catchOptionsAll = [catchCopy]
-      localStorage.setItem('catchOptions', JSON.stringify(catchCopy))
+      localStorage.setItem(this.$route.path, JSON.stringify(catchCopy))
     },
     //收藏查询
     queryRecover (item) {

+ 7 - 1
src/views/tablePage/index.vue

@@ -20,7 +20,7 @@
         <PublicPageForm ref="ruleForm" :label-width="labelWidth" :form-pass="tableData" :form-type="tableType" :form-item="formItem" :form-data="tableForm" />
       </PublicPageDialog>
       <!--高级查询-->
-      <PublicPageDialog dialog-title="高级查询" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedDrawer = false" @handleSubmit="advancedTable('advancedDialogForm')">
+      <PublicPageDialog dialog-title="高级查询" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedClose" @handleSubmit="advancedTable('advancedDialogForm')">
         <AdvancedQuery ref="advancedDialogForm" @getAdvancedQueryData="getAdvancedQueryData" />
         <template slot="d_foot">
           <el-button size="small" @click="queryCollect('advancedDialogForm')" type="primary">收藏</el-button>
@@ -475,6 +475,12 @@ export default {
     advancedTable (refName) {
       this.$refs[refName].advancedQueryHandler()
     },
+    //高级查询-取消
+    advancedClose () {
+      this.advancedDrawer = false
+      this.defaultfilter = { 1: 1 }
+      this.queryTableData(true)
+    },
     //高级查询-确定-数据
     getAdvancedQueryData (dataRules) {
       console.log(dataRules)