From feb1bc83e9d2e2b57fef8bdafaa2e24a43fec96c Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期五, 02 八月 2024 12:11:17 +0800
Subject: [PATCH] 解析块和解析方法的页面开发和功能开发

---
 src/api/kbList.ts                          |   26 +++++
 src/views/dmx/knowledgeLib/eidtDetails.vue |  146 +++++++++++++++++++++++++++++
 src/views/dmx/knowledgeLib/tool.vue        |   15 +-
 src/views/dmx/knowledgeLib/addDetails.vue  |  109 +++++++++++++++------
 4 files changed, 258 insertions(+), 38 deletions(-)

diff --git a/src/api/kbList.ts b/src/api/kbList.ts
index af8f7cc..bd8f60e 100644
--- a/src/api/kbList.ts
+++ b/src/api/kbList.ts
@@ -163,3 +163,29 @@
 };
 
 
+// 鏂板瑙f瀽鍧�
+export function achunkCreate(params) {
+  return axios.post("/api/v1/chunk/create", params);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/dmx/knowledgeLib/addDetails.vue b/src/views/dmx/knowledgeLib/addDetails.vue
index 07db2d2..8a58977 100644
--- a/src/views/dmx/knowledgeLib/addDetails.vue
+++ b/src/views/dmx/knowledgeLib/addDetails.vue
@@ -5,11 +5,42 @@
       <icon-plus />
     </template>
   </a-button>
-  <a-modal v-model:visible="visible" title="鍒涘缓鐭ヨ瘑搴�" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start">
-    <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit" >
-      <a-form-item field="name" label="鍚嶇О">
-        <a-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�"/>
+  <a-modal v-model:visible="visible" title="鍒涘缓瑙f瀽鍧�" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start">
+    <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit" layout="vertical" >
+      <a-form-item field="content_with_weight" label="瑙f瀽鍧�">
+        <a-textarea v-model="form.content_with_weight" placeholder="" style="height: 100px"  auto-size />
       </a-form-item>
+      <a-form-item field="important_kwd_key" label="鍏抽敭璇� *">
+        <div style="width: auto">
+          <a-tag
+            v-for="(item,index) in form.important_kwd"
+            :key="index"
+            closable
+            bordered
+            @close="form.important_kwd.splice(index,1)"
+            style="margin-right: 10px"
+          >
+            {{item}}
+          </a-tag>
+
+
+          <a-input
+            ref="formInput"
+            v-show="keyVisible"
+            v-model="form.important_kwd_key"
+            placeholder=""
+            size="small"
+            style="width: 80px;margin-right: 16px"
+            @blur="inputChange"
+          />
+          <a-button type="dashed" shape="circle" size="small" @click="addKey">
+            <icon-plus />
+          </a-button>
+        </div>
+
+      </a-form-item>
+
+
       <a-form-item>
         <div style="width: 100%;text-align: right">
           <a-button @click="visible = false">鍙栨秷</a-button>
@@ -22,29 +53,39 @@
 
 <script lang="ts" setup>
 import { onMounted ,onBeforeMount, reactive, ref } from "vue";
+import { achunkCreate } from "@/api/kbList";
+
+const props = defineProps(['item'])
 
 const visible = ref(false);
+const keyVisible = ref(false);
 const loading = ref(false);
 const form = reactive({
-  name: '',// 鐢ㄦ埛鍚�
-  nameJoin: '',// 鏄电О
-  post: '',// 宀椾綅
-  txt: '',// 澶囨敞
+  content_with_weight: '',
+  important_kwd: [],
+  important_kwd_key: '',
 });
 const formRef = ref(null);
-
+const formInput = ref(null);
 const rules = {
-  name: [
+  content_with_weight: [
     {
       required: true,
-      message:'鍚嶇О涓嶅厑璁镐负绌�',
+      message:'璇疯緭鍏ュ�硷紒',
     },
   ],
 }
 
 
-const handleSubmit = ({values, errors}) => {
-  console.log('values:', values, '\nerrors:', errors)
+const handleSubmit = async ({values, errors}) => {
+  console.log(props.item.id);
+  if(!errors){
+    const res = await achunkCreate({
+      content_with_weight: values.content_with_weight,
+      important_kwd: values.important_kwd,
+      doc_id: props.item.id,
+    })
+  }
 }
 
 const handleClick = () => {
@@ -53,12 +94,6 @@
 const handleBeforeOk = (done) => {
     formRef.value.validate().then(res => {
       console.log('form:', form)
-      if (!form.name) {
-        done(false)
-      }else {
-        console.log('璇锋眰鏁版嵁');
-
-      }
     })
 };
 const handleCancel = () => {
@@ -67,13 +102,32 @@
 
 const handleOpened =(el) => {
   Object.assign(form,{
-    name: '',// 鐢ㄦ埛鍚�
-    nameJoin: '',// 鏄电О
-    post: '',// 宀椾綅
-    txt: '',// 澶囨敞
+    content_with_weight: '',
+    important_kwd: [],
+    important_kwd_key: '',
   });
   formRef.value.resetFields();
+  keyVisible.value= false;
 }
+
+const addKey = () => {
+  form.important_kwd_key = '';
+  formInput.value.focus();
+  keyVisible.value= true;
+}
+
+const inputChange = (e) => {
+  if (!form.important_kwd.includes(form.important_kwd_key) && form.important_kwd_key){
+    form.important_kwd.push(form.important_kwd_key)
+  }else {
+
+  }
+  keyVisible.value= false;
+}
+
+
+
+
 
 onBeforeMount(()=>{
 
@@ -82,13 +136,4 @@
 
 
 })
-</script>
-
-<script lang="ts">
-export default {
-  name: 'add',
-  methods: {
-
-  }
-};
 </script>
\ No newline at end of file
diff --git a/src/views/dmx/knowledgeLib/eidtDetails.vue b/src/views/dmx/knowledgeLib/eidtDetails.vue
new file mode 100644
index 0000000..3e1a521
--- /dev/null
+++ b/src/views/dmx/knowledgeLib/eidtDetails.vue
@@ -0,0 +1,146 @@
+
+<template>
+  <a-modal v-model:visible="visible" title="缂栬緫瑙f瀽鍧�" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start">
+    <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit" layout="vertical" >
+      <a-form-item field="content_with_weight" label="瑙f瀽鍧�">
+        <a-textarea v-model="form.content_with_weight" placeholder="" style="height: 100px"  auto-size />
+      </a-form-item>
+      <a-form-item field="important_kwd_key" label="鍏抽敭璇� *">
+        <div style="width: auto">
+          <a-tag
+            v-for="(item,index) in form.important_kwd"
+            :key="index"
+            closable
+            bordered
+            @close="form.important_kwd.splice(index,1)"
+            style="margin-right: 10px"
+          >
+            {{item}}
+          </a-tag>
+
+
+          <a-input
+            ref="formInput"
+            v-show="keyVisible"
+            v-model="form.important_kwd_key"
+            placeholder=""
+            size="small"
+            style="width: 80px;margin-right: 16px"
+            @blur="inputChange"
+          />
+          <a-button type="dashed" shape="circle" size="small" @click="addKey">
+            <icon-plus />
+          </a-button>
+        </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>
+      <a-form-item>
+        <div style="width: 100%;text-align: right">
+          <a-button @click="visible = false">鍙栨秷</a-button>
+          <a-button style="margin-left: 10px" type="primary" html-type="submit">纭畾</a-button>
+        </div>
+      </a-form-item>
+    </a-form>
+  </a-modal>
+</template>
+
+<script lang="ts" setup>
+import { onMounted ,onBeforeMount, reactive, ref } from "vue";
+import { achunkCreate } from "@/api/kbList";
+
+const props = defineProps(['item'])
+
+const visible = ref(false);
+const keyVisible = ref(false);
+const loading = ref(false);
+const form = reactive({
+  content_with_weight: '',
+  important_kwd: [],
+  important_kwd_key: '',
+});
+const formRef = ref(null);
+const formInput = ref(null);
+const rules = {
+  content_with_weight: [
+    {
+      required: true,
+      message:'璇疯緭鍏ュ�硷紒',
+    },
+  ],
+}
+
+
+const handleSubmit = async ({values, errors}) => {
+  console.log(props.item.id);
+  if(!errors){
+    const res = await achunkCreate({
+      content_with_weight: values.content_with_weight,
+      important_kwd: values.important_kwd,
+      doc_id: props.item.id,
+    })
+  }
+}
+
+const handleClick = () => {
+  visible.value = true;
+};
+
+defineExpose({
+  handleClick
+})
+const handleBeforeOk = (done) => {
+    formRef.value.validate().then(res => {
+      console.log('form:', form)
+    })
+};
+const handleCancel = () => {
+  visible.value = false;
+}
+
+const handleOpened =(el) => {
+  Object.assign(form,{
+    content_with_weight: '',
+    important_kwd: [],
+    important_kwd_key: '',
+  });
+  formRef.value.resetFields();
+  keyVisible.value= false;
+}
+
+const addKey = () => {
+  form.important_kwd_key = '';
+  formInput.value.focus();
+  keyVisible.value= true;
+}
+
+const inputChange = (e) => {
+  if (!form.important_kwd.includes(form.important_kwd_key) && form.important_kwd_key){
+    form.important_kwd.push(form.important_kwd_key)
+  }else {
+
+  }
+  keyVisible.value= false;
+}
+
+
+
+
+
+onBeforeMount(()=>{
+
+})
+onMounted(()=>{
+
+
+})
+</script>
\ No newline at end of file
diff --git a/src/views/dmx/knowledgeLib/tool.vue b/src/views/dmx/knowledgeLib/tool.vue
index e7532a8..040fdf0 100644
--- a/src/views/dmx/knowledgeLib/tool.vue
+++ b/src/views/dmx/knowledgeLib/tool.vue
@@ -143,7 +143,7 @@
                     </a-radio-group>
                   </template>
                 </a-popover>
-                <addDetails></addDetails>
+                <addDetails :item="item"></addDetails>
               </div>
             </div>
             <a-divider style="margin-top: 10px" />
@@ -151,7 +151,7 @@
               <a-checkbox-group v-model="data" @change="handleChange" >
                 <div class="groupList" :style="{background:keyBg=='1'?'#eff8ff':'white'}">
                   <a-checkbox  value="1"></a-checkbox>
-                  <div class="groupList-content" @click="groupListContentClick('1')">
+                  <div class="groupList-content" @click="groupListContentClick('1')" @dblclick="contentClick()">
                     鑰� stable version 鏄渶鏂扮ǔ瀹氱増锛岀粡杩囧厖鍒嗘祴璇曞拰楠岃瘉锛宐ug 杈冨皯锛�
                     閫傚悎鐢ㄤ簬鐢熶骇鐜銆傚叾鐗堟湰鍙烽�氬父涓哄弻鏁帮紝濡� 1.26銆俵egacy versions
                     鍒欐槸涔嬪墠鍙戝竷鐨勭ǔ瀹氱増锛屽浜庨渶瑕�
@@ -179,11 +179,9 @@
               </a-checkbox-group>
             </div>
           </div>
+          <eidtDetails ref="eidtDil"></eidtDetails>
         </a-tab-pane>
       </a-tabs>
-
-
-
   </a-modal>
 </template>
 
@@ -192,10 +190,12 @@
 import { Message } from "@arco-design/web-vue";
 import {kbdocumentchangeparser} from "@/api/kbList";
 import addDetails from '@/views/dmx/knowledgeLib/addDetails.vue'
+import eidtDetails from '@/views/dmx/knowledgeLib/eidtDetails.vue'
 const visible = ref(false);
 const loading = ref(false);
 const radio = ref('1');
 const keyBg = ref('');
+const eidtDil = ref();
 
 const props =  defineProps(['kbtenantInfo','item','kbdetail'])
 // const emit =  defineEmits(['upTabdateItem'])
@@ -229,7 +229,6 @@
     '浠ヤ笂灏辨槸浣犻渶瑕佹�荤粨鐨勫唴瀹广��',
 });
 const formRef = ref(null);
-
 const rules = {
   prompt: [
     {
@@ -284,6 +283,9 @@
   visible.value = false;
 }
 
+const contentClick = (done) => {
+  eidtDil.value.handleClick();
+}
 const handleOpened =(el) => {
   // console.log('props',props.kbtenantInfo);
   // console.log('props',props.item);
@@ -296,6 +298,7 @@
   //   txt: '',// 澶囨敞
   // });
   // formRef.value.resetFields();
+  console.log(props.item.id);
 }
 
 

--
Gitblit v1.8.0