Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
supervise-wecom
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f2093d69
authored
Jun 03, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 添加审批提交页面的表单项配置,优化表单逻辑和数据处理
1 parent
e2bf04ba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
63 deletions
src/api/mine.js
src/views/mine/view/approvalSubmit.vue
src/api/mine.js
View file @
f2093d6
...
@@ -10,6 +10,9 @@ export default {
...
@@ -10,6 +10,9 @@ export default {
getDictList
(
data
)
{
getDictList
(
data
)
{
return
api
.
post
(
"dj.api.staff.miniprogram.dict.list"
,
data
,
"staffUrl"
);
return
api
.
post
(
"dj.api.staff.miniprogram.dict.list"
,
data
,
"staffUrl"
);
},
},
getFlightSupervisorList
(
data
)
{
return
api
.
post
(
"dj.api.supervisor.mini.list.flightSupervisor"
,
data
,
"supervisorUrl"
);
},
submitApproval
(
data
)
{
submitApproval
(
data
)
{
return
api
.
post
(
"dj.api.supervisor.mini.approval.submit"
,
data
,
"supervisorUrl"
);
return
api
.
post
(
"dj.api.supervisor.mini.approval.submit"
,
data
,
"supervisorUrl"
);
},
},
...
...
src/views/mine/view/approvalSubmit.vue
View file @
f2093d6
<
template
>
<
template
>
<div
class=
"approval-submit-page"
>
<div
class=
"approval-submit-page"
>
<!--
<div
class=
"page-header"
>
<van-icon
name=
"arrow-left"
@
click=
"$router.back()"
/>
<div
class=
"page-title"
>
{{
pageTitle
}}
</div>
<van-icon
name=
"ellipsis"
/>
</div>
-->
<div
v-if=
"isApprove"
class=
"form-card"
>
<div
v-if=
"isApprove"
class=
"form-card"
>
<div
class=
"form-row"
@
click=
"openPicker('scene')"
>
<div
v-for=
"item in approveFormItems"
<span>
带教场景
</span>
:key=
"item.key"
<div
class=
"row-value"
>
class=
"form-row"
<span
:class=
"
{ placeholder: !form.teachingSceneName }">
{{
form
.
teachingSceneName
||
'点击选择'
}}
</span>
@
click=
"handleFormItemClick(item)"
>
<van-icon
name=
"arrow"
/>
<span>
{{
item
.
label
}}
<em
v-if=
"item.required"
>
*
</em></span>
</div>
</div>
<div
class=
"form-row"
@
click=
"showTimePicker = true"
>
<span>
带教时间
</span>
<div
class=
"row-value"
>
<div
class=
"row-value"
>
<span
:class=
"
{ placeholder: !form.teachingTime }">
{{
form
.
teachingTime
||
'点击选择'
}}
</span>
<span
:class=
"
{ placeholder: !getFormValue(item) }">
<van-icon
name=
"arrow"
/>
{{
getFormValue
(
item
)
||
item
.
placeholder
}}
</div>
</span>
</div>
<div
class=
"form-row"
@
click=
"openPicker('method')"
>
<span>
带教方式
</span>
<div
class=
"row-value"
>
<span
:class=
"
{ placeholder: !form.teachingMethodName }">
{{
form
.
teachingMethodName
||
'点击选择'
}}
</span>
<van-icon
name=
"arrow"
/>
</div>
</div>
<div
class=
"form-row"
@
click=
"openPicker('topic')"
>
<span>
带教主题
</span>
<div
class=
"row-value"
>
<span
:class=
"
{ placeholder: !form.teachingTopicName }">
{{
form
.
teachingTopicName
||
'点击选择'
}}
</span>
<van-icon
name=
"arrow"
/>
<van-icon
name=
"arrow"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<div
v-else
class=
"reject-card"
>
<div
v-else
class=
"reject-card"
>
<div
v-for=
"item in rejectFormItems"
:key=
"item.key"
>
<div
class=
"reject-label"
>
<div
class=
"reject-label"
>
驳回理由
<span>
*
</span>
{{
item
.
label
}}
<span
v-if=
"item.required"
>
*
</span>
</div>
<van-field
class=
"reject-field"
show-word-limit
:maxlength=
"item.maxlength"
:placeholder=
"item.placeholder"
:rows=
"item.rows"
:type=
"item.type"
:value=
"form[item.valueKey]"
@
input=
"setFormValue(item.valueKey, $event)"
/>
</div>
</div>
<van-field
v-model
.
trim=
"form.rejectReason"
class=
"reject-field"
maxlength=
"500"
placeholder=
"请输入"
rows=
"4"
type=
"textarea"
show-word-limit
/>
</div>
</div>
<div
class=
"bottom-bar"
>
<div
class=
"bottom-bar"
>
...
@@ -97,6 +76,61 @@ const DICT_CONFIG = {
...
@@ -97,6 +76,61 @@ const DICT_CONFIG = {
topic
:
{
typeCode
:
"teaching_topic"
,
title
:
"选择带教主题"
},
topic
:
{
typeCode
:
"teaching_topic"
,
title
:
"选择带教主题"
},
};
};
const
APPROVE_FORM_CONFIG
=
[
{
key
:
"supervisor"
,
label
:
"指定带教督导"
,
required
:
true
,
requiredKey
:
"assignedSupervisorPhone"
,
valueKey
:
"assignedSupervisorName"
,
type
:
"picker"
,
pickerTitle
:
"选择指定带教督导"
,
placeholder
:
"点击选择"
,
},
{
key
:
"scene"
,
label
:
"带教场景"
,
valueKey
:
"teachingSceneName"
,
type
:
"picker"
,
placeholder
:
"点击选择"
,
},
{
key
:
"time"
,
label
:
"带教时间"
,
valueKey
:
"teachingTime"
,
type
:
"datetime"
,
placeholder
:
"点击选择"
,
},
{
key
:
"method"
,
label
:
"带教方式"
,
valueKey
:
"teachingMethodName"
,
type
:
"picker"
,
placeholder
:
"点击选择"
,
},
{
key
:
"topic"
,
label
:
"带教主题"
,
valueKey
:
"teachingTopicName"
,
type
:
"picker"
,
placeholder
:
"点击选择"
,
},
];
const
REJECT_FORM_CONFIG
=
[
{
key
:
"rejectReason"
,
label
:
"驳回理由"
,
required
:
true
,
requiredKey
:
"rejectReason"
,
valueKey
:
"rejectReason"
,
type
:
"textarea"
,
rows
:
4
,
maxlength
:
500
,
placeholder
:
"请输入"
,
},
];
export
default
{
export
default
{
name
:
"MineApprovalSubmit"
,
name
:
"MineApprovalSubmit"
,
data
()
{
data
()
{
...
@@ -107,6 +141,7 @@ export default {
...
@@ -107,6 +141,7 @@ export default {
currentDate
:
new
Date
(),
currentDate
:
new
Date
(),
showTimePicker
:
false
,
showTimePicker
:
false
,
dicts
:
{
dicts
:
{
supervisor
:
[],
scene
:
[],
scene
:
[],
methodOnline
:
[],
methodOnline
:
[],
methodOffline
:
[],
methodOffline
:
[],
...
@@ -119,6 +154,8 @@ export default {
...
@@ -119,6 +154,8 @@ export default {
},
},
submitting
:
false
,
submitting
:
false
,
form
:
{
form
:
{
assignedSupervisorPhone
:
""
,
assignedSupervisorName
:
""
,
teachingSceneCode
:
""
,
teachingSceneCode
:
""
,
teachingSceneName
:
""
,
teachingSceneName
:
""
,
teachingTime
:
""
,
teachingTime
:
""
,
...
@@ -137,14 +174,25 @@ export default {
...
@@ -137,14 +174,25 @@ export default {
pageTitle
()
{
pageTitle
()
{
return
this
.
isApprove
?
"通过"
:
"驳回"
;
return
this
.
isApprove
?
"通过"
:
"驳回"
;
},
},
approveFormItems
()
{
return
APPROVE_FORM_CONFIG
;
},
rejectFormItems
()
{
return
REJECT_FORM_CONFIG
;
},
currentFormItems
()
{
return
this
.
isApprove
?
this
.
approveFormItems
:
this
.
rejectFormItems
;
},
submitDisabled
()
{
submitDisabled
()
{
return
this
.
submitting
||
!
this
.
id
||
(
!
this
.
isApprove
&&
!
this
.
form
.
rejectReason
);
return
this
.
submitting
||
!
this
.
id
||
this
.
hasRequiredEmpty
(
);
},
},
methodKey
()
{
methodKey
()
{
const
sceneText
=
`
${
this
.
form
.
teachingSceneCode
}${
this
.
form
.
teachingSceneName
}
`
;
const
sceneText
=
`
${
this
.
form
.
teachingSceneCode
}${
this
.
form
.
teachingSceneName
}
`
;
return
sceneText
.
includes
(
"线下"
)
||
sceneText
.
includes
(
"offline"
)
?
"methodOffline"
:
"methodOnline"
;
return
sceneText
.
includes
(
"线下"
)
||
sceneText
.
includes
(
"offline"
)
?
"methodOffline"
:
"methodOnline"
;
},
},
pickerColumns
()
{
pickerColumns
()
{
if
(
this
.
picker
.
key
===
"supervisor"
)
return
this
.
dicts
.
supervisor
;
if
(
this
.
picker
.
key
===
"method"
)
if
(
this
.
picker
.
key
===
"method"
)
return
this
.
dicts
[
this
.
methodKey
];
return
this
.
dicts
[
this
.
methodKey
];
return
this
.
dicts
[
this
.
picker
.
key
]
||
[];
return
this
.
dicts
[
this
.
picker
.
key
]
||
[];
...
@@ -154,7 +202,7 @@ export default {
...
@@ -154,7 +202,7 @@ export default {
this
.
userInfo
=
util
.
getLocalStorage
(
"ww_userInfo"
)
||
{};
this
.
userInfo
=
util
.
getLocalStorage
(
"ww_userInfo"
)
||
{};
this
.
id
=
this
.
$route
.
query
.
id
||
""
;
this
.
id
=
this
.
$route
.
query
.
id
||
""
;
this
.
type
=
this
.
$route
.
query
.
type
||
"approve"
;
this
.
type
=
this
.
$route
.
query
.
type
||
"approve"
;
document
.
title
=
this
.
isApprove
?
"通过"
:
"驳回"
;
document
.
title
=
this
.
pageTitle
;
if
(
this
.
isApprove
)
{
if
(
this
.
isApprove
)
{
this
.
getDicts
();
this
.
getDicts
();
}
}
...
@@ -162,6 +210,7 @@ export default {
...
@@ -162,6 +210,7 @@ export default {
methods
:
{
methods
:
{
async
getDicts
()
{
async
getDicts
()
{
await
Promise
.
all
([
await
Promise
.
all
([
this
.
getFlightSupervisors
(),
this
.
getDict
(
"scene"
),
this
.
getDict
(
"scene"
),
this
.
getDict
(
"methodOnline"
),
this
.
getDict
(
"methodOnline"
),
this
.
getDict
(
"methodOffline"
),
this
.
getDict
(
"methodOffline"
),
...
@@ -178,44 +227,92 @@ export default {
...
@@ -178,44 +227,92 @@ export default {
const
list
=
data
.
list
||
data
.
records
||
data
||
[];
const
list
=
data
.
list
||
data
.
records
||
data
||
[];
this
.
dicts
[
key
]
=
(
Array
.
isArray
(
list
)
?
list
:
[]).
map
(
this
.
normalizeDictItem
);
this
.
dicts
[
key
]
=
(
Array
.
isArray
(
list
)
?
list
:
[]).
map
(
this
.
normalizeDictItem
);
},
},
async
getFlightSupervisors
()
{
const
res
=
await
api
.
getFlightSupervisorList
({
phone
:
this
.
userInfo
.
phone
});
const
data
=
res
.
data
||
res
||
{};
const
list
=
data
.
list
||
data
.
records
||
data
||
[];
this
.
dicts
.
supervisor
=
(
Array
.
isArray
(
list
)
?
list
:
[]).
map
(
this
.
normalizeSupervisorItem
);
},
normalizeDictItem
(
item
)
{
normalizeDictItem
(
item
)
{
return
{
return
{
...
item
,
...
item
,
code
:
item
.
itemValue
||
""
,
code
:
item
.
itemValue
||
item
.
code
||
item
.
value
||
""
,
name
:
item
.
itemName
||
""
,
name
:
item
.
itemName
||
item
.
name
||
item
.
label
||
""
,
};
};
},
},
openPicker
(
key
)
{
normalizeSupervisorItem
(
item
)
{
const
configKey
=
key
===
"method"
?
this
.
methodKey
:
key
;
return
{
this
.
picker
.
key
=
key
;
...
item
,
this
.
picker
.
title
=
DICT_CONFIG
[
configKey
]?.
title
||
""
;
phone
:
item
.
assignedSupervisorPhone
||
item
.
supervisorPhone
||
item
.
phone
||
item
.
mobile
||
""
,
name
:
item
.
assignedSupervisorName
||
item
.
supervisorName
||
item
.
name
||
item
.
staffName
||
""
,
};
},
handleFormItemClick
(
item
)
{
if
(
item
.
type
===
"datetime"
)
{
this
.
showTimePicker
=
true
;
return
;
}
this
.
openPicker
(
item
);
},
openPicker
(
item
)
{
this
.
picker
.
key
=
item
.
key
;
this
.
picker
.
title
=
item
.
pickerTitle
||
this
.
getDictConfig
(
item
.
key
)?.
title
||
""
;
this
.
picker
.
show
=
true
;
this
.
picker
.
show
=
true
;
},
},
getDictConfig
(
key
)
{
const
configKey
=
key
===
"method"
?
this
.
methodKey
:
key
;
return
DICT_CONFIG
[
configKey
];
},
onPickerConfirm
(
item
)
{
onPickerConfirm
(
item
)
{
if
(
!
item
)
{
if
(
!
item
)
{
this
.
picker
.
show
=
false
;
this
.
picker
.
show
=
false
;
return
;
return
;
}
}
if
(
this
.
picker
.
key
===
"scene"
)
{
const
handlers
=
{
supervisor
:
this
.
applySupervisor
,
scene
:
this
.
applyScene
,
method
:
this
.
applyMethod
,
topic
:
this
.
applyTopic
,
};
const
handler
=
handlers
[
this
.
picker
.
key
];
if
(
handler
)
handler
(
item
);
this
.
picker
.
show
=
false
;
},
applySupervisor
(
item
)
{
this
.
form
.
assignedSupervisorPhone
=
item
.
phone
;
this
.
form
.
assignedSupervisorName
=
item
.
name
;
},
applyScene
(
item
)
{
this
.
form
.
teachingSceneCode
=
item
.
code
;
this
.
form
.
teachingSceneCode
=
item
.
code
;
this
.
form
.
teachingSceneName
=
item
.
name
;
this
.
form
.
teachingSceneName
=
item
.
name
;
this
.
form
.
teachingMethodCode
=
""
;
this
.
form
.
teachingMethodCode
=
""
;
this
.
form
.
teachingMethodName
=
""
;
this
.
form
.
teachingMethodName
=
""
;
}
},
if
(
this
.
picker
.
key
===
"method"
)
{
applyMethod
(
item
)
{
this
.
form
.
teachingMethodCode
=
item
.
code
;
this
.
form
.
teachingMethodCode
=
item
.
code
;
this
.
form
.
teachingMethodName
=
item
.
name
;
this
.
form
.
teachingMethodName
=
item
.
name
;
}
},
if
(
this
.
picker
.
key
===
"topic"
)
{
applyTopic
(
item
)
{
this
.
form
.
teachingTopicCode
=
item
.
code
;
this
.
form
.
teachingTopicCode
=
item
.
code
;
this
.
form
.
teachingTopicName
=
item
.
name
;
this
.
form
.
teachingTopicName
=
item
.
name
;
}
this
.
picker
.
show
=
false
;
},
},
onTimeConfirm
(
value
)
{
onTimeConfirm
(
value
)
{
this
.
form
.
teachingTime
=
dayjs
(
value
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
this
.
form
.
teachingTime
=
dayjs
(
value
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
this
.
showTimePicker
=
false
;
this
.
showTimePicker
=
false
;
},
},
getFormValue
(
item
)
{
return
this
.
form
[
item
.
valueKey
];
},
setFormValue
(
key
,
value
)
{
this
.
$set
(
this
.
form
,
key
,
typeof
value
===
"string"
?
value
.
trim
()
:
value
);
},
hasRequiredEmpty
()
{
return
this
.
currentFormItems
.
some
(
item
=>
item
.
required
&&
!
this
.
form
[
item
.
requiredKey
||
item
.
valueKey
]);
},
getFirstEmptyRequired
()
{
return
this
.
currentFormItems
.
find
(
item
=>
item
.
required
&&
!
this
.
form
[
item
.
requiredKey
||
item
.
valueKey
]);
},
buildParams
()
{
buildParams
()
{
const
params
=
{
const
params
=
{
id
:
this
.
id
,
id
:
this
.
id
,
...
@@ -228,6 +325,8 @@ export default {
...
@@ -228,6 +325,8 @@ export default {
}
}
return
{
return
{
...
params
,
...
params
,
assignedSupervisorPhone
:
this
.
form
.
assignedSupervisorPhone
,
assignedSupervisorName
:
this
.
form
.
assignedSupervisorName
,
teachingSceneCode
:
this
.
form
.
teachingSceneCode
,
teachingSceneCode
:
this
.
form
.
teachingSceneCode
,
teachingSceneName
:
this
.
form
.
teachingSceneName
,
teachingSceneName
:
this
.
form
.
teachingSceneName
,
teachingTime
:
this
.
form
.
teachingTime
,
teachingTime
:
this
.
form
.
teachingTime
,
...
@@ -244,18 +343,21 @@ export default {
...
@@ -244,18 +343,21 @@ export default {
Toast
(
"缺少任务信息"
);
Toast
(
"缺少任务信息"
);
return
;
return
;
}
}
if
(
!
this
.
isApprove
&&
!
this
.
form
.
rejectReason
)
{
const
emptyItem
=
this
.
getFirstEmptyRequired
();
Toast
(
"请输入驳回理由"
);
if
(
emptyItem
)
{
Toast
(
emptyItem
.
message
||
`请填写
${
emptyItem
.
label
}
`
);
return
;
return
;
}
}
this
.
submitting
=
true
;
console
.
log
(
"提交参数"
,
this
.
buildParams
())
;
try
{
api
.
submitApproval
(
this
.
buildParams
()).
then
((
res
)
=>
{
await
api
.
submitApproval
(
this
.
buildParams
()
);
console
.
log
(
"提交结果"
,
res
);
Toast
(
"提交成功"
);
Toast
(
"提交成功"
);
this
.
$router
.
replace
({
name
:
"mine/tasks"
});
// this.$router.replace({ name: "mine/tasks" });
}
finally
{
}).
catch
(()
=>
{
// 处理错误
}).
finally
(()
=>
{
this
.
submitting
=
false
;
this
.
submitting
=
false
;
}
}
);
},
},
},
},
};
};
...
@@ -308,6 +410,11 @@ export default {
...
@@ -308,6 +410,11 @@ export default {
&:last-child
{
&:last-child
{
border-bottom
:
0
;
border-bottom
:
0
;
}
}
em
{
color
:
#ee0a24
;
font-style
:
normal
;
}
}
}
.row-value
{
.row-value
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment