From 475c0b3a4c0168df322f68a5ab82a28ec58f23e4 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期五, 30 八月 2024 14:57:28 +0800 Subject: [PATCH] 创建知识库 --- src/api/login/UserMenuData.ts | 15 +++ src/views/project/yw/dataManage/graph/AddGraph.vue | 3 src/views/project/yw/dataManage/knowledge/AddKnowledge.vue | 173 +++++++++++++++++++++++++++++++++++++++++++ customer_list/yw/static/config/route.js | 7 + 4 files changed, 196 insertions(+), 2 deletions(-) diff --git a/customer_list/yw/static/config/route.js b/customer_list/yw/static/config/route.js index 4086aea..6287f29 100644 --- a/customer_list/yw/static/config/route.js +++ b/customer_list/yw/static/config/route.js @@ -50,5 +50,12 @@ path: '/knowledge/knowledgeIndex', component: '/project/yw/dataManage/knowledge/Knowledge.vue', }, + { + name: 'AddKnowledge', + isKeepAlive: true, + isAffix: false, + path: '/knowledge/addKnowledge', + component: '/project/yw/dataManage/knowledge/AddKnowledge.vue', + }, //#endregion ]; diff --git a/src/api/login/UserMenuData.ts b/src/api/login/UserMenuData.ts index 0d97036..3fb1f55 100644 --- a/src/api/login/UserMenuData.ts +++ b/src/api/login/UserMenuData.ts @@ -139,6 +139,21 @@ SortCode: 2, Description: '', }, + { + Children: [], + ID: '1', + ParentID: '1742436890822447105', + Type: 2, + Name: '鍒涘缓鐭ヨ瘑搴�', + Path: '/knowledge/addKnowledge', + Permission: '', + Icon: 'ywifont ywicon-a-appround15', + IsIframe: false, + IsHide: true, + Weight: 0, + SortCode: 2, + Description: '', + }, ], }, ]; diff --git a/src/views/project/yw/dataManage/graph/AddGraph.vue b/src/views/project/yw/dataManage/graph/AddGraph.vue index 3becafb..071da94 100644 --- a/src/views/project/yw/dataManage/graph/AddGraph.vue +++ b/src/views/project/yw/dataManage/graph/AddGraph.vue @@ -73,9 +73,9 @@ <script setup lang="ts"> import type { UploadUserFile } from 'element-plus'; +import { ElMessage, ElMessage } from 'element-plus'; import { reactive, ref } from 'vue'; import { useRouter } from 'vue-router'; - // 瀹氫箟鍙橀噺鍐呭 const state = reactive({ detailTitle: '瀵煎叆鏁版嵁', @@ -171,4 +171,3 @@ box-sizing: border-box; } </style> -ElMessage, typeElMessage, typeElMessage, typeElMessage, typeElMessage, typeElMessage, typeElMessage, typeElMessage, typeElMessage, type diff --git a/src/views/project/yw/dataManage/knowledge/AddKnowledge.vue b/src/views/project/yw/dataManage/knowledge/AddKnowledge.vue new file mode 100644 index 0000000..071da94 --- /dev/null +++ b/src/views/project/yw/dataManage/knowledge/AddKnowledge.vue @@ -0,0 +1,173 @@ +<template> + <div class="h100 overflow-y-auto p-[16px]"> + <div class="mb-[10px] flex items-center"> + <el-button style="margin-left: 8px; width: 40px" text @click="handleExitFlow"> + <el-icon style="font-size: 24px !important"> + <ArrowLeft /> + </el-icon> + </el-button> + <span class="text-[24px] text-[#26244c] font-[700]">{{ state.detailTitle }}</span> + </div> + <div class="relative"> + <div class="relative transition-[opacity 0.3s]"> + <div class="set-form-height"> + <div class="flex flex-col"> + <el-form :model="state.categoryForm" label-width="120px" label-position="left"> + <el-form-item label="瀵煎叆绫荤洰:"> + <label>{{ state.categoryForm.ImportCategory }}</label> + </el-form-item> + <el-form-item label="绫荤洰绫诲瀷:"> + <label>{{ state.categoryForm.CategoryType }}</label> + </el-form-item> + <el-form-item label="瀵煎叆鏂瑰紡:"> + <el-upload + ref="uploadRef" + v-model:file-list="fileList" + class="upload-demo w-[530px]" + drag + :multiple="true" + :auto-upload="false" + :accept="state.allowType" + :limit="state.limit" + :before-upload="beforeAvatarUpload" + > + <el-icon class="el-icon--upload"><upload-filled /></el-icon> + <div class="el-upload__text"> + <em>鐐瑰嚮鎴栨嫋鎷戒笂浼犳枃浠�</em> + </div> + <template #tip> + <div class="el-upload__tip"> + 鏀寔鏍煎紡锛歿{ state.allowType }};闄愬埗澶у皬{{ state.size }}M,鏈�澶氫笂浼爗{ state.limit }}涓枃浠� + </div> + </template> + </el-upload> + </el-form-item> + <el-form-item label="鏂囨。璇嗗埆:"> + <div + class="bg-[#f6f5ff] border-[1px] border-solid border-[#0062be] py-[12px] w-[215px] px-[16px] rounded-lg cursor-pointer" + > + <el-radio-group v-model="state.categoryForm.DocumentRecognition"> + <el-radio value="1" size="large"> + <span class="font-[700] text[14px]">鏂囨。鏅鸿兘瑙f瀽</span> + </el-radio> + </el-radio-group> + <el-tooltip :content="state.demoDesc" placement="top" effect="light" popper-class="set_tooltip_demo"> + <div class="text-[#878aab] text-[12px] mx-0 mt-[2px] mb-0 set-desc"> + {{ state.demoDesc }} + </div> + </el-tooltip> + </div> + </el-form-item> + </el-form> + + <div class="set-form-footer"> + <el-button type="primary" @click="onSubmit">纭� 璁�</el-button> + <el-button>鍙栨秷</el-button> + </div> + </div> + </div> + </div> + </div> + </div> +</template> + +<script setup lang="ts"> +import type { UploadUserFile } from 'element-plus'; +import { ElMessage, ElMessage } from 'element-plus'; +import { reactive, ref } from 'vue'; +import { useRouter } from 'vue-router'; +// 瀹氫箟鍙橀噺鍐呭 +const state = reactive({ + detailTitle: '瀵煎叆鏁版嵁', + categoryForm: { + ImportCategory: '榛樿绫荤洰', + CategoryType: '鏈湴绫荤洰', + DocumentRecognition: '1', + }, + allowType: '.pdf,.doc,.docx,.txt,.md,.pptx,.ppt', + limit: 5, + size: 5, + demoDesc: '浣跨敤闃块噷浜戞枃妗f櫤鑳借В鏋愭湇鍔℃嵁瑙f瀽鏂囨。锛屾娊鍙栨枃妗e唴瀹广�佸眰绾х粨鏋勭瓑淇℃伅銆�', +}); +const fileList = ref<UploadUserFile[]>([]); +const router = useRouter(); +//杩斿洖 +const handleExitFlow = () => { + //鏄惁鏄剧ず杩斿洖 + router.back(); +}; +const flag = ref(true); +const beforeAvatarUpload = () => { + fileList.value.forEach((item: any) => { + console.log(item); + const type = item.name.split('.')[1]; + if (state.allowType.indexOf(type) == -1) { + ElMessage({ + type: 'error', + message: `鏍煎紡閿欒,鏀寔鏍煎紡:${state.allowType}!`, + }); + flag.value = false; + return; + } else if (item.size / 1024 / 1024 > state.size) { + ElMessage.error(`鏂囦欢鏈�澶�${state.size}MB!`); + flag.value = false; + return; + } + }); + return flag.value; +}; +//纭 +const onSubmit = () => {}; +</script> +<style scoped lang="scss"> +.set-form-height { + height: calc(100% - 62px); + background: #fff; + border-radius: 16px 16px 0 0; + flex: 1; + margin: 0 24px 64px; + overflow-y: auto; + padding: 20px; +} +.set-desc { + -webkit-line-clamp: 2; + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + word-break: break-word; + line-height: 1.5714285714285714; + font-family: PingFangSC; + box-sizing: border-box; +} +.set-form-footer { + align-items: center; + background: #fff; + bottom: 0; + box-shadow: 4px 0 5px 1px rgba(16, 9, 65, 0.06); + display: flex; + flex-shrink: 0; + gap: 8px; + height: 64px; + padding-left: 24px; + position: fixed; + width: 100%; + left: 220px; +} +</style> +<style> +.set_tooltip_demo { + max-width: 326px; + max-height: 150px; + min-width: 32px; + min-height: 32px; + padding: 6px 8px; + color: #26244c; + text-align: start; + text-decoration: none; + word-wrap: break-word; + background-color: #fff; + border-radius: 6px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); + box-sizing: border-box; +} +</style> -- Gitblit v1.9.3