优化
This commit is contained in:
parent
16ee3ecdc1
commit
363d9a4b72
@ -5,7 +5,7 @@
|
|||||||
:props="props"
|
:props="props"
|
||||||
:options="timeOptions"
|
:options="timeOptions"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
v-model="defaultStartId"
|
v-model="startId"
|
||||||
style="width:250px">
|
style="width:250px">
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
<div class="report_content">
|
<div class="report_content">
|
||||||
@ -89,10 +89,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
// 当前选择的月份
|
// 当前选择的月份
|
||||||
pickerTime: '',
|
pickerTime: '',
|
||||||
// 给选择器设置默认选项
|
|
||||||
defaultStartId: [],
|
|
||||||
// 当前的绩效id
|
// 当前的绩效id
|
||||||
startId: '',
|
startId: [0, 0],
|
||||||
//
|
//
|
||||||
statisticals: [
|
statisticals: [
|
||||||
{num: '0', desc: '参与人数'},
|
{num: '0', desc: '参与人数'},
|
||||||
@ -109,30 +107,19 @@ export default {
|
|||||||
//
|
//
|
||||||
value: [],
|
value: [],
|
||||||
timeOptions: [{
|
timeOptions: [{
|
||||||
value: 0,
|
startId: 0,
|
||||||
label: '月底',
|
time: '月底',
|
||||||
children: []
|
children: []
|
||||||
}, {
|
}, {
|
||||||
value: 1,
|
startId: 1,
|
||||||
label: '自定义',
|
time: '自定义',
|
||||||
children: []
|
children: []
|
||||||
}],
|
}],
|
||||||
//
|
//
|
||||||
props: {
|
props: {
|
||||||
lazy: true,
|
value: 'startId',
|
||||||
lazyLoad: (node, resolve) => {
|
label: 'time',
|
||||||
// 获取节点类型
|
level: true
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// 考核人数报表持有类
|
// 考核人数报表持有类
|
||||||
option: {
|
option: {
|
||||||
@ -215,7 +202,8 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
beforeMount () { },
|
beforeMount () { },
|
||||||
mounted () {
|
async mounted () {
|
||||||
|
await this.handleStartsReq()
|
||||||
this.handleChartDataReq()
|
this.handleChartDataReq()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -286,15 +274,6 @@ export default {
|
|||||||
this.$loadingStart()
|
this.$loadingStart()
|
||||||
const result = await getChartData(params)
|
const result = await getChartData(params)
|
||||||
this.$loadingEnd()
|
this.$loadingEnd()
|
||||||
// 如果没传startId则对startId赋予初始值,
|
|
||||||
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) => {
|
result.data.forEach((val, index) => {
|
||||||
if (val.type === 0) {
|
if (val.type === 0) {
|
||||||
// 头部数据
|
// 头部数据
|
||||||
@ -325,21 +304,22 @@ export default {
|
|||||||
pageSize: 999
|
pageSize: 999
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let res = await getStartsData(params)
|
for (let i in this.timeOptions) {
|
||||||
if (typeof handleNode === 'undefined') {
|
let res = await getStartsData(Object.assign({}, params, { cycleType: this.timeOptions[i].startId }))
|
||||||
let children = Array.from(res.data.list).map(item => ({
|
if (res.code !== 200) return this.$message.error(res.msg)
|
||||||
value: item.startId,
|
res = res.data
|
||||||
label: item.time,
|
console.log('res: ', res)
|
||||||
leaf: true
|
this.key += 10
|
||||||
}))
|
this.timeOptions[i].children = res.list.map((m, mindex) => {
|
||||||
if (type === 0) {
|
console.log('timeOptions: ', typeof i)
|
||||||
this.timeOptions[0].children = children
|
|
||||||
} else {
|
if (i === '0' && mindex === 0) {
|
||||||
this.timeOptions[1].children = children
|
this.startId = [0, m.startId]
|
||||||
}
|
}
|
||||||
} else {
|
return m
|
||||||
handleNode(res.data)
|
})
|
||||||
}
|
}
|
||||||
|
console.log('this.timeOptions: ', this.timeOptions)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user