<!-- 人员培训 -->
|
<template>
|
<div class="flex_column">
|
<div v-if="!editPlanShow && isDepartment">
|
<TableCard title="年度计划表">
|
<template v-slot:form>
|
<div class="items_center">
|
<span>创建人</span>
|
<el-input v-model="pagination.compilerName" class="search" placeholder="请输入" size="small"></el-input>
|
<el-button size="small" type="primary" @click="getYearPlanList(departId)">查询</el-button>
|
</div>
|
<div>
|
<el-button size="small" type="primary" @click="uploadDia = true">导入</el-button>
|
</div>
|
</template>
|
<template v-slot:table>
|
<ZTTable
|
:column="yearPlanColumn"
|
:currentChange="currentChange"
|
:height="'320'"
|
:table-data="yearPlanTableData"
|
:table-loading="yearLoading"
|
highlightCurrentRow
|
style="padding: 0 15px;">
|
</ZTTable>
|
<div class="pagination">
|
<div></div>
|
<el-pagination
|
:page-size="pagination.pageSize"
|
:page-sizes="[10, 20, 30, 40]"
|
:total="pagination.total"
|
layout="total, sizes, prev, pager, next, jumper"
|
@current-change="handleYearCurrent"
|
@size-change="handleYearSizeChange">
|
</el-pagination>
|
</div>
|
</template>
|
</TableCard>
|
</div>
|
<div v-if="!editPlanShow" class="table">
|
<TableCard title="年度计划明细表">
|
<template v-slot:form>
|
<div class="items_center">
|
<span>培训讲师</span>
|
<el-input v-model="inDetailForm.trainingLecturerName" class="search" clearable placeholder="请输入" size="small"></el-input>
|
<span>课程编号</span>
|
<el-input v-model="inDetailForm.courseCode" class="search" clearable placeholder="请输入" size="small"></el-input>
|
<span style="margin-right: 16px">培训日期</span>
|
<el-date-picker v-model="inDetailForm.trainingDate" clearable
|
format="yyyy-MM-dd" placeholder="选择日期" size="small"
|
type="date" value-format="yyyy-MM-dd"></el-date-picker>
|
<el-button size="small" style="margin-left: 16px" type="primary" @click="searchTable">查询</el-button>
|
</div>
|
<div>
|
<el-button v-if="isDepartment && currentChangeRow && isOperation" size="small" @click="batchDelete">批量删除</el-button>
|
<el-button v-if="isDepartment && currentChangeRow && isOperation" size="small" type="primary" @click="addTrainingPlan">新增</el-button>
|
</div>
|
</template>
|
<template v-slot:table>
|
<ZTTable
|
:column="inDetailPlanColumn"
|
:handleSelectionChange="handleSelectionChange"
|
:height="isDepartment ? '45vh' : '68vh' "
|
:isSelection="true"
|
:table-data="inDetailPlanTableData"
|
:table-loading="yearLoading"
|
style="padding: 0 15px;">
|
</ZTTable>
|
<div class="pagination">
|
<div></div>
|
<el-pagination
|
:page-size="inDetailPagination.pageSize"
|
:page-sizes="[10, 20, 30, 40]"
|
:total="inDetailPagination.total"
|
layout="total, sizes, prev, pager, next, jumper"
|
@current-change="handleCurrentChange"
|
@size-change="handleSizeChange">
|
</el-pagination>
|
</div>
|
</template>
|
</TableCard>
|
</div>
|
<Add ref="addPlan" :currentChangeRow="currentChangeRow" @search="getInDetailPlan(currentRowId, departId)"></Add>
|
<Edit
|
v-if="editPlanShow"
|
ref="editPlan"
|
:currentRow="currentRow"
|
@del="getInDetailPlan(currentRowId, departId)"
|
@goBack="goBack"
|
></Edit>
|
<el-dialog :visible.sync="reviewDialog" title="审核" width="30%" @close="reviewRemarks = ''">
|
<span>
|
审核备注:
|
<el-input v-model="reviewRemarks" type="textarea"></el-input>
|
</span>
|
<span slot="footer" class="dialog-footer">
|
<el-button :loading="reviewLoading" @click="handleReview(2)">不通过</el-button>
|
<el-button :loading="reviewLoading" type="primary" @click="handleReview(1)">通 过</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog :visible.sync="approvalDialog" title="批准" width="30%" @close="approvalRemarks = ''">
|
<span>
|
批准备注:
|
<el-input v-model="approvalRemarks" type="textarea"></el-input>
|
</span>
|
<span slot="footer" class="dialog-footer">
|
<el-button :loading="approvalLoading" @click="handleApproval(2)">不批准</el-button>
|
<el-button :loading="reviewLoading" type="primary" @click="handleApproval(1)">批 准</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog :visible.sync="uploadDia" title="数据导入" width="500px">
|
<div style="margin: 0 auto;">
|
<el-upload ref="upload" :action="javaApi + $api.personnel.personTrainingImport" :auto-upload="false" :before-upload="beforeUpload" :file-list="fileList" :headers="token"
|
:limit="1" :on-error="onError" :on-success="onSuccess" accept=".xlsx" drag
|
name="file">
|
<i class="el-icon-upload"></i>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
</el-upload>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="uploadDia = false">取 消</el-button>
|
<el-button :loading="uploading" type="primary" @click="submitUpload()">上 传</el-button>
|
</span>
|
</el-dialog >
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../../tool/value-table.vue';
|
import TableCard from '../../caorui/TableCard/index.vue';
|
import ZTTable from '../../caorui/ZTTable/index.vue';
|
import Add from './AddInDetail.vue';
|
import Edit from './Edit.vue';
|
|
export default {
|
name: 'PersonnelTraining',
|
components: { Add, ZTTable, TableCard, ValueTable, Edit },
|
props: {
|
departId: {
|
type: Number,
|
default: () => {
|
return null;
|
}
|
},
|
isDepartment: {
|
type: Boolean,
|
default: false
|
}
|
},
|
data() {
|
return {
|
search: {},
|
superviseForm: {},
|
inDetailForm: {
|
trainingLecturerName: '',
|
courseCode: '',
|
trainingDate: '',
|
},
|
yearLoading: false,
|
yearPlanTableData: [], // 年度计划表数据
|
yearPlanColumn: [
|
{
|
label: '文件名称',
|
width: '160px',
|
prop: 'fileName'
|
}, {
|
label: '创建时间',
|
width: '160px',
|
prop: 'createTime'
|
}, {
|
label: '创建人',
|
prop: 'createUserName'
|
}, {
|
label: '编制人',
|
prop: 'compilerName'
|
}, {
|
label: '编制日期',
|
width: '160px',
|
prop: 'compilationDate'
|
}, {
|
label: '审核人',
|
prop: 'reviewerName',
|
minWidth: '100px',
|
}, {
|
dataType: 'tag',
|
label: '审核状态',
|
prop: 'reviewerStatus',
|
width: '100px',
|
formatData: (params) => {
|
if (params == 1) {
|
return '通过';
|
} else if (params == 2) {
|
return '不通过';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 1) {
|
return 'success';
|
} else if (params == 2) {
|
return 'danger';
|
} else {
|
return null
|
}
|
}
|
}, {
|
label: '审核备注',
|
prop: 'auditRemarks',
|
minWidth: '100px',
|
}, {
|
label: '审核日期',
|
width: '160px',
|
prop: 'auditDate'
|
}, {
|
label: '批准人',
|
prop: 'approverName',
|
minWidth: '100px',
|
}, {
|
label: '批准备注',
|
prop: 'approvalRemarks',
|
minWidth: '100px',
|
}, {
|
dataType: 'tag',
|
label: '批准状态',
|
minWidth: '100px',
|
prop: 'approvalStatus',
|
formatData: (params) => {
|
if (params == 1) {
|
return '批准';
|
} else if (params == 2) {
|
return '不批准';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 1) {
|
return 'success';
|
} else if (params == 2) {
|
return 'danger';
|
} else {
|
return null
|
}
|
}
|
}, {
|
label: '批准日期',
|
width: '160px',
|
prop: 'approvalDate'
|
}, {
|
dataType: 'action',
|
width: '180px',
|
label: '操作',
|
fixed: 'right',
|
operation: [
|
{
|
name: '导出',
|
type: 'text',
|
disabled: (row) => {
|
if(row.approvalStatus === 1 && row.reviewerStatus === 1) {
|
return false;
|
} else {
|
return true;
|
}
|
},
|
clickFun: (row) => {
|
this.downLoadPost(row);
|
}
|
},
|
{
|
name: '审核',
|
type: 'text',
|
disabled: (row) => {
|
if(row.reviewerStatus === 1) {
|
return true;
|
} else {
|
return false;
|
}
|
},
|
clickFun: (row) => {
|
this.handleCheck(row.id);
|
}
|
},
|
{
|
name: '批准',
|
type: 'text',
|
disabled: (row) => {
|
if(row.approvalStatus === 1) {
|
return true;
|
} else {
|
return false;
|
}
|
},
|
clickFun: (row) => {
|
this.handleApprove(row.id);
|
}
|
},
|
{
|
name: '删除',
|
type: 'text',
|
color: '#f56c6c',
|
clickFun: (row) => {
|
this.deleteFun(row.id);
|
}
|
}
|
]
|
}],
|
inDetailPlanTableData: [], // 年度计划明细表表数据
|
inDetailPlanColumn: [
|
{
|
label: '课程编号',
|
prop: 'courseCode',
|
width: '130px',
|
}, {
|
dataType: 'tag',
|
label: '认领状态',
|
width: '100px',
|
prop: 'whetherClaim',
|
formatData: (params) => {
|
if (params === true) {
|
return '已认领';
|
} else {
|
return '未认领';
|
}
|
},
|
formatType: (params) => {
|
if (params === true) {
|
return 'success';
|
} else {
|
return 'info'
|
}
|
}
|
}, {
|
label: '培训目标',
|
prop: 'trainingObjectives',
|
width: '100px',
|
}, {
|
label: '培训内容',
|
prop: 'trainingContent',
|
width: '100px',
|
}, {
|
label: '培训方式',
|
prop: 'trainingMode',
|
width: '100px',
|
}, {
|
dataType: 'tag',
|
label: '课程状态',
|
width: '100px',
|
prop: 'state',
|
formatData: (params) => {
|
if (params == 1) {
|
return '已完成';
|
} else if (params == 2) {
|
return '进行中';
|
} else if (params == 3) {
|
return '未开始';
|
} else if (params == 4) {
|
return '已结束';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 1) {
|
return 'success';
|
} else if (params == 2) {
|
return 'warning';
|
} else if (params == 3) {
|
return 'primary';
|
} else if (params == 4) {
|
return 'info';
|
} else {
|
return null
|
}
|
}
|
}, {
|
label: '参加对象',
|
prop: 'participants',
|
width: '100px',
|
}, {
|
label: '举办部门',
|
prop: 'holdingDepartment',
|
width: '100px',
|
}, {
|
label: '培训地点',
|
prop: 'placeTraining',
|
width: '100px',
|
}, {
|
label: '培训讲师',
|
prop: 'trainingLecturerName',
|
width: '100px',
|
}, {
|
label: '培训日期',
|
prop: 'trainingDate',
|
width: '100px',
|
}, {
|
label: '开始时间',
|
prop: 'openingTime',
|
width: '100px',
|
}, {
|
label: '课时',
|
prop: 'classHour',
|
width: '100px',
|
}, {
|
label: '备注',
|
prop: 'remarks',
|
width: '100px',
|
}, {
|
dataType: 'action',
|
width: '180',
|
label: '操作',
|
fixed: 'right',
|
operation: [
|
// 超过会议开始时间就不能认领了
|
{
|
name: '认领',
|
type: 'text',
|
clickFun: (row) => {
|
this.handleClaim(row);
|
},
|
disabled: (row) => {
|
if(row.whetherClaim === true || row.trainingDate < this.$moment().format('YYYY-MM-DD')) {
|
return true;
|
} else {
|
return false;
|
}
|
},
|
},
|
{
|
name: '结果明细',
|
type: 'text',
|
clickFun: (row) => {
|
this.editInDetail(row);
|
},
|
showHide: () => {
|
if (this.isDepartment) {
|
return true;
|
} else {
|
return false;
|
}
|
}
|
},
|
{
|
name: '导出',
|
type: 'text',
|
clickFun: (row) => {
|
this.downLoadInDetail(row);
|
}
|
}
|
|
]
|
}],
|
pagination: {
|
pageSize: 20,
|
current: 1,
|
total: 0,
|
compilerName: ""
|
},
|
inDetailPagination: {
|
pageSize: 20,
|
current: 1,
|
total: 0
|
},
|
editPlanShow: false,
|
currentRow: {},
|
currentRowId: null, // 当前选中数据的id
|
reviewRemarks: '', // 审核备注
|
reviewDialog: false, // 审核弹框
|
reviewLoading: false, // 审核提交按钮
|
approvalRemarks: '', // 审核备注
|
approvalDialog: false, // 审核弹框
|
approvalLoading: false, // 审核提交按钮
|
multipleSelection: [], // 年度明细表选中的数据
|
uploadDia: false,
|
uploading: false,
|
isOperation: false,
|
token: null,
|
fileList: [],
|
currentChangeRow: {},
|
};
|
},
|
mounted() {
|
this.token = {
|
'token': sessionStorage.getItem('token')
|
}
|
if (this.isDepartment) {
|
this.getYearPlanList(this.departId)
|
} else {
|
this.getInDetailPlan('', this.departId)
|
}
|
},
|
methods: {
|
searchTable () {
|
this.getInDetailPlan(this.currentRowId)
|
},
|
// 查询-年度计划表
|
getYearPlanList(userId) {
|
const name = this.isDepartment ? 'departmentId' : 'userId';
|
this.$axios.get(this.$api.personnel.personTrainingSelect + `?${name}=` + userId + '&size=' + this.pagination.pageSize + '¤t=' + this.pagination.current + '&compilerName=' + this.pagination.compilerName).then(res => {
|
if (res.code === 201) return
|
this.yearPlanTableData = res.data.records;
|
this.pagination.total = res.data.total;
|
if (this.yearPlanTableData.length > 0) {
|
this.currentRowId = this.yearPlanTableData[0].id
|
this.currentChange(this.yearPlanTableData[0])
|
}
|
});
|
},
|
currentChange (row) {
|
const now = new Date();
|
const currentYear = now.getFullYear();
|
this.currentChangeRow = row
|
this.currentRowId = row.id
|
if (row.createTime.slice(0,4) == currentYear) {
|
this.isOperation = true;
|
} else {
|
this.isOperation = false;
|
}
|
this.getInDetailPlan(row.id)
|
},
|
getInDetailPlan (id) {
|
if (this.inDetailForm.trainingDate === null) {
|
this.inDetailForm.trainingDate = ''
|
}
|
const userId = this.isDepartment ? '' : this.departId
|
this.$axios.get(this.$api.personnel.queryTheAnnualPlanDetailsTable + '?userId=' + userId + '&size=' + this.inDetailPagination.pageSize +
|
'¤t=' + this.inDetailPagination.current + '&id=' + id +
|
'&trainingLecturerName=' + this.inDetailForm.trainingLecturerName+
|
'&trainingDate=' + this.inDetailForm.trainingDate+
|
'&courseCode=' + this.inDetailForm.courseCode).then(res => {
|
if (res.code === 201) return
|
this.inDetailPlanTableData = res.data.records;
|
this.inDetailPagination.total = res.data.total;
|
});
|
},
|
// 新增年度计划明细表
|
addTrainingPlan() {
|
if (!this.currentRowId) {
|
this.$message.warning('请选择一条计划进行新增')
|
return
|
}
|
this.$refs.addPlan.showDialog(this.currentRowId);
|
},
|
// 年度计划表-删除
|
deleteFun(id) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.$axios.delete(this.$api.personnel.personTrainingDelete + '?id=' + id).then(res => {
|
this.$message.success('删除成功!');
|
this.getYearPlanList(this.departId);
|
});
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
// 年度计划表-审核
|
handleCheck(id) {
|
this.currentRowId = id
|
this.reviewDialog = true
|
},
|
handleReview (status) {
|
const personTrainingUpdateDto = {
|
id: this.currentRowId,
|
remarks: this.reviewRemarks,
|
status: status
|
}
|
this.reviewLoading = true
|
this.$axios.post(this.$api.personnel.reviewAnnualPersonnelTraining, personTrainingUpdateDto, {
|
headers: {
|
'Content-Type': 'application/json'
|
},
|
noQs: true
|
}).then(res => {
|
if (res.code === 200) {
|
this.$message.success('提交成功!');
|
this.reviewDialog = false
|
this.getYearPlanList(this.departId);
|
}
|
this.reviewLoading = false
|
}).catch(() => {
|
this.reviewLoading = false
|
})
|
},
|
// 年度计划表-批准
|
handleApprove(id) {
|
this.currentRowId = id
|
this.approvalDialog = true
|
},
|
handleApproval (status) {
|
const personTrainingUpdateDto = {
|
id: this.currentRowId,
|
remarks: this.approvalRemarks,
|
status: status
|
}
|
this.approvalLoading = true
|
this.$axios.post(this.$api.personnel.approveAnnualPersonnelTraining, personTrainingUpdateDto, {
|
headers: {
|
'Content-Type': 'application/json'
|
},
|
noQs: true
|
}).then(res => {
|
if (res.code === 200) {
|
this.$message.success('提交成功!');
|
this.approvalDialog = false
|
this.getYearPlanList(this.departId);
|
}
|
this.approvalLoading = false
|
}).catch(() => {
|
this.approvalLoading = false
|
})
|
},
|
// 年度计划表-下载
|
downLoadPost(row) {
|
this.$axios.get(this.$api.personnel.exportPersonTraining + '?id=' + row.id,{responseType: "blob"}).then(res => {
|
this.outLoading = false
|
this.$message.success('导出成功')
|
const blob = new Blob([res],{ type: 'application/msword' });
|
const url = URL.createObjectURL(blob);
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = row.fileName + '.docx';
|
link.click();
|
})
|
},
|
// 年度计划-导入
|
submitUpload() {
|
if (this.$refs.upload.uploadFiles.length == 0) {
|
this.$message.error('未选择文件')
|
return
|
}
|
this.uploading = true
|
this.$refs.upload.submit();
|
this.uploading = false
|
},
|
onSuccess(response, file, fileList) {
|
this.$refs.upload.clearFiles()
|
this.uploadDia = false
|
this.uploading = false
|
if (response.code == 201) {
|
this.$message.error(response.message)
|
return
|
}
|
this.$message.success('上传成功')
|
this.standardList = []
|
this.productList = []
|
this.getYearPlanList(this.departId)
|
},
|
onError(err, file, fileList) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
this.uploading = false
|
},
|
beforeUpload(file, fileList) {
|
if (file.type != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
|
this.$message.error('上传文件格式不正确');
|
this.$refs.upload.clearFiles()
|
return false;
|
}
|
},
|
// 年度计划分页
|
handleYearCurrent(page) {
|
this.pagination.current = page;
|
this.getYearPlanList(this.departId);
|
},
|
handleYearSizeChange(size) {
|
this.pagination.pageSize = size;
|
this.getYearPlanList(this.departId);
|
},
|
// 年度计划明细表-认领、取消认领
|
handleClaim(row) {
|
this.$confirm('是否确认认领该课程?', '提示', {
|
confirmButtonText: '认领',
|
cancelButtonText: '取消认领',
|
type: 'warning'
|
}).then(() => {
|
this.handleClaimFun(true, row.id)
|
}).catch(() => {
|
this.handleClaimFun(false, row.id)
|
});
|
},
|
handleClaimFun(claimAndClaim, rowId) {
|
this.$axios.post(this.$api.personnel.claimOfTrainingAndAssessmentRecords + `?claimAndClaim=${claimAndClaim}&courseId=${rowId}`).then(res => {
|
this.getInDetailPlan(this.currentChangeRow.id)
|
});
|
},
|
// 年度计划明细表-编辑
|
editInDetail(row) {
|
this.editPlanShow = true;
|
this.currentRow = row
|
},
|
//
|
goBack() {
|
this.editPlanShow = false;
|
this.getInDetailPlan(this.currentRowId)
|
},
|
// 年度计划明细表-下载
|
downLoadInDetail(row) {
|
this.$axios.get(this.$api.personnel.exportPersonTrainingRecord + '?id=' + row.id,{responseType: "blob"}).then(res => {
|
this.outLoading = false
|
this.$message.success('导出成功')
|
const blob = new Blob([res],{ type: 'application/msword' });
|
const url = URL.createObjectURL(blob);
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = row.courseCode + '人员培训与考核记录' + '.docx';
|
link.click();
|
})
|
},
|
// 年度计划明细表-多选
|
handleSelectionChange(list) {
|
this.multipleSelection = list
|
},
|
// 年度明细表-删除
|
batchDelete () {
|
if (this.multipleSelection.length > 0) {
|
let ids = []
|
this.multipleSelection.forEach(item => {
|
ids.push(item.id)
|
})
|
this.$confirm('是否确认删除所选择的数据?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.$axios.post(this.$api.personnel.deleteAnnualPlanDetailTable+ '?ids=' +ids.join(',')).then(res => {
|
if (res.code == 200) {
|
this.$message.success('删除成功');
|
this.getInDetailPlan(this.currentRowId);
|
}
|
});
|
}).catch(() => {
|
this.$message.warning('取消删除');
|
});
|
} else {
|
this.$message.warning('请选择需要删除的数据')
|
}
|
},
|
handleSizeChange(val) {
|
this.inDetailPagination.size = val;
|
this.getYearPlanList(this.departId);
|
},
|
handleCurrentChange(val) {
|
this.inDetailPagination.current = val;
|
this.getYearPlanList(this.departId);
|
},
|
},
|
watch: {
|
// 监听点击el-tree的数据,进行数据刷新
|
departId: {
|
handler(newId, oldId) {
|
if (this.isDepartment) {
|
this.getYearPlanList(newId);
|
} else {
|
this.getInDetailPlan('')
|
}
|
}
|
}
|
}
|
};
|
</script>
|
<style scoped>
|
.flex_column {
|
display: flex;
|
height: 80vh;
|
flex-direction: column;
|
overflow: auto;
|
justify-content: space-between;
|
}
|
|
.pagination {
|
display: flex;
|
justify-content: space-between
|
}
|
|
.items_center {
|
display: flex;
|
align-items: center;
|
}
|
|
.date_box {
|
margin: 0 5px;
|
}
|
|
.search {
|
width: 150px;
|
margin: 0 16px;
|
}
|
</style>
|