| | |
| | | data: data |
| | | }) |
| | | } |
| | | export function uploadTemplate(data) { |
| | | return request({ |
| | | url: '/company/industryTemplate/upload', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function delSysClause(params) { |
| | | return request({ |
| | |
| | | method: 'get', |
| | | params: params |
| | | }) |
| | | } |
| | | } |
| | |
| | | <el-table-column label="序号" type="index" align="center" width="80"/> |
| | | <el-table-column label="质量手册" prop="fileName" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="initFile()">{{scope.row.companyName + scope.row.qualityName + '.docx'}}</el-button> |
| | | <el-button link type="primary" @click="initFile(scope.row.companyName)">{{scope.row.companyName + scope.row.qualityName + '.docx'}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > |
| | | <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> |
| | |
| | | return tableData |
| | | } |
| | | |
| | | const initFile = async () => { |
| | | const initFile = async (name) => { |
| | | await getInfo() |
| | | const templatePath = '/qualityFile.docx' |
| | | try { |
| | | await generateWordDocument( |
| | | templatePath, |
| | | data.companyInfo, |
| | | '质量手册.docx' |
| | | name+'质量手册.docx' |
| | | ); |
| | | ElMessage.success('文档生成成功!'); |
| | | ElMessage.success('手册导出成功!'); |
| | | } catch (error) { |
| | | console.error('导出失败:', error); |
| | | ElMessage.warning('文档生成失败'); |
| | | ElMessage.warning('手册导出失败'); |
| | | } |
| | | } |
| | | |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="模板名称:" prop="templateName"> |
| | | <el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="模板名称"></el-input> |
| | | <el-form-item label="章节:" prop="chapter"> |
| | | <el-input v-model.trim="state.form.chapter" :disabled="state.title =='查看'" placeholder="章节"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="文件记录:" prop="templateName"> |
| | | <el-input v-model.trim="state.form.templateName" :disabled="state.title =='查看'" placeholder="文件记录"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="分类:" prop="type"> |
| | | <el-input v-model.trim="state.form.type" :disabled="state.title =='查看'" placeholder="分类"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="行业:" prop="industryType"> |
| | | <el-select v-model="state.form.industryType" placeholder="请选择" clearable style="width: 100%"> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="模板文件:" prop="filePath"> |
| | | <el-form-item label="模板:" prop="filePath"> |
| | | <el-upload accept=".doc,.docx" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" :limit='state.fileLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" > |
| | | <el-button type="primary">点击上传</el-button> |
| | | <template #tip> |
| | |
| | | filePath: '', |
| | | fileName: '', |
| | | format: '', |
| | | companyId: null |
| | | companyId: null, |
| | | type: '', |
| | | chapter: '' |
| | | }, |
| | | formRules:{ |
| | | companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }], |
| | | templateName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }], |
| | | templateName: [{ required: true, message: '请输入文件记录', trigger: 'blur' }], |
| | | industryType: [{ required: true, message: '请选择行业类型', trigger: 'blur' }], |
| | | filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }] |
| | | filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }], |
| | | chapter: [{ required: true, message: '请输入章节', trigger: 'blur' }], |
| | | type: [{ required: true, message: '请输入分类', trigger: 'blur' }], |
| | | }, |
| | | isAdmin: false, |
| | | companyList: [], |
| | |
| | | filePath: '', |
| | | fileName: '', |
| | | format: '', |
| | | companyId: null |
| | | companyId: null, |
| | | type: '', |
| | | chapter: '' |
| | | } |
| | | state.fileList = [] |
| | | superRef.value.clearValidate(); |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分类:" > |
| | | <el-input v-model.trim="data.queryParams.type" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item > |
| | | <el-button v-if="isAdmin" type="primary" @click="getList">查询</el-button> |
| | | <el-button v-if="isAdmin" type="primary" plain @click="reset">重置</el-button> |
| | | <el-button type="primary" @click="getList">查询</el-button> |
| | | <el-button type="primary" plain @click="reset">重置</el-button> |
| | | <el-button type="primary" @click="exportData">导入</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <!-- 表格数据 --> |
| | | <el-table v-loading="loading" :data="dataList" :border="true"> |
| | | <el-table-column label="序号" type="index" align="center" width="80"/> |
| | | <el-table-column label="模板名称" prop="templateName" align="center"/> |
| | | <el-table-column label="章节" prop="chapter" align="center"/> |
| | | <el-table-column label="文件记录" prop="templateName" align="center"/> |
| | | <el-table-column label="行业" prop="industryName" align="center" /> |
| | | <el-table-column label="模板文件" prop="fileName" align="center"> |
| | | <el-table-column label="模板" prop="fileName" align="center"> |
| | | <template #default="scope"> |
| | | <el-link style="" type="primary" @click="downloadFile(scope.row)">{{scope.row.fileName}}</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="分类" prop="type" align="center" /> |
| | | <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> |
| | |
| | | /> |
| | | |
| | | <edit-dialog ref="dialogRef" @getList=getList></edit-dialog> |
| | | <el-dialog |
| | | v-model="data.exportDialog" |
| | | title="导入模板" |
| | | width="550px" |
| | | :before-close="handleCloseExport" |
| | | :close-on-press-escape="false" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :model="state.form" size="default" ref="superRef" :rules="state.formRules" label-width="110px" > |
| | | <el-form-item label="表格模板:" > |
| | | <el-button @click="downloadFileTable" size="default" :icon="Download" type="primary" plain>下载模板</el-button> |
| | | </el-form-item> |
| | | <el-form-item label="导入文件"> |
| | | <el-upload |
| | | accept=".xlsx,.xls" |
| | | :before-upload="beforeUpload" |
| | | v-model:file-list="state.exportFileList" |
| | | action="#" |
| | | :auto-upload="false" |
| | | :on-change="handleChange" |
| | | style="width: 100%" |
| | | > |
| | | <el-button :icon="Upload" size="default" type="primary">点击上传</el-button> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="handleCloseExport" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="onUpload" size="default">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {delCompany, getCompany} from "@/api/onlineEducation/company"; |
| | | import { Plus, Upload, Download} from '@element-plus/icons-vue'; |
| | | import {delUser, getUser} from "@/api/onlineEducation/user"; |
| | | import Cookies from "js-cookie"; |
| | | import editDialog from './components/editDialog.vue' |
| | | import { |
| | | delIndustryTemp, |
| | | getIndustryTemp, |
| | | getIndustryTemp, uploadTemplate, |
| | | } from "@/api/staffManage/staff"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import axios from "axios"; |
| | |
| | | const { proxy } = getCurrentInstance(); |
| | | const loading = ref(false); |
| | | const dialogRef = ref(); |
| | | const checkFiles = (rule, value, callback) => { |
| | | if (state.exportFileList.length == 0) { |
| | | callback(new Error('请上传导入文件')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | const data = reactive({ |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: null, |
| | | industryType: null |
| | | industryType: null, |
| | | type: '' |
| | | }, |
| | | total: 0, |
| | | dataList: [], |
| | | companyList: [], |
| | | industryList: [], |
| | | isAdmin: false, |
| | | typeList: [] |
| | | typeList: [], |
| | | exportDialog: false, |
| | | |
| | | }); |
| | | const state = reactive({ |
| | | form: { |
| | | id: null, |
| | | filePath: '', |
| | | companyId: null |
| | | }, |
| | | formRules:{ |
| | | companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }], |
| | | filePath: [{ required: true, validator: checkFiles, trigger: 'blur' }] |
| | | }, |
| | | exportFileList: [], |
| | | }) |
| | | |
| | | const { queryParams, total, dataList,companyList,industryList, isAdmin } = toRefs(data); |
| | | const userInfo = ref() |
| | |
| | | loading.value = true |
| | | const res = await getIndustryTemp(data.queryParams) |
| | | if(res.code == 200){ |
| | | data.dataList = res.data.list || [] |
| | | data.dataList = res.data.list |
| | | data.total = res.data.total |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | |
| | | dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin, data.companyList); |
| | | } |
| | | |
| | | const exportData = () => { |
| | | data.exportDialog = true |
| | | |
| | | } |
| | | const handleCloseExport = () => { |
| | | state.exportFileList = [] |
| | | data.exportDialog = false |
| | | } |
| | | const beforeUpload = (file) => { |
| | | state.exportFileList = [...state.exportFileList, file] |
| | | state.exportFileList = state.exportFileList.slice(-1) |
| | | return false; |
| | | } |
| | | const downloadFileTable = () => { |
| | | const filePath = '/example.xls'; |
| | | const link = document.createElement('a'); |
| | | link.href = filePath; |
| | | link.download = filePath.substr(filePath.lastIndexOf('/') + 1); |
| | | link.click(); |
| | | } |
| | | const fileBinaryList = ref([]) |
| | | const handleChange = (file, files) => { |
| | | fileBinaryList.value = files; |
| | | }; |
| | | const onUpload = async () => { |
| | | if(state.exportFileList.length == 0){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请先上传表格文件' |
| | | }); |
| | | return |
| | | }else{ |
| | | const formData = new FormData(); |
| | | fileBinaryList.value.forEach((file) => { |
| | | formData.append('file', file.raw) |
| | | }) |
| | | console.log('form',formData) |
| | | const res = await uploadTemplate(formData) |
| | | if(res.code == 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '导入成功' |
| | | }); |
| | | state.exportFileList = [] |
| | | data.exportDialog = false |
| | | await getList() |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'error', |
| | | message: res.message |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** 重置新增的表单以及其他数据 */ |
| | | const reset= async()=> { |
| | | data.queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: null, |
| | | industryType: null |
| | | if(data.isAdmin){ |
| | | data.queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: null, |
| | | industryType: null, |
| | | type: '' |
| | | } |
| | | await getCompanyList() |
| | | }else { |
| | | data.queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: data.queryParams.companyId, |
| | | industryType: null, |
| | | type: '' |
| | | } |
| | | } |
| | | await getCompanyList() |
| | | await getList() |
| | | } |
| | | const handleDelete = (val) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | </script> |
| | |
| | | } |
| | | choosedData.value = [] |
| | | data.companyList = []; |
| | | getCompanyList() |
| | | }else { |
| | | data.queryParams = { |
| | | companyId: data.queryParams.companyId, |
| | |
| | | } |
| | | } |
| | | getList(); |
| | | getCompanyList() |
| | | |
| | | } |
| | | const exportData = () => { |
| | | if(choosedData.value && choosedData.value.length === 0){ |
| | |
| | | } |
| | | choosedData.value = [] |
| | | data.companyList = []; |
| | | getCompanyList() |
| | | }else { |
| | | data.queryParams = { |
| | | companyId: data.queryParams.companyId, |
| | |
| | | } |
| | | } |
| | | getList(); |
| | | getCompanyList() |
| | | |
| | | } |
| | | const exportData = () => { |
| | | if(choosedData.value && choosedData.value.length === 0){ |
| | |
| | | } |
| | | choosedData.value = [] |
| | | data.companyList = []; |
| | | getCompanyList() |
| | | }else { |
| | | data.queryParams = { |
| | | companyId: data.queryParams.companyId, |
| | |
| | | } |
| | | } |
| | | getList(); |
| | | getCompanyList() |
| | | |
| | | } |
| | | const exportData = () => { |
| | | if(choosedData.value && choosedData.value.length === 0){ |
| | |
| | | } |
| | | |
| | | const getAllList = async () => { |
| | | let params = data.queryParams |
| | | params.pageSize = 999 |
| | | const res = await getUser(params) |
| | | const res = await getUser({ |
| | | pageNum: 1, |
| | | pageSize: 999, |
| | | username: '', |
| | | userType: null, |
| | | companyId: null |
| | | }) |
| | | if(res.code == 200){ |
| | | data.expertData = res.data.list.map((item,index) => { |
| | | return { |