10 changed files with 970 additions and 946 deletions
-
59src/api/qc/qc.js
-
2src/views/modules/qc/FAIResultEntry.vue
-
3src/views/modules/qc/IPQCResultEntry.vue
-
1224src/views/modules/qc/IQCResultEntry.vue
-
101src/views/modules/qc/qcFamilyAttribute.vue
-
155src/views/modules/qc/qcItem.vue
-
130src/views/modules/qc/qcMethod.vue
-
53src/views/modules/qc/qcPartAttribute.vue
-
54src/views/modules/qc/qcTemplate.vue
-
135src/views/modules/qc/qc_upload.vue
1224
src/views/modules/qc/IQCResultEntry.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,135 @@ |
|||
<template> |
|||
<div class="customer-css"> |
|||
<el-dialog :title="titleCon" :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-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">将文件拖到此处,或<em>点击上传</em></div> |
|||
</el-upload> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<span slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="saveUploadFile()">保存</el-button> |
|||
<el-button type="primary" @click="closeDialog">关闭</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
uploadExcel, // 导入项目文件 |
|||
uploadTemplateExcel, // 导入模板文件 |
|||
uploadPartAttributeExcel, // 导入物料属性文件 |
|||
uploadFamilyAttributeExcel, // 导入类别属性文件 |
|||
} from "@/api/qc/qc.js" |
|||
export default { |
|||
data() { |
|||
return { |
|||
titleCon: '文件导入', |
|||
visible: false, |
|||
fileList: [], |
|||
pageData: { |
|||
flag: '', |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
//初始化组件的参数 |
|||
init(currentRow) { |
|||
// 获得类别 |
|||
this.pageData = JSON.parse(JSON.stringify(currentRow)) |
|||
//打开页面 |
|||
this.visible = true; |
|||
}, |
|||
// 上传之前 |
|||
beforeUploadHandle(file) { |
|||
let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase() |
|||
if (!(extName === '.xlsx' || extName === '.xls')) { |
|||
this.$message.error('数据导入失败,请选择正确的xlsx模板文件') |
|||
return false |
|||
} |
|||
}, |
|||
/*选择上传文件时*/ |
|||
onChange(file){ |
|||
this.fileList.push(file); |
|||
}, |
|||
/*关闭modal*/ |
|||
closeDialog(){ |
|||
// 刷新报工的页面 |
|||
this.$emit('refreshPageTables'); |
|||
// 关闭当前的页面 |
|||
this.visible = false; |
|||
}, |
|||
/*保修当前的数据*/ |
|||
saveUploadFile(){ |
|||
/*判断文件是否上传*/ |
|||
if(null == this.fileList || 0 == this.fileList.length){ |
|||
this.$message.error("请先上传文件!"); |
|||
return false; |
|||
} |
|||
const formData = new FormData(); |
|||
formData.append("file", this.fileList[0].raw); |
|||
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); |
|||
} |
|||
}) |
|||
} 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); |
|||
} |
|||
}) |
|||
}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); |
|||
} |
|||
}) |
|||
}else if (this.pageData.flag == 'familyAttribute'){ |
|||
uploadFamilyAttributeExcel(formData).then(({data}) => { |
|||
if (data.code === 0) { |
|||
this.$message.success(data.msg); |
|||
// 清空文件上传记录 |
|||
this.$refs.uploadFile.clearFiles(); |
|||
// 关闭窗口并刷新页面 |
|||
this.closeDialog(); |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
} |
|||
}, |
|||
created() { |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
<style scoped lang="scss"> |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue