From 83014a0eed8d21d9299d228b2287293f35a45637 Mon Sep 17 00:00:00 2001 From: longyvfengyun <496960745@qq.com> Date: 星期五, 22 十二月 2023 09:02:05 +0800 Subject: [PATCH] 物料中心内容修改 --- src/pages/resourceManage/materialsCenter/list.vue | 92 +++++++++++++++++++++++++++++++++------------- 1 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/pages/resourceManage/materialsCenter/list.vue b/src/pages/resourceManage/materialsCenter/list.vue index 058eafa..8bc86e2 100644 --- a/src/pages/resourceManage/materialsCenter/list.vue +++ b/src/pages/resourceManage/materialsCenter/list.vue @@ -166,8 +166,8 @@ <div class="type-grp"> <a-radio-group v-model="uploadType" button-style="solid"> <a-radio-button value="normal"> 鏅�氶檮浠� </a-radio-button> - <a-radio-button value="pic"> 鍥剧墖 </a-radio-button> - <a-radio-button value="dwg"> 鍥剧焊 </a-radio-button> + <a-radio-button value="pic" :disabled="isSpecialMater"> 鍥剧墖 </a-radio-button> + <a-radio-button value="dwg" :disabled="isSpecialMater"> 鍥剧焊 </a-radio-button> </a-radio-group> </div> <a-upload @@ -178,6 +178,7 @@ <!-- :showUploadList="false" --> <a-button type="primary">閫夋嫨闄勪欢</a-button> </a-upload> + <div v-show="isSpecialMater" class="text-msg">0108,0109寮�澶寸殑鐗╂枡浠呭厑璁镐笂浼犳櫘閫氶檮浠讹紙鍥剧焊涔熼�氳繃鏅�氶檮浠惰繘琛屼笂浼狅級</div> </a-modal> <a-modal :visible="errorVisible" @@ -219,11 +220,11 @@ import getWebUrl from "@/assets/js/tools/getWebUrl"; import { - uploadOthers, - picOrDwg, - zipParse, - getFileList, - addMaterial, + uploadOthers, + picOrDwg, + zipParse, + getFileList, + addMaterial, getMaterialInfoApi, } from "./apis"; import { dwgReview } from "@/pages/workplace/apis"; // import { downloadLog } from "@/pages/system/logs/apis"; @@ -443,6 +444,12 @@ canUpload() { return checkPermit(PERMITS.uploadBom, this.permits); }, + isSpecialMater() { + const { subCode } = this.currentObj; + const reg = /^(0108\d+)|(0109\d+)/; + + return reg.test(subCode); + } }, components: { AdvanceTable, @@ -606,8 +613,10 @@ }); }, fileUploadShow() { + this.uploadType = "normal"; this.uploadFileList = []; this.fileUploadVisible = true; + }, fileUploadCancel() { this.fileUploadVisible = false; @@ -633,31 +642,38 @@ this.uploadFileList.forEach((v, i) => { formData.append("file", v.originFileObj); }); - if ( - this.uploadType == "normal" && - this.uploadFileList.some((v) => v.name.toLowerCase() == dwgFileName) - ) { - this.$message.error("鎵�閫夐檮浠剁被鍨嬩笉鍖归厤"); - this.$layer.close(loading); - return false; - } - if ( - this.uploadType == "dwg" && - this.uploadFileList.some((v) => v.name.toLowerCase() != dwgFileName) - ) { - this.$message.error("鎵�閫夐檮浠剁被鍨嬩笉鍖归厤"); - this.$layer.close(loading); - return false; - } + // 鐗规畩鐗╂枡涓嶈繘琛屾牎楠屽悕绉帮紝缁熶竴鎸夋櫘閫氶檮浠惰繘琛屼笂浼� + const isSpecial = this.isSpecialMater; + if(!isSpecial) { + if ( + this.uploadType == "normal" && + this.uploadFileList.some((v) => v.name.toLowerCase() == dwgFileName) + ) { + this.$message.error("鎵�閫夐檮浠剁被鍨嬩笉鍖归厤"); + this.$layer.close(loading); + return false; + } + if ( + this.uploadType == "dwg" && + this.uploadFileList.some((v) => v.name.toLowerCase() != dwgFileName) + ) { + this.$message.error("鎵�閫夐檮浠剁被鍨嬩笉鍖归厤"); + this.$layer.close(loading); + return false; + } + } let upload = this.uploadType != "normal" ? picOrDwg : uploadOthers; + upload = isSpecial?uploadOthers:upload; + upload(formData) .then((res) => { this.$layer.close(loading); const { code, data, msg } = res.data; if (code && data) { this.$message.success(msg); - this.panelShow(this.currentObj); + this.getMaterialInfo(this.currentObj); this.fileUploadVisible = false; + } else { this.$message.error(msg); } @@ -667,6 +683,18 @@ console.log(error); }); }, + async getMaterialInfo(obj) { + const {subCode, subModel, subName} = obj; + try{ + const res = await getMaterialInfoApi(subCode, subModel, subName); + const rs = res.data; + if(rs.code ===1 && rs.data) { + this.panelShow(rs.data2); + } + }catch (e) { + console.log(e); + } + }, resCancel() { this.resShow = false; }, @@ -725,7 +753,7 @@ let fileName = v.match(reg2)[2]; let arr = fileName.split("."); let fileType = arr.length ? arr[arr.length - 1].toLowerCase() : ""; - return !(reg.test(fileName) && fileType == "dwg"); + return !(reg.test(fileName) && fileType == "dwg" && !this.isSpecialMater); }); } if (dwgUrl) { @@ -740,14 +768,23 @@ const {dwgUrl, attachLocks, attachFileList} = obj; let isHasNewFile = true; // 鏍囪瘑鏄惁瀛樻湁鏂囦欢锛屾病鏈夐攣瀹氬拰鏈攣瀹氭棩蹇� if(attachFileList) { + let boolList = []; for(let i=0; i<attachFileList.length; i++) { const itemI = attachFileList[i]; + let isHasFile = false; for(let j=0; j<attachLocks.length; j++) { const itemJ = attachLocks[j]; if(itemI === itemJ.attachName) { - isHasNewFile = false; + isHasFile = true; break; } + } + boolList.push(isHasFile); + } + for(let i=0; i<boolList.length; i++) { + if(!boolList[i]) { + isHasNewFile = true; + break; } } }else { @@ -880,4 +917,7 @@ a.not-can-use { color: #808080; } +.text-msg { + color: #FF0000; +} </style> -- Gitblit v1.9.1