From 75ad8dcd408a7af732c8f8a655e572408413b612 Mon Sep 17 00:00:00 2001
From: fengyuan_yang <1976974459@qq.com>
Date: Tue, 20 Oct 2026 10:46:17 +0800
Subject: [PATCH 1/2] =?UTF-8?q?2026-10-20=20qms=E5=AF=BC=E5=85=A5=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/modules/qc/qcItem.vue | 3 +-
src/views/modules/qc/qcMethod.vue | 3 +-
src/views/modules/qc/qcPartAttribute.vue | 6 ++--
src/views/modules/qc/qcTemplate.vue | 2 --
src/views/modules/qc/qc_upload.vue | 44 +++++++++++++++++++++---
5 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/src/views/modules/qc/qcItem.vue b/src/views/modules/qc/qcItem.vue
index eef0813..798383a 100644
--- a/src/views/modules/qc/qcItem.vue
+++ b/src/views/modules/qc/qcItem.vue
@@ -1571,8 +1571,7 @@
qcUpload () {
let currentData = {
flag: 'item',
- createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
+ createBy: this.$store.state.user.name
}
//打开组件 去做新增业务
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qcMethod.vue b/src/views/modules/qc/qcMethod.vue
index 1f55f36..67c8068 100644
--- a/src/views/modules/qc/qcMethod.vue
+++ b/src/views/modules/qc/qcMethod.vue
@@ -719,8 +719,7 @@
qcUpload () {
let currentData = {
flag: 'method',
- createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
+ createBy: this.$store.state.user.name
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
diff --git a/src/views/modules/qc/qcPartAttribute.vue b/src/views/modules/qc/qcPartAttribute.vue
index 2e46079..d6d6ec6 100644
--- a/src/views/modules/qc/qcPartAttribute.vue
+++ b/src/views/modules/qc/qcPartAttribute.vue
@@ -3358,8 +3358,7 @@
let currentData = {
flag: flag,
title: title,
- createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
+ createBy: this.$store.state.user.name
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
@@ -3370,8 +3369,7 @@
qcUpload () {
let currentData = {
flag: 'partAttribute',
- createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
+ createBy: this.$store.state.user.name
}
//打开组件 去做新增业务
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qcTemplate.vue b/src/views/modules/qc/qcTemplate.vue
index 7a9dcde..2acf201 100644
--- a/src/views/modules/qc/qcTemplate.vue
+++ b/src/views/modules/qc/qcTemplate.vue
@@ -1825,7 +1825,6 @@
let currentData = {
flag: 'template',
createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
title: '模板导入'
}
this.$nextTick(() => {
@@ -1838,7 +1837,6 @@
let currentData = {
flag: 'templateItem',
createBy: this.$store.state.user.name,
- site: this.$store.state.user.site,
title: '检验项目导入'
}
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qc_upload.vue b/src/views/modules/qc/qc_upload.vue
index 6c067f7..1451be4 100644
--- a/src/views/modules/qc/qc_upload.vue
+++ b/src/views/modules/qc/qc_upload.vue
@@ -2,7 +2,17 @@
- 下载文件模板
+
+ 下载文件模板
+
+
+
+
+
{
+ this.siteList = (data && data.rows) ? data.rows : []
+ if (!this.selectedSite && this.siteList.length) {
+ this.selectedSite = this.siteList[0].siteID
+ }
+ })
+ },
+ getDefaultSite () {
+ return (this.siteList && this.siteList.length) ? this.siteList[0].siteID : ''
+ },
getSiteAndBu () {
let tempData = {
username: this.$store.state.user.name,
@@ -97,8 +122,10 @@ export default {
this.titleCon = this.pageData.title || '文件导入'
this.fileList = []
this.bu = ''
+ this.selectedSite = this.getDefaultSite()
this.saveLoading = false
this.visible = true
+ this.loadSiteList()
this.$nextTick(() => {
if (this.$refs.uploadFile) {
this.$refs.uploadFile.clearFiles()
@@ -122,6 +149,7 @@ export default {
closeDialog(){
this.fileList = []
this.bu = ''
+ this.selectedSite = this.getDefaultSite()
this.saveLoading = false
this.$emit('refreshPageTables');
this.visible = false;
@@ -154,7 +182,7 @@ export default {
return false;
}
if (this.isMasterImport && !this.importSite) {
- this.$message.warning("未获取到当前用户工厂");
+ this.$message.warning("请选择工厂");
return false;
}
if (this.fileList == null || this.fileList.length === 0){
@@ -227,7 +255,7 @@ export default {
partStandard: '物料检验标准导入模板.xlsx'
}
if (!this.importSite) {
- this.$message.warning("未获取到当前用户工厂")
+ this.$message.warning("请选择工厂")
return
}
await downloadQcImportTemplate(this.pageData.flag, this.importSite).then(({data}) => {
@@ -274,4 +302,12 @@ export default {
}
From fe598f145cf589dd00714ec32a0c02b256485c75 Mon Sep 17 00:00:00 2001
From: fengyuan_yang <1976974459@qq.com>
Date: Wed, 21 Oct 2026 13:33:00 +0800
Subject: [PATCH 2/2] =?UTF-8?q?2026-10-21=20qms=E5=AF=BC=E5=85=A5=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/qc/qc.js | 3 +-
src/utils/httpRequest.js | 8 +++
src/views/modules/qc/qcItem.vue | 69 ++++++++--------------
src/views/modules/qc/qcMethod.vue | 71 ++++++++---------------
src/views/modules/qc/qcPartAttribute.vue | 74 +++++++++---------------
src/views/modules/qc/qcTemplate.vue | 71 +++++++++--------------
src/views/modules/qc/qc_upload.vue | 46 +--------------
7 files changed, 115 insertions(+), 227 deletions(-)
diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js
index 6ca76f9..e5a0c5c 100644
--- a/src/api/qc/qc.js
+++ b/src/api/qc/qc.js
@@ -1,4 +1,4 @@
-import { createAPI } from "@/utils/httpRequest.js";
+import { createAPI, createDownloadAPI } from "@/utils/httpRequest.js";
// ===================================== 检验方法 =====================================
export const qcMethodSearch = data => createAPI(`/pms/qc/qcMethodSearch`,'post',data)
@@ -7,6 +7,7 @@ export const qcMethodUpdate = data => createAPI(`/pms/qc/qcMethodUpdate`,'post',
export const qcMethodDelete = data => createAPI(`/pms/qc/qcMethodDelete`,'post',data)
export const uploadMethodExcel = data => createAPI(`/pms/qc/uploadMethodExcel`,'post',data)
export const downloadQcImportTemplate = (flag, site) => createAPI(`/pms/qc/downloadQcImportTemplate?flag=${flag}&site=${encodeURIComponent(site || '')}`,'post','download')
+export const exportQcExcel = (flag, data) => createDownloadAPI(`/pms/qc/exportQcExcel?flag=${encodeURIComponent(flag || '')}`,'post', data)
// ===================================== 检验项目 =====================================
export const qcItemSearch = data => createAPI(`/pms/qc/qcItemSearch`,'post',data)
diff --git a/src/utils/httpRequest.js b/src/utils/httpRequest.js
index a762667..45d7885 100644
--- a/src/utils/httpRequest.js
+++ b/src/utils/httpRequest.js
@@ -166,3 +166,11 @@ export const createAPI = (url, method, data) => {
...config
})
}
+
+export const createDownloadAPI = (url, method, data) => {
+ return instance2({
+ url,
+ method,
+ data
+ })
+}
diff --git a/src/views/modules/qc/qcItem.vue b/src/views/modules/qc/qcItem.vue
index 798383a..ae176c3 100644
--- a/src/views/modules/qc/qcItem.vue
+++ b/src/views/modules/qc/qcItem.vue
@@ -46,20 +46,7 @@
导入
-
- {{ "导出" }}
-
+ 导出
@@ -449,6 +436,7 @@
addItemObject, // 新增项目设备
deleteItemObject, // 删除项目设备
updateItemObject, // 修改项目设备
+ exportQcExcel
} from "@/api/qc/qc.js"
import { getSiteData } from '@/api/board.js'
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
@@ -479,13 +467,7 @@
columnsProp:['createdBy', 'updateBy'],
// 是否收藏
favorite: false,
- // 导出 start
- exportData: [],
- exportName: "检验项目" + this.dayjs().format('YYYYMMDDHHmmss'),
- exportHeader: ["检验项目"],
- exportFooter: [],
- exportList: [],
- // 导出 end
+ exportLoading: false,
searchData: {
site: '',
userName: this.$store.state.user.name,
@@ -1539,39 +1521,36 @@
}
},
- //导出excel
- async createExportData() {
- this.searchData.limit = -1
- this.searchData.page = 1
- await qcItemSearch(this.searchData).then(({data}) => {
- this.exportList= data.page.list;
+ exportExcel () {
+ this.exportLoading = true
+ const query = Object.assign({}, this.searchData, { page: 1, limit: 1000 })
+ exportQcExcel('item', query).then(({data}) => {
+ this.bindExportBlob(data, '检验项目' + this.dayjs().format('YYYYMMDDHHmmss') + '.xlsx')
+ }).catch(() => {
+ this.$message.error('导出失败')
+ }).finally(() => {
+ this.exportLoading = false
})
- return this.exportList;
},
- startDownload() {},
-
- finishDownload() {},
-
- fields () {
- let json = "{"
- this.columnList.forEach((item, index) => {
- if (index == this.columnList.length - 1) {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
- } else {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
- }
- })
- json += "}"
- let s = eval("(" + json + ")")
- return s
+ bindExportBlob (data, fileName) {
+ const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
+ const linkNode = document.createElement('a')
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ linkNode.click()
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
},
// 导入
qcUpload () {
let currentData = {
flag: 'item',
- createBy: this.$store.state.user.name
+ createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site
}
//打开组件 去做新增业务
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qcMethod.vue b/src/views/modules/qc/qcMethod.vue
index 67c8068..6f3b193 100644
--- a/src/views/modules/qc/qcMethod.vue
+++ b/src/views/modules/qc/qcMethod.vue
@@ -44,20 +44,7 @@
查询
新增
导入
-
- {{ "导出" }}
-
+ 导出
@@ -176,7 +163,8 @@
qcMethodUpdate, // 检验方法修改
qcMethodDelete, // 检验方法删除
inspectionTypeSearch, // 搜索所有检验类型
- getSiteAndBuByUserName
+ getSiteAndBuByUserName,
+ exportQcExcel
} from "@/api/qc/qc.js"
import { getSiteData } from '@/api/board.js'
import {getTableDefaultListLanguage, getTableUserListLanguage,updateColumnSize} from "@/api/table.js"
@@ -191,13 +179,7 @@
columnsProp:['createBy', 'updateBy'],
// 是否收藏
favorite: false,
- // 导出 start
- exportData: [],
- exportName: "检验方法" + this.dayjs().format('YYYYMMDDHHmmss'),
- exportHeader: ["检验方法"],
- exportFooter: [],
- exportList: [],
- // 导出 end
+ exportLoading: false,
searchData: {
site: '',
userName: this.$store.state.user.name,
@@ -688,38 +670,35 @@
}
},
- //导出excel
- async createExportData() {
- this.searchData.limit = -1
- this.searchData.page = 1
- await qcMethodSearch(this.searchData).then(({data}) => {
- this.exportList= data.page.list
+ exportExcel () {
+ this.exportLoading = true
+ const query = Object.assign({}, this.searchData, { page: 1, limit: 1000 })
+ exportQcExcel('method', query).then(({data}) => {
+ this.bindExportBlob(data, '检验方法' + this.dayjs().format('YYYYMMDDHHmmss') + '.xlsx')
+ }).catch(() => {
+ this.$message.error('导出失败')
+ }).finally(() => {
+ this.exportLoading = false
})
- return this.exportList
},
- startDownload() {},
-
- finishDownload() {},
-
- fields () {
- let json = "{"
- this.columnList.forEach((item, index) => {
- if (index == this.columnList.length - 1) {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
- } else {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
- }
- })
- json += "}"
- let s = eval("(" + json + ")")
- return s
+ bindExportBlob (data, fileName) {
+ const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
+ const linkNode = document.createElement('a')
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ linkNode.click()
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
},
qcUpload () {
let currentData = {
flag: 'method',
- createBy: this.$store.state.user.name
+ createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
diff --git a/src/views/modules/qc/qcPartAttribute.vue b/src/views/modules/qc/qcPartAttribute.vue
index d6d6ec6..b264f75 100644
--- a/src/views/modules/qc/qcPartAttribute.vue
+++ b/src/views/modules/qc/qcPartAttribute.vue
@@ -71,20 +71,7 @@
物料属性导入
检验模板导入
检验标准导入
-
- {{ "导出" }}
-
+ 导出
@@ -1090,7 +1077,8 @@
updatePatrolConfig as updatePatrolConfigApi,
deletePatrolConfig as deletePatrolConfigApi,
getPatrolOperationDescList as getPatrolOperationDescListApi,
- getPartAttributeFileList
+ getPartAttributeFileList,
+ exportQcExcel
} from "@/api/qc/qc.js"
import { getSiteData } from '@/api/board.js'
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
@@ -1114,13 +1102,7 @@
maintainFlagProps: ['iqcFlag', 'ipqcFlag', 'fqcFlag', 'oqcFlag', 'sqcFlag'],
// 是否收藏
favorite: false,
- // 导出 start
- exportData: [],
- exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
- exportHeader: ["根据物料设置检验模板"],
- exportFooter: [],
- exportList: [],
- // 导出 end
+ exportLoading: false,
tagNo: '',
patrolConfigDialogFlag: false,
patrolConfigLoading: false,
@@ -3317,32 +3299,28 @@
}
},
- //导出excel
- async createExportData() {
- this.searchData.limit = -1
- this.searchData.page = 1
- await qcPartAttributeSearch(this.searchData).then(({data}) => {
- this.exportList= data.page.list
+ exportExcel () {
+ this.exportLoading = true
+ const query = Object.assign({}, this.searchData, { page: 1, limit: 1000 })
+ exportQcExcel('partAttr', query).then(({data}) => {
+ this.bindExportBlob(data, '物料属性' + this.dayjs().format('YYYYMMDDHHmmss') + '.xlsx')
+ }).catch(() => {
+ this.$message.error('导出失败')
+ }).finally(() => {
+ this.exportLoading = false
})
- return this.exportList
},
- startDownload() {},
-
- finishDownload() {},
-
- fields () {
- let json = "{"
- this.columnList.forEach((item, index) => {
- if (index == this.columnList.length - 1) {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
- } else {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
- }
- })
- json += "}"
- let s = eval("(" + json + ")")
- return s
+ bindExportBlob (data, fileName) {
+ const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
+ const linkNode = document.createElement('a')
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ linkNode.click()
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
},
qcPartAttrUpload () {
@@ -3358,7 +3336,8 @@
let currentData = {
flag: flag,
title: title,
- createBy: this.$store.state.user.name
+ createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
@@ -3369,7 +3348,8 @@
qcUpload () {
let currentData = {
flag: 'partAttribute',
- createBy: this.$store.state.user.name
+ createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site
}
//打开组件 去做新增业务
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qcTemplate.vue b/src/views/modules/qc/qcTemplate.vue
index 2acf201..dd22b2e 100644
--- a/src/views/modules/qc/qcTemplate.vue
+++ b/src/views/modules/qc/qcTemplate.vue
@@ -48,20 +48,7 @@
模板导入
检验项目导入
-
- {{ "导出" }}
-
+ 导出
@@ -543,6 +530,7 @@
saveInspectionStandard, // 新增检验标准
goUpItemQC, // 上移项目位置
goDownItemQC,// 下移项目位置
+ exportQcExcel
} from "@/api/qc/qc.js"
import { getSiteData } from '@/api/board.js'
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
@@ -559,13 +547,7 @@
columnsProp:['createBy', 'updateBy'],
// 是否收藏
favorite: false,
- // 导出 start
- exportData: [],
- exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
- exportHeader: ["根据物料设置检验模板"],
- exportFooter: [],
- exportList: [],
- // 导出 end
+ exportLoading: false,
tagNo: '',
searchData: {
site: '',
@@ -1758,14 +1740,28 @@
}
},
- //导出excel
- async createExportData () {
- this.searchData.limit = -1
- this.searchData.page = 1
- await templateSearch(this.searchData).then(({data}) => {
- this.exportList= data.page.list
+ exportExcel () {
+ this.exportLoading = true
+ const query = Object.assign({}, this.searchData, { page: 1, limit: 1000 })
+ exportQcExcel('template', query).then(({data}) => {
+ this.bindExportBlob(data, '检验模板' + this.dayjs().format('YYYYMMDDHHmmss') + '.xlsx')
+ }).catch(() => {
+ this.$message.error('导出失败')
+ }).finally(() => {
+ this.exportLoading = false
})
- return this.exportList
+ },
+
+ bindExportBlob (data, fileName) {
+ const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
+ const linkNode = document.createElement('a')
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ linkNode.click()
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
},
goUp() {
goUpItemQC(this.currentRow).then(({data}) => {
@@ -1802,29 +1798,13 @@
})
},
- startDownload() {},
-
- finishDownload() {},
-
- fields () {
- let json = "{"
- this.columnList.forEach((item, index) => {
- if (index == this.columnList.length - 1) {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
- } else {
- json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
- }
- })
- json += "}"
- let s = eval("(" + json + ")")
- return s
- },
// 模板导入
qcUpload () {
let currentData = {
flag: 'template',
createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site,
title: '模板导入'
}
this.$nextTick(() => {
@@ -1837,6 +1817,7 @@
let currentData = {
flag: 'templateItem',
createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site,
title: '检验项目导入'
}
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qc_upload.vue b/src/views/modules/qc/qc_upload.vue
index 1451be4..fdcddb5 100644
--- a/src/views/modules/qc/qc_upload.vue
+++ b/src/views/modules/qc/qc_upload.vue
@@ -2,17 +2,7 @@
-
- 下载文件模板
-
-
-
-
-
+ 下载文件模板
{
- this.siteList = (data && data.rows) ? data.rows : []
- if (!this.selectedSite && this.siteList.length) {
- this.selectedSite = this.siteList[0].siteID
- }
- })
- },
- getDefaultSite () {
- return (this.siteList && this.siteList.length) ? this.siteList[0].siteID : ''
- },
getSiteAndBu () {
let tempData = {
username: this.$store.state.user.name,
@@ -122,10 +97,8 @@ export default {
this.titleCon = this.pageData.title || '文件导入'
this.fileList = []
this.bu = ''
- this.selectedSite = this.getDefaultSite()
this.saveLoading = false
this.visible = true
- this.loadSiteList()
this.$nextTick(() => {
if (this.$refs.uploadFile) {
this.$refs.uploadFile.clearFiles()
@@ -149,7 +122,6 @@ export default {
closeDialog(){
this.fileList = []
this.bu = ''
- this.selectedSite = this.getDefaultSite()
this.saveLoading = false
this.$emit('refreshPageTables');
this.visible = false;
@@ -181,10 +153,6 @@ export default {
this.$message.warning("请选择BU!");
return false;
}
- if (this.isMasterImport && !this.importSite) {
- this.$message.warning("请选择工厂");
- return false;
- }
if (this.fileList == null || this.fileList.length === 0){
this.$message.error("请先上传文件!");
return false;
@@ -255,7 +223,7 @@ export default {
partStandard: '物料检验标准导入模板.xlsx'
}
if (!this.importSite) {
- this.$message.warning("请选择工厂")
+ this.$message.warning("未获取到当前用户工厂")
return
}
await downloadQcImportTemplate(this.pageData.flag, this.importSite).then(({data}) => {
@@ -302,12 +270,4 @@ export default {
}