Browse Source

多灾融合预警,报表字段管理修改

lxh 1 month ago
parent
commit
49db296a30

+ 4 - 4
.env.development

@@ -6,8 +6,8 @@ VITE_PUBLIC_PATH = /
 
 # 跨域代理,您可以配置多个 ,请注意,没有换行符
 #VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
-# VITE_PROXY = [["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"]]
-VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
+VITE_PROXY = [["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"]]
+# VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://10.10.150.72:9999"],["/upload","http://localhost:3300/upload"],["/documents", "http://10.10.150.72:9050"],["/modelreq", "http://10.10.150.72:9999"],["/webRtc", "http://192.168.183.216:8051"]]
 #VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]
 
@@ -30,6 +30,6 @@ VITE_GLOB_API_URL_PREFIX=
 #微前端qiankun应用,命名必须以VITE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
 #VITE_APP_SUB_APP = [["micro-need-air", "//10.10.150.72:8099/"], ["micro-vent-3dModal", "//localhost:8091/"], ["micro-fire-front", "//localhost:8090/"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.88:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
+# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
+VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//localhost:8091/"], ["micro-need-air", "//localhost:8099/"], ["micro-fire-front", "//localhost:8090/"]]

+ 132 - 13
src/views/vent/deviceManager/tableReport/components/NormalTable.vue

@@ -4,6 +4,8 @@
       <template #tableTitle>
         <a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button>
         <a-button preIcon="ant-design:cloud-upload-outlined" type="primary" @click="handleExtract">提取</a-button>
+        <a-button preIcon="ant-design:vertical-align-top-outlined" type="primary" @click="handleUpload">导入</a-button>
+        <a-button preIcon="ant-design:vertical-align-bottom-outlined" type="primary" @click="handleDownload">导出</a-button>
       </template>
       <template #action="{ record }">
         <a class="table-action-link" @click="handleEdit(record)">编辑</a>
@@ -31,8 +33,37 @@
         </div>
       </a-form>
     </a-modal>
-
-
+<!-- 导入弹窗 -->
+<a-modal v-model:visible="visibleUpload" width="450px" :footer="null" :title="titleUpload" centered destroyOnClose>
+      <a-form :model="formStateUpload" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }" autocomplete="off">
+        <a-form-item label="报表类型:">
+          <JDictSelectTag v-model:value="formStateUpload.reportType" placeholder="请选择报表类型" dictCode="reportType"
+            style="width: 240px" />
+        </a-form-item>
+        <a-form-item label="文件上传">
+          <a-upload :before-upload="beforeUpload" @remove="handleRemove" :multiple="false" :file-list="fileList">
+            <a-button type="primary" preIcon="ant-design:cloud-upload-outlined">选择文件</a-button>
+          </a-upload>
+        </a-form-item>
+        <div class="opertion-btn">
+          <a-button type="primary" @click="confirmUpload">确定</a-button>
+          <a-button type="success" style="margin-left:10px" @click="cancelUpload">取消</a-button>
+        </div>
+      </a-form>
+    </a-modal>
+    <!-- 导出弹窗 -->
+    <a-modal v-model:visible="visibleDown" width="450px" :footer="null" :title="titleDown" centered destroyOnClose>
+      <a-form :model="formStateDown" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }" autocomplete="off">
+        <a-form-item label="报表类型:">
+          <JDictSelectTag v-model:value="formStateDown.reportType" placeholder="请选择报表类型" dictCode="reportType"
+            style="width: 240px" />
+        </a-form-item>
+        <div class="opertion-btn">
+          <a-button type="primary" @click="confirmDownload">确定</a-button>
+          <a-button type="success" style="margin-left:10px" @click="cancelDownload">取消</a-button>
+        </div>
+      </a-form>
+    </a-modal>
   </div>
 </template>
 
@@ -45,6 +76,7 @@ import { useModal } from '/@/components/Modal';
 import DeviceModal from './DeviceModal.vue';
 import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
 import { useListPage } from '/@/hooks/system/useListPage';
+import { useMessage } from '/@/hooks/web/useMessage';
 
 const props = defineProps({
   columnsType: {
@@ -72,6 +104,14 @@ const props = defineProps({
     type: Function,
     required: true,
   },
+  getImportUrl: {
+    type: Function,
+    required: true,
+  },
+  getExportUrl: {
+    type: Function,
+    required: true,
+  },
   deleteById: {
     type: Function,
     required: true,
@@ -99,7 +139,7 @@ const props = defineProps({
 });
 
 const emit = defineEmits(['submitSuccess', 'editHandler']);
-
+const { createMessage } = useMessage();
 let visibleTq = ref(false)//控制手动提取弹窗的显示与隐藏
 let titleTq = ref('提取信息')
 let formStateTq = reactive({
@@ -108,7 +148,20 @@ let formStateTq = reactive({
 const isUpdate = ref(false);
 const record = reactive({});
 const formSchemaData = ref(props.formSchema);
+//导入弹窗信息
+const visibleUpload=ref(false)
+const titleUpload=ref('导入')
+let formStateUpload=reactive({
+  reportType:'',
+})
+let fileList = reactive<any[]>([]); //上传文件列表
 
+//导出弹窗信息
+let visibleDown=ref(false)
+let titleDown=ref('导出')
+let formStateDown=reactive({
+  reportType:''
+})
 watch(
   () => props.formSchema,
   (val) => {
@@ -126,7 +179,7 @@ const [registerModal, { openModal, closeModal }] = useModal();
 const columnList = getTableHeaderColumns(props.columnsType);
 
 // 列表页面公共参数、方法
-const { prefixCls, tableContext, onExportXls, onImportXls, doRequest } = useListPage({
+const { prefixCls, tableContext, doRequest } = useListPage({
   designScope: props.designScope,
   tableProps: {
     title: props.title,
@@ -158,13 +211,6 @@ const { prefixCls, tableContext, onExportXls, onImportXls, doRequest } = useList
     //   return Object.assign(params, { column: 'createTime', devicekind: props.deviceType });
     // },
   },
-  // exportConfig: {
-  //   name: props.title,
-  //   url: props.getExportUrl,
-  // },
-  // importConfig: {
-  //   url: props.getImportUrl,
-  // },
 });
 
 //注册table数据
@@ -232,6 +278,81 @@ function cancelTq() {
   formStateTq.reportType = ''
   visibleTq.value = false
 }
+//打开导入弹窗
+function handleUpload(){
+visibleUpload.value=true
+formStateUpload.reportType=''
+fileList.length=0
+}
+ //上传文件
+ let beforeUpload = (file) => {
+    fileList.length = 0;
+    let index = file.name.indexOf('.');
+    let name = file.name.substring(index + 1);
+    if (name == 'png' || name == 'jpg' || name == 'gif' || name == 'psd' || name == 'webp') {
+      createMessage.warning('禁止上传图片类型的文件!');
+    } else {
+      fileList.push(file);
+    }
+  };
+  // 文件移除
+  let handleRemove = (file) => {
+    const index = fileList.indexOf(file);
+    const newFileList = fileList.slice();
+    newFileList.splice(index, 1);
+    fileList.length = 0;
+  };
+  //确定上传
+  async function confirmUpload(){
+    const formData = new FormData();
+      formData.append('file', fileList[0]);
+      formData.append('reportType', formStateUpload.reportType);
+       await props.getImportUrl(formData, reload);
+     visibleUpload.value=false
+     
+  }
+  //取消上传
+  function cancelUpload(){
+visibleUpload.value=false
+formStateUpload.reportType=''
+  }
+  //打开导出弹窗
+  function handleDownload(){
+    visibleDown.value=true
+    formStateDown.reportType=''
+  }
+  //确定导出
+ async function confirmDownload(){
+  let res=await props.getExportUrl({reportType:formStateDown.reportType})
+  let filename = `${new Date().getTime()}.xlsx`;
+  downFilePublic(res, filename);
+  visibleDown.value=false
+  }
+  // 下载公用方法
+function downFilePublic(content, fileName) {
+  const blob = new Blob([content], { type: 'application/xlsx;charset=UTF-8' }); // 构造一个blob对象来处理数据
+  // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
+  // IE10以上支持blob但是依然不支持download
+  if ('download' in document.createElement('a')) {
+    // 支持a标签download的浏览器
+    const link = document.createElement('a'); // 创建a标签
+    link.download = fileName; // a标签添加属性
+    link.style.display = 'none';
+    link.href = URL.createObjectURL(blob);
+    document.body.appendChild(link);
+    link.click(); // 执行下载
+    URL.revokeObjectURL(link.href); // 释放url
+    document.body.removeChild(link); // 释放标签
+  } else {
+    // 其他浏览器
+    navigator.msSaveBlob(blob, fileName);
+  }
+}
+  //取消导出
+  function cancelDownload(){
+    visibleDown.value=false
+    formStateDown.reportType=''
+  }
 /**
  * 操作列定义
  * @param record
@@ -258,8 +379,6 @@ function getActions(record: EditRecordRow, column: BasicColumn): ActionItem[] {
 
 defineExpose({
   doRequest,
-  onExportXls,
-  onImportXls,
   reload,
   getForm,
 });

+ 3 - 1
src/views/vent/deviceManager/tableReport/index.vue

@@ -8,6 +8,8 @@
         :deleteById="deleteById"
         :saveOrUpdate="saveOrUpdate"
         :readReportData="readReportData"
+         :getImportUrl="getImportUrl"
+      :getExportUrl="getExportUrl"
         designScope="table-search-reset"
         title="报表管理"
         :showTab="false"
@@ -19,7 +21,7 @@
     //ts语法
     import NormalTable from './components/NormalTable.vue';
     import { columns, searchFormSchema, formSchema } from './tableReport.data';
-    import { list, deleteById, saveOrUpdate,readReportData } from './tableReport.api';
+    import { list, deleteById, saveOrUpdate,readReportData,getExportUrl,getImportUrl } from './tableReport.api';
   </script>
   
   <style scoped></style>

+ 16 - 1
src/views/vent/deviceManager/tableReport/tableReport.api.ts

@@ -6,10 +6,25 @@ enum Api {
   save = '/safety/reportDataSyn/add',
   edit = '/safety/reportDataSyn/edit',
   deleteById = '/safety/reportDataSyn/delete',
-  readReportData= '/safety/reportDataSyn/readReportData'//手动从报表里提取数据
+  readReportData= '/safety/reportDataSyn/readReportData',//手动从报表里提取数据
+  importData = '/safety/reportDataSyn/importData',//导入
+  exportData='/safety/reportDataSyn/exportData'//导出
 }
 
 /**
+ * 导出
+ * @param params
+ */
+export const getExportUrl = (params) => defHttp.get({ url: Api.exportData, params, responseType: 'blob' });
+/**
+ * 导入api
+ */
+export const getImportUrl = (params, handleSuccess) => {
+  return defHttp.post({ headers: { 'Content-Type': 'multipart/form-data' }, url: Api.importData, params }).then(() => {
+    handleSuccess();
+  });
+};
+/**
  * 手动从报表里提取数据
  * @param params
  */

+ 2 - 2
src/views/vent/monitorManager/alarmMonitor/common/mainWell.vue

@@ -486,10 +486,10 @@
 
       if (val.smoke.length != 0) {
         val.smoke.forEach((el) => {
-          el.smokeVal=el.readData.smokeval=='0' || el.readData.smokeval=='0.0' ? '无烟' : el.readData.smokeval=='1' ? '有烟' :el.readData.smokeval 
+          el.smokeVal=el.readData.smokeval=='0'  ? '无烟' : el.readData.smokeval=='1' ? '有烟' :el.readData.smokeval 
           monitorlistYw.push({
             strinstallpos: el.strinstallpos,
-            val: el.readData.smokeval,
+            val: el.smokeVal,
             warnLevel_str: el.warnLevel_str,
             readTime: el.readTime,
           });

+ 2 - 2
src/views/vent/monitorManager/alarmMonitor/common/measurePoint.vue

@@ -189,11 +189,11 @@
 
           .label-l {
             position: absolute;
-            left: 50%;
+          width:100%;
             top: 7px;
             color: var(--vent-font-color);
             font-size: 14px;
-            transform: translate(-50%, 0);
+            text-align:center;
           }
 
           .value-l {

+ 7 - 8
src/views/vent/monitorManager/alarmMonitor/index.vue

@@ -177,7 +177,7 @@
             </div>
             <div class="item-monitor-box">
               <span class="title">火灾监测预警</span>
-              <span :class="centerData.fire != 1001 ? 'value' : 'value1'">{{
+              <span :class="centerData.fire != 0 && centerData.fire != 101 ? 'value1' : 'value'">{{
                 centerData.fire == 0
                   ? '低风险'
                   : centerData.fire == 101
@@ -200,7 +200,7 @@
             </div>
             <div class="item-monitor-box">
               <span class="title">设备监测预警</span>
-              <span :class="centerData.sb != 1001 ? 'value' : 'value1'">{{
+              <span :class="centerData.sb != 0 && centerData.sb != 101 ? 'value1' : 'value'">{{
                 centerData.sb == 0
                   ? '低风险'
                   : centerData.sb == 101
@@ -223,7 +223,7 @@
             </div>
             <div class="item-monitor-box">
               <span class="title">粉尘监测预警</span>
-              <span :class="centerData.fc != 1001 ? 'value' : 'value1'">{{
+              <span :class="centerData.fc != 0 && centerData.fc != 101 ? 'value1' : 'value'">{{
                 centerData.fc == 0
                   ? '低风险'
                   : centerData.fc == 101
@@ -246,7 +246,7 @@
             </div>
             <div class="item-monitor-box">
               <span class="title">瓦斯监测预警</span>
-              <span :class="centerData.ws != 1001 ? 'value' : 'value1'">{{
+              <span :class="centerData.ws != 0 && centerData.ws != 101 ? 'value1' : 'value'">{{
                 centerData.ws == 0
                   ? '低风险'
                   : centerData.ws == 101
@@ -274,7 +274,7 @@
             </div>
             <div class="item-monitor-box">
               <span class="title">通风监测预警</span>
-              <span :class="centerData.tf !== 1001 ? 'value' : 'value1'">{{
+              <span :class="centerData.tf !== 0 && centerData.tf !== 101 ? 'value1' : 'value'">{{
                 centerData.tf == 0
                   ? '低风险'
                   : centerData.tf == 101
@@ -553,9 +553,8 @@
     centerData.sb = res.info.deviceWarnInfo.maxLevel;
     centerData.fc = res.info.sysInfo.dustS.maxLevel;
     centerData.riskLevel = res.info.riskLevel;
-    Levels = await getDisasterProportion();
-
-    centerData.levels = 0 < Levels.level <= 1 ? 101 : 1 < Levels.level <= 2 ? 102 : 2 < Levels.level <= 3 ? 103 : 3 < Levels.level <= 4 ? 104 : 0;
+    Levels =Object.assign({},await getDisasterProportion())
+    centerData.levels =  Levels.level>0 && Levels.level<= 1 ? 101 :  Levels.level>1 && Levels.level<= 2 ? 102 :  Levels.level>2 &&  Levels.level <= 3 ? 103 : Levels.level>3 &&Levels.level <= 4 ? 104 : 0;
 
     Object.keys(iconsMonitor).forEach((el) => {
       if (res.info.devicekindInfo[el]) {