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 ++++++++++++++++++++++--------
 src/pages/resourceManage/materialsCenter/apis.js  |   31 ++++++++--
 2 files changed, 91 insertions(+), 32 deletions(-)

diff --git a/src/pages/resourceManage/materialsCenter/apis.js b/src/pages/resourceManage/materialsCenter/apis.js
index 1221afc..e32616f 100644
--- a/src/pages/resourceManage/materialsCenter/apis.js
+++ b/src/pages/resourceManage/materialsCenter/apis.js
@@ -2,7 +2,7 @@
 
 /**
  * 鍥剧焊鏌ヨ鍒嗙被妫�绱�
- * @returns 
+ * @returns
  */
 // export const searchCadDrawer = (params, data) => {
 //   return axios({
@@ -14,7 +14,7 @@
 // }
 /**
  * 鍥剧焊鎵撳寘涓嬭浇
- * @returns 
+ * @returns
  */
 // export const packageDoc = (pictureUrls) => {
 //   return axios({
@@ -40,7 +40,7 @@
   })
 }
 /**
- * 寤虹珛鍏宠仈鏃舵煡璇㈡墍鏈夌殑鐗╂枡锛堜笉鍒嗛〉锛� 
+ * 寤虹珛鍏宠仈鏃舵煡璇㈡墍鏈夌殑鐗╂枡锛堜笉鍒嗛〉锛�
  */
 export const getAllMaterialNoLimit = () => {
   return axios({
@@ -50,7 +50,7 @@
 }
 /**
  * zip瑙f瀽 鏂板鐗╂枡
- * @returns 
+ * @returns
  */
 export const zipParse = (data) => {
   return axios({
@@ -87,6 +87,25 @@
 }
 
 /**
+ * 鑾峰彇鍗曚釜鐗╂枡鐨勪俊鎭�
+ * @param subCode 缂栫爜
+ * @param subModel  鐗╂枡鍨嬪彿
+ * @param subName 鐗╂枡鍚嶇О
+ * @return {AxiosPromise}
+ */
+export const getMaterialInfoApi = (subCode, subModel, subName)=>{
+  return axios({
+    method: "GET",
+    url: "material/getMaterialDialog",
+    params: {
+      subCode,
+      subModel,
+      subName
+    }
+  })
+}
+
+/**
  * 鏌ヨ鐗╂枡鐨勫巻鍙茬増鏈�
  * @returns
  */
@@ -111,7 +130,7 @@
 }
 
 /**
- * 
+ *
  * @returns
  */
 export const uploadOthers = (data) => {
@@ -175,4 +194,4 @@
     url: "material",
     data
   })
-}
\ No newline at end of file
+}
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