perf: Optimize some front-end pages
parent
b6919c34f8
commit
c217712642
|
|
@ -80,7 +80,7 @@
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-text type="info" class="color-secondary mr-8" v-if="checkList.length > 0">
|
<el-text class="color-secondary mr-8" v-if="checkList.length > 0">
|
||||||
{{ $t('common.selected') }} {{ checkList.length }}
|
{{ $t('common.selected') }} {{ checkList.length }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, watch, onMounted} from 'vue'
|
import { ref, computed, watch, onMounted } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||||
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||||
|
|
@ -208,7 +208,6 @@ function getDetail() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||||
function openGenerateDialog(row: any) {
|
function openGenerateDialog(row: any) {
|
||||||
if (GenerateRelatedDialogRef.value) {
|
if (GenerateRelatedDialogRef.value) {
|
||||||
|
|
@ -239,8 +238,8 @@ const ParagraphDialogRef = ref()
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
function editParagraph(row: any) {
|
function editParagraph(row: any) {
|
||||||
if (!props.disabled) {
|
if (!props.disabled) {
|
||||||
title.value = t('views.paragraph.paragraphDetail')
|
title.value = t('views.paragraph.editParagraph')
|
||||||
ParagraphDialogRef.value.open(row)
|
ParagraphDialogRef.value.open(row, 'edit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,7 +250,8 @@ function handleClickCard(row: any) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!props.disabled) {
|
if (!props.disabled) {
|
||||||
editParagraph(row)
|
title.value = t('views.paragraph.paragraphDetail')
|
||||||
|
ParagraphDialogRef.value.open(row)
|
||||||
} else {
|
} else {
|
||||||
emit('clickCard')
|
emit('clickCard')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,18 +112,23 @@ const cancelEdit = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const open = (data: any, str: any) => {
|
const open = (data: any, str: any) => {
|
||||||
if (data && !str) {
|
if (data && str === 'add') {
|
||||||
|
isEdit.value = true
|
||||||
|
position.value = data.position
|
||||||
|
} else if (data) {
|
||||||
detail.value.title = data.title
|
detail.value.title = data.title
|
||||||
detail.value.content = data.content
|
detail.value.content = data.content
|
||||||
cloneData.value = cloneDeep(detail.value)
|
cloneData.value = cloneDeep(detail.value)
|
||||||
paragraphId.value = data.id
|
paragraphId.value = data.id
|
||||||
document_id.value = data.document_id
|
document_id.value = data.document_id
|
||||||
dataset_id.value = data.dataset_id || id
|
dataset_id.value = data.dataset_id || id
|
||||||
|
if (str === 'edit') {
|
||||||
|
isEdit.value = true
|
||||||
|
} else {
|
||||||
|
isEdit.value = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
isEdit.value = true
|
isEdit.value = true
|
||||||
if (str === 'add') {
|
|
||||||
position.value = data.position
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
container=".paragraph-scollbar"
|
container=".paragraph-scollbar"
|
||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
>
|
>
|
||||||
<template v-for="(item) in paragraphDetail" :key="item.id">
|
<template v-for="item in paragraphDetail" :key="item.id">
|
||||||
<el-anchor-link :href="`#m${item.id}`" :title="item.title" v-if="item.title">
|
<el-anchor-link :href="`#m${item.id}`" :title="item.title" v-if="item.title">
|
||||||
<span :title="item.title">
|
<span :title="item.title">
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
|
|
@ -171,10 +171,13 @@
|
||||||
<el-button :disabled="multipleSelection.length === 0" @click="deleteMulParagraph">
|
<el-button :disabled="multipleSelection.length === 0" @click="deleteMulParagraph">
|
||||||
{{ $t('common.delete') }}
|
{{ $t('common.delete') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<span class="ml-24">
|
<span class="color-secondary ml-24 mr-16">
|
||||||
{{ $t('common.selected') }} {{ multipleSelection.length }}
|
{{ $t('common.selected') }} {{ multipleSelection.length }}
|
||||||
{{ $t('views.document.items') }}
|
{{ $t('views.document.items') }}
|
||||||
</span>
|
</span>
|
||||||
|
<el-button link type="primary" v-if="multipleSelection.length > 0" @click="multipleSelection = []">
|
||||||
|
{{ $t('common.clear') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<ParagraphDialog
|
<ParagraphDialog
|
||||||
|
|
@ -236,7 +239,6 @@ const searchTypeChange = () => {
|
||||||
search.value = ''
|
search.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
watch(
|
watch(
|
||||||
() => ParagraphDialogRef.value?.dialogVisible,
|
() => ParagraphDialogRef.value?.dialogVisible,
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ function relateProblem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function editParagraph(row: any) {
|
function editParagraph(row: any) {
|
||||||
ParagraphDialogRef.value.open(row)
|
ParagraphDialogRef.value.open(row, 'edit')
|
||||||
}
|
}
|
||||||
|
|
||||||
function editName(val: string) {
|
function editName(val: string) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
:key="opt.value"
|
:key="opt.value"
|
||||||
:label="opt.label"
|
:label="opt.label"
|
||||||
:value="opt.value"
|
:value="opt.value"
|
||||||
:disabled="opt.disabledFunction?.(element)"
|
:disabled="selectedRoles.includes(opt.value)"
|
||||||
>
|
>
|
||||||
<el-tooltip effect="dark" :content="opt.label" placement="top" :show-after="500">
|
<el-tooltip effect="dark" :content="opt.label" placement="top" :show-after="500">
|
||||||
<div class="ellipsis" style="max-width: 190px">{{ opt.label }}</div>
|
<div class="ellipsis" style="max-width: 190px">{{ opt.label }}</div>
|
||||||
|
|
@ -55,7 +55,6 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<!-- 添加按钮 -->
|
<!-- 添加按钮 -->
|
||||||
<el-button type="primary" text class="mt-2" @click="handleAdd">
|
<el-button type="primary" text class="mt-2" @click="handleAdd">
|
||||||
<el-icon class="mr-4">
|
<el-icon class="mr-4">
|
||||||
|
|
@ -67,7 +66,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch, computed } from 'vue'
|
||||||
import type { FormItemModel } from '@/api/type/role'
|
import type { FormItemModel } from '@/api/type/role'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -83,6 +82,10 @@ const form = defineModel<Record<string, any>[]>('form', {
|
||||||
default: [],
|
default: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const selectedRoles = computed(() => {
|
||||||
|
return form.value.map((item) => item.role_id)
|
||||||
|
})
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
form.value.push({ ...formItem })
|
form.value.push({ ...formItem })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue