feat: 段落排序
This commit is contained in:
parent
904c01dc1f
commit
4054244f65
@ -63,6 +63,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, nextTick } from 'vue'
|
import { ref, watch, nextTick } from 'vue'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { arraySort } from '@/utils/utils'
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
const ParagraphDialogRef = ref()
|
const ParagraphDialogRef = ref()
|
||||||
@ -80,6 +81,7 @@ const open = (data: any, id?: string) => {
|
|||||||
detail.value.paragraph_list = id
|
detail.value.paragraph_list = id
|
||||||
? detail.value.paragraph_list.filter((v: any) => v.dataset_id === id)
|
? detail.value.paragraph_list.filter((v: any) => v.dataset_id === id)
|
||||||
: detail.value.paragraph_list
|
: detail.value.paragraph_list
|
||||||
|
detail.value.paragraph_list = arraySort(detail.value.paragraph_list, 'similarity', true)
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="text-right p-24 pt-0" v-if="problemId && isEdit">
|
<div class="text-right p-24 pt-0" v-if="problemId && isEdit">
|
||||||
<el-button @click.prevent="isEdit = false"> 取消 </el-button>
|
<el-button @click.prevent="cancelEdit"> 取消 </el-button>
|
||||||
<el-button type="primary" :disabled="loading" @click="submitHandle"> 保存 </el-button>
|
<el-button type="primary" :disabled="loading" @click="submitHandle"> 保存 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -46,6 +46,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, nextTick } from 'vue'
|
import { ref, watch, nextTick } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||||
import paragraphApi from '@/api/paragraph'
|
import paragraphApi from '@/api/paragraph'
|
||||||
@ -75,6 +76,7 @@ const detail = ref<any>({})
|
|||||||
const isEdit = ref(false)
|
const isEdit = ref(false)
|
||||||
const document_id = ref('')
|
const document_id = ref('')
|
||||||
const dataset_id = ref('')
|
const dataset_id = ref('')
|
||||||
|
const cloneData = ref(null)
|
||||||
|
|
||||||
watch(dialogVisible, (bool) => {
|
watch(dialogVisible, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
@ -83,13 +85,20 @@ watch(dialogVisible, (bool) => {
|
|||||||
isEdit.value = false
|
isEdit.value = false
|
||||||
document_id.value = ''
|
document_id.value = ''
|
||||||
dataset_id.value = ''
|
dataset_id.value = ''
|
||||||
|
cloneData.value = null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const cancelEdit = () => {
|
||||||
|
isEdit.value = false
|
||||||
|
detail.value = cloneDeep(cloneData.value)
|
||||||
|
}
|
||||||
|
|
||||||
const open = (data: any) => {
|
const open = (data: any) => {
|
||||||
if (data) {
|
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)
|
||||||
problemId.value = data.id
|
problemId.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
|
||||||
|
|||||||
@ -61,6 +61,17 @@ watch(
|
|||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
watch(
|
||||||
|
() => props.isEdit,
|
||||||
|
(value) => {
|
||||||
|
if (!value) {
|
||||||
|
paragraphFormRef.value?.clearValidate()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
表单校验
|
表单校验
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user