| | |
| | | <div class="uploading-btn-to"> |
| | | <i class="iconfont iconAdd"></i> 上传 |
| | | </div> |
| | | <div class="el-upload__tip" slot="tip">只能上传.xls,.xlsx文件</div> |
| | | <div class="el-upload__tip" slot="tip"> |
| | | 只能上传.xls,.xlsx文件 |
| | | </div> |
| | | </dragUpload> |
| | | </div> |
| | | <div class="download-file"> |
| | | <i class="iconfont iconFile"></i> |
| | | <a href="/static/学员导入模板.xlsx" download>下载学员模板</a> |
| | | <a href="/static/学员导入模板.xlsx" download |
| | | >下载学员模板</a |
| | | > |
| | | </div> |
| | | </div> |
| | | <div style="font-size: 12px; color: #6993ff" v-if="hasAudience"> |
| | | 已上传,如需修改直接点击上传 |
| | | <i class="el-icon-close" title="删除" @click="clearaudience"></i> |
| | | <i |
| | | class="el-icon-close" |
| | | title="删除" |
| | | @click="clearaudience" |
| | | ></i> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | |
| | | <script> |
| | | import dragUpload from "@/components/drag-upload"; |
| | | var self = null; |
| | | var eventSource = null; |
| | | export default { |
| | | inject: ["reload"], |
| | | name: "Creation", |
| | |
| | | progress: false, |
| | | percentage: 0, |
| | | progressStatus: "", |
| | | over: false |
| | | }; |
| | | }, |
| | | components: { dragUpload }, |
| | |
| | | }, |
| | | fatherMethod(res, type) { |
| | | this.progress = false; |
| | | // if (res.falseLst === null || res.falseLst.length === 0) { |
| | | // this.$message.success("上传数据成功"); |
| | | // this.$emit("load-success"); |
| | | // } |
| | | // else { |
| | | // let errortips = ""; |
| | | // res.falseLst.map((item) => { |
| | | // errortips += ( |
| | | // `${item.playerRoll}` + |
| | | // `${item.cause} </div><div style='line-height: 1.5;'>` |
| | | // ).replace("[]", ""); |
| | | // }); |
| | | // this.$message({ |
| | | // dangerouslyUseHTMLString: true, |
| | | // message: `<div style='line-height: 1.5;'>导入数据成功导入${res.successNum || 0 |
| | | // }条,错误信息:</div><div style='line-height: 1.5;'>${errortips}</div>`, |
| | | // type: "error", |
| | | // duration: 6000, |
| | | // showClose: true, |
| | | // }); |
| | | // } |
| | | |
| | | if (res.success) { |
| | | var ojb = JSON.parse(res.message); |
| | | if (ojb.falseLst === null) { |
| | |
| | | }); |
| | | this.$message({ |
| | | dangerouslyUseHTMLString: true, |
| | | message: `<div style='line-height: 1.5;'>导入数据成功导入${ |
| | | res.successNum || 0 |
| | | message: `<div style='line-height: 1.5;'>导入数据成功导入${ojb.successNum || 0 |
| | | }条,错误信息:</div><div style='line-height: 1.5;'>${errortips}</div>`, |
| | | type: "error", |
| | | duration: 6000, |
| | |
| | | } else { |
| | | this.$message.error(res.message); |
| | | } |
| | | // if (res.falseLst === null) { |
| | | // this.$message.success("上传数据成功"); |
| | | // this.$emit("load-success"); |
| | | // } else if (res.falseLst.length >= 1) { |
| | | // let errortips = ""; |
| | | // res.falseLst.map((item) => { |
| | | // errortips += (`${item.playerRoll}` + `${item.cause} \r\n`).replace('[]', ''); |
| | | // }); |
| | | // this.$message({ |
| | | // message: `导入数据成功导入${res.successNum}条,错误信息:${errortips}`, |
| | | // type: "error", |
| | | // duration: 6000, |
| | | // }); |
| | | // } |
| | | if (res.falseLst === null) { |
| | | this.$message.success("上传数据成功"); |
| | | this.$emit("load-success"); |
| | | } else if (res.falseLst.length >= 1) { |
| | | let errortips = ""; |
| | | res.falseLst.map((item) => { |
| | | errortips += (`${item.playerRoll}` + `${item.cause} \r\n`).replace('[]', ''); |
| | | }); |
| | | this.$message({ |
| | | message: `导入数据成功导入${res.successNum}条,错误信息:${errortips}`, |
| | | type: "error", |
| | | duration: 6000, |
| | | }); |
| | | } |
| | | |
| | | |
| | | setTimeout(function () { |
| | | if (eventSource) |
| | | eventSource.close() |
| | | }, 5 * 1000); |
| | | |
| | | }, |
| | | showUploadProcess() { |
| | | self.progress = true; |
| | | self.percentage = 0.1; |
| | | self.progressStatus = ""; |
| | | setTimeout(function () { |
| | | const eventSource = new EventSource( |
| | | eventSource = new EventSource( |
| | | "/dream/sse-stream/" + |
| | | JSON.parse(localStorage.getItem("selectStaff")).id |
| | | ); |
| | |
| | | |
| | | if (res.current == res.total) { |
| | | self.progressStatus = "success"; |
| | | if (res.falseLst === null || res.falseLst.length === 0) { |
| | | if ((res.falseLst === null || res.falseLst.length === 0) && self.progress) { |
| | | self.$message.success("上传数据成功"); |
| | | self.$emit("load-success"); |
| | | eventSource.close() |
| | | } else if (res.falseLst.length >= 1) { |
| | | let errortips = ""; |
| | | res.falseLst.map((item) => { |
| | |
| | | }); |
| | | self.$message({ |
| | | dangerouslyUseHTMLString: true, |
| | | message: `<div style='line-height: 1.5;'>导入数据成功导入${ |
| | | res.successNum || 0 |
| | | message: `<div style='line-height: 1.5;'>导入数据成功导入${res.successNum || 0 |
| | | }条,错误信息:</div><div style='line-height: 1.5;'>${errortips}</div>`, |
| | | type: "error", |
| | | duration: 6000, |
| | |
| | | }); |
| | | } |
| | | |
| | | eventSource.close() |
| | | self.progress = false; |
| | | } |
| | | }; |
| | |
| | | eventSource.onerror = function (err) { |
| | | console.error("EventSource failed:", err); |
| | | eventSource.close(); |
| | | self.showUploadProcess(); |
| | | // self.showUploadProcess(); |
| | | }; |
| | | }, 3 * 1000); |
| | | }, 2 * 1000); |
| | | }, |
| | | }, |
| | | created() { |