Browse Source

Merge remote-tracking branch 'origin/master'

master
常熟吴彦祖 1 month ago
parent
commit
a1a97ea771
  1. 3
      src/api/qc/qc.js
  2. 8
      src/utils/httpRequest.js
  3. 68
      src/views/modules/qc/qcItem.vue
  4. 70
      src/views/modules/qc/qcMethod.vue
  5. 72
      src/views/modules/qc/qcPartAttribute.vue
  6. 69
      src/views/modules/qc/qcTemplate.vue
  7. 4
      src/views/modules/qc/qc_upload.vue

3
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)

8
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
})
}

68
src/views/modules/qc/qcItem.vue

@ -46,20 +46,7 @@
</el-form-item>
<el-form-item label=" ">
<el-button v-if="authSave" type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
<el-button type="primary" :loading="exportLoading" @click="exportExcel()">导出</el-button>
</el-form-item>
</el-form>
@ -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,32 +1521,28 @@
}
},
//导出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)
},
// 导入
@ -1572,7 +1550,7 @@
let currentData = {
flag: 'item',
createBy: this.$store.state.user.name,
site: this.$store.state.user.site,
site: this.$store.state.user.site
}
//打开组件 去做新增业务
this.$nextTick(() => {

70
src/views/modules/qc/qcMethod.vue

@ -44,20 +44,7 @@
<el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
<el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
<el-button type="primary" :loading="exportLoading" @click="exportExcel()">导出</el-button>
</el-form-item>
</el-form>
@ -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,39 +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,
site: this.$store.state.user.site,
site: this.$store.state.user.site
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)

72
src/views/modules/qc/qcPartAttribute.vue

@ -71,20 +71,7 @@
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcPartAttrUpload()">物料属性导入</el-button>
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcPartTemplateUpload()">检验模板导入</el-button>
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcPartStandardUpload()">检验标准导入</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
<el-button type="primary" :loading="exportLoading" @click="exportExcel()">导出</el-button>
</el-form-item>
</el-form>
@ -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 () {
@ -3359,7 +3337,7 @@
flag: flag,
title: title,
createBy: this.$store.state.user.name,
site: this.$store.state.user.site,
site: this.$store.state.user.site
}
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
@ -3371,7 +3349,7 @@
let currentData = {
flag: 'partAttribute',
createBy: this.$store.state.user.name,
site: this.$store.state.user.site,
site: this.$store.state.user.site
}
//打开组件 去做新增业务
this.$nextTick(() => {

69
src/views/modules/qc/qcTemplate.vue

@ -48,20 +48,7 @@
<el-form-item :label="' '">
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcUpload()">模板导入</el-button>
<el-button v-if="!authSave" type="primary" icon="el-icon-upload" @click="qcItemDetailUpload()">检验项目导入</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
<el-button type="primary" :loading="exportLoading" @click="exportExcel()">导出</el-button>
</el-form-item>
</el-form>
@ -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,23 +1798,6 @@
})
},
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 () {

4
src/views/modules/qc/qc_upload.vue

@ -153,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;

Loading…
Cancel
Save