Merge remote-tracking branch 'origin/master'
| | |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // 导入 |
| | | export function importData(data) { |
| | | return request({ |
| | | url: '/threshold/import', |
| | | method: 'post', |
| | | data: data, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | }, |
| | | timeout: 150000 |
| | | }) |
| | | } |
| | |
| | | <el-row class="content-warp"> |
| | | <el-button size="small" type="success" @click="addOpen" plain>新增</el-button> |
| | | <el-button size="small" type="danger" @click="bathDelete" plain>删除</el-button> |
| | | <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="导入点位"> |
| | | <div class="bottom_"> |
| | | <p>导入点位只做新增操作</p> |
| | | </div> |
| | | <div class="bottom_"> |
| | | <el-upload |
| | | ref="upload" |
| | | class="upload-demo" |
| | | drag |
| | | :action="importUrl" |
| | | :file-list="fileList" |
| | | :before-upload="beforeUpload" |
| | | > |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <div class="el-upload__tip" slot="tip">只能上传xls/xlsx文件</div> |
| | | </el-upload> |
| | | </div> |
| | | <div> |
| | | <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport" |
| | | v-hasPermi="['point:import']">导入</el-button> |
| | | </div> |
| | | <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference" v-hasPermi="['point:import']">导入白名单</el-button> |
| | | </el-popover> |
| | | </el-row> |
| | | <el-row class="content-warp"> |
| | | <el-col :span="24"> |
| | |
| | | listThreshold, |
| | | getThreshold, |
| | | updateThreshold, |
| | | importData, |
| | | } from "@/api/platform/threshold"; |
| | | import { |
| | | editCar, |
| | |
| | | {required: true, message: "设备编码不能为空", trigger: "blur"}, |
| | | ], |
| | | }, |
| | | // 导入文件路径 |
| | | importUrl: '', |
| | | fileList: [], |
| | | importFile: null, |
| | | upload: false, |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | this.$modal.msgSuccess("批量删除成功"); |
| | | this.ids = []; |
| | | }) |
| | | }, |
| | | beforeUpload(file) { |
| | | this.importFile = file |
| | | this.fileList = [file] |
| | | return false |
| | | }, |
| | | // 导入白名单 |
| | | handleImport() { |
| | | this.upload = true; |
| | | let formData = new FormData() |
| | | formData.append("file", this.importFile) |
| | | importData(formData).then(res => { |
| | | this.$message.success("导入成功") |
| | | this.upload = false |
| | | this.fileList = [] |
| | | this.getWhiteList() |
| | | }) |
| | | } |
| | | } |
| | | }; |