feat: 设置知识库bug
This commit is contained in:
parent
a7cbf51db3
commit
58babb7fe2
@ -31,6 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import type { datasetData } from '@/api/type/dataset'
|
import type { datasetData } from '@/api/type/dataset'
|
||||||
import { isAllPropertiesEmpty } from '@/utils/utils'
|
import { isAllPropertiesEmpty } from '@/utils/utils'
|
||||||
@ -41,6 +42,11 @@ const props = defineProps({
|
|||||||
default: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const route = useRoute()
|
||||||
|
const {
|
||||||
|
params: { type }
|
||||||
|
} = route
|
||||||
|
const isCreate = type === 'create'
|
||||||
const { dataset } = useStore()
|
const { dataset } = useStore()
|
||||||
const baseInfo = computed(() => dataset.baseInfo)
|
const baseInfo = computed(() => dataset.baseInfo)
|
||||||
const form = ref<datasetData>({
|
const form = ref<datasetData>({
|
||||||
@ -57,6 +63,7 @@ const FormRef = ref()
|
|||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
console.log(value)
|
||||||
if (value && JSON.stringify(value) !== '{}') {
|
if (value && JSON.stringify(value) !== '{}') {
|
||||||
form.value.name = value.name
|
form.value.name = value.name
|
||||||
form.value.desc = value.desc
|
form.value.desc = value.desc
|
||||||
@ -71,7 +78,9 @@ watch(form.value, (value) => {
|
|||||||
if (isAllPropertiesEmpty(value)) {
|
if (isAllPropertiesEmpty(value)) {
|
||||||
dataset.saveBaseInfo(null)
|
dataset.saveBaseInfo(null)
|
||||||
} else {
|
} else {
|
||||||
dataset.saveBaseInfo(value)
|
if (isCreate) {
|
||||||
|
dataset.saveBaseInfo(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user