privateField.js 907 B

1234567891011121314151617181920212223242526272829
  1. import { mapGetters } from 'vuex'
  2. const privateField = {
  3. computed: {
  4. ...mapGetters(['private_field', 'isSupertube', 'originLevel'])
  5. },
  6. methods: {
  7. /**
  8. * @description
  9. * 1 成本价 2 销售价 3 毛利率
  10. * 1. 超管可以查看所有
  11. * 2. 供应商(originLevel === '3') 可以查看成本(type === '1)
  12. * 3. 业务公司(originLevel === '2') 根据角色的private_field查看
  13. */
  14. isDisplayPrivateField(type) {
  15. const vm = this
  16. const { isSupertube, originLevel, private_field } = vm
  17. console.log(originLevel, private_field)
  18. if (isSupertube) return true
  19. if (originLevel === '3' && type === '1') return true
  20. if (originLevel === '2' && private_field && private_field.includes(type)) return true
  21. },
  22. displayPrivateField(isDisplay, value) {
  23. return isDisplay ? value : '******'
  24. }
  25. }
  26. }
  27. export default privateField