Переглянути джерело

局部风机管控系统-报表导出提交

lxh 1 рік тому
батько
коміт
6b6a4918cc

+ 4 - 4
package.json

@@ -88,9 +88,9 @@
     "vxe-table": "4.5.12",
     "vxe-table-plugin-antd": "3.1.0",
     "xe-utils": "3.5.13",
-    "xgplayer": "^3.0.13",
-    "xgplayer-flv": "^3.0.13",
-    "xgplayer-hls": "^3.0.13",
+    "xgplayer": "^3.0.14",
+    "xgplayer-flv": "^3.0.14",
+    "xgplayer-hls": "^3.0.14",
     "xss": "^1.0.14"
   },
   "devDependencies": {
@@ -201,4 +201,4 @@
       ]
     }
   }
-}
+}

+ 71 - 9
src/views/vent/monitorManager/comment/components/reportInfo.vue

@@ -1,25 +1,87 @@
 <template>
-    <BasicModal @register="registerModal" :defaultFullscreen="true" title="报表导出" width="1000px" v-bind="$attrs" :footer="null"
-        :showCancelBtn="false" :showOkBtn="false" destroyOnClose :mask-closable="false">
-        <NormalTable :isReportFan="isReportFan" :columns="columns" :downLoad="downLoad" :list="reportList" designScope="device-tabel" title="报表导出"
-            :showTab="false" />
+    <BasicModal @register="registerModal" :defaultFullscreen="true" title="报表导出" width="1000px" v-bind="$attrs"
+        :footer="null" :showCancelBtn="false" :showOkBtn="false" destroyOnClose :mask-closable="false">
+        <div id="fileEdit"></div>
     </BasicModal>
 </template>
 
 <script lang="ts" setup>
 import { computed, unref, inject, reactive, ref, watch, defineProps } from 'vue';
 import { BasicModal, useModalInner } from '/@/components/Modal';
-import NormalTable from '../../../reportManager/comment/NormalTable.vue';
-import { columns } from '../../../reportManager/reportManager.data'
-import {downLoad,reportList} from '../../../reportManager/reportManager.api'
+import { useUserStore } from '/@/store/modules/user';
+
+let props = defineProps({
+    editID: {
+        type: String,
+        default: () => {
+            return ''
+        }
+    },
+    fileType: {
+        type: String,
+        default: () => {
+            return ''
+        }
+    }
+})
+
+const remoteUrl = import.meta.env.DEV ? 'http://182.92.126.35' : 'http://' + window.location.hostname;
+const userStore = useUserStore(); //获取用户信息
+let userId = unref(userStore.getUserInfo).id;
+let userName = unref(userStore.getUserInfo).username;
+// const emit = defineEmits(['register']);
 
-let isReportFan=ref(false)
 let [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
     //重置表单
     setModalProps({ confirmLoading: false });
     // Object.assign(deviceData, data.record);
-
 });
+
+watch(() => props.editID, (newV, oldV) => {
+    console.log(newV,'newV----------')
+    new DocsAPI.DocEditor(
+        'fileEdit', // 元素id
+        {
+            type: 'desktop',
+            width: '100%',
+            height: '860px',
+            document: {
+                title: '文档管理',
+                url: remoteUrl + ':9999/ventanaly-device/safety/reportInfo/onlyOffice/read?id=' + props.editID + '&type=' + '', //id表示文件id,后端接口用这个id来加载文件
+                fileType: props.fileType == 'doc' ? 'docx' : props.fileType == 'xls' ? 'xlsx' : props.fileType == 'ppt' ? 'pptx' : props.fileType, //当文件类型为doc、xls、ppt时,对应用docx、xlsx、pptx否则会保存异常。
+                key: '',
+                lang: 'zh-CN',
+                permissions: {
+                    download: true, //是否可下载
+                    edit: true,
+                    fillForms: true,
+                    print: true, //是否可打印
+                },
+            },
+            editorConfig: {
+                lang: 'zh-CN',
+                mode: 'view', //view:只读且可复制内容,edit:可编辑
+                callbackUrl: remoteUrl + ':9999/ventanaly-device/safety/reportInfo/onlyOffice/save?id=' + props.editID + '&type=' + '', //id表示文件id,后端接口用这个id来加载文件
+                coEditing: {
+                    mode: 'fast',
+                    change: true,
+                },
+                customization: {
+                    toolbarNoTabs: true,
+                    autosave: false, //是否自动保存
+                    forcesave: true, //定义保存按钮是否显示
+                    hideRightMenu: true,
+                },
+                //用户信息
+                user: {
+                    id: userId, //用户ID
+                    name: userName, //用户名称
+                },
+            },
+        }
+    );
+})
+
 </script>
 
 <style lang="less" scoped></style>

+ 1 - 1
src/views/vent/monitorManager/fanLocalMonitor/fanLocal.three.ts

@@ -304,7 +304,7 @@ export const addCssText = () => {
 //   }
 // };
 export const playSmoke = (selectData) => {
-  debugger;
+  // debugger;
   console.log('selectData[Fan1fHz]------------》', selectData['Fan1fHz'], Number(selectData['Fan1fHz']));
   if (selectData['Fan1StartStatus'] == '1') {
     // 主风机打开

+ 17 - 6
src/views/vent/monitorManager/fanLocalMonitor/index.vue

@@ -394,7 +394,7 @@
     </div>
   </a-modal>
   <DeviceBaseInfo @register="registerModal"  :device-type="selectData['deviceType']" />
-  <reportInfo @register="registerModal1"></reportInfo>
+ <reportInfo @register="registerModal1" :editID="editID" :fileType="fileType"></reportInfo>
 </template>
 
 <script setup lang="ts">
@@ -428,11 +428,10 @@
   import { CaretRightOutlined } from '@ant-design/icons-vue';
   import { usePermission } from '/@/hooks/web/usePermission';
   import { DownloadOutlined } from '@ant-design/icons-vue';
-  import reportInfo from '../comment/components/reportInfo.vue'
+  import reportInfo from '../comment/components/reportInfo.vue';
+  import {save,reportList} from '../../reportManager/reportManager.api'
   const { hasPermission } = usePermission();
-
   const globalConfig = inject('globalConfig');
-
   const [registerModal, { openModal, closeModal }] = useModal();
   const [registerModal1, { openModal:openModal1, closeModal: closeModal1}] = useModal();
   const { currentRoute } = useRouter();
@@ -605,6 +604,10 @@
   const headElHeight = ref(0);
   let btnClick = ref(true); // 判断按钮是否可点
 
+  //报表导出
+  let editID=ref<any>('')
+  let fileType=ref('')
+
   const { getCamera, removeCamera } = useCamera();
 
   watch(deviceType, (type) => {
@@ -657,8 +660,16 @@
   };
 
   //报表导出点击
-  function reportDown(){
+  async function reportDown(){
     openModal1();
+   let res=await save({reportType:'fanlocal'})
+   console.log(res,'res-----------')
+   let list=await reportList({id:res.id})
+   console.log(list,'list-----------')
+   let index = list.records[0].fileName.indexOf('.');
+  fileType.value = list.records[0].fileName.substring(index + 1);
+   editID.value=list.records[0].id
+   openModal1();
   }
 
   //详情
@@ -700,7 +711,7 @@
     if (Object.prototype.toString.call(timer) === '[object Null]') {
       timer = await setTimeout(
         async () => {
-          debugger;
+          // debugger;
           await getDataSource();
           if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
             // 初始打开页面

+ 4 - 10
src/views/vent/reportManager/comment/NormalTable.vue

@@ -2,15 +2,15 @@
   <div>
     <BasicTable @register="registerTable" :rowSelection="rowSelection">
       <template #tableTitle >
-        <a-button v-if="isReportFan" preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button>
+        <a-button  preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button>
       </template>
       <template #action="{ record }">
         <a  class="table-action-link" @click="handleEdit(record)">编辑</a>
-        <a-popconfirm v-if="isReportFan" title="确定删除?" @confirm="handleDelete(record)">
+        <a-popconfirm  title="确定删除?" @confirm="handleDelete(record)">
           <a class="table-action-link">删除</a>
         </a-popconfirm>
         <a class="table-action-link" @click="handleDownLoad(record)">导出</a>
-        <a v-if="isReportFan" class="table-action-link" @click="handleHisrecord(record)"> 历史记录</a>
+        <a  class="table-action-link" @click="handleHisrecord(record)"> 历史记录</a>
         <slot name="action" v-bind="{ record }"></slot>
       </template>
       <template #bodyCell="{ column, record }">
@@ -34,13 +34,7 @@ import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
 import { useListPage } from '/@/hooks/system/useListPage';
 
 const props = defineProps({
-  //是否显示新增,删除按钮
-  isReportFan: {
-    type: Boolean,
-    default: () => {
-      return true
-    }
-  },
+  
   //下载文件接口
   downLoad: {
     type: Function,

+ 1 - 3
src/views/vent/reportManager/index.vue

@@ -2,7 +2,7 @@
     <div class="reportManager">
         <customHeader>报表管理中心</customHeader>
         <div class="content">
-            <NormalTable v-if="refesh" :isReportFan="isReportFan" :columns="columns" :searchFormSchema="searchFormSchema"
+            <NormalTable v-if="refesh"  :columns="columns" :searchFormSchema="searchFormSchema"
                 :deleteById="deleteById" :downLoad="downLoad" :list="reportList" designScope="device-tabel" title="报表管理"
                 :showTab="true" @saveAdd="saveAdd" />
         </div>
@@ -17,8 +17,6 @@ import { columns, searchFormSchema } from './reportManager.data';
 import { reportList, save, deleteById,downLoad } from './reportManager.api'
 
 let refesh = ref(true)
-let isReportFan=ref(true)
-
 async function saveAdd(params) {
     let res = await save({ ...params })
     console.log(res, '新增成功-------')