优化
This commit is contained in:
parent
16ee3ecdc1
commit
363d9a4b72
@ -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()
|
||||
// 如果没传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) => {
|
||||
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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user