Commit 19b3e88e by 匡雅琴

添加全部选项

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