8 changed files with 1202 additions and 405 deletions
-
16cclqms-vue/src/api/qc/qc.js
-
22cclqms-vue/src/i18n/locales/qc.cn.js
-
22cclqms-vue/src/i18n/locales/qc.en.js
-
170cclqms-vue/src/views/modules/qc/IQCBatchPurchaseAdd.vue
-
1cclqms-vue/src/views/modules/qc/IQCResultEntry.vue
-
133cclqms-vue/src/views/modules/qc/file_collect_upload.vue
-
1193cclqms-vue/src/views/modules/qc/qcPartAttribute.vue
-
44cclqms-vue/src/views/modules/qc/qc_spec_upload.vue
@ -0,0 +1,133 @@ |
|||
<template> |
|||
<div class="customer-css"> |
|||
<el-dialog :title="$t('qc.fileCollectImport.dialogTitle')" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog"> |
|||
<el-form :inline="true" label-position="top" label-width="80px"> |
|||
<el-button type="primary" @click="downloadFile()">{{ $t('qc.uploadCommon.downloadTemplate') }}</el-button> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls" |
|||
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" style="text-align: left;"> |
|||
<i class="el-icon-upload"></i> |
|||
<div class="el-upload__text">{{ $t('qc.fileCollectImport.dragHintComma') }}<em>{{ $t('qc.common.clickUpload') }}</em></div> |
|||
</el-upload> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<span slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="saveUploadFile()">{{ $t('qc.common.save') }}</el-button> |
|||
<el-button type="primary" @click="closeDialog">{{ $t('qc.common.close') }}</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
qcPartFileCollectUpload, |
|||
downloadQcPartFileCollectTemplate, |
|||
} from '@/api/qc/qc.js' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
visible: false, |
|||
fileList: [], |
|||
pageData: { |
|||
site: '', |
|||
partNo: '', |
|||
createBy: '' |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
init(currentRow) { |
|||
this.pageData = JSON.parse(JSON.stringify(currentRow)) |
|||
this.fileList = [] |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
if (this.$refs.uploadFile) { |
|||
this.$refs.uploadFile.clearFiles() |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
beforeUploadHandle(file) { |
|||
let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase() |
|||
if (!(extName === '.xlsx' || extName === '.xls')) { |
|||
this.$message.error(this.$t('qc.common.badXlsxTemplate')) |
|||
return false |
|||
} |
|||
}, |
|||
|
|||
onChange(file) { |
|||
this.fileList.push(file) |
|||
}, |
|||
|
|||
closeDialog() { |
|||
this.fileList = [] |
|||
if (this.$refs.uploadFile) { |
|||
this.$refs.uploadFile.clearFiles() |
|||
} |
|||
this.visible = false |
|||
}, |
|||
|
|||
saveUploadFile() { |
|||
if (null == this.fileList || this.fileList.length === 0) { |
|||
this.$message.error(this.$t('qc.common.pleaseUploadFile')) |
|||
return false |
|||
} |
|||
const formData = new FormData() |
|||
formData.append('file', this.fileList[0].raw) |
|||
formData.append('site', this.pageData.site) |
|||
formData.append('partNo', this.pageData.partNo) |
|||
formData.append('createBy', this.pageData.createBy) |
|||
|
|||
qcPartFileCollectUpload(formData).then(({ data }) => { |
|||
if (data.code === 0) { |
|||
this.$message.success(data.msg) |
|||
this.$refs.uploadFile.clearFiles() |
|||
this.fileList = [] |
|||
this.visible = false |
|||
this.$emit('refreshFileCollectList') |
|||
} else { |
|||
let message = data.msg.split(';') |
|||
this.$alert(message[0] + '<br/>' + (message[1] || ''), this.$t('qc.common.importFailTitle'), { |
|||
confirmButtonText: this.$t('qc.common.confirm'), |
|||
dangerouslyUseHTMLString: true |
|||
}) |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error(this.$t('qc.entry.importFailContent')) |
|||
}) |
|||
}, |
|||
|
|||
downloadFile() { |
|||
downloadQcPartFileCollectTemplate().then((response) => { |
|||
const blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) |
|||
const fileName = this.$t('qc.fileCollectImport.templateFileName') |
|||
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) |
|||
}).catch(() => { |
|||
this.$message.error(this.$t('qc.common.downloadTemplateFail')) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.customer-dialog { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
.customer-upload { |
|||
margin-top: 10px; |
|||
} |
|||
</style> |
|||
1193
cclqms-vue/src/views/modules/qc/qcPartAttribute.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue