Browse Source

1. 修改巷道阻变分析

hongrunxia 2 months ago
parent
commit
42d5e15523

+ 76 - 75
src/components/jeecg/OnLine/hooks/usePopBiz.ts

@@ -147,7 +147,7 @@ export function usePopBiz(ob, tableRef?) {
    */
   function filterUnuseSelect() {
     selectRows.value = unref(selectRows).filter((item) => {
-      let combineKey = combineRowKey(item);
+      const combineKey = combineRowKey(item);
       return unref(checkedKeys).indexOf(combineKey) >= 0;
     });
   }
@@ -157,7 +157,7 @@ export function usePopBiz(ob, tableRef?) {
    * @param key
    */
   function getRowByKey(key) {
-    let row = unref(dataSource).filter((record) => combineRowKey(record) === key);
+    const row = unref(dataSource).filter((record) => combineRowKey(record) === key);
     return row && row.length > 0 ? row[0] : '';
   }
 
@@ -177,18 +177,18 @@ export function usePopBiz(ob, tableRef?) {
    * 加载列信息
    */
   function loadColumnsInfo() {
-    let url = `${configUrl.getColumns}${props.code}`;
+    const url = `${configUrl.getColumns}${props.code}`;
     //缓存key
-    let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
+    const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
     httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
       if (res.success) {
         initDictOptionData(res.result.dictOptions);
         cgRpConfigId.value = res.result.cgRpConfigId;
         title.value = res.result.cgRpConfigName;
-        let currColumns = res.result.columns;
+        const currColumns = res.result.columns;
         for (let a = 0; a < currColumns.length; a++) {
           if (currColumns[a].customRender) {
-            let dictCode = currColumns[a].customRender;
+            const dictCode = currColumns[a].customRender;
             currColumns[a].customRender = ({ text }) => {
               return filterMultiDictText(unref(dictOptions)[dictCode], text + '');
             };
@@ -222,14 +222,14 @@ export function usePopBiz(ob, tableRef?) {
   function loadColumnsAndData() {
     // 第一次加载 置空isTotal 在这里调用确保 该方法只是进入页面后 加载一次 其余查询不走该方法
     pagination.isTotal = '';
-    let url = `${configUrl.getColumnsAndData}${props.id}`;
+    const url = `${configUrl.getColumnsAndData}${props.id}`;
     //缓存key
-    let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
+    const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
     httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
       if (res.success) {
         initDictOptionData(res.result.dictOptions);
         cgRpConfigId.value = props.id;
-        let { columns: metaColumnList, cgreportHeadName, fieldHrefSlots, isGroupTitle } = res.result;
+        const { columns: metaColumnList, cgreportHeadName, fieldHrefSlots, isGroupTitle } = res.result;
         title.value = cgreportHeadName;
         // href 跳转
         const fieldHrefSlotKeysMap = {};
@@ -269,7 +269,7 @@ export function usePopBiz(ob, tableRef?) {
    */
   function handleSumColumn(metaColumnList: OnlineColumn[], dataTotal: number): void {
     // 获取需要合计列的dataIndex
-    let sumColumnList = getNeedSumColumns(metaColumnList);
+    const sumColumnList = getNeedSumColumns(metaColumnList);
     // 判断是否为第一次获取数据,如果是的话,则需要重新设置pageSize
     if (pagination.isTotal == '') {
       if (sumColumnList.length > 0) {
@@ -277,7 +277,7 @@ export function usePopBiz(ob, tableRef?) {
         // 有合计字段时,每次最多查询原pageSize-1条记录,另外需要第一次时将查询的10条中删除最后一条
         // 删除最后一条数据 如果第一次得到的数据长度等于pageSize的话,则删除最后一条
         if (dataSource.value.length == pagination.pageSize) {
-          let remove_data = dataSource.value.pop();
+          const remove_data = dataSource.value.pop();
         }
         pagination.realPageSize = pagination.pageSize - 1;
       } else {
@@ -286,7 +286,7 @@ export function usePopBiz(ob, tableRef?) {
     }
     // 需要添加合计字段
     if (pagination.isTotal) {
-      let totalRow = {};
+      const totalRow = {};
       sumColumnList.forEach((dataIndex) => {
         let count = 0;
         dataSource.value.forEach((row) => {
@@ -298,7 +298,7 @@ export function usePopBiz(ob, tableRef?) {
         totalRow[dataIndex] = isNaN(count) ? '包含非数字内容' : count.toFixed(2);
 
         // 长整形时合计不显示.00后缀
-        let v = metaColumnList.find((v) => v.dataIndex == dataIndex);
+        const v = metaColumnList.find((v) => v.dataIndex == dataIndex);
         if (v && v.fieldType == 'Long') {
           totalRow[dataIndex] = parseInt(totalRow[dataIndex]);
         }
@@ -314,14 +314,14 @@ export function usePopBiz(ob, tableRef?) {
    * @param columns
    */
   function getNeedSumColumns(columns: OnlineColumn[]): string[] {
-    let arr: string[] = [];
-    for (let column of columns) {
+    const arr: string[] = [];
+    for (const column of columns) {
       if (column.isTotal === '1') {
         arr.push(column.dataIndex!);
       }
-        // 【VUEN-1569】【online报表】合计无效
+      // 【VUEN-1569】【online报表】合计无效
       if (column.children && column.children.length > 0) {
-        let subArray = getNeedSumColumns(column.children);
+        const subArray = getNeedSumColumns(column.children);
         if (subArray.length > 0) {
           arr.push(...subArray);
         }
@@ -334,7 +334,7 @@ export function usePopBiz(ob, tableRef?) {
    * 处理列的href和字典翻译
    */
   function handleColumnHrefAndDict(columns: OnlineColumn[], fieldHrefSlotKeysMap: {}): OnlineColumn[] {
-    for (let column of columns) {
+    for (const column of columns) {
       let { customRender, hrefSlotName, fieldType } = column;
       // online 报表中类型配置为日期(yyyy-MM-dd ),但是实际展示为日期时间格式(yyyy-MM-dd HH:mm:ss) issues/3042
       if (fieldType == 'Date') {
@@ -358,14 +358,14 @@ export function usePopBiz(ob, tableRef?) {
         // 如果 hrefSlotName 有值则代表使用了href跳转
         // 两者可以兼容。兼容的具体思路为:先获取到字典替换的值,再添加href链接跳转
         if (customRender || hrefSlotName) {
-          let dictCode = customRender as string;
-          let replaceFlag = '_replace_text_';
+          const dictCode = customRender as string;
+          const replaceFlag = '_replace_text_';
           column.customRender = ({ text, record }) => {
             let value = text;
             // 如果 dictCode 有值,就进行字典转换
             if (dictCode) {
               if (dictCode.startsWith(replaceFlag)) {
-                let textFieldName = dictCode.replace(replaceFlag, '');
+                const textFieldName = dictCode.replace(replaceFlag, '');
                 value = record[textFieldName];
               } else {
                 value = filterMultiDictText(unref(dictOptions)[dictCode], text + '');
@@ -379,7 +379,7 @@ export function usePopBiz(ob, tableRef?) {
             }
             // 如果 hrefSlotName 有值,就生成一个 a 标签,包裹住字典替换后(或原生)的值
             if (hrefSlotName) {
-              let field = fieldHrefSlotKeysMap[hrefSlotName];
+              const field = fieldHrefSlotKeysMap[hrefSlotName];
               if (field) {
                 return h(
                   'a',
@@ -403,21 +403,21 @@ export function usePopBiz(ob, tableRef?) {
    * @param columns
    */
   function handleGroupTitle(columns: OnlineColumn[]): OnlineColumn[] {
-    let newColumns: OnlineColumn[] = [];
-    for (let column of columns) {
+    const newColumns: OnlineColumn[] = [];
+    for (const column of columns) {
       //排序字段受控  ---- 此逻辑为新增逻辑 待
       if (unref(iSorter) && column.dataIndex === unref(iSorter).column) {
         column.sortOrder = unref(iSorter).order === 'asc' ? 'ascend' : 'descend';
       }
       //判断字段是否需要合并表头
       if (column.groupTitle) {
-        let clIndex = newColumns.findIndex((im) => im.title === column.groupTitle);
+        const clIndex = newColumns.findIndex((im) => im.title === column.groupTitle);
         if (clIndex !== -1) {
           //表头已存在直接push children
           newColumns[clIndex].children!.push(column);
         } else {
           //表头不存在组装表头信息
-          let clGroup: OnlineColumn = {},
+          const clGroup: OnlineColumn = {},
             child: OnlineColumn[] = [];
           child.push(column);
           clGroup.title = column.groupTitle;
@@ -433,7 +433,7 @@ export function usePopBiz(ob, tableRef?) {
   }
 
   // 获取路由器对象 href跳转用到
-  let router = useRouter();
+  const router = useRouter();
   /**
    * href 点击事件
    * @param field
@@ -441,9 +441,9 @@ export function usePopBiz(ob, tableRef?) {
    */
   function handleClickFieldHref(field, record) {
     let href = field.href;
-    let urlPattern = /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/;
-    let compPattern = /\.vue(\?.*)?$/;
-    let jsPattern = /{{([^}]+)}}/g; // {{ xxx }}
+    const urlPattern = /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/;
+    const compPattern = /\.vue(\?.*)?$/;
+    const jsPattern = /{{([^}]+)}}/g; // {{ xxx }}
     if (typeof href === 'string') {
       href = href.trim().replace(/\${([^}]+)?}/g, (s1, s2) => record[s2]);
       // 执行 {{...}} JS增强语句
@@ -475,10 +475,10 @@ export function usePopBiz(ob, tableRef?) {
    */
   function handleExport() {
     const { handleExportXls } = useMethods();
-    let url = `${configUrl.export}${cgRpConfigId.value}`;
-    let params = getQueryParams(); //查询条件
+    const url = `${configUrl.export}${cgRpConfigId.value}`;
+    const params = getQueryParams(); //查询条件
     // 【VUEN-1568】如果选中了某些行,就只导出选中的行
-    let keys = unref(checkedKeys);
+    const keys = unref(checkedKeys);
     if (keys.length > 0) {
       params['force_id'] = keys
         .map((i) => selectRows.value.find((item) => combineRowKey(item) === i)?.id)
@@ -512,9 +512,9 @@ export function usePopBiz(ob, tableRef?) {
    */
   function onShowTotal(total) {
     // 重新根据是否有合计计算每页显示的数据
-    let start = (pagination.current - 1) * pagination.realPageSize + 1;
-    let end = start + (pagination.isTotal ? dataSource.value.length - 1 : dataSource.value.length) - 1;
-    let realTotal = pagination.isTotal ? pagination.realTotal : total;
+    const start = (pagination.current - 1) * pagination.realPageSize + 1;
+    const end = start + (pagination.isTotal ? dataSource.value.length - 1 : dataSource.value.length) - 1;
+    const realTotal = pagination.isTotal ? pagination.realTotal : total;
     return start + '-' + end + ' 共' + realTotal + '条';
   }
 
@@ -531,9 +531,9 @@ export function usePopBiz(ob, tableRef?) {
    * @param data 数据结果集
    */
   function initQueryInfo(data) {
-    let url = `${configUrl.getQueryInfo}${unref(cgRpConfigId)}`;
+    const url = `${configUrl.getQueryInfo}${unref(cgRpConfigId)}`;
     //缓存key
-    let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
+    const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
     httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
       // console.log("获取查询条件", res);
       if (res.success) {
@@ -563,16 +563,16 @@ export function usePopBiz(ob, tableRef?) {
     if (arg == 1) {
       pagination.current = 1;
     }
-    let params = getQueryParams(); //查询条件
+    const params = getQueryParams(); //查询条件
     params['onlRepUrlParamStr'] = getUrlParamString();
     console.log('params', params);
     loading.value = true;
-    let url = `${configUrl.getData}${unref(cgRpConfigId)}`;
+    const url = `${configUrl.getData}${unref(cgRpConfigId)}`;
     //缓存key
-    let groupIdKey = props.groupId ? `${props.groupId}${url}${JSON.stringify(params)}` : '';
+    const groupIdKey = props.groupId ? `${props.groupId}${url}${JSON.stringify(params)}` : '';
     httpGroupRequest(() => defHttp.get({ url, params }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
       loading.value = false;
-      let data = res.result;
+      const data = res.result;
       console.log('表格信息:', data);
       setDataSource(data);
     });
@@ -582,14 +582,14 @@ export function usePopBiz(ob, tableRef?) {
    * 获取地址栏的参数
    */
   function getUrlParamString() {
-   let query = route.query;
-   let arr:any[] = []
-   if(query && Object.keys(query).length>0){
-     Object.keys(query).map(k=>{
-       arr.push(`${k}=${query[k]}`)
-     })
-   }
-   return arr.join('&')
+    const query = route.query;
+    const arr: any[] = [];
+    if (query && Object.keys(query).length > 0) {
+      Object.keys(query).map((k) => {
+        arr.push(`${k}=${query[k]}`);
+      });
+    }
+    return arr.join('&');
   }
 
   /**
@@ -598,7 +598,7 @@ export function usePopBiz(ob, tableRef?) {
   function setDataSource(data) {
     if (data) {
       pagination.total = Number(data.total);
-      let currentPage = pagination?.current ?? 1;
+      const currentPage = pagination?.current ?? 1;
       for (let a = 0; a < data.records.length; a++) {
         if (!data.records[a].rowIndex) {
           data.records[a].rowIndex = a + (currentPage - 1) * 10;
@@ -607,9 +607,10 @@ export function usePopBiz(ob, tableRef?) {
       dataSource.value = data.records;
       //update-begin-author:taoyan date:2023-2-11 for:issues/356 在线报表分页有问题
       //update-begin-author:liusq date:2023-4-04 for:issues/426 修复356时候引入的回归错误 JPopupOnlReportModal.vue 中未修改
-      tableRef?.value && tableRef?.value?.setPagination({
-        total: Number(data.total)
-      })
+      tableRef?.value &&
+        tableRef?.value?.setPagination({
+          total: Number(data.total),
+        });
       //update-end-author:liusq date:2023-4-04  for:issues/426 修复356时候引入的回归错误 JPopupOnlReportModal.vue 中未修改
       //update-end-author:taoyan date:2023-2-11 for:issues/356 在线报表分页有问题
     } else {
@@ -624,14 +625,14 @@ export function usePopBiz(ob, tableRef?) {
    * 获取查询参数
    */
   function getQueryParams() {
-    let paramTarget = {};
+    const paramTarget = {};
     if (unref(dynamicParam)) {
       //处理自定义参数
       Object.keys(unref(dynamicParam)).map((key) => {
         paramTarget['self_' + key] = unref(dynamicParam)[key];
       });
     }
-    let param = Object.assign(paramTarget, unref(queryParam), unref(iSorter));
+    const param = Object.assign(paramTarget, unref(queryParam), unref(iSorter));
     param.pageNo = pagination.current;
     // 合计逻辑 [待优化 3.0]
     //  实际查询时不使用table组件的pageSize,而使用自定义的realPageSize,realPageSize会在第一次获取到数据后变化
@@ -645,8 +646,8 @@ export function usePopBiz(ob, tableRef?) {
   function dynamicParamHandler(arr?) {
     if (arr && arr.length > 0) {
       //第一次加载查询条件前 初始化queryParam为空对象
-      let queryTemp = {};
-      for (let item of arr) {
+      const queryTemp = {};
+      for (const item of arr) {
         if (item.mode === 'single') {
           queryTemp[item.field] = '';
         }
@@ -658,11 +659,11 @@ export function usePopBiz(ob, tableRef?) {
       queryParam.value = Object.assign(queryParam.value, props.routeQuery);
     }
 
-    let dynamicTemp = {};
+    const dynamicTemp = {};
     if (props.param) {
       Object.keys(props.param).map((key) => {
         let str = props.param[key];
-        if (key in queryParam) {
+        if (key in queryParam.value) {
           if (str && str.startsWith("'") && str.endsWith("'")) {
             str = str.substring(1, str.length - 1);
           }
@@ -707,9 +708,9 @@ export function usePopBiz(ob, tableRef?) {
    */
   function clickThenCheck(record) {
     if (clickThenCheckFlag === true) {
-      let rowKey = combineRowKey(record);
+      const rowKey = combineRowKey(record);
       if (!unref(checkedKeys) || unref(checkedKeys).length == 0) {
-        let arr1: any[] = [],
+        const arr1: any[] = [],
           arr2: any[] = [];
         arr1.push(record);
         arr2.push(rowKey);
@@ -722,7 +723,7 @@ export function usePopBiz(ob, tableRef?) {
           //selectRows.value.push(record);
         } else {
           //已选中就取消
-          let rowKey_index = unref(checkedKeys).indexOf(rowKey);
+          const rowKey_index = unref(checkedKeys).indexOf(rowKey);
           checkedKeys.value.splice(rowKey_index, 1);
           //selectRows.value.splice(rowKey_index, 1);
         }
@@ -735,7 +736,7 @@ export function usePopBiz(ob, tableRef?) {
 
   //防止字典中有垃圾数据
   function initDictOptionData(arr) {
-    let obj = {};
+    const obj = {};
     Object.keys(arr).map((k) => {
       obj[k] = arr[k].filter((item) => {
         return item != null;
@@ -754,7 +755,7 @@ export function usePopBiz(ob, tableRef?) {
       return;
     }
 
-    for (let key in obj) {
+    for (const key in obj) {
       if (obj.hasOwnProperty(key) && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
         delete obj[key];
       }
@@ -801,15 +802,15 @@ export function usePopBiz(ob, tableRef?) {
   // 超链点击事件--> 打开一个modal窗口
   function openHrefCompModal(href) {
     // 解析 href 参数
-    let index = href.indexOf('?');
+    const index = href.indexOf('?');
     let path = href;
     if (index !== -1) {
       path = href.substring(0, index);
-      let paramString = href.substring(index + 1, href.length);
-      let paramArray = paramString.split('&');
-      let params = {};
+      const paramString = href.substring(index + 1, href.length);
+      const paramArray = paramString.split('&');
+      const params = {};
       paramArray.forEach((paramObject) => {
-        let paramItem = paramObject.split('=');
+        const paramItem = paramObject.split('=');
         params[paramItem[0]] = paramItem[1];
       });
       hrefComponent.value.params = params;
@@ -826,8 +827,8 @@ export function usePopBiz(ob, tableRef?) {
    * emit事件 获取选中的行数据
    */
   function getOkSelectRows(): any[] {
-    let arr = unref(selectRows);
-    let selectedRowKeys = checkedKeys.value;
+    const arr = unref(selectRows);
+    const selectedRowKeys = checkedKeys.value;
     console.log('arr', arr);
     if (!selectedRowKeys || selectedRowKeys.length <= 0) {
       return [];
@@ -835,10 +836,10 @@ export function usePopBiz(ob, tableRef?) {
     if (!arr || arr.length <= 0) {
       return [];
     }
-    let rows: any = [];
-    for (let key of selectedRowKeys) {
+    const rows: any = [];
+    for (const key of selectedRowKeys) {
       for (let i = 0; i < arr.length; i++) {
-        let combineKey = combineRowKey(arr[i]);
+        const combineKey = combineRowKey(arr[i]);
         if (key === combineKey) {
           rows.push(toRaw(arr[i]));
           break;

+ 34 - 18
src/views/vent/monitorManager/alarmMonitor/alarm.data.ts

@@ -41,30 +41,45 @@ export const ventTunColumns: BasicColumn[] = [
     dataIndex: 'fArea',
     width: 80,
     align: 'center',
+    customRender: function ({ text }) {
+      return Number(text).toFixed(2);
+    },
   },
   {
     title: '风速(m/s)',
     dataIndex: 'fRealV',
     width: 80,
     align: 'center',
+    customRender: function ({ text }) {
+      return Number(text).toFixed(2);
+    },
   },
   {
     title: '风量(m³/min)',
     dataIndex: 'fRealQMin',
     width: 80,
     align: 'center',
+    customRender: function ({ text }) {
+      return Number(text).toFixed(0);
+    },
   },
+  // {
+  //   title: '按需分风风阻',
+  //   dataIndex: 'oldHTotal',
+  //   width: 80,
+  //   align: 'center',
+  //   customRender: function ({ text }) {
+  //     return Number(text).toFixed(2);
+  //   },
+  // },
   {
-    title: '按需分风风阻',
-    dataIndex: 'oldHTotal',
-    width: 80,
-    align: 'center',
-  },
-  {
-    title: '实时解算风阻',
+    title: '巷道风阻',
     dataIndex: 'dHTotal',
     width: 80,
     align: 'center',
+    customRender: function ({ text }) {
+      return Number(text).toFixed(2);
+    },
   },
 
   {
@@ -74,17 +89,18 @@ export const ventTunColumns: BasicColumn[] = [
       if (record) {
         if (record['dHTotal'] && record['oldHTotal']) {
           const p = ((record['dHTotal'] - record['oldHTotal']) / record['oldHTotal']) * 100;
-          if (p == 0) {
-            return '正常';
-          } else if (p > 0 && p <= 1) {
-            return '低风险';
-          } else if (p > 1 && p <= 3) {
-            return '一般风险';
-          } else if (p > 3 && p <= 5) {
-            return '较大风险';
-          } else {
-            return '重大风险';
-          }
+          // if (p == 0) {
+          //   return '正常';
+          // } else if (p > 0 && p <= 1) {
+          //   return '低风险';
+          // } else if (p > 1 && p <= 3) {
+          //   return '一般风险';
+          // } else if (p > 3 && p <= 5) {
+          //   return '较大风险';
+          // } else {
+          //   return '重大风险';
+          // }
+          return '正常';
         } else {
           return '-';
         }

+ 14 - 13
src/views/vent/monitorManager/alarmMonitor/warn/ventilateWarn.vue

@@ -395,20 +395,21 @@
           data = [];
         }
       });
-      let maxLevel = data.length != 0 ? data.reduce((a, b) => (a.leveld > b.leveld ? a : b)).leveld : 0;
+      // let maxLevel = data.length != 0 ? data.reduce((a, b) => (a.leveld > b.leveld ? a : b)).leveld : 0;
       // hdData.address = data.length != 0 ? data.reduce((a, b) => (a.leveld > b.leveld ? a : b)).strName : '';
-      console.log(hdData.maxLevel);
-      if (maxLevel == 0) {
-        hdData.maxLevel = '正常';
-      } else if (maxLevel > 0 && maxLevel <= 1) {
-        hdData.maxLevel = '低风险';
-      } else if (maxLevel > 1 && maxLevel <= 3) {
-        hdData.maxLevel = '一般风险';
-      } else if (maxLevel > 3 && maxLevel <= 5) {
-        hdData.maxLevel = '较大风险';
-      } else {
-        hdData.maxLevel = '重大风险';
-      }
+      // console.log(hdData.maxLevel);
+      // if (maxLevel == 0) {
+      //   hdData.maxLevel = '正常';
+      // } else if (maxLevel > 0 && maxLevel <= 1) {
+      //   hdData.maxLevel = '低风险';
+      // } else if (maxLevel > 1 && maxLevel <= 3) {
+      //   hdData.maxLevel = '一般风险';
+      // } else if (maxLevel > 3 && maxLevel <= 5) {
+      //   hdData.maxLevel = '较大风险';
+      // } else {
+      //   hdData.maxLevel = '重大风险';
+      // }
+      hdData.maxLevel = '正常';
     }
   }