| | |
| | | "@microsoft/fetch-event-source": "^2.0.1", |
| | | "@vue-office/docx": "^1.6.2", |
| | | "@vue-office/excel": "^1.7.11", |
| | | "@vue-office/pdf": "^2.0.2", |
| | | "@vueuse/core": "^9.3.0", |
| | | "arco-design-pro-vue": "^2.7.3", |
| | | "axios": "^0.24.0", |
File was renamed from src/views/dmx/knowledgeLib/components/txtPdf.vue |
| | |
| | | <template> |
| | | <iframe :src="previewSrc"></iframe> |
| | | <vue-office-pdf :src="previewSrc" :style="comStyle" @rendered="renderedHandler" @error="errorHandler"></vue-office-pdf> |
| | | </template> |
| | | |
| | | <script setup> |
| | |
| | | }, |
| | | }); |
| | | //引入VueOfficeExcel组件相关 |
| | | import VueOfficeExcel from '@vue-office/excel'; |
| | | import VueOfficePdf from '@vue-office/pdf'; |
| | | import '@vue-office/excel/lib/index.css'; |
| | | |
| | | const comStyle = { |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <pre v-html="content"></pre> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watch } from "vue"; |
| | | |
| | | let content = ref(""); |
| | | // 获取父组件传递的资源url |
| | | const props = defineProps({ |
| | | previewSrc: { |
| | | type: String, |
| | | required: false, |
| | | default: () => "" |
| | | } |
| | | }); |
| | | |
| | | const getContent = (url) => { |
| | | fetch(url) |
| | | .then((res) => res.text()) |
| | | .then((data) => { |
| | | content.value = data; |
| | | }); |
| | | }; |
| | | getContent(props.previewSrc); |
| | | |
| | | //引入VueOfficeExcel组件相关 |
| | | import "@vue-office/excel/lib/index.css"; |
| | | |
| | | const comStyle = { |
| | | width: "100%", |
| | | height: "100%" |
| | | }; |
| | | |
| | | const renderedHandler = () => { |
| | | console.log("rendered"); |
| | | }; |
| | | const errorHandler = (err) => { |
| | | console.log("error", err); |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | .aUpload { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | } |
| | | </style> |
| | |
| | | pagination.current = params.page; |
| | | pagination.total = data.data.total; |
| | | |
| | | if (timer) { |
| | | clearInterval(timer); |
| | | } |
| | | // 定时器查询文档 |
| | | timer = setInterval(async () => { |
| | | let params = { ...basePagination, kb_id: kbobj.id }; |
| | | const data = await queryKbDocumentList(params); |
| | | if (data.code == '0') { |
| | | parser_ids = kbtenantInfo.parser_ids |
| | | .split(',') |
| | | .reduce((acc, pair) => { |
| | | const [key, value] = pair.split(':'); |
| | | acc[key] = value; |
| | | return acc; |
| | | }, {}); |
| | | // console.log(parser_ids, 'parser_ids'); |
| | | kbtenantInfo.parser_idObj = parser_ids; |
| | | renderData.value = data.data.docs || []; |
| | | renderData.value = renderData.value.map((item) => { |
| | | return { |
| | | ...item, |
| | | loading: false, |
| | | parser_id: parser_ids[item.parser_id], |
| | | }; |
| | | }); |
| | | // console.log(renderData.value, 'renderData'); |
| | | } |
| | | }, 10000); |
| | | documentList() |
| | | } |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | |
| | | } |
| | | }; |
| | | |
| | | const documentList= async () => { |
| | | let params = { ...basePagination, kb_id: kbobj.id }; |
| | | const data = await queryKbDocumentList(params); |
| | | if (data.code == '0') { |
| | | parser_ids = kbtenantInfo.parser_ids |
| | | .split(',') |
| | | .reduce((acc, pair) => { |
| | | const [key, value] = pair.split(':'); |
| | | acc[key] = value; |
| | | return acc; |
| | | }, {}); |
| | | // console.log(parser_ids, 'parser_ids'); |
| | | kbtenantInfo.parser_idObj = parser_ids; |
| | | renderData.value = data.data.docs || []; |
| | | renderData.value = renderData.value.map((item) => { |
| | | return { |
| | | ...item, |
| | | loading: false, |
| | | parser_id: parser_ids[item.parser_id], |
| | | }; |
| | | }); |
| | | // console.log(renderData.value, 'renderData'); |
| | | } |
| | | } |
| | | |
| | | const search = () => { |
| | | basePagination.page = 1; |
| | | fetchData({ |
| | |
| | | <!-- <docx previewSrc="http://192.168.20.116:1080/v1/document/get/405c3efa4d8c11ef97560242ac120006"></docx>--> |
| | | <docx v-if="documenttype == 'docx'" :previewSrc="previewSrc"></docx> |
| | | <excel v-if="documenttype == 'excel'" :previewSrc="previewSrc"></excel> |
| | | <txtPdf v-if="documenttype == 'txtPdf'" :previewSrc="previewSrc"></txtPdf> |
| | | <Pdf v-if="documenttype == 'pdf'" :previewSrc="previewSrc"></Pdf> |
| | | <txt v-if="documenttype == 'txt'" :previewSrc="previewSrc"></txt> |
| | | </a-modal> |
| | | <a-modal |
| | | v-model:visible="visible" |
| | |
| | | |
| | | import docx from '@/views/dmx/knowledgeLib/components/docx.vue'; |
| | | import excel from '@/views/dmx/knowledgeLib/components/excel.vue'; |
| | | import txtPdf from '@/views/dmx/knowledgeLib/components/txtPdf.vue'; |
| | | import Pdf from '@/views/dmx/knowledgeLib/components/Pdf.vue'; |
| | | import txt from '@/views/dmx/knowledgeLib/components/txt.vue'; |
| | | import { is } from 'immutable'; |
| | | import uploadFile from './components/uploadFile.vue'; |
| | | |
| | |
| | | resolved "https://registry.npmmirror.com/@vue-office/excel/-/excel-1.7.11.tgz" |
| | | integrity sha512-LF3R9IV573Sf4qTu6Ik5Ee8UMfkrsZQ6HEQE25/2m1c0CMcHX6KanIy6Cz0b0Q+FrLH3TjIsLTm6oPcqAbDGSA== |
| | | |
| | | "@vue-office/pdf@^2.0.2": |
| | | version "2.0.2" |
| | | resolved "https://registry.npmmirror.com/@vue-office/pdf/-/pdf-2.0.2.tgz#475010e4279c6dfb368e3dc7df81f56b597bd080" |
| | | integrity sha512-bQFqGxSOnKbvCS7OoJniYoTz1VIm1XOrRD27Msorxny9NFJ8RsQK1A4uhlnISJRFMaUwp1qlcVE9jMAhsiIyjg== |
| | | |
| | | "@vue/babel-helper-vue-transform-on@1.2.2": |
| | | version "1.2.2" |
| | | resolved "https://registry.npmmirror.com/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.2.2.tgz" |