|
|
@@ -0,0 +1,105 @@
|
|
|
+<template>
|
|
|
+ <Modal
|
|
|
+ width="600px"
|
|
|
+ :title="$t('fuse.localUpload')"
|
|
|
+ :open="visible"
|
|
|
+ @ok="okHandler"
|
|
|
+ :afterClose="afterClose"
|
|
|
+ @cancel="emit('update:visible', false)"
|
|
|
+ :okText="$t('sys.upload.name1')"
|
|
|
+ :cancelText="$t('sys.cancel')"
|
|
|
+ class="model-table"
|
|
|
+ >
|
|
|
+ <ui-input
|
|
|
+ width="200px"
|
|
|
+ style="display: none"
|
|
|
+ class="input"
|
|
|
+ ref="inputRef"
|
|
|
+ :accept="ft"
|
|
|
+ :maxSize="maxSize"
|
|
|
+ @update:modelValue="(file: File) => uploadHandler(file)"
|
|
|
+ type="file"
|
|
|
+ >
|
|
|
+ <template v-slot:replace>
|
|
|
+ <Button type="primary" ghost ref="btn" style="width: 100%">
|
|
|
+ <ui-icon type="add" class="icon" />{{ $t("sys.upload.place1") }}
|
|
|
+ </Button>
|
|
|
+ </template>
|
|
|
+ </ui-input>
|
|
|
+ <div class="bund">
|
|
|
+ <h4>{{ $t("fuse.modelUpload.title0") }}</h4>
|
|
|
+ <p>
|
|
|
+ {{ $t("fuse.modelUpload.desc0") }}
|
|
|
+ </p>
|
|
|
+ <img src="./image1.png" />
|
|
|
+ </div>
|
|
|
+ <div class="bund">
|
|
|
+ <h4>{{ $t("fuse.modelUpload.title1") }}</h4>
|
|
|
+ <p>
|
|
|
+ {{ $t("fuse.modelUpload.desc1") }}
|
|
|
+ </p>
|
|
|
+ <img src="./image2.png" />
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { Modal, Table, Empty, Button } from "ant-design-vue";
|
|
|
+import { getSizeStr } from "@/utils";
|
|
|
+import { addMaterial, Material } from "@/api/material";
|
|
|
+import { computed, ref } from "vue";
|
|
|
+
|
|
|
+const props = defineProps<{
|
|
|
+ uploadFormat?: string[];
|
|
|
+ format?: string[];
|
|
|
+ maxSize?: number;
|
|
|
+ visible: boolean;
|
|
|
+ count?: number;
|
|
|
+ readonly?: boolean;
|
|
|
+ groupIds: number[];
|
|
|
+ useType?: string;
|
|
|
+ afterClose?: () => void;
|
|
|
+}>();
|
|
|
+
|
|
|
+const emit = defineEmits<{
|
|
|
+ (e: "update:visible", v: boolean): void;
|
|
|
+ (e: "selectMaterials", v: Material[]): void;
|
|
|
+}>();
|
|
|
+
|
|
|
+const ft = computed(() => {
|
|
|
+ const ft = props.uploadFormat || props.format;
|
|
|
+ if (!ft) return void 0;
|
|
|
+ return ft.map((t) => `.${t}`).join(",");
|
|
|
+});
|
|
|
+
|
|
|
+const inputRef = ref();
|
|
|
+const okHandler = () => {
|
|
|
+ console.log(inputRef.value.vmRef);
|
|
|
+ inputRef.value.vmRef.input.click();
|
|
|
+};
|
|
|
+
|
|
|
+const uploadHandler = async (file: File) => {
|
|
|
+ const m = await addMaterial(file);
|
|
|
+ emit("selectMaterials", [{ ...m, uploadId: m.id }]);
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.bund {
|
|
|
+ &:not(:first-child) {
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ h4 {
|
|
|
+ margin-bottom: 4px;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|