Parcourir la source

Merge branch '2025-02-24/fetaure-RemoveFiled'

sunxiao il y a 4 semaines
Parent
commit
f2f3406999

+ 0 - 1
src/utils/format.js

@@ -1,7 +1,6 @@
 import dayjs from "dayjs";
 import { ORDER_OPTION_ENUM } from "./enum";
 
-
 export const formatToData = ({ dataSource, warnKey, isNoUnit, statusVal }) => {
   const reuslt = {
     title: dataSource?.title,

+ 1 - 1
src/utils/request.ts

@@ -143,5 +143,5 @@ export const streamHttp  = new Request({
 
 export default new Request({
   baseURL,
-  timeout: 20 * 1000
+  timeout: 30 * 1000
 });

+ 12 - 1
src/views/analyse/PymolView.vue

@@ -37,7 +37,7 @@ const onChangeTabs = warningStatus => {
 }
 
 // 打开详情
-const handleOpenContent = async ({ id, reason:title }) => {
+const handleOpenContent = async ({ id, reason:title, counts }) => {
   const { data } = await waterApi.getWaringDetails(id);
   const showVal = JSON.parse(data.showVal);
   const { basic, jsData, csData } = showVal;
@@ -53,6 +53,17 @@ const handleOpenContent = async ({ id, reason:title }) => {
     statusVal: !!warningActive.value ? '系统关闭' : basic['状态']
   });
 
+  /**
+   * 临时修改 - 后续需要删除
+   * */ 
+   textDataSources.value = {
+    ...textDataSources.value,
+    list: textDataSources.value.list.map(item => {
+      if (item.label === '持续时间') item.value = counts;
+      return item
+    })
+  }
+
   jsTableData.value = [jsData];
   csTableData.value = [csData];
 

+ 217 - 98
src/views/analyse/WaterView.vue

@@ -13,7 +13,7 @@ import { formatToData } from "@/utils/format";
 
 import { waterApi } from '@/api/water';
 
-const { recommendList } = useRecommend({type: 1});
+const { recommendList } = useRecommend({ type: 1 });
 const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
 const { refetch, cancelFetch } = useFetchStream("/grpc/decisionStream", { methdos: 'POST' }, false);
 
@@ -54,18 +54,156 @@ const options = [
   { label: '出水', value: 1 }
 ]
 
+const mockData = [
+  {
+    "createBy": "task-job",
+    "createTime": "2025-02-22 18:08",
+    "updateBy": "task-job",
+    "updateTime": "2025-02-23 09:08",
+    "remark": "0",
+    "id": 4287,
+    "type": 0,
+    "category": "进水SS",
+    "time": "2025-02-23 08:08",
+    "reason": "进水SS超标报警",
+    "warningVal": 900,
+    "designVal": 315,
+    "controlVal": null,
+    "forecastVal": null,
+    "functionWay": 0,
+    "level": "一级",
+    "status": 2,
+    "isEmergency": 0,
+    "offTime": "2025-02-23 09:08:00",
+    "operator": null,
+    "review": null,
+    "useRecommend": null,
+    "waterType": 0,
+    "symbol": 0,
+    "cwrwxz": 2.8571,
+    "cwrwfhz": 2.1813,
+    "delFlag": 0,
+    "revision": 15,
+    "counts": "2",
+    "warningValStr": null,
+    "warningStatus": null,
+    "symbolDesc": "超标准值"
+  },
+  {
+    "createBy": "task-job",
+    "createTime": "2025-02-22 19:08",
+    "updateBy": "task-job",
+    "updateTime": "2025-02-22 22:08",
+    "remark": "0",
+    "id": 4289,
+    "type": 0,
+    "category": "出水总氮",
+    "time": "2025-02-22 21:08",
+    "reason": "出水总氮超管控报警",
+    "warningVal": 12.58,
+    "designVal": 15,
+    "controlVal": 12,
+    "forecastVal": null,
+    "functionWay": 0,
+    "level": "三级",
+    "status": 2,
+    "isEmergency": 0,
+    "offTime": "2025-02-22 22:08:00",
+    "operator": null,
+    "review": null,
+    "useRecommend": null,
+    "waterType": 1,
+    "symbol": 1,
+    "cwrwxz": 1.0699,
+    "cwrwfhz": 0.282,
+    "delFlag": 0,
+    "revision": 3,
+    "counts": "4",
+    "warningValStr": null,
+    "warningStatus": null,
+    "symbolDesc": "超管控值"
+  },
+  {
+    "createBy": "task-job",
+    "createTime": "2025-02-20 03:08",
+    "updateBy": "task-job",
+    "updateTime": "2025-02-20 08:08",
+    "remark": "0",
+    "id": 4256,
+    "type": 0,
+    "category": "进水SS",
+    "time": "2025-02-20 07:08",
+    "reason": "进水SS超标报警",
+    "warningVal": 900,
+    "designVal": 315,
+    "controlVal": null,
+    "forecastVal": null,
+    "functionWay": 0,
+    "level": "一级",
+    "status": 2,
+    "isEmergency": 0,
+    "offTime": "2025-02-20 08:08:20",
+    "operator": null,
+    "review": null,
+    "useRecommend": null,
+    "waterType": 0,
+    "symbol": 0,
+    "cwrwxz": 1.0698,
+    "cwrwfhz": 0.6046,
+    "delFlag": 0,
+    "revision": 5,
+    "counts": "2",
+    "warningValStr": null,
+    "warningStatus": null,
+    "symbolDesc": "超标准值"
+  },
+  {
+    "createBy": "task-job",
+    "createTime": "2025-02-19 17:08",
+    "updateBy": "task-job",
+    "updateTime": "2025-02-19 21:08",
+    "remark": "0",
+    "id": 4247,
+    "type": 0,
+    "category": "进水总磷",
+    "time": "2025-02-19 20:08",
+    "reason": "进水总磷超标报警",
+    "warningVal": 8.32,
+    "designVal": 7.1,
+    "controlVal": null,
+    "forecastVal": null,
+    "functionWay": 0,
+    "level": "一级",
+    "status": 2,
+    "isEmergency": 0,
+    "offTime": "2025-02-19 21:08:20",
+    "operator": null,
+    "review": null,
+    "useRecommend": null,
+    "waterType": 0,
+    "symbol": 0,
+    "cwrwxz": 1.1554,
+    "cwrwfhz": 0.7731,
+    "delFlag": 0,
+    "revision": 4,
+    "counts": "2",
+    "warningValStr": null,
+    "warningStatus": null,
+    "symbolDesc": "超标准值"
+  },
+]
 watch(() => waterTypeValue.value, curValue => {
   onRestore({ warningStatus: warningActive.value, waterType: curValue });
 })
 
 const handleModelVisible = () => {
   visible.value = true;
-} 
+}
 
 const resetConfiguration = () => {
   /**
    * 临时这样,后续统一处理
-   * */ 
+   * */
   textDataSources.value = '';
 
   answerLoading.value = false;
@@ -82,9 +220,10 @@ const resetConfiguration = () => {
 /**
  * 报警详情
 */
-const handleOpenContent = async ({ id, category, reason:title }) => {
+const handleOpenContent = async (item) => {
+  const { id, category, reason: title, counts } = item;
+  if (id == flowParams.warningId) return;
 
-  if ( id == flowParams.warningId ) return;
 
   flowParams.category = category;
   flowParams.warningId = id;
@@ -92,7 +231,7 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   flowParams.simulate = '{}';
 
   answerLoading.value = false;
-  
+
   answerResult.value = [];
 
   const { data } = await waterApi.getWaringDetails(id);
@@ -104,10 +243,10 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
     const reportList = [];
     const alertList = [];
     let simulateObj = null;
-  
+
     answer.map(item => {
       const answerObjItem = JSON.parse(item);
-      switch(answerObjItem.biz) {
+      switch (answerObjItem.biz) {
         case "DECISION_REPORT":
           reportList.push(answerObjItem.message);
           break
@@ -115,7 +254,7 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
           alertList.push(answerObjItem);
           break
         case "DECISION_SIMULATE":
-          if (warningActive.value === 1) return; 
+          if (warningActive.value === 1) return;
           const { off, on, pred } = JSON.parse(answerObjItem.message);
           simulateObj = {
             biz: 'DECISION_SIMULATE',
@@ -128,7 +267,7 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
       }
     })
 
-    if ( reportList.length ) {
+    if (reportList.length) {
       answerResult.value.push({
         biz: 'DECISION_REPORT',
         answer: reportList.join(""),
@@ -137,8 +276,8 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
       })
     }
 
-    if ( alertList.length ) {
-      const [ parseAnswer ] = alertList.map(item => {
+    if (alertList.length) {
+      const [parseAnswer] = alertList.map(item => {
         item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
         return item;
       })
@@ -154,7 +293,7 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
     if (simulateObj) {
       answerResult.value.push(simulateObj);
     }
-    
+
   } catch (error) {
     answerResult.value.push({
       biz: 'DECISION_REPORT',
@@ -171,7 +310,7 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
   // const reportList = [];
   // const alertList = [];
   // let simulateObj = null;
- 
+
   // answer.map(item => {
   //   const answerObjItem = JSON.parse(item);
   //   switch(answerObjItem.biz) {
@@ -229,6 +368,18 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
     warnKey: '报警值',
     statusVal: !!warningActive.value ? '系统关闭' : basic['状态']
   });
+
+  /**
+   * 临时修改 - 后续需要删除
+   * */
+  textDataSources.value = {
+    ...textDataSources.value,
+    list: textDataSources.value.list.map(item => {
+      if (item.label === '持续时间') item.value = counts;
+      return item
+    })
+  }
+
   jsTableData.value = [jsData];
   csTableData.value = [csData];
 
@@ -243,12 +394,12 @@ const onChangeTabs = warningStatus => {
 
 // 生成流数据
 const onRegenerate = async () => {
-  
+
   answerLoading.value = true;
 
   const len = answerResult.value.length ? answerResult.value.length : 0;
 
-  const tempReport = { 
+  const tempReport = {
     biz: 'DECISION_REPORT',
     answer: '',
     loading: true,
@@ -257,15 +408,15 @@ const onRegenerate = async () => {
 
   let tempSimulate = null;
 
-  answerLoading.value = answerResult.value[len - 1 ].biz !== 'DECISION_TABLE';
+  answerLoading.value = answerResult.value[len - 1].biz !== 'DECISION_TABLE';
 
   const feedback = flowParams.feedback
 
   const params = {
     body: JSON.stringify({ ...flowParams, feedback: JSON.stringify(feedback) }),
-    errorHandler: () => {},
+    errorHandler: () => { },
     successHandler: data => {
-      
+
       const item = JSON.parse(data);
 
       answerLoading.value = false;
@@ -275,7 +426,7 @@ const onRegenerate = async () => {
         tempReport.delayLoading = false;
         answerResult.value[len] = { ...tempReport };
       }
-      
+
       if (item.biz === 'DECISION_ALERT') {
         const list = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
         answerResult.value.push({
@@ -289,7 +440,7 @@ const onRegenerate = async () => {
 
       if (item.biz === 'DECISION_SIMULATE') {
         const lastAnswerItem = answerResult.value[len - 1];
-        if ( lastAnswerItem.biz === 'DECISION_TABLE' ) {
+        if (lastAnswerItem.biz === 'DECISION_TABLE') {
           answerResult.value[len - 1] = {
             ...lastAnswerItem,
             content: JSON.parse(item.message).pred.join(", ")
@@ -328,12 +479,12 @@ const onRegenerate = async () => {
     if (tempSimulate) {
       answerResult.value.push(tempSimulate);
     }
-    
+
     setTimeout(() => {
       scrollToBottomIfAtBottom();
     }, 500)
   }
-  catch(error) {
+  catch (error) {
     console.log("exist error .....", error);
   }
 }
@@ -342,21 +493,21 @@ const onRegenerate = async () => {
 const handlerAlertOptions = (item, val, index) => {
   const { list, isAllSelect } = item;
 
-  if ( isAllSelect ) return;
+  if (isAllSelect) return;
 
   val.isActive = index;
 
   const isExists = list.find(({ isActive }) => isActive === null);
 
-  if ( !isExists ) {
-    item.isAllSelect = true; 
+  if (!isExists) {
+    item.isAllSelect = true;
 
     const result = item.list
-    .map(({ id, options, isActive }) => ({ [id]: options[isActive] }))
-    .reduce((accumulator, currentValue) => {
-      Object.keys(currentValue).forEach(key => accumulator[key] = currentValue[key]);
-      return accumulator;
-    }, {});
+      .map(({ id, options, isActive }) => ({ [id]: options[isActive] }))
+      .reduce((accumulator, currentValue) => {
+        Object.keys(currentValue).forEach(key => accumulator[key] = currentValue[key]);
+        return accumulator;
+      }, {});
 
     const newResult = { ...flowParams.feedback, ...result };
     flowParams.feedback = newResult;
@@ -401,7 +552,7 @@ const handleWelcomeRecommend = question => {
             <n-tab name="thebeatles" tab="历史报警" @click="onChangeTabs(1)"></n-tab>
           </n-tabs>
           <div class="select-card">
-            <n-select v-model:value="waterTypeValue" :options="options" size="tiny"/>
+            <n-select v-model:value="waterTypeValue" :options="options" size="tiny" />
           </div>
         </div>
       </template>
@@ -409,31 +560,26 @@ const handleWelcomeRecommend = question => {
       <div class="px-[12px] py-[14px] text-[#5e5e5e]">
         <p v-show="!recordList.length" class="pt-[30px] text-[12px] text-[#999] text-center">暂无报警数据</p>
         <div class="grid grid-cols-1 gap-[12px]">
-          <RecodeSquareCardItem
-            v-for="item in recordList"
-            :key="item.id"
-            :item="item"
-            @on-click="handleOpenContent"
-          />
+          <div v-show="warningActive == 1">
+            <RecodeSquareCardItem v-for="item, index in mockData" :key="item.id" :item="item"
+              @on-click="handleOpenContent" :style="{ marginBottom: index < 3 ? '10px' : '' }" />
+          </div>
+          <RecodeSquareCardItem v-for="item in recordList" :key="item.id" :item="item" @on-click="handleOpenContent" />
         </div>
       </div>
     </TheSubMenu>
 
     <TheChatView ref="scrollRef" :is-footer="false">
-      <ChatWelcome title="您好,我是LibraAI工艺管控助手" card-title="常见处理方案:"
-        :sub-title="[
-          '水质报警功能针对五大核心指标实时监测,发现异常后将推送给相关人员决策方案',
-          '报警时间为每小时警报,请大家及时处理'
-        ]" 
-        :card-content="recommendList"
-        @on-click="handleWelcomeRecommend"
-        v-if="!textDataSources"
-      />
+      <ChatWelcome title="您好,我是LibraAI工艺管控助手" card-title="常见处理方案:" :sub-title="[
+        '水质报警功能针对五大核心指标实时监测,发现异常后将推送给相关人员决策方案',
+        '报警时间为每小时警报,请大家及时处理'
+      ]" :card-content="recommendList" @on-click="handleWelcomeRecommend" v-if="!textDataSources" />
       <ChatBaseCard v-if="textDataSources">
         <div class="waring-answer-wrapper">
           <dl class="message-inner warning-info_medium ">
             <dt class="mb-[2px] font-bold text-[#1A2029]">{{ textDataSources?.title }}</dt>
-            <dd v-for="item, index in textDataSources?.list" :key="index"><span :class="{'text-[#F44C49]': item.isWarning}">{{ item.label }}: {{ item.value }}</span></dd>
+            <dd v-for="item, index in textDataSources?.list" :key="index"><span
+                :class="{ 'text-[#F44C49]': item.isWarning }">{{ item.label }}: {{ item.value }}</span></dd>
           </dl>
           <div class="table-inner">
             <div class="warning-table mb-[8px]">
@@ -455,33 +601,22 @@ const handleWelcomeRecommend = question => {
           </div>
         </div>
       </ChatBaseCard>
-  
-      <section v-for="item,index in answerResult" :key="index">
+
+      <section v-for="item, index in answerResult" :key="index">
         <template v-if="item.biz === 'DECISION_REPORT'">
-          <ChatAnswer
-            :loading="item.loading"
-            :delay-loading="item.delayLoading"
-            :toggleVisibleIcons="false"
-            :content="item.answer"
-          ></ChatAnswer>
+          <ChatAnswer :loading="item.loading" :delay-loading="item.delayLoading" :toggleVisibleIcons="false"
+            :content="item.answer"></ChatAnswer>
         </template>
-        
+
         <template v-if="item.biz === 'DECISION_ALERT'">
-          <ChatBaseCard
-            :loading="item.loading"
-            :delay-loading="item.delayLoading"
-            :toggleVisibleIcons="false"
-          >
+          <ChatBaseCard :loading="item.loading" :delay-loading="item.delayLoading" :toggleVisibleIcons="false">
             <p class="mb-[15px] font-bold text-[#1A2029]">需要确定以下问题,完成决策方案:</p>
             <ul class="radio-wrapper space-y-[14px]">
-              <li class="flex items-center" v-for="val,i in item.list" :key="i">
+              <li class="flex items-center" v-for="val, i in item.list" :key="i">
                 <p class="mr-[14px]">{{ val.mainContent }}</p>
                 <p class="radio-btn-group space-x-[14px]">
-                  <span
-                    v-for="option,index in val.options"
-                    :class="['radio-btn', { active: val.isActive === index }]"
-                    @click="handlerAlertOptions(item, val, index)"
-                  >{{ option }}</span>
+                  <span v-for="option, index in val.options" :class="['radio-btn', { active: val.isActive === index }]"
+                    @click="handlerAlertOptions(item, val, index)">{{ option }}</span>
                 </p>
               </li>
             </ul>
@@ -493,21 +628,14 @@ const handleWelcomeRecommend = question => {
             px-[30px] py-[10px] mb-[20px]
             rounded-[8px] 
             bg-white text-[13px] 
-            text-[#5E5E5E] hover:text-[#2454FF]"
-            :disabled="item.isDisable"
-            @click="handleModelVisible"
-          >
+            text-[#5E5E5E] hover:text-[#2454FF]" :disabled="item.isDisable" @click="handleModelVisible">
             水质预测推演
           </button>
         </template>
 
         <template v-if="item.biz === 'DECISION_TABLE'">
-          <ChatAnswer
-            :loading="item.loading"
-            :delay-loading="item.delayLoading"
-            :toggleVisibleIcons="false"
-            class="reset-chart"
-          >
+          <ChatAnswer :loading="item.loading" :delay-loading="item.delayLoading" :toggleVisibleIcons="false"
+            class="reset-chart">
             <div class="markdown-body text-[15px] break-all">
               <strong class="block mb-[16px]">推荐指标调整:</strong>
               <div class="custom-table-wrapper">
@@ -525,52 +653,43 @@ const handleWelcomeRecommend = question => {
                 </table>
               </div>
               <strong class="block mb-[16px]">预测推演结果:</strong>
-              <span>以上指标达成后,预计{{flowParams.category}}可达到:{{ item.content }}</span>
+              <span>以上指标达成后,预计{{ flowParams.category }}可达到:{{ item.content }}</span>
             </div>
           </ChatAnswer>
           <button class="
             px-[30px] py-[10px] mb-[20px]
             rounded-[8px]
             bg-white text-[13px]
-            text-[#5E5E5E] hover:text-[#2454FF]"
-            :disabled="item.isDisable"
-            @click="handleModelVisible"
-          >
+            text-[#5E5E5E] hover:text-[#2454FF]" :disabled="item.isDisable" @click="handleModelVisible">
             水质预测推演
           </button>
         </template>
       </section>
 
-      <ChatAnswer
-        :loading="answerLoading"
-        :delay-loading="answerLoading"
-        :toggleVisibleIcons="false"
-        v-show="answerLoading"
-        loadingText="内容生成中,大概需要1分钟..."
-      ></ChatAnswer>
+      <ChatAnswer :loading="answerLoading" :delay-loading="answerLoading" :toggleVisibleIcons="false"
+        v-show="answerLoading" loadingText="内容生成中,大概需要1分钟..."></ChatAnswer>
 
     </TheChatView>
   </section>
-  <CustomModal
-    v-model:visible="visible"
-    :current-data="modalData"
-    @on-submit="handleSendSimulate"
-    ></CustomModal>
+  <CustomModal v-model:visible="visible" :current-data="modalData" @on-submit="handleSendSimulate"></CustomModal>
 </template>
 
 <style lang="scss">
-  .reset-chart {
+.reset-chart {
   .markdown-body {
     .custom-table-wrapper {
       width: 100%;
       overflow: hidden;
       padding: 10px;
-      table td,  table th {
-        white-space: normal !important; 
+
+      table td,
+      table th {
+        white-space: normal !important;
       }
     }
   }
 }
+
 .select-card {
   padding: 15px 10px 0 10px;
 }

+ 1 - 1
src/views/answer/AnswerView.vue

@@ -116,7 +116,7 @@ const onRegenerate = async ({ showVal, question, realQuestion, tools, uploadFile
       module: 0,
       modelType: Number(unref(switchActive)),
       isStrong: Number(unref(switchActive)),
-      tools,
+      tools: tools ? tools : unref(switchActive) ? 'DEEPSEEK' : null,
       prompt: null
       // TODO: 后续大概率需要删除
       // topP: 0.9,

+ 6 - 6
src/views/data/config.js

@@ -16,12 +16,12 @@ export const columns = [
     width: 60,
     render: ({ testHour }) => dayjs(testHour).format("HH")
   },
-  {
-    title: "进水流量",
-    key: "jsll",
-    width: 100,
-    render: ({ jsll }) => formatTofixed(jsll)
-  },
+  // {
+  //   title: "进水流量",
+  //   key: "jsll",
+  //   width: 100,
+  //   render: ({ jsll }) => formatTofixed(jsll)
+  // },
   {
     title: "#1好氧池硝酸盐",
     key: "no3Hlj1Jqr",