1234567891011121314151617181920212223242526272829 |
- import { mapGetters } from 'vuex'
- const privateField = {
- computed: {
- ...mapGetters(['private_field', 'isSupertube', 'originLevel'])
- },
- methods: {
- /**
- * @description
- * 1 成本价 2 销售价 3 毛利率
- * 1. 超管可以查看所有
- * 2. 供应商(originLevel === '3') 可以查看成本(type === '1)
- * 3. 业务公司(originLevel === '2') 根据角色的private_field查看
- */
- isDisplayPrivateField(type) {
- const vm = this
- const { isSupertube, originLevel, private_field } = vm
- console.log(originLevel, private_field)
- if (isSupertube) return true
- if (originLevel === '3' && type === '1') return true
- if (originLevel === '2' && private_field && private_field.includes(type)) return true
- },
- displayPrivateField(isDisplay, value) {
- return isDisplay ? value : '******'
- }
- }
- }
- export default privateField
|