|
@@ -239,6 +239,27 @@
|
|
|
>{{ $t('数据去重') }}
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="info"
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ size="mini"
|
|
|
+ @click="handleImportFile"
|
|
|
+ v-hasPermi="['sems:specYlgd:edit']"
|
|
|
+ >文件上传
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-dropdown trigger="click" @command="handleDownloadZip">
|
|
|
+ <el-button type="warning" :disabled="multiple">
|
|
|
+ 文件下载<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="info" >注册登记资料</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="report" >全面检验报告</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
@@ -320,6 +341,38 @@
|
|
|
<u-table-column :label="$t('年度检查报告编号')" align="center" prop="yearReportNo" :show-overflow-tooltip="true"/>
|
|
|
<u-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
|
|
|
<u-table-column :label="$t('备注2')" align="center" prop="remarks2" :render-header="remarksHeader" :show-overflow-tooltip="true"/>
|
|
|
+ <u-table-column label="注册登记资料" align="center" prop="tnNew-score" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-badge
|
|
|
+ :value="scope.row.infoNum"
|
|
|
+ :hidden="scope.row.infoNum == 0"
|
|
|
+ :type="'primary'"
|
|
|
+ :offset="[-5, 5]"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-folder"
|
|
|
+ style="color:#6e96fa;"
|
|
|
+ @click="handleDoc(scope.row , 'sems-ylgd-info')"
|
|
|
+ circle>
|
|
|
+ </el-button>
|
|
|
+ </el-badge>
|
|
|
+ </template>
|
|
|
+ </u-table-column>
|
|
|
+ <u-table-column label="全面检验报告" align="center" prop="tnNew-score" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-badge
|
|
|
+ :value="scope.row.reportNum"
|
|
|
+ :hidden="scope.row.reportNum == 0"
|
|
|
+ :type="'primary'"
|
|
|
+ :offset="[-5, 5]"
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-folder"
|
|
|
+ size="small"
|
|
|
+ style="color:#6e96fa;" @click="handleDoc(scope.row , 'sems-ylgd-report')" circle></el-button>
|
|
|
+ </el-badge>
|
|
|
+ </template>
|
|
|
+ </u-table-column>
|
|
|
<u-table-column :label="$t('操作')" align="center" fixed="right" width="170" class-name="small-padding">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
@@ -798,6 +851,236 @@
|
|
|
</el-form>
|
|
|
<el-button type="primary" @click="submitModofyForm">{{ $t('提交') }}</el-button>
|
|
|
</el-dialog>
|
|
|
+ <!-- 用户导入对话框 -->
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ {{ $t('确认人') }}
|
|
|
+ <el-select v-model="upload.submitData.wxjl" :placeholder="$t('请选择')+ $t('装置维修经理')" filterable clearable
|
|
|
+ size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in wxjlList"
|
|
|
+ :key="dict.userId"
|
|
|
+ :label="dict.nickName"
|
|
|
+ :value="dict.userId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xlsx, .xls"
|
|
|
+ :data="upload.submitData"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="false"
|
|
|
+ drag
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ {{ $t('将文件拖到此处,或') }}
|
|
|
+ <em>{{ $t('点击上传') }}</em>
|
|
|
+ </div>
|
|
|
+ <div class="el-upload__tip" slot="tip">
|
|
|
+ <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
|
|
|
+ <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
|
|
|
+ </div>
|
|
|
+ <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
|
|
|
+ <input name="type" :value="upload.type" hidden/>
|
|
|
+ </form>
|
|
|
+ <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
|
|
|
+ <div class="el-upload__tip" style="color:red" slot="tip"> Excel单元格式为文本格式 </div>
|
|
|
+
|
|
|
+ </el-upload>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <a v-if="waitSubmit" style="margin-right: 300px">{{ $t('正在导入...') }}</a>
|
|
|
+ <el-button type="primary" @click="submitFileForm" v-loading.fullscreen.lock="fullscreenLoading">{{
|
|
|
+ $t('确定')
|
|
|
+ }}
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="upload.open = false">{{ $t('取消') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <form ref="downloadDevForm" :action="downloadDevAction" target="FORMSUBMIT">
|
|
|
+ <input name="devType" v-model="devType" hidden/>
|
|
|
+ <input name="ids" v-model="ids" hidden/>
|
|
|
+ <input name="downloadType" v-model="downloadType" hidden/>
|
|
|
+ </form>
|
|
|
+ <form ref="downloadForm" :action="downloadZipAction" target="FORMSUBMIT">
|
|
|
+ <input name="id" v-model="downloadForm.id" hidden/>
|
|
|
+ </form>
|
|
|
+ <el-dialog :close-on-click-modal="false" :title="$t('检验更新')" width="30%" :visible.sync="inspectionInformation">
|
|
|
+ <el-form ref="dateform" label-width="120px">
|
|
|
+ <el-form-item>
|
|
|
+ <span>{{ $t('已选择') }} {{ dataListSelections.length }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" :disabled="dataListSelections.length <= 0" @click="downloadDev(2)">
|
|
|
+ {{ $t('downloadSelect') }}
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ ref="upload"
|
|
|
+ :limit="5"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="true"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="uploadUrl(2)"
|
|
|
+ multiple>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">{{ $t('文件') }}<em>{{ $t('点击上传') }}</em></div>
|
|
|
+ <div class="el-upload__tip" slot="tip">{{ $t('仅支持excel格式') }}</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="inspectionInformation = false">{{ $t('返回') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :title="modifyTitle" :visible.sync="modifyVisible" width="550px" append-to-body>
|
|
|
+ <el-form ref="modifyForm" :model="modifyForm" :rules="modifyRules">
|
|
|
+ <el-form-item :label="$t('确认人')" prop="wxjl">
|
|
|
+ <el-select v-model="modifyForm.wxjl" :placeholder="$t('请选择')+ $t('装置维修经理')" filterable clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in wxjlList"
|
|
|
+ :key="dict.userId"
|
|
|
+ :label="dict.nickName"
|
|
|
+ :value="dict.userId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-button type="primary" @click="submitModofyForm">{{ $t('提交') }}</el-button>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 文件导入对话框 -->
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :title="uploadFile.title" :visible.sync="uploadFile.open" width="400px" append-to-body>
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ 装 置
|
|
|
+ <el-select v-model="uploadFile.plantCode" :placeholder="$t('请选择')+ $t('装置')" filterable clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in plantOptions"
|
|
|
+ :key="dict.name"
|
|
|
+ :label="dict.name"
|
|
|
+ :value="dict.name"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ 文件类型
|
|
|
+ <el-select v-model="uploadFile.fileType" :placeholder="$t('请选择')+ $t('文件类型')" filterable clearable
|
|
|
+ size="small">
|
|
|
+ <el-option
|
|
|
+ key="info"
|
|
|
+ label="注册登记资料"
|
|
|
+ value="info"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ key="report"
|
|
|
+ label="全面检验报告"
|
|
|
+ value="report"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <el-upload
|
|
|
+ :limit="100"
|
|
|
+ :headers="uploadFile.headers"
|
|
|
+ :action="uploadFile.url"
|
|
|
+ :on-success="handleFileSuccess2"
|
|
|
+ :on-change="handleFileChange"
|
|
|
+ :auto-upload="false"
|
|
|
+ ref="uploadFile"
|
|
|
+ drag
|
|
|
+ multiple
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ {{ $t('将文件拖到此处,或') }}
|
|
|
+ <em>{{ $t('点击上传') }}</em>
|
|
|
+ </div>
|
|
|
+ <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:文件名为 管道编号_XXXXX.xxx') }}</div>
|
|
|
+
|
|
|
+ </el-upload>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <a v-if="waitSubmit" style="margin-right: 300px">{{ $t('正在导入...') }}</a>
|
|
|
+ <el-button type="primary" @click="submitFileForm2" :loading="fullscreenLoading">{{
|
|
|
+ $t('确定')
|
|
|
+ }}
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="uploadFile.open = false">{{ $t('取消') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 报告附件对话框 -->
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" 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="220" 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 type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">保存</el-button>
|
|
|
+ <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">取消</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>
|
|
|
+ <el-dialog :close-on-click-modal="false" 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 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>
|
|
|
<add-approve v-if="addAprroveVisible" ref="addApprove" @refreshDataList="getList"></add-approve>
|
|
|
<his-approve v-if="hisAprroveVisible" ref="hisApprove" @refreshDataList="getList"></his-approve>
|
|
|
<his-check v-if="hisCheckVisible" ref="hisCheck" @refreshDataList="getList"></his-check>
|
|
@@ -815,7 +1098,9 @@ import {
|
|
|
exportSpecYlgd,
|
|
|
updateSpecYlgdPre,
|
|
|
duplicate,
|
|
|
- updateSpecYlgdBatch
|
|
|
+ importFiles,
|
|
|
+ updateSpecYlgdBatch,
|
|
|
+ downloadFileZip
|
|
|
} from "@/api/sems/specYlgd";
|
|
|
import {treeselect} from "@/api/system/dept";
|
|
|
import {getToken} from "@/utils/auth";
|
|
@@ -828,7 +1113,7 @@ import HisCheck from "../check/check"
|
|
|
import {addModify} from "@/api/sems/his/modify";
|
|
|
import {listPostUser} from "@/api/system/user";
|
|
|
import HisReform from "./specYlgd-hisReform";
|
|
|
-import {updateSpecYlrqBatch} from "@/api/sems/specYlrq";
|
|
|
+import {allFileList, delCommonfile} from "@/api/common/commonfile";
|
|
|
|
|
|
export default {
|
|
|
name: "SpecYlgd",
|
|
@@ -898,6 +1183,67 @@ export default {
|
|
|
url: process.env.VUE_APP_BASE_API + "/sems/specYlgd/importData",
|
|
|
submitData: {wxjl: null}
|
|
|
},
|
|
|
+ // 报告附件参数
|
|
|
+ doc: {
|
|
|
+ file: "",
|
|
|
+ // 是否显示弹出层(报告附件)
|
|
|
+ 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: 'traning'
|
|
|
+ },
|
|
|
+ pType: 'traning',
|
|
|
+ pId: null,
|
|
|
+ form: {}
|
|
|
+ },
|
|
|
+ // 用户导入参数
|
|
|
+ uploadFile: {
|
|
|
+ downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
|
|
|
+ // 是否显示弹出层(用户导入)
|
|
|
+ open: false,
|
|
|
+ type: "specYlgd",
|
|
|
+ // 弹出层标题(用户导入)
|
|
|
+ title: "",
|
|
|
+ // 是否禁用上传
|
|
|
+ isUploading: false,
|
|
|
+ fileList: [],
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
+ updateSupport: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: {Authorization: "Bearer " + getToken(),"Content-Type": "multipart/form-data"},
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/sems/specYlgd/importFiles",
|
|
|
+ fileType: null,
|
|
|
+ plantCode: null,
|
|
|
+ },
|
|
|
+ pdf : {
|
|
|
+ title: '',
|
|
|
+ pdfUrl: '',
|
|
|
+ numPages: null,
|
|
|
+ open: false,
|
|
|
+ pageNum: 1,
|
|
|
+ pageTotalNum: 1,
|
|
|
+ loadedRatio: 0,
|
|
|
+ },
|
|
|
+ downloadForm: {
|
|
|
+ id: '',
|
|
|
+ type: ''
|
|
|
+ },
|
|
|
+ downloadZipAction: process.env.VUE_APP_BASE_API + '/sems/specYlgd/downloadFileZip',
|
|
|
+ fileList: [],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
searchValue: null,
|
|
@@ -1159,6 +1505,7 @@ export default {
|
|
|
this.msgSuccess(this.$t('修改成功'));
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
+ this.$refs.deviceTable.clearSelection();
|
|
|
});
|
|
|
/*updateSpecYlgdPre(this.form).then(response => {
|
|
|
this.open = false;
|
|
@@ -1452,6 +1799,156 @@ export default {
|
|
|
)
|
|
|
]
|
|
|
},
|
|
|
+
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ handleImportFile() {
|
|
|
+ this.uploadFile.title = "文件导入";
|
|
|
+ this.uploadFile.open = true;
|
|
|
+ },
|
|
|
+ /** 报告附件按钮操作 */
|
|
|
+ handleDoc(row , fileType) {
|
|
|
+ var workType = "";
|
|
|
+ if (fileType === "byxworklicense-boiler"){
|
|
|
+ workType = this.$t('裂解(裂化)');
|
|
|
+ }else if (fileType === "byxworklicense-compression"){
|
|
|
+ workType = this.$t('压力容器');
|
|
|
+ }else if (fileType === "byxworklicense-separation"){
|
|
|
+ workType = this.$t('压力管道');
|
|
|
+ }else if (fileType === "byxworklicense-pguaeu"){
|
|
|
+ workType = '';
|
|
|
+ }
|
|
|
+ this.doc.pType = fileType
|
|
|
+ this.doc.queryParams.pType = fileType
|
|
|
+ this.doc.id = row.id;
|
|
|
+ this.doc.title = this.$t('附件') ;
|
|
|
+ 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 => {
|
|
|
+ response.forEach(element => {
|
|
|
+ element["isEdit"] = false
|
|
|
+ });
|
|
|
+ response.forEach(element => {
|
|
|
+ element["isAdd"] = false
|
|
|
+ });
|
|
|
+ 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()
|
|
|
+ },
|
|
|
+ // 文件下载处理
|
|
|
+ handleDownload(row) {
|
|
|
+ var name = row.fileName;
|
|
|
+ var url = row.fileUrl;
|
|
|
+ var suffix = url.substring(url.lastIndexOf("."), url.length);
|
|
|
+ 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()
|
|
|
+ },
|
|
|
+ openPdf(){
|
|
|
+ window.open(this.pdf.pdfUrl);//path是文件的全路径地址
|
|
|
+ },
|
|
|
+ handleSee (row){
|
|
|
+ // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
|
|
|
+ this.pdf.open =true
|
|
|
+ this.pdf.title = row.fileName
|
|
|
+ this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ 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('删除成功'));
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDownloadZip(type) {
|
|
|
+ const ids = this.ids;
|
|
|
+ this.downloadForm.id = ids.join(',')
|
|
|
+ this.downloadForm.type = type
|
|
|
+ downloadFileZip(this.downloadForm).then(response => {
|
|
|
+ // 创建临时链接
|
|
|
+ const url = window.URL.createObjectURL(new Blob([response]));
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = url;
|
|
|
+ link.setAttribute('download', '文件.zip'); // 和后端返回的文件名一致
|
|
|
+ document.body.appendChild(link);
|
|
|
+
|
|
|
+ // 模拟点击下载
|
|
|
+ link.click();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 文件上传中处理
|
|
|
+ handleFileUploadProgress2(event, file, fileList) {
|
|
|
+ this.uploadFile.fileList = fileList;
|
|
|
+ this.uploadFile.isUploading = true;
|
|
|
+ },
|
|
|
+ // 文件上传成功处理
|
|
|
+ handleFileSuccess2(response, file, fileList) {
|
|
|
+ if (response.code == 200) {
|
|
|
+ this.msgSuccess("导入成功");
|
|
|
+ this.$refs.uploadFile.clearFiles();
|
|
|
+ this.uploadFile.open = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleFileChange(file, fileList) {
|
|
|
+ console.log('文件变动:', file);
|
|
|
+ console.log(fileList)
|
|
|
+ this.fileList = fileList; // 更新文件列表
|
|
|
+ console.log(this.fileList)
|
|
|
+ },
|
|
|
+ // 提交上传文件
|
|
|
+ submitFileForm2() { // 导入
|
|
|
+ let formData = new FormData(); // 用FormData存放上传文件
|
|
|
+ console.log(this.fileList)
|
|
|
+ this.fileList.forEach(file => {
|
|
|
+ formData.append('file', file.raw)
|
|
|
+ })
|
|
|
+ formData.append("plantCode", this.uploadFile.plantCode)
|
|
|
+ formData.append("fileType", this.uploadFile.fileType)
|
|
|
+ // importCase是上传接口
|
|
|
+ importFiles(formData).then((res) => {
|
|
|
+ this.fullscreenLoading = true
|
|
|
+ //手动上传无法触发成功或失败的钩子函数,因此这里手动调用
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.msgSuccess("导入成功");
|
|
|
+ this.$refs.uploadFile.clearFiles();
|
|
|
+ this.uploadFile.open = false
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ this.fullscreenLoading = false
|
|
|
+ }, (err) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancelBatch() {
|
|
|
+ this.openBatch = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|