| | |
| | | <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> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- <org-tree :data="companyInfo.deptList" />--> |
| | | <button @click="exportOrgChart">导出组织架构图</button> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <edit-dialog ref="dialogRef" @getList=getList></edit-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 {delUser, getUser} from "@/api/onlineEducation/user"; |
| | | import Cookies from "js-cookie"; |
| | | import editDialog from './components/editDialog.vue' |
| | | import {generateWordDocument} from './components/exportDoc.js' |
| | | |
| | | |
| | | import { |
| | | addIndustryTemp, |
| | | delIndustryTemp, |
| | | getIndustryTemp, |
| | | } from "@/api/staffManage/staff"; |
| | | // import OrgTree from 'vue-org-tree' |
| | | import html2canvas from 'html2canvas' |
| | | import { saveAs } from 'file-saver' |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { |
| | | addStandardQuality, |
| | |
| | | getStandardDetail, |
| | | getStandardQuality |
| | | } from "@/api/standardSys/standardSys"; |
| | | import {getBasic} from "@/api/companyInfo/basicInfo"; |
| | | import {getCom} from "@/api/companyInfo/overview"; |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance(); |
| | |
| | | ] |
| | | }); |
| | | |
| | | const { queryParams, total, dataList,companyList, isAdmin } = toRefs(data); |
| | | const { queryParams, total, dataList,companyList, isAdmin, companyInfo } = toRefs(data); |
| | | const userInfo = ref() |
| | | onMounted(async ()=>{ |
| | | if(userStore.roles.includes('admin')){ |
| | |
| | | onUnmounted(()=>{ |
| | | |
| | | }) |
| | | |
| | | const exportOrgChart=()=> { |
| | | const element = document.querySelector('.org-tree'); // 获取组织架构图的容器元素 |
| | | html2canvas(element).then(canvas => { |
| | | // 创建一个图片元素 |
| | | let img = new Image(); |
| | | img.src = canvas.toDataURL('image/png'); |
| | | |
| | | // 创建并触发下载 |
| | | img.onload = () => { |
| | | let w = img.width; |
| | | let h = img.height; |
| | | let canvas2 = document.createElement('canvas'); |
| | | let ctx = canvas2.getContext('2d'); |
| | | canvas2.width = w; |
| | | canvas2.height = h; |
| | | ctx.drawImage(img, 0, 0, w, h); |
| | | saveAs(canvas2.toDataURL('image/png'), '组织架构图.png'); |
| | | }; |
| | | }); |
| | | } |
| | | |
| | | const getList = async () => { |
| | | loading.value = true |
| | |
| | | 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('手册导出失败'); |
| | | } |
| | | } |
| | | |