BusiCard.js 1.17 KB
// pages/tab/output/components/BusiCard/BusiCard.js
import constantData from './constant/data'
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    info: {
      type: Object,
      value: {}
    },
    sceneCode: {
      type: String,
      value: '-1'
    },
    fromPage: {
      type: String,
      value: 'client'
    },
    formData: {
      type: Object,
      value: () => { }
    }
  },

  lifetimes: {
    attached() {
      let { fromPage, clientFormObj, staffFormObj } = this.data
      let _obj = {}
      switch (fromPage) {
        case 'staff':
          _obj = JSON.parse(JSON.stringify(staffFormObj))
          break
        default:
          _obj = JSON.parse(JSON.stringify(clientFormObj))
          break
      }
      this.setData({
        formObj: _obj
      })
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    formObj: {},
    timeTabObj: constantData.timeTabObj,
    clientFormObj: constantData.clientFormObj,
    staffFormObj: constantData.staffFormObj
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleItemTap(e) {
      const { item } = e.currentTarget.dataset
      this.triggerEvent('handleItemTap', item)
    }
  }
})