SAP数据上传

master
leo 3 years ago
parent 7abf25f62f
commit 63b57abc9e

@ -0,0 +1,28 @@
import http from '../http';
// 通用BOM上载
export async function uploadBom(params: any) {
let result = {};
await http.post('/api/SapUpload/UploadBom', params).then((data) => {
result = data.Data;
});
return result;
}
// 物料上载
export async function uploadViewMaterial(params: any) {
let result = {};
await http.post('/api/SapUpload/UploadViewMaterial', params).then((data) => {
result = data.Data;
});
return result;
}
// 通用生产版本上传
export async function uploadProductVersion(params: any) {
let result = {};
await http.post('/api/SapUpload/UploadProductVersion', params).then((data) => {
result = data.Data;
});
return result;
}

@ -84,7 +84,7 @@
</lay-container>
</lay-scroll>
<lay-layer area="90%" v-model="showEditBox" title="视图查看">
<ShowView :viewList="viewList" :viewHeight="viewHeight" @cancelClick="cancelClick"></ShowView>
<ShowView :viewList="viewList" :viewHeight="viewHeight" :viewType="viewType" @cancelClick="cancelClick"></ShowView>
</lay-layer>
</div>
</template>
@ -248,6 +248,7 @@
const showEditBox = ref(false);
const viewList = ref([]);
const viewHeight = ref(500);
const viewType = ref(0);
return {
dataList,
dataColumn,
@ -255,7 +256,8 @@
viewTypeCount,
showEditBox,
viewList,
viewHeight
viewHeight,
viewType
}
},
props: {
@ -289,10 +291,11 @@
let result = await getBasicRoleList({
FRoleType: 39
}) || [];
console.log('result', result);
console.log('this.dataInfoObj', this.dataInfoObj);
let dataList = [];
let hasType = this.dataInfoObj.FViewType.split(',');
console.log(result);
console.log(hasType);
result.forEach((item) => {
let viewData = dataList.find(s => s.name == item.FName) || null;
if (viewData == null) {
@ -311,7 +314,7 @@
if (item.FRemark.indexOf("导出") != -1) viewData.outCode = item.FCode;
}
});
console.log(dataList)
this.dataList = dataList;
},
async _getTeamworkView(data, type) {
@ -322,7 +325,8 @@
FViewType: viewType,
FType: type,
HalfId : this.dataInfoObj.FMaterialHalfIDs
};
};
this.viewType = viewType;
if (this.dataInfoObj.FProgress == "100" || this.dataInfoObj.FProgress == "100%") {
postData.FFinish = 1;
}

@ -2,6 +2,10 @@
<lay-container fluid="true" class="content-box">
<lay-table v-if="dataColumn.length>0" :height="viewHeight+'px'" :columns="dataColumn" :data-source="dataList"
:row-style="rowStyle">
<template v-slot:toolbar>
<lay-button v-if="this.buttonName" size="sm" type="primary" @click="upload">{{ buttonName }}
</lay-button>
</template>
</lay-table>
</lay-container>
</template>
@ -19,7 +23,12 @@
import {
ref
} from 'vue';
import {
uploadViewMaterial,
uploadProductVersion,
uploadBom
} from "/src/api/api/sapUpload";
import { layer } from '@layui/layer-vue';
export default {
setup() {
const dataColumn = ref([]);
@ -32,12 +41,14 @@
if (rowIndex > dataColor.value[idx]) color = "color:#" + colors[idx];
}
return color;
}
};
const buttonName = ref("");
return {
dataColumn,
dataList,
dataColor,
rowStyle,
buttonName
}
},
props: {
@ -48,9 +59,24 @@
viewHeight: {
type: Number,
default: () => 600,
},
viewType: {
type: Number,
default: () => 0
}
},
mounted() {
if (this.viewType == 1) {
this.buttonName = "物料上传"
}
if (this.viewType == 4) {
this.buttonName = "通用生产版本上传"
}
if (this.viewType == 5) {
this.buttonName = "通用BOM上传"
}
this.initPage();
},
methods: {
@ -63,6 +89,7 @@
}];
let dataList = [];
let dataColor = []
this.viewList.forEach((item) => {
if (item.length > 0) {
if (dataColumn.length == 1) {
@ -90,6 +117,46 @@
},
cancelClick() {
this.$emit('cancelClick', false);
},
async upload() {
if (this.viewType == 1) {
let idx = layer.load(2);
let result = await uploadViewMaterial(this.dataList)
console.log('result', result);
layer.close(idx);
if (result > 0) {
layer.msg('物料上传成功');
} else {
layer.msg('物料上传失败');
}
}
if (this.viewType == 4) {
let idx = layer.load(2);
let result = await uploadProductVersion(this.dataList)
console.log('result', result);
layer.close(idx);
if (result > 0) {
layer.msg('通用生产版本上传');
} else {
layer.msg('通用生产版本上传');
}
}
if (this.viewType == 5) {
let idx = layer.load(2);
let result = await uploadBom(this.dataList)
console.log('result', result);
layer.close(idx);
if (result > 0) {
layer.msg('通用BOM上传成功');
} else {
layer.msg('通用BOM上传失败');
}
}
}
}
}

Loading…
Cancel
Save