Skip to content

Commit 0076236

Browse files
author
puhui999
committed
Merge remote-tracking branch 'refs/remotes/yudao/dev' into dev-crm
2 parents ae53ca6 + f55c9b7 commit 0076236

File tree

14 files changed

+58
-55
lines changed

14 files changed

+58
-55
lines changed

.env.dev

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ VITE_UPLOAD_TYPE=server
1212
# 上传路径
1313
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
1414

15-
# 接口前缀
16-
VITE_API_BASEPATH=/dev-api
17-
1815
# 接口地址
1916
VITE_API_URL=/admin-api
2017

.env.local-dev

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ VITE_UPLOAD_TYPE=server
1111
# 上传路径
1212
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
1313

14-
# 接口前缀
15-
VITE_API_BASEPATH=/dev-api
16-
1714
# 接口地址
1815
VITE_API_URL=/admin-api
1916

.env.prod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ VITE_UPLOAD_TYPE=server
1111
# 上传路径
1212
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
1313

14-
# 接口前缀
15-
VITE_API_BASEPATH=
16-
1714
# 接口地址
1815
VITE_API_URL=/admin-api
1916

.env.stage

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ VITE_UPLOAD_TYPE=server
1111
# 上传路径
1212
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
1313

14-
# 接口前缀
15-
VITE_API_BASEPATH=
16-
1714
# 接口地址
1815
VITE_API_URL=/admin-api
1916

.env.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ VITE_UPLOAD_TYPE=server
1111
# 上传路径
1212
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
1313

14-
# 接口前缀
15-
VITE_API_BASEPATH=
16-
1714
# 接口地址
1815
VITE_API_URL=/admin-api
1916

src/views/crm/statistics/performance/components/ContractCountPerformance.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<!-- 客户总量统计 -->
1+
<!-- 员工业绩统计 -->
2+
<!-- TODO @scholar:参考 ReceivablePricePerformance 建议改 -->
23
<template>
34
<!-- Echarts图 -->
45
<el-card shadow="never">
@@ -7,7 +8,7 @@
78
</el-skeleton>
89
</el-card>
910

10-
<!-- 统计列表 TODO @scholar:统计列表的展示不对 -->
11+
<!-- 统计列表 -->
1112
<el-card shadow="never" class="mt-16px">
1213
<el-table v-loading="loading" :data="tableData">
1314
<el-table-column
@@ -186,6 +187,7 @@ const loadData = async () => {
186187
187188
// 2.2 更新列表数据
188189
list.value = performanceList
190+
convertListData()
189191
loading.value = false
190192
}
191193
@@ -199,9 +201,10 @@ const tableData = reactive([
199201
{ title: '环比增长率(%)' }
200202
])
201203
202-
// 定义 init 方法
203-
const init = () => {
204+
// 定义 convertListData 方法,数据行列转置,展示每月数据
205+
const convertListData = () => {
204206
const columnObj = { label: '日期', prop: 'title' }
207+
columnsData.splice(0, columnsData.length) //清空数组
205208
columnsData.push(columnObj)
206209
207210
list.value.forEach((item, index) => {
@@ -211,9 +214,9 @@ const init = () => {
211214
tableData[1]['prop' + index] = item.lastMonthCount
212215
tableData[2]['prop' + index] = item.lastYearCount
213216
tableData[3]['prop' + index] =
214-
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
215-
tableData[4]['prop' + index] =
216217
item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
218+
tableData[4]['prop' + index] =
219+
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
217220
})
218221
}
219222
@@ -222,6 +225,5 @@ defineExpose({ loadData })
222225
/** 初始化 */
223226
onMounted(async () => {
224227
await loadData()
225-
init()
226228
})
227229
</script>

src/views/crm/statistics/performance/components/ContractPricePerformance.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<!-- 客户总量统计 -->
1+
<!-- 员工业绩统计 -->
2+
<!-- TODO @scholar:参考 ReceivablePricePerformance 建议改 -->
23
<template>
34
<!-- Echarts图 -->
45
<el-card shadow="never">
@@ -7,7 +8,7 @@
78
</el-skeleton>
89
</el-card>
910

10-
<!-- 统计列表 TODO @scholar:统计列表的展示不对 -->
11+
<!-- 统计列表 -->
1112
<el-card shadow="never" class="mt-16px">
1213
<el-table v-loading="loading" :data="tableData">
1314
<el-table-column
@@ -186,6 +187,7 @@ const loadData = async () => {
186187
187188
// 2.2 更新列表数据
188189
list.value = performanceList
190+
convertListData()
189191
loading.value = false
190192
}
191193
@@ -200,8 +202,9 @@ const tableData = reactive([
200202
])
201203
202204
// 定义 init 方法
203-
const init = () => {
205+
const convertListData = () => {
204206
const columnObj = { label: '日期', prop: 'title' }
207+
columnsData.splice(0, columnsData.length) //清空数组
205208
columnsData.push(columnObj)
206209
207210
list.value.forEach((item, index) => {
@@ -211,9 +214,9 @@ const init = () => {
211214
tableData[1]['prop' + index] = item.lastMonthCount
212215
tableData[2]['prop' + index] = item.lastYearCount
213216
tableData[3]['prop' + index] =
214-
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
215-
tableData[4]['prop' + index] =
216217
item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
218+
tableData[4]['prop' + index] =
219+
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
217220
})
218221
}
219222
@@ -222,6 +225,5 @@ defineExpose({ loadData })
222225
/** 初始化 */
223226
onMounted(async () => {
224227
await loadData()
225-
init()
226228
})
227229
</script>

src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- 客户总量统计 -->
1+
<!-- 员工业绩统计 -->
22
<template>
33
<!-- Echarts图 -->
44
<el-card shadow="never">
@@ -7,7 +7,7 @@
77
</el-skeleton>
88
</el-card>
99

10-
<!-- 统计列表 TODO @scholar:统计列表的展示不对 -->
10+
<!-- 统计列表 -->
1111
<el-card shadow="never" class="mt-16px">
1212
<el-table v-loading="loading" :data="tableData">
1313
<el-table-column
@@ -17,6 +17,7 @@
1717
:prop="item.prop"
1818
align="center"
1919
>
20+
<!-- TODO @scholar:IDEA 爆红的处理 -->
2021
<template #default="scope">
2122
{{ scope.row[item.prop] }}
2223
</template>
@@ -120,6 +121,7 @@ const echartsOption = reactive<EChartsOption>({
120121
type: 'value',
121122
name: '',
122123
axisTick: {
124+
// TODO @scholar:IDEA 爆红的处理
123125
alignWithLabel: true,
124126
lineStyle: {
125127
width: 0
@@ -186,11 +188,13 @@ const loadData = async () => {
186188
187189
// 2.2 更新列表数据
188190
list.value = performanceList
191+
convertListData()
189192
loading.value = false
190193
}
191194
192195
// 初始化数据
193-
const columnsData = reactive([])
196+
// TODO @scholar:加个 as any[],避免 idea 爆红
197+
const columnsData = reactive([] as any[])
194198
const tableData = reactive([
195199
{ title: '当月回款金额统计(元)' },
196200
{ title: '上月回款金额统计(元)' },
@@ -200,8 +204,9 @@ const tableData = reactive([
200204
])
201205
202206
// 定义 init 方法
203-
const init = () => {
207+
const convertListData = () => {
204208
const columnObj = { label: '日期', prop: 'title' }
209+
columnsData.splice(0, columnsData.length) //清空数组
205210
columnsData.push(columnObj)
206211
207212
list.value.forEach((item, index) => {
@@ -210,10 +215,11 @@ const init = () => {
210215
tableData[0]['prop' + index] = item.currentMonthCount
211216
tableData[1]['prop' + index] = item.lastMonthCount
212217
tableData[2]['prop' + index] = item.lastYearCount
218+
// TODO @scholar:百分比,使用 erpCalculatePercentage 直接计算;如果是 0,则返回 0,统一就好哈;
213219
tableData[3]['prop' + index] =
214-
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
215-
tableData[4]['prop' + index] =
216220
item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
221+
tableData[4]['prop' + index] =
222+
item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
217223
})
218224
}
219225
@@ -222,6 +228,5 @@ defineExpose({ loadData })
222228
/** 初始化 */
223229
onMounted(async () => {
224230
await loadData()
225-
init()
226231
})
227232
</script>

src/views/crm/statistics/performance/index.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- 数据统计 - 员工客户分析 -->
1+
<!-- 数据统计 - 员工业绩分析 -->
22
<template>
33
<ContentWrap>
44
<!-- 搜索工作栏 -->
@@ -9,16 +9,13 @@
99
:inline="true"
1010
label-width="68px"
1111
>
12-
<el-form-item label="时间范围" prop="orderDate">
12+
<el-form-item label="选择年份" prop="orderDate">
1313
<el-date-picker
14-
v-model="queryParams.times"
15-
:shortcuts="defaultShortcuts"
14+
v-model="queryParams.times[0]"
1615
class="!w-240px"
17-
end-placeholder="结束日期"
18-
start-placeholder="开始日期"
19-
type="daterange"
20-
value-format="YYYY-MM-DD HH:mm:ss"
21-
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
16+
type="year"
17+
value-format="YYYY"
18+
:default-time="[new Date().getFullYear()]"
2219
/>
2320
</el-form-item>
2421
<el-form-item label="归属部门" prop="deptId">
@@ -62,7 +59,7 @@
6259
<ContractPricePerformance :query-params="queryParams" ref="ContractPricePerformanceRef" />
6360
</el-tab-pane>
6461
<!-- 员工回款金额统计 -->
65-
<el-tab-pane label="员工回款金额统计" name="followupType" lazy>
62+
<el-tab-pane label="员工回款金额统计" name="ReceivablePricePerformance" lazy>
6663
<ReceivablePricePerformance
6764
:query-params="queryParams"
6865
ref="ReceivablePricePerformanceRef"
@@ -76,21 +73,20 @@
7673
import * as DeptApi from '@/api/system/dept'
7774
import * as UserApi from '@/api/system/user'
7875
import { useUserStore } from '@/store/modules/user'
79-
import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
76+
import { beginOfDay, formatDate } from '@/utils/formatTime'
8077
import { defaultProps, handleTree } from '@/utils/tree'
8178
import ContractCountPerformance from './components/ContractCountPerformance.vue'
8279
import ContractPricePerformance from './components/ContractPricePerformance.vue'
8380
import ReceivablePricePerformance from './components/ReceivablePricePerformance.vue'
8481
85-
defineOptions({ name: 'CrmStatisticsPerformance' })
82+
defineOptions({ name: 'CrmStatisticsCustomer' })
8683
8784
const queryParams = reactive({
8885
deptId: useUserStore().getUser.deptId,
8986
userId: undefined,
9087
times: [
91-
// 默认显示最近一周的数据
92-
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))),
93-
formatDate(endOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24)))
88+
// 默认显示当年的数据
89+
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)))
9490
]
9591
})
9692
@@ -104,6 +100,7 @@ const userListByDeptId = computed(() =>
104100
: []
105101
)
106102
103+
// TODO @scholar:改成尾注释,保证 vue 内容短一点;变量名小写
107104
// 活跃标签
108105
const activeTab = ref('ContractCountPerformance')
109106
// 1.员工合同数量统计
@@ -115,6 +112,19 @@ const ReceivablePricePerformanceRef = ref()
115112
116113
/** 搜索按钮操作 */
117114
const handleQuery = () => {
115+
// 从 queryParams.times[0] 中获取到了年份
116+
const selectYear = parseInt(queryParams.times[0])
117+
118+
// 创建一个新的 Date 对象,设置为指定的年份的第一天
119+
const fullDate = new Date(selectYear, 0, 1, 0, 0, 0)
120+
121+
// 将完整的日期时间格式化为需要的字符串形式,比如 2004-01-01 00:00:00
122+
// TODO @scholar:看看,是不是可以使用 year 哈
123+
queryParams.times[0] = `${fullDate.getFullYear()}-${String(fullDate.getMonth() + 1).padStart(
124+
2,
125+
'0'
126+
)}-${String(fullDate.getDate()).padStart(2, '0')} ${String(fullDate.getHours()).padStart(2, '0')}:${String(fullDate.getMinutes()).padStart(2, '0')}:${String(fullDate.getSeconds()).padStart(2, '0')}`
127+
118128
switch (activeTab.value) {
119129
case 'ContractCountPerformance':
120130
ContractCountPerformanceRef.value?.loadData?.()

src/views/mp/components/wx-reply/components/TabImage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import { getAccessToken } from '@/utils/auth'
6363
import { Reply } from './types'
6464
const message = useMessage()
6565
66-
const UPLOAD_URL = import.meta.env.VITE_API_BASEPATH + '/admin-api/mp/material/upload-temporary'
66+
const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary'
6767
const HEADERS = { Authorization: 'Bearer ' + getAccessToken() } // 设置上传的请求头部
6868
6969
const props = defineProps<{

0 commit comments

Comments
 (0)