Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
6ae9746a
提交
6ae9746a
authored
4月 22, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mobile/plan): 新增判断编辑和删除_无法操作已执行和之前计划
同上
上级
1c6e8287
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
40 行删除
+30
-40
index.js
src/hooks/promotion/index.js
+12
-18
index.vue
src/mobile/views/promotion/plan/index/index.vue
+16
-8
index.vue
src/views/promotion/plan/index.vue
+2
-14
没有找到文件。
src/hooks/promotion/index.js
浏览文件 @
6ae9746a
export
const
usePromotionHooks
=
()
=>
{
/**
* 判断某个身份在指定日期号码是否有上传权限
* @param {*} isCityManager 城市经理 true,职能角色 false
* @param {*} dateNum 指定日期号码 1-31
* @returns
*/
const
isUpDisRef
=
ref
(
true
)
const
checkUpDis
=
(
isCityManager
,
dateNum
)
=>
{
isUpDisRef
.
value
=
(
new
Date
().
getDate
()
>=
dateNum
&&
isCityManager
.
value
)
}
return
{
isUpDisRef
,
checkUpDis
}
}
/**
* 判断计划是否可编辑/删除
* @param {*} row 计划信息对象
* @returns boolean true 可编辑/删除,false 不可编辑/删除
*/
export
const
checkPlanExpire
=
(
row
)
=>
{
const
date
=
new
Date
()
const
rowDate
=
new
Date
(
row
.
clockInTime
)
rowDate
.
setHours
(
rowDate
.
getHours
()
+
1
)
return
!
(
rowDate
<
date
||
row
.
planStatus
===
1
)
}
\ No newline at end of file
src/mobile/views/promotion/plan/index/index.vue
浏览文件 @
6ae9746a
...
...
@@ -62,7 +62,7 @@ defineOptions({
}
)
import
{
parseTime
}
from
'@/utils'
import
{
checkPlanExpire
}
from
'@/hooks'
import
{
getPromotionActiveStatus
}
from
'@/dicts'
import
{
getChargeListAPI
,
getPlanListAPI
,
deletePlanAPI
}
from
'@/api'
import
PlanSearch
from
'./plan-search.vue'
...
...
@@ -150,11 +150,17 @@ const onRefresh = () => {
// 编辑计划
const
editPlan
=
(
row
)
=>
{
if
(
!
checkPlanExpire
(
row
))
{
return
proxy
.
$modal
.
msgWarning
(
'无法编辑,已执行或之前计划'
)
}
router
.
push
(
`/m/promotion_plan_editing/${row.id
}
`
)
}
// 删除计划
const
deletePlan
=
(
row
)
=>
{
if
(
!
checkPlanExpire
(
row
))
{
return
proxy
.
$modal
.
msgWarning
(
'无法删除,已执行或之前计划'
)
}
proxy
.
$modal
.
confirm
(
`确认删除计划吗?`
).
then
(
async
()
=>
{
await
deletePlanAPI
({
planIds
:
[
row
.
id
],
...
...
@@ -184,13 +190,7 @@ const deletePlan = (row) => {
.
van
-
cell
{
margin
-
top
:
10
px
;
::
v
-
deep
(.
van
-
swipe
-
cell__right
)
{
display
:
flex
;
button
{
height
:
100
%
;
}
}
::
v
-
deep
(.
van
-
cell__label
)
{
font
-
size
:
14
px
!
important
;
...
...
@@ -208,6 +208,14 @@ const deletePlan = (row) => {
margin
:
0
;
}
}
::
v
-
deep
(.
van
-
swipe
-
cell__right
)
{
display
:
flex
;
button
{
height
:
100
%
;
}
}
}
}
}
...
...
src/views/promotion/plan/index.vue
浏览文件 @
6ae9746a
...
...
@@ -450,7 +450,7 @@
<
script
setup
>
import
{
getPlanListAPI
,
uploadFileToOSSAPI
,
addPlanAPI
,
savePlanAPI
,
deletePlanAPI
,
addPlanByRoleAPI
,
getProCityAPI
,
getDealerListAPI
,
getWarZoneListAPI
,
getChargeListAPI
,
addPlanByWebAPI
,
updatePlanByWebAPI
,
getPlanStoreListAPI
,
updatePlanAPI
,
batchUpdatePlanAPI
}
from
'@/api'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
{
useDatePickerOptions
,
checkPlanExpire
}
from
'@/hooks'
import
{
v4
as
uuidv4
}
from
'uuid'
;
import
store
from
'@/store'
import
userStore
from
'@/store/modules/user'
...
...
@@ -458,7 +458,6 @@ import { getPromotionRole, getPromotionActiveStatus } from '@/dicts'
import
{
CITY_MANAGER
,
PROMOTION_STATUS
}
from
'@/dicts'
import
{
parseTime
}
from
'@/utils'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
;
import
{
usePromotionHooks
}
from
'@/hooks'
const
{
proxy
}
=
getCurrentInstance
();
const
isCityManager
=
ref
(
userStore
().
promotionIdentity
)
...
...
@@ -762,18 +761,7 @@ const formatter = (row, col, value) => {
return
value
}
}
// 判断计划是否过期(上班开始后 1 小时无法编辑和删除)
const
checkPlanExpire
=
(
row
)
=>
{
const
date
=
new
Date
()
const
rowDate
=
new
Date
(
row
.
clockInTime
)
rowDate
.
setHours
(
rowDate
.
getHours
()
+
1
)
if
(
rowDate
<
date
||
row
.
planStatus
===
1
)
{
// 过期/已经开始不可以操作
return
false
}
else
{
return
true
}
}
// 计划是否可选和编辑和删除按钮禁用
const
selectableFn
=
(
row
)
=>
{
return
checkPlanExpire
(
row
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论