提交 d019365e authored 作者: lidongxu's avatar lidongxu

refactor: w

w
上级 13415468
<template>
<PickerSearch v-model:show="showEmployee"
:columns="showEmployeeList"
placeholder="搜索归属人"
@confirm="onEmployeeConfirm"
@search="searchEmployee" />
</template>
<script setup>
import { getChargeListAPI } from '@/api'
// 选择归属人弹窗组件
// 归属人
const allEmpolyeeList = ref([])
const getEmployeeList = async () => {
const res = await getChargeListAPI()
allEmpolyeeList.value = res.data.map(item => {
return {
text: item.name,
value: item.id,
employeeNo: item.employeeNo,
deptQcName: item.deptQcName,
deptQcId: item.deptQcId
}
})
}
getEmployeeList()
// 确定归属人
const onEmployeeConfirm = (val) => {
props.query.employeeId = val.selectedOptions[0].value
showEmployee.value = false
emits('query')
}
// 搜索归属人
const searchEmployee = (searchName) => {
showEmployeeList.value = allEmpolyeeList.filter(item => {
return item.text.includes(searchName)
})
}
</script>
<style scoped></style>
\ No newline at end of file
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
<PlanSearch v-model:show="showSearch" <PlanSearch v-model:show="showSearch"
v-model:query="query" v-model:query="query"
:planColumns="planColumns" :planColumns="planColumns"
:allEmpolyeeList="allEmpolyeeList"
@query="querySearch" /> @query="querySearch" />
<!-- 新增组件(浮动气泡) --> <!-- 新增组件(浮动气泡) -->
<van-floating-bubble icon="plus" <van-floating-bubble icon="plus"
...@@ -82,7 +81,7 @@ import userStore from '@/store/modules/user' ...@@ -82,7 +81,7 @@ import userStore from '@/store/modules/user'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { checkPlanExpire } from '@/hooks' import { checkPlanExpire } from '@/hooks'
import { getPromotionActiveStatus } from '@/dicts' import { getPromotionActiveStatus } from '@/dicts'
import { getChargeListAPI, getPlanListAPI, deletePlanAPI } from '@/api' import { getPlanListAPI, deletePlanAPI } from '@/api'
import PlanSearch from './plan-search.vue' import PlanSearch from './plan-search.vue'
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -114,20 +113,7 @@ const planColumns = [ ...@@ -114,20 +113,7 @@ const planColumns = [
} }
] ]
// 归属人
const allEmpolyeeList = ref([])
const getEmployeeList = async () => {
const res = await getChargeListAPI()
allEmpolyeeList.value = res.data.map(item => {
return {
text: item.name,
value: item.id,
employeeNo: item.employeeNo,
deptQcName: item.deptQcName,
deptQcId: item.deptQcId
}
})
}
const getPlanList = async () => { const getPlanList = async () => {
// 搜索条件改变/刷新时,页码重置为 1 // 搜索条件改变/刷新时,页码重置为 1
...@@ -203,7 +189,6 @@ const deletePlan = (row) => { ...@@ -203,7 +189,6 @@ const deletePlan = (row) => {
} }
const init = async () => { const init = async () => {
await getEmployeeList()
getPlanList() getPlanList()
} }
init() init()
......
...@@ -51,11 +51,8 @@ ...@@ -51,11 +51,8 @@
:disabled="promotionIdentity" :disabled="promotionIdentity"
@click="showEmployee = true"> @click="showEmployee = true">
</van-field> </van-field>
<PickerSearch v-model:show="showEmployee" <PickerBelong v-model:show="showEmployee"
:columns="showEmployeeList" @confirm="onEmployeeConfirm" />
placeholder="搜索归属人"
@confirm="onEmployeeConfirm"
@search="searchEmployee" />
<!-- 店铺名 --> <!-- 店铺名 -->
<van-field v-model="query.storeNameLike" <van-field v-model="query.storeNameLike"
...@@ -75,6 +72,7 @@ ...@@ -75,6 +72,7 @@
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { useDatePickerOptions } from '@/hooks' import { useDatePickerOptions } from '@/hooks'
import userStore from '@/store/modules/user' import userStore from '@/store/modules/user'
import PickerBelong from '../components/PickerBelong'
const promotionIdentity = computed(() => userStore().promotionIdentity) const promotionIdentity = computed(() => userStore().promotionIdentity)
const employeeNo = computed(() => userStore().employeeNo) const employeeNo = computed(() => userStore().employeeNo)
...@@ -116,10 +114,7 @@ const searchDateStr = computed(() => { ...@@ -116,10 +114,7 @@ const searchDateStr = computed(() => {
} }
return [props.query.activityStartDate, props.query.activityEndDate].map(o => parseTime(o, "{y}-{m}-{d}")).join(' 至 ') return [props.query.activityStartDate, props.query.activityEndDate].map(o => parseTime(o, "{y}-{m}-{d}")).join(' 至 ')
}) })
// 日历最小范围
const searchMinDate = computed(() => {
return new Date(!props.query.activityStartDate ? new Date().getFullYear() - 1 : props.query.activityStartDate.getFullYear() - 1, 0, 1)
})
// 日期日历范围 // 日期日历范围
const selSearchCalendar = () => { const selSearchCalendar = () => {
// 默认设置今日日期 // 默认设置今日日期
...@@ -148,23 +143,7 @@ const confirmPlan = (val) => { ...@@ -148,23 +143,7 @@ const confirmPlan = (val) => {
// 归属人 // 归属人
const showEmployee = ref(false) const showEmployee = ref(false)
// 展示归属人
const showEmployeeList = ref([])
watch(() => props.allEmpolyeeList, (newValue) => {
showEmployeeList.value = newValue
// 如果是城市经理默认填充
if (promotionIdentity.value) {
// 找到员工的 id
const obj = newValue.find(o => o.employeeNo === employeeNo.value)
props.query.employeeId = obj.value
}
})
// 搜索归属人
const searchEmployee = (searchName) => {
showEmployeeList.value = props.allEmpolyeeList.filter(item => {
return item.text.includes(searchName)
})
}
// 确定归属人 // 确定归属人
const onEmployeeConfirm = (val) => { const onEmployeeConfirm = (val) => {
props.query.employeeId = val.selectedOptions[0].value props.query.employeeId = val.selectedOptions[0].value
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论