index.js 3.02 KB
/*
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-05-17 10:42:40
 */
export default {
  data () {
    return {
      isSearch: false,
      searchList: [],
      otherForm: {}
    }
  },
  methods: {
    // 点击高级查询弹出查询弹框
    /**
     * @description: 点击高级查询弹出查询弹框
     * @author: renchao
     */
    moreQueryClick () {
      this.isSearch = true

    },
    // 查询事件
    /**
     * @description: 查询事件
     * @param {*} bs
     * @param {*} mc
     * @param {*} code
     * @author: renchao
     */
    handleSelect (bs, mc, code) {
      this.dictData[bs].forEach(item => {
        if (item.dcode == this.queryForm[code]) {
          this.searchForm[mc] = item.dname
        }
      })
    },
    // 清空单个表单
    /**
     * @description: 清空单个表单
     * @param {*} el
     * @author: renchao
     */
    handleEmpty (el) {
      for (var i = 0; i < this.searchList.length; i++) {
        if (el == this.searchList[i].zdm) {
          this.searchList.splice(i, 1)
        }
      }
      let obj = {
        ywlymc: 'ywly',
        qllxmc: 'qllx',
        djlxmc: 'djlx'
      }
      if (obj[el]) {
        this.queryForm[obj[el]] = ''
      } else if (this.otherForm[[el]]) {
        this.otherForm[[el]] = ''
      } else {
        this.queryForm[el] = ''
      }
      this.searchForm[el] = ''
    },
    // 删除单个查询条件
    /**
     * @description: 删除单个查询条件
     * @param {*} item
     * @param {*} index
     * @author: renchao
     */
    handelItem (item, index) {
      let obj = {
        ywlymc: 'ywly',
        qllxmc: 'qllx',
        djlxmc: 'djlx'
      }
      this.searchList.splice(index, 1)
      if (obj[item.zdm]) {
        this.queryForm[obj[item.zdm]] = ''
      } else if (this.otherForm[[item.zdm]]) {
        this.otherForm[[item.zdm]] = ''
      } else {
        this.queryForm[item.zdm] = ''
      }
      this.searchForm[item.zdm] = ''
    },
    /**
     * @description: iterationData
     * @author: renchao
     */
    iterationData () {
      let obj = {
        ywlymc: '业务来源', qllxmc: '权利类型', djlxmc: '登记类型', ywh: '业务号', sqywmc: '申请业务名称',
        qlrmc: '权利人', ywrmc: '义务人', slsj: '受理时间'
      }
      this.searchList = Object.entries({ ...this.searchForm, ...this.otherForm }).map((item) => {
        const [name, value] = item
        if (value) return { name: obj[name], value, zdm: name }
      }).filter(Boolean)
    },
    /**
     * @description: getSearch
     * @param {*} val
     * @author: renchao
     */
    getSearch (val) {
      this.otherForm = val
      this.iterationData()
      this.queryClick()
    },
    // 清空查询条件
    /**
     * @description: 清空查询条件
     * @author: renchao
     */
    hanldeCleanAll () {
      this.searchForm = {}
      this.queryForm = {
        ywly: "",
        qllx: "",
        djlx: "",
        ywh: ""
      }
      this.otherForm = {}
      this.searchList = []
      this.queryClick()
    }
  }
}