소스 검색

法规处审批入库按钮loading, 返回操作提示信息

baichengfei 5 년 전
부모
커밋
51c4a145a8

+ 15 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -1136,6 +1136,21 @@ func (this *AnnualAuditController) UpdateIsStorage() {
 		return
 	}
 
+	defer func() { //finally处理失败的异常
+		if err := recover(); err != nil {
+			errinfo.Message = err.(string)
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else {
+			//返回正确结果
+			errinfo.Message = "入库成功"
+			errinfo.Code = 0
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		}
+	}()
+
 	var annualEntity annualaudit.OilAnnualAudit
 	annualSrv := annualaudit.GetOilAnnualAuditService(utils.DBE)
 	annualSrv.GetEntityById(id, &annualEntity)

+ 14 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -1034,6 +1034,20 @@ func (this *OilSupplierCertController) UpdateIsStorage() {
 		this.ServeJSON()
 		return
 	}
+	defer func() { //finally处理失败的异常
+		if err := recover(); err != nil {
+			errinfo.Message = err.(string)
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else {
+			//返回正确结果
+			errinfo.Message = "入库成功"
+			errinfo.Code = 0
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		}
+	}()
 
 	var supplierCertEntity suppliercert.OilSupplierCert
 	certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)

+ 15 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -1074,6 +1074,21 @@ func (this *OilSupplierCertAppendController) UpdateIsStorage() {
 		return
 	}
 
+	defer func() { //finally处理失败的异常
+		if err := recover(); err != nil {
+			errinfo.Message = err.(string)
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else {
+			//返回正确结果
+			errinfo.Message = "入库成功"
+			errinfo.Code = 0
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		}
+	}()
+
 	var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
 	certAppendSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 	certAppendSrv.GetEntityById(id, &supplierCertAppendEntity)

+ 19 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierstorage/_opera/goodsedit.vue

@@ -26,8 +26,8 @@
           </el-popover>-->
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="createWZAccessCardNo">生成准入编码</el-button>
           <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="saveAccessCardNo">保存准入编码</el-button>
-          <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="confirm">确认入库</el-button>
-          <el-button type="warning" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="backStatus">退回</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="confirm" :loading="btnLoading">确认入库</el-button>
+          <el-button type="warning" size="mini" style="margin-right: 5px" v-if="this,formData.Status == '7'" @click="backStatus" :loading="btnLoading">退回</el-button>
           <!-- <router-link :to="'/oilsupplier/supplierstorage/goodslist'"> -->
             <el-button type="primary" size="mini" style="margin-left: 8px" v-if="showReturn" @click="$router.back(-1)">返回
             </el-button>
@@ -322,6 +322,7 @@
 
     data () {
       return {
+        btnLoading: false,
         backRemark: '',
         dialogVisibleBack: false,
         activeName: '0',
@@ -511,6 +512,7 @@
           Status: '-7',
           BackRemark: this.backRemark
         }
+        this.btnLoading = true
         apiCert.backStatus(this.formData.CertId, params, this.$axios).then(res => {
           this.dialogVisibleBack = false
           if (res.data.code === 0) {
@@ -518,15 +520,17 @@
               type: 'success',
               message: res.data.message
             })
-            this.$router.push('/')
+            this.$router.replace('/')
           } else {
             this.$message({
               type: 'warning',
               message: res.data.message
             })
           }
+          this.btnLoading = false
         }).catch(err => {
           this.dialogVisibleBack = false
+          this.btnLoading = false
           console.log(err)
         })
       },
@@ -584,6 +588,7 @@
           })
           return
         }
+        this.btnLoading = true
         this.$confirm('确认提交入库', '提示', {
           confirmButtonText: '确认',
           cancelButtonText: '取消',
@@ -597,11 +602,13 @@
           tepApi.updateIsStorage(this.certId, params, this.$axios).then(res => {
             if (res.data.code === 0) {
               this.initDatas()
+              this.$refs['WfHistory'].$forceUpdate()
+              console.log('已强制刷新历史审批流程')
               this.$message({
                 type: 'success',
                 message: res.data.message
               })
-              this.$router.push('/')
+              // this.$router.push('/') // TODO 是否跳回首页
             } else {
               this.$message({
                 type: 'warning',
@@ -609,6 +616,13 @@
               })
             }
           })
+          this.btnLoading = false
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消'
+          })
+          this.btnLoading = false
         })
       },
       inputCompany (val) {
@@ -730,7 +744,7 @@
             if (this.formData.Status != 0) {
               this.add_flat = false
             }
-            console.log(this.add_flat)
+            console.log(this.add_flat, '添加标示')
             this.$refs['GoodsInfo'].CityAry = []
             this.$refs['GoodsInfo'].CityAry.push(this.formData.Province)
             this.$refs['GoodsInfo'].CityAry.push(this.formData.City)