UNPKG

manage-client

Version:

经营管控模块前台组件

63 lines (60 loc) 1.65 kB
let DataStore = { params: {}, singleValues: {}, gasstyles: {}, gasbrands: [], price: [], adjustables: [], getParam (key) { console.log("获取key的值"); console.log(key); return this.params[key] }, getSingleValue (key) { return this.singleValues[key] }, getGasstyle (key) { return this.gasbrands.key }, getGasbrand () { return this.gasbrands }, getAdjustable () { // 数组去重 let arr = [] this.adjustables.forEach((item, next) => { arr.push(item) }) let hash = {} let result = arr.reduce((item, next) => { hash[next.label] ? '' : hash[next.label] = true && item.push(next) return item }, []) return Array.from(new Set(result)) }, getPrice (object) { // 目前支持三个字段并都有值 f_user_type,f_gasproperties,f_price_type if (!object.f_user_type || !object.f_gasproperties || !object.f_price_type) { return } let result = [] // 做筛选 this.price.forEach((item) => { if (item.f_state === '有效' && object.f_user_type === item.f_user_type && object.f_gasproperties === item.f_gasproperties && object.f_price_type === item.f_price_type) { let value = { label: item.f_price_name, value: item } result.push(value) } }) // 数组去重 let hash = {} result = result.reduce((item, next) => { hash[next.label] ? '' : hash[next.label] = true && item.push(next) return item }, []) return Array.from(new Set(result)) } } export default DataStore