| | |
| | | <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 |
| | |
| | | <!-- :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" |
| | |
| | | picOrDwg, |
| | | zipParse, |
| | | getFileList, |
| | | addMaterial, |
| | | addMaterial, getMaterialInfoApi, |
| | | } from "./apis"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | // import { downloadLog } from "@/pages/system/logs/apis"; |
| | |
| | | canUpload() { |
| | | return checkPermit(PERMITS.uploadBom, this.permits); |
| | | }, |
| | | isSpecialMater() { |
| | | const { subCode } = this.currentObj; |
| | | const reg = /^(0108\d+)|(0109\d+)/; |
| | | |
| | | return reg.test(subCode); |
| | | } |
| | | }, |
| | | components: { |
| | | AdvanceTable, |
| | |
| | | }); |
| | | }, |
| | | fileUploadShow() { |
| | | this.uploadType = "normal"; |
| | | this.uploadFileList = []; |
| | | this.fileUploadVisible = true; |
| | | |
| | | }, |
| | | fileUploadCancel() { |
| | | this.fileUploadVisible = false; |
| | |
| | | this.uploadFileList.forEach((v, i) => { |
| | | formData.append("file", v.originFileObj); |
| | | }); |
| | | // 特殊物料不进行校验名称,统一按普通附件进行上传 |
| | | const isSpecial = this.isSpecialMater; |
| | | if(!isSpecial) { |
| | | if ( |
| | | this.uploadType == "normal" && |
| | | this.uploadFileList.some((v) => v.name.toLowerCase() == dwgFileName) |
| | |
| | | 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); |
| | | } |
| | |
| | | this.$layer.close(loading); |
| | | 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; |
| | |
| | | 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) { |
| | |
| | | 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 { |
| | |
| | | a.not-can-use { |
| | | color: #808080; |
| | | } |
| | | .text-msg { |
| | | color: #FF0000; |
| | | } |
| | | </style> |