zhangding há 3 anos atrás
pai
commit
35388371a6

+ 1 - 0
master/src/main/resources/mybatis/intact/TIntactGylMapper.xml

@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="dataNo"    column="data_no"    />
         <result property="bookNo"    column="book_no"    />
         <result property="manufactor"    column="manufactor"    />
+        <result property="archives"    column="archives"    />
         <result property="deptName" column="dept_name" />
     </resultMap>
 

+ 162 - 1
ui/src/views/intact/gyl/index.vue

@@ -492,6 +492,12 @@
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.submitdate, '{y}-{m}-{d}') }}</span>
         </template>
+      </el-table-column>
+            <el-table-column label="档案" align="center" prop="archives" :show-overflow-tooltip="true" >
+       <template slot-scope="scope">  
+      
+         <el-button icon="el-icon-folder" style="color:#6e96fa;"  @click="handleDoc(scope.row)"  ></el-button>
+       </template>
       </el-table-column>
       <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true"/>
 <!--      <el-table-column label="创建人" align="center" prop="createrCode" :show-overflow-tooltip="true"/>-->
@@ -874,11 +880,77 @@
               <el-button @click="upload.open = false">取 消</el-button>
           </div>
       </el-dialog>
+         <!-- 档案附件对话框 -->
+    <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
+      <el-upload
+        ref="doc"
+        :limit="50"
+        :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')"
+                size="mini"
+                type="text"
+                icon="el-icon-view"
+                @click="handleSee(scope.row)"
+              >{{ $t('预览') }}</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 v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" 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 :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { listGyl, getGyl, delGyl, addGyl, updateGyl, exportGyl, importTemplate} from "@/api/intact/gyl";
+import {allFileList, delCommonfile} from "@/api/common/commonfile";
 import { listRecord} from "@/api/inspection/record";
 import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
@@ -926,6 +998,40 @@ export default {
             // 上传的地址
             url: process.env.VUE_APP_BASE_API + "/intact/gyl/importData"
         },
+           // 报告附件参数
+      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: 'gyl'
+        },
+        pType: 'gyl',
+        pId: null
+      },
+      pdf : {
+        title: '',
+        pdfUrl: '',
+        numPages: null,
+        open: false,
+        pageNum: 1,
+        pageTotalNum: 1,
+        loadedRatio: 0,
+      },
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -1168,6 +1274,7 @@ export default {
         }
       });
     },
+    
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
@@ -1221,7 +1328,61 @@ export default {
       // 提交上传文件
       submitFileForm() {
           this.$refs.upload.submit();
-      }
+      },
+       /** 报告附件按钮操作 */
+     handleDoc(row) {
+      this.doc.id = row.id;
+      this.doc.title = row.filename;
+      this.doc.open = true;
+      this.doc.queryParams.pId = row.id
+      this.doc.pId = row.id
+      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()
+    },
   }
 };
 </script>

+ 162 - 1
ui/src/views/intact/ysj/index.vue

@@ -257,6 +257,12 @@
       <el-table-column label="单元" align="center" prop="unit" :show-overflow-tooltip="true"/>
       <el-table-column label="设备名称" align="center" prop="devname" :show-overflow-tooltip="true"/>
       <el-table-column label="设备位号" align="center" prop="devno" :show-overflow-tooltip="true"/>
+            <el-table-column label="档案" align="center" prop="archives" :show-overflow-tooltip="true" >
+       <template slot-scope="scope">  
+      
+         <el-button icon="el-icon-folder" style="color:#6e96fa;"  @click="handleDoc(scope.row)"  ></el-button>
+       </template>
+      </el-table-column>
       <el-table-column label="安装位置" align="center" prop="position" :show-overflow-tooltip="true"/>
       <el-table-column label="尺寸" align="center" prop="deviceSize" :show-overflow-tooltip="true"/>
       <el-table-column label="设计压力" align="center" prop="desPressure" :show-overflow-tooltip="true"/>
@@ -468,11 +474,78 @@
         <el-button @click="upload.open = false">取 消</el-button>
       </div>
     </el-dialog>
+     <!-- 档案附件对话框 -->
+    <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
+      <el-upload
+        ref="doc"
+        :limit="50"
+        :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')"
+                size="mini"
+                type="text"
+                icon="el-icon-view"
+                @click="handleSee(scope.row)"
+              >{{ $t('预览') }}</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 v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" 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 :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
 import {listYsj, getYsj, delYsj, addYsj, updateYsj, exportYsj, importTemplate} from "@/api/intact/ysj";
+import {allFileList, delCommonfile} from "@/api/common/commonfile";
 import {treeselect} from "@/api/system/dept";
 import {getToken} from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
@@ -519,6 +592,40 @@ export default {
         headers: {Authorization: "Bearer " + getToken()},
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/intact/ysj/importData"
+      },
+         // 报告附件参数
+      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: 'ysj'
+        },
+        pType: 'ysj',
+        pId: null
+      },
+      pdf : {
+        title: '',
+        pdfUrl: '',
+        numPages: null,
+        open: false,
+        pageNum: 1,
+        pageTotalNum: 1,
+        loadedRatio: 0,
       },
       // 查询参数
       queryParams: {
@@ -760,7 +867,61 @@ export default {
     // 提交上传文件
     submitFileForm() {
       this.$refs.upload.submit();
-    }
+    },
+      /** 报告附件按钮操作 */
+     handleDoc(row) {
+      this.doc.id = row.id;
+      this.doc.title = row.filename;
+      this.doc.open = true;
+      this.doc.queryParams.pId = row.id
+      this.doc.pId = row.id
+      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()
+    },
   }
 };
 </script>