From d5bd0e88c1eec6bb2947d2bfa57348d89edbc1c3 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期五, 18 七月 2025 16:20:45 +0800 Subject: [PATCH] 修改 --- src/views/work/qualityInfo/supplierQuality/supplierList/index.vue | 476 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 465 insertions(+), 11 deletions(-) diff --git a/src/views/work/qualityInfo/supplierQuality/supplierList/index.vue b/src/views/work/qualityInfo/supplierQuality/supplierList/index.vue index f36fce3..74da243 100644 --- a/src/views/work/qualityInfo/supplierQuality/supplierList/index.vue +++ b/src/views/work/qualityInfo/supplierQuality/supplierList/index.vue @@ -24,19 +24,43 @@ <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"> + <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="供应商名称" prop="supplierName" align="center" /> - <el-table-column label="供应商类型" prop="supplierType" align="center" /> + <el-table-column label="供货单位" prop="supplierName" align="center" /> + <el-table-column label="地址" prop="supplierAddr" align="center" /> + <el-table-column label="供应品名称" prop="merito" align="center" /> <el-table-column label="联系人" prop="user" align="center" /> <el-table-column label="联系电话" prop="phone" align="center" /> - <el-table-column label="邮箱" prop="emil" align="center" /> - <el-table-column label="主营产品" prop="merito" align="center" /> - <el-table-column label="服务内容" prop="content" align="center" /> - <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > + <el-table-column label="备注" prop="remark" align="center" /> + <el-table-column label="业绩评定表" align="center" class-name="small-padding fixed-width" width="160" > + <template #default="scope"> + <el-button link type="primary" @click="openPerformance('review',scope.row)">查看</el-button> + <el-button link type="primary" @click="openPerformance('edit',scope.row)">编辑</el-button> + <el-button link type="primary" @click = 'exportPerformance(scope.row)'>导出</el-button> + </template> + </el-table-column> + <el-table-column label="质量保证能力调查表" align="center" class-name="small-padding fixed-width" width="160" > + <template #default="scope"> + <el-button link type="primary" @click="openQuality('review',scope.row)">查看</el-button> + <el-button link type="primary" @click="openQuality('edit',scope.row)">编辑</el-button> + <el-button link type="primary" @click = 'exportQuality(scope.row)'>导出</el-button> + </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="openCert('review',scope.row)">查看</el-button> + </template> + </el-table-column> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" > <template #default="scope"> <el-button link type="primary" @click="openDialog('review',scope.row)" >查看</el-button> <el-button link type="primary" @click="openDialog('edit',scope.row)" >编辑</el-button> @@ -57,22 +81,31 @@ /> </div> <supplierDialog ref="noticeRef" @getList = "getList"></supplierDialog> + <performanceTable ref="performanceRef" @getList = "getList"></performanceTable> + <qualityDialog ref="qualityRef" @getList = "getList"></qualityDialog> + <certDialog ref="certRef" @getList = "getList"></certDialog> </div> </template> <script setup> import {getCurrentInstance, onMounted, reactive, ref, toRefs} from "vue"; import supplierDialog from "./components/supplierDialog.vue" +import performanceTable from './components/performanceTableDialog.vue' +import qualityDialog from './components/qualityDialog.vue' +import certDialog from './components/certDialog.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 {delSupplier, getSupplierPage} from "@/api/supplier/supplierList"; - +import {delSupplierById, getPerformance, getQuality, getSupplierPage} from "@/api/supplier/supplierList"; const { proxy } = getCurrentInstance(); const loading = ref(false); const noticeRef = ref(); +const performanceRef = ref(); +const qualityRef = ref(); +const certRef = ref(); + const loadingCompany = ref(false) const choosedData = ref([]) const data = reactive({ @@ -82,7 +115,155 @@ companyId: null, }, companyList: [], - isAdmin: false + isAdmin: false, + verifyList:[{id: 1,label: '现场验证'},{id: 2,label: '入库验证'},{id: 3,label: '供方货源处验证'},], + opinionList:[{id: 1,label: '保留(≥80)'},{id: 2,label: '暂停,整改后再评价(≥65)'},{id: 3,label: '剔除(<65)'},], + traitList:[ + { + id: 1, + name: '成批生产' + }, + { + id: 2, + name: '流水线生产' + }, + { + id: 3, + name: '单台生产' + }, + { + id: 4, + name: '其他' + }, + ], + facilityList:[ + { + id: 1, + name: '齐全、良好' + }, + { + id: 2, + name: '基本齐全、尚可' + }, + { + id: 3, + name: '不全' + }, + { + id: 4, + name: '代理商' + }, + ], + craftList:[ + { + id: 1, + name: '齐备' + }, + { + id: 2, + name: '有一部分' + }, + { + id: 3, + name: '没有' + }, + { + id: 4, + name: '代理商' + }, + ], + developList:[ + { + id: 1, + name: '能自行设计开发新品' + }, + { + id: 2, + name: '只能开发简单产品' + }, + { + id: 3, + name: '没有自行开发能力,代理商' + }, + ], + teamWorkList:[ + { + id: 1, + name: '是外资企业' + }, + { + id: 2, + name: '是合资企业' + }, + { + id: 3, + name: '给企业提供产品' + }, + { + id: 4, + name: '无对外合作经验' + }, + { + id: 5, + name: '有对外合作经验,但不经常发生' + }, + ], + qualificationList:[ + { + id: 1, + name: '营业执照' + }, + { + id: 2, + name: '有效期内' + }, + { + id: 3, + name: '有效期外' + }, + { + id: 4, + name: '高新技术企业' + }, + { + id: 5, + name: '有效期内' + }, + { + id: 6, + name: '有效期外' + }, + { + id: 7, + name: '资质代理商' + }, + { + id: 8, + name: '其他资质情况:' + }, + ], + productList:[ + { + id: 1, + name: '通过产品认证' + }, + { + id: 2, + name: '没有产品认证' + }, + { + id: 3, + name: '通过质量体系认证' + }, + { + id: 4, + name: '没有体系认证' + }, + { + id: 5, + name: '其他认证(请指出具体内容):' + }, + ] }); const dataList = ref([]); const total = ref(0); @@ -102,6 +283,8 @@ if(data.isAdmin){ getCompanyList() } + + }); const getList = async () => { loading.value = true; @@ -112,7 +295,7 @@ }else{ ElMessage.warning(res.message) } - loading.value = false; + loading.value = false } const searchClick = () => { @@ -120,6 +303,15 @@ } const openDialog = (type, value) => { noticeRef.value.openDialog(type, value,data.companyList); +} +const openPerformance = (type, value) => { + performanceRef.value.openDialog(type, value); +} +const openQuality = (type,value) => { + qualityRef.value.openDialog(type, value); +} +const openCert = (type,value) => { + certRef.value.openDialog(type, value); } const selectValue = (val) => { data.companyList.forEach(item => { @@ -179,7 +371,7 @@ type: 'warning', }) .then( async() => { - const res = await delSupplier(val.id); + const res = await delSupplierById(val.id); if(res.code === 200){ ElMessage({ type: 'success', @@ -191,7 +383,269 @@ } }) } +const qualityPath = ref('/qualityExample.docx') +const exportQuality = async (val) => { + let state = {} + const param = { + supplierSureId: val.id + } + const res = await getQuality(param) + if(res.code == 200){ + state = res.data + state.productName = val.merito + if(state.otherQualifi){ + data.qualificationList.forEach((item) => { + if(item.id == 8){ + item.name = item.name+ state.otherQualifi + } + }) + } + if(state.otherProduct){ + data.productList.forEach((item) => { + if(item.id == 5){ + item.name = item.name+ state.otherProduct + } + }) + } + await handleCheckData(res.data) + state.traitList = data.traitList + state.facilityList = data.facilityList + state.craftList = data.craftList + const teamWorkData = formatCheckboxData(data.teamWorkList) + state.teamWorkList = teamWorkData + const developData = formatCheckboxData(data.developList) + state.developList = developData + const qualificationData = formatCheckboxData(data.qualificationList,'quality') + state.qualificationList = qualificationData + const productData = formatCheckboxData(data.productList) + state.productList = productData + state.chargeTime = state.chargeTime?state.chargeTime.substring(0,10):'' + try { + generateWordDocument(qualityPath.value, state, val.supplierName+'_供方质量保证能力调查表.docx'); + await setTableData() + } catch (error){ + ElMessage({ + type: 'warning', + message: '导出失败' + }); + } + }else{ + ElMessage.warning(res.message) + } +} +function formatCheckboxData(items,type) { + return items.reduce((rows, item, index) => { + if(type == 'quality'){ + if (index % 3 === 0) { + // 创建新行,添加第一个复选框 + rows.push({ check1: item }); + } else if (index % 3 === 1 && rows.length > 0) { + // 向当前行添加第二个复选框 + const currentRow = rows[rows.length - 1]; + currentRow.check2 = item; + } else if (index % 3 === 2 && rows.length > 0) { + // 向当前行添加第三个复选框 + const currentRow = rows[rows.length - 1]; + currentRow.check3 = item; + } + }else{ + if (index % 2 === 0) { + // 创建新行,添加第一个复选框 + rows.push({ check1: item }); + } else { + // 向最后一行添加第二个复选框 + const lastRow = rows[rows.length - 1]; + lastRow.check2 = item; + } + } + return rows; + }, []); +} +const handleCheckData = (val) =>{ + const idSetTrait = new Set(val.trait.split(',').map((i => Number(i)))) + data.traitList.forEach(item => { + if (idSetTrait.has(item.id)) { + item.checked = true; + } + }); + const idSetFacility = new Set(val.facility.split(',').map((i => Number(i)))) + data.facilityList.forEach(item => { + if (idSetFacility.has(item.id)) { + item.checked = true; + } + }); + const idSetCraft = new Set(val.craft.split(',').map((i => Number(i)))) + data.craftList.forEach(item => { + if (idSetCraft.has(item.id)) { + item.checked = true; + } + }); + const idSetDevelop = new Set(val.develop.split(',').map((i => Number(i)))) + data.developList.forEach(item => { + if (idSetDevelop.has(item.id)) { + item.checked = true; + } + }); + const idSetTeamWork = new Set(val.teamWork.split(',').map((i => Number(i)))) + data.teamWorkList.forEach(item => { + if (idSetTeamWork.has(item.id)) { + item.checked = true; + } + }); + const idSetQualification = new Set(val.qualification.split(',').map((i => Number(i)))) + data.qualificationList.forEach(item => { + if (idSetQualification.has(item.id)) { + item.checked = true; + } + }); + const idSetProduct = new Set(val.product.split(',').map((i => Number(i)))) + data.productList.forEach(item => { + if (idSetProduct.has(item.id)) { + item.checked = true; + } + }); +} + + + + + +const performancePath = ref('/performanceExample.docx') +const exportPerformance = async (val) => { + let state = {} + const param = { + supplierSureId: val.id + } + const res = await getPerformance(param) + if(res.code == 200){ + // if(!res.data.p1){ + // ElMessage.warning('暂无数据!') + // return + // } + state = res.data + state.tableData = [{name: '产品质量 p1', good: '', fine: '', middle: '', bad: ''}, + {name: '交货期 p2', good: '', fine: '', middle: '', bad: ''}, + {name: '履约能力 p3', good: '', fine: '', middle: '', bad: ''}, + {name: '价格 p4', good: '', fine: '', middle: '', bad: ''}, + {name: '售后服务 p5', good: '', fine: '', middle: '', bad: ''}, + {name: '资历 p6', good: '', fine: '', middle: '', bad: ''}, + ] + //更新表格字段名 + const p1Field = getMatchedField(res.data.p1) + if(p1Field){ + state.tableData[0][p1Field] = res.data.p1 + } + const p2Field = getMatchedField(res.data.p2) + if(p2Field){ + state.tableData[1][p2Field] = res.data.p2 + } + const p3Field = getMatchedField(res.data.p3) + if(p3Field){ + state.tableData[2][p3Field] = res.data.p3 + } + const p4Field = getMatchedField(res.data.p4) + if(p4Field){ + state.tableData[3][p4Field] = res.data.p4 + } + const p5Field = getMatchedField(res.data.p5) + if(p5Field){ + state.tableData[4][p5Field] = res.data.p5 + } + const p6Field = getMatchedField(res.data.p6) + if(p6Field){ + state.tableData[5][p6Field] = res.data.p6 + } + const sum = res.data.p1+res.data.p2+res.data.p3+res.data.p4+res.data.p5+res.data.p6 + state.tableData = state.tableData.map((i,index) => { + return { + ...i, + list: [{ + first: index == 0, + conclusion:'Σ(Pi)/6 ='+(sum/6).toFixed(2) + }] + } + }) + data.verifyList.forEach(i => { + i.checked = i.id != state.verify + }) + state.verifyList = data.verifyList + data.opinionList.forEach(i => { + i.checked = i.id != state.opinion + }) + state.opinionList = data.opinionList + state.reviewTime = state.reviewTime?state.reviewTime.substring(0,10):'' + state.checkTime = state.checkTime?state.checkTime.substring(0,10):'' + }else{ + ElMessage.warning(res.message) + } + try { + generateWordDocument(performancePath.value, state, val.supplierName+'_业绩评定表.docx'); + } catch (error){ + ElMessage({ + type: 'warning', + message: '导出失败' + }); + } + +} +const demo = ref([ + { + rage: '86-100', + field: 'good' + }, + { + rage: '71-85', + field: 'fine' + }, + { + rage: '60-70', + field: 'middle' + }, + { + rage: '0-59', + field: 'bad' + }, +]) +const getMatchedField = (num) => { + for (const item of demo.value) { + const [min, max] = item.rage.split('-').map(Number); + if (num >= min && num <= max) { + return item.field; // 返回匹配的字段名(如 "good") + } + } + return null; // 无匹配时返回 null +} +const exportData = () => { + startGeneration() +} +const templatePath = ref('/supplierExample.docx') +const startGeneration = async () => { + const supplierList = {} + supplierList.tableData = dataList.value.map((item,index) => { + return{ + ...item, + num: index+1 + } + }) + try { + generateWordDocument(templatePath.value, supplierList, '合格供方名录.docx'); + } catch (error){ + ElMessage({ + type: 'warning', + message: '导出失败' + }); + } +} +const setTableData = () => { + data.traitList=[{id: 1, name: '成批生产'}, {id: 2, name: '流水线生产'}, {id: 3, name: '单台生产'}, {id: 4, name: '其他'},] + data.facilityList=[{id: 1, name: '齐全、良好'}, {id: 2, name: '基本齐全、尚可'}, {id: 3, name: '不全'}, {id: 4, name: '代理商'},] + data.craftList=[{id: 1, name: '齐备'}, {id: 2, name: '有一部分'}, {id: 3, name: '没有'}, {id: 4, name: '代理商'},] + data.developList=[{id: 1, name: '能自行设计开发新品'}, {id: 2, name: '只能开发简单产品'}, {id: 3, name: '没有自行开发能力,代理商'},] + data.teamWorkList=[{id: 1, name: '是外资企业'}, {id: 2, name: '是合资企业'}, {id: 3, name: '给企业提供产品'}, {id: 4, name: '无对外合作经验'}, {id: 5, name: '有对外合作经验,但不经常发生'},] + data.qualificationList=[{id: 1, name: '营业执照'}, {id: 2, name: '有效期内'}, {id: 3, name: '有效期外'}, {id: 4, name: '高新技术企业'}, {id: 5, name: '有效期内'}, {id: 6, name: '有效期外'}, {id: 7, name: '资质代理商'}, {id: 8, name: '其他资质情况:'},] + data.productList=[{id: 1, name: '通过产品认证'}, {id: 2, name: '没有产品认证'}, {id: 3, name: '通过质量体系认证'}, {id: 4, name: '没有体系认证'}, {id: 5, name: '其他认证(请指出具体内容):'},] +} </script> <style lang="scss"> .pag-container{ -- Gitblit v1.9.2