From 8d6b6b8f322e83c82c24e1128d34f6106e6021c7 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 26 九月 2023 16:17:06 +0800 Subject: [PATCH] 新增接口 --- src/views/coalMine/cPeopleManage/components/trainDialog.vue | 257 ++++ src/api/notCoalMine/people.js | 36 src/views/notCoalMine/nPlaceManage/nTrainManage/index.vue | 2 src/assets/images/profile.jpg | 0 src/views/notCoalMine/nPlaceManage/nExamManage/index.vue | 2 src/views/notCoalMine/nPeopleManage/components/peopleDialog.vue | 451 +++++++ src/views/notCoalMine/nTeacherManage/nTeacher/index.vue | 23 src/utils/validate.js | 11 src/views/notCoalMine/nTeacherManage/nTeacher/components/teacherDialog.vue | 486 ++++++++ .env.development | 3 src/views/coalMine/cPeopleManage/components/peopleDialog.vue | 405 +++++++ src/views/login.vue | 13 src/views/notCoalMine/nPeopleManage/components/experienceDialog.vue | 128 ++ src/api/coalMine/operateType.js | 36 src/api/coalMine/people.js | 149 ++ src/views/coalMine/cPeopleManage/components/examDialog.vue | 260 ++++ src/views/notCoalMine/nPeopleManage/index.vue | 159 +- src/assets/images/login-background.jpg | 0 src/views/coalMine/cPeopleManage/index.vue | 221 ++- src/views/coalMine/cPeopleManage/components/certDialog.vue | 280 ++++ src/views/coalMine/cPeopleManage/components/experienceDialog.vue | 235 ++++ src/views/system/operateType/index.vue | 223 +++ 22 files changed, 3,238 insertions(+), 142 deletions(-) diff --git a/.env.development b/.env.development index 8017627..eba997d 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,8 @@ ENV = 'development' # 若依管理系统/开发环境 -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API = 'http://192.168.0.41:8085' +#VUE_APP_BASE_API = 'http://192.168.0.70:8085' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/src/api/coalMine/operateType.js b/src/api/coalMine/operateType.js new file mode 100644 index 0000000..4d10652 --- /dev/null +++ b/src/api/coalMine/operateType.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + +// 数据分页 +export function getOperatePage(data) { + return request({ + url: '/system/operateType/list', + method: 'post', + data: data + }) +} + +// 新增数据 +export function addOperate(data) { + return request({ + url: '/system/operateType/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editOperate(data) { + return request({ + url: '/system/operateType/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delOperate(id) { + return request({ + url: '/system/operateType/removeById/' + id, + method: 'get' + }) +} diff --git a/src/api/coalMine/people.js b/src/api/coalMine/people.js new file mode 100644 index 0000000..9d70c28 --- /dev/null +++ b/src/api/coalMine/people.js @@ -0,0 +1,149 @@ +import request from '@/utils/request' + +// 数据分页 +export function getPeoplePage(query) { + return request({ + url: '/cm/staff/page', + method: 'get', + params: query + }) +} + +// 新增数据 +export function addPeople(data) { + return request({ + url: '/cm/staff/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editPeople(data) { + return request({ + url: '/cm/staff/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delPeople(id) { + return request({ + url: '/cm/staff/del/' + id, + method: 'get' + }) +} + +// 新增数据 +export function addResume(data) { + return request({ + url: '/cm/staffResume/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editResume(data) { + return request({ + url: '/cm/staffResume/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delResume(id) { + return request({ + url: '/cm/staffResume/del/' + id, + method: 'get' + }) +} + +// 新增数据 +export function addCert(data) { + return request({ + url: '/cmStaffQa/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editCert(data) { + return request({ + url: '/cmStaffQa/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delCert(id) { + return request({ + url: '/cmStaffQa/del/' + id, + method: 'get' + }) +} + +// 新增数据 +export function addTrain(data) { + return request({ + url: '/cmStaffTrain/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editTrain(data) { + return request({ + url: '/cmStaffTrain/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delTrain(id) { + return request({ + url: '/cmStaffTrain/del/' + id, + method: 'get' + }) +} + +// 新增数据 +export function addExam(data) { + return request({ + url: '/cmStaffExam/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editExam(data) { + return request({ + url: '/cmStaffExam/edit', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delExam(id) { + return request({ + url: '/cmStaffExam/del/' + id, + method: 'get' + }) +} + +// 上传 +export function uploadFile(data) { + return request({ + url: '/attachment/upload/detail', + method: 'post', + data: data + }) +} diff --git a/src/api/notCoalMine/people.js b/src/api/notCoalMine/people.js new file mode 100644 index 0000000..5a43c45 --- /dev/null +++ b/src/api/notCoalMine/people.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + +// 数据分页 +export function getPeoplePage(query) { + return request({ + url: '/nc/staff/list/page', + method: 'get', + params: query + }) +} + +// 新增数据 +export function addPeople(data) { + return request({ + url: '/nc/staff/add', + method: 'post', + data: data + }) +} + +// 修改数据 +export function editPeople(data) { + return request({ + url: '/nc/staff/mod', + method: 'post', + data: data + }) +} + +// 删除数据 +export function delPeople(id) { + return request({ + url: '/nc/staff/del/batch/' + id, + method: 'get' + }) +} diff --git a/src/assets/images/login-background.jpg b/src/assets/images/login-background.jpg index 8a89eb8..dc05211 100644 --- a/src/assets/images/login-background.jpg +++ b/src/assets/images/login-background.jpg Binary files differ diff --git a/src/assets/images/profile.jpg b/src/assets/images/profile.jpg index b3a940b..6bb6af3 100644 --- a/src/assets/images/profile.jpg +++ b/src/assets/images/profile.jpg Binary files differ diff --git a/src/utils/validate.js b/src/utils/validate.js index adfa254..e689132 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -81,3 +81,14 @@ } return Array.isArray(arg) } + +// 简单校验手机号(十一位数字则通过) +export function verifySimplePhone(val) { + var regex = /^\d{11}$/; // 正则表达式,\d 匹配数字,{11} 表示匹配11次 + return regex.test(val); +} + +export function verifyIdCard(val) { + var regex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + return regex.test(val) +} diff --git a/src/views/coalMine/cPeopleManage/components/certDialog.vue b/src/views/coalMine/cPeopleManage/components/certDialog.vue new file mode 100644 index 0000000..7a4e4fd --- /dev/null +++ b/src/views/coalMine/cPeopleManage/components/certDialog.vue @@ -0,0 +1,280 @@ +<template> + <el-dialog title="资格证书" :visible.sync="open" width="50%" append-to-body> + <div class="app-container home"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="openEdit({},'add')" + v-hasPermi="['system:experts:add']" + >新增</el-button> + </el-col> +<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>--> + </el-row> + <el-table v-loading="loading" :data="dataList"> + <el-table-column type="index" label="序号" width="55" align="center" /> + <el-table-column label="证书名称" align="center" prop="name"/> + <el-table-column label="资格类型" align="center" prop="qualificationType" /> + <el-table-column label="作业类别" align="center" prop="jobCategory" /> + <el-table-column label="操作项目" align="center" prop="operationItems" /> + <el-table-column label="人员" align="center" prop="staffId" /> + <el-table-column label="有效期至" align="center" prop="expiredTime"/> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openEdit(scope.row,'edit')" + >编辑</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row,scope.index)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + <el-dialog :title="title" :visible.sync="dialogVisible" width="50%" append-to-body> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px"> + <el-row> + <el-col :span="20"> + <el-form-item label="证书名称" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="资格类型" prop="operateTypeId"> + <el-cascader + v-model="form.operateTypeId" + :options="typeList" + style="width: 100%" + :props="{ expandTrigger: 'hover', value: 'id',label: 'name',emitPath: false}" + @change="handleChange"></el-cascader> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="过期时间" prop="expiredTime"> + <el-date-picker + v-model="form.expiredTime" + value-format="yyyy-MM-dd" + style="width: 100%"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button type="primary" @click="submit()">提交</el-button> + </div> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> + +// import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +import {addCert, editCert, delCert} from "@/api/coalMine/people"; +import {getOperatePage} from "@/api/coalMine/operateType"; + +export default { + name: "certDialog", + dicts: [], + components: { }, + data() { + return { + open: false, + id: null, + dialogVisible: false, + title: '新增证书', + loading: false, + dataList: [], + typeList: [], + form: { + name: '', + id: null, + staffId: null, + expiredTime: '', + operateTypeId: null + }, + rules: { + name: [{ required: true, message: "请填写证书名称", trigger: "blur" }], + expiredTime: [{ required: true, message: "请选择过期时间", trigger: "blur" }], + operateTypeId: [{ required: true, message: "请选择资格类型", trigger: "blur" }] + } + }; + }, + created() { + + }, + methods: { + openDialog(data){ + this.dataList = data.cmStaffQas + this.id = data.id + this.getList() + this.open = true + }, + + async getList() { + this.loading = true; + const res = await getOperatePage({name: ''}) + if(res.code == 200){ + this.typeList = this.handleTree(res.data, "id"); + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + this.loading = false; + }, + + openEdit(data,type){ + this.dialogVisible = true + if(type == 'add'){ + this.title='新增证书' + this.form = { + name: '', + id: null, + staffId: this.id, + expiredTime: '', + operateTypeId: null + } + }else { + this.title='编辑证书' + for(let i in data){ + if(this.isKey(i,this.form)){ + this.form[i] = data[i] + } + } + } + }, + isKey(key,obj){ + return key in obj + }, + handleDelete(row,index){ + this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + const res = await delCert(row.id) + if(res.code == 200){ + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => { + + }); + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + const obj = JSON.parse(JSON.stringify(this.form)) + // console.log(obj.qualification[1],'obj',this.findNameById(this.typeList,obj.qualification[1])) + // if(obj.qualification.length == 2){ + // obj.qualificationType = this.findNameById(this.typeList,obj.qualification[0]) + // obj.jobCategory = this.findNameById(this.typeList,obj.qualification[1]) + // obj.operateTypeId = this.obj.qualification[1] + // } + // if(obj.qualification.length == 3){ + // obj.qualificationType = this.findNameById(this.typeList,obj.qualification[0]) + // obj.jobCategory = this.findNameById(this.typeList,obj.qualification[1]) + // obj.operationItems = this.findNameById(this.typeList,obj.qualification[2]) + // obj.operateTypeId = obj.qualification[2] + // } + if(this.title == '新增证书'){ + const {id,...data} = obj + const res = await addCert(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + const res= await editCert(obj) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + + findNameById(data,id){ + for(const node of data){ + if(node.id == id){ + return node.name + } + if(node.children){ + const foundName = this.findNameById(node.children,id) + if(foundName){ + return foundName + } + } + } + return null + }, + + handleChange(){ + + }, + handleQuery(){ + + }, + resetQuery(){ + + }, + } +}; +</script> + +<style scoped lang="scss"> +.home {} +</style> + diff --git a/src/views/coalMine/cPeopleManage/components/examDialog.vue b/src/views/coalMine/cPeopleManage/components/examDialog.vue new file mode 100644 index 0000000..3a6835b --- /dev/null +++ b/src/views/coalMine/cPeopleManage/components/examDialog.vue @@ -0,0 +1,260 @@ +<template> + <el-dialog title="考试经历" :visible.sync="open" width="50%" append-to-body> + <div class="app-container home"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="openEdit({},'add')" + v-hasPermi="['system:experts:add']" + >新增</el-button> + </el-col> +<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>--> + </el-row> + <el-table v-loading="loading" :data="dataList"> + <el-table-column type="index" label="序号" width="55" align="center"/> + <el-table-column label="考试时间" align="center" prop="examTime"/> + <el-table-column label="考试中心" align="center" prop="examCenter"/> + <el-table-column label="科目" align="center" prop="subject"/> + <el-table-column label="考试结果" align="center" prop="result"> + <template #default="scope"> + {{scope.row.result == 0 ? '通过' : '未通过'}} + </template> + </el-table-column> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openEdit(scope.row,'edit')" + >编辑</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row,scope.index)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + <el-dialog :title="title" :visible.sync="dialogVisible" width="50%" append-to-body> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px"> + <el-row> + <el-col :span="20"> + <el-form-item label="考试时间" prop="examTime"> + <el-date-picker + v-model="form.examTime" + value-format="yyyy-MM-dd" + style="width: 100%"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="考试中心" prop="examCenter"> + <el-input v-model="form.examCenter"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="科目" prop="subject"> + <el-input v-model="form.subject"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="考试结果" prop="result"> + <el-radio-group v-model="form.result" :disabled="disable"> + <el-radio label="0">通过</el-radio> + <el-radio label="1">未通过</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button type="primary" @click="submit()">提交</el-button> + </div> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> + +import {addExam, editExam, delExam} from "@/api/coalMine/people"; + +export default { + name: "examDialog", + dicts: [], + components: { }, + data() { + return { + open: false, + id: null, + dialogVisible: false, + title: '新增经历', + loading: false, + dataList: [], + form: { + id: null, + staffId: null, + examTime: '', + examCenter: '', + subject: '', + result: '' + }, + rules: { + examCenter: [{ required: true, message: "请填写考试中心", trigger: "blur" }], + examTime: [{ required: true, message: "请选择考试时间", trigger: "blur" }], + subject: [{ required: true, message: "请填写考试科目", trigger: "blur" }], + result: [{ required: true, message: "请选择考试结果", trigger: "blur" }] + } + }; + }, + created() { + + }, + methods: { + openDialog(data){ + this.dataList = data.cmStaffExams + this.id = data.id + this.open = true + }, + + openEdit(data,type){ + this.dialogVisible = true + if(type == 'add'){ + this.title='新增经历' + this.form = { + id: null, + staffId: this.id, + examTime: '', + examCenter: '', + subject: '', + result: '' + } + }else { + this.title='编辑经历' + for(let i in data){ + if(this.isKey(i,this.form)){ + this.form[i] = data[i] + } + } + } + }, + isKey(key,obj){ + return key in obj + }, + handleDelete(row,index){ + this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + const res = await delExam(row.id) + if(res.code == 200){ + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => { + + }); + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + const obj = JSON.parse(JSON.stringify(this.form)) + if(this.title == '新增经历'){ + const {id,...data} = obj + const res = await addExam(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + const res= await editExam(obj) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + + findNameById(data,id){ + for(const node of data){ + if(node.id == id){ + return node.name + } + if(node.children){ + const foundName = this.findNameById(node.children,id) + if(foundName){ + return foundName + } + } + } + return null + }, + + handleChange(){ + + }, + handleQuery(){ + + }, + resetQuery(){ + + }, + } +}; +</script> + +<style scoped lang="scss"> +.home {} +</style> + diff --git a/src/views/coalMine/cPeopleManage/components/experienceDialog.vue b/src/views/coalMine/cPeopleManage/components/experienceDialog.vue new file mode 100644 index 0000000..5de9f1c --- /dev/null +++ b/src/views/coalMine/cPeopleManage/components/experienceDialog.vue @@ -0,0 +1,235 @@ +<template> + <el-dialog title="个人履历" :visible.sync="open" width="50%" append-to-body> + <div class="app-container home"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="openEdit({},'add')" + v-hasPermi="['system:experts:add']" + >新增</el-button> + </el-col> +<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>--> + </el-row> + <el-table v-loading="loading" :data="dataList"> + <el-table-column type="index" label="序号" width="55" align="center" /> + <el-table-column label="时间" align="center" prop="startTime"> + <template #default="scope"> + {{scope.row.startTime.substring(0,7) + '~' + scope.row.endTime.substring(0,7)}} + </template> + </el-table-column> + <el-table-column label="单位" align="center" prop="unit" /> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openEdit(scope.row,'edit')" + >编辑</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row,scope.index)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + <el-dialog :title="title" :visible.sync="dialogVisible" width="50%" append-to-body> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px"> + <el-row> + <el-col :span="20"> + <el-form-item label="工作时间" prop="timeRange"> + <el-date-picker + v-model="form.timeRange" + @change="changeTime" + type="monthrange" + range-separator="至" + start-placeholder="开始月份" + end-placeholder="结束月份" + value-format="yyyy-MM-01" + style="width: 100%"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="单位" prop="unit"> + <el-input v-model="form.unit"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button type="primary" @click="submit()">提交</el-button> + </div> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> +import {addResume, editResume, delResume} from "@/api/coalMine/people"; + +export default { + name: "experienceDialog", + dicts: [], + components: { }, + data() { + return { + open: false, + id: null, + dialogVisible: false, + title: '新增履历', + loading: false, + dataList: [], + form: { + id: null, + staffId: null, + timeRange: [], + startTime: '', + endTime: '', + unit: '' + }, + rules: { + timeRange: [{ required: true, message: "请选择时间段", trigger: "blur" }], + // startTime: [{ required: true, message: "请选择开始时间", trigger: "blur" }], + // endTime: [{ required: true, message: "请选择结束时间", trigger: "blur" }], + unit: [{ required: true, message: "请填写单位", trigger: "blur" }] + } + }; + }, + created() { + + }, + methods: { + openDialog(data){ + this.dataList = data.cmStaffResumes + this.id = data.id + this.open = true + }, + openEdit(data,type){ + this.dialogVisible = true + if(type == 'add'){ + this.title='新增履历' + this.form = { + id: null, + staffId: this.id, + timeRange: [], + startTime: '', + endTime: '', + unit: '' + } + }else { + this.title='编辑履历' + this.form.id = data.id + this.form.staffId = data.staffId + this.form.startTime = data.startTime + this.form.endTime = data.endTime + this.form.timeRange[0] = data.startTime + this.form.timeRange[1] = data.endTime + this.form.unit = data.unit + console.log(this.form.timeRange,'range') + } + }, + handleDelete(row,index){ + this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + const res = await delResume(row.id) + if(res.code == 200){ + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => { + + }); + }, + changeTime(value){ + this.form.startTime = this.form.timeRange[0] + this.form.endTime = this.form.timeRange[1] + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + if(this.title == '新增履历'){ + const {id,timeRange,...data} = this.form + const res= await addResume(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + const {timeRange,...data} = this.form + const res= await editResume(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + getList(){ + + }, + handleChange(){ + + }, + handleQuery(){ + + }, + resetQuery(){ + + }, + } +}; +</script> + +<style scoped lang="scss"> +.home {} +</style> + diff --git a/src/views/coalMine/cPeopleManage/components/peopleDialog.vue b/src/views/coalMine/cPeopleManage/components/peopleDialog.vue new file mode 100644 index 0000000..734df01 --- /dev/null +++ b/src/views/coalMine/cPeopleManage/components/peopleDialog.vue @@ -0,0 +1,405 @@ +<template> + <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body> + <div class="main_form"> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px" :label-position="labelPosition"> + <el-row> + <el-col :span="20"> + <el-form-item label="姓名" prop="name"> + <el-input v-model="form.name" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="性别" prop="sex"> + <el-radio-group v-model="form.sex" :disabled="disable"> + <el-radio :label="0">男</el-radio> + <el-radio :label="1">女</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="身份证号" prop="code"> + <el-input v-model="form.code" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="民族" prop="nationCode"> + <el-select v-model="form.nationCode" placeholder="请选择" :disabled="disable" style="width: 100%"> + <el-option + v-for="dict in dict.type.sys_nation_code" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="联系电话" prop="mobilePhone"> + <el-input v-model="form.mobilePhone" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="最高学历" prop="eduLevel"> + <el-input v-model="form.eduLevel" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="证件照" prop="photoAttachment"> + <el-upload + action="" + :disabled="disable" + :auto-upload="false" + :limit="1" + accept="image/*,.pdf" + :file-list="fileList" + list-type="picture-card" + :before-upload="beforeAvatarUpload" + :on-change="avatorChange" + :on-preview="handlePreview" + :on-exceed="overLimit" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button v-if="title == '查看人员'" type="primary" @click="open = false">确认</el-button> + <el-button v-else type="primary" @click="submit()">提交</el-button> + </div> + <el-dialog :visible.sync="dialogVisible" append-to-body> + <img width="100%" :src="dialogImageUrl" alt=""> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> +import { uploadFile,addPeople,editPeople } from '@/api/coalMine/people' +import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +export default { + name: "peopleDialog", + dicts: ['sys_nation_code'], + data() { + var validatePass = (rule, value, callback) => { + if (this.fileList.length == 0) { + callback(new Error('请上传证件照')); + } else { + callback(); + } + } + let validatePhone = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入手机号')) + }else{ + if(!verifySimplePhone(value)){ + callback(new Error('手机号格式有误')) + }else{ + callback() + } + } + } + let verifyId = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入身份证号')) + }else{ + if(!verifyIdCard(value)){ + callback(new Error('身份证号格式有误')) + }else{ + callback() + } + } + } + return { + labelPosition: 'right', + disable: false, + title: '新增人员', + open: false, + form:{ + id: null, + name: '', + sex: null, + code: '', + nationCode: '', + mobilePhone: '', + eduLevel: '', + photoAttachment: null + }, + fileList: [], + dialogImageUrl: '', + dialogVisible: false, + rules:{ + name:[{ required: true, message: '请填写姓名', trigger: 'blur' }], + sex:[{ required: true, message: '请选择性别', trigger: 'blur' }], + code: [{ required: true, validator: verifyId, trigger: 'blur' }], + nationCode: [{ required: true, message: '请选择民族', trigger: 'blur' }], + mobilePhone:[{ required: true, validator: validatePhone, trigger: 'blur' }], + eduLevel: [{ required: true, message: '请填写最高学历', trigger: 'blur' }], + photoAttachment: [{ required: true,validator: validatePass, trigger: 'blur' }] + }, + }; + }, + created() { + const t = this + const width = document.documentElement.clientWidth + if(width < 750){t.labelPosition = 'top'} + }, + methods: { + openDialog(val,type){ + const t = this + t.fileList = [] + const width = document.documentElement.clientWidth + if(width < 750){this.labelPosition = 'top'} + t.open = true + if(type == 'add'){ + t.title = '新增人员' + t.disable = false + t.form = { + id: null, + name:'', + sex: null, + code: '', + nationCode: '', + mobilePhone:'', + eduLevel: '', + photoAttachment: null + } + }else{ + if(type == 'edit'){ + t.title = '编辑人员' + t.disable = false + }else{ + t.title = '查看人员' + t.disable = true + } + if(val){ + for(let i in val){ + if(t.isValidKey(i,this.form)){ + t.form[i] = val[i] + } + } + t.form.sex = Number(t.form.sex) + // 仅限单张图片处理 + t.form.photoAttachment = val.photoAttachment.id + let file = { + name: val.photoAttachment.fileName, + url: process.env.VUE_APP_BASE_API + val.photoAttachment.fileUrl + } + t.fileList.push(file) + } + console.log(t.fileList,'fileList1') + } + }, + isValidKey(key,obj){ + return key in obj + }, + + avatorChange(file, fileList) { + this.fileList = fileList; + console.log(fileList,'list2') + }, + + overLimit(){ + this.$message({ + type: 'warning', + message: '超出文件上传数量' + }); + }, + handlePreview(file) { + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, + beforeAvatarUpload(file) { + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + this.$message.error('上传头像图片大小不能超过 5MB!'); + } + return isLt5M; + }, + async submitUpload() { + // 仅限单张图片处理 + const { fileList } = this; + if (fileList.length === 0 || !fileList.find((file)=>file.raw)) { + return; + } + const uploadPromises = fileList.map(async (file) => { + const formData = new FormData(); + formData.append("file", file.raw); + formData.append("module", 'accountPath'); + try { + const res = await uploadFile(formData); + if (res.code == 200) { + return res.data.id + } else { + this.$message.error('图片上传出错!'); + return null; + } + } catch (error) { + console.error('上传文件出错:', error); + return null; + } + }); + const uploadedFiles = await Promise.all(uploadPromises); + const validUploadedFiles = uploadedFiles.filter(file => file !== null); + if (validUploadedFiles.length > 0) { + // 返回数据,单张多张处理不同 + this.form.photoAttachment = validUploadedFiles[0] + } + }, + handleRemove(file, fileList) { + console.log(file, fileList); + this.fileList = fileList + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + await this.submitUpload() + if(this.title == '新增人员'){ + const {id,...data} = this.form + const res= await addPeople(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.fileList = [] + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + const res= await editPeople(this.form) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.fileList = [] + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + changeSource(num){ + this.form.source = num + } + } +}; +</script> + +<style scoped lang="scss"> +.home { + blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; + } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + } + .col-item { + margin-bottom: 20px; + } + + ul { + padding: 0; + margin: 0; + } + + font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + color: #676a6c; + overflow-x: hidden; + + ul { + list-style-type: none; + } + + h4 { + margin-top: 0px; + } + + h2 { + margin-top: 10px; + font-size: 26px; + font-weight: 100; + } + + p { + margin-top: 10px; + + b { + font-weight: 700; + } + } + + .update-log { + ol { + display: block; + list-style-type: decimal; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0; + margin-inline-end: 0; + padding-inline-start: 40px; + } + } +} +.avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; +} +.avatar-uploader .el-upload:hover { + border-color: #409EFF; +} +.avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; +} +.avatar { + width: 178px; + height: 178px; + display: block; +} +</style> + diff --git a/src/views/coalMine/cPeopleManage/components/trainDialog.vue b/src/views/coalMine/cPeopleManage/components/trainDialog.vue new file mode 100644 index 0000000..f94aee3 --- /dev/null +++ b/src/views/coalMine/cPeopleManage/components/trainDialog.vue @@ -0,0 +1,257 @@ +<template> + <el-dialog title="培训经历" :visible.sync="open" width="50%" append-to-body> + <div class="app-container home"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="openEdit({},'add')" + v-hasPermi="['system:experts:add']" + >新增</el-button> + </el-col> +<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>--> + </el-row> + <el-table v-loading="loading" :data="dataList"> + <el-table-column type="index" label="序号" width="55" align="center" /> + <el-table-column label="培训时间" align="center" prop="startTime"> + <template #default="scope"> + {{scope.row.startTime.substring(0,7) + '~' + scope.row.endTime.substring(0,7)}} + </template> + </el-table-column> + <el-table-column label="培训单位" align="center" prop="unit" /> + <el-table-column label="所属批次" align="center" prop="batch" /> + <el-table-column label="科目" align="center" prop="subject" /> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openEdit(scope.row,'edit')" + >编辑</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row,scope.index)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + <el-dialog :title="title" :visible.sync="dialogVisible" width="50%" append-to-body> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px"> + <el-row> + <el-col :span="20"> + <el-form-item label="培训时间" prop="timeRange"> + <el-date-picker + v-model="form.timeRange" + @change="changeTime" + type="monthrange" + range-separator="至" + start-placeholder="开始月份" + end-placeholder="结束月份" + value-format="yyyy-MM-01" + style="width: 100%"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="批次" prop="batch"> + <el-input v-model="form.batch"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="科目" prop="subject"> + <el-input v-model="form.subject"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="单位" prop="unit"> + <el-input v-model="form.unit"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button type="primary" @click="submit()">提交</el-button> + </div> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> +import {addTrain, editTrain, delTrain} from "@/api/coalMine/people"; + +export default { + name: "trainDialog", + dicts: [], + components: { }, + data() { + return { + open: false, + id: null, + dialogVisible: false, + title: '新增经历', + loading: false, + dataList: [], + form: { + id: null, + staffId: null, + timeRange: [], + startTime: '', + endTime: '', + batch: '', + subject: '', + unit: '' + }, + rules: { + timeRange: [{ required: true, message: "请选择时间段", trigger: "blur" }], + batch: [{ required: true, message: "请选择开始时间", trigger: "blur" }], + subject: [{ required: true, message: "请选择结束时间", trigger: "blur" }], + unit: [{ required: true, message: "请填写单位", trigger: "blur" }] + } + }; + }, + created() { + + }, + methods: { + openDialog(data){ + this.dataList = data.cmStaffTrains + this.id = data.id + this.open = true + }, + openEdit(data,type){ + this.dialogVisible = true + if(type == 'add'){ + this.title='新增经历' + this.form = { + id: null, + staffId: this.id, + timeRange: [], + startTime: '', + endTime: '', + batch: '', + subject: '', + unit: '' + } + }else { + this.title='编辑经历' + for(let i in data){ + if(this.isKey(i,this.form)){ + this.form[i] = data[i] + } + } + this.form.timeRange[0] = data.startTime + this.form.timeRange[1] = data.endTime + } + }, + isKey(key,obj){ + return key in obj + }, + handleDelete(row,index){ + this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + const res = await delTrain(row.id) + if(res.code == 200){ + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => { + + }); + }, + changeTime(value){ + this.form.startTime = this.form.timeRange[0] + this.form.endTime = this.form.timeRange[1] + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + if(this.title == '新增经历'){ + const {id,timeRange,...data} = this.form + const res= await addTrain(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + const {timeRange,...data} = this.form + const res= await editTrain(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.dialogVisible = false + this.open = false + this.$emit('closeDialog') + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + getList(){ + + }, + handleChange(){ + + }, + handleQuery(){ + + }, + resetQuery(){ + + }, + } +}; +</script> + +<style scoped lang="scss"> +.home {} +</style> + diff --git a/src/views/coalMine/cPeopleManage/index.vue b/src/views/coalMine/cPeopleManage/index.vue index b80b393..9071ba1 100644 --- a/src/views/coalMine/cPeopleManage/index.vue +++ b/src/views/coalMine/cPeopleManage/index.vue @@ -3,7 +3,7 @@ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="用户姓名" prop="userName"> <el-input - v-model="queryParams.userName" + v-model="queryParams.name" placeholder="请输入用户姓名" clearable @keyup.enter.native="handleQuery" @@ -11,18 +11,11 @@ </el-form-item> <el-form-item label="身份证号" prop="idCard"> <el-input - v-model="queryParams.idCard" + v-model="queryParams.code" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery" /> - </el-form-item> - <el-form-item label="作业类型"> - <el-cascader - v-model="classiFy" - :options="expertTypes" - :props="{ expandTrigger: 'hover', value: 'id',label: 'label'}" - @change="handleChange"></el-cascader> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> @@ -37,104 +30,198 @@ plain icon="el-icon-plus" size="mini" - @click="handleAdd" + @click="openPeople({},'add')" v-hasPermi="['system:experts:add']" >新增</el-button> </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getPage"></right-toolbar> </el-row> - <el-table v-loading="loading" :data="expertList"> + <el-table v-loading="loading" :data="dataList"> <el-table-column type="index" label="序号" width="55" align="center" /> <el-table-column label="姓名" align="center" prop="name" /> - <el-table-column label="性别" align="center" prop="name" /> - <el-table-column label="身份证号" align="center" prop="name" /> - <el-table-column label="电话" align="center" prop="phone"/> - <el-table-column label="民族" align="center" prop="phone"/> - <el-table-column label="所属单位" align="center" prop="phone"/> - <el-table-column label="最高学历" align="center" prop="degree" /> - <el-table-column label="资格类型" align="center" prop="job" /> - <el-table-column label="作业证书" align="center" prop="speciality" /> - <el-table-column label="关联作业次数" align="center"/> - <el-table-column label="违章次数" align="center"/> - <el-table-column label="证件照片" align="center"/> - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <el-table-column label="性别" align="center" prop="sex"> <template #default="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - >编辑</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-view" - @click="handleView(scope.row)" - >查看</el-button> -<!-- <el-button--> -<!-- size="mini"--> -<!-- type="text"--> -<!-- icon="el-icon-delete"--> -<!-- @click="handleDelete(scope.row)"--> -<!-- v-hasPermi="['system:experts:remove']"--> -<!-- >删除</el-button>--> + {{ scope.row.sex == 0?'男':'女' }} + </template> + </el-table-column> + <el-table-column label="身份证号" align="center" prop="code" /> + <el-table-column label="电话" align="center" prop="mobilePhone"/> + <el-table-column label="民族" align="center" prop="nationCode"> + <template #default="scope"> + {{getNationName(scope.row.nationCode)}} + </template> + </el-table-column> + <el-table-column label="最高学历" align="center" prop="eduLevel"/> + <el-table-column label="证件照片" align="center" prop="photoPath"> + <template #default="scope"> + <el-button type="text" @click="viewFile(scope.row.photoAttachment)">预览</el-button> + </template> + </el-table-column> + <el-table-column label="个人履历" align="center"> + <template #default="scope"> + <el-button type="text" @click="openExperience(scope.row)">管理<span v-if="scope.row.cmStaffResumes && scope.row.cmStaffResumes.length>0">({{scope.row.cmStaffResumes.length}})</span></el-button> + </template> + </el-table-column> + <el-table-column label="资格证书" align="center"> + <template #default="scope"> + <el-button type="text" @click="openCert(scope.row)">管理<span v-if="scope.row.cmStaffQas && scope.row.cmStaffQas.length>0">({{scope.row.cmStaffQas.length}})</span></el-button> + </template> + </el-table-column> + <el-table-column label="培训经历" align="center"> + <template #default="scope"> + <el-button type="text" @click="openTrain(scope.row)">管理<span v-if="scope.row.cmStaffTrains && scope.row.cmStaffTrains.length>0">({{scope.row.cmStaffTrains.length}})</span></el-button> + </template> + </el-table-column> + <el-table-column label="考试经历" align="center"> + <template #default="scope"> + <el-button type="text" @click="openExam(scope.row)">管理<span v-if="scope.row.cmStaffExams && scope.row.cmStaffExams.length>0">({{scope.row.cmStaffExams.length}})</span></el-button> + </template> + </el-table-column> + <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button size="mini" type="text" icon="el-icon-edit" @click="openPeople(scope.row,'edit')">编辑</el-button> + <el-button size="mini" type="text" icon="el-icon-view" @click="openPeople(scope.row,'view')">查看</el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:experts:remove']">删除</el-button> +<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="openExperience(scope.row)">个人履历</el-button>--> +<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="openCert(scope.row)">资格证书</el-button>--> +<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="openTrain(scope.row)">培训经历</el-button>--> </template> </el-table-column> </el-table> <pagination v-show="total>0" :total="total" - :page.sync="queryParams.pageIndex" + :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" - @pagination="getList" + @pagination="getPage" /> + <peopleDialog ref="peopleDialog" @closeDialog="resetQuery"></peopleDialog> + <experienceDialog ref="experienceDialog" @closeDialog="resetQuery"></experienceDialog> + <certDialog ref="certDialog" @closeDialog="resetQuery"></certDialog> + <trainDialog ref="trainDialog" @closeDialog="resetQuery"></trainDialog> + <examDialog ref="examDialog" @closeDialog="resetQuery"></examDialog> </div> </template> <script> +import peopleDialog from "@/views/coalMine/cPeopleManage/components/peopleDialog"; +import experienceDialog from "@/views/coalMine/cPeopleManage/components/experienceDialog"; +import certDialog from "@/views/coalMine/cPeopleManage/components/certDialog" +import trainDialog from "@/views/coalMine/cPeopleManage/components/trainDialog" +import examDialog from "@/views/coalMine/cPeopleManage/components/examDialog" +import { getPeoplePage,delPeople } from "@/api/coalMine/people"; +import axios from "axios"; +import { getToken } from "@/utils/auth"; export default { name: "cPeopleManage", - dicts: [], - components: {}, + dicts: ['sys_nation_code'], + components: { peopleDialog, experienceDialog, certDialog, trainDialog, examDialog }, data() { return { loading: false, - single: true, - multiple: true, showSearch: true, - addForm: false, total: 0, - expertTypes: [], - expertList: [], - queryParams: {}, - classiFy: [], - form: {}, - rules: { - classifyName: [ - { required: true, message: "分类名称不能为空", trigger: "blur" } - ] - } + dataList: [], + queryParams: { + code: '', + name: '', + pageNum: 1, + pageSize: 10 + }, }; }, created() { - + const t = this + t.getPage() }, methods: { - getList(){ - + async getPage(){ + const t = this + t.loading = true + const res = await getPeoplePage(t.queryParams) + if(res.code == 200){ + t.dataList = res.rows + t.total = res.total + }else{ + t.$message({ + message: res.msg, + type: 'warning' + }) + } + t.loading = false }, - handleChange(){ + getNationName(code){ + let obj = JSON.parse(JSON.stringify(this.dict.type.sys_nation_code)).find(i=>i.value == code) + if(obj){ + return obj.label + }else{ + return '无' + } + }, + openPeople(data,type){ + this.$refs.peopleDialog.openDialog(data,type) + }, + openExperience(data){ + this.$refs.experienceDialog.openDialog(data) + }, + openCert(data){ + this.$refs.certDialog.openDialog(data) + }, + openTrain(data){ + this.$refs.trainDialog.openDialog(data) + }, + openExam(data){ + this.$refs.examDialog.openDialog(data) + }, + + handleDelete(row){ + this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + const res = await delPeople(row.id) + if(res.code == 200){ + this.$message({ + type: 'success', + message: '删除成功!' + }); + await this.getPage() + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => { + + }); }, handleQuery(){ - + this.queryParams.pageNum = 1 + this.getPage() }, resetQuery(){ - + this.$refs['queryForm'].resetFields() + this.getPage() }, handleAdd(){ - } + }, + viewFile(file){ + axios.get(process.env.VUE_APP_BASE_API + file.fileUrl,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob'}).then(res=>{ + if (res) { + const link = document.createElement('a') + let blob = new Blob([res.data],{type: res.data.type}) + link.style.display = "none"; + link.href = URL.createObjectURL(blob); // 创建URL + window.open(link.href) + } else { + this.$message.error('获取文件失败') + } + }) + }, } }; </script> diff --git a/src/views/login.vue b/src/views/login.vue index d2cec1d..93ae70d 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,7 +1,7 @@ <template> <div class="login"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> - <h3 class="title">新疆维吾尔自治区特种作业安全生产知识和管理能力考核系统</h3> + <h3 class="title">新疆维吾尔自治区特种作业<br/>安全生产知识和管理能力考核系统</h3> <el-form-item prop="username"> <el-input v-model="loginForm.username" @@ -56,7 +56,7 @@ </el-form> <!-- 底部 --> <div class="el-login-footer"> - <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span> + <span>技术支持:中国科学院</span> </div> </div> </template> @@ -119,8 +119,8 @@ }); }, getCookie() { - const username = Cookies.get("username"); - const password = Cookies.get("password"); + const username = Cookies.get("username") + const password = Cookies.get("password") const rememberMe = Cookies.get('rememberMe') this.loginForm = { username: username === undefined ? this.loginForm.username : username, @@ -162,13 +162,14 @@ justify-content: center; align-items: center; height: 100%; - background-image: url("../assets/images/login-background.jpg"); + background: url("../assets/images/login-background.jpg") no-repeat center; background-size: cover; } .title { - margin: 0px auto 30px auto; + margin: 0 auto 30px; text-align: center; color: #707070; + line-height: 28px; } .login-form { diff --git a/src/views/notCoalMine/nPeopleManage/components/experienceDialog.vue b/src/views/notCoalMine/nPeopleManage/components/experienceDialog.vue new file mode 100644 index 0000000..e88e0b8 --- /dev/null +++ b/src/views/notCoalMine/nPeopleManage/components/experienceDialog.vue @@ -0,0 +1,128 @@ +<template> + <el-dialog title="个人履历" :visible.sync="open" width="50%" append-to-body> + <div class="app-container home"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="openDialog({},'add')" + v-hasPermi="['system:experts:add']" + >新增</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + <el-table v-loading="loading" :data="expertList"> + <el-table-column type="index" label="序号" width="55" align="center" /> + <el-table-column label="姓名" align="center" prop="name" /> + <el-table-column label="性别" align="center" prop="name" /> + <el-table-column label="身份证号" align="center" prop="name" /> + <el-table-column label="电话" align="center" prop="phone"/> + <el-table-column label="民族" align="center" prop="phone"/> + <el-table-column label="所属单位" align="center" prop="phone"/> + <el-table-column label="最高学历" align="center" prop="degree" /> + <el-table-column label="资格类型" align="center" prop="job" /> + <el-table-column label="作业证书" align="center" prop="speciality" /> + <el-table-column label="关联作业次数" align="center"/> + <el-table-column label="违章次数" align="center"/> + <el-table-column label="证件照片" align="center"/> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openDialog(scope.row,'edit')" + >编辑</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-view" + @click="openDialog(scope.row,'view')" + >查看</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openExperience(scope.row)" + >个人履历</el-button> + </template> + </el-table-column> + </el-table> + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageIndex" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + </div> + </el-dialog> +</template> + +<script> +// import {getExpertTypes,addExpertInfo,uploadFile} from '@/api/system/form' +// import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +import peopleDialog from "@/views/coalMine/cPeopleManage/components/peopleDialog"; + +export default { + name: "experienceDialog", + dicts: [], + components: { peopleDialog }, + data() { + return { + open: false, + loading: false, + single: true, + multiple: true, + showSearch: true, + addForm: false, + total: 0, + expertTypes: [], + expertList: [], + queryParams: {}, + classiFy: [], + form: {}, + rules: { + classifyName: [ + { required: true, message: "分类名称不能为空", trigger: "blur" } + ] + } + }; + }, + created() { + + }, + methods: { + openDialog(data){ + this.open = true + }, + getList(){ + + }, + handleChange(){ + + }, + handleQuery(){ + + }, + resetQuery(){ + + }, + } +}; +</script> + +<style scoped lang="scss"> +.home {} +</style> + diff --git a/src/views/notCoalMine/nPeopleManage/components/peopleDialog.vue b/src/views/notCoalMine/nPeopleManage/components/peopleDialog.vue new file mode 100644 index 0000000..b780a00 --- /dev/null +++ b/src/views/notCoalMine/nPeopleManage/components/peopleDialog.vue @@ -0,0 +1,451 @@ +<template> + <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body> + <div class="main_form"> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px" :label-position="labelPosition"> + <el-row> + <el-col :span="20"> + <el-form-item label="姓名" prop="name"> + <el-input v-model="form.name" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="性别" prop="sex"> + <el-radio-group v-model="form.sex" :disabled="disable"> + <el-radio :label="0">男</el-radio> + <el-radio :label="1">女</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="身份证号" prop="idCardNum"> + <el-input v-model="form.idCardNum" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="民族" prop="nationCode"> + <el-select v-model="form.nationCode" :disabled="disable" placeholder="请选择" style="width: 100%"> + <el-option + v-for="dict in dict.type.sys_nation_code" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="联系电话" prop="phone"> + <el-input v-model="form.phone" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="最高学历" prop="highestEducation"> + <el-input v-model="form.highestEducation" :readonly="disable"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="证件照" prop="photoPath"> + <el-upload + action="" + :auto-upload="false" + :limit="1" + accept="image/*,.pdf" + :file-list="fileList" + list-type="picture-card" + :before-upload="beforeAvatarUpload" + :on-change="avatorChange" + :on-preview="handlePreview" + :on-exceed="overLimit" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + </el-form-item> + </el-col> + </el-row> + <template v-if="title == '查看人员'"> + <el-row v-if="form.violationList && form.violationList.length>0"> + <el-col :span="20"> + <el-form-item label="违章记录"> + <el-table :data="form.violationList"> + <el-table-column label="时间" align="center"> + <template #default="scope"> + {{scope.row.startTime + '--' + scope.row.endTime}} + </template> + </el-table-column> + <el-table-column label="单位" align="center" prop="unit"/> + </el-table> + </el-form-item> + </el-col> + </el-row> + <el-row v-if="form.resumeList && form.resumeList.length>0"> + <el-col :span="20"> + <el-form-item label="个人履历"> + <el-table :data="form.resumeList"> + <el-table-column label="时间" align="center"> + <template #default="scope"> + {{scope.row.startTime + '--' + scope.row.endTime}} + </template> + </el-table-column> + <el-table-column label="单位" align="center" prop="unit"/> + </el-table> + </el-form-item> + </el-col> + </el-row> + <el-row v-if="form.trainList && form.trainList.length>0"> + <el-col :span="20"> + <el-form-item label="培训经历"> + <el-table :data="form.trainList"> + <el-table-column label="培训时间" align="center"> + <template #default="scope"> + {{scope.row.startTime + '--' + scope.row.endTime}} + </template> + </el-table-column> + <el-table-column label="培训单位" align="center" prop="trainInstitutionName"/> + <el-table-column label="所属批次" align="center" prop="planId"/> + <el-table-column label="科目" align="center" prop="subject"/> + </el-table> + </el-form-item> + </el-col> + </el-row> + <el-row v-if="form.examineeList && form.examineeList.length>0"> + <el-col :span="20"> + <el-form-item label="考试经历"> + <el-table :data="form.examineeList"> + <el-table-column label="考试时间" align="center"> + <template #default="scope"> + {{scope.row.startTime + '--' + scope.row.endTime}} + </template> + </el-table-column> + <el-table-column label="考试中心" align="center" prop="trainInstitutionName"/> + <el-table-column label="科目" align="center" prop="subject"/> + <el-table-column label="考试结果" align="center" prop="trainInstitutionName"/> + </el-table> + </el-form-item> + </el-col> + </el-row> + </template> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button v-if="title == '查看人员'" type="primary" @click="open = false">确认</el-button> + <el-button v-else type="primary" @click="submit()">提交</el-button> + </div> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="dialogImageUrl" alt=""> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> +// import {getExpertTypes,addExpertInfo,uploadFile} from '@/api/system/form' +// import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +export default { + name: "peopleDialog", + dicts: ['sys_nation_code'], + data() { + var validatePass = (rule, value, callback) => { + if (this.fileList.length == 0) { + callback(new Error('请上传证件照')); + } else { + callback(); + } + } + let validatePhone = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入手机号')) + }else{ + if(!verifySimplePhone(value)){ + callback(new Error('手机号格式有误')) + }else{ + callback() + } + } + } + let verifyId = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入身份证号')) + }else{ + if(!verifyIdCard(value)){ + callback(new Error('身份证号格式有误')) + }else{ + callback() + } + } + } + return { + labelPosition: 'right', + title: '新增人员', + disable: false, + open: false, + form:{ + name: '', + sex: null, + idCardNum: '', + nationCode: null, + phone: '', + highestEducation: '', + photoPath: '' + }, + fileList: [], + dialogImageUrl: '', + dialogVisible: false, + rules:{ + name:[{ required: true, message: '请填写姓名', trigger: 'blur' }], + sex:[{ required: true, message: '请选择性别', trigger: 'blur' }], + idCard: [{ required: true, validator: verifyId, trigger: 'blur' }], + race: [{ required: true, message: '请选择民族', trigger: 'blur' }], + phone:[{ required: true, validator: validatePhone, trigger: 'blur' }], + degree: [{ required: true, message: '请填写最高学历', trigger: 'blur' }], + photoPath: [{ required: true,validator: validatePass, trigger: 'blur' }] + }, + }; + }, + created() { + const t = this + const width = document.documentElement.clientWidth + if(width < 750){t.labelPosition = 'top'} + }, + methods: { + openDialog(val,type){ + const width = document.documentElement.clientWidth + if(width < 750){this.labelPosition = 'top'} + if(type == 'add'){ + this.title = '新增人员' + this.disable = false + }else{ + if(type == 'edit'){ + this.title = '编辑人员' + this.disable = false + }else{ + this.title = '查看人员' + this.disable = true + } + this.form = val + // if(val){ + // for(let i in val){ + // if(this.isValidKey(i,this.form)){ + // this.form[i] = val[i] + // } + // } + // } + } + this.open = true + }, + isValidKey(key,obj){ + return key in obj + }, + + async getExpertsType(){ + const res = await getExpertTypes() + if(res.code == 200){ + this.expertsType = res.data + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }, + avatorChange(file, fileList) { + this.fileList = fileList; + }, + overLimit(){ + this.$message({ + type: 'warning', + message: '超出文件上传数量' + }); + }, + handlePreview(file) { + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, + beforeAvatarUpload(file) { + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + this.$message.error('上传头像图片大小不能超过 5MB!'); + } + return isLt5M; + }, + async submitUpload() { + const t = this; + // 创建一个数组来存储所有上传操作的 Promise + const uploadPromises = []; + // 定义一个函数来上传文件并将结果存入 resumeLink 数组 + async function uploadAndCollect(fileList, type) { + if (fileList.length > 0) { + const resumeLink = []; + for (const file of fileList) { + const formData = new FormData(); + formData.append("file", file.raw); + formData.append("module", 'expertPath'); + + const res = await uploadFile(formData); + if (res.code === 200) { + resumeLink.push(res.data[0].fileKey); + } else { + this.$message.error('图片上传出错!'); + } + } + // 将收集到的文件链接设置到 this.form 中 + if (type == '证件照') { t.form.photoPath = resumeLink.join(',')} + return resumeLink; + } + return []; + } + // 依次执行上传操作并等待完成 + uploadPromises.push(uploadAndCollect(t.fileList, '证件照')); + // 等待所有上传操作完成 + await Promise.all(uploadPromises); + // 打印已更新的 this.form + console.log(t.form, 'form1'); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + async submit(){ + if(this.form.supportDirectionSafety.length == 0 && this.form.supportDirectionPrevention.length == 0 && this.form.supportDirectionEmergency.length == 0){ + this.$message({ + type:'warning', + message: '请至少选择一种支撑方向' + }) + return + } + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + await this.submitUpload() + let data = this.form + data.supportDirectionSafety = data.supportDirectionSafety.join(',') + data.supportDirectionPrevention = data.supportDirectionPrevention.join(',') + data.supportDirectionEmergency = data.supportDirectionEmergency.join(',') + data.bigClassify = data.profession[0] + data.smallClassify = data.profession[1] + delete data.profession + const res= await addExpertInfo(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.$emit('closeDialog') + this.$refs.ruleForm.resetFields() + this.fileList = [] + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + changeSource(num){ + this.form.source = num + } + } +}; +</script> + +<style scoped lang="scss"> +.home { + blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; + } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + } + .col-item { + margin-bottom: 20px; + } + + ul { + padding: 0; + margin: 0; + } + + font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + color: #676a6c; + overflow-x: hidden; + + ul { + list-style-type: none; + } + + h4 { + margin-top: 0px; + } + + h2 { + margin-top: 10px; + font-size: 26px; + font-weight: 100; + } + + p { + margin-top: 10px; + + b { + font-weight: 700; + } + } + + .update-log { + ol { + display: block; + list-style-type: decimal; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0; + margin-inline-end: 0; + padding-inline-start: 40px; + } + } +} +.avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; +} +.avatar-uploader .el-upload:hover { + border-color: #409EFF; +} +.avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; +} +.avatar { + width: 178px; + height: 178px; + display: block; +} +</style> + diff --git a/src/views/notCoalMine/nPeopleManage/index.vue b/src/views/notCoalMine/nPeopleManage/index.vue index 5fff864..0ff7c4b 100644 --- a/src/views/notCoalMine/nPeopleManage/index.vue +++ b/src/views/notCoalMine/nPeopleManage/index.vue @@ -3,7 +3,7 @@ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="用户姓名" prop="userName"> <el-input - v-model="queryParams.userName" + v-model="queryParams.name" placeholder="请输入用户姓名" clearable @keyup.enter.native="handleQuery" @@ -11,18 +11,11 @@ </el-form-item> <el-form-item label="身份证号" prop="idCard"> <el-input - v-model="queryParams.idCard" + v-model="queryParams.idCardNum" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery" /> - </el-form-item> - <el-form-item label="作业类型"> - <el-cascader - v-model="classiFy" - :options="expertTypes" - :props="{ expandTrigger: 'hover', value: 'id',label: 'label'}" - @change="handleChange"></el-cascader> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> @@ -37,103 +30,155 @@ plain icon="el-icon-refresh" size="mini" - @click="handleAdd" + @click="resetQuery" v-hasPermi="['system:experts:add']" >同步数据</el-button> </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getPage"></right-toolbar> </el-row> - <el-table v-loading="loading" :data="expertList"> + <el-table v-loading="loading" :data="dataList"> <el-table-column type="index" label="序号" width="55" align="center" /> <el-table-column label="姓名" align="center" prop="name" /> - <el-table-column label="性别" align="center" prop="name" /> - <el-table-column label="身份证号" align="center" prop="name" /> + <el-table-column label="性别" align="center" prop="sex"> + <template #default="scope"> + {{ scope.row.sex == 0?'男':'女' }} + </template> + </el-table-column> + <el-table-column label="身份证号" align="center" prop="idCardNum" /> <el-table-column label="电话" align="center" prop="phone"/> - <el-table-column label="民族" align="center" prop="phone"/> - <el-table-column label="所属单位" align="center" prop="phone"/> - <el-table-column label="最高学历" align="center" prop="degree" /> - <el-table-column label="资格类型" align="center" prop="job" /> - <el-table-column label="作业证书" align="center" prop="speciality" /> - <el-table-column label="关联作业次数" align="center"/> - <el-table-column label="违章次数" align="center"/> - <el-table-column label="证件照片" align="center"/> + <el-table-column label="民族" align="center" prop="nationCode"> + <template #default="scope"> + {{getNationName(scope.row.nationCode)}} + </template> + </el-table-column> + <el-table-column label="所属单位" align="center" prop="resumeList"> + <template #default="scope"> + {{ scope.row.resumeList.map(i=>i.unit).join(',') }} + </template> + </el-table-column> + <el-table-column label="最高学历" align="center" prop="highestEducation"/> + <el-table-column label="作业证书" align="center" prop="certCount"> + <template #default="scope"> + <el-button v-if="scope.row.certCount>0" type="text">{{ scope.row.certCount }}</el-button> + <span v-else>{{scope.row.certCount}}</span> + </template> + </el-table-column> + <el-table-column label="关联作业次数" align="center" prop="workCount"/> + <el-table-column label="违章次数" align="center" prop="violationCount"/> + <el-table-column label="证件照片" align="center" prop="photoPath"> + <template #default="scope"> + <el-button type="text" @click="viewFile(scope.row.photoPath)">预览</el-button> + </template> + </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <template #default="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - >编辑</el-button> +<!-- <el-button--> +<!-- size="mini"--> +<!-- type="text"--> +<!-- icon="el-icon-edit"--> +<!-- @click="openPeople(scope.row,'edit')"--> +<!-- >编辑</el-button>--> <el-button size="mini" type="text" icon="el-icon-view" - @click="handleView(scope.row)" + @click="openPeople(scope.row,'view')" >查看</el-button> -<!-- <el-button--> -<!-- size="mini"--> -<!-- type="text"--> -<!-- icon="el-icon-delete"--> -<!-- @click="handleDelete(scope.row)"--> -<!-- v-hasPermi="['system:experts:remove']"--> -<!-- >删除</el-button>--> </template> </el-table-column> </el-table> <pagination v-show="total>0" :total="total" - :page.sync="queryParams.pageIndex" + :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" - @pagination="getList" + @pagination="getPage" /> + <peopleDialog ref="peopleDialog"></peopleDialog> </div> </template> <script> +import { getPeoplePage } from "@/api/notCoalMine/people"; +import peopleDialog from "./components/peopleDialog"; +import axios from "axios"; +import {getToken} from "@/utils/auth"; + export default { name: "nPeopleManage", - dicts: [], - components: {}, + dicts: ['sys_nation_code'], + components: { peopleDialog }, data() { return { loading: false, - single: true, - multiple: true, showSearch: true, - addForm: false, total: 0, - expertTypes: [], - expertList: [], - queryParams: {}, - classiFy: [], - form: {}, - rules: { - classifyName: [ - { required: true, message: "分类名称不能为空", trigger: "blur" } - ] + dataList: [], + queryParams: { + idCardNum: '', + name: '', + pageNum: 1, + pageSize: 10 } }; }, created() { - + const t = this + t.getPage() }, methods: { - getList(){ - + async getPage(){ + const t = this + t.loading = true + const res = await getPeoplePage(t.queryParams) + if(res.code == 200){ + t.dataList = res.rows + t.total = res.total + }else{ + t.$message({ + message: res.msg, + type: 'warning' + }) + } + t.loading = false + }, + getNationName(code){ + let obj = JSON.parse(JSON.stringify(this.dict.type.sys_nation_code)).find(i=>i.value == code) + if(obj){ + return obj.label + }else{ + return '无' + } + }, + openPeople(data,type){ + this.$refs.peopleDialog.openDialog(data,type) }, handleChange(){ }, handleQuery(){ - + this.queryParams.pageNum = 1 + this.getPage() }, resetQuery(){ - + this.$refs['queryForm'].resetFields() + this.getPage() }, handleAdd(){ + }, + viewFile(file){ + axios.get(process.env.VUE_APP_BASE_API + file,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob'}).then(res=>{ + if (res) { + const link = document.createElement('a') + let blob = new Blob([res.data],{type: res.data.type}) + link.style.display = "none"; + link.href = URL.createObjectURL(blob); // 创建URL + window.open(link.href) + } else { + this.$message.error('获取文件失败') + } + }) } } }; diff --git a/src/views/notCoalMine/nPlaceManage/nExamManage/index.vue b/src/views/notCoalMine/nPlaceManage/nExamManage/index.vue index 08d196d..9df966b 100644 --- a/src/views/notCoalMine/nPlaceManage/nExamManage/index.vue +++ b/src/views/notCoalMine/nPlaceManage/nExamManage/index.vue @@ -5,7 +5,7 @@ <el-button type="primary" plain - icon="el-icon-refresh" + icon="el-icon-plus" size="mini" @click="handleAdd('add')" v-hasPermi="['system:experts:add']" diff --git a/src/views/notCoalMine/nPlaceManage/nTrainManage/index.vue b/src/views/notCoalMine/nPlaceManage/nTrainManage/index.vue index 0c9ca7b..43c3b51 100644 --- a/src/views/notCoalMine/nPlaceManage/nTrainManage/index.vue +++ b/src/views/notCoalMine/nPlaceManage/nTrainManage/index.vue @@ -5,7 +5,7 @@ <el-button type="primary" plain - icon="el-icon-refresh" + icon="el-icon-plus" size="mini" @click="handleAdd('add')" v-hasPermi="['system:experts:add']" diff --git a/src/views/notCoalMine/nTeacherManage/nTeacher/components/teacherDialog.vue b/src/views/notCoalMine/nTeacherManage/nTeacher/components/teacherDialog.vue new file mode 100644 index 0000000..a17417d --- /dev/null +++ b/src/views/notCoalMine/nTeacherManage/nTeacher/components/teacherDialog.vue @@ -0,0 +1,486 @@ +<template> + <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body> + <div class="main_form"> + <el-form :model="form" :rules="rules" ref="ruleForm" label-width="200px" :label-position="labelPosition"> + <el-row> + <el-col :span="20"> + <el-form-item label="姓名" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="性别" prop="sex"> + <el-radio-group v-model="form.sex"> + <el-radio :label="0">男</el-radio> + <el-radio :label="1">女</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="身份证号" prop="idCard"> + <el-input v-model="form.idCard"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="联系电话" prop="phone"> + <el-input v-model="form.phone"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="职称" prop="title"> + <el-input v-model="form.title"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="最高学历" prop="degree"> + <el-input v-model="form.degree"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="资质到期" prop="birthday"> + <el-date-picker + style="width: 100%" + v-model="form.birthday" + value-format="yyyy-MM-dd" + type="date" + placeholder="选择日期"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="在职情况" prop="dutyStatus"> + <el-radio-group v-model="form.dutyStatus"> + <el-radio :label="0">在岗</el-radio> + <el-radio :label="1">退休</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="描述"> + <el-input v-model="form.remark" type="textarea" :autosize="{ minRows: 2}"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="证件照"> + <el-upload + action="#" + multiple + :limit="20" + :on-exceed="overLimit" + :auto-upload="false" + accept="image/*,.pdf" + :file-list="resumeList" + list-type="picture-card" + :before-upload="beforeAvatarUpload" + :on-change="resumeChange" + :on-preview="handlePreview" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-form-item label="资质"> + <el-upload + action="" + multiple + :limit="20" + :on-exceed="overLimit" + :auto-upload="false" + accept="image/*,.pdf" + list-type="picture-card" + :file-list="inventionList" + :before-upload="beforeAvatarUpload" + :on-change="inventChange" + :on-preview="handlePreview" + :on-remove="handleRemove"> + <i class="el-icon-plus"></i> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="width: 100%;padding-bottom: 30px;display: flex;justify-content: center"> + <el-button type="primary" @click="submit()">提交</el-button> + </div> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="dialogImageUrl" alt=""> + </el-dialog> + </div> + </el-dialog> +</template> + +<script> +// import {getExpertTypes,addExpertInfo,uploadFile} from '@/api/system/form' +import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +export default { + name: "teacherDialog", + data() { + var validatePass = (rule, value, callback) => { + if (this.fileList.length == 0) { + callback(new Error('请上传证件照')); + } else { + callback(); + } + } + let validatePhone = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入手机号')) + }else{ + if(!verifySimplePhone(value)){ + callback(new Error('手机号格式有误')) + }else{ + callback() + } + } + } + let verifyId = (rule, value, callback)=>{ + if(value === ''){ + callback(new Error('请输入身份证号')) + }else{ + if(!verifyIdCard(value)){ + callback(new Error('身份证号格式有误')) + }else{ + callback() + } + } + } + return { + title: '新增教师', + open: false, + labelPosition: 'right', + form:{ + name:'', + sex:'', + profession: [], + bigClassify:null, + smallClassify: null, + birthday: '', + phone:'', + title: '', + idCard: '', + dutyStatus: null, + companyName: '', + companyAddress: '', + deptName: '', + job: '', + companyTelephone: '', + faxNum: '', + email: '', + graduationSchool: '', + degree: '', + speciality: '', + currentProfession: '', + supportDirectionSafety: [], + supportDirectionPrevention: [], + supportDirectionEmergency: [], + resumeKey: '', + paperSituationKey: '', + remark: '', + }, + expertsType: [], + directionList: [ + { + value: 1, + label: '现场检查' + }, + { + value: 2, + label: '调查评估' + }, + { + value: 3, + label: '咨询服务' + }, + { + value: 4, + label: '教育培训' + }, + { + value: 5, + label: '其他' + } + ], + resumeList: [], + inventionList: [], + dialogImageUrl: '', + dialogVisible: false, + rules:{ + name:[{ required: true, message: '请填写姓名', trigger: 'blur' }], + sex:[{ required: true, message: '请选择性别', trigger: 'blur' }], + profession: [{ required: true, message: '请选择专业类别', trigger: 'blur' }], + birthday: [{ required: true, message: '请选择出生日期', trigger: 'blur' }], + phone:[{ required: true, validator: validatePhone, trigger: 'blur' }], + title: [{ required: true, message: '请填写职称', trigger: 'blur' }], + electronicPhoto: [{ required: true,validator: validatePass, trigger: 'blur' }], + idCard: [{ required: true, validator: verifyId, trigger: 'blur' }], + dutyStatus: [{ required: true, message: '请选择在岗情况', trigger: 'blur' }], + companyName: [{ required: true, message: '请填写单位全称', trigger: 'blur' }], + degree: [{ required: true, message: '请填写最高学历', trigger: 'blur' }] + }, + }; + }, + created() { + const t = this + const width = document.documentElement.clientWidth + if(width < 750){t.labelPosition = 'top'} + }, + methods: { + openDialog(val,type){ + const width = document.documentElement.clientWidth + if(width < 750){this.labelPosition = 'top'} + if(type == 'add'){ + this.title = '新增教师' + }else{ + if(type == 'edit'){ + this.title = '编辑教师' + }else{ + this.title = '查看教师' + } + if(val){ + for(let i in val){ + if(this.isValidKey(i,this.form)){ + this.form[i] = val[i] + } + } + } + } + this.open = true + }, + isValidKey(key,obj){ + return key in obj + }, + + + async getExpertsType(){ + const res = await getExpertTypes() + if(res.code == 200){ + this.expertsType = res.data + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }, + + avatorChange(file, fileList) { + this.fileList = fileList; + }, + resumeChange(file, fileList) { + this.resumeList = fileList; + }, + inventChange(file, fileList){ + this.inventionList = fileList; + }, + overLimit(){ + this.$message({ + type: 'warning', + message: '超出文件上传数量' + }); + }, + handlePreview(file) { + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, + beforeAvatarUpload(file) { + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + this.$message.error('上传头像图片大小不能超过 5MB!'); + } + return isLt5M; + }, + async submitUpload() { + const t = this; + // 创建一个数组来存储所有上传操作的 Promise + const uploadPromises = []; + // 定义一个函数来上传文件并将结果存入 resumeLink 数组 + async function uploadAndCollect(fileList, type) { + if (fileList.length > 0) { + const resumeLink = []; + for (const file of fileList) { + const formData = new FormData(); + formData.append("file", file.raw); + formData.append("module", 'expertPath'); + + const res = await uploadFile(formData); + if (res.code === 200) { + resumeLink.push(res.data[0].fileKey); + } else { + this.$message.error('图片上传出错!'); + } + } + // 将收集到的文件链接设置到 this.form 中 + if (type == '工作简历') { t.form.resumeKey = resumeLink.join(',')} + if (type == '发明著作') { t.form.paperSituationKey = resumeLink.join(',')} + return resumeLink; + } + return []; + } + // 依次执行上传操作并等待完成 + uploadPromises.push(uploadAndCollect(t.resumeList, '工作简历')); + uploadPromises.push(uploadAndCollect(t.inventionList,'发明著作')); + // 等待所有上传操作完成 + await Promise.all(uploadPromises); + // 打印已更新的 this.form + console.log(t.form, 'form1'); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + async submit(){ + this.$refs["ruleForm"].validate(async(valid) =>{ + if(valid) { + await this.submitUpload() + let data = this.form + data.supportDirectionSafety = data.supportDirectionSafety.join(',') + data.supportDirectionPrevention = data.supportDirectionPrevention.join(',') + data.supportDirectionEmergency = data.supportDirectionEmergency.join(',') + data.bigClassify = data.profession[0] + data.smallClassify = data.profession[1] + delete data.profession + const res= await addExpertInfo(data) + if(res.code == 200){ + this.$message({ + type:'success', + message: res.msg + }) + this.$emit('closeDialog') + this.$refs.ruleForm.resetFields() + this.resumeList = [] + this.inventionList = [] + }else{ + this.$message({ + type:'warning', + message: res.msg + }) + } + }else{ + this.$message({ + type:'warning', + message:'请完善必填信息' + }) + } + }) + }, + changeSource(num){ + this.form.source = num + } + } +}; +</script> + +<style scoped lang="scss"> +.home { + .main-title{ + font-size: 24px; + font-weight: bolder; + text-align: center; + margin-bottom: 20px; + color: #333; + } + blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; + } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + } + .col-item { + margin-bottom: 20px; + } + + ul { + padding: 0; + margin: 0; + } + + font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + color: #676a6c; + overflow-x: hidden; + + ul { + list-style-type: none; + } + + h4 { + margin-top: 0px; + } + + h2 { + margin-top: 10px; + font-size: 26px; + font-weight: 100; + } + + p { + margin-top: 10px; + + b { + font-weight: 700; + } + } + + .update-log { + ol { + display: block; + list-style-type: decimal; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0; + margin-inline-end: 0; + padding-inline-start: 40px; + } + } +} +.avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; +} +.avatar-uploader .el-upload:hover { + border-color: #409EFF; +} +.avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; +} +.avatar { + width: 178px; + height: 178px; + display: block; +} +</style> + diff --git a/src/views/notCoalMine/nTeacherManage/nTeacher/index.vue b/src/views/notCoalMine/nTeacherManage/nTeacher/index.vue index ec5a418..c528663 100644 --- a/src/views/notCoalMine/nTeacherManage/nTeacher/index.vue +++ b/src/views/notCoalMine/nTeacherManage/nTeacher/index.vue @@ -30,7 +30,7 @@ plain icon="el-icon-plus" size="mini" - @click="handleAdd" + @click="openTeacher({},'add')" v-hasPermi="['system:experts:add']" >新增</el-button> </el-col> @@ -55,14 +55,8 @@ size="mini" type="text" icon="el-icon-edit" - @click="handleUpdate(scope.row)" + @click="openTeacher({},'add')" >编辑</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-view" - @click="handleView(scope.row)" - >停用</el-button> <el-button size="mini" type="text" @@ -70,6 +64,12 @@ @click="handleDelete(scope.row)" v-hasPermi="['system:experts:remove']" >删除</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="openWorkType(scope.row)" + >工种详情</el-button> </template> </el-table-column> </el-table> @@ -80,14 +80,16 @@ :limit.sync="queryParams.pageSize" @pagination="getList" /> + <teacherDialog ref="teacherDialog"></teacherDialog> </div> </template> <script> +import teacherDialog from "@/views/notCoalMine/nTeacherManage/nTeacher/components/teacherDialog"; export default { name: "cTeacherManage", dicts: [], - components: {}, + components: {teacherDialog}, data() { return { loading: false, @@ -112,6 +114,9 @@ }, methods: { + openTeacher(data,type){ + this.$refs.teacherDialog.openDialog(data,type) + }, getList(){ }, diff --git a/src/views/system/operateType/index.vue b/src/views/system/operateType/index.vue new file mode 100644 index 0000000..28e0368 --- /dev/null +++ b/src/views/system/operateType/index.vue @@ -0,0 +1,223 @@ +<template> + <div class="app-container"> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:post:add']" + >新增</el-button> + </el-col> + </el-row> + + <el-table v-loading="loading" :data="dataList" row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> + <el-table-column label="资格类型/作业类别/操作项目" prop="name" /> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:experts:edit']" + >修改</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:experts:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="父级" prop="parentId"> + <el-cascader + v-model="form.parentId" + :options="dataList" + style="width: 100%" + :props="{ expandTrigger: 'hover', value: 'id',label: 'name',emitPath: false,checkStrictly: true }" + @change="handleChange"></el-cascader> + </el-form-item> + <el-form-item label="作业类型名称" prop="name"> + <el-input v-model="form.name"/> + </el-form-item> + <el-form-item label="作业类型代码" prop="code"> + <el-input v-model="form.code"/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button @click="cancel">取 消</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import {getOperatePage, delOperate, addOperate, editOperate} from "@/api/coalMine/operateType"; + +export default { + name: "certType", + dicts: ['sys_normal_disable'], + data() { + return { + loading: true, + single: true, + multiple: true, + showSearch: true, + total: 0, + dataList: [], + title: "", + open: false, + form: {}, + rules: { + name: [{ required: true, message: "请填写类型名称", trigger: "blur" }], + code: [{ required: true, message: "请填写类型代码", trigger: "blur" }] + } + }; + }, + created() { + this.getList(); + }, + methods: { + async getList() { + this.loading = true; + const res = await getOperatePage({name: ''}) + if(res.code == 200){ + this.dataList = this.handleTree(res.data, "id"); + console.log(this.dataList,'data') + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + this.loading = false; + }, + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + handleChange(value) { + console.log(value); + }, + // 表单重置 + reset() { + this.form = { + parentId: 0, + id: null, + name: '', + code: '' + }; + this.resetForm("form"); + }, + + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "添加分类"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + this.form.id = row.id + this.form.name = row.name + this.form.code = row.code + this.form.parentId = this.findParentNodeById(this.dataList,row.id) + this.open = true; + this.title = "修改分类"; + }, + /** 提交按钮 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.title == '修改分类') { + editOperate(this.form).then(res => { + if(res.code == 200){ + this.$message({ + type: 'success', + message: '修改成功' + }); + this.open = false; + this.getList(); + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }); + } else { + const {id,...data} = this.form + addOperate(data).then(res => { + if(res.code == 200){ + this.$message({ + type: 'success', + message: '添加成功' + }); + this.open = false; + this.getList(); + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }); + } + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + const id = row.id; + this.$modal.confirm('是否确认删除分类为"' + row.name + '"的数据项?').then(function() { + return delOperate(id); + }).then((res) => { + if(res.code == 200){ + this.getList(); + this.$message({ + type: 'success', + message: '删除成功' + }); + }else{ + this.$message({ + type: 'warning', + message: res.msg + }); + } + }).catch(() => {}); + }, + + // 获取父级ID + findParentNodeById(data, value) { + for (const node of data) { + if (node.id === value) { + return null; // 已经是根节点,没有父级节点 + } + if (node.children) { + for (const child of node.children) { + if (child.id === value) { + return node.id; // 返回当前节点的ID作为父级ID + } + } + const foundNode = this.findParentNodeById(node.children, value); + if (foundNode !== null) { + return foundNode; // 返回找到的父级ID + } + } + } + return null; + } + } +}; +</script> -- Gitblit v1.9.2