Browse Source

按钮操作添加提示保存

lichao 3 years ago
parent
commit
f215aad774

+ 33 - 17
src/views/businessManagement/deliveryNotice/detailsPageEdit.vue

@@ -1302,25 +1302,41 @@ export default {
           if (this.contactsData.length == 0) {
             return this.$message.error('商品信息为空')
           }
-          for (let item in this.contactsData) {
-            if (!this.contactsData[item].id) {
-              return this.$message.error('有商品未保存,请先保存')
+          // for (let item in this.contactsData) {
+          //   if (!this.contactsData[item].id) {
+          //     return this.$message.error('有商品未保存,请先保存')
+          //   }
+          // }
+          if (contrastObj(this.form, this.oldForm) ||
+            contrastList(this.contactsData, this.oldGoodsList) ||
+            contrastList(this.advantageProjectData, this.oldFeesList) ||
+            contrastList(this.bankOfDepositData, this.oldUploadList)
+          ) {
+            this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            }).then(() => {
+              this.editCustomer(false)
+            }).catch(() => {
+              this.$message.info('已取消')
+            })
+          } else {
+            //商品信息
+            this.form.deliveryItemsList = this.contactsData
+            this.form.deliveryFeesList = this.advantageProjectData
+            this.form.deliveryFilesList = this.bankOfDepositData
+            if (typeof this.form.corpsTypeId == 'object') {
+              this.form.corpsTypeId = this.form.corpsTypeId.join(",")
             }
+            this.pageLoading = true
+            sendOutGoods(this.form).then(res => {
+              this.$message.success('发货成功')
+              this.queryData(res.data.data.id)
+            }).finally(() => {
+              this.pageLoading = false
+            })
           }
-          //商品信息
-          this.form.deliveryItemsList = this.contactsData
-          this.form.deliveryFeesList = this.advantageProjectData
-          this.form.deliveryFilesList = this.bankOfDepositData
-          if (typeof this.form.corpsTypeId == 'object') {
-            this.form.corpsTypeId = this.form.corpsTypeId.join(",")
-          }
-          this.pageLoading = true
-          sendOutGoods(this.form).then(res => {
-            this.$message.success('发货成功')
-            this.queryData(res.data.data.id)
-          }).finally(() => {
-            this.pageLoading = false
-          })
         } else {
           return false;
         }

+ 19 - 19
src/views/businessManagement/purchaseOrder/detailsPageEdit.vue

@@ -834,25 +834,25 @@ export default {
         }).then(() => {
           this.editCustomer(false)
         }).catch(() => {
-          // this.$message({
-          //   type: 'info',
-          //   message: '已取消'
-          // });
-          this.selection.forEach(item => {
-            lsit.push(item.id)
-          })
-          // lsit.push(this.selection[item].id)
-          let data = {
-            id: this.form.id,
-            orderItemIds: lsit
-          }
-          generateShipment(data).then(res => {
-            this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
-            this.$router.push({
-              path: "/businessManagement/receipt/index",
-              query: {form: JSON.stringify(res.data.data)},
-            });
-          })
+          this.$message({
+            type: 'info',
+            message: '已取消'
+          });
+          // this.selection.forEach(item => {
+          //   lsit.push(item.id)
+          // })
+          // // lsit.push(this.selection[item].id)
+          // let data = {
+          //   id: this.form.id,
+          //   orderItemIds: lsit
+          // }
+          // generateShipment(data).then(res => {
+          //   this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
+          //   this.$router.push({
+          //     path: "/businessManagement/receipt/index",
+          //     query: {form: JSON.stringify(res.data.data)},
+          //   });
+          // })
         })
       } else {
         // lsit.push(this.selection[item].id)

+ 30 - 29
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -1272,17 +1272,18 @@ export default {
         }).then(() => {
           this.editCustomer(false)
         }).catch(() => {
-          this.$confirm("是否生成采购单?", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          }).then(() => {
-            saveSell(this.form.id).then(res => {
-              if (res.data.code == 200) {
-                this.$message.success("生成成功");
-              }
-            });
-          });
+          this.$message.info('已取消')
+          // this.$confirm("是否生成采购单?", {
+          //   confirmButtonText: "确定",
+          //   cancelButtonText: "取消",
+          //   type: "warning"
+          // }).then(() => {
+          //   saveSell(this.form.id).then(res => {
+          //     if (res.data.code == 200) {
+          //       this.$message.success("生成成功");
+          //     }
+          //   });
+          // });
         })
       } else {
         this.$confirm("是否生成采购单?", {
@@ -1358,24 +1359,24 @@ export default {
         }).then(() => {
           this.editCustomer(false)
         }).catch(() => {
-          // this.$message({
-          //   type: 'info',
-          //   message: '已取消'
-          // });
-          this.selection.forEach(item => {
-            lsit.push(item.id)
-          })
-          let data = {
-            id: this.form.id,
-            orderItemIds: lsit
-          }
-          generateShipment(data).then(res => {
-            this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
-            this.$router.push({
-              path: "/businessManagement/deliveryNotice/index",
-              query: {form: JSON.stringify(res.data.data)},
-            });
-          })
+          this.$message({
+            type: 'info',
+            message: '已取消'
+          });
+          // this.selection.forEach(item => {
+          //   lsit.push(item.id)
+          // })
+          // let data = {
+          //   id: this.form.id,
+          //   orderItemIds: lsit
+          // }
+          // generateShipment(data).then(res => {
+          //   this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
+          //   this.$router.push({
+          //     path: "/businessManagement/deliveryNotice/index",
+          //     query: {form: JSON.stringify(res.data.data)},
+          //   });
+          // })
         })
       } else {
         // lsit.push(this.selection[item].id)