瀏覽代碼

审批方法剥离,独立

baichengfei 5 年之前
父節點
當前提交
d00722a66d

+ 5 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -631,7 +631,7 @@ func (this *OilSupplierCertController) CheckSupplierCertCanSubmit() {
 // @Title 企业用户提交按钮  --启动工作流
 // @Description 企业用户提交按钮
 // @Success	200	{object} controllers.Request
-// @router /first-audit/:id [post]
+// @router /company-audit/:id [post]
 func (this *OilSupplierCertController) CompanyAuditEntity() {
 	certId := this.Ctx.Input.Param(":id")
 	unitId := this.GetString("UnitId")
@@ -653,7 +653,8 @@ func (this *OilSupplierCertController) CompanyAuditEntity() {
 		}
 	}()
 
-	if this.User.IsCompanyUser == 1 {
+	if this.User.IsCompanyUser == 0 {
+		// 0二级单位; 1企业用户
 		panic("非企业用户,请用分办功能提交!")
 	}
 
@@ -680,7 +681,7 @@ func (this *OilSupplierCertController) CompanyAuditEntity() {
 	processInstanceId := supplierCertEntity.WorkflowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
-		processInstanceId := svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, "1", supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
+		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, "1", supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
@@ -846,7 +847,7 @@ func (this *OilSupplierCertController) SeparateAuditEntity() {
 	}
 	supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
 	supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
-	supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
+	supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit) // 专业处室
 	certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)

+ 8 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertListener.go

@@ -27,10 +27,12 @@ type ListenerApproveParams struct {
 // @Title 获取二级单位分办人员列表 --回调
 // @Description get user by token
 // @Success 200 {string} string
-// @router /pre-fen-trail [get]
+// @router /pre-fen-trail [post]
 func (this *OilSupplierCertListenerController) PreFenTrialStatus() {
-	businessKey := this.GetString("businessKey")
-	supplierCertId := strings.Split(businessKey, "-")[0]
+	var jsonBlob = this.Ctx.Input.RequestBody
+	var listenerApprove ListenerApproveParams
+	json.Unmarshal(jsonBlob, &listenerApprove)
+	supplierCertId := strings.Split(listenerApprove.BusinessKey, "-")[0]
 
 	certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
 	var supplierCertEntity suppliercert.OilSupplierCert
@@ -47,7 +49,9 @@ func (this *OilSupplierCertListenerController) PreFenTrialStatus() {
 	stepCode := workflow.GetWorkFlowStepCode(supplierCertEntity.SupplierTypeCode)
 	auditSettingService := auditsetting.GetOilAuditSettingService(utils.DBE)
 	approverIds := auditSettingService.GetApproverIdsByStepCodeAndUnitId(stepCode, supplierCertEntity.CommitComId)
-	this.Data["json"] = approverIds
+	var approveInfo ListenerApproveInfo
+	approveInfo.Users = approverIds
+	this.Data["json"] = &approveInfo
 	this.ServeJSON()
 }
 

+ 1 - 1
src/dashoo.cn/frontend_web/src/api/oilsupplier/suppliercert.js

@@ -57,7 +57,7 @@ export default {
       method: 'post'
     })
   },
-  firstAuditEntity (entityId, params, myAxios) {
+  companyAuditEntity (entityId, params, myAxios) {
     return myAxios({
       url: '/suppliercert/company-audit/' + entityId,
       method: 'post',

+ 40 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/goodsedit.vue

@@ -496,7 +496,7 @@
                    @click="dialogVisibleCom = false">取 消</el-button>
         <el-button size="mini"
                    type="primary"
-                   @click="SubpEntity" :loading="loading">确定</el-button>
+                   @click="companySubmitToSecUnitSeparate" :loading="loading">确定</el-button>
       </span>
     </el-dialog>
 
@@ -1682,15 +1682,15 @@ export default {
       })
     },
     selectAuditOrg () {
-      this.getFirAuditerByDept()
-      if (this.selectDept) {
-        this.changeOrgUnit(this.selectDept)
-      }
       if (this.IsCompanyUser === 0) {
+        this.getFirAuditerByDept()
         this.dialogVisible = true
       } else if (this.IsCompanyUser === 1) {
         this.dialogVisibleCom = true
       }
+      if (this.selectDept) {
+        this.changeOrgUnit(this.selectDept)
+      }
     },
     commitAudit () {
       console.log('提交审批')
@@ -1838,6 +1838,41 @@ export default {
         console.error(err)
       })
     },
+    companySubmitToSecUnitSeparate () {
+      if (this.orgauditOptions == null || this.orgauditOptions.length === 0) {
+        this.$message({
+          type: 'warning',
+          message: '该单位没有分办人员!'
+        })
+        return
+      }
+      this.applyLoading = true
+      this.auditform.UnitId = this.UnitOrg
+      this.auditform.CertId = this.certId
+      this.loading = true
+      console.log('企业用户提交参数', this.auditform)
+      apiCert.companyAuditEntity(this.certId, this.auditform, this.$axios)
+        .then(res => {
+          if (res.data.code === 0) {
+            // 保存成功后,初始化数据,变成修改
+            this.initDatas()
+            this.dialogVisibleCom = false
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+          this.loading = false
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
     SubpEntity () {
       if (this.orgauditOptions == null || this.orgauditOptions.length === 0) {
         this.$message({

+ 127 - 30
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplieraudit/_opera/goodsedit.vue

@@ -12,18 +12,18 @@
         </span>
         <span style="float: right;">
           <el-button type="primary" size="mini" style="margin-left: 8px" @click="commonAuditClick()"
-            v-if="auditBtn && this.formData.Status == '1'">初审</el-button>
+            v-if="auditBtn && parseInt(this.formData.Status) === 1">初审</el-button>
           <el-button type="primary" size="mini" style="margin-left: 8px" @click="commonAuditClick()"
-            v-if="auditBtn && this.formData.Status == '2'">复审</el-button>
+            v-if="auditBtn && parseInt(this.formData.Status) === 2">复审</el-button>
           <el-button type="primary" size="mini" style="margin-left: 8px" @click="businessOfficeSeparateAuditClick()"
-            v-if="auditBtn && this.formData.Status == '3' && this.formData.InStyle != '2'">提交专业审核</el-button>
+            v-if="auditBtn && parseInt(this.formData.Status) === 3 && parseInt(this.formData.InStyle) !== 2">提交专业审核</el-button>
           <el-button type="primary" size="mini" style="margin-left: 8px" @click="commonAuditClick()"
-            v-if="auditBtn && this.formData.Status == '4' && this.formData.InStyle != '2'">专业审核</el-button>
+            v-if="auditBtn && parseInt(this.formData.Status) === 4 && parseInt(this.formData.InStyle) !== 2">专业审核</el-button>
           <el-button type="primary" size="mini" style="margin-left: 8px" @click="AuditEntity('5')"
-            v-if="auditBtn && this.formData.Status == '5'">集中评审</el-button>
+            v-if="auditBtn && parseInt(this.formData.Status) === 5">集中评审</el-button>
           <!--&& this.formData.InStyle != '3'-->
-          <el-button type="primary" size="mini" style="margin-left: 8px" @click="AuditEntity()"
-            v-if="this.formData.Status == '10'">分办</el-button>
+          <el-button type="primary" size="mini" style="margin-left: 8px" @click="secUnitSeparateAuditClick()"
+            v-if="parseInt(this.formData.Status) === 10">分办</el-button>
           <!--<router-link>-->
             <el-button type="primary" size="mini" style="margin-left: 8px" onclick="window.history.go(-1)">返回</el-button>
           <!--</router-link>-->
@@ -292,7 +292,7 @@
         <el-button type="primary" size="small" @click="businessOfficeSeparateAuditMakeSure()" :loading="loading">确 定</el-button>
       </div>
     </el-dialog>
-    <el-dialog title="提交初审" :visible.sync="dialogVisible" width="520px">
+    <el-dialog title="提交初审" :visible.sync="dialogSecUnitSeparateVisible" width="520px">
       <el-form ref="searchForm" label-width="100px">
         <el-row>
           <el-col :span="24">
@@ -303,11 +303,8 @@
               </el-radio-group>
             </el-form-item>
           </el-col>
-          <el-col :span="24" v-if="shenheForm.SuccessStatus == 1">
+          <el-col :span="24" v-if="parseInt(shenheForm.SuccessStatus) === 1">
             <el-form-item label="初审人员">
-              <!--<el-input ref="selectAuditer" readonly v-model="auditerName" placeholder="请选择初审人">-->
-                <!--<el-button slot="append" icon="el-icon-search" @click="chooseAuditorShow"></el-button>-->
-              <!--</el-input>-->
               <el-select ref="selectAuditer"
                          v-model="auditer"
                          placeholder="请选择初审人"
@@ -331,9 +328,6 @@
               </el-select>
             </el-form-item>
             <el-form-item label="专业处室" v-if="inStyle != '2' && inStyle != '4' && inStyle != '6' && inStyle != '3' ">
-              <!--<el-cascader :options="orgtreelist" :props="orgtreeprops" :show-all-levels="false" filterable-->
-              <!--style="width: 100%" v-model="majorDept" placeholder="请选择专业处室">-->
-              <!--</el-cascader>-->
               <el-select  v-model="selectDept" filterable disabled
                           placeholder="请选择" style="width: 100%" @change="changeOrgUnit">
                 <el-option  v-for="item in allorgunitOptions" :key="item.Id" :label="item.Fullname"
@@ -342,13 +336,13 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="24" v-if="shenheForm.SuccessStatus == 1">
+          <el-col :span="24" v-if="parseInt(shenheForm.SuccessStatus) === 1">
             <el-form-item label="备注">
               <el-input v-model="auditform.AuditRemark" type="textarea" placeholder="请输入备注内容">
               </el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="24" v-if="shenheForm.SuccessStatus == 0">
+          <el-col :span="24" v-if="parseInt(shenheForm.SuccessStatus) === 0">
             <el-form-item label="退回原因">
               <el-input v-model="backRemark" type="textarea" placeholder="请输入退回原因,不少于5个字!">
               </el-input>
@@ -357,8 +351,8 @@
         </el-row>
       </el-form>
       <span slot="footer" class="dialog-footer">
-        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="makeSure()" :loading="loading">确定</el-button>
+        <el-button @click="dialogSecUnitSeparateVisible = false">取 消</el-button>
+        <el-button type="primary" @click="secUnitSeparateAuditMakeSure()" :loading="loading">确定</el-button>
       </span>
     </el-dialog>
 
@@ -418,7 +412,7 @@
         auditer: '',
         ProfessionalAudit: '', // 业务处室专业审批人id
         auditerName: '',
-        dialogVisible: false,
+        dialogSecUnitSeparateVisible: false,
         chooseAuditorVisible: false,
         dialogCommonAuditMakeSureVisible: false,
         dialogSecondAuditMakeSureVisible: false,
@@ -963,6 +957,7 @@
         console.log('专业审核01')
         this.auditOrgChange()
         this.btnstatus = val
+        console.log('专业审核01状态', this.formData.Status)
         if (this.formData.Status === '3') {
           this.dialogBusinessOfficeSeparateAuditVisible = true
         } else if (this.formData.Status === '1') {
@@ -970,7 +965,7 @@
         } else if (this.formData.Status === '10') {
           this.getFirAuditerByDept()
           this.changeOrgUnit(this.selectDept)
-          this.dialogVisible = true
+          this.dialogSecUnitSeparateVisible = true
         } else {
           console.log('专业审核05')
           this.dialogMakeSure = true
@@ -984,6 +979,34 @@
       },
       commonAuditMakeSure () {
         console.log('审批结果公共提交')
+        this.commonAuditParamsCheck()
+        this.loading = true
+        let params = {
+          result: this.shenheForm.SuccessStatus,
+          AuditRemark: this.shenheForm.AuditorRemark
+        }
+        console.log('审批结果提交参数:', params)
+        apiCert.commonAuditEntity(this.certId, params, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            console.log('审批提交,成功返回')
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+          this.dialogCommonAuditMakeSureVisible = false
+          this.loading = false
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      commonAuditParamsCheck () {
         if (this.shenheForm.SuccessStatus === 1) {
           if (this.shenheForm.AuditorRemark.trim().length < 20 && this.formData.Status !== '3' && this.formData.Status !== '5' && this.formData.Status !== '10') {
             this.$message({
@@ -997,7 +1020,7 @@
               type: 'warning',
               message: '请填写审批意见!'
             })
-            return
+            return false
           }
         } else {
           if (this.shenheForm.AuditorRemark.trim().length < 5 && this.formData.Status !== '3' && this.formData.Status !== '5') {
@@ -1012,16 +1035,32 @@
               type: 'warning',
               message: '请填写退回意见!'
             })
-            return
+            return false
           }
         }
+      },
+      // 二级单位分办审批会话框 ⬇
+      secUnitSeparateAuditClick (val) {
+        console.log('二级单位分办审批会话框')
+        this.auditOrgChange()
+        this.btnstatus = val
+        this.getFirAuditerByDept()
+        this.changeOrgUnit(this.selectDept)
+        this.dialogSecUnitSeparateVisible = true
+      },
+      // 二级单位分办审批结果确认 ⬇
+      secUnitSeparateAuditMakeSure () {
+        console.log('二级单位分办审批结果确认')
+        this.secUnitSeparateAuditParamsCheck()
         this.loading = true
         let params = {
-          result: this.shenheForm.SuccessStatus,
-          AuditRemark: this.shenheForm.AuditorRemark
+          FirstAudit: this.auditer,
+          SecondAudit: this.fushenauditer,
+          ThirdAudit: this.selectDept,
+          AuditRemark: this.auditform.AuditRemark
         }
-        console.log('审批结果提交参数:', params)
-        apiCert.commonAuditEntity(this.certId, params, this.$axios).then(res => {
+        console.log('二级单位分办审批结果提交参数:', params)
+        apiCert.separateAuditEntity(this.certId, params, this.$axios).then(res => {
           if (res.data.code === 0) {
             console.log('审批提交,成功返回')
             this.initDatas()
@@ -1035,13 +1074,71 @@
               message: res.data.message
             })
           }
-          this.dialogCommonAuditMakeSureVisible = false
+          this.dialogSecUnitSeparateVisible = false
           this.loading = false
         }).catch(err => {
           console.error(err)
         })
       },
-      // 业务处室接收——分办
+      // 二级单位分办审批参数检查 ⬇
+      secUnitSeparateAuditParamsCheck () {
+        if (this.shenheForm.SuccessStatus === 1) {
+          if (this.auditer === '') {
+            this.$message({
+              type: 'warning',
+              message: '请选择初审人!'
+            })
+            return
+          }
+          if (this.fushenauditer === '') {
+            this.$message({
+              type: 'warning',
+              message: '请选择复审人!'
+            })
+            return
+          }
+          if (![2, 4, 6].includes(parseInt(this.inStyle))) {
+            if (this.userOptions == null || this.userOptions.length === 0) {
+              this.$message({
+                type: 'warning',
+                message: '该专业科室未配置接收人!'
+              })
+              return
+            }
+          }
+          if (this.shenheForm.AuditorRemark.trim().length < 1 && this.formData.Status === '5') {
+            this.$message({
+              type: 'warning',
+              message: '请填写审批意见!'
+            })
+            return
+          }
+          if (this.shenheForm.AuditorRemark.trim().length < 20 && this.formData.Status !== '3' && this.formData.Status !== '5' && this.formData.Status !== '10') {
+            this.$message({
+              type: 'warning',
+              message: '审批意见不能低于20个字符!'
+            })
+            return false
+          }
+        } else {
+          this.shenheForm.AuditorRemark = this.backRemark
+          if (this.shenheForm.AuditorRemark.trim().length < 5 && this.formData.Status !== '3' && this.formData.Status !== '5') {
+            this.$message({
+              type: 'warning',
+              message: '退回意见不能低于5个字符!'
+            })
+            return
+          }
+          if (this.shenheForm.AuditorRemark.trim().length < 1 && this.formData.Status === '5') {
+            this.$message({
+              type: 'warning',
+              message: '请填写退回意见!'
+            })
+            return false
+          }
+        }
+      },
+      // 业务处室接收——分办 ⬇
       businessOfficeSeparateAuditClick (val) {
         console.log('业务处室接收————分办')
         this.auditOrgChange()
@@ -1193,7 +1290,7 @@
           if (res.data.code === 0) {
             if (this.btnstatus == '5') {
               this.initDatas()
-              this.dialogVisible = false
+              this.dialogSecUnitSeparateVisible = false
               this.dialogMakeSure = false
               this.dialogBusinessOfficeSeparateAuditVisible = false
               this.dialogMakeSure2 = false