Skip to content

Commit c217712

Browse files
perf: Optimize some front-end pages
1 parent b6919c3 commit c217712

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

ui/src/views/application/component/AddKnowledgeDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<template #footer>
8181
<div class="flex-between">
8282
<div class="flex">
83-
<el-text type="info" class="color-secondary mr-8" v-if="checkList.length > 0">
83+
<el-text class="color-secondary mr-8" v-if="checkList.length > 0">
8484
{{ $t('common.selected') }} {{ checkList.length }}
8585
</el-text>
8686
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">

ui/src/views/paragraph/component/ParagraphCard.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</el-card>
129129
</template>
130130
<script setup lang="ts">
131-
import {ref, computed, watch, onMounted} from 'vue'
131+
import { ref, computed, watch, onMounted } from 'vue'
132132
import { useRoute } from 'vue-router'
133133
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
134134
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
@@ -208,7 +208,6 @@ function getDetail() {
208208
})
209209
}
210210
211-
212211
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
213212
function openGenerateDialog(row: any) {
214213
if (GenerateRelatedDialogRef.value) {
@@ -239,8 +238,8 @@ const ParagraphDialogRef = ref()
239238
const title = ref('')
240239
function editParagraph(row: any) {
241240
if (!props.disabled) {
242-
title.value = t('views.paragraph.paragraphDetail')
243-
ParagraphDialogRef.value.open(row)
241+
title.value = t('views.paragraph.editParagraph')
242+
ParagraphDialogRef.value.open(row, 'edit')
244243
}
245244
}
246245
@@ -251,7 +250,8 @@ function handleClickCard(row: any) {
251250
return
252251
}
253252
if (!props.disabled) {
254-
editParagraph(row)
253+
title.value = t('views.paragraph.paragraphDetail')
254+
ParagraphDialogRef.value.open(row)
255255
} else {
256256
emit('clickCard')
257257
}

ui/src/views/paragraph/component/ParagraphDialog.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,23 @@ const cancelEdit = () => {
112112
}
113113
114114
const open = (data: any, str: any) => {
115-
if (data && !str) {
115+
if (data && str === 'add') {
116+
isEdit.value = true
117+
position.value = data.position
118+
} else if (data) {
116119
detail.value.title = data.title
117120
detail.value.content = data.content
118121
cloneData.value = cloneDeep(detail.value)
119122
paragraphId.value = data.id
120123
document_id.value = data.document_id
121124
dataset_id.value = data.dataset_id || id
125+
if (str === 'edit') {
126+
isEdit.value = true
127+
} else {
128+
isEdit.value = false
129+
}
122130
} else {
123131
isEdit.value = true
124-
if (str === 'add') {
125-
position.value = data.position
126-
}
127132
}
128133
dialogVisible.value = true
129134
}

ui/src/views/paragraph/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
container=".paragraph-scollbar"
6363
@click="handleClick"
6464
>
65-
<template v-for="(item) in paragraphDetail" :key="item.id">
65+
<template v-for="item in paragraphDetail" :key="item.id">
6666
<el-anchor-link :href="`#m${item.id}`" :title="item.title" v-if="item.title">
6767
<span :title="item.title">
6868
{{ item.title }}
@@ -171,10 +171,13 @@
171171
<el-button :disabled="multipleSelection.length === 0" @click="deleteMulParagraph">
172172
{{ $t('common.delete') }}
173173
</el-button>
174-
<span class="ml-24">
174+
<span class="color-secondary ml-24 mr-16">
175175
{{ $t('common.selected') }} {{ multipleSelection.length }}
176176
{{ $t('views.document.items') }}
177177
</span>
178+
<el-button link type="primary" v-if="multipleSelection.length > 0" @click="multipleSelection = []">
179+
{{ $t('common.clear') }}
180+
</el-button>
178181
</div>
179182
</el-card>
180183
<ParagraphDialog
@@ -236,7 +239,6 @@ const searchTypeChange = () => {
236239
search.value = ''
237240
}
238241
239-
240242
const dialogVisible = ref(false)
241243
watch(
242244
() => ParagraphDialogRef.value?.dialogVisible,

ui/src/views/problem/component/DetailProblemDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function relateProblem() {
160160
}
161161
162162
function editParagraph(row: any) {
163-
ParagraphDialogRef.value.open(row)
163+
ParagraphDialogRef.value.open(row, 'edit')
164164
}
165165
166166
function editName(val: string) {

ui/src/views/system/role/component/MemberFormContent.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
:key="opt.value"
3333
:label="opt.label"
3434
:value="opt.value"
35-
:disabled="opt.disabledFunction?.(element)"
35+
:disabled="selectedRoles.includes(opt.value)"
3636
>
3737
<el-tooltip effect="dark" :content="opt.label" placement="top" :show-after="500">
3838
<div class="ellipsis" style="max-width: 190px">{{ opt.label }}</div>
@@ -55,7 +55,6 @@
5555
</el-button>
5656
</div>
5757
</el-scrollbar>
58-
5958
<!-- 添加按钮 -->
6059
<el-button type="primary" text class="mt-2" @click="handleAdd">
6160
<el-icon class="mr-4">
@@ -67,7 +66,7 @@
6766
</template>
6867

6968
<script setup lang="ts">
70-
import { ref, watch } from 'vue'
69+
import { ref, watch, computed } from 'vue'
7170
import type { FormItemModel } from '@/api/type/role'
7271
7372
const props = defineProps<{
@@ -83,6 +82,10 @@ const form = defineModel<Record<string, any>[]>('form', {
8382
default: [],
8483
})
8584
85+
const selectedRoles = computed(() => {
86+
return form.value.map((item) => item.role_id)
87+
})
88+
8689
function handleAdd() {
8790
form.value.push({ ...formItem })
8891
}

0 commit comments

Comments
 (0)