!433 CRM: 修复客户导入、销售漏斗。上传组件的文件列表给拓展一个下载 。

Merge pull request !433 from puhui999/dev-crm
This commit is contained in:
芋道源码 2024-04-28 04:52:53 +00:00 committed by Gitee
commit c96902d622
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 80 additions and 39 deletions

View File

@ -6,11 +6,11 @@
"private": false, "private": false,
"scripts": { "scripts": {
"i": "pnpm install", "i": "pnpm install",
"dev": "vite --mode local-dev", "local-dev": "vite --mode local-dev",
"dev-server": "vite --mode dev", "dev": "vite --mode dev",
"ts:check": "vue-tsc --noEmit", "ts:check": "vue-tsc --noEmit",
"build:local-dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev", "build:local-dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev",
"build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev", "build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode dev",
"build:test": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode test", "build:test": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode test",
"build:stage": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode stage", "build:stage": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode stage",
"build:prod": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode prod", "build:prod": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode prod",

View File

@ -32,6 +32,25 @@
格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b> 的文件 格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b> 的文件
</div> </div>
</template> </template>
<template #file="row">
<div class="flex items-center">
<span>{{ row.file.name }}</span>
<div class="ml-10px">
<el-link
:href="row.file.url"
:underline="false"
download
target="_blank"
type="primary"
>
下载
</el-link>
</div>
<div class="ml-10px">
<el-button link type="danger" @click="handleRemove(row.file)"> 删除</el-button>
</div>
</div>
</template>
</el-upload> </el-upload>
</div> </div>
</template> </template>

View File

@ -2,23 +2,24 @@ import * as echarts from 'echarts/core'
import { import {
BarChart, BarChart,
FunnelChart,
GaugeChart,
LineChart, LineChart,
PieChart,
MapChart, MapChart,
PictorialBarChart, PictorialBarChart,
RadarChart, PieChart,
GaugeChart RadarChart
} from 'echarts/charts' } from 'echarts/charts'
import { import {
TitleComponent,
TooltipComponent,
GridComponent,
PolarComponent,
AriaComponent, AriaComponent,
ParallelComponent, GridComponent,
LegendComponent, LegendComponent,
ParallelComponent,
PolarComponent,
TitleComponent,
ToolboxComponent, ToolboxComponent,
TooltipComponent,
VisualMapComponent VisualMapComponent
} from 'echarts/components' } from 'echarts/components'
@ -41,7 +42,8 @@ echarts.use([
CanvasRenderer, CanvasRenderer,
PictorialBarChart, PictorialBarChart,
RadarChart, RadarChart,
GaugeChart GaugeChart,
FunnelChart
]) ])
export default echarts export default echarts

View File

@ -1,16 +1,24 @@
<!-- 客户导入窗口 --> <!-- 客户导入窗口 -->
<template> <template>
<Dialog v-model="dialogVisible" title="客户导入" width="400"> <Dialog v-model="dialogVisible" title="客户导入" width="400">
<div class="flex items-center my-10px">
<span class="mr-10px">负责人</span>
<el-select v-model="ownerUserId" class="!w-240px" clearable>
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</div>
<el-upload <el-upload
ref="uploadRef" ref="uploadRef"
v-model:file-list="fileList" v-model:file-list="fileList"
:auto-upload="false" :auto-upload="false"
:disabled="formLoading" :disabled="formLoading"
:headers="uploadHeaders"
:limit="1" :limit="1"
:on-error="submitFormError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="submitFormSuccess"
accept=".xlsx, .xls" accept=".xlsx, .xls"
action="none" action="none"
drag drag
@ -43,9 +51,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as CustomerApi from '@/api/crm/customer' import * as CustomerApi from '@/api/crm/customer'
import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download' import download from '@/utils/download'
import type { UploadUserFile } from 'element-plus' import type { UploadUserFile } from 'element-plus'
import * as UserApi from '@/api/system/user'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'SystemUserImportForm' }) defineOptions({ name: 'SystemUserImportForm' })
@ -54,15 +63,18 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const formLoading = ref(false) // const formLoading = ref(false) //
const uploadRef = ref() const uploadRef = ref()
const uploadHeaders = ref() // Header
const fileList = ref<UploadUserFile[]>([]) // const fileList = ref<UploadUserFile[]>([]) //
const updateSupport = ref(false) // const updateSupport = ref(false) //
const ownerUserId = ref<undefined | number>() //
const userOptions = ref<UserApi.UserVO[]>([]) //
/** 打开弹窗 */ /** 打开弹窗 */
const open = () => { const open = async () => {
dialogVisible.value = true dialogVisible.value = true
fileList.value = [] await resetForm()
resetForm() //
userOptions.value = await UserApi.getSimpleUserList()
ownerUserId.value = useUserStore().getUser.id
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -72,17 +84,20 @@ const submitForm = async () => {
message.error('请上传文件') message.error('请上传文件')
return return
} }
//
uploadHeaders.value = {
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}
formLoading.value = true formLoading.value = true
try {
const formData = new FormData() const formData = new FormData()
formData.append('updateSupport', updateSupport.value) formData.append('updateSupport', String(updateSupport.value))
formData.append('file', fileList.value[0].raw) formData.append('file', fileList.value[0].raw as Blob)
// TODO @ uploadHeaders formData.append('ownerUserId', String(ownerUserId.value))
await CustomerApi.handleImport(formData) const res = await CustomerApi.handleImport(formData)
submitFormSuccess(res)
} catch {
submitFormError()
} finally {
formLoading.value = false
}
} }
/** 文件上传成功 */ /** 文件上传成功 */
@ -108,6 +123,8 @@ const submitFormSuccess = (response: any) => {
text += '< ' + customerName + ': ' + data.failureCustomerNames[customerName] + ' >' text += '< ' + customerName + ': ' + data.failureCustomerNames[customerName] + ' >'
} }
message.alert(text) message.alert(text)
formLoading.value = false
dialogVisible.value = false
// //
emits('success') emits('success')
} }
@ -119,9 +136,12 @@ const submitFormError = (): void => {
} }
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = async () => {
// //
formLoading.value = false fileList.value = []
updateSupport.value = false
ownerUserId.value = undefined
await nextTick()
uploadRef.value?.clearFiles() uploadRef.value?.clearFiles()
} }

View File

@ -79,7 +79,7 @@
<Icon class="mr-5px" icon="ep:search" /> <Icon class="mr-5px" icon="ep:search" />
搜索 搜索
</el-button> </el-button>
<el-button @click="resetQuery(undefined)"> <el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" /> <Icon class="mr-5px" icon="ep:refresh" />
重置 重置
</el-button> </el-button>
@ -113,7 +113,7 @@
<el-tab-pane label="下属负责的" name="3" /> <el-tab-pane label="下属负责的" name="3" />
</el-tabs> </el-tabs>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true"> <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="客户名称" fixed="left" prop="name" width="160"> <el-table-column align="center" fixed="left" label="客户名称" prop="name" width="160">
<template #default="scope"> <template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)"> <el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }} {{ scope.row.name }}
@ -125,9 +125,9 @@
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" /> <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="scope.row.source" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="手机" align="center" prop="mobile" width="120" /> <el-table-column align="center" label="手机" prop="mobile" width="120" />
<el-table-column label="电话" align="center" prop="telephone" width="130" /> <el-table-column align="center" label="电话" prop="telephone" width="130" />
<el-table-column label="邮箱" align="center" prop="email" width="180" /> <el-table-column align="center" label="邮箱" prop="email" width="180" />
<el-table-column align="center" label="客户级别" prop="level" width="135"> <el-table-column align="center" label="客户级别" prop="level" width="135">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" /> <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="scope.row.level" />
@ -164,7 +164,7 @@
width="180px" width="180px"
/> />
<el-table-column align="center" label="最后跟进记录" prop="contactLastContent" width="200" /> <el-table-column align="center" label="最后跟进记录" prop="contactLastContent" width="200" />
<el-table-column label="地址" align="center" prop="detailAddress" width="180" /> <el-table-column align="center" label="地址" prop="detailAddress" width="180" />
<el-table-column align="center" label="距离进入公海天数" prop="poolDay" width="140"> <el-table-column align="center" label="距离进入公海天数" prop="poolDay" width="140">
<template #default="scope"> {{ scope.row.poolDay }} </template> <template #default="scope"> {{ scope.row.poolDay }} </template>
</el-table-column> </el-table-column>
@ -254,7 +254,7 @@ const activeName = ref('1') // 列表 tab
/** tab 切换 */ /** tab 切换 */
const handleTabClick = (tab: TabsPaneContext) => { const handleTabClick = (tab: TabsPaneContext) => {
queryParams.sceneType = tab.paneName queryParams.sceneType = tab.paneName as string
handleQuery() handleQuery()
} }