From 6b5f0408ab95f5ea135f97924c6e414042cd2a88 Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期四, 05 九月 2024 11:27:41 +0800
Subject: [PATCH] 单文档
---
src/views/sessionManager/components/updataFile.vue | 99 ++++++++++++++++++++++++++++---------------------
1 files changed, 57 insertions(+), 42 deletions(-)
diff --git a/src/views/sessionManager/components/updataFile.vue b/src/views/sessionManager/components/updataFile.vue
index a9c1827..11ac03a 100644
--- a/src/views/sessionManager/components/updataFile.vue
+++ b/src/views/sessionManager/components/updataFile.vue
@@ -26,49 +26,47 @@
style="
width: 100%;
margin-top: 10px;
- display: flex;
justify-content: space-between;
+ text-align: right;
"
class="upload-wrap"
>
- <div>
- <span>瑙f瀽鏂规硶: </span>
- <a-radio-group
- v-model="parser_id"
- style="width: 400px"
- @change="parserChange"
- >
- <a-popover v-for="item in filterData" :key="item.value">
- <a-radio :value="item.value" style="margin-right: 10px">{{
- item.name
- }}</a-radio>
- <!-- <template #content>
- <p style="max-width: 300px">{{ item.parser_config_str }}</p>
- </template> -->
- <template #content>
- <p>{{ item.parser_config_str }}</p>
- </template>
- </a-popover>
- </a-radio-group>
- </div>
- <a-select
- :style="{ width: '100px', margin: '0 10px' }"
- :default-value="['閫氱敤', '澶氭ā鎬�']"
- v-model="parser_configs"
- multiple
- size="small"
- >
- <a-option v-for="item in parser_ids" :key="item.value">{{
- item.name
- }}</a-option>
- </a-select>
- <p class="config-text">鏇村閰嶇疆</p>
+<!-- <div>-->
+<!-- <span>瑙f瀽鏂规硶: </span>-->
+<!-- <a-radio-group-->
+<!-- v-model="parser_id"-->
+<!-- style="width: 400px"-->
+<!-- @change="parserChange"-->
+<!-- >-->
+<!-- <a-popover v-for="item in filterData" :key="item.value">-->
+<!-- <a-radio :value="item.value" style="margin-right: 10px">{{-->
+<!-- item.name-->
+<!-- }}</a-radio>-->
+
+<!-- <template #content>-->
+<!-- <p>{{ item.parser_config_str }}</p>-->
+<!-- </template>-->
+<!-- </a-popover>-->
+<!-- </a-radio-group>-->
+<!-- </div>-->
+<!-- <a-select-->
+<!-- :style="{ width: '100px', margin: '0 10px' }"-->
+<!-- :default-value="['閫氱敤', '澶氭ā鎬�']"-->
+<!-- v-model="parser_configs"-->
+<!-- multiple-->
+<!-- size="small"-->
+<!-- >-->
+<!-- <a-option v-for="item in parser_ids" :key="item.value">{{-->
+<!-- item.name-->
+<!-- }}</a-option>-->
+<!-- </a-select>-->
+<!-- <p class="config-text">鏇村閰嶇疆</p>-->
<a-button
:loading="onFileSelectedLoading"
@click="upDataFile"
type="primary"
size="mini"
- style="border-radius: 24px"
+ style="border-radius: 24px;"
>
<span style="font-size: 12px"> 涓婁紶 </span>
</a-button>
@@ -93,7 +91,8 @@
getParseMethodsListApi,
getSessionDetailsApi,
uploadWithoutKb,
- } from '@/api/session';
+ uploadAndParse, upload_and_parse, getDocumentStatus
+ } from "@/api/session";
const visible = ref(false);
const loading = ref(false);
@@ -289,7 +288,7 @@
});
return type;
};
-
+ let status_timer;
const upDataFile = async () => {
if (!activeSessionId.value) {
//鏂板缓浼氳瘽
@@ -337,17 +336,32 @@
formData.append('parser_id', parser_id.value);
}
}
- uploadWithoutKb(formData).then((res) => {
+ console.log(formData, 'formData');
+ upload_and_parse(formData).then((res) => {
onFileSelectedLoading.value = false;
- if (res.code == 200) {
+ if (res.code == 0) {
+ //涓婁紶鎴愬姛
+ Message.success("涓婁紶鎴愬姛");
cancel();
- // uploaditemList.value = [];
- emit('selectFileCallback', uploaditemList.value);
- Message.success('涓婁紶鎴愬姛');
+ emit("selectFileCallback", uploaditemList.value,activeSessionId.value);
} else {
Message.error('涓婁紶澶辫触');
}
});
+ };
+
+
+ const checkStatus = async (doc_ids) => {
+ let res = await getDocumentStatus(doc_ids);
+ if (res.code == 200 && res.data.status == "success") {
+ //涓婁紶鎴愬姛
+ Message.success("涓婁紶鎴愬姛");
+ cancel();
+ emit("selectFileCallback", uploaditemList.value);
+ if (status_timer) {
+ clearTimeout(status_timer!);
+ }
+ }
};
const cancel = () => {
@@ -364,11 +378,12 @@
const getParseMethodsList = async () => {
let res = await getParseMethodsListApi();
parser_ids.value = res.data.map((item) => {
+ console.log(item, item.parser_config_str, 78787);
return {
name: item.name,
value: item.id,
parser_config: '',
- parser_config_str: item.parser_config_str,
+ parser_config_str: JSON.stringify(item.formats),
};
});
parser_idsArr.value = res.data;
--
Gitblit v1.8.0