From d3a1d472cec50b22dced79e540060580bf2f7a3e Mon Sep 17 00:00:00 2001 From: Yang <903110162@qq.com> Date: Wed, 10 May 2023 22:32:02 +0800 Subject: [PATCH] commit by yzf --- src/views/half/components/EditViewOFF.vue | 34 +++--- src/views/half/components/ShowData1.vue | 134 ++++++++++++++++------ src/views/half/half.vue | 6 +- 3 files changed, 123 insertions(+), 51 deletions(-) diff --git a/src/views/half/components/EditViewOFF.vue b/src/views/half/components/EditViewOFF.vue index 5ec47bf..855ecdf 100644 --- a/src/views/half/components/EditViewOFF.vue +++ b/src/views/half/components/EditViewOFF.vue @@ -37,7 +37,10 @@ :value="tIdv.FValue" :label="tIdv.FName"> - + + + + @@ -349,7 +352,7 @@ export default { }); let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; - localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); + //localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); console.log('editColumn', editColumn); this.editColumn = editColumn; @@ -371,6 +374,9 @@ export default { if ($this.dataInfoObj.FCanEdit == 2) { item.FTypeID1 = fType1 ? fType1.FName : item.FTypeID1; item.FTypeID2 = fType2 ? fType2.FName : item.FTypeID2; + + + } else { @@ -384,9 +390,11 @@ export default { if (!isFTypeID1 && !isFTypeID2) { item.FTypeID1 = fType1 ? fType1.FName : item.FTypeID1; item.FTypeID2 = fType2 ? fType2.FName : item.FTypeID2; + } } - + item["FTypeID1Name"]=fType1 ? fType1.FName : item.FTypeID1; + item["FTypeID2Name"] = fType2 ? fType2.FName : item.FTypeID2; return item; @@ -485,18 +493,18 @@ export default { FType: this.dataInfoObj.FType }; let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; - let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId)); - console.log('cacheDataList', cacheDataList); + //let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId)); + //console.log('cacheDataList', cacheDataList); let allTypeSelected = true; this.dataList.forEach((row, index) => { - let cache = cacheDataList[index]; + //let cache = cacheDataList[index]; let dataObj = {}; - if (row["FTypeID1"] == -1 || row["FTypeID2"] == -1 || row["FTypeID1"] == '' || row["FTypeID2"] == '') { - layer.msg("请先为所有物料选择分类", { icon: 2, time: 1000 }); - layer.close(idx); - allTypeSelected = false; - return - } + // if (row["FTypeID1"] == -1 || row["FTypeID2"] == -1 || row["FTypeID1"] == '' || row["FTypeID2"] == '') { + // layer.msg("请先为所有物料选择分类", { icon: 2, time: 1000 }); + // layer.close(idx); + // allTypeSelected = false; + // return + // } console.log('this.editColumn', this.editColumn); for (let col of this.dataColumn) { let valTemp = row[col.key]; @@ -539,7 +547,7 @@ export default { }, "OperateLog"); let $this = this; //$this.initPage(); - localStorage.setItem('EditView' + saveId, JSON.stringify(this.dataList)); + //localStorage.setItem('EditView' + saveId, JSON.stringify(this.dataList)); setTimeout(function () { layer.close(idx); layer.msg('保存成功'); diff --git a/src/views/half/components/ShowData1.vue b/src/views/half/components/ShowData1.vue index 765649a..a43ab46 100644 --- a/src/views/half/components/ShowData1.vue +++ b/src/views/half/components/ShowData1.vue @@ -1,6 +1,6 @@ @@ -170,7 +172,9 @@ import { import { getTeamworkView } from "/src/api/api/halfmaterialteamwork"; - +import { + getBasicRoleList +} from "/src/api/api/user"; import ShowView from './ShowView.vue'; @@ -228,44 +232,102 @@ export default { //获取视图 async _getViewList() { - this.dataList = [{ "name": "物料视图", "code": "1", "outCode": "6","seeCode":"1" }, { "name": "配方视图", "code": "2", "outCode": "7","seeCode":"2" }]; + + let result = await getBasicRoleList({ + FRoleType: 39 + + }) || []; + + let result2 = await getBasicRoleList({ + FRoleType: 39, + TeamId: this.dataInfoObj.FID, + Type: 2 + + }) || []; + debugger + console.log('result', result); + console.log('this.dataInfoObj', this.dataInfoObj); + let dataList = []; + let hasType = "1,2".split(','); + + result.forEach((item) => { + let viewData = dataList.find(s => s.name == item.FName) || null; + debugger + if (viewData == null) { + if (hasType.indexOf(item.FCode) != -1) { + viewData = { + name: item.FName, + seeCode: "", + outCode: "" + }; + if (result2) { + let dataResult = result2.find((x) => { + return x.FID == item.FID; + }) + if (dataResult) { + if (item.FRemark.indexOf("查看") != -1) viewData.seeCode = item.FCode; + if (item.FRemark.indexOf("导出") != -1) viewData.outCode = item.FCode; + } + + } + + dataList.push(viewData); + } + } else { + if (result2) { + let dataResult = result2.find((x) => { + return x.FID == item.FID; + }) + if (dataResult) { + if (item.FRemark.indexOf("查看") != -1) viewData.seeCode = item.FCode; + if (item.FRemark.indexOf("导出") != -1) viewData.outCode = item.FCode; + } + + } + } + }); + + this.dataList = dataList; + + + //this.dataList = [{ "name": "物料视图", "code": "1", "outCode": "6","seeCode":"1" }, { "name": "配方视图", "code": "2", "outCode": "7","seeCode":"2" }]; }, async _getTeamworkView(data, type) { let viewType = parseInt(type == 1 ? data.seeCode : data.outCode); - if (type == 2) viewType = viewType - this.viewTypeCount; - let postData = { - FTeamID: this.dataInfoObj.FID, - FViewType: viewType, - FType: type, - HalfId : this.dataInfoObj.FMaterialHalfIDs + if (type == 2) viewType = viewType - this.viewTypeCount; + let postData = { + FTeamID: this.dataInfoObj.FID, + FViewType: viewType, + FType: type, + HalfId: this.dataInfoObj.FMaterialHalfIDs + }; + this.viewType = viewType; + if (this.dataInfoObj.FProgress == "100" || this.dataInfoObj.FProgress == "100%") { + postData.FFinish = 1; + } + let idx = layer.load(2); + let result = await getTeamworkView(postData); + layer.close(idx); + if (type == 1) { + let list = []; + let count = 0; + for (let key in result) { + list.push(result[key]); + count += result[key].length; }; - this.viewType = viewType; - if (this.dataInfoObj.FProgress == "100" || this.dataInfoObj.FProgress == "100%") { - postData.FFinish = 1; - } - let idx = layer.load(2); - let result = await getTeamworkView(postData); - layer.close(idx); - if (type == 1) { - let list = []; - let count = 0; - for (let key in result) { - list.push(result[key]); - count += result[key].length; - }; - if (count == 0) { - layer.msg("请稍等,视图信息还在编辑中", { - time: 2000, - icon: 3 - }); - } else { - this.viewList = list; - this.viewHeight = Math.ceil(500); - this.showEditBox = true; - } + if (count == 0) { + layer.msg("请稍等,视图信息还在编辑中", { + time: 2000, + icon: 3 + }); } else { - window.open(result); + this.viewList = list; + this.viewHeight = Math.ceil(500); + this.showEditBox = true; } + } else { + window.open(result); + } }, //日期处理 dateFormat(dataStr) { diff --git a/src/views/half/half.vue b/src/views/half/half.vue index 2973f45..8a591f9 100644 --- a/src/views/half/half.vue +++ b/src/views/half/half.vue @@ -303,12 +303,14 @@ export default { if (data) { data["FTeamID"] = data.FID; } - this.objInfoObj = data; + let height = document.documentElement.clientHeight || document.body.clientHeight || 1000; + this.objInfoObj = data || {}; + this.objInfoObj["FHeight"] = Math.ceil(height * 0.8); this.showEditBox[i] = true; }, _clickSetInfo(data, type) { - + for (let i = 0; i < this.showEditBox.length; i++) { this.showEditBox[i] = false; }