From 745a01cc58ec9095d34b3d7846d3e5041d6060bc Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 10 Apr 2024 12:29:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/app-table/index.vue | 2 +- ui/src/components/read-write/index.vue | 3 ++- ui/src/stores/modules/common.ts | 20 ++++++++++++++++++-- ui/src/views/dataset/CreateDataset.vue | 8 ++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ui/src/components/app-table/index.vue b/ui/src/components/app-table/index.vue index fd2c5e43c..693ca395c 100644 --- a/ui/src/components/app-table/index.vue +++ b/ui/src/components/app-table/index.vue @@ -9,7 +9,7 @@ :placeholder="`请输入${quickCreateName}`" class="w-500 mr-12" autofocus - :maxlength="quickCreateMaxlength" + :maxlength="quickCreateMaxlength || '-'" :show-word-limit="quickCreateMaxlength ? true : false" @keydown.enter="submitHandle" /> diff --git a/ui/src/components/read-write/index.vue b/ui/src/components/read-write/index.vue index 6a04e4633..5f86b81cc 100644 --- a/ui/src/components/read-write/index.vue +++ b/ui/src/components/read-write/index.vue @@ -19,8 +19,9 @@ v-model="writeValue" placeholder="请输入" autofocus - :maxlength="maxlength" + :maxlength="maxlength || '-'" :show-word-limit="maxlength ? true : false" + @keydown.enter="submit" > diff --git a/ui/src/stores/modules/common.ts b/ui/src/stores/modules/common.ts index 993eba347..2f36c6730 100644 --- a/ui/src/stores/modules/common.ts +++ b/ui/src/stores/modules/common.ts @@ -1,13 +1,29 @@ import { defineStore } from 'pinia' +import type { pageRequest } from '@/api/type/common' + +export interface commonTypes { + breadcrumb: any + paginationConfig: any | null + search: any +} const useCommonStore = defineStore({ id: 'common', - state: () => ({ - breadcrumb: null + state: (): commonTypes => ({ + breadcrumb: null, + // 搜索和分页缓存 + paginationConfig: null, + search: null }), actions: { saveBreadcrumb(data: any) { this.breadcrumb = data + }, + savePage(val: string, data: pageRequest) { + this.paginationConfig[val] = data + }, + saveCondition(val: string, data: any) { + this.search[val] = data } } }) diff --git a/ui/src/views/dataset/CreateDataset.vue b/ui/src/views/dataset/CreateDataset.vue index beacabfd0..7a55bd963 100644 --- a/ui/src/views/dataset/CreateDataset.vue +++ b/ui/src/views/dataset/CreateDataset.vue @@ -113,18 +113,18 @@ function clearStore() { } function submit() { loading.value = true - const data = [] as any + const documents = [] as any StepSecondRef.value?.paragraphList.map((item: any) => { - data.push({ + documents.push({ name: item.name, paragraphs: item.content }) }) - const obj = { ...baseInfo.value, data } as datasetData + const obj = { ...baseInfo.value, documents } as datasetData if (id) { // 上传文档 document - .asyncPostDocument(id as string, data) + .asyncPostDocument(id as string, documents) .then(() => { MsgSuccess('提交成功') clearStore()