Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
3618fd7f
Commit
3618fd7f
authored
May 09, 2025
by
TerryLan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(智能表单): 出差表单功能完善
parent
092f2b8d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
13 deletions
+55
-13
smart-forms.ts
src/apis/smart-forms.ts
+8
-0
business-trip-form.vue
src/views/home/components/smart-forms/business-trip-form.vue
+42
-11
home.vue
src/views/home/home.vue
+3
-0
smart-forms.ts
src/views/home/utils/smart-forms.ts
+2
-2
No files found.
src/apis/smart-forms.ts
0 → 100644
View file @
3618fd7f
import
{
request
}
from
'@/utils/request'
export
function
fetchBusinessTripFormSubmit
<
T
>
(
payload
:
object
)
{
return
request
.
post
<
T
>
(
'/bizPluginBusinessRest/submitTravelForm.json'
,
{
fromDataDto
:
payload
,
formType
:
'TravelForm'
,
})
}
src/views/home/components/smart-forms/business-trip-form.vue
View file @
3618fd7f
<
script
setup
lang=
"ts"
>
import
{
computed
,
inject
,
readonly
,
ref
,
useTemplateRef
,
watch
}
from
'vue'
import
{
computed
,
inject
,
readonly
,
ref
,
toRaw
,
useTemplateRef
,
watch
,
watchEffect
}
from
'vue'
import
type
{
MessageItemInterface
}
from
'../../types'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
type
{
FormInst
,
FormRules
,
FormItemRule
}
from
'naive-ui'
...
...
@@ -8,7 +8,8 @@ import { useSystemLanguageStore } from '@/store/modules/system-language'
import
MessageBubbleLoading
from
'../message-bubble-loading.vue'
import
isEmail
from
'validator/es/lib/isEmail'
import
type
{
BusinessTripForm
,
ResponseBusinessTripForm
}
from
'./types'
import
{
businessTripFormParser
}
from
'../../utils/smart-forms'
import
{
businessTripFormParser
,
businessTripFormReturner
}
from
'../../utils/smart-forms'
import
{
fetchBusinessTripFormSubmit
}
from
'@/apis/smart-forms'
interface
Props
{
messageItem
:
MessageItemInterface
...
...
@@ -82,6 +83,7 @@ const formModel = ref<BusinessTripForm>({
generalBudget
:
''
,
email
:
''
,
})
const
submitFormBtnLoading
=
ref
(
false
)
const
objectiveOptions
=
readonly
([
{
...
...
@@ -126,17 +128,41 @@ watch(
},
)
watchEffect
(()
=>
{
let
aggregateAmount
=
0
if
(
formModel
.
value
.
vehicleEstimatedCost
)
{
aggregateAmount
+=
formModel
.
value
.
vehicleEstimatedCost
}
if
(
formModel
.
value
.
residenceEstimatedCost
)
{
aggregateAmount
+=
formModel
.
value
.
residenceEstimatedCost
}
if
(
formModel
.
value
.
advancePaymentAmount
)
{
aggregateAmount
+=
formModel
.
value
.
advancePaymentAmount
}
formModel
.
value
.
generalBudget
=
aggregateAmount
.
toString
()
})
function
handleSubmitForm
()
{
businessTripFormRef
.
value
?.
validate
((
errors
)
=>
{
if
(
!
errors
)
{
window
.
$message
.
success
(
'提交'
)
updateSpecifyMessageItem
(
messageItemId
,
{
smartFormInfo
:
{
...(
props
.
messageItem
.
smartFormInfo
||
{
type
:
'BusinessTripForm'
,
params
:
''
}),
isDisabled
:
true
,
},
})
submitFormBtnLoading
.
value
=
true
fetchBusinessTripFormSubmit
(
businessTripFormReturner
(
toRaw
(
formModel
.
value
)))
.
then
((
res
)
=>
{
if
(
res
.
code
!==
0
)
return
''
updateSpecifyMessageItem
(
messageItemId
,
{
smartFormInfo
:
{
...(
props
.
messageItem
.
smartFormInfo
||
{
type
:
'BusinessTripForm'
,
params
:
''
}),
isDisabled
:
true
,
},
})
})
.
finally
(()
=>
{
submitFormBtnLoading
.
value
=
false
})
}
})
}
...
...
@@ -320,7 +346,12 @@ function handleSubmitForm() {
</n-form-item>
<div
class=
"mt-[46px] text-end"
>
<n-button
type=
"primary"
:disabled=
"isDisabledForm"
@
click=
"handleSubmitForm"
>
<n-button
type=
"primary"
:disabled=
"isDisabledForm"
:loading=
"submitFormBtnLoading"
@
click=
"handleSubmitForm"
>
{{ t('smart_forms_module.business_trip_form.confirm_submission') }}
</n-button>
</div>
...
...
src/views/home/home.vue
View file @
3618fd7f
...
...
@@ -244,6 +244,8 @@ function onGetMessageRecordList(recordId: string) {
function
onClearSessionReferenceFile
()
{
footerOperationRef
.
value
&&
footerOperationRef
.
value
.
clearSessionReferenceFile
()
}
function
onSmartFormsStatusFreeze
()
{}
</
script
>
<
template
>
...
...
@@ -281,6 +283,7 @@ function onClearSessionReferenceFile() {
@
delete-message-item=
"onDeleteMessageItem"
@
create-new-session=
"onCreateNewSession"
@
history-record-list-update=
"onHistoryRecordListUpdate"
@
smart-forms-status-freeze=
"onSmartFormsStatusFreeze"
/>
</div>
...
...
src/views/home/utils/smart-forms.ts
View file @
3618fd7f
...
...
@@ -28,8 +28,8 @@ export function businessTripFormReturner(form: BusinessTripForm) {
return
{
purpose
:
form
.
objective
,
place
:
form
.
travelLocation
,
departureDate
:
form
.
departureTime
,
returnDate
:
form
.
returnTime
,
departureDate
:
form
.
departureTime
?
new
Date
(
form
.
departureTime
).
toISOString
()
:
''
,
returnDate
:
form
.
returnTime
?
new
Date
(
form
.
returnTime
).
toISOString
()
:
''
,
vehicle
:
form
.
vehicle
,
transportationFee
:
form
.
vehicleEstimatedCost
,
accommodation
:
form
.
residence
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment