|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script lang="ts" setup> | 
|---|
|  |  |  | import { onMounted ,onBeforeMount, reactive, ref } from "vue"; | 
|---|
|  |  |  | import { kbcreate } from "@/api/kbList"; | 
|---|
|  |  |  | import { Message } from '@arco-design/web-vue'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const visible = ref(false); | 
|---|
|  |  |  | const loading = ref(false); | 
|---|
|  |  |  | const form = reactive({ | 
|---|
|  |  |  | name: '',// 用户名 | 
|---|
|  |  |  | nameJoin: '',// 昵称 | 
|---|
|  |  |  | post: '',// 岗位 | 
|---|
|  |  |  | txt: '',// 备注 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const formRef = ref(null); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSubmit = ({values, errors}) => { | 
|---|
|  |  |  | console.log('values:', values, '\nerrors:', errors) | 
|---|
|  |  |  | const emit =  defineEmits(['getknowledge','getKbdetail']) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSubmit = async({values, errors}) => { | 
|---|
|  |  |  | if(errors) return; | 
|---|
|  |  |  | let data = await kbcreate({ | 
|---|
|  |  |  | name: values.name, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | if(data.code == 0){ | 
|---|
|  |  |  | visible.value = false; | 
|---|
|  |  |  | Message.success('创建成功'); | 
|---|
|  |  |  | // emit('getKbdetail',data.data.kb_id); | 
|---|
|  |  |  | emit("getknowledge",data.data.kb_id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleClick = () => { | 
|---|
|  |  |  | 
|---|
|  |  |  | const handleOpened =(el) => { | 
|---|
|  |  |  | Object.assign(form,{ | 
|---|
|  |  |  | name: '',// 用户名 | 
|---|
|  |  |  | nameJoin: '',// 昵称 | 
|---|
|  |  |  | post: '',// 岗位 | 
|---|
|  |  |  | txt: '',// 备注 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | formRef.value.resetFields(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script lang="ts"> | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'add', | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | </script> | 
|---|