Rmengdi 4 сар өмнө
parent
commit
c08e10ad09

+ 1 - 1
src/api/als/dataImport.js

@@ -30,7 +30,7 @@ export const getAircaftTypeAndModelTree = async (data) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.downloadPost('/als/dataImport/importTemplate', {})
+  return http.postFile('/als/dataImport/importTemplate', {})
 }
 
 /**

+ 2 - 2
src/views/als/flightData/index.vue

@@ -92,7 +92,7 @@
 </template>
 
 <script>
-import { getDataImport, addDataImport, updateDataImport, removeDataImport } from '@/api/als/dataImport'
+import { getDataImport, addDataImport, updateDataImport, removeDataImport, importTemplateApi } from '@/api/als/dataImport'
 import { getAircaftCatalogTree } from '@/api/als/sideTree'
 import { getAircaftCatalogAll } from '@/api/als/aircraft'
 import { deepClone, debounce } from '@/utils/index'
@@ -462,7 +462,7 @@ export default {
     },
     /** 下载模板操作 */
     importTemplate() {
-      download('/warning/importTemplate', {}, `warning_template_${new Date().getTime()}.xlsx`)
+      useDownload(importTemplateApi, 'warning_template', {}, '.xlsx')
     },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {

+ 38 - 33
src/views/als/intelligentQA/index.vue

@@ -58,7 +58,8 @@
         <div class="contentRight">
           <div>
             <div class="source">
-              <el-link :href="`${fileInfo.url}`" style="color: #209cc1" :underline="false" target="_blank">
+              <!-- <el-link :href="`${fileInfo.url}`" style="color: #209cc1" :underline="false" target="_blank"> -->
+              <el-link @click="downloadFile(fileInfo.url)" style="color: #209cc1" :underline="false" target="_blank">
                 <el-tooltip class="item" effect="dark" content="点击可下载" placement="top">
                   <span> 来源:《{{ moreData.file_name }}{{ moreData.fileName }}》</span>
                 </el-tooltip>
@@ -94,6 +95,7 @@ import { getListByIdsApi } from '@/api/als/oss'
 import VueOfficeDocx from '@vue-office/docx'
 import VueOfficePdf from '@vue-office/pdf'
 import '@vue-office/docx/lib/index.css'
+import { localResource } from '../utils/common'
 
 export default {
   name: 'IntelligentQA',
@@ -193,38 +195,37 @@ export default {
           answer: '正在解析您的问题,请稍后......'
         })
         this.questionInput = ''
-        const { code, data } = await handlerAsk(sendInput)
-        // const { code, data } = {
-        //   code: 200,
-        //   msg: '',
-        //   data: {
-        //     user_id: 'user',
-        //     answer: '解决办法为:更换电池或遥控器',
-        //     file_name: '排故手册',
-        //     // ossID: '225825878820585472',//pdf
-        //     ossID: '225840762526433280', //word
-        //     graph: {
-        //       data: [
-        //         { name: '202310150010', category: 'HMC' },
-        //         { name: '电视', category: '成品' },
-        //         { name: '电视遥控器失灵', category: '故障描述' },
-        //         { name: '家用电器', category: '系统' },
-        //         { name: '更换电池或遥控器', category: '维修策略' }
-        //       ],
-        //       links: [
-        //         { source: '202310150010', target: '电视', value: '成品' },
-        //         { source: '202310150010', target: '电视遥控器失灵', value: '故障描述' },
-        //         { source: '202310150010', target: '家用电器', value: '系统' },
-        //         { source: '202310150010', target: '更换电池或遥控器', value: '维修策略' }
-        //       ]
-        //     }
-        //   }
-        // }
+        // const { code, data } = await handlerAsk(sendInput)
+        const { code, data } = {
+          code: 200,
+          msg: '',
+          data: {
+            user_id: 'user',
+            answer: '解决办法为:更换电池或遥控器',
+            file_name: '排故手册',
+            ossID: '227701077942149120', //pdf
+            // ossID: '227692224508796928', //word
+            graph: {
+              data: [
+                { name: '202310150010', category: 'HMC' },
+                { name: '电视', category: '成品' },
+                { name: '电视遥控器失灵', category: '故障描述' },
+                { name: '家用电器', category: '系统' },
+                { name: '更换电池或遥控器', category: '维修策略' }
+              ],
+              links: [
+                { source: '202310150010', target: '电视', value: '成品' },
+                { source: '202310150010', target: '电视遥控器失灵', value: '故障描述' },
+                { source: '202310150010', target: '家用电器', value: '系统' },
+                { source: '202310150010', target: '更换电池或遥控器', value: '维修策略' }
+              ]
+            }
+          }
+        }
 
         if (code == 200) {
-          console.log(1111)
-          const newData = this.handleData(JSON.parse(data))
-          // const newData = this.handleData(data)
+          // const newData = this.handleData(JSON.parse(data))
+          const newData = this.handleData(data)
           this.chatInfo.pop()
           this.chatInfo.push(newData)
           // this.getHistoryAll()
@@ -239,8 +240,8 @@ export default {
 
     handleData(data) {
       if (data.graph) {
-        const graphData = eval('(' + data.graph + ')')
-        data.graph = graphData
+        // const graphData = eval('(' + data.graph + ')')
+        // data.graph = graphData
         const categories = []
         data.graph.data.forEach((node) => {
           const flag = categories.find((item) => {
@@ -281,6 +282,10 @@ export default {
       } catch (error) {}
     },
 
+    downloadFile(url) {
+      localResource(url)
+    },
+
     deleteHistory(id) {
       this.$confirm('是否删除该条记录?', '提示', {
         confirmButtonText: '确定',