feat:任务单-新增/编辑-添加附件上传

main
黄伟杰 4 days ago
parent f1f6de879a
commit 2b235d1182

@ -13,6 +13,7 @@ export interface TaskVO {
status: number // 状态
processInstanceId: string // 流程实例的编号
remark: string // 备注
fileUrl?: string // 附件 URL
isEnable: boolean // 是否启用
}
// 物料 VO

@ -4433,8 +4433,10 @@ export default {
urgentYesLabel: 'Yes',
dialogRemarkLabel: 'Remark',
dialogRemarkPlaceholder: 'Please enter remark',
dialogFileUrlLabel: 'Attachment',
dialogSubmitButtonText: 'Confirm',
dialogCancelButtonText: 'Cancel',
fileUploadingTip: 'Attachment is uploading. Please submit later.',
validatorTaskNameRequired: 'Task name cannot be empty',
validatorCustomerRequired: 'Customer cannot be empty',

@ -4286,8 +4286,10 @@ export default {
urgentYesLabel: '是',
dialogRemarkLabel: '备注',
dialogRemarkPlaceholder: '请输入备注',
dialogFileUrlLabel: '附件',
dialogSubmitButtonText: '确 定',
dialogCancelButtonText: '取 消',
fileUploadingTip: '附件上传中,请稍后提交',
validatorTaskNameRequired: '任务单名称不能为空',
validatorCustomerRequired: '客户不能为空',

@ -5,7 +5,7 @@
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
v-loading="formLoading || fileUploading"
>
<el-form-item prop="code">
@ -95,9 +95,18 @@
type="textarea"
/>
</el-form-item>
<el-form-item :label="t('ProductionPlan.Task.dialogFileUrlLabel')" prop="fileUrl">
<UploadFile
:is-show-tip="false"
v-model="formData.fileUrl"
:limit="1"
@uploading-change="handleFileUploadingChange"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading">
<el-button @click="submitForm" type="primary" :disabled="formLoading || fileUploading">
{{ t('ProductionPlan.Task.dialogSubmitButtonText') }}
</el-button>
<el-button @click="dialogVisible = false">
@ -230,6 +239,7 @@ type TaskFormData = {
isUrgent?: string
processInstanceId?: string
remark?: string
fileUrl?: string
isEnable?: boolean
isCode?: boolean
}
@ -238,6 +248,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const fileUploading = ref(false)
const formData = ref<TaskFormData>({
id: undefined,
taskName: undefined,
@ -251,6 +262,7 @@ const formData = ref<TaskFormData>({
isUrgent: undefined,
processInstanceId: undefined,
remark: undefined,
fileUrl: undefined,
isEnable: undefined,
isCode: undefined
})
@ -366,6 +378,10 @@ const clearCustomer = () => {
formRef.value?.clearValidate('customerId')
}
const handleFileUploadingChange = (uploading: boolean) => {
fileUploading.value = uploading
}
const hydrateCustomerName = async () => {
const customerId = formData.value.customerId
if (!customerId || formData.value.customerName) return
@ -403,6 +419,10 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
if (fileUploading.value) {
message.warning(t('ProductionPlan.Task.fileUploadingTip'))
return
}
//
await formRef.value.validate()
//
@ -440,10 +460,12 @@ const resetForm = () => {
status: undefined,
processInstanceId: undefined,
remark: undefined,
fileUrl: undefined,
isEnable: true,
isCode: true
}
formRef.value?.resetFields()
fileUploading.value = false
}
</script>

Loading…
Cancel
Save