【金掌桂2022年开门红需求--业绩查询】active在父组件算好,在传给子组件,避免触发change事件,否则会导致this.getSetDate()多调用一次问题

This commit is contained in:
liyuetong
2021-11-19 16:39:50 +08:00
parent 893c8825af
commit 353fc60771
3 changed files with 71 additions and 52 deletions

View File

@@ -65,7 +65,7 @@ export default {
}
},
async getSchemePics() {
const result = await makePosters({})
const result = await makePosters({systemType:'h5'})
if (result.result === '0') {
this.isShow = result.content.isShow
this.pics = result.content.pictureUrl

View File

@@ -43,11 +43,16 @@ export default {
availableLevel: {
type: Number,
default: 0
},
//active在父组件算好在传给子组件避免触发change事件否则会导致this.getSetDate()多调用一次问题
active: {
type: Number,
default: 0
}
},
data() {
return {
active: 0,
// active: 0,
tabs: [
{ name: '中心支公司', available: false, level: 3 },
{ name: '营销服务部', available: false, level: 4 },

View File

@@ -1,53 +1,59 @@
<template>
<div>
<div class="header">
<div class="header-left">
<van-button>
<img :src="point" />
<span class="ml5 mr5">标保</span>
</van-button>
<div v-if="isGeneralAgent == '1'">
<div class="header">
<div class="header-left">
<van-button>
<img :src="point" />
<span class="ml5 mr5">标保</span>
</van-button>
</div>
<!-- <div class="header-center">
<van-button class="btn-gray" :class="{ activeBtn: timeType === 0 }" @click="isDayConditionShow = true"></van-button>
<van-button class="btn-gray month" :class="{ activeBtn: timeType === 1 }" @click="isMonthConditionShow = true"></van-button>
<van-button class="btn-gray" :class="{ activeBtn: timeType === 2 }" @click="isYearConditionShow = true"></van-button>
</div> -->
<div class="header-right">
<van-button @click="isTimeBarShow = true">
<span class="mr5">{{ timeCondition }}</span>
<van-icon name="arrow-down" />
</van-button>
</div>
</div>
<!-- <div class="header-center">
<van-button class="btn-gray" :class="{ activeBtn: timeType === 0 }" @click="isDayConditionShow = true"></van-button>
<van-button class="btn-gray month" :class="{ activeBtn: timeType === 1 }" @click="isMonthConditionShow = true"></van-button>
<van-button class="btn-gray" :class="{ activeBtn: timeType === 2 }" @click="isYearConditionShow = true"></van-button>
</div> -->
<div class="header-right">
<van-button @click="isTimeBarShow = true">
<span class="mr5">{{ timeCondition }}</span>
<van-icon name="arrow-down" />
</van-button>
<!-- 筛选 -->
<div class="classification">
<div :style="scrollObj">
<span>机构名称: </span>
<span v-for="(level, index) in (8-levelLength)+1" :key="index" class="filter" @click="showLevelCondition(levelLength + index)">
<!-- <span>{{ levelNames[level] }}</span> -->
<span>{{ levelNames[levelLength + index] }}</span>
<van-icon name="arrow-down" />
</span>
</div>
</div>
</div>
<!-- 筛选 -->
<div class="classification">
<div :style="scrollObj">
<span>机构名称: </span>
<span v-for="(level, index) in (8-levelLength)+1" :key="index" class="filter" @click="showLevelCondition(levelLength + index)">
<!-- <span>{{ levelNames[level] }}</span> -->
<span>{{ levelNames[levelLength + index] }}</span>
<van-icon name="arrow-down" />
</span>
<div class="content">
<Organization ref="organization" @updateQueryCom="updateQueryCom" :availableLevel.sync="availableLevel" :active.sync="active" />
</div>
<!-- 机构筛选栏 -->
<van-popup v-for="(level, index) in 8" :key="index" v-model="popCondition[index]" position="bottom" :style="{ height: '40vh' }">
<van-picker show-toolbar :columns="columns[level]" @confirm="onLevelConditionConfirm($event, level)" @cancel="closeLevelConditionPopup(level)" />
</van-popup>
<!-- 时间筛选栏 -->
<van-popup v-model="isTimeBarShow" position="bottom" :style="{ height: '40vh' }">
<van-datetime-picker
v-model="dayTimeCondition"
type="datetime"
:min-date="minDate"
:max-date="maxDate"
@confirm="onDayTimeConditionConfirm"
@cancel="isTimeBarShow = false"
/>
</van-popup>
</div>
<div class="content">
<Organization ref="organization" @updateQueryCom="updateQueryCom" :availableLevel.sync="availableLevel" />
<div v-else-if="isGeneralAgent == '0'" class="text-center">
<img class="mt40 w250" src="@/assets/images/pic_page-non.png" />
<div class="fs17 c-gray-dark mt40">普通代理人暂无数据</div>
</div>
<!-- 机构筛选栏 -->
<van-popup v-for="(level, index) in 8" :key="index" v-model="popCondition[index]" position="bottom" :style="{ height: '40vh' }">
<van-picker show-toolbar :columns="columns[level]" @confirm="onLevelConditionConfirm($event, level)" @cancel="closeLevelConditionPopup(level)" />
</van-popup>
<!-- 时间筛选栏 -->
<van-popup v-model="isTimeBarShow" position="bottom" :style="{ height: '40vh' }">
<van-datetime-picker
v-model="dayTimeCondition"
type="datetime"
:min-date="minDate"
:max-date="maxDate"
@confirm="onDayTimeConditionConfirm"
@cancel="isTimeBarShow = false"
/>
</van-popup>
<!-- -->
<!-- <van-popup v-model="isDayConditionShow" position="bottom" :style="{ height: '40vh' }">
<van-datetime-picker v-model="dayCondition" type="date" :max-date="maxDate" @confirm="onDayConditionConfirm" @cancel="isDayConditionShow = false" />
@@ -93,6 +99,7 @@ export default {
},
data() {
return {
isGeneralAgent:null, //是否为普通代理人
levelLength:1, //内勤职级数为8外勤区部组职级数不确定
// 代理人是否是内勤
isInner: false,
@@ -125,6 +132,7 @@ export default {
dayTimeCondition: currentDate,
// 0: 标保, 1: 人力, 2: 产品
typeIndex: 0,
//子组件机构名称的角标等于this.availableLevel - 3
active: 0,
// 日期筛选是否显示
isTimeBarShow: false,
@@ -145,6 +153,7 @@ export default {
7: '全部',
8: '全部'
},
// level1Code: '86',
level1Code: 0,
level1Objs: [],
level2Code: 0,
@@ -189,17 +198,21 @@ export default {
//内勤level 01,02,03,04,05时从全国开始 服务机构 外勤level 06,07,08时从当前职级开始
if (resData.result != '0') return this.$toast(resData.resultMessage)
let manageLv = Number(resData.content.level.substr(1, 1))
this.isGeneralAgent = manageLv == 9?'0':'1' //是否为普通代理人
if(manageLv == '1' || manageLv == '2' || manageLv == '3' || manageLv == '4'|| manageLv == '5'){
this.initData() //内勤
}else{
let manageCode = resData.content.code
//外勤时level${manageLv}Code需要获取当前用户的inCode否则全部时不会获取到上个职级的Code值
this[`level${manageLv}Code`] = resData.content.inCode
//外勤区部组职级数
this.levelLength = manageLv
// 外勤当前用户的第一职级
this.levelNames[manageLv] = resData.name
this.levelNames[manageLv] = resData.content.name
this.availableLevel = manageLv
this.active = this.availableLevel - 3
this[`level${manageLv}Objs`].splice(0)
this[`level${manageLv}Objs`].push(resData)
this[`level${manageLv}Objs`].push(resData.content)
this.setLevelColumnsWai(manageLv)
this.initData(manageCode,manageLv) //外勤
}
@@ -301,7 +314,7 @@ export default {
if (data === '全国') {
this.params.manageLv = '01'
} else if (data === '全部') {
this.params.manageLv = `0${level}`
this.params.manageLv = `0${level-1}`
} else {
// this.params.manageLv = `0${level + 1}`
this.params.manageLv = `0${level}`
@@ -325,9 +338,9 @@ export default {
this.reset()
}
},
async dataTypeChange() {
await this.getSetDate()
},
// async dataTypeChange() {
// await this.getSetDate()
// },
setRightBtn() {
setTimeout(() => {
window.EWebBridge.webCallAppInJs('webview_right_button', {
@@ -366,7 +379,7 @@ export default {
this.setLevelColumns(firsts[0].level)
this.params.manageCode = manageLv > 5 ? this[`level${manageLv}Objs`][0].inCode : this[`level${manageLv}Objs`][0].code
this.params.manageLv = `0${manageLv}`
// await this.getSetDate()
await this.getSetDate()
}else { // 内勤
// 原逻辑--开始
// 设置下拉选
@@ -384,6 +397,7 @@ export default {
// 外勤可以查看的最高级别机构
const availableOrg = firsts[0]
this.availableLevel = availableOrg.level
this.active = this.availableLevel - 3
// 查询下级机构
const data = await this.getLevelFilterColumn(availableOrg.code, availableOrg.level)
if (data) {