Browse Source

2025.05.19 qms 物料属性设置导入优化

master
jiayang yue 10 months ago
parent
commit
985dffd4d6
  1. 1
      src/views/modules/qc/qcPartAttribute.vue
  2. 64
      src/views/modules/qc/qc_upload.vue

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

@ -2277,6 +2277,7 @@
flag: 'partAttribute',
createBy: this.$store.state.user.name,
site: this.$store.state.user.site,
buNo: this.userBuList[0].buNo.split('_')[1],
}
//
this.$nextTick(() => {

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

@ -14,7 +14,7 @@
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveUploadFile()">保存</el-button>
<el-button type="primary" :loading="uploadLoading" @click="saveUploadFile()">保存</el-button>
<el-button type="primary" @click="closeDialog">关闭</el-button>
</span>
</el-dialog>
@ -38,10 +38,12 @@ export default {
titleCon: '文件导入',
visible: false,
fileList: [],
uploadLoading: false,
pageData: {
flag: '',
createBy: '',
site: ''
site: '',
buNo: '',
},
}
},
@ -68,6 +70,7 @@ export default {
/*关闭modal*/
closeDialog () {
this.fileList = []
this.$refs.uploadFile.clearFiles()
//
this.$emit('refreshPageTables')
//
@ -75,64 +78,47 @@ export default {
},
/*保修当前的数据*/
saveUploadFile () {
this.uploadLoading = true
/*判断文件是否上传*/
if (null == this.fileList || 0 == this.fileList.length) {
this.$message.error("请先上传文件!")
this.uploadLoading = false
return false
}
const formData = new FormData()
formData.append("file", this.fileList[0].raw)
formData.append("createBy", this.pageData.createBy)
formData.append("site", this.pageData.site)
formData.append("buNo", this.pageData.buNo)
// flag
let promise
if (this.pageData.flag === 'item') {
uploadExcel(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.$refs.uploadFile.clearFiles()
//
this.closeDialog()
} else {
this.$message.warning(data.msg)
}
})
promise = uploadExcel(formData)
} else if (this.pageData.flag === 'template') {
uploadTemplateExcel(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.$refs.uploadFile.clearFiles()
//
this.closeDialog()
} else {
this.$message.warning(data.msg)
}
})
promise = uploadTemplateExcel(formData)
} else if (this.pageData.flag === 'partAttribute') {
uploadPartAttributeExcel(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.$refs.uploadFile.clearFiles()
//
this.closeDialog()
}else {
this.$message.warning(data.msg)
}
})
promise = uploadPartAttributeExcel(formData)
} else if (this.pageData.flag === 'familyAttribute') {
uploadFamilyAttributeExcel(formData).then(({data}) => {
promise = uploadFamilyAttributeExcel(formData)
}
promise
.then(({ data }) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.$refs.uploadFile.clearFiles()
//
this.closeDialog()
} else {
this.$message.warning(data.msg)
}
})
}
.catch(err => {
this.$message.error("上传失败,请稍后重试")
console.error(err)
})
.finally(() => {
this.uploadLoading = false // loading
})
},
//
async downloadFile () {

Loading…
Cancel
Save