소스 검색

feat: 问题调整

sunxiao 10 달 전
부모
커밋
df0f5cebcb

+ 32 - 0
src/assets/styles/common.scss

@@ -152,6 +152,38 @@
 
 }
 
+.recode-card-item {
+  
+  &:hover, &_active {
+    border-radius: 2px;
+    background-color: #fff;
+    box-shadow: 0.5px 0.5px 4px 0px #93A1B233;
+    overflow: hidden;
+
+    .content {
+      color: #325DF3;
+    }
+
+    .del-icon {
+      display: block;
+
+      &:hover {
+        color: red;
+      }
+    }
+
+    &::before {
+      position: absolute;
+      top: 0;
+      left: 0px;
+      display: block;
+      content: " ";
+      width: 2px;
+      height: 100%;
+      background: #325DF3;
+    }
+  }
+}
 // pre code,
 // pre tt {
 //   line-height: 1.65;

+ 3 - 3
src/components/BaseInput/index.vue

@@ -13,10 +13,10 @@ const focusInput = _ => isFocusState.value = true;
 
 const blurInput = _ => isFocusState.value = false;
 
-const handleInpFocus = () => {
-  inputInstRef.value?.focus()
-}
 
+defineExpose({
+  handleInpFocus
+})
 </script>
 <template>
   <div class="chat-inp-inner border-[1px]" :class="[{ 'border-[#2454FF]': isFocusState }]">

+ 1 - 0
src/components/Chat/ChatInput.vue

@@ -63,6 +63,7 @@ const clearInpVal = () => {
 
 defineExpose({
   clearInpVal,
+  handleInpFocus,
   inpVal,
 })
 

+ 4 - 4
src/components/Layout/TheChatView.vue

@@ -52,12 +52,12 @@ defineExpose({ targetScrollDom });
 
 <template>
   <div class="flex-1 h-full chat-container">
-    <div class="chat-wrapper w-full h-full rounded-[20px]">
+    <div class="chat-wrapper w-full h-full flex flex-col rounded-[20px]">
       <div class="chat-header flex items-center justify-end py-[24px] pr-[18px] space-x-[16px]">
         <userTop></userTop>
       </div>
-      <main class="flex flex-col justify-between h-full m-auto chat-main"
-        :style="{ height: isFooter ? 'calc(100% - 212px)' : 'calc(100% - 100px)' }">
+      <!-- :style="{ minHeight: isFooter ? 'calc(100% - 310px)' : 'calc(100% - 100px)' }" -->
+      <main class="chat-main flex flex-1 flex-col justify-between m-auto">
         <div class="chat-scroll" ref="targetScrollDom">
           <!-- pb-[20px] -->
           <div class="w-[800px] m-auto ">
@@ -82,7 +82,7 @@ defineExpose({ targetScrollDom });
     background: linear-gradient(180deg, rgba(238, 253, 255, 0.5) 0%, rgba(231, 243, 252, 0.5) 100%);
 
     .chat-main {
-      height: calc(100% - 212px);
+      min-height: calc(100% - 310px);
       color: #1A2029;
 
       .chat-scroll {

+ 2 - 1
src/components/Layout/TheMenu.vue

@@ -59,7 +59,7 @@ const menuOptions = [
       {
         label: '预测报警',
         icon: renderChildrenIcon({ name: 'menu-analyse-notice' }),
-        key: 'key3',
+        key: 'normal',
       },
       {
         label: '智能工单',
@@ -82,6 +82,7 @@ const menuOptions = [
 
 const handleUpdateValue = (key, { url }) => {
   if (url) return window.open(url);
+  if (key == 'normal') return;
   router.push(key);
 }
 

+ 1 - 34
src/components/RecodeCardItem/index.vue

@@ -1,7 +1,7 @@
 <script setup>
 import { ref, computed } from 'vue';
 import { NPopconfirm, useMessage  } from 'naive-ui';
-import { chatApi } from "@/api/chat";
+
 import { SvgIcon } from '@/components';
 
 const props = defineProps({
@@ -19,12 +19,8 @@ const props = defineProps({
   }
 });
 
-const isOff = ref(false);
-
 const emit = defineEmits(['on-delete', 'on-click']);
 
-const message = useMessage();
-
 const handleCardClick = () => {
   emit('on-click', props.dataItem);
 }
@@ -57,34 +53,5 @@ const handleDelete = async () => {
     @include textLine(1);
   }
 
-  &:hover {
-    border-radius: 2px;
-    background-color: #fff;
-    box-shadow: 0.5px 0.5px 4px 0px #93A1B233;
-    overflow: hidden;
-
-    .content {
-      color: #325DF3;
-    }
-
-    .del-icon {
-      display: block;
-
-      &:hover {
-        color: red;
-      }
-    }
-
-    &::before {
-      position: absolute;
-      top: 0;
-      left: 0px;
-      display: block;
-      content: " ";
-      width: 2px;
-      height: 100%;
-      background: #325DF3;
-    }
-  }
 }
 </style>

+ 10 - 12
src/views/analyse/WaterView.vue

@@ -160,8 +160,6 @@ const handleOpenContent = async ({ id, category }) => {
 
     const answerObjItem = JSON.parse( item );
 
-    console.log( answerObjItem );
-
     if ( answerObjItem.biz === "DECISION_REPORT" ) {
       reportList.push(answerObjItem.message);
 
@@ -259,9 +257,11 @@ const handleOpenContent = async ({ id, category }) => {
     { label: '标准值',   realKey: '标准值', value: 'mg/L', isWarning: false },
     { label: '报警级别', realKey: '告警级别', value: '', isWarning: false },
     { label: '报警次数', realKey: '报警次数', value: '', isWarning: false },
+    { label: '数据来源', realKey: '数据来源', value: '', isWarning: false },
     { label: '状态',     realKey: '状态', value: '', isWarning: false }
   ]
 
+  basic['数据来源'] = '在线仪表';
 
   textDataSources.value = format.textSorting(basic, textWhiteList);
 
@@ -349,8 +349,8 @@ const onRegenerate = async () => {
   }
 
   try {
-    const res = await refetch(params);
-    console.log( "最终", res );
+    await refetch(params);
+
     const answerItem = answerResult.value[answerResult.value.length - 1];
     if (answerItem?.biz) {
       answerItem.loading = false;
@@ -364,9 +364,9 @@ const onRegenerate = async () => {
       answerResult.value.push(tempSimulate);
     }
     
-    // setTimeout(() => {
-    //   scrollToBottomIfAtBottom();
-    // }, 500)
+    setTimeout(() => {
+      scrollToBottomIfAtBottom();
+    }, 500)
   }
   catch(error) {
     console.log("exist error .....", error);
@@ -403,12 +403,12 @@ const handleSendSimulate = ({ simulate, table }) => {
   const len = answerResult.value.length;
 
   flowParams.simulate = simulate;
-  answerResult.value[len - 1].isDisable = false;
+  answerResult.value[len - 1].isDisable = true;
 
   answerResult.value.push({
     biz: 'DECISION_TABLE',
     loading: true,
-    delayLoading: true,
+    delayLoading: false,
     table,
     isDisable: false
   })
@@ -421,7 +421,6 @@ const handleWelcomeRecommend = question => {
   chatStore.setChatQuestion(question);
   router.push('/answer');
 }
-
 </script>
 
 <template>
@@ -449,7 +448,6 @@ const handleWelcomeRecommend = question => {
     </TheSubMenu>
 
     <TheChatView ref="scrollRef" :is-footer="false">
-
       <ChatWelcome title="您好,我是LibraAI工艺管控助手" card-title="常见处理方案:"
         :sub-title="[
           '水质报警功能针对五大核心指标实时监测,发现异常后将推送给相关人员决策方案',
@@ -574,7 +572,7 @@ const handleWelcomeRecommend = question => {
         :delay-loading="answerLoading"
         :toggleVisibleIcons="false"
         v-show="answerLoading"
-        loadingText="内容生成中123,大概需要50秒..."
+        loadingText="内容生成中,大概需要50秒..."
       ></ChatAnswer>
     </TheChatView>
   </section>

+ 15 - 2
src/views/analyse/WorkOrder.vue

@@ -21,6 +21,7 @@ const switchActive = ref(false);
 
 const isLoading = ref(false);
 const inputRef = ref(null);
+const recordActive = ref(null);
 
 const currenSessionId = ref(null);
 
@@ -39,6 +40,8 @@ const handleCreateDialog = async () => {
   }
 
   currenSessionId.value = null;
+  
+  recordActive.value = null;
 
   clearChat();
 }
@@ -49,6 +52,8 @@ const handleChatDetail = async ({ sessionId }) => {
 
   controller.abort();
 
+  recordActive.value = sessionId;
+
   const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
 
   chatDataSource.value = data.map(item => ({ ...item, loading: false,  }));
@@ -171,8 +176,16 @@ onUnmounted(() => {
       </template>
 
       <div class="pr-[4px] text-[#5e5e5e]">
-        <RecodeCardItem v-for="item, index in recordList" :key="item.sessionId + index" :title="item.showVal"
-          :time="item.createTime" :data-item="item" @on-click="handleChatDetail" @on-delete="handeChatDelete" />
+        <RecodeCardItem
+          v-for="item, index in recordList" 
+          :key="item.sessionId + index"
+          :title="item.showVal"
+          :time="item.createTime"
+          :data-item="item"
+          :class="{'recode-card-item_active': recordActive === item.sessionId}"
+          @on-click="handleChatDetail"
+          @on-delete="handeChatDelete"
+        />
       </div>
     </TheSubMenu>
 

+ 25 - 11
src/views/analyse/components/CustomModal.vue

@@ -22,12 +22,26 @@ const simulateData = computed(() => {
 
   usefulkeys.forEach(key => {
     const tempArr = data[key];
-
     resultObj[key] = tempArr.map(item => {
+
+      // MLSS   r  mlss 和内回流比是整数
+
+      let numVal = '';
+      const keyWhiteList = ['MLSS', 'r']
+      const numDigit = keyWhiteList.includes(item.name) ? 0 : 2;
+
+
+      if (Array.isArray( item.value )) {
+        numVal = item.value.map(n => Number(n).toFixed(numDigit));
+      } else {
+        numVal = Number(item.value).toFixed(numDigit);
+      }
+
       return {
         ...item,
+        value: numVal,
         label: SIMULATE_ENUM[item.name],
-        inpVal: Array.isArray( item.value ) ? item.value.join() : item.value,
+        inpVal: Array.isArray( item.value ) ? item.value.join(", ") : item.value,
         errMsg: ''
       }
     })
@@ -52,15 +66,15 @@ const handleStartReport = () => {
   usefulkeys.forEach(key => {
     simulateData.value[key].forEach(item => {
       
-      simulate[item.name] = Array.isArray(item.value) ? item.inpVal.split(",") : item.inpVal;
+      simulate[item.name] = Array.isArray(item.value) ? item.inpVal.split(",").map(n => Number(n)) : item.inpVal;
 
-      table.header.push(item.label);
-      table.body.push(item.inpVal);
+      if (key === 'on') {
+        table.header.push(item.label);
+        table.body.push(item.inpVal);
+      }
     })
   })
   
-  console.log( simulateData.value );
-  console.log( simulate );
   handleCancel();
   emit('on-submit', { simulate: JSON.stringify(simulate), table })
   console.log( "result", JSON.stringify(simulate), table );
@@ -76,8 +90,8 @@ const handleStartReport = () => {
     :maskClosable="false"
   >
     <div class="modal-wrapper">
-      <p class="header mb-[16px] font-bold text-[16px] leading-[22px]">水质预测 - 出水氨氮</p>
-      <div class="content-card mb-[8px]">
+      <p class="header mb-[16px] font-bold text-[16px] leading-[22px]">水质预测-好氧硝酸盐</p>
+      <div class="content-card mb-[20px]">
         <p class="mb-[10px] font-bold text-[14px] leading-[20px]">可调参数</p>
         <ul class="inp-group grid grid-cols-2 gap-x-[24px]  gap-y-[8px]">
           <li
@@ -91,7 +105,7 @@ const handleStartReport = () => {
         </ul>
       </div>
 
-      <div class="content-card mb-[20px]">
+      <!-- <div class="content-card mb-[20px]">
         <p class="mb-[10px] font-bold text-[14px] leading-[20px]">相关参数</p>
         <ul class="grid grid-cols-2 gap-x-[24px]  gap-y-[10px]">
           <li class="space-x-[8px]" v-for="item,index in simulateData.off" :key="index">
@@ -101,7 +115,7 @@ const handleStartReport = () => {
             </span>
           </li>
         </ul>
-      </div>
+      </div> -->
 
       <div class="footer flex items-center justify-between">
         <p>*红色数字为建议调整数值</p>

+ 12 - 12
src/views/analyse/components/config.js

@@ -1,15 +1,15 @@
 export const SIMULATE_ENUM = {
-  COD_in:       '进水COD',
-  DO_O:         '好氧池DO (#1 #2)',
-  MLSS:         'MLSS (#1 #2)',
-  Q_in:         '进水流量',
-  tyjyl:        '碳源药剂投加量',
-  r:            '内回流比(#1 #2)',
-  cltjl:        '除磷药剂投加量',
+  COD_in:       '进水COD mg/L',
+  DO_O:         '好氧池末端DO (#1 #2) mg/L',
+  MLSS:         'MLSS (#1 #2) mg/L',
+  Q_in:         '进水流量 m3/h',
+  tyjyl:        '碳源药剂投加量 m³/h',
+  r:            '内回流比(#1 #2) %',
+  cltjl:        '除磷药剂投加量m³/h',
   gwnl:         '干污泥量',
-  hycxsy_all:   '好氧硝酸盐(#1 #2)',
-  qyan_all:     '缺氧氨氮(#1 #2)',
-  qyckxsy_all:  '缺氧硝酸盐',
-  T:            '水温',
+  hycxsy_all:   '好氧硝酸盐(#1 #2) mg/L',
+  qyan_all:     '缺氧氨氮(#1 #2) mg/L',
+  qyckxsy_all:  '缺氧硝酸盐 mg/L',
+  T:            '水温',
   pH:           'pH'
-}
+}

+ 7 - 0
src/views/answer/AnswerView.vue

@@ -25,6 +25,7 @@ const switchActive = ref(false);
 
 const isLoading = ref(false);
 const inputRef = ref(null);
+const recordActive = ref(null);
 
 const currenSessionId = ref(null);
 
@@ -46,6 +47,8 @@ const handleCreateDialog = async () => {
 
   currenSessionId.value = null;
 
+  recordActive.value = null;
+
   clearChat();
 }
 
@@ -53,7 +56,10 @@ const handleCreateDialog = async () => {
 const handleChatDetail = async ({ sessionId }) => {
   isLoading.value = false;
 
+  recordActive.value = sessionId;
+
   controller.abort();
+  inputRef.value.clearInpVal();
 
   const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
 
@@ -184,6 +190,7 @@ onUnmounted(() => {
           :title="item.showVal"
           :time="item.createTime"
           :data-item="item"
+          :class="{'recode-card-item_active': recordActive === item.sessionId}"
           @on-click="handleChatDetail"
           @on-delete="handeChatDelete"
         />

+ 15 - 4
src/views/helper/HelperView.vue

@@ -12,7 +12,6 @@ const ANSWER_ID_KEY = '@@id@@';
 
 let controller = new AbortController();
 
-// TODO: 如果这里的key不一样,将会在拆一层组件出来 - list
 const { recordList, isFetching, onScrolltolower, onReset, addHistoryRecord } = useInfinite('/front/bigModel/qa/pageList', { module: 2 });
 const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
 const { chatDataSource, addChat, updateChat, clearChat, updateById } = useChat();
@@ -24,6 +23,7 @@ const switchActive = ref(false);
 
 const isLoading = ref(false);
 const inputRef = ref(null);
+const recordActive = ref(null);
 
 const currenSessionId = ref(null);
 
@@ -43,6 +43,8 @@ const handleCreateDialog = async () => {
 
   inputRef.value.clearInpVal();
 
+  recordActive.value = null;
+
   currenSessionId.value = null;
 
   clearChat();
@@ -52,6 +54,10 @@ const handleCreateDialog = async () => {
 const handleChatDetail = async ({ sessionId }) => {
   isLoading.value = false;
 
+  recordActive.value = sessionId;
+  
+  inputRef.value.clearInpVal();
+
   controller.abort();
 
   const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
@@ -59,6 +65,8 @@ const handleChatDetail = async ({ sessionId }) => {
   chatDataSource.value = data.map(item => ({ ...item, loading: false,  }));
   currenSessionId.value = sessionId;
 
+
+
   scrollToBottom();
 }
 
@@ -143,7 +151,9 @@ const handleSubmit = async (question, realQuestion = '') => {
 
 // 处理推荐问题
 const handleWelcomeRecommend = ({ content }) => {
+  console.log( inputRef.value )
   inputRef.value.inpVal = content;
+  inputRef.value.handleInpFocus();
 }
 
 // 删除历史对话
@@ -179,6 +189,7 @@ onUnmounted(() => {
           :title="item.showVal"
           :time="item.createTime"
           :data-item="item"
+          :class="{'recode-card-item_active': recordActive === item.sessionId}"
           @on-click="handleChatDetail"
           @on-delete="handeChatDelete"
         />
@@ -202,7 +213,8 @@ onUnmounted(() => {
               @click="handleWelcomeRecommend(item)"
             >
               <div class="grid-item-icon space-x-[8px]">
-                <SvgIcon name="tool-report" size="24"></SvgIcon>
+                <img :src="item.banner" alt="" class="w-[24px]">
+                <!-- <SvgIcon name="tool-report" size="24"></SvgIcon> -->
                 <h3 class="grid-item-title">{{item.title}}</h3>
               </div>
               <div class="text-[#5E5E5E] mt-[8px] text-justify">
@@ -250,7 +262,6 @@ onUnmounted(() => {
 <style scoped lang="scss">
 .grid-container{
 	position: relative;
-	// height: calc(100vh - 460px);
   padding-bottom: 20px;
   margin-top: 36px;
 	overflow: hidden;
@@ -273,7 +284,6 @@ onUnmounted(() => {
 			padding: 16px;
 			margin-bottom: 16px;
 			border-radius: 10px;
-			box-shadow: 0 2px 4px rgba(0,0,0,0.08);
 			background-color: #fff;
 			-webkit-column-break-inside: avoid;
 			break-inside: avoid;
@@ -282,6 +292,7 @@ onUnmounted(() => {
 
       &:hover {
         border:1px solid #2454FF;
+        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
       }
 
 			.grid-item-icon{