| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-row class="title-center"> |
| | | <el-col :span="fileSpan"> |
| | | <el-col :span="14"> |
| | | <el-form ref="form" :inline="true" :model="form" label-width="100px"> |
| | | <el-form-item label="EXCEL导入"> |
| | | <!-- <el-input v-model="form.name" placeholder="未选择文件"></el-input>--> |
| | | <el-upload |
| | | class="upload-demo inline-block margin-right-10" |
| | | ref="upload" |
| | | action="" |
| | | :http-request="uploadSectionFile" |
| | | :on-preview="handlePreview" |
| | | :on-remove="handleRemove" |
| | | :file-list="fileList" |
| | | :before-upload="beforeUpload" |
| | | :auto-upload="true" |
| | | :auto-upload="false" |
| | | > |
| | | <el-button type="primary" size="small" class="btns">选择文件</el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="btns" |
| | | size="small" |
| | | icon="el-icon-bottom" |
| | | @click="dangerImport" |
| | | >导入</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | class="btns" |
| | | size="small" |
| | | icon="el-icon-download" |
| | | @click="downloadTemplate" |
| | | >下载模板</el-button |
| | | > |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | | <el-col :span="14-fileSpan"> |
| | | <el-button |
| | | type="primary" |
| | | class="btns" |
| | | size="small" |
| | | icon="el-icon-bottom" |
| | | >导入</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | class="btns" |
| | | size="small" |
| | | icon="el-icon-download" |
| | | @click="downloadTemplate" |
| | | >下载模板</el-button |
| | | > |
| | | </el-col> |
| | | <!-- <el-col :span="14-fileSpan">--> |
| | | <!-- --> |
| | | <!-- </el-col>--> |
| | | <el-col :span="10" style="text-align: right"> |
| | | <el-button |
| | | class="btns" |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import {getPageList,delDanger,analogy_export_do,downloadFile} from "@/api/sgyhpczl/hiddenDangerRegistration"; |
| | | import {getPageList,delDanger,analogy_export_do,downloadFile,danger_import_do} from "@/api/sgyhpczl/hiddenDangerRegistration"; |
| | | import {initJCBM ,initYHLX, initBC ,initJCLB ,initYHBM ,initYHJB,initLlr} from "@/api/sgyhpczl/initSelect"; |
| | | export default { |
| | | data() { |
| | |
| | | return false; |
| | | } |
| | | }, |
| | | //上传 |
| | | uploadSectionFile(param) { |
| | | console.log(param) |
| | | let form = new FormData(); |
| | | var that = this; |
| | | form.append('file', param.file); |
| | | //隐患延期申请附件 |
| | | form.append('type', "0"); |
| | | uploadFile(form).then(res => { |
| | | var data = res.data; |
| | | if (data.ok) { |
| | | var fileName = data.data.fileName[0]; |
| | | if (!fileName.endsWith("a62b")) { |
| | | fileName = fileName + "a62b"; |
| | | } |
| | | var fileObj = { |
| | | "fileName": fileName, |
| | | "uid": param.file.uid |
| | | } |
| | | this.fileNameList.push(fileObj); |
| | | danger_import_do(form).then(res=>{ |
| | | if (res.data.ok==1){ |
| | | console.log(res.data) |
| | | } else{ |
| | | this.$message({type:'error', message:res.data.msg, duration:3000}) |
| | | } |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | |
| | | }, |
| | | //导入 |
| | | dangerImport(){ |
| | | this.$refs.upload.submit(); |
| | | }, |
| | | //下载模板 |
| | | downloadTemplate(){ |