This commit is contained in:
2025-07-17 18:05:15 +08:00
parent 3f4fa2dd0e
commit fcc7c7dc68
2 changed files with 17 additions and 6 deletions

View File

@ -71,7 +71,8 @@
<script setup>
import * as ocr from "@paddlejs-models/ocr";
import { drawBox } from "@/utils/ocrUtils";
import { nextTick, onMounted,reactive, ref,getCurrentInstance } from "vue";
import { nextTick, onMounted,reactive, ref,getCurrentInstance, watch } from "vue";
import { init } from "echarts";
const props = defineProps({
modelValue: {
type: Boolean,
@ -96,8 +97,13 @@ const textStyle = reactive({
})
const hasLoadingJS = ref(false)
onMounted(() => {
initPage();
watch(()=>props.modelValue,val=>{
if(val) initDemo();
},{immediate:true,deep:true})
const initDemo = () =>{
if(!hasLoadingJS.value) initPage();
nextTick(() => {
const fileInput = document.getElementById("file-input");
const fileInfo = document.getElementById("file-info");
@ -157,7 +163,7 @@ onMounted(() => {
}
});
});
});
}
// 读取文本文件
function readTextFile(file) {
@ -280,7 +286,6 @@ const changeRadio = (val) =>{
image.value = ''
}
const onComfirm = () => {
if(active == '文件解析'){
const resultDiv = document.getElementById("result");
let obj = {
@ -298,6 +303,12 @@ const handleClose = () => {
resultDiv.textContent = "请先上传文件";
const fileInfo = document.getElementById("file-info");
fileInfo.textContent = "未选择文件";
fileInfo.textContent = "选择文件";
files.value = {}
alertText.value = '请先上传文件...';
texts.value = []
image.value = ''
active.value = '文件解析'
emits("update:modelValue", false);
};

View File

@ -96,7 +96,7 @@
<Model v-model="isShow" :type="chooselx" :ids="ids" @change="getModelList" :dic="{ D_GS_RQFJ_FXDJ }"></Model>
<Export :show="isImport" lx="fjnr" @closeImport="isImport = false" @handleImport="getList" />
<!-- 文字解析 -->
<ExtractionText v-if="showText" v-model="showText" @change="getText"></ExtractionText>
<ExtractionText v-model="showText" @change="getText"></ExtractionText>
</div>
</template>