# Conflicts:
#	src/views/Order/formula.vue
master
Yang 3 years ago
commit 2ddd4d3a55

@ -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;
}

@ -63,6 +63,12 @@
<template v-slot:FFactoryCode="{ data }"> <template v-slot:FFactoryCode="{ data }">
{{ data.FFactoryCode }} {{ data.FFactoryCode }}
</template> </template>
<template v-slot:FConversionPersonnel="{ data }">
{{ data.FConversionPersonnel }}
</template>
<template v-slot:FDevDate="{ data }">
{{ data.FDevDate }}
</template>
<template v-slot:FAddDate="{ data }"> <template v-slot:FAddDate="{ data }">
{{ data.FAddDate }} {{ data.FAddDate }}
</template> </template>
@ -138,12 +144,12 @@
}, },
{ {
title: "转规格人员", title: "转规格人员",
key: "", key: "FConversionPersonnel",
width: "110px" width: "110px"
}, },
{ {
title: "开发日期", title: "开发日期",
key: "", key: "FDevDate",
width: "110px" width: "110px"
}, },
{ {
@ -253,12 +259,14 @@
this.postData.FPageIndex = this.pageInfo.current; this.postData.FPageIndex = this.pageInfo.current;
this.postData.FPageSize = this.pageInfo.limit; this.postData.FPageSize = this.pageInfo.limit;
let result = await getPageList(this.postData, "Formula"); let result = await getPageList(this.postData, "Formula");
console.log('result', result);
result.Data.List = result.Data.List || []; result.Data.List = result.Data.List || [];
result.Data.List.forEach((item) => { result.Data.List.forEach((item) => {
let type = this.typeList.find(s => s.FValue == item.FType); let type = this.typeList.find(s => s.FValue == item.FType);
item.FTypeName = type == null ? item.FType : type.FName; item.FTypeName = type == null ? item.FType : type.FName;
item.FAddDate = item.FAddDate == null ? "" : this.dateFormat(item.FAddDate); item.FAddDate = item.FAddDate == null ? "" : this.dateFormat(item.FAddDate);
item.FEditDate = item.FEditDate == null ? "" : this.dateFormat(item.FEditDate); item.FEditDate = item.FEditDate == null ? "" : this.dateFormat(item.FEditDate);
item.FDevDate = item.FDevDate == null ? "" : this.dateFormat(item.FDevDate);
}); });
this.pageInfo.total = result.Data.Total || 0; this.pageInfo.total = result.Data.Total || 0;
this.dataList = result.Data.List; this.dataList = result.Data.List;

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

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

@ -18,6 +18,8 @@
</lay-button> </lay-button>
<lay-button size="sm" @click="downView" type="primary">导出视图 <lay-button size="sm" @click="downView" type="primary">导出视图
</lay-button> </lay-button>
<lay-button size="sm" @click="upSAP" type="primary">物料上传
</lay-button>
</template> </template>
<template v-for="item in editColumn" v-slot:[item.key]="{ data }"> <template v-for="item in editColumn" v-slot:[item.key]="{ data }">
<lay-select v-if="item.key == 'FTypeID1'" size="sm" v-model="data['FTypeID1']" <lay-select v-if="item.key == 'FTypeID1'" size="sm" v-model="data['FTypeID1']"
@ -109,6 +111,9 @@ import {
getInfoData, getInfoData,
GetMaterialInfoList GetMaterialInfoList
} from "/src/api/api/materialType"; } from "/src/api/api/materialType";
import {
uploadViewMaterial,
} from "/src/api/api/sapUpload";
import OperateLog from "./OperateLog.vue"; import OperateLog from "./OperateLog.vue";
import FormulaView from "./FormulaView.vue"; import FormulaView from "./FormulaView.vue";
import FreezingColumnSetting from './FreezingColumnSetting.vue'; import FreezingColumnSetting from './FreezingColumnSetting.vue';
@ -623,6 +628,38 @@ export default {
window.location.href = result.Data window.location.href = result.Data
} }
}, },
async upSAP() {
let uploadList = []
this.dataList.forEach(item => {
let uploadItem = ref({})
for (var key in item) {
let cols = this.dataColumn.filter(c => c.key == key)
if (cols && cols.length > 0) {
let keyName = cols[0]["category"] + "." + cols[0]["title"]
uploadItem[keyName] = item[key]
}
}
if (uploadItem) {
uploadList.push(uploadItem)
}
})
if (uploadList) {
let idx = layer.load(2);
let result = await uploadViewMaterial(uploadList)
layer.close(idx);
if (result > 0) {
layer.msg('物料上传成功');
} else {
layer.msg('物料上传失败');
}
}
}
} }
} }
</script> </script>

Loading…
Cancel
Save