| | |
| | | let result = ref(null) |
| | | let props = defineProps({ |
| | | rowIndex:null, |
| | | orderId:null |
| | | orderId:null, |
| | | state:null |
| | | }) |
| | | |
| | | const form = reactive({ |
| | |
| | | const loadSupportedFormats = async () => { |
| | | try { |
| | | if (fileList.value.length === 0) { |
| | | ElMessage.warning('请先选择要上传的DWG文件') |
| | | ElMessage.warning('请先选择要上传的DWG文件或图片文件') |
| | | return |
| | | } |
| | | loadingFormats.value = true |
| | |
| | | } |
| | | }, 500) |
| | | |
| | | |
| | | const data ={ |
| | | file:fileList.value[0].raw |
| | | file:fileList.value[0].raw, |
| | | name:fileList.value[0].raw.name |
| | | } |
| | | request.post(`/orderFile/updateOrderFileByOrderNumber/${props.orderId}/${props.rowIndex.orderNumber}`,data).then(res=>{ |
| | | if (res.code === '200') { |
| | |
| | | } |
| | | } |
| | | |
| | | const fileTypeCheck = (file) => { |
| | | const fileName = file.raw.name.toLowerCase(); |
| | | |
| | | switch (true) { |
| | | case /\.dwg$/.test(fileName): |
| | | case /\.png$/.test(fileName): |
| | | case /\.jpg$/.test(fileName): |
| | | return true; |
| | | default: |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | const handleFileChange = (file) => { |
| | | console.log(file) |
| | | if (!(file.raw.name.toLowerCase().endsWith('.dwg') )) { |
| | | const fileTypeCheckBoole = fileTypeCheck(file) |
| | | if (!(fileTypeCheckBoole )) { |
| | | //ElMessage.error('请选择DWG或DXF格式的文件') |
| | | ElMessage.error('请选择DWG格式的文件') |
| | | ElMessage.error('请选择DWG文件或JPG、PNG格式的图片文件') |
| | | uploadRef.value.clearFiles() |
| | | return |
| | | } |
| | |
| | | <div class="card-header"> |
| | | <span class="header-title"> |
| | | <el-icon><Document /></el-icon> |
| | | DWG文件上传 |
| | | 文件上传 |
| | | </span> |
| | | |
| | | </div> |
| | |
| | | :on-remove="handleFileRemove" |
| | | :file-list="fileList" |
| | | :limit="1" |
| | | :accept="'.dwg' || '.dxf' " |
| | | :disabled="converting" |
| | | > |
| | | <el-icon class="el-icon--upload"><UploadFilled /></el-icon> |
| | | <div class="el-upload__text"> |
| | | 拖拽DWG文件到此处或 <em>点击选择文件</em> |
| | | 拖拽文件到此处或 <em>点击选择文件</em> |
| | | </div> |
| | | <template #tip> |
| | | <div class="el-upload__tip"> |
| | | 仅支持 .dwg 格式文件,且文件大小不超过50MB |
| | | 仅支持 .dwg、.jpg、.png 格式文件,且文件大小不超过50MB |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | |
| | | type="primary" |
| | | :loading="converting" |
| | | @click="loadSupportedFormats" |
| | | :disabled="!form.format" |
| | | :disabled="!form.format || props.state !== 1 || converting" |
| | | > |
| | | <template #icon> |
| | | <el-icon><MagicStick /></el-icon> |
| | |
| | | </el-button> |
| | | |
| | | <el-button @click="handleReset" |
| | | :loading="converting"> |
| | | :loading="converting" |
| | | :disabled="props.state !== 1 || converting"> |
| | | <template #icon> |
| | | <el-icon><RefreshLeft /></el-icon> |
| | | </template> |
| | |
| | | </el-button> |
| | | <el-button |
| | | @click = 'deleteFile' |
| | | :disabled="props.state !== 1" |
| | | ><template #icon> |
| | | <el-icon><Delete /></el-icon> |
| | | </template> |