// pages/cattle/cattle.js - 生产管理/牛羊管理页面
Page({
  data: {
    // 牛只管理功能列表
    cattleFunctions: [
      { id: 1, name: '牛档案', iconText: '📁', color: 'icon-cyan', url: '/pages/cattle/archive/archive' },
      { id: 2, name: '发情记录', iconText: '💗', color: 'icon-orange', url: '/pages/cattle/estrus/estrus' },
      { id: 3, name: '配种记录', iconText: '🔬', color: 'icon-blue', url: '/pages/cattle/breeding/breeding' },
      { id: 4, name: '妊娠记录', iconText: '🤰', color: 'icon-yellow', url: '/pages/cattle/pregnancy/pregnancy' },
      { id: 5, name: '分娩记录', iconText: '👶', color: 'icon-green', url: '/pages/cattle/birth/birth' },
      { id: 6, name: '断奶记录', iconText: '🍼', color: 'icon-purple', url: '/pages/cattle/weaning/weaning' },
      { id: 7, name: '转栏记录', iconText: '🔄', color: 'icon-red', url: '/pages/cattle/transfer/transfer' },
      { id: 8, name: '离栏记录', iconText: '🚪', color: 'icon-teal', url: '/pages/cattle/exit/exit' },
      { id: 9, name: '栏舍设置', iconText: '🏠', color: 'icon-indigo', url: '/pages/cattle/pen/pen' },
      { id: 10, name: '批次设置', iconText: '📦', color: 'icon-pink', url: '/pages/cattle/batch/batch' },
      { id: 11, name: '防疫预警', iconText: '💉', color: 'icon-lime', url: '/pages/cattle/vaccination/vaccination' }
    ],
    // 猪只管理功能列表
    pigFunctions: [
      { id: 1, name: '猪档案', iconText: '📁', color: 'icon-cyan', url: '/pages/pig/archive/archive' },
      { id: 2, name: '发情记录', iconText: '💗', color: 'icon-orange', url: '/pages/pig/estrus/estrus' },
      { id: 3, name: '配种记录', iconText: '🔬', color: 'icon-blue', url: '/pages/pig/breeding/breeding' },
      { id: 4, name: '妊娠记录', iconText: '🤰', color: 'icon-yellow', url: '/pages/pig/pregnancy/pregnancy' },
      { id: 5, name: '分娩记录', iconText: '👶', color: 'icon-green', url: '/pages/pig/birth/birth' },
      { id: 6, name: '断奶记录', iconText: '🍼', color: 'icon-purple', url: '/pages/pig/weaning/weaning' },
      { id: 7, name: '转栏记录', iconText: '🔄', color: 'icon-red', url: '/pages/pig/transfer/transfer' },
      { id: 8, name: '离栏记录', iconText: '🚪', color: 'icon-teal', url: '/pages/pig/exit/exit' },
      { id: 9, name: '栏舍设置', iconText: '🏠', color: 'icon-indigo', url: '/pages/pig/pens/pens' },
      { id: 10, name: '批次设置', iconText: '📦', color: 'icon-pink', url: '/pages/pig/batches/batches' },
      { id: 11, name: '防疫预警', iconText: '💉', color: 'icon-lime', url: '/pages/pig/vaccination/vaccination' }
    ]
  },

  onLoad() {
    console.log('牛羊管理页面加载')
  },

  onShow() {
    console.log('牛羊管理页面显示')
  },

  onPullDownRefresh() {
    // 下拉刷新
    setTimeout(() => {
      wx.stopPullDownRefresh()
      wx.showToast({
        title: '刷新成功',
        icon: 'success'
      })
    }, 1000)
  },

  // 导航到功能页面
  navigateTo(e) {
    const url = e.currentTarget.dataset.url
    if (url) {
      wx.navigateTo({
        url,
        fail: () => {
          wx.showToast({
            title: '功能开发中',
            icon: 'none'
          })
        }
      })
    } else {
      wx.showToast({
        title: '功能开发中',
        icon: 'none'
      })
    }
  }
})
