hongrunxia пре 9 месеци
родитељ
комит
275bc1846c

+ 10 - 4
src/hooks/vent/useSSO.ts

@@ -2,19 +2,21 @@
 
 import QueryString from 'qs';
 import { useUserStore } from '/@/store/modules/user';
-import { useRoute } from 'vue-router';
+import { useRoute, useRouter } from 'vue-router';
 
 /** 单点登录功能的Hook,该Hook是为了部署在同一局域网内的多套系统之间能够无缝切换 */
 export function useSSO() {
+  const router = useRouter();
   const userStore = useUserStore();
   const route = useRoute();
 
   /** 启用单点登录功能来跳转新的页面 */
-  function open(url: string, target?: string) {
+  function open(url: string, redirect?: string, target?: string) {
     const qs = QueryString.stringify({
       username: userStore.userInfo?.username,
       // 毫无意义的伪装,但我就是要装一下
       id: userStore.getPassword,
+      redirect,
     });
     window.open(`${url}?${qs}`, target);
   }
@@ -22,7 +24,7 @@ export function useSSO() {
   /** 用在跳转到的页面上,执行单点登录的逻辑 */
   function doSSO() {
     if (!route.query) return;
-    const { username, id } = route.query;
+    const { username, id, redirect } = route.query;
     if (!username || !id) return;
     const realPassword = userStore.decryptPassword(id as string);
     const params = {
@@ -30,7 +32,11 @@ export function useSSO() {
       password: realPassword,
       checkKey: new Date().getTime(),
     };
-    userStore.login(params);
+    userStore.login(params).then(() => {
+      if (redirect) {
+        router.push(redirect as string);
+      }
+    });
   }
 
   return {

+ 2 - 1
src/views/vent/home/billboard/billboard.data.ts

@@ -21,7 +21,7 @@ export const GAS_STATUS_COLUMN = [
 export const DUST_STATUS_COLUMN = [
   {
     name: '设备类型',
-    prop: 'deviceType',
+    prop: 'typeName',
   },
   {
     name: '监测数量',
@@ -34,6 +34,7 @@ export const DUST_STATUS_COLUMN = [
 ];
 
 // 火灾状态监测相关的内容配置项
+export const FIRE_STATUS_IGNORE_TRANSLATION_KEYS = ['tempMax'];
 export const FIRE_STATUS_LIST = [
   {
     icon: 'warning-optical-fiber',

+ 1 - 1
src/views/vent/home/billboard/components/FileOverview.vue

@@ -27,7 +27,7 @@
   });
 
   function fetchData() {
-    fileData.value = props.data.fileServerInfo;
+    fileData.value = props.data.fileServerInfo || DEFAULT_TEST_DATA.fileServerInfo;
   }
 
   onMounted(() => {

+ 18 - 4
src/views/vent/home/billboard/components/FireStatus.vue

@@ -12,10 +12,11 @@
   />
 </template>
 <script lang="ts" setup>
+  import _ from 'lodash-es';
   import { onMounted, ref, shallowRef } from 'vue';
   import CommonTitle from './CommonTitle.vue';
   import ListItem from './ListItem.vue';
-  import { BillboardType, DEFAULT_TEST_DATA, FIRE_STATUS_LIST } from '../billboard.data';
+  import { BillboardType, DEFAULT_TEST_DATA, FIRE_STATUS_LIST, FIRE_STATUS_IGNORE_TRANSLATION_KEYS } from '../billboard.data';
 
   const props = withDefaults(
     defineProps<{
@@ -31,8 +32,17 @@
   const listData = shallowRef<any>({});
 
   function fetchData() {
-    const info = props.data.fireInfo;
-    const trans = {
+    const info = props.data.fireInfo || DEFAULT_TEST_DATA.fireInfo;
+    const riskTrans = {
+      0: '低风险',
+      101: '低风险',
+      102: '普通风险',
+      103: '较高风险',
+      104: '高风险',
+      201: '低风险',
+      1001: '低风险',
+    };
+    const warnTrans = {
       0: '低风险',
       101: '低风险',
       102: '一般风险',
@@ -41,7 +51,11 @@
       201: '报警',
       1001: '网络断开',
     };
-    risk.value = trans[info.fireWarnLevel];
+    risk.value = riskTrans[info.fireWarnLevel];
+    _.forEach(info, (val, key) => {
+      if (FIRE_STATUS_IGNORE_TRANSLATION_KEYS.includes(key)) return;
+      info[key] = warnTrans[val];
+    });
     listData.value = info;
   }
 

+ 1 - 1
src/views/vent/home/billboard/components/GasStatus.vue

@@ -28,7 +28,7 @@
   const tableData = shallowRef<BillboardType['gasInfo']['gasTypeList']>([]);
 
   function fetchData() {
-    const info = props.data.gasInfo;
+    const info = props.data.gasInfo || DEFAULT_TEST_DATA.gasInfo;
     const trans = {
       0: '低风险',
       101: '低风险',

+ 1 - 1
src/views/vent/home/billboard/components/VentilationStatus.vue

@@ -35,7 +35,7 @@
   const treeData = shallowRef<TreeProps['treeData']>([]);
 
   function fetchData() {
-    const info = props.data.ventInfo;
+    const info = props.data.ventInfo || DEFAULT_TEST_DATA.ventInfo;
     const { prefix, suffix, prop, children } = VENTILATION_STATUS_TREE_CONFIG;
     ventilatorCount.value = info.fanMainList.length.toString();
     headerData.value = info;

+ 11 - 1
src/views/vent/home/billboard/index.vue

@@ -40,6 +40,7 @@
   const route = useRoute();
   const { open } = useSSO();
 
+  // 组件Map,不同type使用不用组件
   const componentMap = {
     DustStatus,
     FileOverview,
@@ -47,6 +48,14 @@
     GasStatus,
     FireStatus,
   };
+  // 组件Map,不同type需要跳转到不同的矿端页面
+  const routePathMap = {
+    DustStatus: '/dust/warn/home',
+    FileOverview: '/fileManager/fileDetail/home',
+    VentilationStatus: '/micro-vent-3dModal/dashboard/analysis',
+    GasStatus: '/gas/warn/home',
+    FireStatus: '/fire/warn/home',
+  };
 
   const mainTitle = '煤炭集团';
 
@@ -80,7 +89,8 @@
 
   // 页面跳转
   function openHandler(ip: string) {
-    open(`http://${ip}:8092/login`);
+    const url = `http://${ip}:8092/login`;
+    open(url, routePathMap[billboardType.value]);
   }
 
   onMounted(() => {

+ 2 - 2
src/views/vent/performance/fileDetail/commen/CADViewer.vue

@@ -5,7 +5,7 @@
 <script lang="ts" setup>
   import { onMounted, onUnmounted } from 'vue';
   import { CADViewer, useCADViewer } from '/@/components/CADViewer';
-  import { downLoad } from '../fileDetail.api';
+  import { downloadById } from '../fileDetail.api';
   import { useRoute } from 'vue-router';
   import { message } from 'ant-design-vue';
 
@@ -24,7 +24,7 @@
     registHook('MKY_Open_File_Complete', () => {
       unregistHook('MKY_Open_File_Complete');
       const loading = message.loading('正在下载文件', 0);
-      downLoad({ id, ifMine: initByRoute }).then((res: Blob) => {
+      downloadById({ id, ifMine: initByRoute }).then((res: Blob) => {
         processFile(new File([res], filename))
           .then((path) => {
             postMessage('MKY_Open_Mxweb', path);

+ 11 - 4
src/views/vent/performance/fileDetail/fileDetail.api.ts

@@ -8,10 +8,11 @@ enum Api {
   delMenu = '/ventanaly-sharefile/fileServer/delete',
   uploadApi = '/ventanaly-sharefile/fileServer/upload',
   downLoad = '/ventanaly-sharefile/fileServer/download',
-  listData ='/activiti/activiti_process/listData',
-  commit='/safety/actBusiness/commit',
-  getNowUserAgencyData='/safety/approvalBusiness/getNowUserAgencyData',
-  getNowUserApprovedData='/safety/approvalBusiness/getNowUserApprovedData'
+  downloadById = '/ventanaly-sharefile/fileServer/downloadById',
+  listData = '/activiti/activiti_process/listData',
+  commit = '/safety/actBusiness/commit',
+  getNowUserAgencyData = '/safety/approvalBusiness/getNowUserAgencyData',
+  getNowUserApprovedData = '/safety/approvalBusiness/getNowUserApprovedData',
 }
 
 /**
@@ -49,6 +50,12 @@ export const delMenu = (params) => defHttp.delete({ url: Api.delMenu, params },
 export const downLoad = (params) => defHttp.post({ url: Api.downLoad, params, responseType: 'blob' });
 
 /**
+ * 下载文件接口,通过id下载
+ * @param params
+ */
+export const downloadById = (params) => defHttp.post({ url: Api.downloadById, params, responseType: 'blob' });
+
+/**
  * 删除文件/文件夹
  */
 export const deleteById = (params, handleSuccess) => {