소스 검색

前端: 供方信息查询和已入库列表的查询条件持久化 localstorage

baichengfei 5 년 전
부모
커밋
218df45306

+ 27 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/basislist.vue

@@ -30,7 +30,7 @@
           </el-form-item>
 
           <el-form-item>
-            <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
+            <el-dropdown split-button type="primary" size="mini" @click="handleSearch($event)" @command="searchCommand">
               查询
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
@@ -296,7 +296,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
+        <el-button size="mini" type="primary" @click="handleSearch($event)">查 询</el-button>
       </span>
     </el-dialog>
 
@@ -759,12 +759,29 @@ import certApi from '@/api/oilsupplier/suppliercert'
     created () {
       // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
+      if (process.client) {
+        let basisStoredSearchParams = window.localStorage.getItem('basisStoredSearchParams')
+        if (basisStoredSearchParams !== '' && basisStoredSearchParams !== null) {
+          let basisSearchForm = JSON.parse(basisStoredSearchParams)
+          this.InFlag = basisSearchForm.InFlag
+          this.searchForm = basisSearchForm
+        }
+      }
       // 查询列表
       this.initDatas()
       this.getDictOptions()
     },
     methods: {
-      initDatas () {
+      initDatas (event) {
+        if (event != null) {
+          this.currentPage = 1
+          if (process.client) {
+            let basisSearchForm = this.searchForm
+            basisSearchForm.InFlag = this.InFlag
+            window.localStorage.setItem('basisStoredSearchParams', JSON.stringify(basisSearchForm)) // 已入库查询参数
+          }
+          this.dialogVisible = false
+        }
         // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
@@ -830,8 +847,13 @@ import certApi from '@/api/oilsupplier/suppliercert'
         this.initDatas()
       },
       clearSearch () {
+        if (process.client) {
+          window.localStorage.setItem('basisStoredSearchParams', '')
+        }
         Object.assign(this.searchForm, this.searchFormReset)
         // this.searchForm = this.searchFormReset;
+        this.searchForm.InFlag = ''
+        this.InFlag = ''
         this.CityAry = []
         this.LinkCityAry = []
         this.CreateOn = ''
@@ -865,10 +887,10 @@ import certApi from '@/api/oilsupplier/suppliercert'
         this.searchForm.City = value[1]
         this.searchForm.Street = value[2]
       },
-      handleSearch () {
+      handleSearch ($event) {
         this.currentPage = 1
         this.dialogVisible = false
-        this.initDatas()
+        this.initDatas($event)
       },
       handleCurrentChange (value) {
         this.currentPage = value

+ 27 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/goodslist.vue

@@ -29,7 +29,7 @@
             </el-select>
           </el-form-item>
           <el-form-item>
-            <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
+            <el-dropdown split-button type="primary" size="mini" @click="handleSearch($event)" @command="searchCommand">
               查询
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
@@ -297,7 +297,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
+        <el-button size="mini" type="primary" @click="handleSearch($event)">查 询</el-button>
       </span>
     </el-dialog>
     <el-dialog title="上传文件" :close-on-click-modal="false"  width="600px" :visible.sync="uploadshow">
@@ -571,6 +571,14 @@
     created () {
       // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
+      if (process.client) {
+        let goodsStoredSearchParams = window.localStorage.getItem('goodsStoredSearchParams')
+        if (goodsStoredSearchParams !== '' && goodsStoredSearchParams !== null) {
+          let goodsSearchForm = JSON.parse(goodsStoredSearchParams)
+          this.InFlag = goodsSearchForm.InFlag
+          this.searchForm = goodsSearchForm
+        }
+      }
       // 查询列表
       this.initDatas()
       this.getDictOptions()
@@ -639,7 +647,16 @@
           }
         })
       },
-      initDatas () {
+      initDatas (event) {
+        if (event != null) {
+          this.currentPage = 1
+          if (process.client) {
+            let goodsSearchForm = this.searchForm
+            goodsSearchForm.InFlag = this.InFlag
+            window.localStorage.setItem('goodsStoredSearchParams', JSON.stringify(goodsSearchForm)) // 已入库查询参数
+          }
+          this.dialogVisible = false
+        }
         // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
@@ -733,17 +750,22 @@
         this.initDatas()
       },
       clearSearch () {
+        if (process.client) {
+          window.localStorage.setItem('goodsStoredSearchParams', '')
+        }
         Object.assign(this.searchForm, this.searchFormReset)
         // this.searchForm = this.searchFormReset;
+        this.searchForm.InFlag = ''
+        this.InFlag = ''
         this.CityAry = []
         this.LinkCityAry = []
         this.CreateOn = ''
         this.initDatas()
       },
-      handleSearch () {
+      handleSearch ($event) {
         this.currentPage = 1
         this.dialogVisible = false
-        this.initDatas()
+        this.initDatas($event)
       },
       handleCurrentChange (value) {
         this.currentPage = value

+ 24 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/index.vue

@@ -31,7 +31,7 @@
           </el-form-item>
 
           <el-form-item>
-            <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
+            <el-dropdown split-button type="primary" size="mini" @click="handleSearch($event)" @command="searchCommand">
               查询
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
@@ -750,6 +750,14 @@
     created () {
       // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
+      if (process.client) {
+        let storedSearchParams = window.localStorage.getItem('storedSearchParams')
+        if (storedSearchParams !== '' && storedSearchParams !== null) {
+          storedSearchParams = JSON.parse(storedSearchParams)
+          // this.CreateOn = storedSearchParams.cacheCreateOn
+          this.searchForm = storedSearchParams
+        }
+      }
       // 查询列表
       this.initDatas()
       this.getDictOptions()
@@ -765,7 +773,16 @@
           return 'techedit'
         }
       },
-      initDatas () {
+      initDatas (event) {
+        if (event != null) {
+          this.currentPage = 1
+          if (process.client) {
+            let searchForm = this.searchForm
+            // searchForm.cacheCreateOn = this.CreateOn.toString()
+            window.localStorage.setItem('storedSearchParams', JSON.stringify(searchForm)) // 已入库查询参数
+          }
+          this.dialogVisible = false
+        }
         // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
@@ -886,16 +903,19 @@
       },
       clearSearch () {
         Object.assign(this.searchForm, this.searchFormReset)
+        if (process.client) {
+          window.localStorage.setItem('storedSearchParams', '')
+        }
         // this.searchForm = this.searchFormReset;
         this.CityAry = []
         this.LinkCityAry = []
         this.CreateOn = ''
         this.initDatas()
       },
-      handleSearch () {
+      handleSearch (event) {
         this.currentPage = 1
         this.dialogVisible = false
-        this.initDatas()
+        this.initDatas(event)
       },
       handleCurrentChange (value) {
         this.currentPage = value

+ 28 - 7
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstore/techlist.vue

@@ -30,7 +30,7 @@
           </el-form-item>
 
           <el-form-item>
-            <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
+            <el-dropdown split-button type="primary" size="mini" @click="handleSearch($event)" @command="searchCommand">
               查询
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
@@ -296,7 +296,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="handleSearch">查 询</el-button>
+        <el-button size="mini" type="primary" @click="handleSearch($event)">查 询</el-button>
       </span>
     </el-dialog>
 
@@ -304,8 +304,7 @@
 </template>
 <script>
   import { mapGetters } from 'vuex'
-import api from '@/api/oilsupplier/supplier'
-import certApi from '@/api/oilsupplier/suppliercert'
+  import api from '@/api/oilsupplier/supplier'
 
   export default {
     computed: {
@@ -761,12 +760,29 @@ import certApi from '@/api/oilsupplier/suppliercert'
       this.isCanApply()
       // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
+      if (process.client) {
+        let techStoredSearchParams = window.localStorage.getItem('techStoredSearchParams')
+        if (techStoredSearchParams !== '' && techStoredSearchParams !== null) {
+          let techSearchForm = JSON.parse(techStoredSearchParams)
+          this.InFlag = techSearchForm.InFlag
+          this.searchForm = techSearchForm
+        }
+      }
       // 查询列表
       this.initDatas()
       this.getDictOptions()
     },
     methods: {
-      initDatas () {
+      initDatas (event) {
+        if (event != null) {
+          this.currentPage = 1
+          if (process.client) {
+            let techSearchForm = this.searchForm
+            techSearchForm.InFlag = this.InFlag
+            window.localStorage.setItem('techStoredSearchParams', JSON.stringify(techSearchForm)) // 已入库查询参数
+          }
+          this.dialogVisible = false
+        }
         // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
@@ -861,17 +877,22 @@ import certApi from '@/api/oilsupplier/suppliercert'
         this.initDatas()
       },
       clearSearch () {
+        if (process.client) {
+          window.localStorage.setItem('techStoredSearchParams', '')
+        }
         Object.assign(this.searchForm, this.searchFormReset)
         // this.searchForm = this.searchFormReset;
+        this.searchForm.InFlag = ''
+        this.InFlag = ''
         this.CreateOn = ''
         this.CityAry = []
         this.LinkCityAry = []
         this.initDatas()
       },
-      handleSearch () {
+      handleSearch (event) {
         this.currentPage = 1
         this.dialogVisible = false
-        this.initDatas()
+        this.initDatas(event)
       },
       handleCurrentChange (value) {
         this.currentPage = value

+ 17 - 3
src/dashoo.cn/frontend_web/src/pages/select/companyselect/index.vue

@@ -1279,6 +1279,14 @@ export default {
   },
   created () {
     Object.assign(this.searchFormReset, this.searchForm)
+    if (process.client) {
+      let companySearchParams = window.localStorage.getItem('companySearchParams')
+      if (companySearchParams !== '' && companySearchParams !== null) {
+        let searchForm = JSON.parse(companySearchParams)
+        this.InFlag = searchForm.InFlag
+        this.searchForm = searchForm
+      }
+    }
     // 执行初始化方法
     this.getDictOptions()
     this.initDatas()
@@ -1287,7 +1295,7 @@ export default {
     this.getDictOptions2()
     // watermark.set("大港油田企业法规处")
   },
-  activated() {
+  activated () {
     this.currentPageSub = 1
   },
   data () {
@@ -1966,8 +1974,6 @@ export default {
       this.jfCurrentPage = value
       this.getJFBadList()
     },
-
-
     // 列表排序功能
     orderby (column) {
       if (column.order === 'ascending') {
@@ -1996,6 +2002,11 @@ export default {
     initDatas (event) {
       if (event != null) {
         this.currentPage = 1
+        if (process.client) {
+          let searchForm = this.searchForm
+          searchForm.InFlag = searchForm.InFlag === '' ? this.InFlag : searchForm.InFlag
+          window.localStorage.setItem('companySearchParams', JSON.stringify(searchForm)) // 供方信息查询参数
+        }
         this.dialogVisible = false
       }
       this.loading = true
@@ -2074,6 +2085,9 @@ export default {
     },
     clearSearch () {
       Object.assign(this.searchForm, this.searchFormReset)
+      if (process.client) {
+        window.localStorage.setItem('companySearchParams', '')
+      }
       this.CityAry = []
       this.SetupTime = ''
       this.auditorg = ''