| | |
| | | <div class="training-management"> |
| | | <!-- 页面头部 --> |
| | | <div class="page-header"> |
| | | <h2>进修管理</h2> |
| | | <div class="header-actions"> |
| | | <el-button type="primary" icon="el-icon-plus" @click="handleAdd"> |
| | | 新增进修记录 |
| | |
| | | <el-table-column prop="id" label="ID" width="80" fixed /> |
| | | <el-table-column prop="name" label="姓名" width="100" fixed> |
| | | <template #default="scope"> |
| | | <el-button type="text" @click="handleView(scope.row)"> |
| | | <el-button type="text" @click="handleView(scope.row.id)"> |
| | | {{ scope.row.name }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="gender" label="性别" width="80"> |
| | | <el-table-column prop="sex" label="性别" width="80"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.gender === '男' ? 'primary' : 'danger'" size="small"> |
| | | {{ scope.row.gender }} |
| | | <el-tag :type="scope.row.sex === '男' ? 'primary' : 'danger'" size="small"> |
| | | {{ scope.row.sex }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="idCard" label="身份证号" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="graduateSchool" label="毕业院校" width="150" show-overflow-tooltip /> |
| | | <el-table-column prop="workUnit" label="所在单位" width="150" show-overflow-tooltip /> |
| | | <el-table-column prop="technicalTitle" label="技术职称" width="120" /> |
| | | <el-table-column prop="professionalField" label="从事专业" width="120" /> |
| | | <el-table-column prop="workYears" label="工作年限" width="100" sortable /> |
| | | <el-table-column prop="trainingStartDate" label="进修开始时间" width="120" /> |
| | | <el-table-column prop="trainingEndDate" label="进修结束时间" width="120" /> |
| | | <el-table-column prop="trainingMajor" label="进修专业" width="120" /> |
| | | <el-table-column prop="status" label="状态" width="100" fixed="right"> |
| | | <el-table-column prop="trainingStartDate" label="进修开始时间" width="120"> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusTag(scope.row.status)"> |
| | | {{ scope.row.status }} |
| | | {{ formatDate(scope.row.trainingStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="trainingEndDate" label="进修结束时间" width="120"> |
| | | <template #default="scope"> |
| | | {{ formatDate(scope.row.trainingEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="trainingMajor" label="进修专业" width="120" /> |
| | | <el-table-column prop="idCard" label="身份证号" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="technicalTitle" label="技术职称" width="120" /> |
| | | <el-table-column prop="profession" label="从事专业" width="120" /> |
| | | <el-table-column prop="workYears" label="工作年限" width="100" sortable /> |
| | | <el-table-column prop="graduationSchool" label="毕业院校" width="150" show-overflow-tooltip /> |
| | | <el-table-column prop="workUnit" label="所在单位" width="150" show-overflow-tooltip /> |
| | | |
| | | <el-table-column prop="recordStatus" label="状态" width="100" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusTag(scope.row.recordStatus)"> |
| | | {{ scope.row.recordStatus || '进行中' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="180" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" @click="handleView(scope.row)"> |
| | | <el-button size="mini" type="text" @click="handleView(scope.row.id)"> |
| | | 查看 |
| | | </el-button> |
| | | <el-button size="mini" type="text" @click="handleEdit(scope.row)"> |
| | | <el-button size="mini" type="text" @click="handleEdit(scope.row.id)"> |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | @click="handleCopy(scope.row)" |
| | | @click="handleCopy(scope.row.id)" |
| | | style="color: #67C23A;" |
| | | > |
| | | 复制 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | @click="handleDelete(scope.row)" |
| | | style="color: #F56C6C;" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <!-- 分页 --> |
| | | <div class="pagination-container"> |
| | | <el-pagination |
| | | :current-page="pagination.currentPage" |
| | | :current-page="pagination.pageNum" |
| | | :page-size="pagination.pageSize" |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | |
| | | width="900px" |
| | | :before-close="handleDetailClose" |
| | | > |
| | | <el-descriptions :column="2" border v-if="currentRecord"> |
| | | <el-descriptions :column="2" border v-if="currentRecord.id"> |
| | | <el-descriptions-item label="姓名">{{ currentRecord.name }}</el-descriptions-item> |
| | | <el-descriptions-item label="性别">{{ currentRecord.gender }}</el-descriptions-item> |
| | | <el-descriptions-item label="性别">{{ currentRecord.sex }}</el-descriptions-item> |
| | | <el-descriptions-item label="年龄">{{ currentRecord.age }}</el-descriptions-item> |
| | | <el-descriptions-item label="学历">{{ currentRecord.education }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修类型"> |
| | |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="身份证号">{{ currentRecord.idCard }}</el-descriptions-item> |
| | | <el-descriptions-item label="毕业院校">{{ currentRecord.graduateSchool }}</el-descriptions-item> |
| | | <el-descriptions-item label="毕业院校">{{ currentRecord.graduationSchool }}</el-descriptions-item> |
| | | <el-descriptions-item label="所在单位">{{ currentRecord.workUnit }}</el-descriptions-item> |
| | | <el-descriptions-item label="技术职称">{{ currentRecord.technicalTitle }}</el-descriptions-item> |
| | | <el-descriptions-item label="从事专业">{{ currentRecord.professionalField }}</el-descriptions-item> |
| | | <el-descriptions-item label="从事专业">{{ currentRecord.profession }}</el-descriptions-item> |
| | | <el-descriptions-item label="工作年限">{{ currentRecord.workYears }}年</el-descriptions-item> |
| | | <el-descriptions-item label="进修目标">{{ currentRecord.trainingObjective }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修开始时间">{{ currentRecord.trainingStartDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修结束时间">{{ currentRecord.trainingEndDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修目标">{{ currentRecord.trainingGoal }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修开始时间">{{ formatDate(currentRecord.trainingStartDate) }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修结束时间">{{ formatDate(currentRecord.trainingEndDate) }}</el-descriptions-item> |
| | | <el-descriptions-item label="进修专业">{{ currentRecord.trainingMajor }}</el-descriptions-item> |
| | | <el-descriptions-item label="从事工作情况" :span="2"> |
| | | {{ currentRecord.workSituation }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="进修科目及目的" :span="2"> |
| | | {{ currentRecord.trainingSubject }} |
| | | <el-descriptions-item label="进修科目" :span="2"> |
| | | {{ currentRecord.applySubject }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="进修目的" :span="2"> |
| | | {{ currentRecord.applyPurpose }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="主要学历" :span="2"> |
| | | <div style="white-space: pre-line;">{{ currentRecord.mainEducation }}</div> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="主要工作经历" :span="2"> |
| | | <div style="white-space: pre-line;">{{ currentRecord.workExperience }}</div> |
| | | <div style="white-space: pre-line;">{{ currentRecord.mainExperience }}</div> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="创建时间">{{ formatDateTime(currentRecord.createTime) }}</el-descriptions-item> |
| | | <el-descriptions-item label="更新时间">{{ formatDateTime(currentRecord.updateTime) }}</el-descriptions-item> |
| | | <!-- <el-descriptions-item label="备注" :span="2">{{ currentRecord.remark }}</el-descriptions-item> --> |
| | | </el-descriptions> |
| | | <span slot="footer"> |
| | | <el-button @click="detailDialogVisible = false">关闭</el-button> |
| | | <el-button type="primary" @click="handleEdit(currentRecord)">编辑</el-button> |
| | | <el-button type="primary" @click="handleEdit(currentRecord.id)">编辑</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="性别" prop="gender"> |
| | | <el-radio-group v-model="editForm.gender"> |
| | | <el-form-item label="性别" prop="sex"> |
| | | <el-radio-group v-model="editForm.sex"> |
| | | <el-radio label="男">男</el-radio> |
| | | <el-radio label="女">女</el-radio> |
| | | </el-radio-group> |
| | |
| | | <el-input v-model="editForm.idCard" placeholder="请输入身份证号" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="毕业院校" prop="graduateSchool"> |
| | | <el-input v-model="editForm.graduateSchool" placeholder="请输入毕业院校" /> |
| | | <el-form-item label="毕业院校" prop="graduationSchool"> |
| | | <el-input v-model="editForm.graduationSchool" placeholder="请输入毕业院校" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="所在单位" prop="workUnit"> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="从事专业" prop="professionalField"> |
| | | <el-input v-model="editForm.professionalField" placeholder="请输入从事专业" /> |
| | | <el-form-item label="从事专业" prop="profession"> |
| | | <el-input v-model="editForm.profession" placeholder="请输入从事专业" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | v-model="editForm.workYears" |
| | | :min="0" |
| | | :max="50" |
| | | :precision="1" |
| | | :step="0.5" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="进修目标" prop="trainingObjective"> |
| | | <el-form-item label="进修目标" prop="trainingGoal"> |
| | | <el-input |
| | | v-model="editForm.trainingObjective" |
| | | v-model="editForm.trainingGoal" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请输入进修目标" |
| | |
| | | v-model="editForm.trainingStartDate" |
| | | type="date" |
| | | placeholder="选择开始日期" |
| | | value-format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | |
| | | v-model="editForm.trainingEndDate" |
| | | type="date" |
| | | placeholder="选择结束日期" |
| | | value-format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | |
| | | <el-input v-model="editForm.trainingMajor" placeholder="请输入进修专业" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="进修科目" prop="applySubject"> |
| | | <el-input |
| | | v-model="editForm.applySubject" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请输入本次申请进修科目" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="进修目的" prop="applyPurpose"> |
| | | <el-input |
| | | v-model="editForm.applyPurpose" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请输入进修目的要求" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="从事工作情况" prop="workSituation"> |
| | | <el-input |
| | | v-model="editForm.workSituation" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入从事工作情况" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="进修科目及目的" prop="trainingSubject"> |
| | | <el-input |
| | | v-model="editForm.trainingSubject" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入本次申请进修何种科目及目的要求" |
| | | /> |
| | | </el-form-item> |
| | | |
| | |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="主要工作经历" prop="workExperience"> |
| | | <el-form-item label="主要工作经历" prop="mainExperience"> |
| | | <el-input |
| | | v-model="editForm.workExperience" |
| | | v-model="editForm.mainExperience" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入主要工作经历(每行一条)" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <!-- <el-form-item label="备注" prop="remark"> |
| | | <el-input |
| | | v-model="editForm.remark" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请输入备注信息" |
| | | /> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | |
| | | <span slot="footer"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { recordslist, recordsedit, recordsadd, recordsInfo, recordsDel,exporrecords } from "@/api/officeManagementApi"; |
| | | |
| | | export default { |
| | | name: 'TrainingManagement', |
| | | data() { |
| | |
| | | }, |
| | | // 分页参数 |
| | | pagination: { |
| | | currentPage: 1, |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | total: 0 |
| | | }, |
| | |
| | | // 表格数据 |
| | | tableData: [], |
| | | // 编辑表单数据 |
| | | editForm: { |
| | | name: '', |
| | | gender: '男', |
| | | age: 25, |
| | | education: '', |
| | | trainingType: '', |
| | | idCard: '', |
| | | graduateSchool: '', |
| | | workUnit: '', |
| | | technicalTitle: '', |
| | | professionalField: '', |
| | | workYears: 0, |
| | | trainingObjective: '', |
| | | trainingStartDate: '', |
| | | trainingEndDate: '', |
| | | trainingMajor: '', |
| | | workSituation: '', |
| | | trainingSubject: '', |
| | | mainEducation: '', |
| | | workExperience: '' |
| | | }, |
| | | editForm: this.getDefaultFormData(), |
| | | // 表单验证规则 |
| | | editRules: { |
| | | name: [{ required: true, message: '请输入姓名', trigger: 'blur' }], |
| | | gender: [{ required: true, message: '请选择性别', trigger: 'change' }], |
| | | sex: [{ required: true, message: '请选择性别', trigger: 'change' }], |
| | | age: [{ required: true, message: '请输入年龄', trigger: 'blur' }], |
| | | education: [{ required: true, message: '请选择学历', trigger: 'change' }], |
| | | trainingType: [{ required: true, message: '请选择进修类型', trigger: 'change' }], |
| | | idCard: [{ required: true, message: '请输入身份证号', trigger: 'blur' }] |
| | | idCard: [ |
| | | { required: true, message: '请输入身份证号', trigger: 'blur' }, |
| | | { pattern: /^\d{17}[\dXx]$/, message: '请输入正确的身份证号', trigger: 'blur' } |
| | | ], |
| | | trainingStartDate: [{ required: true, message: '请选择进修开始时间', trigger: 'change' }], |
| | | trainingEndDate: [{ required: true, message: '请选择进修结束时间', trigger: 'change' }] |
| | | } |
| | | } |
| | | }, |
| | |
| | | async loadData() { |
| | | this.loading = true |
| | | try { |
| | | // 模拟API调用 |
| | | await new Promise(resolve => setTimeout(resolve, 500)) |
| | | const params = { |
| | | pageNum: this.pagination.pageNum, |
| | | pageSize: this.pagination.pageSize, |
| | | ...this.queryParams |
| | | } |
| | | |
| | | // 生成模拟数据 |
| | | this.tableData = this.generateMockData() |
| | | this.pagination.total = this.tableData.length |
| | | // 处理时间范围查询 |
| | | if (this.queryParams.dateRange && this.queryParams.dateRange.length === 2) { |
| | | params.startDate = this.queryParams.dateRange[0] |
| | | params.endDate = this.queryParams.dateRange[1] |
| | | } |
| | | |
| | | const response = await recordslist(params) |
| | | |
| | | if (response.code === 200) { |
| | | this.tableData = response.rows || [] |
| | | this.pagination.total = response.total || 0 |
| | | } else { |
| | | this.$message.error(response.msg || '获取数据失败') |
| | | } |
| | | } catch (error) { |
| | | console.error('加载数据失败:', error) |
| | | this.$message.error('数据加载失败') |
| | |
| | | this.loading = false |
| | | } |
| | | }, |
| | | // 生成模拟数据 |
| | | generateMockData() { |
| | | const names = ['张三', '李四', '王五', '赵六', '钱七', '孙八', '周九', '吴十'] |
| | | const trainingTypes = ['professional', 'management', 'education', 'skill'] |
| | | const statuses = ['进行中', '已完成', '待审核', '已取消'] |
| | | |
| | | return Array.from({ length: 10 }, (_, index) => ({ |
| | | id: index + 1, |
| | | name: names[Math.floor(Math.random() * names.length)], |
| | | gender: Math.random() > 0.5 ? '男' : '女', |
| | | age: 25 + Math.floor(Math.random() * 20), |
| | | education: ['博士', '硕士', '本科', '大专'][Math.floor(Math.random() * 4)], |
| | | trainingType: trainingTypes[Math.floor(Math.random() * trainingTypes.length)], |
| | | idCard: '11010119900101' + (1000 + index).toString().slice(-4), |
| | | graduateSchool: ['北京大学', '清华大学', '复旦大学', '上海交通大学'][Math.floor(Math.random() * 4)], |
| | | workUnit: ['北京协和医院', '上海瑞金医院', '广州中山医院', '武汉同济医院'][Math.floor(Math.random() * 4)], |
| | | technicalTitle: ['主任医师', '副主任医师', '主治医师', '住院医师'][Math.floor(Math.random() * 4)], |
| | | professionalField: ['心血管内科', '神经外科', '儿科', '妇产科'][Math.floor(Math.random() * 4)], |
| | | workYears: 5 + Math.floor(Math.random() * 20), |
| | | trainingObjective: '提升专业技术和临床能力', |
| | | trainingStartDate: '2024-' + (Math.floor(Math.random() * 12) + 1).toString().padStart(2, '0') + '-01', |
| | | trainingEndDate: '2024-' + (Math.floor(Math.random() * 12) + 1).toString().padStart(2, '0') + '-28', |
| | | trainingMajor: '临床医学', |
| | | workSituation: '在临床一线工作,负责患者诊疗', |
| | | trainingSubject: '高级心血管介入治疗技术', |
| | | mainEducation: '2005-2009 北京大学医学部 临床医学本科\n2009-2012 北京大学医学部 硕士', |
| | | workExperience: '2012-2015 北京协和医院 住院医师\n2015-2020 北京协和医院 主治医师', |
| | | status: statuses[Math.floor(Math.random() * statuses.length)] |
| | | })) |
| | | }, |
| | | // 获取进修类型标签样式 |
| | | getTrainingTypeTag(type) { |
| | | const typeMap = { |
| | |
| | | } |
| | | return typeMap[type] || 'info' |
| | | }, |
| | | |
| | | // 获取进修类型文本 |
| | | getTrainingTypeText(type) { |
| | | const textMap = { |
| | |
| | | } |
| | | return textMap[type] || type |
| | | }, |
| | | |
| | | // 获取状态标签样式 |
| | | getStatusTag(status) { |
| | | const statusMap = { |
| | | '进行中': 'primary', |
| | | '已完成': 'success', |
| | | '待审核': 'warning', |
| | | '已取消': 'danger' |
| | | '已取消': 'danger', |
| | | '正常': 'success', |
| | | '删除': 'danger' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | }, |
| | | |
| | | // 格式化日期 |
| | | formatDate(date) { |
| | | if (!date) return '' |
| | | return date.split(' ')[0] |
| | | }, |
| | | |
| | | // 格式化日期时间 |
| | | formatDateTime(dateTime) { |
| | | if (!dateTime) return '' |
| | | return dateTime.replace('T', ' ') |
| | | }, |
| | | |
| | | // 查询处理 |
| | | handleQuery() { |
| | | this.pagination.currentPage = 1 |
| | | this.pagination.pageNum = 1 |
| | | this.loadData() |
| | | }, |
| | | |
| | | // 重置查询 |
| | | handleReset() { |
| | | this.queryParams = { |
| | |
| | | technicalTitle: '', |
| | | dateRange: [] |
| | | } |
| | | this.pagination.currentPage = 1 |
| | | this.pagination.pageNum = 1 |
| | | this.loadData() |
| | | }, |
| | | |
| | | // 查看详情 |
| | | handleView(record) { |
| | | this.currentRecord = { ...record } |
| | | this.detailDialogVisible = true |
| | | async handleView(id) { |
| | | try { |
| | | const response = await recordsInfo(id) |
| | | if (response.code === 200) { |
| | | this.currentRecord = response.data || {} |
| | | this.detailDialogVisible = true |
| | | } else { |
| | | this.$message.error(response.msg || '获取详情失败') |
| | | } |
| | | } catch (error) { |
| | | console.error('获取详情失败:', error) |
| | | this.$message.error('获取详情失败') |
| | | } |
| | | }, |
| | | |
| | | // 新增记录 |
| | | handleAdd() { |
| | | this.isEditing = false |
| | |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | }, |
| | | |
| | | // 编辑记录 |
| | | handleEdit(record) { |
| | | this.isEditing = true |
| | | this.currentRecord = record |
| | | this.editForm = { ...record } |
| | | this.editDialogVisible = true |
| | | this.detailDialogVisible = false |
| | | this.$nextTick(() => { |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | async handleEdit(id) { |
| | | try { |
| | | const response = await recordsInfo(id) |
| | | if (response.code === 200) { |
| | | this.isEditing = true |
| | | this.currentRecord = response.data || {} |
| | | this.editForm = { ...response.data } |
| | | this.editDialogVisible = true |
| | | this.detailDialogVisible = false |
| | | this.$nextTick(() => { |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | } else { |
| | | this.$message.error(response.msg || '获取记录失败') |
| | | } |
| | | } catch (error) { |
| | | console.error('获取记录失败:', error) |
| | | this.$message.error('获取记录失败') |
| | | } |
| | | }, |
| | | |
| | | // 复制记录 |
| | | handleCopy(record) { |
| | | this.isEditing = false |
| | | const copiedRecord = { ...record } |
| | | delete copiedRecord.id |
| | | copiedRecord.name = copiedRecord.name + '(复制)' |
| | | this.editForm = copiedRecord |
| | | this.editDialogVisible = true |
| | | this.$nextTick(() => { |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | async handleCopy(id) { |
| | | try { |
| | | const response = await recordsInfo(id) |
| | | if (response.code === 200) { |
| | | this.isEditing = false |
| | | const copiedRecord = { ...response.data } |
| | | delete copiedRecord.id |
| | | copiedRecord.name = copiedRecord.name + '(复制)' |
| | | copiedRecord.isCopy = 1 |
| | | copiedRecord.originalId = id |
| | | this.editForm = copiedRecord |
| | | this.editDialogVisible = true |
| | | this.$nextTick(() => { |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | } else { |
| | | this.$message.error(response.msg || '获取记录失败') |
| | | } |
| | | } catch (error) { |
| | | console.error('获取记录失败:', error) |
| | | this.$message.error('获取记录失败') |
| | | } |
| | | }, |
| | | |
| | | // 保存记录 |
| | | async handleSave() { |
| | | try { |
| | |
| | | if (!valid) return |
| | | |
| | | this.saveLoading = true |
| | | // 模拟API调用 |
| | | await new Promise(resolve => setTimeout(resolve, 1000)) |
| | | |
| | | this.$message.success(this.isEditing ? '保存成功' : '新增成功') |
| | | this.editDialogVisible = false |
| | | this.loadData() |
| | | // 验证结束时间不能早于开始时间 |
| | | if (this.editForm.trainingStartDate && this.editForm.trainingEndDate) { |
| | | if (this.editForm.trainingEndDate < this.editForm.trainingStartDate) { |
| | | this.$message.error('结束时间不能早于开始时间') |
| | | this.saveLoading = false |
| | | return |
| | | } |
| | | } |
| | | |
| | | let response |
| | | if (this.isEditing) { |
| | | // 编辑 |
| | | response = await recordsedit(this.editForm) |
| | | } else { |
| | | // 新增 |
| | | response = await recordsadd(this.editForm) |
| | | } |
| | | |
| | | if (response.code === 200) { |
| | | this.$message.success(this.isEditing ? '保存成功' : '新增成功') |
| | | this.editDialogVisible = false |
| | | this.loadData() |
| | | } else { |
| | | this.$message.error(response.msg || (this.isEditing ? '保存失败' : '新增失败')) |
| | | } |
| | | } catch (error) { |
| | | console.error('保存失败:', error) |
| | | this.$message.error('操作失败') |
| | | this.$message.error(this.isEditing ? '保存失败' : '新增失败') |
| | | } finally { |
| | | this.saveLoading = false |
| | | } |
| | | }, |
| | | |
| | | // 删除记录 |
| | | async handleDelete(row) { |
| | | try { |
| | | await this.$confirm('确定要删除这条记录吗?', '提示', { |
| | | type: 'warning', |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消' |
| | | }) |
| | | |
| | | const response = await recordsDel(row.id) |
| | | if (response.code === 200) { |
| | | this.$message.success('删除成功') |
| | | this.loadData() |
| | | } else { |
| | | this.$message.error(response.msg || '删除失败') |
| | | } |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | console.error('删除失败:', error) |
| | | this.$message.error('删除失败') |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 关闭详情对话框 |
| | | handleDetailClose() { |
| | | this.detailDialogVisible = false |
| | | this.currentRecord = {} |
| | | }, |
| | | |
| | | // 关闭编辑对话框 |
| | | handleEditClose() { |
| | | this.editDialogVisible = false |
| | | this.currentRecord = {} |
| | | this.editForm = this.getDefaultFormData() |
| | | this.$nextTick(() => { |
| | | this.$refs.editForm && this.$refs.editForm.clearValidate() |
| | | }) |
| | | }, |
| | | |
| | | // 导出数据 |
| | | exportData() { |
| | | this.$message.success('导出功能开发中') |
| | | const queryParams = this.queryParams; |
| | | this.$modal |
| | | .confirm("是否确认导出所有进修管理数据项?") |
| | | .then(() => { |
| | | return exporrecords(queryParams); |
| | | }) |
| | | .then((response) => { |
| | | this.$download.name(response.msg); |
| | | }) |
| | | .catch(() => { }); |
| | | }, |
| | | |
| | | // 分页大小变化 |
| | | handleSizeChange(size) { |
| | | this.pagination.pageSize = size |
| | | this.pagination.currentPage = 1 |
| | | this.pagination.pageNum = 1 |
| | | this.loadData() |
| | | }, |
| | | |
| | | // 当前页变化 |
| | | handleCurrentChange(page) { |
| | | this.pagination.currentPage = page |
| | | this.pagination.pageNum = page |
| | | this.loadData() |
| | | }, |
| | | |
| | | // 排序变化 |
| | | handleSortChange(sort) { |
| | | console.log('排序变化:', sort) |
| | | // 这里可以添加排序逻辑 |
| | | // 这里可以添加排序逻辑,如果需要的话 |
| | | }, |
| | | |
| | | // 获取默认表单数据 |
| | | getDefaultFormData() { |
| | | return { |
| | | id: null, |
| | | name: '', |
| | | gender: '男', |
| | | sex: '男', |
| | | age: 25, |
| | | education: '', |
| | | trainingType: '', |
| | | idCard: '', |
| | | graduateSchool: '', |
| | | graduationSchool: '', |
| | | workUnit: '', |
| | | technicalTitle: '', |
| | | professionalField: '', |
| | | profession: '', |
| | | workYears: 0, |
| | | trainingObjective: '', |
| | | trainingGoal: '', |
| | | trainingStartDate: '', |
| | | trainingEndDate: '', |
| | | trainingMajor: '', |
| | | workSituation: '', |
| | | trainingSubject: '', |
| | | applySubject: '', |
| | | applyPurpose: '', |
| | | mainEducation: '', |
| | | workExperience: '' |
| | | mainExperience: '', |
| | | remark: '', |
| | | isCopy: 0, |
| | | originalId: null |
| | | } |
| | | } |
| | | } |