From d4a3ca549f8755c2f87442c27217c3be39cab5cc Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期三, 14 八月 2024 16:00:10 +0800 Subject: [PATCH] 设备维修 --- src/views/dataManager/semanticFunction/child/agentInsertFile.vue | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 61 insertions(+), 6 deletions(-) diff --git a/src/views/dataManager/semanticFunction/child/agentInsertFile.vue b/src/views/dataManager/semanticFunction/child/agentInsertFile.vue index 32e2189..87bf7f1 100644 --- a/src/views/dataManager/semanticFunction/child/agentInsertFile.vue +++ b/src/views/dataManager/semanticFunction/child/agentInsertFile.vue @@ -1,27 +1,36 @@ <template> <div :id="msgId" class="textBox"> - + <div v-loading="loading" element-loading-text="鏁版嵁涓婁紶涓�..." element-loading-spinner="el-icon-loading" + element-loading-background="rgba(0, 0, 0, 0.6)" class="fileBox" v-for="(item, index) in filieOption" + :key="index"> + <span>{{ item.name }}</span><span class="upMsg"> + {{ upMsg }} + </span> + </div> </div> </template> <script> +import { rag_chat, rag_search, rag_upload } from "@/api/mapView/rag.js"; export default { data() { return { msgId: null, - msgText: '', + filieOption: [], + loading: false, + upMsg: "", } }, props: { childObject: { - type: Array, + type: Object, + required: true } }, watch: { childObject: { handler(newVal, oldVal) { if (newVal) { - console.log(newVal); this.setTextMsg(newVal) } }, @@ -31,11 +40,57 @@ }, methods: { setTextMsg(res) { + if (!res.msg) return this.id = res.id - console.log("insertFile", msg); + this.filieOption = res.msg; + this.$nextTick(() => { + this.loading = true; + this.setInsertFile() + }) + }, + setInsertFile() { + const fs = document.getElementById("insertFile") + if (fs.files.length <= 0) return; + const formData = new FormData(); + for (var i = 0, c = fs.files.length; i < c; i++) { + formData.append("file", fs.files[i]); // fs.files[i].name,file + } + rag_upload(formData).then(response => { + this.loading = false + document.getElementById('insertFile').value = "" + if (response.data == 'success') { + this.upMsg = "涓婁紶鎴愬姛" + } else { + this.upMsg = "涓婁紶澶辫触" + } + + }) } } } </script> -<style></style> \ No newline at end of file +<style lang="scss" scoped> +.textBox { + padding-top: 10px; +} + +.fileBox { + background: white; + padding: 10px; + margin-bottom: 10px; + min-width: 300px; + min-height: 70px; + display: flex; + align-items: center; + border-radius: 5px; + justify-content: space-between; + .upMsg { + font-size: 12px; + color: #1890ff; + } + + + +} +</style> -- Gitblit v1.9.3