Przeglądaj źródła

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

2213980799@qq.com 1 rok temu
rodzic
commit
c662c96c8e

+ 2 - 2
src/api/material/BOM.js

@@ -272,10 +272,10 @@ export async function startAndStop(data) {
 
 
 export async function bomSubmit(data) {
 export async function bomSubmit(data) {
   const res = await request.post(`/bpm/bom/submit`, data);
   const res = await request.post(`/bpm/bom/submit`, data);
-  if (res.data.code == 0) {
+  if (res && res.data.code == 0) {
     return res.data;
     return res.data;
   }
   }
-  return Promise.reject(new Error(res.data.message));
+
 }
 }
 
 
 // 嘉实医药提交
 // 嘉实医药提交

+ 2 - 2
src/utils/request.js

@@ -48,15 +48,15 @@ service.interceptors.request.use(
 service.interceptors.response.use(
 service.interceptors.response.use(
   (res) => {
   (res) => {
     // token 自动续期
     // token 自动续期
-    if (res.data.code == -1 && res.config?.showErrorToast !== false) {
+    if (Number(res.data.code) == -1 && res.config?.showErrorToast !== false) {
       Message.error(res.data.message);
       Message.error(res.data.message);
       return false;
       return false;
     }
     }
     const token = res.headers[TOKEN_HEADER_NAME.toLowerCase()];
     const token = res.headers[TOKEN_HEADER_NAME.toLowerCase()];
-
     if (token) {
     if (token) {
       setToken(token);
       setToken(token);
     }
     }
+
     return res;
     return res;
   },
   },
   (error) => {
   (error) => {

+ 46 - 43
src/views/material/BOMmanage/detailsPop.vue

@@ -133,7 +133,12 @@
               提交发布
               提交发布
             </el-button>
             </el-button>
 
 
-            <el-button type="primary" size="mini" @click="handleSave"   v-if="currentNodeData.status != 1">
+            <el-button
+              type="primary"
+              size="mini"
+              @click="handleSave"
+              v-if="currentNodeData.status != 1"
+            >
               保存
               保存
             </el-button>
             </el-button>
           </div>
           </div>
@@ -199,7 +204,7 @@
               >
               >
                 <el-option
                 <el-option
                   v-for="item in versList"
                   v-for="item in versList"
-                  :label="'V' +item.versions + '.0'"
+                  :label="'V' + item.versions + '.0'"
                   :value="item.versions"
                   :value="item.versions"
                   :key="item.id"
                   :key="item.id"
                 >
                 >
@@ -435,7 +440,6 @@
 
 
         if (Object.prototype.hasOwnProperty.call(row, 'bomType')) {
         if (Object.prototype.hasOwnProperty.call(row, 'bomType')) {
           this.currentNodeData.bomType = row.bomType;
           this.currentNodeData.bomType = row.bomType;
-
         }
         }
         this.drawer = true;
         this.drawer = true;
         this.getTreeData();
         this.getTreeData();
@@ -466,11 +470,10 @@
         this.getVersion();
         this.getVersion();
       },
       },
 
 
-
       async getTreeData() {
       async getTreeData() {
         try {
         try {
           this.treeLoading = true;
           this.treeLoading = true;
-          
+
           const res = await getBomTreeList({
           const res = await getBomTreeList({
             categoryId: this.searchObj.categoryId,
             categoryId: this.searchObj.categoryId,
             versions: this.searchObj.versions,
             versions: this.searchObj.versions,
@@ -508,7 +511,7 @@
         if (id) {
         if (id) {
           getBomGetById(id).then((res) => {
           getBomGetById(id).then((res) => {
             this.currentNodeData = res.data;
             this.currentNodeData = res.data;
-            this.searchObj.versions =  this.currentNodeData.versions
+            this.searchObj.versions = this.currentNodeData.versions;
             this.$forceUpdate();
             this.$forceUpdate();
           });
           });
         } else {
         } else {
@@ -522,7 +525,8 @@
       getVersion(type) {
       getVersion(type) {
         let param = {
         let param = {
           categoryId: this.searchObj.categoryId,
           categoryId: this.searchObj.categoryId,
-          bomType: this.currentNodeData.bomType
+          bomType: this.currentNodeData.bomType,
+          isTemp: this.searchObj.isTemp
         };
         };
         versionList(param).then((res) => {
         versionList(param).then((res) => {
           this.versList = res || [];
           this.versList = res || [];
@@ -559,10 +563,17 @@
           .finally(() => {});
           .finally(() => {});
       },
       },
 
 
-      transformation(tt) {
+      async transformation(tt) {
         if (this.currentNodeData.status != 1) {
         if (this.currentNodeData.status != 1) {
           return this.$message.warning('只有已发布版本才可以转换');
           return this.$message.warning('只有已发布版本才可以转换');
         }
         }
+
+        let _type = tt == 'P' ? 1 : tt == 'M' ? 2 : tt == 'A' ? 3 : 4;
+        if (!this.isEdit) {
+          let isHas = await this.hasVersionFn(_type);
+          if (!isHas) return;
+        }
+
         this.loadingInstance = this.$loading({
         this.loadingInstance = this.$loading({
           lock: true,
           lock: true,
           text: '转换中...',
           text: '转换中...',
@@ -586,8 +597,6 @@
             this.loadingInstance.close();
             this.loadingInstance.close();
             this.$message.success('转换成功');
             this.$message.success('转换成功');
 
 
- 
-             let _type = tt == 'P' ? 1 : tt == 'M' ? 2 : tt == 'A' ? 3 : 4;
             this.currentNodeData.bomType = _type;
             this.currentNodeData.bomType = _type;
             this.getTreeData();
             this.getTreeData();
             this.getVersion();
             this.getVersion();
@@ -595,7 +604,6 @@
         });
         });
       },
       },
 
 
-
       handleAdd() {
       handleAdd() {
         this.baseInfoShow = true;
         this.baseInfoShow = true;
       },
       },
@@ -615,12 +623,9 @@
       handleSave() {
       handleSave() {
         this.$message.success('保存成功');
         this.$message.success('保存成功');
         this.handleClose();
         this.handleClose();
-
-      
       },
       },
 
 
       handSubmit() {
       handSubmit() {
-       
         if (this.clientEnvironmentId == 4) {
         if (this.clientEnvironmentId == 4) {
           this.isSubmit = true;
           this.isSubmit = true;
         } else {
         } else {
@@ -631,8 +636,10 @@
           })
           })
             .then(() => {
             .then(() => {
               bomSubmit({ businessId: this.currentNodeData.id }).then((res) => {
               bomSubmit({ businessId: this.currentNodeData.id }).then((res) => {
-                this.$message.success('发布成功');
-                this.getTreeData();
+                if (res.code == 0) {
+                  this.$message.success('发布成功');
+                  this.getTreeData();
+                }
               });
               });
             })
             })
             .catch(() => {});
             .catch(() => {});
@@ -664,35 +671,31 @@
         }
         }
       },
       },
 
 
-      async hasVersionFn() {
-         return new Promise((resolve) => {
-        let param = {
-          categoryId: this.searchObj.categoryId,
-          bomType: this.currentNodeData.bomType
-        };
-        hasNewVersion(param).then((res) => {
-           if(res.data == 1) {
-                this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
-                  confirmButtonText: '覆盖',
-                  cancelButtonText: '取消',
-                  type: 'warning'
+      async hasVersionFn(bomType) {
+        return new Promise((resolve) => {
+          let param = {
+            categoryId: this.searchObj.categoryId,
+            bomType: bomType
+          };
+          hasNewVersion(param).then((res) => {
+            if (res.data == 1) {
+              this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
+                confirmButtonText: '覆盖',
+                cancelButtonText: '取消',
+                type: 'warning'
+              })
+                .then(() => {
+                  resolve(true);
                 })
                 })
-                  .then(() => {
-                    resolve(false);
-                  })
-                  .catch(() => {
-                    resolve(true);
-                  });
-
-
-           } else {
-            resolve(true);
-           }
-
-   
+                .catch(() => {
+                  resolve(false);
+                });
+            } else {
+              resolve(true);
+            }
+          });
         });
         });
-      });
-      },
+      }
     }
     }
   };
   };
 </script>
 </script>

+ 11 - 2
src/views/material/BOMmanage/index.vue

@@ -30,6 +30,11 @@
             </el-link>
             </el-link>
           </template>
           </template>
 
 
+          <template v-slot:versions="{ row }">
+              V{{ row.versions }}.0
+          </template>
+
+
           <template v-slot:isTemp="{ row }">
           <template v-slot:isTemp="{ row }">
             <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
             <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
           </template>
           </template>
@@ -131,6 +136,7 @@
           },
           },
           {
           {
             prop: 'versions',
             prop: 'versions',
+            slot: 'versions',
             label: '版本'
             label: '版本'
           },
           },
           {
           {
@@ -247,8 +253,11 @@
           })
           })
             .then(() => {
             .then(() => {
               bomSubmit({ businessId: row.id }).then((res) => {
               bomSubmit({ businessId: row.id }).then((res) => {
-                this.$message.success('发布成功');
-                this.reload();
+                if(res?.code == '0') {
+                  this.$message.success('发布成功');
+                  this.reload();
+                }
+  
               });
               });
             })
             })
             .catch(() => {});
             .catch(() => {});

+ 1 - 0
vue.config.js

@@ -33,6 +33,7 @@ module.exports = {
       '/api': {
       '/api': {
         // target: 'http://192.168.1.124:50001',
         // target: 'http://192.168.1.124:50001',
         // target: 'http://192.168.1.147:18086',
         // target: 'http://192.168.1.147:18086',
+        // target: 'http://192.168.1.176:18086',
         target: 'http://192.168.1.125:18086',
         target: 'http://192.168.1.125:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
         pathRewrite: {