Explorar o código

feat: 新增重置筛选项

zhangyuhan hai 1 ano
pai
achega
ea8305b934
Modificáronse 1 ficheiros con 45 adicións e 32 borrados
  1. 45 32
      src/web/templates/pc/supsearch.html

+ 45 - 32
src/web/templates/pc/supsearch.html

@@ -3683,6 +3683,49 @@ function checkTagDisabled () {
         }
         return params
       },
+      resetCustomFilter (data) {
+        const customData = data || this.customRC.origin
+        if (customData && customData.key) {
+          try {
+            this.customRC.origin = customData
+            this.customRC.label = customData.label
+            this.customRC.key = customData.key
+            this.customRC.list = customData.options.map(v => {
+              const isSelect = customData.defaultVal.indexOf(v.key) > -1
+              if (v.label === '全部') {
+                this.customRC.allKey = v.key
+              }
+              return {
+                children: [
+                  {
+                    disabled: false,
+                    indeterminate: false,
+                    selected: isSelect,
+                    label: '全部',
+                    value: '全部',
+                    parent: v.label
+                  }
+                ],
+                disabled: false,
+                indeterminate: false,
+                selected: isSelect,
+                label: v.label,
+                value: v.label === '全部' ? '全部' : v.key
+              }
+            })
+            this.customRC.selectVal = customData.defaultVal
+            this.customRC.show = true
+            if (this.$refs.selectRC && this.$refs.selectRC.initData) {
+              this.$refs.selectRC.initData()
+              this.$refs.selectRC.getData()
+            }
+          } catch (e) {
+            console.warn(e)
+          }
+        } else {
+          this.customRC.show = false
+        }
+      },
       // 融创客户定制
       getCustomInfo () {
         $.ajax({
@@ -3692,38 +3735,7 @@ function checkTagDisabled () {
             if(res.error_code === 0) {
               if (res.data && res.data[0]) {
                 const customData = res.data[0]
-                try {
-                  this.customRC.origin = customData
-                  this.customRC.label = customData.label
-                  this.customRC.key = customData.key
-                  this.customRC.list = customData.options.map(v => {
-                    const isSelect = customData.defaultVal.indexOf(v.key) > -1
-                    if (v.label === '全部') {
-                      this.customRC.allKey = v.key
-                    }
-                    return {
-                      children: [
-                        {
-                          disabled: false,
-                          indeterminate: false,
-                          selected: isSelect,
-                          label: '全部',
-                          value: '全部',
-                          parent: v.label
-                        }
-                      ],
-                      disabled: false,
-                      indeterminate: false,
-                      selected: isSelect,
-                      label: v.label,
-                      value: v.label === '全部' ? '全部' : v.key
-                    }
-                  })
-                  this.customRC.selectVal = customData.defaultVal
-                  this.customRC.show = true
-                } catch (e) {
-                  console.warn(e)
-                }
+                this.resetCustomFilter(customData)
               }
             }
           }.bind(this),
@@ -4762,6 +4774,7 @@ function checkTagDisabled () {
       // 重置筛选
       onResetFilter: function() {
         this.resetAll()
+        this.resetCustomFilter()
         beforeSubmit('filter-reset')
       },
       // 已存筛选条件