refactor: 提取公共选项定义

This commit is contained in:
dhb52 2024-01-21 12:47:12 +08:00
parent 7c0c651592
commit c38bbb99a1
4 changed files with 45 additions and 47 deletions

View File

@ -1,4 +1,5 @@
<!-- 分配给我的客户 --> <!-- 分配给我的客户 -->
<!-- WHERE followUpStatus = ? -->
<template> <template>
<ContentWrap> <ContentWrap>
<div class="pb-5 text-xl">分配给我的客户</div> <div class="pb-5 text-xl">分配给我的客户</div>
@ -108,17 +109,14 @@
</template> </template>
<script setup lang="ts" name="FollowCustomer"> <script setup lang="ts" name="FollowCustomer">
import * as CustomerApi from '@/api/crm/customer'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as CustomerApi from '@/api/crm/customer' import { FOLLOWUP_STATUS } from './common'
const { push } = useRouter() const { push } = useRouter()
const FOLLOWUP_STATUS = [
{ label: '已跟进', value: true },
{ label: '待跟进', value: false }
]
const loading = ref(true) // const loading = ref(true) //
const total = ref(0) // const total = ref(0) //
const list = ref([]) // const list = ref([]) //

View File

@ -1,4 +1,5 @@
<!-- TODO: dhb52 待Clue页面更新后同步更新 --> <!-- TODO: dhb52 待Clue页面更新后同步更新 -->
<!-- WHERE transformStatus = 0 AND followUpStatus = ? -->
<template> <template>
<ContentWrap> <ContentWrap>
<div class="pb-5 text-xl">分配给我的线索</div> <div class="pb-5 text-xl">分配给我的线索</div>
@ -81,14 +82,10 @@
</template> </template>
<script setup lang="ts" name="FollowLeads"> <script setup lang="ts" name="FollowLeads">
import * as ClueApi from '@/api/crm/clue'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as ClueApi from '@/api/crm/clue' import { FOLLOWUP_STATUS } from './common'
const FOLLOWUP_STATUS = [
{ label: '已跟进', value: true },
{ label: '待跟进', value: false }
]
const loading = ref(true) // const loading = ref(true) //
const total = ref(0) // const total = ref(0) //
@ -96,7 +93,8 @@ const list = ref([]) // 列表的数据
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
followUpStatus: false followUpStatus: false,
transformStatus: false //
}) })
const queryFormRef = ref() // const queryFormRef = ref() //

View File

@ -1,8 +1,6 @@
<template> <template>
<ContentWrap> <ContentWrap>
<div class="pb-5 text-xl"> <div class="pb-5 text-xl"> 今日需联系客户 </div>
今日需联系客户
</div>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
ref="queryFormRef" ref="queryFormRef"
@ -12,7 +10,12 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="状态" prop="contactStatus"> <el-form-item label="状态" prop="contactStatus">
<el-select v-model="queryParams.contactStatus" class="!w-240px" placeholder="状态" @change="handleQuery"> <el-select
v-model="queryParams.contactStatus"
class="!w-240px"
placeholder="状态"
@change="handleQuery"
>
<el-option <el-option
v-for="(option, index) in CONTACT_STATUS" v-for="(option, index) in CONTACT_STATUS"
:label="option.label" :label="option.label"
@ -22,7 +25,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="归属" prop="sceneType"> <el-form-item label="归属" prop="sceneType">
<el-select v-model="queryParams.sceneType" class="!w-240px" placeholder="归属" @change="handleQuery"> <el-select
v-model="queryParams.sceneType"
class="!w-240px"
placeholder="归属"
@change="handleQuery"
>
<el-option <el-option
v-for="(option, index) in SCENE_TYPES" v-for="(option, index) in SCENE_TYPES"
:label="option.label" :label="option.label"
@ -111,9 +119,12 @@
</template> </template>
<script lang="ts" setup name="TodayCustomer"> <script lang="ts" setup name="TodayCustomer">
import * as BacklogApi from '@/api/crm/backlog'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as BacklogApi from '@/api/crm/backlog' import { CONTACT_STATUS, SCENE_TYPES } from './common'
const { push } = useRouter()
const loading = ref(true) // const loading = ref(true) //
const total = ref(0) // const total = ref(0) //
@ -126,19 +137,6 @@ const queryParams = ref({
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const CONTACT_STATUS = [
{ label: '今日需联系', value: 1 },
{ label: '已逾期', value: 2 },
{ label: '已联系', value: 3 }
]
const SCENE_TYPES = [
// TODO
{ label: '我负责的', value: 1 },
{ label: '我参与的', value: 2 },
{ label: '下属负责的', value: 3 }
]
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -157,22 +155,7 @@ const handleQuery = () => {
getList() getList()
} }
/** 重置按钮操作 */
const resetQuery = (func: Function | undefined = undefined) => {
queryFormRef.value.resetFields()
queryParams.value = {
pageNo: 1,
pageSize: 10,
contactStatus: 1,
sceneType: 1
}
// TODO @dbh52 func
func && func()
handleQuery()
}
/** 打开客户详情 */ /** 打开客户详情 */
const { push } = useRouter()
const openDetail = (id: number) => { const openDetail = (id: number) => {
push({ name: 'CrmCustomerDetail', params: { id } }) push({ name: 'CrmCustomerDetail', params: { id } })
} }

View File

@ -0,0 +1,19 @@
/** 跟进状态 */
export const FOLLOWUP_STATUS = [
{ label: '已跟进', value: true },
{ label: '待跟进', value: false }
]
/** 归属范围 */
export const SCENE_TYPES = [
{ label: '我负责的', value: 1 },
{ label: '我参与的', value: 2 },
{ label: '下属负责的', value: 3 }
]
/** 联系状态 */
export const CONTACT_STATUS = [
{ label: '今日需联系', value: 1 },
{ label: '已逾期', value: 2 },
{ label: '已联系', value: 3 }
]