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', flag: 'partAttribute',
createBy: this.$store.state.user.name, createBy: this.$store.state.user.name,
site: this.$store.state.user.site, site: this.$store.state.user.site,
buNo: this.userBuList[0].buNo.split('_')[1],
} }
// //
this.$nextTick(() => { this.$nextTick(() => {

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

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

Loading…
Cancel
Save