فهرست منبع

规章制度预览

ltao 3 سال پیش
والد
کامیت
448485fc4d
3فایلهای تغییر یافته به همراه214 افزوده شده و 29 حذف شده
  1. 21 0
      src/assets/styles/global.css
  2. 18 13
      src/views/combatduty/RateOfTen/index.vue
  3. 175 16
      src/views/regulations/fileinfo/index.vue

+ 21 - 0
src/assets/styles/global.css

@@ -1159,4 +1159,25 @@ input:-moz-placeholder {
 /* 弹出层向下移动 */
 .el-dialog:not(.is-fullscreen) {
   margin-top: 10vh !important;
+}
+/* 规章制度弹框样式 */
+#fileinfodocx .el-dialog__body{
+  height: 650px !important;
+  overflow: auto !important;
+}
+#fileinfopdf .el-dialog__body{
+  height: 650px !important;
+  overflow: auto !important;
+}
+#fileinfodocx .el-dialog{
+  background-color: white !important;
+}
+#fileinfopdf .el-dialog{
+  background-color: white !important;
+}
+#fileinfodocx .el-dialog__title{
+  color: black !important;
+}
+#fileinfopdf .el-dialog__title{
+  color: black !important;
 }

+ 18 - 13
src/views/combatduty/RateOfTen/index.vue

@@ -851,7 +851,7 @@ export default {
                 // console.log(data[1].value)
                 // 设置满编率
                 // var n = data[0].value / (data[1].value + data[0].value);
-                if (_this.form.bzrs == 0) {
+                if (_this.form.bzrs == 0 || _this.form.sjrs==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -897,11 +897,11 @@ export default {
       // 在位率
       var data2 = [
         {
-          value: _this.form.zwrs,
+          value: this.form.zwrs,
           name: "在位人数",
         },
         {
-          value: _this.form.zwrs,
+          value: this.form.zwrs,
           name: "未在位人数",
         },
       ];
@@ -926,7 +926,7 @@ export default {
           name: "出动人数",
         },
         {
-          value: this.form.bzrs,
+          value: this.form.cdrs,
           name: "未出动率",
         },
       ];
@@ -1043,7 +1043,12 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                if (_this.form.zwrs == 0) {
+                // if(_this.form.bzrs-_this.form.zwrs<=0){
+                //   // console.log(1)
+                //   data2[1].value=9
+                //   console.log(data2[1].value)
+                // }
+                if (_this.form.zwrs == 0 || _this.form.bzrs==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                     "\n" +
                     "\n" +
@@ -1132,7 +1137,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                if (_this.form.dkrs == 0) {
+                if (_this.form.dkrs == 0 || _this.form.sjrs==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                     "\n" +
                     "\n" +
@@ -1194,7 +1199,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                if (_this.form.cdrs == 0) {
+                if (_this.form.cdrs == 0 || _this.form.bzrs) {
                   var s = `{value|${(0).toFixed()}%}` +
                     "\n" +
                     "\n" +
@@ -1258,7 +1263,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                 if (data5[0].value== 0) {
+                 if (data5[0].value== 0||_this.form.zwrs==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -1320,7 +1325,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                 if (_this.zhuangbei.zbsy== 0) {
+                 if (_this.zhuangbei.zbsy== 0 || _this.zhuangbei.zbbz==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -1392,7 +1397,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                if (_this.zhuangbei.zbky== 0) {
+                if (_this.zhuangbei.zbky== 0 || _this.zhuangbei.zbsy) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -1465,7 +1470,7 @@ export default {
               },
               formatter: function (params) {
                 // var n = data8[0].value / (data8[1].value + data8[0].value);
-                 if (_this.zhuangbei.sjpt== 0) {
+                 if (_this.zhuangbei.sjpt== 0 || _this.zhuangbei.bzpt) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -1553,7 +1558,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                if (_this.zhuangbei.cczb== 0) {
+                if (_this.zhuangbei.cczb== 0 || _this.zhuangbei.zbsy==0) {
                   var s = `{value|${(0).toFixed()}%}` +
                   "\n" +
                   "\n" +
@@ -1625,7 +1630,7 @@ export default {
                 name: { color: "#fff", fontSize: 14 },
               },
               formatter: function (params) {
-                   if (_this.zhuangbei.zbcd== 0) {
+                   if (_this.zhuangbei.zbcd== 0 || _this.form.zbbz) {
                   var s = `{value|${(0).toFixed()}%}`+
                   "\n" +
                   "\n" +

+ 175 - 16
src/views/regulations/fileinfo/index.vue

@@ -126,11 +126,8 @@
             >
               <span>
                 <!-- <iframe :src="'http://192.168.5.177:8080'+scope.row.parentDirName" target="_blank">阅读</iframe> -->
-                <a
-                  :href="'http://192.168.2.250:8089' + scope.row.parentDirName"
-                  target="_blank"
-                  >阅读</a
-                >
+                <!-- :href="'http://192.168.2.250:8089' + scope.row.parentDirName" -->
+                <a target="_blank">阅读</a>
               </span>
             </el-button>
             <el-button
@@ -139,11 +136,7 @@
               @click="handleupLoad(scope.row)"
             >
               <span class="chakan1">
-                <a
-                  :href="'http://192.168.2.250:8089' + scope.row.parentDirName"
-                  download
-                  >下载</a
-                >
+                <a :href="downurl + scope.row.parentDirName" download>下载</a>
               </span>
             </el-button>
             <el-button size="dels" type="text" @click="handledels(scope.row)">
@@ -487,11 +480,75 @@
           <el-button @click="cancel" size="" class="aa1"> 取 消</el-button>
         </div>
       </el-dialog>
+      <!-- 添加预览doc文件弹框 -->
+      <el-dialog
+        style="color: pink"
+        :title="title3"
+        :visible.sync="open33"
+        width="850px"
+        append-to-body
+        id="fileinfodocx"
+        class="el-dialog__header"
+        :close-on-click-modal="false"
+      >
+        <div  ref="file"></div>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitForm3">确 定</el-button>
+          <el-button @click="open33 = false" size="" class="aa1">
+            取 消</el-button
+          >
+        </div>
+      </el-dialog>
+      <!-- 预览PDF文件弹框 -->
+      <el-dialog
+        :title="title3"
+        :visible.sync="previewDialog"
+        width="850px"
+        append-to-body
+        id="fileinfopdf"
+        class="el-dialog__header"
+        :close-on-click-modal="false"
+      >
+        <template>
+          <!-- <div style="margin-bottom:20px"> -->
+            <div style="display:flex">
+            <el-button :theme="'default'" type="submit" :title="'上一页'" @click.native="prePage"> 上一页</el-button>
+            <div style="margin-left:10px;margin-right:10px">{{pageNum}}/{{pageTotalNum}} </div>
+            <el-button :theme="'default'" type="submit" :title="'下一页'" @click.native="nextPage"> 下一页</el-button>
+            <!-- <el-button :theme="'default'" type="submit" :title="'顺时针旋转'" @click.native="clock" > 顺时针旋转</el-button>
+            <el-button :theme="'default'" type="submit" :title="'逆时针旋转'" @click.native="counterClock" > 逆时针旋转</el-button>
+           <el-button :theme="'default'" type="submit" :title="'打印'" @click.native="pdfPrintAll"> 打印</el-button> -->
+          </div>
+            <PDF
+              ref="pdf"
+              :src="pdfurl"
+              :page="pageNum"
+              :rotate="pageRotate"
+              @progress="loadedRatio = $event"
+              @page-loaded="pageLoaded($event)"
+              @num-pages="pageTotalNum = $event"
+              @error="pdfError($event)"
+              @link-clicked="page = $event"
+              
+            ></PDF>
+          <!-- </div> -->
+            <!-- <div class="el-dialog__footer"> -->
+              <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="previewDialog = false">确 定</el-button>
+                <el-button @click="previewDialog = false" size="" class="aa1">取 消</el-button>
+              </div>
+          <!-- </div> -->
+        </template>
+      </el-dialog>
     </div>
   </div>
 </template>
 
 <script>
+import axios from "axios";
+import PDF from "vue-pdf";
+const docx = require("docx-preview");
+window.JSZip = require("jszip");
 import {
   // 获取文件列表接口
   listFileinfo,
@@ -614,6 +671,19 @@ export default {
       addbtn: true,
       // 虚拟字段
       fid: "",
+      open33: false,
+      title3: "预览文件",
+      // 下载文件路径
+      downurl: process.env.VUE_APP_BASE_API,
+      // pdf文件
+      previewDialog: false,
+      pdfurl:"",
+      pageNum: 1,
+      pageTotalNum: 1,
+      pageRotate: 0,
+      // 加载进度
+      loadedRatio: 0,
+      curPageNum: 0,
     };
   },
 
@@ -631,7 +701,58 @@ export default {
     $(".app-wrapper").addClass("hideSidebar");
     $(".sidebar-logo-container").removeClass("collapse");
   },
+  components: {
+    PDF,
+  },
   methods: {
+    /**
+     * 预览PDF
+     */
+    previewPDF(row, index) {
+      this.previewDialog = true;
+      console.log("", row, index);
+    },
+    // 上一页函数,
+    prePage() {
+      var page = this.pageNum;
+      page = page > 1 ? page - 1 : this.pageTotalNum;
+      this.pageNum = page;
+    },
+    // 下一页函数
+    nextPage() {
+      var page = this.pageNum;
+      page = page < this.pageTotalNum ? page + 1 : 1;
+      this.pageNum = page;
+    },
+    // 页面顺时针翻转90度。
+    clock() {
+      this.pageRotate += 90;
+    },
+    // 页面逆时针翻转90度。
+    counterClock() {
+      this.pageRotate -= 90;
+    },
+    // 页面加载回调函数,其中e为当前页数
+    pageLoaded(e) {
+      this.curPageNum = e;
+    },
+    // 错误时回调函数。
+    pdfError(error) {
+      console.error(error);
+    },
+    // 打印全部
+    pdfPrintAll() {
+      /**
+       * 打印界面字符乱码是因为你pdf中使用了自定义字体导致的,谷歌浏览器打印的时候预览界面真的变成了真·方块字 ,解决方案如下:
+       * 用文章最后的pdfjsWrapper.js在替换掉node_modules/vue-pdf/src/pdfjsWrapper.js
+       */
+      console.log("打印");
+      this.$refs.pdf.print();
+    },
+    // 预览弹框
+    submitForm3() {
+      this.open33 = false;
+    },
     RankList() {
       rankList().then((res) => {
         this.Ranking = res.data;
@@ -799,7 +920,7 @@ export default {
 
         // })
 
-        console.log(this.fileinfoList);
+        // console.log(this.fileinfoList);
         this.total = response.total;
         this.loading = false;
       });
@@ -1009,8 +1130,24 @@ export default {
     },
     // 阅读按钮操作
     ViewRead(row) {
-      // console.log(row.id)
-      // console.log(row)
+      console.log(row);
+      if (row.parentDirId == ".docx" || row.parentDirId == ".doc") {
+        this.open33 = true;
+        axios({
+          method: "get",
+          responseType: "blob", // 设置响应文件格式
+          url: process.env.VUE_APP_BASE_API + row.parentDirName,
+        }).then(({ data }) => {
+          // console.log(11)
+          console.log(data);
+          $(".docx").attr("id", "printArea");
+          // console.log($(".docx"));
+          docx.renderAsync(data, this.$refs.file); // 渲染到页面预览
+        });
+      } else if(row.parentDirId =='.pdf'){
+        this.previewDialog = true;
+        this.pdfurl=process.env.VUE_APP_BASE_API + row.parentDirName
+      }
       row.common = "1";
       updateFileinfo(row).then((res) => {
         this.getList();
@@ -1018,7 +1155,6 @@ export default {
           this.Ranking = res.data;
         });
       });
-      // console.log(this.fileinfoList);
       // window.open("www.baidu.com","_self");
     },
     // 下载按钮操作
@@ -1028,6 +1164,25 @@ export default {
 </script>
 
 <style scoped>
+/* ::v-deep .el-dialog__body{
+  overflow: auto !important;
+  height: 600px !important;
+} */
+/* doc文件样式修改 */
+::v-deep .docx{
+  padding: 0 !important;
+}
+::v-deep .docx-wrapper>section.docx{
+  /* padding: 0 !important; */
+ margin-bottom: 0px !important;
+ box-shadow: none;
+}
+/* 预览弹框背景去除 */
+::v-deep .docx-wrapper {
+  padding: 0 !important;
+  background: none !important;
+}
+
 ::v-deep .vue-treeselect__placeholder {
   color: #bdbdbd4f !important;
 }
@@ -1456,11 +1611,15 @@ body,
 ::v-deep input:-moz-placeholder {
   color: #bdbdbd4f !important;
 }
-.aa1{
+.aa1 {
   background-color: #1263aa !important;
   color: #fff !important;
 }
-::v-deep .el-dialog__footer .dialog-footer .el-button--btn{
+::v-deep .el-dialog__footer .dialog-footer .el-button--btn {
   padding-top: 00px !important;
 }
+.userAgree{
+  height: 600px;
+  overflow: auto;
+}
 </style>