|
...
|
...
|
@@ -33,9 +33,9 @@ |
|
33
|
33
|
</Button>
|
|
34
|
34
|
</Authority>
|
|
35
|
35
|
<Button type="primary" @click="handleOpenTsl"> 物模型TSL </Button>
|
|
36
|
|
- <Button v-if="false && isShowBtn" type="primary" @click="handleImportModel"
|
|
37
|
|
- >导入物模型</Button
|
|
38
|
|
- >
|
|
|
36
|
+ <Upload v-if="isShowBtn" :show-upload-list="false" :customRequest="handleImportModel">
|
|
|
37
|
+ <Button type="primary"> 导入物模型 </Button>
|
|
|
38
|
+ </Upload>
|
|
39
|
39
|
</div>
|
|
40
|
40
|
<div class="flex gap-2">
|
|
41
|
41
|
<Authority :value="ModelOfMatterPermission.RELEASE">
|
|
...
|
...
|
@@ -126,10 +126,15 @@ |
|
126
|
126
|
import { Authority } from '/@/components/Authority';
|
|
127
|
127
|
import PhysicalModelModal from './cpns/physical/PhysicalModelModal.vue';
|
|
128
|
128
|
import PhysicalModelTsl from './cpns/physical/PhysicalModelTsl.vue';
|
|
129
|
|
- import { Popconfirm, Button, Alert } from 'ant-design-vue';
|
|
|
129
|
+ import { Popconfirm, Button, Alert, Upload } from 'ant-design-vue';
|
|
130
|
130
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
131
|
131
|
import { DeviceRecord } from '/@/api/device/model/deviceModel';
|
|
132
|
|
- import { deleteModel, getModelList, releaseModel } from '/@/api/device/modelOfMatter';
|
|
|
132
|
+ import {
|
|
|
133
|
+ deleteModel,
|
|
|
134
|
+ getModelList,
|
|
|
135
|
+ importModelOfMatter,
|
|
|
136
|
+ releaseModel,
|
|
|
137
|
+ } from '/@/api/device/modelOfMatter';
|
|
133
|
138
|
import { OpenModelOfMatterModelParams, OpenModelMode } from './cpns/physical/types';
|
|
134
|
139
|
import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel';
|
|
135
|
140
|
import { ref } from 'vue';
|
|
...
|
...
|
@@ -229,7 +234,17 @@ |
|
229
|
234
|
}
|
|
230
|
235
|
};
|
|
231
|
236
|
|
|
232
|
|
- const handleImportModel = async () => {};
|
|
|
237
|
+ const handleImportModel = async (data: { file: File }) => {
|
|
|
238
|
+ const fileReader = new FileReader();
|
|
|
239
|
+
|
|
|
240
|
+ fileReader.onload = () => {
|
|
|
241
|
+ console.log(fileReader.result);
|
|
|
242
|
+
|
|
|
243
|
+ importModelOfMatter({ tkDeviceProfileId: props.record.id });
|
|
|
244
|
+ };
|
|
|
245
|
+
|
|
|
246
|
+ fileReader.readAsText(data.file, 'utf-8');
|
|
|
247
|
+ };
|
|
233
|
248
|
|
|
234
|
249
|
defineExpose({});
|
|
235
|
250
|
</script>
|
...
|
...
|
|