From 680fb34b2eeaad7e9c4b51ff6880207b2947b728 Mon Sep 17 00:00:00 2001 From: leo <10200039@qq.com> Date: Sun, 7 May 2023 19:17:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=A9=E6=96=99=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=B7=AF=E7=BA=BF=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/materia/components/EditView.vue | 83 ++++++++++++++++------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/src/views/materia/components/EditView.vue b/src/views/materia/components/EditView.vue index 5088750..01b1c68 100644 --- a/src/views/materia/components/EditView.vue +++ b/src/views/materia/components/EditView.vue @@ -248,6 +248,7 @@ export default { this.typeList[1] = _data.types.filter(s => s.FDepth != 1) || []; let dataColumn = _data.columns || []; + console.log('dataColumn', dataColumn); let editColumn = dataColumn.filter(it => { let b = false; if (this.dataInfoObj.FCanEdit != 2) { @@ -343,8 +344,8 @@ export default { // } }); - - let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; + + let saveId = this.dataInfoObj.FID; localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); this.editColumn = editColumn; @@ -387,6 +388,9 @@ export default { let freezingColumns = freezingCols.FFreezingColumns + console.log('this.dataList', this.dataList); + console.log('this.dataColumn', this.dataColumn); + if (freezingColumns) { let c_list = freezingColumns.split(",") c_list.forEach(c => { @@ -442,9 +446,6 @@ export default { }) || null; if (result != null && result.FID) { - - console.log('data.FTypeID1', data.FTypeID1); - let type1 = this.typeList[0].filter(t => t.FValue == data.FTypeID1)[0]; let typeName = type1.FName; @@ -488,10 +489,10 @@ export default { FViewType: this.dataInfoObj.FViewType, FTeamworkType: this.dataInfoObj.FTeamworkType, }; - let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; + let saveId = this.dataInfoObj.FID; let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId)); let allTypeSelected = true - + this.dataList.forEach((row, index) => { let cache = cacheDataList[index]; let dataObj = {}; @@ -504,22 +505,53 @@ export default { } for (let col of this.editColumn) { let valTemp = row[col.key]; - if (this.dataInfoObj.FViewType == 10) { - if (!dataObj[col.table]) { - dataObj[col.table] = {}; - dataObj[col.table].FMaterialID = row["FMaterialID"]; - } - dataObj[col.table][col.key] = valTemp; - if (col.key == "FTypeID1" || col.key == "FTypeID2") { - let temps = this.typeList[col.key == "FTypeID1" ? 0 : 1] || []; - let temp = temps.find(s => s.FID == valTemp) || null; - valTemp = temp == null ? "" : temp.FName; - } - updateObj.LogList.push(col.title + ":" + (valTemp == "" ? "删除" : valTemp)); - } else if (valTemp != cache[col.key]) { + // if (this.dataInfoObj.FViewType == 10) { + // if (!dataObj[col.table]) { + // dataObj[col.table] = {}; + // dataObj[col.table].FMaterialID = row["FMaterialID"]; + // } + // dataObj[col.table][col.key] = valTemp; + // if (col.key == "FTypeID1" || col.key == "FTypeID2") { + // let temps = this.typeList[col.key == "FTypeID1" ? 0 : 1] || []; + // let temp = temps.find(s => s.FID == valTemp) || null; + // valTemp = temp == null ? "" : temp.FName; + // } + // updateObj.LogList.push(col.title + ":" + (valTemp == "" ? "删除" : valTemp)); + // } else if (valTemp != cache[col.key]) { + // if (!dataObj[col.table]) { + // dataObj[col.table] = {}; + // dataObj[col.table].FMaterialID = row["FMaterialID"]; + // } + // dataObj[col.table][col.key] = valTemp; + // if (col.key == "FTypeID1" || col.key == "FTypeID2") { + // let temps = this.typeList[col.key == "FTypeID1" ? 0 : 1] || []; + // let temp = temps.find(s => s.FID == valTemp) || null; + // valTemp = temp == null ? "" : temp.FName; + // } + // updateObj.LogList.push(col.title + ":" + (valTemp == "" ? "删除" : valTemp)); + // } + if (valTemp != cache[col.key]) { if (!dataObj[col.table]) { dataObj[col.table] = {}; dataObj[col.table].FMaterialID = row["FMaterialID"]; + + if (col.table == "TFS_ViewMaterial") { + dataObj[col.table].FMRP1ProductType = row["FMRP1ProductType"]; + dataObj[col.table].FTypeID2 = row["FTypeID2"]; + } + + if (col.table == "TFS_MaterialInfo") { + dataObj[col.table].FMRP1ProductType = row["FMRP1ProductType"]; + dataObj[col.table].FTypeID1 = row["FTypeID1"]; + dataObj[col.table].FTypeID2 = row["FTypeID2"]; + dataObj[col.table].FType2 = row["FTypeID2"]; + } + + if (col.table == "TFS_Material") { + dataObj[col.table].FTypeID1 = row["FTypeID1"]; + dataObj[col.table].FTypeID2 = row["FTypeID2"]; + dataObj[col.table].FType = row["FMRP1ProductType"]; + } } dataObj[col.table][col.key] = valTemp; if (col.key == "FTypeID1" || col.key == "FTypeID2") { @@ -531,20 +563,21 @@ export default { } } - for (let key in dataObj) { - debugger + // dataObj["TFS_ViewMaterial"].FMRP1ProductType = row["FMRP1ProductType"]; + // dataObj["TFS_ViewMaterial"].FTypeID1 = row["FTypeID1"]; + // dataObj["TFS_ViewMaterial"].FTypeID2 = row["FTypeID2"]; + console.log('dataObj', dataObj); + for (let key in dataObj) { if (!updateObj[key]) updateObj[key] = []; updateObj[key].push(dataObj[key]); } }); - if (!allTypeSelected) { return false; } - let updateLog = updateObj.LogList.join("、"); - debugger + let updateLog = updateObj.LogList.join("、"); if (updateLog != "") { delete updateObj.LogList // 发送保存请求