| | |
| | | <!-- 岗位职责 --> |
| | | <template> |
| | | <div class="view"> |
| | | <div style="text-align: left; margin-bottom: 15px;padding: 0 10px"> |
| | | <label>员工:</label> |
| | | <el-input v-model="userName" clearable placeholder="请输入员工" size="small" style="width: 20vh;"></el-input> |
| | | <el-button size="small" type="primary" @click="refreshTable">查询</el-button> |
| | | <div v-if="isDepartment" style="float: right;"> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <el-form ref="page" size="small" :inline="true"> |
| | | <el-form-item label="员工"> |
| | | <el-input v-model="userName" clearable placeholder="请输入员工" size="small" style="width: 20vh;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button size="small" type="primary" @click="refreshTable">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-button size="small" type="primary" @click="addPost">新增</el-button> |
| | | <!-- <el-button size="small" type="primary">导出excel</el-button>--> |
| | | </div> |
| | | </div> |
| | | <div class="table" style="padding: 0 10px"> |
| | | <el-table :data="tableData" height="70vh" style="width: 100%"> |
| | | <div class="table"> |
| | | <el-table :data="tableData" v-loading="tableLoading" height="66.5vh" style="width: 100%"> |
| | | <el-table-column label="序号" type="index" width="60"></el-table-column> |
| | | <el-table-column label="员工编号" min-width="120" prop="account"></el-table-column> |
| | | <el-table-column label="岗位名称" min-width="180" prop="postName"></el-table-column> |
| | |
| | | <el-table-column label="任职人审核日期" min-width="180" prop="incumbentDate"></el-table-column> |
| | | <el-table-column label="主管" min-width="180" prop="supervisorName"></el-table-column> |
| | | <el-table-column label="主管审核日期" min-width="180" prop="supervisorDate"></el-table-column> |
| | | <el-table-column fixed="right" label="操作" width="140"> |
| | | <el-table-column fixed="right" label="操作" width="140" align="center"> |
| | | <template v-slot="scope"> |
| | | <el-button v-if="!isDepartment || scope.row.currentState === '关闭'" size="small" type="text" |
| | | @click="handleViewClick(scope.row, 'view')">查看 |
| | |
| | | @click="handleViewClick(scope.row, 'edit')">编辑 |
| | | </el-button> |
| | | <el-button size="small" type="text" @click="downLoadPost(scope.row)">导出</el-button> |
| | | <el-button v-if="isDepartment" size="small" type="text" @click="deletePost(scope.row)">删除</el-button> |
| | | <el-button v-if="isDepartment" size="small" style="color: #f56c6c" type="text" @click="deletePost(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" |
| | | :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" |
| | | background |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange"> |
| | | </el-pagination> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // import { dateFormat } from '../../../util/date'; |
| | | import { dateFormat } from '@/utils/date' |
| | | import { |
| | | exportPersonJobResponsibilities, personJobResponsibilitiesDelete, |
| | | personJobResponsibilitiesSave, |
| | | personJobResponsibilitiesSelect |
| | | } from "@/api/cnas/personal/personJobResponsibilities"; |
| | | import {selectUserCondition} from "@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | userName: '', |
| | | tableData: [], |
| | | tableLoading: false, |
| | | responsibleOptions: [], |
| | | search: { |
| | | size: 20, |
| | |
| | | // 查询列表信息 |
| | | getPostList(userId) { |
| | | this.search.userId = userId; |
| | | const name = this.isDepartment ? 'departmentId' : 'userId'; |
| | | this.$axios.get(this.$api.personnel.personJobResponsibilitiesSelect + '?userName=' + this.userName + `&${name}=` + this.search.userId + '&size=' + this.search.size + '¤t=' + this.search.current).then(res => { |
| | | if (res.code === 201) return; |
| | | const params = this.isDepartment ? { |
| | | userName: this.userName, |
| | | departmentId: this.search.userId, |
| | | size: this.search.size, |
| | | current: this.search.current, |
| | | }: { |
| | | userName: this.userName, |
| | | userId: this.search.userId, |
| | | size: this.search.size, |
| | | current: this.search.current, |
| | | } |
| | | this.tableLoading = true |
| | | personJobResponsibilitiesSelect(params).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | }); |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | //提交表单 |
| | | async submitForm(saveState) { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid === true || saveState !== '1submit') { |
| | | // 给当前环节设置创建人与时间 |
| | | let user = JSON.parse(localStorage.getItem('user')); |
| | | let user = this.nickName; |
| | | const dateTime = dateFormat(new Date()); |
| | | // 获取当前环节操作人与日期 |
| | | switch (this.currentStep) { |
| | |
| | | } |
| | | // 获取当前状态 |
| | | this.form.currentState = currentStepAction === 3 ? '关闭' : this.steps[currentStepAction]; |
| | | this.$axios.post(this.$api.personnel.personJobResponsibilitiesSave, this.form, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | noQs: true |
| | | }).then(res => { |
| | | personJobResponsibilitiesSave(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('提交成功'); |
| | | this.getPostList(this.departId); |
| | |
| | | }, |
| | | // 下载岗位职责 |
| | | downLoadPost(row) { |
| | | this.$axios.post(this.$api.personPostAuthorizationRecord.exportPersonJobResponsibilities,{id:row.id},{responseType: "blob"}).then(res => { |
| | | exportPersonJobResponsibilities({id:row.id}).then(res => { |
| | | const blob = new Blob([res],{ type: 'application/octet-stream' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = row.incumbentName+'-岗位职责'+'.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = row.incumbentName+'-岗位职责'+'.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | this.$download.saveAs(blob, row.incumbentName+'-岗位职责'+'.docx'); |
| | | this.$message.success('导出成功') |
| | | }) |
| | | }, |
| | | // 删除岗位职责 |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios.delete(this.$api.personnel.personJobResponsibilitiesDelete + '?id=' + row.id).then(res => { |
| | | personJobResponsibilitiesDelete({id: row.id}).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('删除成功'); |
| | | this.getPostList(this.departId); |
| | |
| | | }, |
| | | // 获取负责人信息接口 |
| | | getUserList() { |
| | | this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { |
| | | selectUserCondition().then(res => { |
| | | if (res.code == 200) { |
| | | this.responsibleOptions = res.data; |
| | | this.responsibleOptions = res.data |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | choiceStep(index) { |
| | | this.currentStepClick = index; |
| | |
| | | this.getPostList(newId); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['nickName']) |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped> |