diff --git a/vue/src/views/pg-fis/basedate/m100BIll/detail.vue b/vue/src/views/pg-fis/basedate/m100BIll/detail.vue index 5ba51a93..25108fdd 100644 --- a/vue/src/views/pg-fis/basedate/m100BIll/detail.vue +++ b/vue/src/views/pg-fis/basedate/m100BIll/detail.vue @@ -219,6 +219,11 @@ export default { /** 列表字段 */ getDefaultField() { var tempsTabs = []; + tempsTabs.push({ + label: "总成编号", + prop: "erpAssemblyCode", + width: 160, + }); tempsTabs.push({ label: "总成名称", prop: "erpAssemblyName", @@ -264,8 +269,10 @@ export default { getList() { this.listLoading = true; console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); + //alert("详表条件:" + JSON.stringify(this.customerInfo.parentId)); + let vehicleAssemblyId = { vehicleAssemblyId: this.customerInfo.parentId }; this.$axios - .gets("/api/newjit/bill-m100/"+ this.customerInfo.parentId) + .gets("/api/newjit/assembly-cfg-vehicle/list", vehicleAssemblyId) .then((response) => { this.list = response; setTimeout(() => { diff --git a/vue/src/views/pg-fis/basedate/m100BIll/index.vue b/vue/src/views/pg-fis/basedate/m100BIll/index.vue index 789de8c9..84b9ed75 100644 --- a/vue/src/views/pg-fis/basedate/m100BIll/index.vue +++ b/vue/src/views/pg-fis/basedate/m100BIll/index.vue @@ -272,12 +272,20 @@ - + filterable + :disabled="false" + @change="getVModel" + > + + @@ -288,7 +296,8 @@ @@ -315,7 +324,7 @@ @@ -327,7 +336,7 @@ type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择时间" - :disabled="isEdit" + :disabled="false" > @@ -344,7 +353,7 @@ @@ -446,7 +456,6 @@ border highlight-current-row style="width: 95%;margin:10px" - @row-click="handleRowClick" > @@ -652,20 +661,52 @@ export default { BillType: 2, //UserId: "00000000-0000-0000-0000-000000000000", }, - form:{ - knr:"", - vehicleModelCode:"", - vin:"", - hostSN:"", - onlineTimeVale:"", + form: + { leftdetails:[], rightdetails:[], }, + saveform:{ + m100Bill: + { + knr:undefined, + vehicleModelCode:undefined, + vin:undefined, + hostSN:undefined, + onlineTime:undefined, + billStatus:2, + billM100Parts:[], + }, + erpAssemblyList: + [ + // { + // erpAssemblyCode:undefined, + // erpAssemblyName:undefined, + // vehicleModel:undefined, + // //isCover: true, + // details: undefined, + // // { + // // partCode: undefined, + // // partNum: 1, + // // description: undefined, + // // isKey: false + // // } + // }, + ] + + // #region + /* + + */ + // #endregion + }, + rightAlldetails:[], page: 1, // 显示搜索条件 showSearch: true, bomUnit, multipleSelection: [], + multipLeLeftSelection:[], drawer: false, dialogFormVisible: false, formTitle: "", @@ -673,14 +714,16 @@ export default { formLoading: false, tableHeight: document.documentElement.clientHeight - 335, detailTableHeight:250, - details:[], //修改子表数据源 + //details:[], //修改子表数据源 PLList:[],//产线下拉 PLChildList:[],//筛选后产线下拉 vehicleModelQuery:{ dicTypeName:"派格车型", }, vehicleModelList:[],//车型list - productTypeList:[{id:1,name:'门板'},{id:2,name:'柱护板'}] + productTypeList:[{id:1,name:'门板'},{id:2,name:'柱护板'}], + gettime:"", + KNRlist:null, }; }, mounted() { @@ -694,6 +737,7 @@ export default { }); }, created() { + //this.getKNRList(); this.getList(); this.getProductLine(); }, @@ -750,7 +794,8 @@ export default { //抽屉 handleDrawerOpen(param) { this.drawer = true; - var parentId = param.id; //主键id + //console.log(param) + var parentId = param.assemblyID; //主键id this.customerInfos = [ { ParentId: parentId, @@ -760,17 +805,73 @@ export default { handleDrawerClose(done) { done(); }, + getCurrentTime() { + //获取当前时间并打印 + var _this = this; + let yy = new Date().getFullYear(); + let mm = new Date().getMonth()+1; + let dd = new Date().getDate(); + let hh = new Date().getHours()<10 ? '0'+new Date().getHours() : new Date().getHours();; + let mf = new Date().getMinutes()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes(); + let ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds(); + _this.gettime = yy+'-'+mm+'-'+dd+' '+hh+':'+mf+':'+ss; + }, save() { this.$refs.form.validate((valid) => { if (valid) { - console.log("保存参数:" + JSON.stringify(this.form)); - console.log(this.form); + this.saveform.m100Bill.hostSN = this.form.hostSN; + this.saveform.m100Bill.knr = this.form.knr; + this.saveform.m100Bill.vin = this.form.vin; + this.saveform.m100Bill.onlineTime = this.form.onlineTime; + this.saveform.m100Bill.vehicleModelCode = this.form.vehicleModelCode; + this.getCurrentTime(); + this.saveform.m100Bill.description = "无"; + this.saveform.m100Bill.receiveTime = this.gettime; + //判断最后一次右侧数据rightdetails是否在右侧全部数据rightAlldetails中 + this.form.rightdetails.forEach(element => { + var tlist = this.rightAlldetails.filter(u => u.erpAssemblyCode === element.erpAssemblyCode && u.partCode === element.partCode + && u.partName === element.partName && u.partNum === element.partNum); + if(tlist.length === 0) + { + this.rightAlldetails.push(element); + } + }); + + //this.saveform.erpAssemblyList.details = {}; + //console.log("当前左侧数据"); + //console.log(this.form.leftdetails); + //console.log("当前右侧显示数据"); + //console.log(this.form.rightdetails); + //console.log("当前右侧全部数据"); + //console.log(this.rightAlldetails); + + /**左右关联拼接最终erpAssemblyList格式 */ + this.form.leftdetails.forEach((element,i) => { + var templist = this.rightAlldetails.filter(u => u.erpAssemblyCode === element.erpAssemblyCode); + let obj = {}; + obj.erpAssemblyCode = element.erpAssemblyCode; + obj.erpAssemblyName = element.erpAssemblyName; + obj.vehicleModel = element.vehicleModel; + obj.details = []; + + templist.forEach(detail => { + if(detail.partCode !== "" && detail.partCode !== undefined) + { + obj.details.push(detail); + } + }); + this.saveform.erpAssemblyList.push(obj); + }); + + //console.log(this.saveform); + console.log("保存参数:" + JSON.stringify(this.saveform)); this.formLoading = true; if (this.isEdit) { //修改 this.$axios - .puts("/api/newjit/new-m100" + this.form.id, this.form) + .puts("/api/newjit/new-m100/" + this.multipleSelection[0].id,this.saveform) .then((response) => { + console.log(response); this.formLoading = false; this.$notify({ title: "成功", @@ -783,12 +884,26 @@ export default { }) .catch(() => { this.formLoading = false; + console.log("error"); + this.saveform = { + m100Bill: + { + knr:undefined, + vehicleModelCode:undefined, + vin:undefined, + hostSN:undefined, + onlineTime:undefined, + billStatus:2, + billM100Parts:[], + }, + erpAssemblyList:[], + }; }); } else { //insert添加 - console.log(JSON.stringify(this.form)); + console.log(JSON.stringify(this.saveform)); this.$axios - .posts("/api/newjit/assembly-cfg-erp", this.form) + .posts("/api/newjit/new-m100", this.saveform) .then((response) => { this.formLoading = false; this.$notify({ @@ -802,6 +917,19 @@ export default { }) .catch(() => { this.formLoading = false; + this.saveform = { + m100Bill: + { + knr:undefined, + vehicleModelCode:undefined, + vin:undefined, + hostSN:undefined, + onlineTime:undefined, + billStatus:2, + billM100Parts:[], + }, + erpAssemblyList:[], + }; }); } } @@ -809,6 +937,7 @@ export default { }, /** 新增 */ handleCreate() { + this.getKNRList(); if (this.$refs["form"] !== undefined) { this.$nextTick(() => { this.$refs["form"].resetFields(); @@ -817,15 +946,44 @@ export default { this.formTitle = "新增"; this.isEdit = false; this.form = {}; - this.details = []; + this.rightAlldetails = []; + this.saveform = { + m100Bill: + { + knr:undefined, + vehicleModelCode:undefined, + vin:undefined, + hostSN:undefined, + onlineTime:undefined, + billStatus:2, + billM100Parts:[], + }, + erpAssemblyList:[], + }; + //this.details = []; this.getvehicleModel(); this.dialogFormVisible = true; }, /** 修改 */ handleUpdate(row) { + this.getKNRList(); this.formTitle = "修改"; this.isEdit = true; - this.details = []; + this.rightAlldetails = []; + this.saveform = { + m100Bill: + { + knr:undefined, + vehicleModelCode:undefined, + vin:undefined, + hostSN:undefined, + onlineTime:undefined, + billStatus:2, + billM100Parts:[], + }, + erpAssemblyList:[], + }; + //this.details = []; this.getvehicleModel(); if (this.multipleSelection.length != 1) { this.$message({ @@ -853,14 +1011,14 @@ export default { // // // }, // }); - this.$confirm("是否删除" + this.multipleSelection[0].erpAssemblyCode + "?", "提示", { + this.$confirm("是否删除底盘号" + this.multipleSelection[0].vin + "的数据?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", }) .then(() => { this.$axios - .deletes("/api/newjit/assembly-cfg-erp/", this.multipleSelection[0].id) + .deletes("/api/newjit/new-m100/"+ this.multipleSelection[0].id) .then((response) => { const index = this.list.indexOf(this.multipleSelection[0]); this.$notify({ @@ -884,9 +1042,22 @@ export default { this.$axios .gets("/api/newjit/new-m100/" + id) .then((response) => { + //console.log(response); this.form = response.item.m100Bill; - //this.details = response.item.details; - //console.log(this.details); + this.form.rightdetails = []; + this.form.leftdetails = response.item.erpAssemblyList; + response.item.erpAssemblyList.forEach((element,i) => { + element.details.forEach(item => { + item.erpAssemblyCode = element.erpAssemblyCode; + this.rightAlldetails.push(item); + if( i === 0 ) + { + this.form.rightdetails.push(item); + } + }); + //console.log(this.rightAlldetails); + //console.log(this.form.rightdetails); + }); }); }, /** 导出功能 */ @@ -975,6 +1146,7 @@ export default { } }, + /**左增加 */ handleAddLeftDetails() { this.$forceUpdate(); if (this.form.leftdetails === undefined) { @@ -984,33 +1156,64 @@ export default { let obj = {}; obj.erpAssemblyCode = ""; obj.erpAssemblyName = ""; - obj.vehicleModel = this.form.vehicleModel; + obj.vehicleModel = this.form.vehicleModelCode; - console.log(this.form.leftdetails); + //console.log(this.form.leftdetails); this.form.leftdetails.push(obj); //console.log(688); }, + /**右增加 */ handleAddRightDetails() { this.$forceUpdate(); - if (this.form.rightdetails === undefined) { - this.form.rightdetails = []; - //console.log(679); - } let obj = {}; - obj.customerPartCode = ""; - obj.customerpartName = ""; - obj.partQty= ""; + //判断是否选择了左侧的数据 + //console.log(this.multipLeLeftSelection); + if(this.multipLeLeftSelection.length !== 1) + { + this.$message({ + message: "必须选择单行总成", + type: "warning", + }); + return; + } + else + { + // if (this.form.rightdetails === undefined) { + // this.form.rightdetails = []; + // this.form.rightdetails.erpAssemblyCode = this.multipLeLeftSelection[0].erpAssemblyCode; + // //console.log(679); + // } + } + obj.erpAssemblyCode = this.multipLeLeftSelection[0].erpAssemblyCode; + obj.partCode = ""; + obj.description = ""; + obj.partNum= 1; - console.log(this.form.rightdetails); + //console.log(this.form.rightdetails); this.form.rightdetails.push(obj); //console.log(688); }, - handleLeftDeleteDetails(index){ + /**左侧删除 */ + handleLeftDeleteDetails(index,row){ this.form.leftdetails.splice(index, 1); + this.rightAlldetails = this. rightAlldetails.filter(u => u.erpAssemblyCode !== row.erpAssemblyCode); //console.log(693); }, - handleRightDeleteDetails(index){ + /**右侧删除 */ + handleRightDeleteDetails(index,row){ this.form.rightdetails.splice(index, 1); + this.rightAlldetails.forEach((element,i) => { + if(element === row) + { + //console.log("右侧删除"); + this.rightAlldetails.splice(i, 1); + //console.log(this.rightAlldetails); + return; + } + }); + // .filter(u => u.erpAssemblyCode !== row.erpAssemblyCode && u.partCode !== row.partCode + // && u.partName !== row.partName && u.partNum !== row.partNum); + //console.log(693); }, @@ -1034,15 +1237,11 @@ export default { getList() { this.listLoading = true; this.listQuery.SkipCount = (this.page - 1) * 10; - console.log(1030) if(this.listQuery.OnlineTimeValue!== undefined) { - console.log(1033) - console.log(this.listQuery.OnlineTimeValue) this.listQuery.OnlineTimeBegin = this.listQuery.OnlineTimeValue[0]; this.listQuery.OnlineTimeEnd = this.listQuery.OnlineTimeValue[1]; } - console.log(this.listQuery.OnlineTimeValue) if(this.listQuery.ReceiveTimeValue!== undefined) { this.listQuery.ReceiveTimeBegin = this.listQuery.ReceiveTimeValue[0]; @@ -1063,34 +1262,27 @@ export default { }); }, - - getDetialList(partCode) { - this.listLoading = true; - console.log("详表条件:" + JSON.stringify(this.customerInfo.parentId)); + getKNRList() { + var lq = {}; + var tlist = []; this.$axios - .gets("/api/newjit/assembly-cfg-erp/" + this.customerInfo.parentId) + .gets("/api/newjit/bill-r100/list", lq) .then((response) => { - console.log(partCode) - if(partCode !== "" && partCode !== undefined) - { - //console.log(partCode) - this.list = response.item.details.filter(u => u.partCode === partCode); - } - else - { - this.list = response.item.details; - } - //alert(JSON.stringify(response.Items)) - //this.totalCount = response.totalCount; - setTimeout(() => { - //大数据量加载时 - this.listLoading = false; - }, 500); + this.KNRlist = response.items; + //console.log(this.KNRlist); }) .catch(() => { - this.listLoading = false; + console.log("error"); }); }, + getVModel() + { + this.form.vehicleModelCode = this.KNRlist.filter(u => u.knr === this.form.knr)[0].vehicleModelCode; + }, + vMchange() + { + this.$forceUpdate(); + }, valueselectChange(){}, handleImportSAP(){}, @@ -1111,6 +1303,15 @@ export default { }, handleSelectionChange(val) { this.multipleSelection = val; + //console.log(this.multipleSelection); + }, + handleLeftSelectionChange(val) + { + // console.log("左改变"); + // console.log(val); + // this.multipLeLeftSelection = []; + // this.multipLeLeftSelection.push(val); + // console.log(this.multipLeLeftSelection); }, /** 通过回调控制style */ cellStyle({ row, column, rowIndex, columnIndex }) { @@ -1128,10 +1329,53 @@ export default { return { textAlign: "left", background: "#FAFAFA" }; } }, + /**主表点击*/ handleRowClick(row, column, event) { this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.toggleRowSelection(row); }, + /**左点击*/ + handleLeftRowClick(row, column, event) { + this.$forceUpdate(); + //console.log("左点击"); + this.$refs.LeftDetialTable.clearSelection(); + this.$refs.LeftDetialTable.toggleRowSelection(row); + this.multipLeLeftSelection = []; + this.multipLeLeftSelection.push(row); + if(this.form.rightdetails === undefined) + { + this.form.rightdetails = [] + } + if(this.form.rightdetails.length > 0) + { + var templist = this.rightAlldetails.filter(u => u.erpAssemblyCode === this.form.rightdetails[0].erpAssemblyCode); + this.form.rightdetails.forEach(element => { + var temp = templist.filter(u => u.erpAssemblyCode === element.erpAssemblyCode && u.partCode === element.partCode + && u.partName === element.partName && u.partNum === element.partNum); + if(temp.length >= 1) + { + //console.log("判定包含"); + //console.log(templist); + //console.log(element); + } + else + { + //console.log("判定不包含"); + //console.log(element); + this.rightAlldetails.push(element); + } + }); + } + else + { + var templist = []; + } + //.log("右侧全数据"); + //console.log(this.rightAlldetails); + this.form.rightdetails = this.rightAlldetails.filter(u => u.erpAssemblyCode === this.multipLeLeftSelection[0].erpAssemblyCode); + //console.log("右侧数据"); + //console.log(this.form.rightdetails); + }, //获取所有产线 getProductLine() {