| | |
| | | </div> |
| | | </div> |
| | | <div style="line-height: 30px;"> |
| | | <el-button size="small" type="primary" @click="uploadDia = true, getUserList()">导入</el-button> |
| | | <el-button size="small" type="primary" @click="openUpload">导入</el-button> |
| | | </div> |
| | | </div> |
| | | <lims-table :tableData="yearPlanTableData" :column="yearPlanColumn" :currentChange="currentChange" |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 8px 12px; border-radius: 4px; background: var(--el-color-primary-light-9); font-size: 13px;"> |
| | | <span>第一次导入请先下载模板,按模板格式填写后再上传。</span> |
| | | <el-button link type="primary" @click="downloadTemplate">下载导入模板</el-button> |
| | | </div> |
| | | <div style="margin: 0 auto;"> |
| | | <el-upload ref="upload" |
| | | :action="javaApi + '/personTraining/personTrainingImport' + '?planYear=' + planYear + '&reviewerId=' + reviewerId" |
| | | :auto-upload="false" :before-upload="beforeUpload" :file-list="fileList" :headers="uploadHeader" :limit="1" |
| | | :on-error="onError" :on-success="onSuccess" accept=".xlsx" drag name="file"> |
| | | :auto-upload="false" :before-upload="beforeUpload" v-model:file-list="fileList" :headers="uploadHeader" :limit="1" |
| | | :on-error="onError" :on-success="onSuccess" accept=".xls,.xlsx" drag name="file"> |
| | | <lims-icon name="el-icon-upload"></lims-icon> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | </el-upload> |
| | | </div> |
| | | <div style="margin-top: 10px; color: var(--el-text-color-secondary); font-size: 12px; line-height: 20px;"> |
| | | <div>支持格式:.xls、.xlsx;单个文件不超过10MB。</div> |
| | | <div>培训讲师必须填写系统中已存在的人员姓名,否则整批导入失败。</div> |
| | | <div>培训时间建议填写 YYYY-MM-DD,课时填写整数。</div> |
| | | <div>导入只读取模板的第一个工作表。</div> |
| | | </div> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="uploadDia = false">取 消</el-button> |
| | |
| | | this.$download.saveAs(blob, row.fileName + '.docx') |
| | | }) |
| | | }, |
| | | // 打开导入弹框 |
| | | openUpload() { |
| | | this.fileList = [] |
| | | this.uploadDia = true |
| | | this.getUserList() |
| | | }, |
| | | // 下载年度计划导入模板 |
| | | downloadTemplate() { |
| | | const link = document.createElement('a') |
| | | link.href = '/import-templates/人员培训年度计划导入模板.xlsx?v=2' |
| | | link.download = '人员培训年度计划导入模板.xlsx' |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | }, |
| | | // 年度计划-导入 |
| | | submitUpload() { |
| | | if (!this.planYear) { |
| | |
| | | this.$message.error('请选择审核人') |
| | | return |
| | | } |
| | | if (this.$refs.upload.uploadFiles.length == 0) { |
| | | if (!this.fileList || this.fileList.length == 0) { |
| | | this.$message.error('未选择文件') |
| | | return |
| | | } |
| | |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.type != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { |
| | | this.$message.error('上传文件格式不正确'); |
| | | if (!/\.(xls|xlsx)$/i.test(file.name || '')) { |
| | | this.$message.error('请选择 .xls 或 .xlsx 格式的文件'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('上传文件不超过10M'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | // 年度计划明细表-编辑 |
| | | editInDetail(row) { |