物模型:调整物模型逻辑
This commit is contained in:
parent
2e6bbf3b9c
commit
59c9618471
@ -19,19 +19,13 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue'
|
||||
const props = defineProps({
|
||||
const props = defineProps<{
|
||||
pos: {
|
||||
type: Object,
|
||||
default: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
visible: boolean
|
||||
}>()
|
||||
|
||||
const emits = defineEmits(['update:visible', 'openModel'])
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="mainHeaderRight">
|
||||
<el-button :icon="Plus" type="primary" @click="addModelAttributeAndService">新增</el-button>
|
||||
<el-upload :show-file-list="false" :limit="1" :http-request="upLoadModel">
|
||||
<el-upload ref="uploadRef" :show-file-list="false" :limit="1" :http-request="upLoadModel" :on-exceed="handleExceed">
|
||||
<template #trigger>
|
||||
<el-button :icon="Upload">导入</el-button>
|
||||
</template>
|
||||
@ -248,6 +248,10 @@ import {
|
||||
UploadRequestOptions,
|
||||
TreeNode,
|
||||
TreeInstance,
|
||||
UploadInstance,
|
||||
genFileId,
|
||||
UploadProps,
|
||||
UploadRawFile,
|
||||
} from 'element-plus'
|
||||
import { Reading, DocumentAdd, DocumentChecked, DocumentDelete, Search, Plus, Download, Upload } from '@element-plus/icons-vue'
|
||||
import {
|
||||
@ -765,7 +769,11 @@ const upLoadModel = (file: UploadRequestOptions) => {
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
ElMessage.success('上传物模型成功')
|
||||
getModelList()
|
||||
if (ModelTabs.value === 'attribute') {
|
||||
getAttributeList()
|
||||
} else {
|
||||
getServiceList()
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
@ -775,6 +783,15 @@ const upLoadModel = (file: UploadRequestOptions) => {
|
||||
})
|
||||
}
|
||||
|
||||
const uploadRef = ref<UploadInstance>()
|
||||
const handleExceed: UploadProps['onExceed'] = (files) => {
|
||||
uploadRef.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
uploadRef.value!.handleStart(file)
|
||||
uploadRef.value!.submit()
|
||||
}
|
||||
|
||||
const downLoadModel = () => {
|
||||
downloadModelReq({ id: curContextMenuTreeData.value!.id! }).then((res: any) => {
|
||||
const downloadUrl = window.URL.createObjectURL(res)
|
||||
|
Loading…
Reference in New Issue
Block a user