新增配件故障率导入
This commit is contained in:
parent
4d87561462
commit
2d8e2c3c2b
@ -285,6 +285,20 @@ export default {
|
||||
return await http.post(this.url, data);
|
||||
},
|
||||
},
|
||||
import:{
|
||||
url: `${config.API_URL}/spare.parts.failure.rate.batch.import`,
|
||||
name: "备件故障导入",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url,params,{'Content-Type': 'multipart/form-data'});
|
||||
}
|
||||
},
|
||||
template:{
|
||||
url: `${config.API_URL}/spare.parts.failure.rate.import.template`,
|
||||
name: "备件故障率导入模版",
|
||||
post: async function (params) {
|
||||
return await http.get(this.url,params,{responseType: 'arraybuffer'});
|
||||
}
|
||||
},
|
||||
},
|
||||
bom:{
|
||||
list:{
|
||||
|
||||
@ -112,7 +112,7 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
getWsResult(res){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45)){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45 || res.data.type == 48)){
|
||||
if(this.type == res.data.type){
|
||||
this.importInfo = res.data;
|
||||
this.progressShow = true;
|
||||
|
||||
@ -5,6 +5,14 @@
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" :size="size" icon="el-icon-plus" @click="add">新增</el-button>
|
||||
<el-button plain type="danger" :disabled="selection.length==0?true:false" :size="size" icon="el-icon-Delete" @click="all_delete"></el-button>
|
||||
<scImport ref="scImport" :size="size" :httpDisabled="httpDisabled" type="48" title="批量导入物料成本" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<template #header>
|
||||
<el-button type="primary" :size="size" plain @click="importFile">批量导入</el-button>
|
||||
</template>
|
||||
<template #download>
|
||||
<div @click="importTemplate">下载导入模版</div>
|
||||
</template>
|
||||
</scImport>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
|
||||
@ -45,6 +53,7 @@ export default {
|
||||
data(){
|
||||
return{
|
||||
size:'small',
|
||||
httpDisabled:false,
|
||||
setMap:{
|
||||
|
||||
},
|
||||
@ -73,6 +82,36 @@ export default {
|
||||
handleSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
// 批量导入
|
||||
importFile(){
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.scImport.importFile();
|
||||
})
|
||||
},
|
||||
async importTemplate() {
|
||||
const res = await this.$API.setup.spare.template.post();
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "配件故障率配置模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
eLink.click();
|
||||
URL.revokeObjectURL(eLink.href);
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
this.httpDisabled = true;
|
||||
const res = await this.$API.setup.spare.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user