Commit 19b3e88e by 匡雅琴

添加全部选项

1 parent b96557c4
......@@ -72,10 +72,17 @@ export default {
empty: '暂无数据'
}
},
watch: {
'defaultValue'(val) {
this.value = val
}
},
mounted() {
const { valueName, isObject, dataList, defaultValue } = this
const isDefaultObject = (defaultValue instanceof Object)
console.log(isDefaultObject,dataList);
this.value = isDefaultObject ? defaultValue[valueName] : defaultValue || (isObject ? dataList[0][valueName] : dataList[0])
console.log(this.value);
},
methods: {
select(item) {
......
......@@ -79,6 +79,11 @@ export default {
async getRetailYearsArea() {
const _result = await this.api.equity.getRetailYearsArea({})
const { areas, years } = _result.data.dataList[0]
console.log(areas, years)
areas.unshift('全部')
years.unshift('全部')
this.defaultArea = areas[0]
this.defaultMonth = years[0]
this.areaDataList = areas
this.monthDataList = years
},
......@@ -86,6 +91,8 @@ export default {
async getWholesaleYears() {
const _result = await this.api.equity.getWholesaleYears({})
const { years } = _result.data.dataList[0]
this.defaultMonth = years[0]
years.unshift('全部')
this.monthDataList = years
},
switchArea() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!