| | |
| | | </el-row> |
| | | |
| | | <el-form-item label="附件" prop="attachmentIds"> |
| | | <el-upload |
| | | v-model:file-list="fileList" |
| | | :action="upload.url" |
| | | :headers="upload.headers" |
| | | multiple |
| | | name="files" |
| | | :on-success="handleUploadSuccess" |
| | | :on-error="handleUploadError" |
| | | :on-remove="handleRemove" |
| | | > |
| | | <el-button type="primary">上传文件</el-button> |
| | | </el-upload> |
| | | <FileUpload v-model:file-list="form.storageBlobDTOs" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="visible = false">取消</el-button> |
| | | <el-button type="primary" @click="submit">确定</el-button> |
| | | <el-button @click="visible = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | import { computed, reactive, ref, watch } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { getToken } from '@/utils/auth' |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { type: Boolean, default: false }, |
| | |
| | | }) |
| | | |
| | | const formRef = ref() |
| | | const fileList = ref([]) |
| | | const upload = reactive({ |
| | | url: import.meta.env.VITE_APP_BASE_API + '/basic/customer-follow/upload', |
| | | headers: { Authorization: 'Bearer ' + getToken() } |
| | | }) |
| | | |
| | | const form = ref({ |
| | | planNodeId: undefined, |
| | |
| | | managerName: '', |
| | | departmentName: '', |
| | | remark: '', |
| | | attachmentIds: [] |
| | | storageBlobDTOs: [] |
| | | }) |
| | | |
| | | const rules = { |
| | |
| | | managerName: info.managerName || '', |
| | | departmentName: info.departmentName || '', |
| | | remark: '', |
| | | attachmentIds: [] |
| | | storageBlobDTOs: [] |
| | | } |
| | | fileList.value = [] |
| | | } |
| | | |
| | | watch( |
| | |
| | | form.value.completionProgress = 100 |
| | | form.value.totalProgress = 100 |
| | | if (!form.value.actualEndTime) form.value.actualEndTime = form.value.reportDate || '' |
| | | } |
| | | |
| | | function handleUploadError() { |
| | | ElMessage.error('上传文件失败') |
| | | } |
| | | |
| | | function handleUploadSuccess(res, file) { |
| | | if (res?.code !== 200) { |
| | | ElMessage.error(res?.msg || '上传失败') |
| | | return |
| | | } |
| | | const attachmentId = res?.data?.id ?? res?.data?.tempId ?? '' |
| | | if (!attachmentId) return |
| | | form.value.attachmentIds.push(attachmentId) |
| | | try { |
| | | file.attachmentId = attachmentId |
| | | } catch (e) {} |
| | | ElMessage.success('上传成功') |
| | | } |
| | | |
| | | function handleRemove(file) { |
| | | const attachmentId = file?.attachmentId |
| | | if (!attachmentId) return |
| | | form.value.attachmentIds = (form.value.attachmentIds || []).filter(id => id !== attachmentId) |
| | | } |
| | | |
| | | async function submit() { |