Skip to content

Commit 3ddba81

Browse files
committed
Merge remote-tracking branch 'yudao/dev' into dev
2 parents 441b913 + 1a5e790 commit 3ddba81

File tree

94 files changed

+248
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+248
-36
lines changed

.image/common/crm-feature.png

15.2 KB
Loading

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ _前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋
202202

203203
演示地址:<https://doc.iocoder.cn/erp-preview/>
204204

205+
### CRM 系统
206+
207+
![功能图](/.image/common/crm-feature.png)
208+
209+
演示地址:<https://doc.iocoder.cn/crm-preview/>
210+
205211
## 🐷 演示图
206212

207213
### 系统功能

src/api/infra/file/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ export const getFilePresignedUrl = (path: string) => {
3838
export const createFile = (data: any) => {
3939
return request.post({ url: '/infra/file/create', data })
4040
}
41+
42+
// 上传文件
43+
export const updateFile = (data: any) => {
44+
return request.upload({ url: '/infra/file/upload', data })
45+
}

src/components/UploadFile/src/useUpload.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { getAccessToken, getTenantId } from '@/utils/auth'
21
import * as FileApi from '@/api/infra/file'
32
import CryptoJS from 'crypto-js'
43
import { UploadRawFile, UploadRequestOptions } from 'element-plus/es/components/upload/src/upload'
5-
import { ajaxUpload } from 'element-plus/es/components/upload/src/ajax'
64
import axios from 'axios'
75

86
export const useUpload = () => {
@@ -26,11 +24,21 @@ export const useUpload = () => {
2624
return { data: presignedInfo.url }
2725
})
2826
} else {
29-
// 模式二:后端上传(需要增加后端身份认证请求头)
30-
options.headers['Authorization'] = 'Bearer ' + getAccessToken()
31-
options.headers['tenant-id'] = getTenantId()
32-
// 使用 ElUpload 的上传方法
33-
return ajaxUpload(options)
27+
// 模式二:后端上传
28+
// 重写 el-upload httpRequest 文件上传成功会走成功的钩子,失败走失败的钩子
29+
return new Promise((resolve, reject) => {
30+
FileApi.updateFile({ file: options.file })
31+
.then((res) => {
32+
if (res.code === 0) {
33+
resolve(res)
34+
} else {
35+
reject(res)
36+
}
37+
})
38+
.catch((res) => {
39+
reject(res)
40+
})
41+
})
3442
}
3543
}
3644

src/utils/formatTime.ts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import dayjs from 'dayjs'
2+
import type { TableColumnCtx } from 'element-plus'
23

34
/**
45
* 日期快捷选项适用于 el-date-picker
@@ -68,10 +69,7 @@ export function formatDate(date: Date, format?: string): string {
6869
return ''
6970
}
7071
// 日期存在,则进行格式化
71-
if (format === undefined) {
72-
format = 'YYYY-MM-DD HH:mm:ss'
73-
}
74-
return dayjs(date).format(format)
72+
return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : ''
7573
}
7674

7775
/**
@@ -171,7 +169,7 @@ export function formatAxis(param: Date): string {
171169
* @param ms 毫秒
172170
* @returns {string} 字符串
173171
*/
174-
export function formatPast2(ms) {
172+
export function formatPast2(ms: number): string {
175173
const day = Math.floor(ms / (24 * 60 * 60 * 1000))
176174
const hour = Math.floor(ms / (60 * 60 * 1000) - day * 24)
177175
const minute = Math.floor(ms / (60 * 1000) - day * 24 * 60 - hour * 60)
@@ -199,12 +197,8 @@ export function formatPast2(ms) {
199197
* @param column 字段
200198
* @param cellValue 字段值
201199
*/
202-
// @ts-ignore
203-
export const dateFormatter = (row, column, cellValue): string => {
204-
if (!cellValue) {
205-
return ''
206-
}
207-
return formatDate(cellValue)
200+
export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
201+
return cellValue ? formatDate(cellValue) : ''
208202
}
209203

210204
/**
@@ -214,20 +208,16 @@ export const dateFormatter = (row, column, cellValue): string => {
214208
* @param column 字段
215209
* @param cellValue 字段值
216210
*/
217-
// @ts-ignore
218-
export const dateFormatter2 = (row, column, cellValue) => {
219-
if (!cellValue) {
220-
return
221-
}
222-
return formatDate(cellValue, 'YYYY-MM-DD')
211+
export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
212+
return cellValue ? formatDate(cellValue, 'YYYY-MM-DD') : ''
223213
}
224214

225215
/**
226216
* 设置起始日期,时间为00:00:00
227217
* @param param 传入日期
228218
* @returns 带时间00:00:00的日期
229219
*/
230-
export function beginOfDay(param: Date) {
220+
export function beginOfDay(param: Date): Date {
231221
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0)
232222
}
233223

@@ -236,7 +226,7 @@ export function beginOfDay(param: Date) {
236226
* @param param 传入日期
237227
* @returns 带时间23:59:59的日期
238228
*/
239-
export function endOfDay(param: Date) {
229+
export function endOfDay(param: Date): Date {
240230
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59)
241231
}
242232

@@ -245,7 +235,7 @@ export function endOfDay(param: Date) {
245235
* @param param1 日期1
246236
* @param param2 日期2
247237
*/
248-
export function betweenDay(param1: Date, param2: Date) {
238+
export function betweenDay(param1: Date, param2: Date): number {
249239
param1 = convertDate(param1)
250240
param2 = convertDate(param2)
251241
// 计算差值
@@ -257,7 +247,7 @@ export function betweenDay(param1: Date, param2: Date) {
257247
* @param param1 日期
258248
* @param param2 添加的时间
259249
*/
260-
export function addTime(param1: Date, param2: number) {
250+
export function addTime(param1: Date, param2: number): Date {
261251
param1 = convertDate(param1)
262252
return new Date(param1.getTime() + param2)
263253
}
@@ -266,7 +256,7 @@ export function addTime(param1: Date, param2: number) {
266256
* 日期转换
267257
* @param param 日期
268258
*/
269-
export function convertDate(param: Date | string) {
259+
export function convertDate(param: Date | string): Date {
270260
if (typeof param === 'string') {
271261
return new Date(param)
272262
}

src/views/bpm/definition/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<template>
2+
<doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
3+
24
<ContentWrap>
35
<el-table v-loading="loading" :data="list">
46
<el-table-column label="定义编号" align="center" prop="id" width="400" />

src/views/bpm/form/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<template>
2+
<doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
3+
24
<ContentWrap>
35
<!-- 搜索工作栏 -->
46
<el-form

src/views/bpm/group/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<template>
2+
<doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
3+
24
<ContentWrap>
35
<!-- 搜索工作栏 -->
46
<el-form

src/views/bpm/model/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<template>
2+
<doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
3+
24
<ContentWrap>
35
<!-- 搜索工作栏 -->
46
<el-form

src/views/bpm/oa/leave/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<template>
2+
<doc-alert title="工作流手册" url="https://doc.iocoder.cn/bpm/" />
3+
24
<ContentWrap>
35
<!-- 搜索工作栏 -->
46
<el-form

0 commit comments

Comments
 (0)