Bläddra i källkod

LY 特种设备 每週檢查

ly 2 år sedan
förälder
incheckning
d324ba99d8

+ 1 - 1
master/src/main/java/com/ruoyi/project/sems/safecheck/controller/TSpecDailycheckController.java

@@ -207,7 +207,7 @@ public class TSpecDailycheckController extends BaseController {
         // 生成word的路径
         String fileDir = RuoYiConfig.getProfile() + "/" + "sems/dailycheck";
         // 生成word的文件名称
-        String fileName = tSpecDailycheck.getId() + ".docx";
+        String fileName =tSpecDailycheck.getPlantCode() +  "_" + DateUtils.dateTime(tSpecDailycheck.getCheckDate())+ "_" + tSpecDailycheck.getId() + ".docx";
         String wordPath = this.createWord(templatePath, fileDir, fileName, params);
         return wordPath;
     }

+ 1 - 1
master/src/main/java/com/ruoyi/project/sems/safecheck/controller/TSpecWeekcheckController.java

@@ -255,7 +255,7 @@ public class TSpecWeekcheckController extends BaseController
         // 生成word的路径
         String fileDir = RuoYiConfig.getProfile() + "/" + "sems/weekcheck";
         // 生成word的文件名称
-        String fileName = tSpecWeekcheck.getId() + ".docx";
+        String fileName =DateUtils.parseDateToStr("YYYY",tSpecWeekcheck.getCheckDate()) + "第" +tSpecWeekcheck.getWeekNo()+ "周" +"_" +tSpecWeekcheck.getId()  + ".docx";
         String wordPath = this.createWord(templatePath, fileDir, fileName, params);
         return wordPath;
     }

+ 0 - 1
master/src/main/java/com/ruoyi/project/sems/safecheck/domain/TSpecDailycheck.java

@@ -71,7 +71,6 @@ public class TSpecDailycheck extends BaseEntity
     private String cSafety;
 
     /** 环境 */
-    @Excel(name = "环境")
     private String cEnv;
 
     /** 政府 */

+ 14 - 17
master/src/main/java/com/ruoyi/project/sems/safecheck/domain/TSpecWeekcheck.java

@@ -21,7 +21,6 @@ public class TSpecWeekcheck extends BaseEntity
     private Long id;
 
     /** 装置名称 */
-    @Excel(name = "装置名称")
     private String plantCode;
 
     private Integer status;
@@ -30,21 +29,17 @@ public class TSpecWeekcheck extends BaseEntity
     private Long delFlag;
 
     /** 创建人 */
-    @Excel(name = "创建人")
     private Long createrCode;
 
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
     /** 修改人 */
-    @Excel(name = "修改人")
     private Long updaterCode;
 
     /** 修改时间 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 
     /** 检查日期 */
@@ -61,7 +56,6 @@ public class TSpecWeekcheck extends BaseEntity
     private Date endDate;
 
     /** 安全员用户id */
-    @Excel(name = "安全员用户id")
     private Long checkerId;
 
     /** 周 */
@@ -69,20 +63,13 @@ public class TSpecWeekcheck extends BaseEntity
     private String weekNo;
 
     /** 安全管理员id */
-    @Excel(name = "安全管理员id")
     private String safeAdminId;
 
-    /** 安全管理员姓名 */
-    @Excel(name = "安全管理员姓名")
-    private String safeAdminName;
+
 
     /** 安全总监id */
-    @Excel(name = "安全总监id")
     private String safeDirId;
 
-    /** 安全总监姓名 */
-    @Excel(name = "安全总监姓名")
-    private String safeDirName;
 
     /** 上周安全风险隐患问题整改核实情况 */
     @Excel(name = "上周安全风险隐患问题整改核实情况")
@@ -100,19 +87,29 @@ public class TSpecWeekcheck extends BaseEntity
     @Excel(name = "下周工作重点")
     private String nextWeekWork;
 
+    /** 安全管理员姓名 */
+    @Excel(name = "安全管理员姓名")
+    private String safeAdminName;
+
     /** 安全管理员意见 */
     @Excel(name = "安全管理员意见")
     private String safeAdminSug;
 
-    /** 安全总监意见 */
-    @Excel(name = "安全总监意见")
-    private String safeDirSug;
 
     /** 检查日期 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "安全管理员日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date safeAdminDate;
 
+
+    /** 安全总监姓名 */
+    @Excel(name = "安全总监姓名")
+    private String safeDirName;
+
+    /** 安全总监意见 */
+    @Excel(name = "安全总监意见")
+    private String safeDirSug;
+
     /** 检查日期 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     @Excel(name = "安全总监日期", width = 30, dateFormat = "yyyy-MM-dd")

+ 339 - 0
ui/src/views/components/file/attachment.vue

@@ -0,0 +1,339 @@
+<template>
+  <div>
+    <!-- 报告附件对话框 -->
+    <el-dialog  :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
+      <el-upload
+        ref="doc"
+        :limit="500"
+        :headers="doc.headers"
+        :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
+        :disabled="doc.isUploading"
+        :on-progress="handleFileDocProgress"
+        :on-success="handleFileDocSuccess"
+        :auto-upload="true"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          {{ $t('将文件拖到此处,或') }}
+          <em>{{ $t('点击上传') }}</em>
+        </div>
+      </el-upload>
+      <el-table :data="doc.commonfileList" border>
+        <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
+          <template slot-scope="scope">
+            <a class="link-type" @click="handleDownload(scope.row)">
+              <span>{{ scope.row.fileName }}</span>
+            </a>
+          </template>
+        </el-table-column>
+        <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80"/>
+        <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
+        <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button
+              v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
+                 ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
+                 ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
+                 ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
+                 ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
+                 ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
+              size="mini"
+              type="text"
+              icon="el-icon-view"
+              @click="handleSee(scope.row)"
+            > {{ $t('预览') }}
+            </el-button>
+            <el-button
+              v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
+              size="mini"
+              type="text"
+              icon="el-icon-view"
+              @click="handleSeePPT(scope.row)"
+            > {{ $t('ppt预览') }}
+            </el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-download"
+              @click="handleDownload(scope.row)"
+            >{{ $t('下载') }}
+            </el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDeleteDoc(scope.row)"
+            >{{ $t('删除') }}
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <!--        <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
+        <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog  :close-on-click-modal="false" v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title"
+                :visible.sync="pdf.open" width="1300px" :center="true" append-to-body>
+      <div style="margin-top: -60px;float: right;margin-right: 40px;">
+        <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
+      </div>
+      <div style="margin-top: -30px">
+        <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"
+                v-if="ppt"></iframe>
+      </div>
+      <div style="padding: 30px; width: 100%; height: 100%;">
+        <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
+                     height="700px" trigger="click" :autoplay="false" indicator-position="outside">
+          <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item">
+            <img :src="item" width="100%" height="100%" object-fit="cover"/>
+          </el-carousel-item>
+        </el-carousel>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+
+import {getToken} from "@/utils/auth";
+import {allFileList, delCommonfile} from "@/api/common/commonfile";
+
+export default {
+  components: { },
+  props: {
+    user: {
+      type: Object
+    }
+  },
+  data() {
+    return {
+      ppt: false,
+      pptView: false,
+      loadingFlash: false,
+      // 报告附件参数
+      doc: {
+        file: "123",
+        // 是否显示弹出层(报告附件)
+        open: false,
+        // 弹出层标题(报告附件)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 报告附件上传位置编号
+        ids: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
+        commonfileList: null,
+        queryParams: {
+          pId: null,
+          pType: ''
+        },
+        pType: '',
+        pId: null
+      },
+      pdf: {
+        title: '',
+        pdfUrl: '',
+        numPages: null,
+        open: false,
+        pageNum: 1,
+        pageTotalNum: 1,
+        loadedRatio: 0,
+      },
+    };
+  },
+  methods: {
+    /** 报告附件按钮操作 */
+    handleDoc(row , pType) {
+      this.doc.id = row.id;
+      this.doc.title = row.filename;
+      this.doc.open = true;
+      this.doc.queryParams.pId = row.id
+      this.doc.queryParams.pType = pType
+      this.doc.pId = row.id
+      this.doc.pType = pType
+      this.getFileList()
+      this.$nextTick(() => {
+        this.$refs.doc.clearFiles()
+      })
+    },
+    getFileList() {
+      allFileList(this.doc.queryParams).then(response => {
+        this.doc.commonfileList = response;
+      });
+    },
+    //附件上传中处理
+    handleFileDocProgress(event, file, fileList) {
+      this.doc.file = file;
+      this.doc.isUploading = true;
+    },
+    //附件上传成功处理
+    handleFileDocSuccess(response, file, fileList) {
+      this.doc.isUploading = false;
+      this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+      this.getFileList()
+    },
+    /** 删除按钮操作 */
+    handleDeleteDoc(row) {
+      const ids = row.id || this.ids;
+      this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
+        confirmButtonText: this.$t('确定'),
+        cancelButtonText: this.$t('取消'),
+        type: "warning"
+      }).then(function () {
+        return delCommonfile(ids);
+      }).then(() => {
+        this.getFileList()
+        this.msgSuccess(this.$t('删除成功'));
+      })
+    },
+    // 文件下载处理
+    handleDownload(row) {
+      var name = row.fileName;
+      var url = row.fileUrl;
+      var suffix = url.substring(url.lastIndexOf("."), url.length);
+      console.log(url)
+      const a = document.createElement('a')
+      a.setAttribute('download', name)
+      a.setAttribute('target', '_blank')
+      a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
+      a.click()
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    //数据分析
+    handleData() {
+      this.sonRefresh = false;
+      this.$nextTick(() => {
+        this.sonRefresh = true;
+      });
+      this.drawer = true
+    },
+    //文件预览
+    openPdf() {
+      //ppt就跳路由预览,office就直接打开文件新页面
+      const didi = {imgs: this.imgs}
+      if (this.pptView == true && this.ppt == false) {
+        let routeUrl = this.$router.resolve({
+          path: "/cpms/index.html#/pptyulan",
+          query: didi
+        });
+        window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
+        console.log(this.imgs)
+      } else {
+        window.open(this.pdf.pdfUrl)
+      }
+    },
+    handleSeePPT(row) {
+      //ppt预览
+      this.loadingFlash = true
+      this.pdf.open = true
+      this.pdf.title = row.fileName
+      this.pdf.pdfUrl = row.fileUrl
+      this.pptView = true
+      this.ppt = false
+      const formatDate = new FormData();
+      formatDate.append("filepath", row.fileUrl)
+      //调用文件预览api
+      let res = this.officeConvert.pptConvertCommon(formatDate)
+
+      //查看接受的全局方法的返回结果 console.log(res)
+      //利用.then方法接受Promise对象
+
+      res.then((result) => {
+        //关闭加载中
+        this.loadingFlash = false
+
+        //成功时直接给地址
+        this.videoList = result.data.imagePathList
+        //将返回的地址集合遍历添加到绑定的数组中
+        this.imgs = []
+        for (var key = 0; key < this.videoList.length; key++) {
+          this.imgs.push(process.env.VUE_APP_BASE_API + this.videoList[key]);
+        }
+      }).catch(result => {
+
+        //请求失败,关闭loading,pdf地址直接为为空,不显示
+        this.pdf.pdfUrl = ""
+        this.loadingFlash = false;
+      })
+    },
+    handleSee(row) {
+      //office预览
+      this.loadingFlash = true
+      this.pdf.open = true
+      this.pdf.title = row.fileName
+      this.pdf.pdfUrl = ""
+
+      this.pptView = false
+      this.ppt = true
+      //如果是PDF等直接可以打开的就不调接口,否则调用接口
+      if (row.fileName.endsWith('pdf')) {
+        this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
+        this.loadingFlash = false
+      } else {
+        const formatDate = new FormData();
+        formatDate.append("filepath", row.fileUrl)
+
+        //调用文件预览api
+        let res = this.officeConvert.officeConvertCommon(formatDate)
+
+
+        //查看接受的全局方法的返回结果 console.log(res)
+        //利用.then方法接受Promise对象
+        res.then((result) => {
+          //关闭加载中
+          this.loadingFlash = false
+
+          if (result.msg.includes("csv")) {
+            this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
+            this.$alert(result.msg, this.$t('检查乱码'), {dangerouslyUseHTMLString: true});
+            //    this.$message({message: result.msg, center: true,type:'warning',  offset:400, });
+
+          } else if (result.msg.includes("不存在")) {
+            //文件不存在时提示
+            this.pdf.pdfUrl = ""
+            this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
+            //    this.$message({message: result.msg, center: true,type:'warning',  offset:400, });
+            this.pdf.open = false
+          } else if (result.msg.includes("不支持此格式")) {
+
+            this.pdf.pdfUrl = ""
+            this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
+            //    this.$message({message: result.msg, center: true,type:'warning',  offset:400, });
+            this.pdf.open = false
+          } else {
+            //成功时直接给地址
+            this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
+          }
+          // this.$nextTick(() => {
+          //   const iframe = window.frames['iFrame']
+          //   const handleLoad = () => {
+          //     setTimeout(() => {
+          //       const Do = (iframe.contentWindow || iframe.contentDocument)
+          //       console.log(Do.document.getElementsByTagName('table')[0])
+          //       Do.document.getElementsByTagName('table')[0].style.width = "100%"
+          //       Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
+          //     }, 500)
+          //   }
+          //   iframe.addEventListener('load', handleLoad, true)
+          // })
+        }).catch(result => {
+          //请求失败,关闭loading,pdf地址直接为为空,不显示
+          this.pdf.pdfUrl = ""
+          this.loadingFlash = false;
+        })
+      }
+    },
+  }
+};
+</script>

+ 25 - 2
ui/src/views/sems/safecheck/dailycheck/index.vue

@@ -76,7 +76,14 @@
         >删除
         </el-button>
       </el-col>
-
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -143,6 +150,13 @@
             @click="wordView(scope.row)"
           >预览
           </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-document"
+            @click="handleDoc(scope.row)"
+          >附件
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -339,6 +353,7 @@
     <form ref="downloadFormPdf" :action="downloadWordActionPdf" target="FORMSUBMIT">
       <input name="id" v-model="downloadFormPdf.id" hidden/>
     </form>
+    <Attachment ref="childRef"></Attachment>
   </div>
 </template>
 
@@ -359,10 +374,11 @@ import {getToken} from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {mylistPlant} from "@/api/system/plant";
+import Attachment from '@/views/components/file/attachment.vue'
 
 export default {
   name: "Dailycheck",
-  components: {Treeselect},
+  components: {Treeselect,Attachment},
   data() {
     return {
       // 遮罩层
@@ -740,6 +756,13 @@ export default {
         window.open(this.pdf.pdfUrl)
       }
     },
+    /** 报告附件按钮操作 */
+    handleDoc(row) {
+      // 通过ref引用子组件
+      const child = this.$refs.childRef;
+      // 调用子组件的方法并传递参数
+      child.handleDoc(row , 'dailycheck');
+    },
   }
 };
 </script>

+ 19 - 3
ui/src/views/sems/safecheck/personweekcheck/index.vue

@@ -113,8 +113,16 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['safecheck:personweekcheck:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-document"
+            @click="handleDoc(scope.row)"
+          >附件
+          </el-button>
         </template>
       </el-table-column>
+
     </el-table>
 
     <pagination
@@ -207,6 +215,7 @@
               <el-button @click="upload.open = false">取 消</el-button>
           </div>
       </el-dialog>
+    <Attachment ref="childRef"></Attachment>
   </div>
 </template>
 
@@ -217,11 +226,11 @@ import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {mylistPlant} from "@/api/system/plant";
-import {getWeekcheckByWeek} from "@/api/sems/safecheck/weekcheck";
+import Attachment from '@/views/components/file/attachment.vue'
 
 export default {
   name: "Personweekcheck",
-  components: { Treeselect },
+  components: { Treeselect,Attachment },
   data() {
     return {
       // 遮罩层
@@ -492,7 +501,14 @@ export default {
       // 提交上传文件
       submitFileForm() {
           this.$refs.upload.submit();
-      }
+      },
+    /** 报告附件按钮操作 */
+    handleDoc(row) {
+      // 通过ref引用子组件
+      const child = this.$refs.childRef;
+      // 调用子组件的方法并传递参数
+      child.handleDoc(row , 'personweekcheck');
+    },
   }
 };
 </script>

+ 8 - 0
ui/src/views/sems/safecheck/weekcheck/index.vue

@@ -43,6 +43,14 @@
           v-hasPermi="['safecheck:weekcheck:edit']"
         >修改</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
 <!--      <el-col :span="1.5">-->
 <!--        <el-button-->
 <!--          type="danger"-->