This commit is contained in:
熊成强 2020-11-13 18:12:53 +08:00
parent 16ee3ecdc1
commit 363d9a4b72

View File

@ -5,7 +5,7 @@
:props="props"
:options="timeOptions"
@change="handleChange"
v-model="defaultStartId"
v-model="startId"
style="width:250px">
</el-cascader>
<div class="report_content">
@ -89,10 +89,8 @@ export default {
return {
//
pickerTime: '',
//
defaultStartId: [],
// id
startId: '',
startId: [0, 0],
//
statisticals: [
{num: '0', desc: '参与人数'},
@ -109,30 +107,19 @@ export default {
//
value: [],
timeOptions: [{
value: 0,
label: '月底',
startId: 0,
time: '月底',
children: []
}, {
value: 1,
label: '自定义',
startId: 1,
time: '自定义',
children: []
}],
//
props: {
lazy: true,
lazyLoad: (node, resolve) => {
//
let type = node.data.value
// 2
this.handleStartsReq(type, function (reslut) {
const childNode = Array.from(reslut.list).map(item => ({
value: item.startId,
label: item.time
}))
// console.log(childNode)
resolve(childNode)
})
}
value: 'startId',
label: 'time',
level: true
},
//
option: {
@ -215,7 +202,8 @@ export default {
computed: {
},
beforeMount () { },
mounted () {
async mounted () {
await this.handleStartsReq()
this.handleChartDataReq()
},
methods: {
@ -286,15 +274,6 @@ export default {
this.$loadingStart()
const result = await getChartData(params)
this.$loadingEnd()
// startIdstartId
if (typeof startId === 'undefined') {
this.defaultStartId[0] = result.data[0].type
this.defaultStartId[1] = result.data[0].defaultId
this.startId = result.data[0].defaultId
this.defaultStartName = result.data[0].defaultTime
//
// this.handleStartsReq(result.data[0].type)
}
result.data.forEach((val, index) => {
if (val.type === 0) {
//
@ -325,21 +304,22 @@ export default {
pageSize: 999
}
try {
let res = await getStartsData(params)
if (typeof handleNode === 'undefined') {
let children = Array.from(res.data.list).map(item => ({
value: item.startId,
label: item.time,
leaf: true
}))
if (type === 0) {
this.timeOptions[0].children = children
} else {
this.timeOptions[1].children = children
for (let i in this.timeOptions) {
let res = await getStartsData(Object.assign({}, params, { cycleType: this.timeOptions[i].startId }))
if (res.code !== 200) return this.$message.error(res.msg)
res = res.data
console.log('res: ', res)
this.key += 10
this.timeOptions[i].children = res.list.map((m, mindex) => {
console.log('timeOptions: ', typeof i)
if (i === '0' && mindex === 0) {
this.startId = [0, m.startId]
}
} else {
handleNode(res.data)
return m
})
}
console.log('this.timeOptions: ', this.timeOptions)
} catch (error) {
console.log(error)
}