var VUE = null
window.addEventListener('load', function () {
  VUE = new Vue({
    // 在原有Vue实例中添加
    el: '#app',
    data() {
      return {
        shanghuName: '',
        // 新增子Tab数据
        subActiveTab: 0,
        hazardList: [
          {
            id: 1,
            description: '消防通道被货物堵塞，存在严重安全隐患',
            status: '待审核',
            date: '2024-03-15',
            shop: 'XX餐饮店',
            type: 2,
          },
          {
            id: 2,
            description: '消防通道被货物堵塞，存在严重安全隐患',
            status: '待整改',
            date: '2024-03-15',
            shop: 'XX餐饮店',
            type: 2,
          },
          // 更多示例数据...
        ],
        activeTab: '',
      }
    },
    computed: {
      filteredHazards() {
        const statusMap = ['全部', '待审核', '待整改', '已整改']
        return this.hazardList.filter((item) =>
          this.subActiveTab === 0
            ? true
            : item.status === statusMap[this.subActiveTab]
        )
      },
    },
    created() {
      this.init()
    },
    methods: {
      init() {
        this.getHazardList()
      },
      onSearch() {
        console.log('xxxx')
      },
      // 新增选择确认方法
      onConfirmType(value) {
        this.formData.type = value
        this.showTypePicker = false
      },
      statusTagType(status) {
        const types = {
          待审核: 'warning',
          待整改: 'primary',
          已整改: 'success',
          整改逾期: 'danger',
        }
        return types[status] || ''
      },
      viewDetail(id) {
        console.log('查看详情:', id)
        let param = {
          id: id,
          flag: 'YH_XQ',
          pageName: '_yh_check',
        }
        let url = gemhoUtil.setParameter('_check_info.html', param)
        console.log(url)

        gemhoUtil.navigatePage(url, '跳转中...')
        // 这里添加跳转逻辑
      },
      //获取隐患列表数据
      getHazardList() {
        http
          .get('/gq/hiddenDanger/list?merId=1&status=' + this.activeTab)
          .then((res) => {
            console.log(res)
          })
      },
    },
  })
})
