Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
e96c275b
提交
e96c275b
authored
4月 22, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(plan-search): 拆分搜索计划组件为单独的 vue 文件
同上
上级
c3f7190e
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
383 行增加
和
440 行删除
+383
-440
plan.js
src/api/promotion/plan.js
+1
-15
PickerSearch.vue
src/components/Mobile/PickerSearch.vue
+26
-42
index.js
src/dicts/index.js
+3
-5
index.vue
src/mobile/views/examine/index.vue
+24
-24
index.vue
src/mobile/views/promotion/plan/detail/index.vue
+2
-2
index.vue
src/mobile/views/promotion/plan/editing/index.vue
+4
-4
index.vue
src/mobile/views/promotion/plan/index/index.vue
+75
-323
plan-search.vue
src/mobile/views/promotion/plan/index/plan-search.vue
+220
-0
user.js
src/store/modules/user.js
+4
-4
date.js
src/utils/date.js
+14
-11
index.vue
src/views/promotion/plan/index.vue
+10
-10
没有找到文件。
src/api/promotion/plan.js
浏览文件 @
e96c275b
...
...
@@ -7,21 +7,7 @@ export function getPlanListAPI(queryParams) {
baseURL
:
VITE_APP_PROMOTION
,
url
:
'/plan/v2/query/page'
,
method
:
'POST'
,
data
:
{
pageNum
:
queryParams
.
pageNum
,
pageSize
:
queryParams
.
pageSize
,
queryParams
:
{
activityStartDate
:
queryParams
.
activityDate
&&
queryParams
.
activityDate
[
0
],
activityEndDate
:
queryParams
.
activityDate
&&
queryParams
.
activityDate
[
1
],
planStatus
:
queryParams
.
planStatus
,
province
:
queryParams
.
province
,
city
:
queryParams
.
city
,
dealerId
:
queryParams
.
zoneId
,
orgQcId
:
queryParams
.
warzoneId
,
employeeId
:
queryParams
.
employeeId
,
storeNameLike
:
queryParams
.
storeName
}
}
data
:
queryParams
})
}
...
...
src/components/Mobile/PickerSearch.vue
浏览文件 @
e96c275b
<
template
>
<div>
<van-popup
v-model:show=
"innerShowPicker"
destroy-on-close
round
position=
"bottom"
@
close=
"onPopupClose"
>
<van-picker
:columns=
"columns"
:cancel-button-text=
"searchShow ? '' : '取消'"
@
confirm=
"onConfirm"
>
<template
#
title
>
<!-- 搜索框 -->
<van-search
v-if=
"searchShow"
v-model=
"searchText"
:placeholder=
"placeholder"
shape=
"round"
@
update:model-value=
"onSearch"
/>
</
template
>
<
template
#
empty
>
<van-empty
image=
"https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
image-size=
"40"
description=
"暂无数据"
/>
</
template
>
</van-picker>
</van-popup>
</div>
<van-popup
destroy-on-close
round
teleport=
"body"
position=
"bottom"
@
close=
"onPopupClose"
>
<van-picker
:columns=
"columns"
:cancel-button-text=
"searchShow ? '' : '取消'"
@
confirm=
"onConfirm"
>
<template
#
title
>
<!-- 搜索框 -->
<van-search
v-if=
"searchShow"
v-model=
"searchText"
:placeholder=
"placeholder"
shape=
"round"
@
update:model-value=
"onSearch"
/>
</
template
>
<
template
#
empty
>
<van-empty
image=
"https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
image-size=
"40"
description=
"暂无数据"
/>
</
template
>
</van-picker>
</van-popup>
</template>
<
script
setup
>
const
props
=
defineProps
({
// 控制弹窗显示隐藏
modelValue
:
{
type
:
Boolean
,
default
:
false
},
// 选择器列数据
columns
:
{
type
:
Array
,
...
...
@@ -52,22 +45,15 @@ const props = defineProps({
});
// 定义向外触发的事件
const
emit
=
defineEmits
([
'
update:modelValue'
,
'
confirm'
,
'search'
]);
const
emit
=
defineEmits
([
'confirm'
,
'search'
]);
// 内部显示状态
const
innerShowPicker
=
ref
(
props
.
modelValue
);
// 搜索文本
const
searchText
=
ref
(
''
);
// 监听 props 变化更新内部状态
watch
(()
=>
props
.
modelValue
,
(
newValue
)
=>
{
innerShowPicker
.
value
=
newValue
;
});
// 弹窗关闭时触发
const
onPopupClose
=
()
=>
{
searchText
.
value
=
''
;
emit
(
'
update:modelValue'
,
false
);
emit
(
'
search'
,
''
);
};
/**
...
...
@@ -77,8 +63,6 @@ const onPopupClose = () => {
*/
const
onConfirm
=
(
values
)
=>
{
emit
(
'confirm'
,
values
);
emit
(
'update:modelValue'
,
false
);
};
/**
...
...
src/dicts/index.js
浏览文件 @
e96c275b
...
...
@@ -11,17 +11,15 @@ export const getPromotionRole = (role) => {
}
// 促销活动状态
export
const
NOT_EXECUTION
=
'NOT_EXECUTION'
// 未执行
export
const
EXECUTION
=
'EXECUTION'
// 执行
// 后台:返回数字,又让我传给他英文字符
// 后台:返回数字,又让我传给他英文字符,页面展示中文
export
const
PROMOTION_STATUS
=
{
0
:
{
label
:
'未执行'
,
value
:
NOT_EXECUTION
value
:
'NOT_EXECUTION'
},
1
:
{
label
:
'执行'
,
value
:
EXECUTION
value
:
'EXECUTION'
}
}
export
const
getPromotionActiveStatus
=
(
statusNum
)
=>
{
...
...
src/mobile/views/examine/index.vue
浏览文件 @
e96c275b
...
...
@@ -231,7 +231,7 @@ const decreaseCount = async () => {
temNum
:
form
.
value
.
temNum
-
1
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
form
.
value
.
temNum
--
;
}
...
...
@@ -243,7 +243,7 @@ const increaseCount = async () => {
temNum
:
form
.
value
.
temNum
+
1
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
form
.
value
.
temNum
++
;
};
...
...
@@ -302,14 +302,14 @@ const storePictureRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storePicture
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除店铺门头照
...
...
@@ -319,7 +319,7 @@ const deleteStorePicture = async () => {
storePicture
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -331,7 +331,7 @@ const planStatusChange = async (val) => {
planStatus
:
form
.
value
.
planStatus
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -342,7 +342,7 @@ const changeStoreDd = async () => {
storeDd
:
form
.
value
.
storeDd
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -357,7 +357,7 @@ const changeTemOnWork = async () => {
temOnWork
:
form
.
value
.
temOnWork
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemOnWorkTimeRange
=
()
=>
{
...
...
@@ -378,7 +378,7 @@ const changeTemHs = async () => {
temHs
:
form
.
value
.
temHs
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemWl
=
async
()
=>
{
...
...
@@ -387,7 +387,7 @@ const changeTemWl = async () => {
temWl
:
form
.
value
.
temWl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemZz
=
async
()
=>
{
...
...
@@ -396,7 +396,7 @@ const changeTemZz = async () => {
temZz
:
form
.
value
.
temZz
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -406,7 +406,7 @@ const temWorkPhotosRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
// 如果当前对象包含 objectUrl 则是组件上传的,替换当前元素的对象
const
index
=
form
.
value
.
temWorkPhotos
.
findIndex
(
o
=>
o
.
objectUrl
)
form
.
value
.
temWorkPhotos
[
index
]
=
{
...
...
@@ -418,7 +418,7 @@ const temWorkPhotosRead = async (file) => {
temWorkPhotos
:
form
.
value
.
temWorkPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -429,7 +429,7 @@ const deleteTemWorkPhotos = async () => {
temWorkPhotos
:
form
.
value
.
temWorkPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -439,14 +439,14 @@ const storeTcPhotoRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storeTcPhoto
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -457,7 +457,7 @@ const deleteStoreTcPhoto = async () => {
storeTcPhoto
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -467,14 +467,14 @@ const temOnWorkPictureRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storeZhjPhoto
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除主货架照片
...
...
@@ -484,7 +484,7 @@ const deleteStoreZhjPhoto = async () => {
storeZhjPhoto
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -494,7 +494,7 @@ const posPhotosRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
// 判断 objectUrl
const
index
=
form
.
value
.
posPhotos
.
findIndex
(
o
=>
o
.
objectUrl
)
form
.
value
.
posPhotos
[
index
]
=
{
...
...
@@ -506,7 +506,7 @@ const posPhotosRead = async (file) => {
posPhotos
:
form
.
value
.
posPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除 POS 照片
...
...
@@ -516,7 +516,7 @@ const deletePosPhotos = async () => {
posPhotos
:
form
.
value
.
posPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -527,7 +527,7 @@ const posRmbChange = async () => {
posRmb
:
form
.
value
.
posRmb
||
0
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
src/mobile/views/promotion/plan/detail/index.vue
浏览文件 @
e96c275b
...
...
@@ -95,7 +95,7 @@ import { parseTime } from '@/utils'
import
userStore
from
'@/store/modules/user'
const
{
proxy
}
=
getCurrentInstance
()
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
// 获取路由路径上的 id 参数
const
route
=
useRoute
();
const
router
=
useRouter
();
...
...
@@ -215,7 +215,7 @@ const clickExamine = async () => {
planStatus
:
planDetail
.
value
.
planStatus
===
0
?
'否'
:
'是'
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
}
)
if
(
!
result
.
data
)
{
return
proxy
.
$modal
.
msgError
(
'创建稽查任务失败'
)
...
...
src/mobile/views/promotion/plan/editing/index.vue
浏览文件 @
e96c275b
...
...
@@ -153,7 +153,7 @@ import userStore from '@/store/modules/user'
import
{
parseTime
}
from
'@/utils'
const
myForm
=
ref
({})
const
{
proxy
}
=
getCurrentInstance
();
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
const
form
=
reactive
({})
const
router
=
useRouter
();
const
route
=
useRoute
()
...
...
@@ -197,7 +197,7 @@ const validatorIncidentals = (value, obj) => {
}
}
const
onSubmit
=
async
()
=>
{
const
data
=
userStore
().
getE
mployeeInfo
const
data
=
userStore
().
e
mployeeInfo
for
(
const
key
in
data
)
{
form
[
key
]
=
data
[
key
]
}
...
...
@@ -278,8 +278,8 @@ const getBelongList = async () => {
columns
.
value
=
allBelongList
.
value
// 判断如果是城市经理,则设置默认归属人为自己
if
(
isCityManager
.
value
)
{
form
.
employeeName
=
userStore
().
getE
mployeeName
form
.
employeeNo
=
userStore
().
getE
mployeeNo
form
.
employeeName
=
userStore
().
e
mployeeName
form
.
employeeNo
=
userStore
().
e
mployeeNo
}
}
getBelongList
()
...
...
src/mobile/views/promotion/plan/index/index.vue
浏览文件 @
e96c275b
...
...
@@ -22,9 +22,9 @@
:to=
"`/m/promotion_plan_detail/$
{item.id}`">
<template
#
label
>
<p
class=
"employee"
>
{{
item
.
employeeName
}}
</p>
<p
v-if=
"item.planStatus === 0"
>
未执行
</p
>
<p
v-else
class=
"plan-go"
>
执行
</p>
<p
:class=
"
{ 'plan-go': item.planStatus === 1 }"
>
{{
getPromotionActiveStatus
(
item
.
planStatus
).
label
}}
</p>
</
template
>
<
template
#
value
>
<span>
{{
item
.
pattern
}}
</span>
...
...
@@ -34,8 +34,8 @@
<
template
#
right
>
<
van
-
button
square
type
=
"success"
text
=
"编辑"
@
click
=
"editPlan(item)"
/>
text
=
"编辑"
@
click
=
"editPlan(item)"
/>
<
van
-
button
square
type
=
"danger"
text
=
"删除"
...
...
@@ -46,115 +46,11 @@
<
/van-list
>
<
/van-pull-refresh
>
<
van
-
popup
v
-
model
:
show
=
"showSearch"
position
=
"right"
:
style
=
"{ height: '100vh'
}
"
>
<!--
快捷时间
-->
<
van
-
field
readonly
label
=
"快捷时间"
placeholder
=
"选择时间"
>
<
template
#
input
>
<
van
-
button
size
=
"small"
type
=
"primary"
v
-
for
=
"item in pickerOptions"
@
click
=
"pickerBtn(item)"
>
{{
item
.
text
}}
<
/van-button
>
<
/template
>
<
/van-field
>
<!--
开始时间
-->
<
van
-
field
v
-
model
=
"query.activityStartDate"
is
-
link
readonly
name
=
"datePicker"
label
=
"开始时间"
placeholder
=
"点击选择时间"
@
click
=
"startShowPicker = true"
:
formatter
=
"formatterStartDate"
>
<
/van-field
>
<
van
-
popup
v
-
model
:
show
=
"startShowPicker"
destroy
-
on
-
close
position
=
"bottom"
teleport
=
"body"
>
<
van
-
date
-
picker
v
-
model
=
"activityStartDatePicker"
@
confirm
=
"onStartConfirm"
@
cancel
=
"startShowPicker = false"
/>
<
/van-popup
>
<!--
结束时间
-->
<
van
-
field
v
-
model
=
"query.activityEndDate"
is
-
link
readonly
name
=
"datePicker"
label
=
"结束时间"
placeholder
=
"点击选择时间"
@
click
=
"endShowPicker = true"
:
formatter
=
"formatterEndDate"
/>
<
van
-
popup
v
-
model
:
show
=
"endShowPicker"
destroy
-
on
-
close
position
=
"bottom"
teleport
=
"body"
>
<
van
-
date
-
picker
v
-
model
=
"activityEndDatePicker"
@
confirm
=
"onEndConfirm"
@
cancel
=
"endShowPicker = false"
/>
<
/van-popup
>
<!--
活动类型
-->
<
van
-
field
v
-
model
=
"query.planStatus"
is
-
link
readonly
label
=
"活动状态"
placeholder
=
"选择活动状态"
@
click
=
"planStatusShowPicker = true"
>
<
/van-field
>
<
van
-
popup
v
-
model
:
show
=
"planStatusShowPicker"
destroy
-
on
-
close
teleport
=
"body"
position
=
"bottom"
>
<
van
-
picker
:
model
-
value
=
"planStatusStr"
:
columns
=
"planColumns"
@
cancel
=
"planStatusShowPicker = false"
@
confirm
=
"onPlanConfirm"
/>
<
/van-popup
>
<!--
归属人
-->
<
van
-
field
v
-
model
=
"query.employeeId"
is
-
link
readonly
label
=
"归属人"
placeholder
=
"选择归属人"
:
disabled
=
"cityManagerPrivilege"
@
click
=
"employeeIdShowPicker = true"
>
<
/van-field
>
<
van
-
popup
v
-
model
:
show
=
"employeeIdShowPicker"
destroy
-
on
-
close
teleport
=
"body"
position
=
"bottom"
>
<
van
-
picker
:
model
-
value
=
"planStatusStr"
:
columns
=
"employeeIdColumns"
@
cancel
=
"employeeIdShowPicker = false"
@
confirm
=
"onEmployeeConfirm"
>
<
template
#
title
>
<
van
-
search
v
-
model
=
"searchEmployeeName"
placeholder
=
"搜索归属人"
@
update
:
model
-
value
=
"onSearch"
/>
<
/template
>
<
/van-picker
>
<
/van-popup
>
<!--
终端名
-->
<
van
-
field
v
-
model
=
"query.storeNameLike"
label
=
"终端名"
placeholder
=
"请输入终端名"
@
update
:
model
-
value
=
"searchByStoreName"
clearable
/>
<!--
重置按钮
-->
<
van
-
button
icon
=
"replay"
class
=
"reset"
block
@
click
=
"resetFn"
>
重置
<
/van-button
>
<
/van-popup
>
<!--
测试
url
参数用
-->
<!--
<
div
>
<
p
class
=
"my-p"
>
{{
url
}}
<
/p
>
<
button
@
click
=
"copy"
>
复制
URL
<
/button
>
<
/div> --
>
<!--
搜索组件
-->
<
PlanSearch
v
-
model
:
show
=
"showSearch"
:
planColumns
=
"planColumns"
:
allEmpolyeeList
=
"allEmpolyeeList"
@
query
=
"getPlanList"
/>
<
/div
>
<
/template
>
...
...
@@ -163,77 +59,31 @@
defineOptions
({
name
:
'm_promotion_plan'
}
)
import
{
parseTime
}
from
'@/utils'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
userStore
from
'@/store/modules/user'
import
{
getPromotionActiveStatus
}
from
'@/dicts'
import
{
getChargeListAPI
,
getPlanListAPI
,
deletePlanAPI
}
from
'@/api'
import
store
from
'@/stor
e'
import
useUserStore
from
'@/store/modules/user'
import
PlanSearch
from
'./plan-search.vu
e'
const
{
proxy
}
=
getCurrentInstance
();
const
{
recentPickerOptions
:
pickerOptions
,
thisYearDate
}
=
useDatePickerOptions
(
0
)
const
router
=
useRouter
()
// 城市经理状态为 true
const
cityManagerPrivilege
=
computed
(()
=>
{
return
store
.
state
?.
value
?.
user
?.
userInfo
?.
privilegeId
==
1
}
)
// const url = ref('')
// url.value = window.location.href
// 点击复制按钮复制字符串到剪切板
// const copy = () =>
{
// const input = document.createElement('input');
// input.value = url.value;
// document.body.appendChild(input);
// input.select();
// document.execCommand('Copy');
// document.body.removeChild(input);
// alert('复制成功');
//
}
const
promotionIdentity
=
computed
(()
=>
userStore
().
promotionIdentity
)
const
employeeName
=
computed
(()
=>
userStore
().
employeeName
)
// 搜索弹窗
const
showSearch
=
ref
(
false
)
// 搜索表单对象
// 计划列表
const
query
=
reactive
({
activityStartDate
:
''
,
activityEndDate
:
''
,
planStatus
:
''
,
employeeId
:
''
,
// 归属人
storeNameLike
:
''
,
// 终端名
pageNum
:
1
,
pageSize
:
10
}
)
// 快捷时间
const
pickerBtn
=
(
item
)
=>
{
let
[
startTime
,
endTime
]
=
item
.
value
()
query
.
activityStartDate
=
parseTime
(
startTime
)
query
.
activityEndDate
=
parseTime
(
endTime
)
// 更新两个数组格式时间
activityStartDatePicker
[
0
]
=
startTime
.
getFullYear
()
activityStartDatePicker
[
1
]
=
startTime
.
getMonth
()
+
1
activityStartDatePicker
[
2
]
=
startTime
.
getDate
()
activityEndDatePicker
[
0
]
=
endTime
.
getFullYear
()
activityEndDatePicker
[
1
]
=
endTime
.
getMonth
()
+
1
activityEndDatePicker
[
2
]
=
endTime
.
getDate
()
const
planList
=
ref
([])
const
loading
=
ref
(
false
)
const
finished
=
ref
(
false
)
planList
.
value
=
[]
planQueryParams
.
pageNum
=
1
getPlanList
()
}
// 开始时间
const
startShowPicker
=
ref
(
false
)
const
activityStartDatePicker
=
[
new
Date
().
getFullYear
(),
new
Date
().
getMonth
()
+
1
,
new
Date
().
getDate
()]
const
onStartConfirm
=
(
val
)
=>
{
query
.
activityStartDate
=
val
.
selectedValues
.
join
(
'-'
)
startShowPicker
.
value
=
false
}
// 结束时间
const
endShowPicker
=
ref
(
false
)
const
activityEndDatePicker
=
[
new
Date
().
getFullYear
(),
new
Date
().
getMonth
()
+
1
,
new
Date
().
getDate
()]
const
onEndConfirm
=
(
val
)
=>
{
query
.
activityEndDate
=
val
.
selectedValues
.
join
(
'-'
)
endShowPicker
.
value
=
false
}
// 活动类型( 执行 EXECUTION ,未执行 NOT_EXECUTION)
const
planStatusShowPicker
=
ref
(
false
)
const
planStatusStr
=
ref
([])
// 活动状态
const
planColumns
=
[
{
text
:
'未执行'
,
...
...
@@ -244,33 +94,13 @@ const planColumns = [
value
:
'EXECUTION'
}
]
const
onPlanConfirm
=
(
val
)
=>
{
query
.
planStatus
=
val
.
selectedOptions
[
0
].
text
planStatusStr
.
value
=
val
.
selectedValues
planStatusShowPicker
.
value
=
false
planList
.
value
=
[]
planQueryParams
.
pageNum
=
1
getPlanList
()
}
// 归属人
const
searchEmployeeName
=
ref
(
''
)
const
employeeIdShowPicker
=
ref
(
false
)
const
employeeIdStr
=
ref
([])
// 所有归属人
const
employeeIdColumnsAll
=
ref
([])
// 展示归属人
const
employeeIdColumns
=
ref
([
])
const
onSearch
=
(
val
)
=>
{
employeeIdColumns
.
value
=
employeeIdColumnsAll
.
value
.
filter
(
item
=>
{
return
item
.
text
.
includes
(
searchEmployeeName
.
value
)
}
)
}
const
allEmpolyeeList
=
ref
([])
const
getEmployeeList
=
async
()
=>
{
const
res
=
await
getChargeListAPI
()
employeeIdColumnsAll
.
value
=
res
.
data
.
map
(
item
=>
{
allEmpolyeeList
.
value
=
res
.
data
.
map
(
item
=>
{
return
{
text
:
item
.
name
,
value
:
item
.
id
,
...
...
@@ -279,72 +109,35 @@ const getEmployeeList = async () => {
deptQcId
:
item
.
deptQcId
}
}
)
employeeIdColumns
.
value
=
employeeIdColumnsAll
.
value
// 城市经理-填充默认归属人
if
(
cityManagerPrivilege
.
value
)
{
query
.
employeeId
=
employeeIdColumnsAll
.
value
.
find
(
item
=>
item
.
employeeNo
===
store
.
state
.
value
.
user
.
userInfo
.
userName
)?.
text
employeeIdStr
.
value
=
employeeIdColumnsAll
.
value
.
find
(
item
=>
item
.
employeeNo
===
store
.
state
.
value
.
user
.
userInfo
.
userName
)?.
value
}
getPlanList
()
}
getEmployeeList
()
const
onEmployeeConfirm
=
(
val
)
=>
{
query
.
employeeId
=
val
.
selectedOptions
[
0
].
text
employeeIdStr
.
value
=
val
.
selectedValues
employeeIdShowPicker
.
value
=
false
planList
.
value
=
[]
planQueryParams
.
pageNum
=
1
getPlanList
()
}
// 计划列表
const
planQueryParams
=
reactive
({
pageNum
:
1
,
pageSize
:
10
}
)
const
planList
=
ref
([])
const
loading
=
ref
(
false
)
const
finished
=
ref
(
false
)
const
getPlanList
=
async
()
=>
{
// 城市经理查自己,职能角色查所有(需要的是促销系统 id)
if
(
cityManagerPrivilege
.
value
)
{
// 城市经理
planQueryParams
.
employeeId
=
employeeIdColumnsAll
.
value
.
find
(
item
=>
item
.
employeeNo
===
store
.
state
.
value
.
user
.
userInfo
.
userName
)?.
value
}
else
{
// 职能角色(走查询表单里的值)
planQueryParams
.
employeeId
=
employeeIdColumns
.
value
.
find
(
item
=>
item
.
text
===
query
.
employeeId
)?.
value
}
const
getPlanList
=
async
({
activityStartDate
,
activityEndDate
,
planStatus
,
employeeId
,
storeNameLike
}
=
{
}
)
=>
{
const
res
=
await
getPlanListAPI
({
...
planQueryParams
,
activityDate
:
[
query
.
activityStartDate
,
query
.
activityEndDate
],
planStatus
:
planColumns
.
find
(
item
=>
item
.
text
===
query
.
planStatus
)?.
value
,
storeName
:
query
.
storeNameLike
,
...
query
,
queryParams
:
{
activityStartDate
:
parseTime
(
activityStartDate
,
"{y
}
-{m
}
-{d
}
"
),
activityEndDate
:
parseTime
(
activityEndDate
,
"{y
}
-{m
}
-{d
}
"
),
planStatus
:
planColumns
.
find
(
item
=>
item
.
text
===
planStatus
)?.
value
,
employeeId
,
storeNameLike
}
,
}
)
planList
.
value
=
[...
planList
.
value
,
...
res
.
data
.
records
]
planList
.
value
=
res
.
data
.
records
// planList.value = [...planList.value, ...res.data.records]
finished
.
value
=
res
.
data
.
records
.
length
===
0
loading
.
value
=
false
}
getPlanList
()
const
formatterStartDate
=
()
=>
{
return
parseTime
(
query
.
activityStartDate
,
'{y
}
-{m
}
-{d
}
'
)
}
const
formatterEndDate
=
()
=>
{
return
parseTime
(
query
.
activityEndDate
,
'{y
}
-{m
}
-{d
}
'
)
}
const
searchByStoreName
=
(
val
)
=>
{
query
.
storeNameLike
=
val
planList
.
value
=
[]
planQueryParams
.
pageNum
=
1
getPlanList
()
}
// const init = async () =>
{
// await
// // getPlanList()
//
}
// init()
const
onLoad
=
()
=>
{
loading
.
value
=
true
planQueryParams
.
pageNum
++
query
.
pageNum
++
getPlanList
()
}
...
...
@@ -354,22 +147,10 @@ const onRefresh = () => {
refreshLoading
.
value
=
true
setTimeout
(()
=>
{
refreshLoading
.
value
=
false
resetFn
()
getPlanList
()
}
,
1000
)
}
// 重置
const
resetFn
=
()
=>
{
query
.
activityStartDate
=
''
query
.
activityEndDate
=
''
query
.
planStatus
=
''
query
.
employeeId
=
''
query
.
storeNameLike
=
''
planList
.
value
=
[]
planQueryParams
.
pageNum
=
1
getPlanList
()
}
// 编辑计划
const
editPlan
=
(
row
)
=>
{
router
.
push
(
`/m/promotion_plan_editing/${row.id
}
`
)
...
...
@@ -380,7 +161,7 @@ const deletePlan = (row) => {
proxy
.
$modal
.
confirm
(
`确认删除计划吗?`
).
then
(
async
()
=>
{
await
deletePlanAPI
({
planIds
:
[
row
.
id
],
employeeNo
:
use
UserStore
().
getE
mployeeNo
employeeNo
:
use
userStore
().
e
mployeeNo
}
)
proxy
.
$modal
.
msgSuccess
(
'删除成功'
)
// 找到 row 在数组里第几条删除
...
...
@@ -397,70 +178,42 @@ const deletePlan = (row) => {
background
:
#
f5f5f5
;
min
-
height
:
100
vh
;
.
van
-
cell
-
group
{
background
:
#
f5f5f5
;
}
.
van
-
cell
{
margin
-
top
:
10
px
;
::
v
-
deep
(.
van
-
cell__title
)
{
/* 强制一行显示 */
/* white-space: nowrap; */
}
p
{
margin
:
0
;
}
}
}
.
van
-
list
{
min
-
height
:
100
vh
;
.
van
-
list
{
min
-
height
:
100
vh
;
/* overflow-x: hidden; */
}
.
van
-
cell
-
group
{
background
:
#
f5f5f5
;
.
reset
{
margin
-
top
:
20
px
;
}
::
v
-
deep
(.
van
-
field
):
first
-
of
-
type
{
.
van
-
button
{
margin
:
0
2.5
px
;
padding
:
0
5
px
;
font
-
size
:
12
px
!
important
;
}
.
van
-
cell
{
margin
-
top
:
10
px
;
.
van
-
cell__right
-
icon
:
first
-
of
-
type
{
display
:
none
;
}
}
::
v
-
deep
(.
van
-
swipe
-
cell__right
)
{
display
:
flex
;
.
plan
-
go
{
color
:
#
39
bb74
;
}
button
{
height
:
100
%
;
}
}
::
v
-
deep
(.
employee
)
{
margin
-
bottom
:
5
px
!
important
;
}
::
v
-
deep
(.
van
-
cell__label
)
{
font
-
size
:
14
px
!
important
;
}
::
v
-
deep
(.
van
-
popup
--
right
)
{
width
:
85
%
!
important
;
}
::
v
-
deep
(.
employee
)
{
margin
-
bottom
:
5
px
!
important
;
}
::
v
-
deep
(.
van
-
cell__label
)
{
font
-
size
:
14
px
!
important
;
}
.
plan
-
go
{
color
:
#
39
bb74
;
}
.
van
-
search
{
width
:
60
%
;
p
{
margin
:
0
;
}
}
}
}
}
::
v
-
deep
(.
van
-
swipe
-
cell__right
)
{
display
:
flex
;
button
{
height
:
100
%
;
}
}
<
/style>
\ No newline at end of file
src/mobile/views/promotion/plan/index/plan-search.vue
0 → 100644
浏览文件 @
e96c275b
<
template
>
<!-- 搜索组件 -->
<van-popup
position=
"right"
class=
"wrap"
>
<!-- 快捷日期 -->
<van-field
readonly
label=
"快捷日期"
>
<template
#
input
>
<van-button
size=
"small"
type=
"primary"
v-for=
"item in pickerOptions"
@
click=
"pickerSelDate(item)"
>
{{
item
.
text
}}
</van-button>
</
template
>
</van-field>
<!-- 日期区间 -->
<van-field
:modelValue=
"searchDateStr"
is-link
readonly
label=
"日期范围"
placeholder=
"选择日期"
@
click=
"selSearchCalendar"
>
</van-field>
<van-calendar
v-model:show=
"showCalendar"
:min-date=
"searchMinDate"
:show-mark=
"false"
type=
"range"
allow-same-day
teleport=
"body"
:default-date=
"[query.activityStartDate, query.activityEndDate]"
@
confirm=
"confirmCalendar"
/>
<!-- 活动类型 -->
<van-field
v-model=
"query.planStatus"
is-link
readonly
label=
"活动状态"
placeholder=
"选择活动状态"
@
click=
"showPlanStatus = true"
>
</van-field>
<van-popup
v-model:show=
"showPlanStatus"
destroy-on-close
teleport=
"body"
position=
"bottom"
>
<van-picker
:model-value=
"[planColumns.find(o => o.text === query.planStatus)?.value]"
:columns=
"planColumns"
@
cancel=
"showPlanStatus = false"
@
confirm=
"confirmPlan"
/>
</van-popup>
<!-- 归属人 -->
<van-field
:model-value=
"showEmployeeList.find(o => o.value === query.employeeId)?.text"
is-link
readonly
label=
"归属人"
placeholder=
"选择归属人"
:disabled=
"promotionIdentity"
@
click=
"showEmployee = true"
>
</van-field>
<PickerSearch
v-model:show=
"showEmployee"
:columns=
"showEmployeeList"
placeholder=
"搜索归属人"
@
confirm=
"onEmployeeConfirm"
@
search=
"searchEmployee"
/>
<!-- 店铺名 -->
<van-field
v-model=
"query.storeNameLike"
label=
"店铺名"
placeholder=
"请输入店铺名"
@
update:model-value=
"searchByStoreName"
clearable
/>
<!-- 重置按钮 -->
<van-button
icon=
"replay"
class=
"reset-btn"
block
@
click=
"resetFn"
>
重置
</van-button>
</van-popup>
</template>
<
script
setup
>
import
{
parseTime
}
from
'@/utils'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
userStore
from
'@/store/modules/user'
const
promotionIdentity
=
computed
(()
=>
userStore
().
promotionIdentity
)
const
employeeNo
=
computed
(()
=>
userStore
().
employeeNo
)
const
{
recentPickerOptions
:
pickerOptions
}
=
useDatePickerOptions
()
const
query
=
reactive
({})
const
props
=
defineProps
({
planColumns
:
{
// 活动状态列表
type
:
Array
,
default
:
[]
},
allEmpolyeeList
:
{
// 所有归属人
type
:
Array
,
default
:
[]
}
})
const
emits
=
defineEmits
([
'query'
])
watch
(
query
,
()
=>
{
emits
(
'query'
,
query
)
},
{
deep
:
true
})
// 选择快捷日期
const
pickerSelDate
=
(
item
)
=>
{
let
[
startTime
,
endTime
]
=
item
.
value
()
// 拿到日期对象
// 同步更新单独选择日期的选择器和参数
query
.
activityStartDate
=
startTime
query
.
activityEndDate
=
endTime
}
// 选择日期区间
const
showCalendar
=
ref
(
false
)
const
searchDateStr
=
computed
(()
=>
{
if
(
!
query
.
activityStartDate
||
!
query
.
activityEndDate
)
{
return
''
}
return
[
query
.
activityStartDate
,
query
.
activityEndDate
].
map
(
o
=>
parseTime
(
o
,
"{y}-{m}-{d}"
)).
join
(
' 至 '
)
})
// 日历最小范围
const
searchMinDate
=
computed
(()
=>
{
return
new
Date
(
!
query
.
activityStartDate
?
new
Date
().
getFullYear
()
-
1
:
query
.
activityStartDate
.
getFullYear
()
-
1
,
0
,
1
)
})
// 日期日历范围
const
selSearchCalendar
=
()
=>
{
// 默认设置今日日期
if
(
!
query
.
activityStartDate
||
!
query
.
activityEndDate
)
{
query
.
activityStartDate
=
new
Date
()
query
.
activityEndDate
=
new
Date
()
}
showCalendar
.
value
=
true
}
// 确定日期
const
confirmCalendar
=
(
value
)
=>
{
showCalendar
.
value
=
false
query
.
activityStartDate
=
value
[
0
]
query
.
activityEndDate
=
value
[
1
]
}
// 活动状态
const
showPlanStatus
=
ref
(
false
)
// 选中的活动状态
const
confirmPlan
=
(
val
)
=>
{
query
.
planStatus
=
val
.
selectedOptions
[
0
].
text
showPlanStatus
.
value
=
false
}
// 归属人
const
showEmployee
=
ref
(
false
)
// 展示归属人
const
showEmployeeList
=
ref
([])
watch
(()
=>
props
.
allEmpolyeeList
,
(
newValue
)
=>
{
showEmployeeList
.
value
=
newValue
// 如果是城市经理默认填充
if
(
promotionIdentity
.
value
)
{
// 找到员工的 id
const
obj
=
newValue
.
find
(
o
=>
o
.
employeeNo
===
employeeNo
.
value
)
query
.
employeeId
=
obj
.
value
}
})
const
searchEmployee
=
(
searchName
)
=>
{
showEmployeeList
.
value
=
props
.
allEmpolyeeList
.
filter
(
item
=>
{
return
item
.
text
.
includes
(
searchName
)
})
}
// 确定归属人
const
onEmployeeConfirm
=
(
val
)
=>
{
query
.
employeeId
=
val
.
selectedOptions
[
0
].
value
showEmployee
.
value
=
false
}
// 店铺名
const
searchByStoreName
=
(
val
)
=>
{
query
.
storeNameLike
=
val
}
// 重置
const
resetFn
=
()
=>
{
query
.
activityStartDate
=
''
query
.
activityEndDate
=
''
query
.
planStatus
=
''
query
.
employeeId
=
''
query
.
storeNameLike
=
''
}
</
script
>
<
style
scoped
lang=
"scss"
>
.wrap
{
--van-field-label-width
:
80px
;
height
:
100vh
;
width
:
85%
!
important
;
.van-field
:first-of-type
{
.van-button
{
margin
:
0
2
.5px
;
padding
:
0
5px
;
font-size
:
12px
!
important
;
}
}
.van-search
{
width
:
60%
;
}
.reset-btn
{
margin-top
:
20px
;
}
}
</
style
>
\ No newline at end of file
src/store/modules/user.js
浏览文件 @
e96c275b
...
...
@@ -95,11 +95,11 @@ export default defineStore(
},
getters
:
{
// 获取促销系统身份(true 城市经理)
getP
romotionIdentity
(
state
)
{
p
romotionIdentity
(
state
)
{
return
getPromotionRole
(
state
.
userInfo
.
privilegeId
)
===
CITY_MANAGER
},
// 获取员工工号,姓名,id
getE
mployeeInfo
(
state
)
{
e
mployeeInfo
(
state
)
{
return
{
operNo
:
state
.
userInfo
.
userName
,
operName
:
state
.
userInfo
.
nickName
,
...
...
@@ -107,11 +107,11 @@ export default defineStore(
}
},
// 获取员工工号
getE
mployeeNo
(
state
)
{
e
mployeeNo
(
state
)
{
return
state
.
userInfo
.
userName
},
// 获取员工姓名
getE
mployeeName
(
state
)
{
e
mployeeName
(
state
)
{
return
state
.
userInfo
.
nickName
}
}
...
...
src/utils/date.js
浏览文件 @
e96c275b
// 把日期对象转成年-月-日前面补0 的数组
/**
* 把日期对象转成年-月-日前面补0 的数组
* @param {*} date 日期对象
* @returns [年,月,日]
* @example 2023-09-01 => [2023, 09, 01]
*/
export
function
formatDateToArr
(
date
)
{
const
year
=
date
.
getFullYear
();
// 获取年份
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 获取月份并补零
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
// 获取日期并补零
return
[
year
,
month
,
day
];
}
/**
* 生成时间列表
* @param {*} startDate 起始时间
...
...
@@ -207,13 +221,3 @@ export function addDateRange(params, dateRange, propName) {
return
search
;
}
/**
* 生成唯一字符串
* @returns {string}
*/
export
function
createUniqueString
()
{
const
timestamp
=
+
new
Date
()
+
''
const
randomNum
=
parseInt
((
1
+
Math
.
random
())
*
65536
)
+
''
return
(
+
(
randomNum
+
timestamp
)).
toString
(
32
)
}
\ No newline at end of file
src/views/promotion/plan/index.vue
浏览文件 @
e96c275b
...
...
@@ -461,7 +461,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
import
{
usePromotionHooks
}
from
'@/hooks'
const
{
proxy
}
=
getCurrentInstance
();
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
const
{
recentPickerOptions
:
pickerOptions
}
=
useDatePickerOptions
()
const
queryParams
=
reactive
({
...
...
@@ -707,9 +707,9 @@ const getPlanList = async () => {
// 城市经理查自己,职能角色查所有
if
(
isCityManager
.
value
)
{
// 城市经理 (用员工 ID(1,2,3),而不是工号,employeeNo 是工号(000535))
queryParams
.
employeeId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
getE
mployeeNo
)?.
value
queryParams
.
employeeId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
e
mployeeNo
)?.
value
// 先从归属人查询当前登录用户的战区 ID
queryParams
.
warzoneId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
getE
mployeeNo
)?.
deptQcId
queryParams
.
warzoneId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
e
mployeeNo
)?.
deptQcId
}
// 日期格式化一下
if
(
queryParams
.
activityDate
?.
length
>
0
)
{
...
...
@@ -811,11 +811,11 @@ const uploadFile = async (file) => {
// 拼接当前月数为文件夹名
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
targetAPI
=
isCityManager
.
value
?
addPlanAPI
:
addPlanByRoleAPI
const
res
=
await
targetAPI
({
"excelUrl"
:
excelUrl
,
"employeeNo"
:
userStore
().
getE
mployeeNo
"employeeNo"
:
userStore
().
e
mployeeNo
})
planTableList
.
value
=
res
.
data
.
table
confirmExcelUUID
.
value
=
res
.
data
.
uuid
...
...
@@ -1061,7 +1061,7 @@ const handleAdd = () => {
resetAddOrEditPlanForm
()
// 只有城市经理情况下,默认填充当前登录人为归属人
if
(
isCityManager
.
value
)
{
addOrEditPlanForm
.
value
.
employeeNo
=
userStore
().
getE
mployeeNo
addOrEditPlanForm
.
value
.
employeeNo
=
userStore
().
e
mployeeNo
}
addOrEditPlanVisible
.
value
=
true
}
...
...
@@ -1116,7 +1116,7 @@ const editFn = (row) => {
const
handleAddOrEditPlan
=
async
()
=>
{
// 表单校验
await
addOrEditPlanRef
.
value
.
validate
()
addOrEditPlanForm
.
value
.
operNo
=
userStore
().
getE
mployeeNo
addOrEditPlanForm
.
value
.
operNo
=
userStore
().
e
mployeeNo
addOrEditPlanForm
.
value
.
operName
=
store
.
state
.
value
.
user
.
userInfo
.
nickName
addOrEditPlanForm
.
value
.
operId
=
store
.
state
.
value
.
user
.
userInfo
.
userId
...
...
@@ -1154,7 +1154,7 @@ const handleDelete = async () => {
})
await
deletePlanAPI
({
planIds
:
checkedRowList
.
value
.
map
(
o
=>
o
.
id
),
employeeNo
:
userStore
().
getE
mployeeNo
employeeNo
:
userStore
().
e
mployeeNo
})
ElMessage
.
success
(
'删除成功'
)
getPlanList
()
...
...
@@ -1221,10 +1221,10 @@ const uploadChangeFile = async (file) => {
// 拼接当前月数为文件夹名
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
res
=
await
updatePlanAPI
({
"excelUrl"
:
excelUrl
,
"employeeNo"
:
userStore
().
getE
mployeeNo
"employeeNo"
:
userStore
().
e
mployeeNo
})
planTableList
.
value
=
res
.
data
.
table
confirmExcelUUID
.
value
=
res
.
data
.
uuid
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论