// pages/emergency/resourse/index/index.js
const app = getApp();

Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    condition: '',
    curTab: 0,
    tabs: [{
      lab: '全部',
      val: 0
    }, {
      lab: '火灾',
      val: 0
    }, {
      lab: '地震',
      val: 0
    }, {
      lab: '暴雨',
      val: 0
    }],

    canChange: false,
    freshIng: false,
    page: 1,
    pageSize: 10,
    list: [{
      name: 'xxxxxx预案名称',
      type: '火灾',
      val: ''
    }, {
      name: 'xxxxxx预案名称',
      type: '地震',
      val: ''
    }, {
      name: 'xxxxxx预案名称',
      type: '暴雨',
      val: ''
    }]
  },

  pageLifetimes: {
    show: function () {
      this.getList();
    },
  },

  /**
   * 组件的方法列表
   */
  methods: {

    /**
     * 搜索
     */
    inputSearch: function (e) {
      this.data.condition = e.detail.value;
      this.refresh();
    },

    /**
     * 切换筛选
     */
    tabSelect: function (params) {
      const index = Number.parseInt(params.currentTarget.dataset.index);
      this.data.curTab = index;
      this.setData(this.data)
    },

    /**
     * 刷新
     * @param {*} params 
     */
    refresh: function (params) {
      this.data.page = 1;
      // this.data.list = [];
      this.setData(this.data)
      this.getList();
    },

    /**
     * 获取列表
     */
    getList: function () {
      let url = ""
      const params = {
        page: this.data.page,
        pageSize: this.data.pageSize,
      }
    }
  }
})