莳松crm管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ss-crm-manage-web/src/views/Clue/Pool/index.vue

320 lines
8.6 KiB

1 year ago
<template>
<div>
<div class="relative">
11 months ago
<el-tabs v-model="queryType" size="small" @tab-change="getTableList">
1 year ago
<el-tab-pane label="全部" name="0" />
<el-tab-pane name="1">
<template #label>
<Tooltip message="除了无效线索和已成交的线索" />
11 months ago
<el-badge v-if="clueCount.unSignNum" :value="clueCount.unSignNum" :max="9999">
1 year ago
<span class="ml-3px">未成交</span>
</el-badge>
11 months ago
<span v-else class="ml-3px">未成交</span>
1 year ago
</template>
</el-tab-pane>
<el-tab-pane name="2">
<template #label>
<Tooltip message="下次跟进时间在今日之前的未成交线索" />
11 months ago
<el-badge v-if="clueCount.followNum" :value="clueCount.followNum" :max="9999">
1 year ago
<span class="ml-3px">待跟进</span>
</el-badge>
11 months ago
<span v-else class="ml-3px">待跟进</span>
1 year ago
</template>
</el-tab-pane>
<el-tab-pane name="3">
<template #label>
<Tooltip message="只有创建时间,无下次跟进时间的未成交线索" />
11 months ago
<el-badge v-if="clueCount.newNum" :value="clueCount.newNum" :max="9999">
1 year ago
<span class="ml-3px">新线索</span>
</el-badge>
11 months ago
<span v-else class="ml-3px">新线索</span>
1 year ago
</template>
</el-tab-pane>
<el-tab-pane label="公海" name="4" />
</el-tabs>
<div class="absolute" style="right: 10px; top: 0">
11 months ago
<el-button plain v-hasPermi="['clue:pool:import']">导入</el-button>
<el-button type="primary" @click="handleInsert" v-hasPermi="['clue:pool:add']">
新增线索
</el-button>
1 year ago
</div>
</div>
<!-- 搜索工作栏 -->
11 months ago
<Search v-if="!loading" ref="searchRef" :schema="allSchemas.searchSchema" labelWidth="0">
11 months ago
<template #actionMore>
<el-button @click="getTableList" v-hasPermi="['clue:pool:search']"> 搜索 </el-button>
<el-button @click="resetQuery" v-hasPermi="['clue:pool:reset']"> 重置 </el-button>
</template>
</Search>
1 year ago
<!-- 列表 -->
<SSTable
11 months ago
v-if="!loading"
1 year ago
class="mt-20px"
v-model:tableObject="tableObject"
:tableColumns="allSchemas.tableColumns"
@get-list="getTableList"
12 months ago
@get-checked-columns="getCheckedColumns"
1 year ago
>
<el-table-column
12 months ago
v-for="item in showColumns"
1 year ago
:key="item.field"
:prop="item.field"
:label="item.label"
min-width="120px"
12 months ago
>
<template #default="{ row }">
<div v-if="item.field == 'followRecord'">
11 months ago
<el-button
type="primary"
text
style="padding: 0"
@click="handleFollow(row)"
v-hasPermi="['clue:pool:update']"
12 months ago
>
11 months ago
快速新增
</el-button>
12 months ago
</div>
<div v-else-if="item.field == 'contact'">
<span>{{ row[item.field] }}</span>
<Icon class="ml-5px" icon="ep:phone" @click="makeCall(row.contact)" />
</div>
11 months ago
<div v-else-if="item.form?.component == 'DatePicker'">
<span>{{ formatDate(row[item.field]) }}</span>
</div>
12 months ago
<span v-else>{{ row[item.field] }}</span>
</template>
</el-table-column>
1 year ago
<el-table-column label="操作" width="200px" fixed="right">
<template #default="scope">
11 months ago
<el-button
type="primary"
link
@click="handleDetail(scope.row)"
v-hasPermi="['clue:pool:detail']"
>
详情
</el-button>
10 months ago
<template v-if="queryType != 4">
<el-button
type="primary"
link
@click="handleEdit(scope.row)"
v-hasPermi="['clue:pool:update']"
>
修改
</el-button>
<el-button
type="primary"
link
@click="handleSuccess(scope.row)"
v-hasPermi="['clue:pool:enroll']"
>
登记
</el-button>
<el-button
type="primary"
link
v-hasPermi="['clue:pool:release']"
@click="handleRelease(scope.row.clueId)"
>
释放
</el-button>
</template>
<template v-else>
<el-button
type="primary"
link
v-hasPermi="['clue:pool:gain']"
@click="handleGain(scope.row.clueId)"
>
获取
</el-button>
</template>
1 year ago
</template>
</el-table-column>
</SSTable>
11 months ago
<DialogClue
v-if="!loading"
ref="formRef"
11 months ago
:userOptions="userOptions"
11 months ago
:schema="allSchemas.formSchema"
@sucess="getTableList"
/>
11 months ago
<DrawerClue
v-if="!loading"
ref="drawerRef"
:schema="allSchemas.formSchema"
@get-list="getTableList"
@update="handleEdit"
/>
10 months ago
<DialogSuccess ref="successRef" :schema="allSchemas.formSchema" />
11 months ago
<DialogFollow ref="followRef" @success="getTableList" />
1 year ago
</div>
</template>
<script setup name="CluePool">
11 months ago
import { getSimpleFieldList } from '@/api/clue/clueField'
1 year ago
import DialogClue from './Comp/DialogClue.vue'
import DrawerClue from './Comp/DrawerClue.vue'
import DialogSuccess from './Comp/DialogSuccess.vue'
12 months ago
import DialogFollow from './Comp/DialogFollow.vue'
11 months ago
import { getSimpleUserList as getUserOption } from '@/api/system/user'
1 year ago
11 months ago
import { removeNullField } from '@/utils'
import { formatDate } from '@/utils/formatTime'
import * as ClueApi from '@/api/clue'
11 months ago
const message = useMessage() // 消息弹窗
11 months ago
const searchRef = ref()
const queryType = ref('2')
1 year ago
const formRef = ref()
const drawerRef = ref()
const successRef = ref()
12 months ago
const followRef = ref()
1 year ago
11 months ago
const loading = ref(true)
const allSchemas = ref({})
async function getCurdSchemas() {
loading.value = true
try {
const data = await getSimpleFieldList()
allSchemas.value = useCrudSchemas(data).allSchemas
} finally {
loading.value = false
nextTick(() => {
getTableList()
})
}
}
1 year ago
const tableObject = ref({
11 months ago
tableList: [],
1 year ago
loading: false,
total: 1,
pageSize: 20,
currentPage: 1
})
12 months ago
const showColumns = ref([])
// 初始化表格
function getCheckedColumns(list) {
showColumns.value = list
}
11 months ago
function resetQuery() {
11 months ago
searchRef.value.reset()
tableObject.value.currentPage = 1
11 months ago
getTableList()
1 year ago
}
11 months ago
async function getTableList() {
1 year ago
// 查询
11 months ago
tableObject.value.loading = true
11 months ago
getSearchCount()
11 months ago
try {
const queryParams = await searchRef.value.getFormModel()
const params = {
...queryParams,
pageNo: tableObject.value.currentPage,
pageSize: tableObject.value.pageSize,
queryType: queryType.value
}
const data = await ClueApi.getCluePage(removeNullField(params))
11 months ago
tableObject.value.tableList = data.list.map((it) => ({ ...it, ...it.diyParams }))
11 months ago
tableObject.value.total = data.total
} finally {
tableObject.value.loading = false
}
}
const clueCount = ref({
unSignNum: 0,
followNum: 0,
newNum: 0
})
function getSearchCount() {
ClueApi.getClueCount().then((data) => {
clueCount.value = data
})
1 year ago
}
// 新增
function handleInsert() {
formRef.value.open('create', null)
}
// 编辑
function handleEdit(row) {
11 months ago
formRef.value.open('update', row.clueId)
1 year ago
}
// 详情
function handleDetail(row) {
11 months ago
drawerRef.value.open(row.clueId)
1 year ago
}
12 months ago
function handleFollow(row) {
11 months ago
followRef.value.open(row.clueId)
12 months ago
}
async function makeCall(phone) {
console.log('打电话:' + phone)
}
1 year ago
// 登记
function handleSuccess(row) {
10 months ago
successRef.value.open(row.clueId)
1 year ago
}
11 months ago
// 释放
function handleRelease(id) {
message.prompt('请先输入释放原因', '是否确认释放线索?').then((res) => {
if (res.value) {
try {
ClueApi.releaseClue({
clueId: id,
publicClue: true,
discardReason: res.value
}).then(() => {
message.success('释放成功')
})
} finally {
getTableList()
}
} else {
message.info('请将释放原因填写完整!')
}
})
}
10 months ago
function handleGain(id) {
message.confirm('是否确认获取公海线索?').then(() => {
try {
ClueApi.getPublicClue({
clueId: id,
publicClue: false
}).then(() => {
message.success('获取成功')
})
} finally {
getTableList()
}
})
}
11 months ago
const userOptions = ref([])
11 months ago
onMounted(() => {
11 months ago
getUserOption().then((data) => {
userOptions.value = data
})
11 months ago
getCurdSchemas()
})
1 year ago
</script>
<style lang="scss" scoped></style>