|
|
|
|
@ -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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
|