|  |  |  | 
|---|
|  |  |  | <a-textarea | 
|---|
|  |  |  | v-model="form.content_with_weight" | 
|---|
|  |  |  | placeholder="" | 
|---|
|  |  |  | style="height: 100px" | 
|---|
|  |  |  | style="height: 100px;overflow: auto;" | 
|---|
|  |  |  | auto-size | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | 
|---|
|  |  |  | <div style="width: auto"> | 
|---|
|  |  |  | <a-tag | 
|---|
|  |  |  | v-for="(item, index) in form.important_kwd" | 
|---|
|  |  |  | :key="index" | 
|---|
|  |  |  | :key="item" | 
|---|
|  |  |  | closable | 
|---|
|  |  |  | bordered | 
|---|
|  |  |  | @close="form.important_kwd.splice(index, 1)" | 
|---|
|  |  |  | @close="deleteKey(item)" | 
|---|
|  |  |  | style="margin-right: 10px" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {{ item }} | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | <a-divider style="margin: 10px 0" /> | 
|---|
|  |  |  | <a-switch size="small" /> | 
|---|
|  |  |  | <span style="color: var(--color-text-2)">启用</span> | 
|---|
|  |  |  | <a-button type="text" style="color: var(--color-text-2)"> | 
|---|
|  |  |  | <template #icon> | 
|---|
|  |  |  | <icon-delete /> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 删除 | 
|---|
|  |  |  | </a-button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--      <div>--> | 
|---|
|  |  |  | <!--        <a-divider style="margin: 10px 0" />--> | 
|---|
|  |  |  | <!--        <a-switch size="small" />--> | 
|---|
|  |  |  | <!--        <span style="color: var(--color-text-2)">启用</span>--> | 
|---|
|  |  |  | <!--        <a-button type="text" style="color: var(--color-text-2)">--> | 
|---|
|  |  |  | <!--          <template #icon>--> | 
|---|
|  |  |  | <!--            <icon-delete />--> | 
|---|
|  |  |  | <!--          </template>--> | 
|---|
|  |  |  | <!--          删除--> | 
|---|
|  |  |  | <!--        </a-button>--> | 
|---|
|  |  |  | <!--      </div>--> | 
|---|
|  |  |  | <a-form-item> | 
|---|
|  |  |  | <div style="width: 100%; text-align: right"> | 
|---|
|  |  |  | <a-button @click="visible = false">取消</a-button> | 
|---|
|  |  |  | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script lang="ts" setup> | 
|---|
|  |  |  | import { onMounted, onBeforeMount, reactive, ref } from 'vue'; | 
|---|
|  |  |  | import { achunkCreate } from '@/api/kbList'; | 
|---|
|  |  |  | import { onMounted, onBeforeMount, reactive, ref, nextTick } from "vue"; | 
|---|
|  |  |  | import { achunkCreate, achunkSet } from "@/api/kbList"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const props = defineProps(['item']); | 
|---|
|  |  |  | const visible =defineModel('eidtDilVisible'); | 
|---|
|  |  |  | const emit = defineEmits(['canplaythrough']); | 
|---|
|  |  |  | const keyVisible = ref(false); | 
|---|
|  |  |  | const loading = ref(false); | 
|---|
|  |  |  | const form = reactive({ | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSubmit = async ({ values, errors }) => { | 
|---|
|  |  |  | console.log(props.item.id); | 
|---|
|  |  |  | if (!errors) { | 
|---|
|  |  |  | const res = await achunkCreate({ | 
|---|
|  |  |  | const res = await achunkSet({ | 
|---|
|  |  |  | content_with_weight: values.content_with_weight, | 
|---|
|  |  |  | important_kwd: values.important_kwd, | 
|---|
|  |  |  | doc_id: props.item.id, | 
|---|
|  |  |  | doc_id: props.item.doc_id, | 
|---|
|  |  |  | chunk_id: props.item.chunk_id, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (res.code === 0) { | 
|---|
|  |  |  | visible.value = false; | 
|---|
|  |  |  | emit('canplaythrough'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleOpened = (el) => { | 
|---|
|  |  |  | Object.assign(form, { | 
|---|
|  |  |  | content_with_weight: '', | 
|---|
|  |  |  | important_kwd: [], | 
|---|
|  |  |  | important_kwd_key: '', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | console.log(props.item); | 
|---|
|  |  |  | nextTick(()=>{ | 
|---|
|  |  |  | Object.assign(form, props.item); | 
|---|
|  |  |  | console.log(form.important_kwd); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | formRef.value.resetFields(); | 
|---|
|  |  |  | keyVisible.value = false; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const deleteKey = (row) => { | 
|---|
|  |  |  | console.log(form.important_kwd); | 
|---|
|  |  |  | console.log(row); | 
|---|
|  |  |  | // form.important_kwd.splice(index, 1); | 
|---|
|  |  |  | form.important_kwd = form.important_kwd.filter((item) => item !== row); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const addKey = () => { | 
|---|
|  |  |  | form.important_kwd_key = ''; | 
|---|
|  |  |  | formInput.value.focus(); | 
|---|