| | |
| | | let result = ref(null) |
| | | let props = defineProps({ |
| | | rowIndex:null, |
| | | orderId:null |
| | | orderId:null, |
| | | state:null |
| | | }) |
| | | |
| | | const form = reactive({ |
| | |
| | | return value; |
| | | }); |
| | | |
| | | const uint8Array = Uint8Array(bytes); |
| | | const file = File([uint8Array], 'a.dwg', { type:'application/x-dwg' }) |
| | | downloadFile(file); |
| | | const uint8Array = new Uint8Array(bytes); |
| | | const file = new File([uint8Array], `${props.orderId}-${props.rowIndex.orderNumber}.dwg`, { type:'application/x-dwg' }) |
| | | |
| | | const url = URL.createObjectURL(file); |
| | | // 创建下载链接 |
| | | const a = document.createElement('a'); |
| | | a.href = url; |
| | | a.download = file.name; |
| | | a.style.display = 'none'; |
| | | |
| | | // 添加到DOM并触发点击 |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | |
| | | // 清理资源 |
| | | setTimeout(() => { |
| | | document.body.removeChild(a); |
| | | URL.revokeObjectURL(url); |
| | | }, 100); |
| | | } catch (error) { |
| | | console.error('解析Java字节数组字符串时出错:', error); |
| | | throw new Error('无效的Java字节数组格式'); |
| | |
| | | |
| | | |
| | | const handleFileChange = (file) => { |
| | | console.log(file.type) |
| | | if (!(file.raw.name.toLowerCase().endsWith('.dwg') || file.raw.name.toLowerCase().endsWith('.dxf'))) { |
| | | ElMessage.error('请选择DWG或DXF格式的文件') |
| | | console.log(file) |
| | | if (!(file.raw.name.toLowerCase().endsWith('.dwg') )) { |
| | | //ElMessage.error('请选择DWG或DXF格式的文件') |
| | | ElMessage.error('请选择DWG格式的文件') |
| | | uploadRef.value.clearFiles() |
| | | return |
| | | } |
| | |
| | | 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> |