Browse Source

Merge branch 'ch/eta_forum_3.0' of eta_forum/eta_forum_front into master

leichen 1 week ago
parent
commit
d8d7b6a64a

+ 1 - 1
README.md

@@ -1,3 +1,3 @@
-# ETA社区项目
+# ETA投研资源库项目
 1. 测试访问地址:http://8.136.199.33:8901/
 

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8" />
     <link rel="icon" type="image/x-icon" href="/fa.ico" id="icon"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>ETA社区</title>
+    <title>ETA投研资源库 </title>
   </head>
   <body>
     <div id="app"></div>

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
     "moment": "^2.30.1",
     "normalize.css": "^8.0.1",
     "tdesign-icons-vue-next": "^0.2.2",
-    "tdesign-vue-next": "^1.10.6",
+    "tdesign-vue-next": "^1.10.7",
     "vue": "^3.5.13",
     "vue-router": "^4.3.2"
   },

+ 5 - 3
src/api/etaChart/etaChart.js

@@ -22,7 +22,9 @@ export default{
     // 指标溯源
     getEdbSource:params=>{
         return get('/edb/trace',params)
-    }
-
-
+    },
+    // 指标溯源
+    getDescription:params=>{
+        return get('/chart/description',params)
+    },
 }

BIN
src/assets/imgs/clear.png


BIN
src/assets/imgs/logo.png


BIN
src/assets/imgs/logo_login.png


+ 6 - 3
src/layout/Index.vue

@@ -35,9 +35,9 @@ async function handleLoginOut(){
 								<span>|</span>
 								<span>{{userInfo?.Mobile}}</span>
 							</div>
-							<div class="flex">
+							<div class="business-name">
 								<span>{{userInfo?.BusinessName}}</span>
-								<span>|</span>
+								<span v-if="userInfo?.Position">|</span>
 								<span>{{userInfo?.Position}}</span>
 							</div>
 						</div>
@@ -68,7 +68,7 @@ async function handleLoginOut(){
 <style lang="scss">
 .header-userInfo-pop-wrap{
 	padding: 0;
-	width: 234px;
+	width: 300px;
 	border-radius: 8px;
 	border: 1px solid var(--border-color);
 	box-shadow: 0px 4px 12px 0px #0000001A;
@@ -86,6 +86,9 @@ async function handleLoginOut(){
 				gap: 0 5px;
 				margin-top: 5px;
 			}
+			.business-name > *  {
+				padding-right: 10px;
+			}
 		}
 		.my-fav-box{
 			border-bottom: 1px solid var(--border-color);

+ 1 - 1
src/router/index.js

@@ -20,7 +20,7 @@ const routes = [
     name:'Login',
     component:()=>import('@/views/Login.vue'),
     meta:{
-      title:'ETA社区'
+      title:'ETA投研资源库'
     },
   },
   {

+ 1 - 1
src/views/Login.vue

@@ -162,7 +162,7 @@ async function handleMobileVerifyCode(){
 					<t-button class="submit-btn" block shape="round" type="submit">登录</t-button>
 
         </t-form>
-				<p class="bottom-tips">共享社区资源,共创市场领先</p>
+				<p class="bottom-tips">共享投研资源,共创市场领先</p>
       </div>
     </div>
   </div>

+ 2 - 2
src/views/etaChart/Index.vue

@@ -84,7 +84,7 @@ function handleSelectChart(item) {
     <ClassifyWrap @filter="handleFilterList" @change="handleSelectChart" />
     <div class="center-wrap">
     <svg-icon name="show_arrow" class="show_chart_name_wrap_btn" v-if="!showChartNameWrap" @click="showChartNameWrap=true"></svg-icon>
-    <div :class="['flex chart-name-list-wrap',!showChartNameWrap?'chart-name-list-wrap_close':'']" v-loading="tableLoading">
+    <!-- <div :class="['flex chart-name-list-wrap',!showChartNameWrap?'chart-name-list-wrap_close':'']" v-loading="tableLoading">
       <div class="flex top-box">
         <span>所选图表</span>
         <t-icon name="chevron-left-double" style="font-size:20px;cursor: pointer;" @click="showChartNameWrap=false"></t-icon>
@@ -102,7 +102,7 @@ function handleSelectChart(item) {
         <span>共{{chartTotal}}张图表</span>
         <span class="clear-btn" @click="activeChartId=''">清除选择</span>
       </div>
-    </div>
+    </div> -->
     </div>
     <div class="right-wrap">
       <ChartList ref="chartListRef"/>

+ 60 - 6
src/views/etaChart/components/ChartWrap.vue

@@ -19,11 +19,12 @@ watch(
   () => props.chartInfoId,
   (n) => {
     tableData.value = []
-    intro.value = ''
+    intro.value = []
     chartInfo.value = null
     calendarType.value = ''
     if (!n) return
     getChartDetail()
+    getDescriptionList()
   }
 )
 
@@ -58,8 +59,25 @@ const columns = [
     align: 'center'
   }
 ]
+const columnsDescription = [
+  {
+    colKey: 'Description',
+    title: '逻辑描述',
+    align: 'center'
+  },
+  {
+    colKey: 'SysUserRealName',
+    title: '创建人',
+    align: 'center'
+  },
+  {
+    colKey: 'CreateTime',
+    title: '创建时间',
+    align: 'center'
+  },
+]
 const tableData = ref([])
-const intro = ref('')
+const intro = ref([])
 const chartInfo = ref(null)
 const calendarType = ref('')
 const loading = ref(false)
@@ -73,7 +91,6 @@ async function getChartDetail() {
   loading.value = false
   if (res.Ret === 200) {
     tableData.value = res.Data.EdbInfoList || []
-    intro.value = res.Data.ChartInfo.Description
     chartInfo.value = res.Data.ChartInfo
     calendarType.value = res.Data.ChartInfo.Calendar
     WaterMark.value=res.Data.WaterMark
@@ -98,7 +115,22 @@ async function getChartDetail() {
     })
   }
 }
+
+async function getDescriptionList() {
+  loading.value = true
+  const res = await apiETAChart.getDescription({
+    ChartInfoId: props.chartInfoId,
+  })
+  loading.value = false
+  if (res.Ret === 200) {
+    intro.value = res.Data.List || ''
+    console.log(res.Data.List);
+    
+  }
+}
+
 getChartDetail()
+getDescriptionList()
 
 
 // 跳转指标溯源
@@ -177,9 +209,24 @@ function handleGoEdbSource(data) {
         </template>
       </t-table>
     </div>
-    <div class="instructions-wrap" v-if="intro">
-      <p>逻辑简述:</p>
-      <p>{{ intro }}</p>
+    <div class="instructions-wrap" v-if="intro && intro.length">
+      <h3>逻辑描述:</h3>
+      <t-table
+        row-key="index"
+        :data="intro"
+        :columns="columnsDescription"
+        bordered
+        hover
+        max-height="300"
+        cell-empty-content="-"
+        resizable
+      >
+        <template #Description="{ row }">
+            <t-tooltip :content="row.Description" theme="light">
+              <span class="text_description">{{ row.Description }}</span>
+            </t-tooltip>
+        </template>
+      </t-table>
     </div>
   </div>
 </template>
@@ -218,6 +265,13 @@ function handleGoEdbSource(data) {
   .instructions-wrap {
     margin-top: 20px;
     line-height: 1.7;
+    .text_description {
+      width: 100%;
+      display: inline-block;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
   }
 }
 </style>

+ 171 - 42
src/views/etaChart/components/ClassifyWrap.vue

@@ -1,5 +1,5 @@
 <script setup>
-import { reactive, ref, watch } from 'vue'
+import { nextTick, reactive, ref, watch } from 'vue'
 import { SearchIcon, Icon } from 'tdesign-icons-vue-next';
 import { apiETAChart } from '@/api/etaChart'
 import { apiSystemCommon } from '@/api/system'
@@ -8,32 +8,33 @@ import { useClassify } from '../hooks/useClassify'
 const emits = defineEmits(['change', 'filter'])
 
 const { userVal } = useClassify()
-function handleUserChange(value,context) {
-  emits('filter')
-  getClassify()
-}
 
 const searchSelectKeys = {
   value: 'ChartInfoId',
   label: 'ChartName'
 }
+const expandedclassify = ref([])
 const searchVal = ref('')
 const searchOpts = ref([])
 const searchLoading = ref(false)
-let searchPage = 1
-const searchPageSize = 20
+let searchPage = ref(1)
+const searchPageSize = 15
 let finished = false
+const totals = ref(0)
+const showSearchResults = ref(false)
 function handleSearchChart(keyword) {
+  if (keyword === '' || keyword === null) return
   finished = false
-  searchPage = 1
+  searchPage.value = 1
   searchOpts.value = []
   handleGetSearchChartList(keyword)
 }
 async function handleGetSearchChartList(keyword) {
   searchLoading.value = true
+  showSuggestions.value = true
   const res = await apiETAChart.chartSearch({
     PageSize: searchPageSize,
-    CurrentIndex: searchPage,
+    CurrentIndex: searchPage.value,
     SysUserIds: userVal.value?.join(','),
     Keyword: keyword
   })
@@ -42,15 +43,32 @@ async function handleGetSearchChartList(keyword) {
     const arr = res.Data.List || []
     searchOpts.value = [...searchOpts.value, ...arr]
     finished = res.Data.Paging.IsEnd
+    totals.value = res.Data.Paging.Totals
+    if (searchOpts.value.length === 0 && searchPage.value === 1) {
+      showSuggestions.value = false
+    }
   }
 }
 async function handleLoadMoreChart() {
   if (finished || searchLoading.value) return
   handleGetSearchChartList()
 }
-function handleSelectChart(value, context) {
+function handleSelectChart(value) {
   if (value) {
-    emits('change', {ChartInfoId:value})
+    emits('change', value)
+    showSuggestions.value = false
+    const array = value.ClassifyLevels || []
+    array.forEach((element, index) => {
+      setTimeout(() => {
+        expandedclassify.value.push(element)
+        // 如果是最后一个元素,执行nextTick
+        if (index === array.length - 1) {
+          nextTick(() => {
+            classifyActived.value = [value.UniqueCode];
+          });
+        }
+      }, index*500);
+    });
   }
 }
 
@@ -116,46 +134,81 @@ function handleClassifyActiveChange({ node }) {
 }
 
 
+
+const showSuggestions = ref(false)
+
+
+const handleBlur = (text) => {
+  showSuggestions.value = false
+  if(!text){
+    clearMenu()
+  }
+}
+const clearMenu = () => {
+  searchOpts.value = []
+  showSearchResults.value = false
+}
+const handleEnterInput = () => {
+  showSuggestions.value = false
+  showSearchResults.value = true
+}
+const handleFocusInput = () => {
+  if(!searchVal.value) return
+  handleSearchChart(searchVal.value)
+}
+const clearInput = () => {
+  searchVal.value = ''
+  showSearchResults.value = false
+  handleSearchChart(searchVal.value)
+}
+const searchLoad = (e) => {
+  const {scrollTop, clientHeight, scrollHeight} = e.target
+  if (scrollTop + clientHeight === scrollHeight){
+    if(finished) return
+    searchPage.value++
+    handleGetSearchChartList()
+  }
+}
+
+
 </script>
 
 <template>
   <div class="bg-white classify-wrap">
-    <div class="select-wrap">
-      <select-chart-creator v-model="userVal" @change="handleUserChange"/>
-    </div>
-    <t-select
-      v-model="searchVal"
-      placeholder="请输入图表名称"
-      clearable
-      filterable
-      :keys="searchSelectKeys"
-      :loading="searchLoading"
-      @search="handleSearchChart"
-      @change="handleSelectChart"
-      :popup-props="{ 'on-scroll-to-bottom': handleLoadMoreChart }"
+    <t-popup
+      placement="bottom-left"
+      trigger="context-menu"
+      :visible="showSuggestions"
+      @on-scroll-to-bottom="handleLoadMoreChart"
     >
-      <template #prefixIcon>
-        <search-icon />
-      </template>
-
-      <template #valueDisplay="{ value,label }">
-        <div style="max-width:180px" class="t-input__inner" v-html="label" v-if="value"></div>
-      </template>
-        
-      <t-option 
-        v-for="item in searchOpts" 
-        :key="item.ChartInfoId" 
-        :value="item.ChartInfoId"
-        :label="item.ChartName"
-        :title="null"
+      <t-input
+        v-model="searchVal"
+        placeholder="请输入图表名称"
+        @change="handleSearchChart"
+        @blur="handleBlur"
+        @focus="handleFocusInput"
+        @enter="handleEnterInput"
       >
+      </t-input>
+      <template #content>
+        <li
+          v-for="(item, index) in searchOpts"
+          :key="index"
+          class="suggestions-item"
+          @click="handleSelectChart(item)"
+        >
         <span v-html="item.ChartName"></span>
-      </t-option>
-    </t-select>
-    <div class="classify-list-box">
+        </li>
+      </template>
+    </t-popup>
+
+
+    <div class="classify-list-box" ref="scrollView" @scroll="searchLoad">
       <t-tree
+        v-if="!showSearchResults"
         :actived="classifyActived"
         :data="classifyList"
+        v-model:expanded="expandedclassify"
         activable
         transition
         lazy
@@ -176,16 +229,44 @@ function handleClassifyActiveChange({ node }) {
           />
         </template>
       </t-tree>
+      <template v-else>
+        <div class="search-result flex-align">
+            <div>共<span class="total-text">{{ totals }}</span>条搜索结果</div>
+            <div @click="clearInput" class="clear-result flex-align">
+                清除内容
+                <img src="@/assets/imgs/clear.png" alt="">
+            </div>
+        </div>
+        <template v-for="(item, index) in searchOpts" :key="index">
+          <div class="list-item" @click="handleSelectChart(item)">
+            <div v-html="item.ChartName"></div>
+          </div>
+        </template>  
+      </template>
     </div>
   </div>
 </template>
 
 <style lang="scss" scoped>
+
+// 美化滚动条
+::-webkit-scrollbar {
+  width: 4px;
+  height: 4px;
+}
+
+::-webkit-scrollbar-track {
+  width: 1px;
+  background: rgba(#101F1C, 0.1);
+  -webkit-border-radius: 2em;
+  -moz-border-radius: 2em;
+  border-radius: 2em;
+}
+
 .classify-wrap {
   width: 300px;
   flex-shrink: 0;
   padding: 20px;
-
   .select-wrap {
     display: flex;
     gap: 0 10px;
@@ -195,6 +276,54 @@ function handleClassifyActiveChange({ node }) {
     padding-top: 10px;
     height: calc(100vh - 260px);
     overflow-y: auto;
+    .search-result {
+      font-family: PingFang SC;
+      font-size: 14px;
+      font-weight: 400;
+      line-height: 22px;
+      color: #999999;
+      justify-content: space-between;
+      margin-bottom: 20px;
+      .clear-result {
+        cursor: pointer;
+        img {
+          width: 16px;
+          height: 16px;
+          margin-left: 5px;
+        }
+      }
+      .total-text {
+        color: #333333;
+      }
+    }
+    .list-item {
+      width: 244px;
+      cursor:pointer;
+      margin: 4px;
+      padding: 5px 5px;
+      text-overflow: ellipsis;
+      overflow: hidden;
+      white-space: nowrap;
+      &:hover {
+        background-color: #ECF2FE; // 背景颜色变为浅灰色
+      }
+    }
   }
 }
+.suggestions-item {
+  width: 244px;
+  cursor:pointer;
+  margin: 4px;
+  padding: 5px 5px;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+  &:hover {
+    background-color: #ECF2FE; // 背景颜色变为浅灰色
+  }
+}
+.flex-align {
+  display: flex;
+  align-items: center;
+}
 </style>

+ 2 - 2
src/views/user/favorite/components/ClassifyWrap.vue

@@ -99,8 +99,8 @@ const showMoveChart=ref(false)
 
 <template>
   <div class="bg-white flex_col classify-wrap">
-    <h3 class="label-text">ETA社区图库</h3>
-    <div class="classify-tree">
+    <h3 class="label-text">ETA投研资源库</h3>
+    <div class="classify-tree"> 
       <t-tree
         ref="treeIns"
         :actived="[selecClassify]"

+ 1 - 1
src/views/user/favorite/components/CollectChart.vue

@@ -47,7 +47,7 @@ async function handleSave(){
   })
   if(res.Ret!==200) return
   show.value=false
-  if(res.Msg==='已收藏,可选择在ETA社区-我的收藏/ETA-我的图库中-ETA社区图库查看'){
+  if(res.Msg==='已收藏,可选择在ETA投研资源库-我的收藏/ETA-我的图库中-ETA投研资源库查看'){
     await $confirmDialog({
       header:'提示',
       body: res.Msg,

+ 1 - 1
src/views/user/favorite/components/MoveChart.vue

@@ -141,7 +141,7 @@ async function handleSave() {
     attach="body"
     width="850px"
     top="80px"
-    header="转移分类(ETA社区分类)"
+    header="转移分类(ETA投研资源库分类)" 
     closeOnOverlayClick
     destroyOnClose
     class="chart-move-pop"