diff --git a/src/views/half/components/BOMDownload.vue b/src/views/half/components/BOMDownload.vue new file mode 100644 index 0000000..b01ecbd --- /dev/null +++ b/src/views/half/components/BOMDownload.vue @@ -0,0 +1,95 @@ + + + + 新销售号:{{dataInfoObj.FSaleCode}} + 配方选择:{{dataInfoObj.FFormulaName}} + 任务来源:{{dataInfoObj.FDesc}} + 下载BOM清单 + + + + + + diff --git a/src/views/half/components/EditMateria.vue b/src/views/half/components/EditMateria.vue index c08bfae..ad294b1 100644 --- a/src/views/half/components/EditMateria.vue +++ b/src/views/half/components/EditMateria.vue @@ -2,13 +2,13 @@ - 选择 + 选择 注:配方号+版本号+描述 - 选择 + 选择 注:配方号+版本号+描述 @@ -121,9 +121,9 @@ import { import { getFormulaList } from '/src/api/api/formula'; -import{ +import { InsertDataModel -} from'/src/api/api/halfmaterialteamwork' +} from '/src/api/api/halfmaterialteamwork' export default { components: { MaterialSelect @@ -165,7 +165,7 @@ export default { dataColumn.forEach((item) => { item.align = "center"; }); - const dataType=ref(""); + const dataType = ref(""); const pageInfo = ref({ total: 0, limit: 5, @@ -189,10 +189,10 @@ export default { const factoryLists = ref([]); const factoryValue = ref(null); const formula1 = ref(-1); - const formula1Name=ref(""); + const formula1Name = ref(""); const formula2 = ref(-1); const formula2Name = ref(""); - const factoryID=ref(""); + const factoryID = ref(""); return { dataInfo, formulaList, @@ -283,22 +283,22 @@ export default { this._getPageList(); }, selectMaterial(str) { - this.dataType=str; + this.dataType = str; this.showEditBox = true; this.editDataInfo.FName = ""; }, - _getSeachData(data){ + _getSeachData(data) { debugger - if(this.dataType==1){ - this.formula1=data.FTestCode; - this.formula1Name=data.FName; + if (this.dataType == 1) { + this.formula1 = data.FTestCode; + this.formula1Name = data.FName; this._getPageList(true); - }else{ - this.formula2=data.FTestCode; - this.formula2Name=data.FName; + } else { + this.formula2 = data.FTestCode; + this.formula2Name = data.FName; } - this.showEditBox=false; + this.showEditBox = false; }, //配方接口 async _getPageList(isFirst) { @@ -316,27 +316,47 @@ export default { postData.Or_FPlmCode = postData.Or_FTestCode = postData.Or_FName = postData.Or_FVersionCode = search; } - let result = await getPageList(postData, "Material"); - result.Data.List = result.Data.List || []; - result.Data.List.forEach((item) => { - let type = this.typeList.find(s => s.FValue == item.FType); - item.FTypeName = type == null ? item.FType : type.FName; - if (this.dataInfo.FFormulaID == item.FID) this.selectedKey = item.FID - }); - debugger - this.pageInfo.total = result.Data.Total || 0; - this.dataList = result.Data.List; + if (this.formula1Name != "") { + let result = await getPageList(postData, "Material"); + result.Data.List = result.Data.List || []; + result.Data.List.forEach((item) => { + let type = this.typeList.find(s => s.FValue == item.FType); + item.FTypeName = type == null ? item.FType : type.FName; + if (this.dataInfo.FFormulaID == item.FID) this.selectedKey = item.FID + }); + debugger + this.pageInfo.total = result.Data.Total || 0; + this.dataList = result.Data.List; + } + }, //数据-验证 async submitClick(isCreate) { - let postData = {"FTestCode":this.formula1,"FNewTestCode":this.formula2,"FCreateFactoryID":this.factoryID}; - + let postData = { "FTestCode": this.formula1, "FNewTestCode": this.formula2, "FCreateFactoryID": this.factoryID }; + + if (this.formula1Name.trim() == "") { + layer.msg('请选择试验号'); + return false; + } + if (this.formula2Name.trim() == "") { + layer.msg('请选择替换试验号'); + return false; + } + if (this.factoryID == "") { + layer.msg('请选择模式'); + return false; + } + + if (this.dataList.length <= 0) { + layer.msg('未找到需要变更的物料'); + return false; + } let ids = layer.load(0) try { - let result=await InsertDataModel(postData); - if (result.Code== 200) { + let result = await InsertDataModel(postData); + if (result.Code == 200) { layer.msg('创建成功'); this.cancelClick(true); } else { diff --git a/src/views/half/components/EditView.vue b/src/views/half/components/EditView.vue index 09a997c..10f8347 100644 --- a/src/views/half/components/EditView.vue +++ b/src/views/half/components/EditView.vue @@ -5,7 +5,7 @@ - 保存 @@ -125,6 +125,10 @@ export default { const dataList = ref([]); const editColumn = ref([]); const selectDataMap = ref(null); + const showFreezingColumnSettingBox = ref(false); + const freezingColumnSetting = ref([]); + const originalColumns = ref([]); + const infoList=ref([]); const typeList = ref([ [], [] @@ -133,23 +137,39 @@ export default { [], [] ]); - const cellStyle = function (row, column, rowIndex, columnIndex) { - let back = column.table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246)" : "" - return back; - } - const cellClassName = function (row, column, rowIndex, columnIndex) { - return column.cellClass || ""; - } + const inputCodeValue = ref(""); const inputDescValue = ref(""); const visible2 = ref(false) const changeVisible2 = function () { visible2.value = !visible2.value }; - const showFreezingColumnSettingBox = ref(false); - const freezingColumnSetting = ref([]); - const originalColumns = ref([]); + const tmpDataColumn = ref([]); + + const cellStyle = function (row, column, rowIndex, columnIndex) { + let back = column.table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246)" : ""; + + return back; + } + const cellClassName = function (row, column, rowIndex, columnIndex) { + + debugger + + let info=row["info"]; + switch (info[column.key+"Type"]) { + case "1": + return column.cellClass = column.cellClass + " one"; + case "2": + return column.cellClass = column.cellClass + " twe"; + case "3": + return column.cellClass = column.cellClass + " three"; + case "4": + return column.cellClass = column.cellClass + " four"; + } + + return column.cellClass || ""; + } return { dataColumn, dataList, @@ -168,7 +188,8 @@ export default { showFreezingColumnSettingBox, freezingColumnSetting, originalColumns, - tmpDataColumn + tmpDataColumn, + infoList }; }, props: { @@ -203,6 +224,7 @@ export default { teamId: this.dataInfoObj.FTeamID, viewType: this.dataInfoObj.FViewType }); + this.infoList=_data; console.log('_data', _data); let freezingCols = await GetFreezingColumns(); if (this.dataInfoObj.FViewType == 1 || this.dataInfoObj.FViewType == 10) { @@ -296,7 +318,6 @@ export default { } item.FTypeID1 = (item.FTypeID1 == 0 || item.FTypeID1 == -1) ? "" : item.FTypeID1; item.FTypeID2 = (item.FTypeID2 == 0 || item.FTypeID2 == -1) ? "" : item.FTypeID2; - if (this.dataInfoObj.FCanEdit == 2) { let fType1 = this.typeList[0].find((t) => { if(item.FTypeID1){ @@ -312,15 +333,18 @@ export default { item.FTypeID1 = fType1?fType1.FName:item.FTypeID1; item.FTypeID2 = fType2?fType2.FName:item.FTypeID2; + } }); let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); this.editColumn = editColumn; - this.dataList = _data.rows; + this.dataList = _data.rows.map(function(item){ + item["info"]=_data.infos.find(s => s.FDataID == item.FMaterialID) || null; + return item; + }); this.dataColumn = dataColumn; - debugger this.originalColumns = this.deepCopy(dataColumn); let freezingColumns = freezingCols.FFreezingColumns @@ -454,7 +478,6 @@ export default { console.log('cacheDataList', cacheDataList); this.dataList.forEach((row, index) => { - debugger let cache = cacheDataList[index]; let dataObj = {}; console.log('this.editColumn', this.editColumn); @@ -495,7 +518,6 @@ export default { } }); let updateLog = updateObj.LogList.join("、"); - debugger if (updateLog != "") { delete updateObj.LogList // 发送保存请求 diff --git a/src/views/half/components/EditViewOFF.vue b/src/views/half/components/EditViewOFF.vue index d37f471..206c63b 100644 --- a/src/views/half/components/EditViewOFF.vue +++ b/src/views/half/components/EditViewOFF.vue @@ -133,11 +133,36 @@ export default { [] ]); const cellStyle = function (row, column, rowIndex, columnIndex) { - let back = column.table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246)" : "" + let back = column.table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246)" : ""; + let info=row["info"]; + debugger + switch (info[column.key+"Type"]) { + case "1": + return document.getElementsByClassName(column.key+"_"+rowIndex+"_"+columnIndex)[0].classList.add("one"); + case "2": + return document.getElementsByClassName(column.key+"_"+rowIndex+"_"+columnIndex)[0].classList.add("twe"); + case "3": + return document.getElementsByClassName(column.key+"_"+rowIndex+"_"+columnIndex)[0].classList.add("three"); + case "4": + return document.getElementsByClassName(column.key+"_"+rowIndex+"_"+columnIndex)[0].classList.add("four"); + } return back; } const cellClassName = function (row, column, rowIndex, columnIndex) { - return column.cellClass || ""; + debugger + // let info=row["info"]; + // switch (info[column.key+"Type"]) { + // case "1": + // return column.cellClass = column.cellClass + " one"; + // case "2": + // return column.cellClass = column.cellClass + " twe"; + // case "3": + // return column.cellClass = column.cellClass + " three"; + // case "4": + // return column.cellClass = column.cellClass + " four"; + // } + + return column.cellClass = column.key+"_"+rowIndex+"_"+columnIndex; } const inputCodeValue = ref(""); const inputDescValue = ref(""); @@ -202,6 +227,29 @@ export default { teamId: this.dataInfoObj.FTeamID, viewType: this.dataInfoObj.FViewType }); + + let FTpye2IDList=this.getParamValues("FTypeID2",_data.rows); + + FTpye2IDList=FTpye2IDList.filter(function(value,index,self){ + return self.indexOf(value) === index; + }); + let TypeInfo={}; + let $thie=this; + FTpye2IDList.forEach((item, i)=>{ + + // let result = $this.getInfoData({ + // "FDataID": item, + // "FType": 1 + // }) || null; + // TypeInfo.push(result); + }) + + // let result = await getInfoData({ + // "FDataID": data.FTypeID2, + // "FType": 1 + // }) || null; + + let freezingCols = await GetFreezingColumns(); console.log('_data', _data); if (this.dataInfoObj.FViewType == 1 || this.dataInfoObj.FViewType == 10) { @@ -315,7 +363,6 @@ export default { // item.FTypeID2 = fType2?fType2.FName:item.FTypeID2; //} }); - debugger let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); @@ -341,6 +388,7 @@ export default { item.FTypeID1 = fType1 ? fType1.FName : item.FTypeID1; item.FTypeID2 = fType2 ? fType2.FName : item.FTypeID2; } + item["info"]=_data.infos.find(s => s.FDataID == item.FMaterialID) || null; return item; }); this.dataColumn = dataColumn; @@ -362,8 +410,7 @@ export default { } - debugger - this._changeType(_data.rows[0], 2); + // this._changeType(_data.rows[0], 2); setTimeout(function () { layer.close(idx); }, 500); @@ -386,6 +433,16 @@ export default { // this.setFreezingColumns(); // } // }, + getParamValues(name,arr){ + var ret = [] + for (var i = 0, len = arr.length; i < len; i++) { + if(arr[i][name]) + { + ret.push(arr[i][name]) + } + } + return ret + }, cancelClick(isRefresh) { isRefresh = isRefresh == undefined ? false : isRefresh; this.$emit('cancelClick', isRefresh); @@ -399,7 +456,6 @@ export default { "FDataID": data.FTypeID2, "FType": 1 }) || null; - if (result != null && result.FID) { let col7 = this.dataColumn.filter(s => s.fieldType == 7) || []; console.log('this.typeList[0]', this.typeList[0].filter(t => t.FValue == data.FTypeID1)[0]); @@ -432,7 +488,34 @@ export default { if (typeName.indexOf("成品") > 0) { data.FViewType = 1 } + this.dataList.map(function(item){ + + if(item.FID==data.FID) + { + debugger + + item.info=result; + } + return item; + }) + // this.dataColumn.forEach((item,i){ + + + // }) + // for(let key in this.dataList){ + // debugger + // } + + // this.dataList.map(function(item){ + // debugger + // let list=result.find(s=>s.FDataID==data.FTypeID2)||""; + + // if(list) + // { + + // } + // }); this.dataColumn.map(function (item) { // let str = result[item.key + "Type"]; @@ -521,7 +604,6 @@ export default { if (updateLog != "") { delete updateObj.LogList // 发送保存请求 - debugger console.log('updateObj', updateObj); let _result = await updateBatchById4(updateObj); if (_result.Code === 200) { diff --git a/src/views/half/route.vue b/src/views/half/route.vue index 7ff5887..97307d1 100644 --- a/src/views/half/route.vue +++ b/src/views/half/route.vue @@ -61,6 +61,9 @@ + + +
注:配方号+版本号+描述