From 1da082138ce384d17b93169cfe108386603e72d0 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 23 七月 2025 08:49:10 +0800 Subject: [PATCH] 修改 --- src/views/work/onlineEducation/trainPlan/components/trainDialog.vue | 273 +++++++++++++++++++ src/views/work/onlineEducation/groupExams/components/viewExamQuestion.vue | 4 src/views/work/onlineEducation/offlineEducation/components/recordDialog.vue | 114 +++++++ src/views/work/qualityInfo/supplierQuality/supplierList/components/supplierDialog.vue | 26 src/views/work/onlineEducation/offlineEducation/index.vue | 66 ++++ src/views/work/selfProblems/internalAudit/auditorManage/tableList/index.vue | 2 src/views/build/conpanyFunctionConsult/orgStructure/dutyDistributeChart/index.vue | 2 src/views/work/onlineEducation/trainPlan/index.vue | 262 ++++++++++++++++++ src/views/work/onlineEducation/courseManage/index.vue | 6 src/api/onlineEducation/trainPlan.js | 36 ++ 10 files changed, 764 insertions(+), 27 deletions(-) diff --git a/src/api/onlineEducation/trainPlan.js b/src/api/onlineEducation/trainPlan.js new file mode 100644 index 0000000..eccafd5 --- /dev/null +++ b/src/api/onlineEducation/trainPlan.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + + +export function getTrainPlanPage(params) { + return request({ + url: '/course/plan/list', + method: 'get', + params: params + }) +} + + +export function addTrainPlan(data) { + return request({ + url: '/course/plan/insert', + method: 'post', + data: data + }) +} + +export function editTrainPlan(params) { + return request({ + url: `/course/plan/update`, + method: 'post', + data: params + }) +} + +export function delTrainPlan(data) { + return request({ + url: `/course/plan/deleted?trainPlanId=${data}`, + method: 'get' + }) +} + + diff --git a/src/views/build/conpanyFunctionConsult/orgStructure/dutyDistributeChart/index.vue b/src/views/build/conpanyFunctionConsult/orgStructure/dutyDistributeChart/index.vue index 00a20a2..ac0fb6a 100644 --- a/src/views/build/conpanyFunctionConsult/orgStructure/dutyDistributeChart/index.vue +++ b/src/views/build/conpanyFunctionConsult/orgStructure/dutyDistributeChart/index.vue @@ -444,4 +444,4 @@ } } -</style> \ No newline at end of file +</style> diff --git a/src/views/work/onlineEducation/courseManage/index.vue b/src/views/work/onlineEducation/courseManage/index.vue index b573590..b6a16a9 100644 --- a/src/views/work/onlineEducation/courseManage/index.vue +++ b/src/views/work/onlineEducation/courseManage/index.vue @@ -101,7 +101,7 @@ </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240"> <template #default="scope"> - <div v-if="data.isAdmin"> + <div v-if="data.isAdmin || data.userType == 6"> <div v-if="scope.row.state !== 3"> <el-button link type="primary" v-if="scope.row.state == 1" @click="openApprove(scope.row)">审核</el-button> <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button> @@ -228,7 +228,8 @@ id: 3, name: '审批不通过' }, - ] + ], + userType: null }); const { queryParams, total, dataList } = toRefs(data); @@ -243,6 +244,7 @@ } const userInfo = JSON.parse(Cookies.get('userInfo')) console.log("userInfo",userInfo) + data.userType = userInfo.userType if(userInfo.userType === 0){ data.isAdmin = true; }else { diff --git a/src/views/work/onlineEducation/groupExams/components/viewExamQuestion.vue b/src/views/work/onlineEducation/groupExams/components/viewExamQuestion.vue index 36d6a69..5124e67 100644 --- a/src/views/work/onlineEducation/groupExams/components/viewExamQuestion.vue +++ b/src/views/work/onlineEducation/groupExams/components/viewExamQuestion.vue @@ -15,8 +15,8 @@ <div v-for="(item,index) in state.singleList" :key="index" style="margin-left: 15px;margin-top: 10px"> <div style="display: flex;flex-direction: column;"> <div style="margin-top: 10px;display: flex"> - <span style="font-size: 15px">题目{{index+1}}:</span> - <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span> + <span style="font-size: 15px;width: 66px">题目{{index+1}}:</span> + <span style="font-size: 16px">{{item.title}}</span> </div> <div style="display: flex;margin-left: 10%;margin-top: 15px"> <div v-for="single in item.content.items"> diff --git a/src/views/work/onlineEducation/offlineEducation/components/recordDialog.vue b/src/views/work/onlineEducation/offlineEducation/components/recordDialog.vue index b887e2a..4b21526 100644 --- a/src/views/work/onlineEducation/offlineEducation/components/recordDialog.vue +++ b/src/views/work/onlineEducation/offlineEducation/components/recordDialog.vue @@ -55,7 +55,18 @@ <el-input v-model.trim="state.form.courseName" :disabled="disabled" placeholder="请输入课程名称" ></el-input> </el-form-item> <el-form-item label="培训等级:" prop="level" > - <el-input v-model.trim="state.form.level" :disabled="disabled" placeholder="请输入培训等级" ></el-input> + <el-select + v-model="state.form.level" + style="width: 100%" + > + <el-option + v-for="item in state.levelList" + :key="item.id" + :label="item.name" + :value="item.id" + /> + </el-select> +<!-- <el-input v-model.trim="state.form.level" :disabled="disabled" placeholder="请输入培训等级" ></el-input>--> </el-form-item> <el-form-item label="要求课时(分):" prop="period" > <el-input v-model.trim="state.form.period" :disabled="disabled" placeholder="请输入要求课时(分)" ></el-input> @@ -71,6 +82,14 @@ <el-radio :label="0">不合格</el-radio> <el-radio :label="1">合格</el-radio> </el-radio-group> + </el-form-item> + <el-form-item label="培训记录:" prop="passed" > + <el-upload accept=".jpg,.jpeg,.png,.doc,.docx,.pdf,.xls,xlsx,ppt,pptx" style="width: 100%" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" > + <el-button type="primary">点击上传</el-button> +<!-- <template #tip>--> +<!-- <div class="el-upload__tip">尺寸小于5M,最多可上传1份</div>--> +<!-- </template>--> + </el-upload> </el-form-item> </el-form> <template #footer v-if="state.title !='查看'"> @@ -95,6 +114,8 @@ import {addStudent, checkStuIdNo, checkStuPhone, editStudent} from "@/api/onlineEducation/student"; import {addRecord, editRecord} from "@/api/onlineEducation/examRecord"; import {getCompany} from "@/api/onlineEducation/company"; +import {delPic} from "@/api/onlineEducation/banner"; +import {getToken} from "@/utils/auth"; const emit = defineEmits(["getList"]); const dialogVisible = ref(false) @@ -121,7 +142,8 @@ passed: 0, studentName: '', courseName: '', - companyId: null + companyId: null, + files: [] }, formRules:{ @@ -144,6 +166,20 @@ companyPageNum: 1, // 当前页码 companyPageSize: 10, // 每页显示的数量 hasMoreItems: null, // 是否还有更多选项 + levelList: [ + { + id: 1, + name: '公司级' + }, + { + id: 2, + name: '部门级' + }, + ], + uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', + header: { + Authorization: getToken() + }, }) onMounted(() => { @@ -173,7 +209,16 @@ if( type === 'view'){ disabled.value = true; } - state.form = value + + state.form = JSON.parse(JSON.stringify(value)) + state.form.studentId = value.student.id + state.form.studentName = value.student.name + state.fileList = value.files.map(i => { + return { + name: i.fileName, + path: i.filePath + } + }) // state.form.studentName = value.company.name; console.log("ba",state.form) } @@ -197,8 +242,7 @@ ElMessage.warning(res.message) } }else if(state.title == '编辑'){ - const {id, name, phone, sex, companyId, empno, post, duty, idNo} = state.form - const data = {id, name, phone, sex, companyId, empno, post, duty, idNo} + const {...data} = state.form const res = await editRecord(data) if(res.code == 200){ ElMessage.success(res.message) @@ -245,6 +289,7 @@ state.stuPageNum = 1; state.stuPageSize = 10; state.studentList = []; + state.fileList = [] superRef.value.clearValidate(); superRef.value.resetFields() dialogVisible.value = false; @@ -311,7 +356,66 @@ ElMessage.warning(res.message) } } +const handleAvatarSuccess = (response,uploadFile) => { + if(response.code == 200){ + state.form.files = state.fileList.map(item => { + return { + fileName: item.response ? item.response?.data.originName: item.name, + filePath: item.response ? item.response?.data.path: item.path + } + }) + }else{ + // state.fileList = [] + // state.form.files = [] + ElMessage({ + type: 'warning', + message: res.message + }) + } +} +const showTip =()=>{ + ElMessage({ + type: 'warning', + message: '超出文件上传数量' + }); +} +const picSize = async (rawFile) => { + if(rawFile.size / 1024 / 1024 > 5){ + ElMessage({ + type: 'warning', + message: '文件大小不能超过5M' + }); + return false + } +}; +const handleRemove = async (file, uploadFiles) => { + state.form.files = state.fileList.map(item => { + return { + fileName: item.response ? item.response?.data.originName: item.name, + filePath: item.response ? item.response?.data.path: item.path + } + }) + // let path = state.form.filePath; + // await delPic({path: path}).then(res => { + // if(res.code == 200){ + // // ElMessage({ + // // type: 'success', + // // message: '文件已删除' + // // }) + // state.form.fileName = '' + // state.form.filePath = '' + // }else{ + // ElMessage({ + // type: 'warning', + // message: res.message + // }) + // } + // }).catch(() => { + // state.form.fileName = '' + // state.form.filePath = '' + // }); +} defineExpose({ diff --git a/src/views/work/onlineEducation/offlineEducation/index.vue b/src/views/work/onlineEducation/offlineEducation/index.vue index 89abc80..2a9bd04 100644 --- a/src/views/work/onlineEducation/offlineEducation/index.vue +++ b/src/views/work/onlineEducation/offlineEducation/index.vue @@ -62,7 +62,7 @@ <el-table-column label="课程名称" prop="courseName" align="center"/> <el-table-column label="培训等级" prop="level" align="center"> <template #default="scope"> - <span>{{scope.row.sex == 1 ? '公司级':scope.row.sex == 2 ? '部门级' : '车间级'}}</span> + <span>{{scope.row.level == 1 ? '公司级':scope.row.level == 2 ? '部门级' : '车间级'}}</span> </template> </el-table-column> <el-table-column label="要求课时(分)" prop="period" align="center"/> @@ -71,6 +71,20 @@ <el-table-column label="是否合格" prop="passed" align="center"> <template #default="scope"> <span>{{scope.row.passed == 0 ? '不合格':'合格'}}</span> + </template> + </el-table-column> + <el-table-column label="培训记录" prop="passed" align="center" width="130"> + <template #default="scope"> + <div v-for="item in scope.row.files" style="display: flex;flex-direction: column"> + <el-link type="primary" @click="openFile(item.filePath)">{{item.fileName}}</el-link> + </div> + + </template> + </el-table-column> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120"> + <template #default="scope"> + <el-button link type="primary" @click="openDialog('edit',scope.row)" >编辑</el-button> + <el-button link type="danger" @click="handleDelete(scope.row)" >删除</el-button> </template> </el-table-column> </el-table> @@ -95,7 +109,8 @@ import {delUser, getUser} from "@/api/onlineEducation/user"; import Cookies from "js-cookie"; import {delStudent, getStudent} from "@/api/onlineEducation/student"; -import {getRecord} from "@/api/onlineEducation/examRecord"; +import {delRecord, getRecord} from "@/api/onlineEducation/examRecord"; +import {renderAsync} from "docx-preview"; const { proxy } = getCurrentInstance(); @@ -103,6 +118,7 @@ const dialogRef = ref(); const data = reactive({ queryParams: { + companyId: null, companyName: '', courseName: '', pageNum: 1, @@ -121,8 +137,10 @@ console.log("userInfo",userInfo) if(userInfo.userType === 0){ data.isAdmin = true; + // data.queryParams.companyId = null }else { data.isAdmin = false; + // data.queryParams.companyId = userInfo.companyId } await getList() }) @@ -167,7 +185,7 @@ type: 'warning', }) .then( async() => { - const res = await delStudent(val.id) + const res = await delRecord(val.id) if(res.code == 200){ ElMessage.success('数据删除成功') await getList() @@ -176,5 +194,47 @@ } }) } +const openFile = async(path)=>{ + const ext = path.split('.').pop().toLowerCase(); + if (ext === 'doc' || ext === 'xls' || ext === 'xlsx') { + ElMessageBox.confirm(`暂不支持线上预览.${ext}文件,是否下载查看?`, '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => { + window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank'); + }).catch(() => { + console.log('取消预览') + }); + return + }else if(ext === 'pdf' || ext === 'jpg'|| ext === 'jpeg' || ext === 'png' ){ + window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank'); + }else{ + try { + // 1. 获取文件 + const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path); + const arrayBuffer = await response.arrayBuffer(); + // 2. 创建新窗口 + const win = window.open('', '_blank'); + win.document.write(` + <!DOCTYPE html> + <html> + <head> + <title>预览</title> + <style> + body { margin: 20px; font-family: Arial; } + .docx-container { width: 100%; height: 100%; } + </style> + </head> + <body> + <div id="container" class="docx-container"></div> + </body> + </html> + `); + // 3. 渲染 DOCX + await renderAsync(arrayBuffer, win.document.getElementById('container')); + + } catch (error) { + console.error('预览失败:', error); + alert(`预览失败: ${error.message}`); + } + } +} </script> diff --git a/src/views/work/onlineEducation/trainPlan/components/trainDialog.vue b/src/views/work/onlineEducation/trainPlan/components/trainDialog.vue new file mode 100644 index 0000000..1ba881d --- /dev/null +++ b/src/views/work/onlineEducation/trainPlan/components/trainDialog.vue @@ -0,0 +1,273 @@ +<template> + <div class="notice"> + <el-dialog + v-model="dialogVisible" + :title="title" + width="600px" + :before-close="handleClose" + :close-on-press-escape="false" + :close-on-click-modal="false" + > + <el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="130px" > + <el-form-item label="企业名称:" prop="companyId" v-if="state.isAdmin"> + <el-select + v-model="state.form.companyId" + filterable + clearable + style="width: 100%" + :disabled="title == '查看' || title == '编辑' || !state.isAdmin" + @change="selectValueCom" + > + <el-option + v-for="item in state.companyList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="时间:" prop="trainTime" > + <el-date-picker + v-model="state.form.trainTime" + type="date" + placeholder="请选择" + style="width: 100%" + value-format="YYYY-MM-DD" + :disabled="title == '查看'" + + /> + </el-form-item> + <el-form-item label="课程名称:" prop="trainName" > + <el-input v-model="state.form.trainName" placeholder="课程名称" :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="组织部门:" prop="deptId" > + <el-select + v-model="state.form.deptId" + placeholder="请选择部门" + filterable + clearable + style="width: 100%" + :disabled="title == '查看'" + > + <el-option + v-for="item in state.deptList" + :key="item.deptId" + :label="item.deptName" + :value="item.deptId"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="参训对象:" prop="trainObject" > + <el-input v-model="state.form.trainObject" placeholder="参训对象" :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="人数:" prop="num" > + <el-input v-model="state.form.num" placeholder="人数" @input="state.form.num = state.form.num.replace(/[^0-9]/g,'')" :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="课时:" prop="hour" > + <el-input v-model="state.form.hour" + placeholder="课时" + @input="state.form.hour = state.form.hour + .replace(/[^0-9.]/g, '') + .replace(/(\..*)\./g, '$1') + .replace(/^(-?\d+\.?\d*).*/, '$1')" + :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="费用预算(元):" prop="money" > + <el-input v-model="state.form.money" + placeholder="费用预算(元)" + @input="state.form.money = state.form.money + .replace(/[^0-9.]/g, '') + .replace(/(\..*)\./g, '$1') + .replace(/^(-?\d+\.?\d*).*/, '$1')" + :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="培训形式:" prop="modality" > + <el-input v-model="state.form.modality" placeholder="培训形式" :disabled="title === '查看'"/> + </el-form-item> + <el-form-item label="是否已完成:" prop="status" > + <el-radio-group v-model="state.form.status"> + <el-radio :label="0">是</el-radio> + <el-radio :label="1">否</el-radio> + </el-radio-group> + </el-form-item> + </el-form> + <template #footer v-if="title !== '查看'"> + <span class="dialog-footer"> + <el-button @click="handleClose" size="default">取 消</el-button> + <el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认</el-button> + </span> + </template> + </el-dialog> + </div> +</template> +<script setup> +import {onMounted, reactive, ref, toRefs} from 'vue' +import Editor from "@/components/Editor/index.vue"; +import {ElMessage} from "element-plus"; +import {addNotice} from "@/api/backManage/notice"; +import {addDict, editDict, getDictDetail} from "@/api/backManage/evaluate"; +import {addCompany, checkName, distributeCompany, editCompany, getCompany} from "@/api/onlineEducation/company"; +import {verifyPhone} from "@/utils/validate"; +import {addBasic, editBasic} from "@/api/companyInfo/basicInfo"; +import Cookies from "js-cookie"; +import {getUser} from "@/api/onlineEducation/user"; +import {addScenario, editScenario} from "@/api/selfProblems/scenario"; +import {addTrainPlan, editTrainPlan} from "@/api/onlineEducation/trainPlan"; +import {getDept} from "@/api/qualityObjectives/object"; + +const dialogVisible = ref(false); +const title = ref(""); +const busRef = ref(); +const length = ref() +const emit = defineEmits(["getList"]); +const state = reactive({ + form: { + id: '', + companyId: null, + trainName: "", + trainTime: "", + deptId: null, + trainObject: "", + num: "", + hour: "", + money: "", + modality: "", + status: 3, + }, + formRules:{ + companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }], + trainName: [{ required: true, message: '请输入课程名称', trigger: 'blur' }], + trainTime:[{ required: true, message: '请选择日期', trigger: 'blur' }], + }, + isAdmin: false, + companyList: [], + deptList: [], +}) + +onMounted(() => { + +}) +const openDialog = async (type, value,companyList) => { + + const userInfo = JSON.parse(Cookies.get('userInfo')) + state.isAdmin = userInfo.userType === 0; + state.form.companyName = userInfo.companyName + state.form.companyId = userInfo.companyId + if(state.isAdmin){ + state.companyList = companyList + state.form.companyId = value.companyId + state.form.companyName = value.companyName + } + title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ; + if(type === 'edit' || type === 'review') { + state.form = JSON.parse(JSON.stringify(value)); + if(state.isAdmin){ + state.form.companyId = value.companyId + state.form.companyName = value.companyName + } + } + await getDeptList() + dialogVisible.value = true; +} + +const getDeptList = async () =>{ + if(state.isAdmin && (state.form.companyId == 0 || state.form.companyId == null)){ + return + } + const param = { + pageNum: 1, + pageSize: 999, + companyId: state.form.companyId + } + const res = await getDept(param) + if(res.code === 200){ + state.deptList = res.data + } +} +const onSubmit = async () => { + const valid = await busRef.value.validate(); + if(!state.isAdmin){ + const userInfo = JSON.parse(Cookies.get('userInfo')) + state.form.companyId = userInfo.companyId + } + if(valid){ + if(title.value === '新增'){ + const {id, ...data} = JSON.parse(JSON.stringify(state.form)) + const res = await addTrainPlan(data) + if(res.code === 200){ + ElMessage({ + type: 'success', + message: '新增成功' + }); + }else{ + ElMessage.warning(res.message) + } + emit("getList") + busRef.value.clearValidate(); + reset(); + dialogVisible.value = false; + }else if(title.value === '编辑'){ + const {...data} = JSON.parse(JSON.stringify(state.form)) + const res = await editTrainPlan(data) + if(res.code === 200){ + ElMessage({ + type: 'success', + message: '编辑成功' + }); + }else{ + ElMessage.warning(res.message) + } + emit("getList") + busRef.value.clearValidate(); + reset(); + dialogVisible.value = false; + } + } +} + +const handleClose = () => { + busRef.value.clearValidate(); + reset(); + dialogVisible.value = false; + emit("getList") + +} +const selectValueCom = (val) => { + state.form.deptId = null + getDeptList() +} +const reset = () => { + state.form = { + id: '', + companyId: null, + trainName: "", + trainTime: "", + deptId: null, + trainObject: "", + num: "", + hour: "", + money: "", + modality: "", + status: 3, + } + state.companyList = [] + state.deptList = [] +} +defineExpose({ + openDialog +}); + +</script> + +<style scoped lang="scss"> +.notice{ + :deep(.el-form .el-form-item__label) { + font-size: 15px; + } + .file { + display: flex; + flex-direction: column; + align-items: flex-start; + } +} +</style> diff --git a/src/views/work/onlineEducation/trainPlan/index.vue b/src/views/work/onlineEducation/trainPlan/index.vue new file mode 100644 index 0000000..6e43193 --- /dev/null +++ b/src/views/work/onlineEducation/trainPlan/index.vue @@ -0,0 +1,262 @@ +<template> + <div class="app-container"> + <div style="margin-bottom: 10px"> + <el-form style="display: flex;flex-wrap: wrap;"> + <el-form-item> + <el-button + type="primary" + plain + icon="Plus" + @click="openDialog('add',{})" + >新增</el-button> + </el-form-item> + <el-form-item label="企业名称:" v-if="data.isAdmin" style="margin-left: 20px"> + <el-select v-model="data.queryParams.companyId" filterable placeholder="请选择" clearable> + <el-option + v-for="item in data.companyList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item v-if="data.isAdmin"> + <el-button type="primary" style="margin-left: 30px" @click="searchClick">查询</el-button> + <el-button plain @click="reset">重置</el-button> + </el-form-item> + <el-form-item style="margin-left: 15px"> + <vue3-json-excel + :json-data="dataList" + :fields="data.isAdmin ? fieldsAdmin : fields" + name="培训计划表.xlsx" + > + <el-button type="primary">导出</el-button> + </vue3-json-excel> +<!-- <el-button--> +<!-- type="primary"--> +<!-- @click="exportData"--> +<!-- >导出</el-button>--> + </el-form-item> + + </el-form> + </div> + <!-- 表格数据 --> + <el-table v-loading="loading" :data="dataList" :border="true" @selection-change="handleSelectionChange"> + <el-table-column type="index" label="序号" width="80" align="center"></el-table-column> + <el-table-column label="企业名称" v-if="data.isAdmin" prop="companyName" align="center" /> + <el-table-column label="时间" prop="trainTime" align="center" /> + <el-table-column label="课程名称" prop="trainName" align="center" /> + <el-table-column label="组织部门" prop="deptName" align="center" /> + <el-table-column label="参训对象" prop="trainObject" align="center" /> + <el-table-column label="人数" prop="num" align="center" /> + <el-table-column label="课时" prop="hour" align="center" /> + <el-table-column label="费用预算(元)" prop="money" align="center" /> + <el-table-column label="培训形式" prop="modality" align="center" /> + <el-table-column label="是否已完成" prop="status" align="center"> + <template #default="scope"> + <span>{{scope.row.status == 0 ? '是' :scope.row.status == 1 ?'否': ''}}</span> + </template> + </el-table-column> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > + <template #default="scope"> + <el-button link type="primary" @click="openDialog('edit',scope.row)" >编辑</el-button> + <el-button link type="danger" @click="handleDelete(scope.row)" >删除</el-button> + </template> + </el-table-column> + </el-table> + + <div class="pag-container"> + <el-pagination + v-model:current-page="data.queryParams.pageNum" + v-model:page-size="data.queryParams.pageSize" + :page-sizes="[10,15,20,25]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + <trainDialog ref="noticeRef" @getList = "getList"></trainDialog> + </div> +</template> + +<script setup> +import {getCurrentInstance, onMounted, reactive, ref, toRefs} from "vue"; +import trainDialog from "./components/trainDialog.vue" +import {ElMessage, ElMessageBox} from "element-plus"; +import {getCompany} from "@/api/onlineEducation/company"; +import Cookies from "js-cookie"; +import {generateWordDocument} from "@/utils/exportWord"; +import {delBasic, getBasic} from "@/api/companyInfo/basicInfo"; +import {delScenario, getScenarioPage} from "@/api/selfProblems/scenario"; +import {delTrainPlan, getTrainPlanPage} from "@/api/onlineEducation/trainPlan"; + +const { proxy } = getCurrentInstance(); +const loading = ref(false); +const noticeRef = ref(); +const loadingCompany = ref(false) +const choosedData = ref([]) +const data = reactive({ + queryParams: { + pageNum: 1, + pageSize: 10, + companyId: null, + }, + companyList: [], + isAdmin: false, + expertData: [] +}); +const dataList = ref([]); +const total = ref(0); + +const { queryParams } = toRefs(data); +const fieldsAdmin = ref({ + '企业名称': 'companyName', + '时间':'trainTime', + '课程名称':'trainName', + '组织部门':'deptName', + '参训对象':'trainObject', + '人数':'num', + '课时':'hour', + '费用预算(元)':'money', + '培训形式':'modality', + '是否已完成':'statusName', +}); +const fields = ref({ + '时间':'trainTime', + '课程名称':'trainName', + '组织部门':'deptName', + '参训对象':'trainObject', + '人数':'num', + '课时':'hour', + '费用预算(元)':'money', + '培训形式':'modality', + '是否已完成':'statusName', +}); +onMounted(() => { + const userInfo = JSON.parse(Cookies.get('userInfo')) + console.log("userInfo",userInfo) + data.isAdmin = userInfo.userType === 0; + if(data.isAdmin){ + data.queryParams.companyId = null + getCompanyList() + }else { + data.queryParams.companyId = userInfo.companyId + } + getList(); +}); +const getList = async () => { + loading.value = true; + const res = await getTrainPlanPage(data.queryParams); + if(res.code === 200){ + dataList.value = res.data.list.map(item => { + return { + ...item, + trainTime: item.trainTime.substring(0,10), + statusName: item.status == 0 ? '是' : item.status == 1 ? '否' : '' + } + }) + total.value = res.data.total + }else{ + ElMessage.warning(res.message) + } + loading.value = false; + +} + +const searchClick = () => { + getList(); +} +const openDialog = (type, value) => { + noticeRef.value.openDialog(type, value,data.companyList); +} + +const getCompanyList = async ()=>{ + const queryParams = { + pageNum: 1, + pageSize: 999 + } + const res = await getCompany(queryParams) + if (res.code == 200) { + data.companyList = res.data.list?res.data.list:[] + } else { + ElMessage.warning(res.message) + } +} + +const handleSizeChange = (val) => { + data.queryParams.pageSize = val + getList() +} +const handleCurrentChange = (val) => { + data.queryParams.pageNum = val + getList() +} + +/** 重置新增的表单以及其他数据 */ +function reset() { + data.queryParams = { + companyId: '', + pageNum: 1, + pageSize: 10, + } + choosedData.value = [] + data.companyList = []; + getList(); + getCompanyList() +} +const exportData = () => { + if(choosedData.value && choosedData.value.length === 0){ + ElMessage.warning('请选择需要导出的数据') + }else { + startGeneration() + } +} +const templatePath = '/scenarioExample.docx' +const startGeneration = async () => { + choosedData.value.forEach(item => { + try { + item.title = item.year+'年度内部审核策划方案' + generateWordDocument(templatePath, item, item.companyName+ '_' + item.title +'.docx'); + } catch (error){ + ElMessage({ + type: 'warning', + message: '导出失败' + }); + } + }) +} + +const handleSelectionChange = (val) => { + choosedData.value = val +} +const handleDelete = (val) => { + ElMessageBox.confirm( + '确定删除此条数据?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then( async() => { + const res = await delTrainPlan(val.id); + if(res.code === 200){ + ElMessage({ + type: 'success', + message: '删除成功' + }); + getList(); + }else{ + ElMessage.warning(res.message) + } + }) +} + +</script> +<style lang="scss"> +.pag-container{ + float: right; + margin-top: 10px; +} +</style> diff --git a/src/views/work/qualityInfo/supplierQuality/supplierList/components/supplierDialog.vue b/src/views/work/qualityInfo/supplierQuality/supplierList/components/supplierDialog.vue index d318110..f39d1ae 100644 --- a/src/views/work/qualityInfo/supplierQuality/supplierList/components/supplierDialog.vue +++ b/src/views/work/qualityInfo/supplierQuality/supplierList/components/supplierDialog.vue @@ -32,7 +32,7 @@ <el-input v-model="state.form.user" :disabled="title === '查看'"/> </el-form-item> <el-form-item label="联系电话:" prop="phone" > - <el-input v-model="state.form.phone" :disabled="title === '查看'"/> + <el-input v-model="state.form.phone" @input="state.form.phone= state.form.phone.replace(/[^0-9-]/g,'')" :disabled="title === '查看'"/> </el-form-item> <el-form-item label="备注:" prop="remark" > <el-input v-model="state.form.remark" :disabled="title === '查看'"/> @@ -64,17 +64,17 @@ const busRef = ref(); const length = ref() const emit = defineEmits(["getList"]); -const validatePhone = (rule, value, callback)=>{ - if(value === ''){ - callback(new Error('请输入手机号')) - }else{ - if(!verifyPhone(value)){ - callback(new Error('手机号格式有误')) - }else{ - callback() - } - } -} +// const validatePhone = (rule, value, callback)=>{ +// if(value === ''){ +// callback(new Error('请输入手机号')) +// }else{ +// if(!verifyPhone(value)){ +// callback(new Error('手机号格式有误')) +// }else{ +// callback() +// } +// } +// } const state = reactive({ form: { @@ -92,7 +92,7 @@ supplierName: [{ required: true, message: '请输入供应商名称', trigger: 'blur' }], supplierAddr:[{ required: true, message: '请输入地址', trigger: 'blur' }], user: [{ required: true, message: '请输入联系人', trigger: 'blur' }], - phone: [{ required: true, validator: validatePhone, trigger: 'blur' }], + phone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }], merito: [{ required: true, message: '请输入主营产品', trigger: 'blur' }], }, isAdmin: false, diff --git a/src/views/work/selfProblems/internalAudit/auditorManage/tableList/index.vue b/src/views/work/selfProblems/internalAudit/auditorManage/tableList/index.vue index f424f8e..aea8de3 100644 --- a/src/views/work/selfProblems/internalAudit/auditorManage/tableList/index.vue +++ b/src/views/work/selfProblems/internalAudit/auditorManage/tableList/index.vue @@ -4,7 +4,7 @@ <el-form style="display: flex;flex-wrap: wrap;"> <el-form-item> <el-button - v-if="data.userType ==0 || data.userType == 1" + v-if="data.userType ==0 || data.userType == 6" type="primary" plain icon="Plus" -- Gitblit v1.9.2