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 432e2f71
authored
Jun 04, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 优化审批提交页面的表单项处理逻辑,添加通用选择器功能
1 parent
f2093d69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
42 deletions
src/views/mine/view/approvalSubmit.vue
src/views/mine/view/approvalSubmit.vue
View file @
432e2f7
...
@@ -131,6 +131,41 @@ const REJECT_FORM_CONFIG = [
...
@@ -131,6 +131,41 @@ const REJECT_FORM_CONFIG = [
},
},
];
];
const
PICKER_FIELD_MAP
=
{
supervisor
:
[
[
"assignedSupervisorPhone"
,
"phone"
],
[
"assignedSupervisorName"
,
"name"
],
[
"assignedSupervisorUuid"
,
"uuid"
],
],
scene
:
[
[
"teachingSceneCode"
,
"code"
],
[
"teachingSceneName"
,
"name"
],
[
"teachingMethodCode"
],
[
"teachingMethodName"
],
],
method
:
[
[
"teachingMethodCode"
,
"code"
],
[
"teachingMethodName"
,
"name"
],
],
topic
:
[
[
"teachingTopicCode"
,
"code"
],
[
"teachingTopicName"
,
"name"
],
],
};
const
APPROVE_SUBMIT_KEYS
=
[
"assignedSupervisorPhone"
,
"assignedSupervisorName"
,
"assignedSupervisorUuid"
,
"teachingSceneCode"
,
"teachingSceneName"
,
"teachingTime"
,
"teachingMethodCode"
,
"teachingMethodName"
,
"teachingTopicCode"
,
"teachingTopicName"
,
];
export
default
{
export
default
{
name
:
"MineApprovalSubmit"
,
name
:
"MineApprovalSubmit"
,
data
()
{
data
()
{
...
@@ -156,6 +191,7 @@ export default {
...
@@ -156,6 +191,7 @@ export default {
form
:
{
form
:
{
assignedSupervisorPhone
:
""
,
assignedSupervisorPhone
:
""
,
assignedSupervisorName
:
""
,
assignedSupervisorName
:
""
,
assignedSupervisorUuid
:
""
,
teachingSceneCode
:
""
,
teachingSceneCode
:
""
,
teachingSceneName
:
""
,
teachingSceneName
:
""
,
teachingTime
:
""
,
teachingTime
:
""
,
...
@@ -243,8 +279,9 @@ export default {
...
@@ -243,8 +279,9 @@ export default {
normalizeSupervisorItem
(
item
)
{
normalizeSupervisorItem
(
item
)
{
return
{
return
{
...
item
,
...
item
,
phone
:
item
.
assignedSupervisorPhone
||
item
.
supervisorPhone
||
item
.
phone
||
item
.
mobile
||
""
,
phone
:
item
.
phone
||
""
,
name
:
item
.
assignedSupervisorName
||
item
.
supervisorName
||
item
.
name
||
item
.
staffName
||
""
,
name
:
item
.
name
||
""
,
uuid
:
item
.
uuid
||
""
,
};
};
},
},
handleFormItemClick
(
item
)
{
handleFormItemClick
(
item
)
{
...
@@ -268,37 +305,17 @@ export default {
...
@@ -268,37 +305,17 @@ export default {
this
.
picker
.
show
=
false
;
this
.
picker
.
show
=
false
;
return
;
return
;
}
}
const
handlers
=
{
this
.
applyPickerValue
(
item
);
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
;
this
.
picker
.
show
=
false
;
},
},
applySupervisor
(
item
)
{
applyPickerValue
(
item
)
{
this
.
form
.
assignedSupervisorPhone
=
item
.
phone
;
const
fields
=
PICKER_FIELD_MAP
[
this
.
picker
.
key
]
||
[];
this
.
form
.
assignedSupervisorName
=
item
.
name
;
fields
.
forEach
(([
formKey
,
itemKey
])
=>
{
},
this
.
form
[
formKey
]
=
itemKey
?
item
[
itemKey
]
||
""
:
""
;
applyScene
(
item
)
{
});
this
.
form
.
teachingSceneCode
=
item
.
code
;
this
.
form
.
teachingSceneName
=
item
.
name
;
this
.
form
.
teachingMethodCode
=
""
;
this
.
form
.
teachingMethodName
=
""
;
},
applyMethod
(
item
)
{
this
.
form
.
teachingMethodCode
=
item
.
code
;
this
.
form
.
teachingMethodName
=
item
.
name
;
},
applyTopic
(
item
)
{
this
.
form
.
teachingTopicCode
=
item
.
code
;
this
.
form
.
teachingTopicName
=
item
.
name
;
},
},
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"
);
this
.
showTimePicker
=
false
;
this
.
showTimePicker
=
false
;
},
},
getFormValue
(
item
)
{
getFormValue
(
item
)
{
...
@@ -313,6 +330,17 @@ export default {
...
@@ -313,6 +330,17 @@ export default {
getFirstEmptyRequired
()
{
getFirstEmptyRequired
()
{
return
this
.
currentFormItems
.
find
(
item
=>
item
.
required
&&
!
this
.
form
[
item
.
requiredKey
||
item
.
valueKey
]);
return
this
.
currentFormItems
.
find
(
item
=>
item
.
required
&&
!
this
.
form
[
item
.
requiredKey
||
item
.
valueKey
]);
},
},
isSubmitSuccess
(
res
)
{
console
.
log
(
"submit res"
,
res
);
if
(
!
res
)
return
false
;
if
(
res
.
code
===
undefined
)
return
true
;
return
Number
(
res
.
code
)
===
0
||
Number
(
res
.
code
)
===
200
;
},
getSubmitErrorMessage
(
res
)
{
return
res
?.
message
||
res
?.
msg
||
res
?.
errorMsg
||
"提交失败"
;
},
buildParams
()
{
buildParams
()
{
const
params
=
{
const
params
=
{
id
:
this
.
id
,
id
:
this
.
id
,
...
@@ -325,17 +353,15 @@ export default {
...
@@ -325,17 +353,15 @@ export default {
}
}
return
{
return
{
...
params
,
...
params
,
assignedSupervisorPhone
:
this
.
form
.
assignedSupervisorPhone
,
...
this
.
pickFormValues
(
APPROVE_SUBMIT_KEYS
),
assignedSupervisorName
:
this
.
form
.
assignedSupervisorName
,
teachingSceneCode
:
this
.
form
.
teachingSceneCode
,
teachingSceneName
:
this
.
form
.
teachingSceneName
,
teachingTime
:
this
.
form
.
teachingTime
,
teachingMethodCode
:
this
.
form
.
teachingMethodCode
,
teachingMethodName
:
this
.
form
.
teachingMethodName
,
teachingTopicCode
:
this
.
form
.
teachingTopicCode
,
teachingTopicName
:
this
.
form
.
teachingTopicName
,
};
};
},
},
pickFormValues
(
keys
)
{
return
keys
.
reduce
((
values
,
key
)
=>
{
values
[
key
]
=
this
.
form
[
key
];
return
values
;
},
{});
},
async
submit
()
{
async
submit
()
{
if
(
this
.
submitting
)
if
(
this
.
submitting
)
return
;
return
;
...
@@ -348,13 +374,16 @@ export default {
...
@@ -348,13 +374,16 @@ export default {
Toast
(
emptyItem
.
message
||
`请填写
${
emptyItem
.
label
}
`
);
Toast
(
emptyItem
.
message
||
`请填写
${
emptyItem
.
label
}
`
);
return
;
return
;
}
}
console
.
log
(
"提交参数"
,
this
.
buildParams
())
;
this
.
submitting
=
true
;
api
.
submitApproval
(
this
.
buildParams
()).
then
((
res
)
=>
{
api
.
submitApproval
(
this
.
buildParams
()).
then
((
res
)
=>
{
console
.
log
(
"提交结果"
,
res
);
if
(
!
res
)
{
Toast
(
this
.
getSubmitErrorMessage
(
res
));
return
;
}
Toast
(
"提交成功"
);
Toast
(
"提交成功"
);
//
this.$router.replace({ name: "mine/tasks" });
this
.
$router
.
replace
({
name
:
"mine/tasks"
});
}).
catch
(()
=>
{
}).
catch
(()
=>
{
// 处理错误
Toast
(
"提交失败"
);
}).
finally
(()
=>
{
}).
finally
(()
=>
{
this
.
submitting
=
false
;
this
.
submitting
=
false
;
});
});
...
...
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