Bläddra i källkod

年审不通过调整

huahaiyan 6 år sedan
förälder
incheckning
bc2c308d69

+ 4 - 1
src/dashoo.cn/backend/api/business/oilsupplier/annualaudit/annualaudit.go

@@ -9,6 +9,9 @@ type OilAnnualAudit struct {
 	RecUnitId        string    `xorm:"comment('推荐单位编码') VARCHAR(10)"`
 	CerId            int       `xorm:"comment('准入ID') INT(10)"`
 	Step             int       `xorm:"comment('页面上第几步') INT(10)"`
+	AuditIndex       int       `xorm:"default 0 comment('审批次数') INT(11)"`
+	BusinessKey      string    `xorm:"VARCHAR(255)"`
+	FirstAudit       int       `xorm:"default 0 comment('初审') INT(10)"`
 	AccessCardNo     string    `xorm:"comment('准入证号') VARCHAR(50)"`
 	SupplierTypeName string    `xorm:"comment('准入类别') VARCHAR(50)"`
 	SupplierName     string    `xorm:"comment('企业名称') VARCHAR(50)"`
@@ -17,7 +20,7 @@ type OilAnnualAudit struct {
 	ProjectName      string    `xorm:"comment('工程项目名称') VARCHAR(50)"`
 	Performance      string    `xorm:"comment('履约执行情况') VARCHAR(50)"`
 	WorkRange        string    `xorm:"comment('准入范围') VARCHAR(50)"`
-	Status           int       `xorm:"comment('状态标识') INT(10)"`
+	Status           string    `xorm:"comment('状态标识') VARCHAR(50)"`
 	BackReason       string    `xorm:"comment('退回原因') VARCHAR(255)"`
 	ApplyTime        time.Time `xorm:"comment('年审日期') DATETIME"`
 	AuditDate        time.Time `xorm:"comment('审核日期') DATETIME"`

+ 139 - 45
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -1,20 +1,23 @@
 package oilsupplier
 
 import (
+	"dashoo.cn/backend/api/business/audithistory"
 	"dashoo.cn/backend/api/business/baseUser"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
 	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/paymentinfo"
 	"dashoo.cn/business2/areajson"
 	"dashoo.cn/business2/items"
 	"dashoo.cn/business2/permission"
 
-	"dashoo.cn/backend/api/business/auditsetting"
 	"encoding/json"
 	"fmt"
 	"strconv"
 	"strings"
 	"time"
 
+	"dashoo.cn/backend/api/business/auditsetting"
+
 	"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/workflow"
@@ -35,6 +38,12 @@ type ShenHeModel struct {
 	AuditorRemark string
 }
 
+type ComShenHeModel struct {
+	SupplierId       int
+	SupplierTypeName string
+	Remark           string
+}
+
 // @Title 获取列表
 // @Description get user by token
 // @Success 200 {object} []annualaudit.OilAnnualAudit
@@ -163,6 +172,14 @@ func (this *AnnualAuditController) GetMyTaskEntityList() {
 	//找出待办任务
 	actisvc := workflow.GetActivitiService(utils.DBE)
 	certIdList := actisvc.GetMyTasks(workflow.OIL_AUDIT_APPLY, this.User.Id)
+	annuIdarr := strings.Split(certIdList, ",")
+	for i, item := range annuIdarr {
+		idx := strings.Index(item, "-")
+		if idx >= 0 {
+			annuIdarr[i] = strings.Split(item, "-")[0]
+		}
+	}
+	certIdList = strings.Join(annuIdarr, ",")
 	where += " and Id in (" + certIdList + ")"
 	//根据部门查询待办任务
 	where += " and Status != 2 "
@@ -220,7 +237,7 @@ func (this *AnnualAuditController) GetDictList() {
 	}
 	// 部门
 	orgsvc := organize.GetOrganizeService(utils.DBE)
-	dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'"+this.User.AccCode+"'")
+	dictList["Organizes"] = orgsvc.GetCollectionDetailviewlist("'" + this.User.AccCode + "'")
 	//获得有专业审核接收权限的人员
 	var users1 []userRole.Base_RoleList
 	var auditWorkflow1 auditsetting.Base_OilAuditSetting
@@ -257,7 +274,7 @@ func (this *AnnualAuditController) GetEntity() {
 }
 
 // @Title 添加
-// @Description 新增
+// @Description 新增年审
 // @Success	200	{object} controllers.Request
 // @router /add [post]
 func (this *AnnualAuditController) AddEntity() {
@@ -294,8 +311,8 @@ func (this *AnnualAuditController) AddEntity() {
 	suppliermodel = list[0]
 	model.RecUnitId = suppliermodel.RecUnitId
 	model.CerId, _ = strconv.Atoi(suppliermodel.CertId)
-	model.Status = 0
-	model.Step = 2
+	model.Status = "0"
+	model.Step = 1
 	model.BackReason = suppliermodel.BackReason
 	model.CreateOn = time.Now()
 	model.CreateBy = this.User.Realname
@@ -305,33 +322,29 @@ func (this *AnnualAuditController) AddEntity() {
 	annualId := model.Id
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, utils.ToStr(annualId), this.User.Id)
-	//获得有审核权限的人员
-	//var users []userRole.Base_RoleList
-	//var userIds string
-	//var auditWorkflow auditsetting.Base_OilAuditSetting
-	//rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
-	//rsvc.GetAuditStepRoleEntity(OilAuditSettingName, firstAudit, workflow.FIRST_TRIAL, &auditWorkflow)
-	//users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), "")
-	//for _, tmpUser := range users {
-	//	userIds += strconv.FormatInt(tmpUser.Id, 10) + ","
-	//}
-	//userIds = strings.Trim(userIds, ",")
+	businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
+	processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
 	var ActiComplete workflow.ActiCompleteVM
 	ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-	ActiComplete.BusinessKey = strconv.Itoa(annualId)
+	ActiComplete.BusinessKey = businessKey
 	ActiComplete.UserNames = firstAudit
 	ActiComplete.UserId = this.User.Id
 	ActiComplete.Result = "1"
-	ActiComplete.Remarks = "提交给二级单位初审"
+	ActiComplete.Remarks = model.Remark
 	ActiComplete.CallbackUrl = ""
 	//提交给二级单位初审
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	var auditmodel annualaudit.OilAnnualAudit
 	auditmodel.WorkflowId = processInstanceId
+	auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
+	auditmodel.AuditIndex = model.AuditIndex
+	auditmodel.BusinessKey = businessKey
 	cols := []string{
 		"Id",
 		"WorkflowId",
+		"FirstAudit",
+		"AuditIndex",
+		"BusinessKey",
 	}
 	if receiveVal == "true" {
 		_, err = svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
@@ -357,6 +370,87 @@ func (this *AnnualAuditController) AddEntity() {
 
 }
 
+// @Title 提交审批
+// @Description 提交审批
+// @Success	200	{object} controllers.Request
+// @router /addauditcomm [post]
+func (this *AnnualAuditController) AddAuditEntity() {
+	var model ComShenHeModel
+	var errinfo ErrorDataInfo
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
+	firstAudit := this.GetString("firstAudit")
+	json.Unmarshal(jsonBlob, &model)
+	where := "CerId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName
+	var auditentity annualaudit.OilAnnualAudit
+	svc.GetEntityByWhere(""+OilAnnualAuditName, where, &auditentity)
+	historworkflowid := auditentity.WorkflowId
+	annualId := auditentity.Id
+	svcActiviti := workflow.GetActivitiService(utils.DBE)
+	//重新工作流
+	businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(auditentity.AuditIndex)
+	processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
+
+	var ActiComplete workflow.ActiCompleteVM
+	ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
+	ActiComplete.BusinessKey = businessKey
+	ActiComplete.UserNames = firstAudit
+	ActiComplete.UserId = this.User.Id
+	ActiComplete.Result = "1"
+	ActiComplete.Remarks = model.Remark
+	ActiComplete.CallbackUrl = ""
+	//提交给二级单位初审
+	receiveVal := svcActiviti.TaskComplete(ActiComplete)
+
+	// 存储审批历史
+	var audithistoryentity audithistory.Base_AuditHistory
+	audithistoryentity.EntityId = annualId
+	audithistoryentity.WorkflowId = historworkflowid
+	audithistoryentity.Process = workflow.OIL_AUDIT_APPLY
+	audithistoryentity.BusinessKey = auditentity.BusinessKey
+	audithistoryentity.Type = model.SupplierTypeName
+	audithistoryentity.BackStep = utils.ToStr(auditentity.Status)
+	audithistoryentity.Index = auditentity.AuditIndex
+	audithistoryentity.CreateOn = time.Now()
+	audithistoryentity.CreateBy = this.User.Realname
+	audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+	svc.InsertEntity(audithistoryentity)
+
+	var auditmodel annualaudit.OilAnnualAudit
+	auditmodel.WorkflowId = processInstanceId
+	auditmodel.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
+	auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
+	auditmodel.BusinessKey = businessKey
+	cols := []string{
+		"Id",
+		"WorkflowId",
+		"Status",
+		"FirstAudit",
+		"BusinessKey",
+	}
+	if receiveVal == "true" {
+		_, err := svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
+		if err == nil {
+			//新增
+			errinfo.Message = "添加成功!"
+			errinfo.Code = 0
+			errinfo.Item = annualId
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else {
+			errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		}
+	} else {
+		errinfo.Message = "工作流异常,请联系管理员!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+
+}
 
 // @Title 删除单条信息
 // @Description
@@ -391,7 +485,6 @@ func (this *AnnualAuditController) DeleteEntity() {
 	}
 }
 
-
 // @Title 审核
 // @Description 审核
 // @Success	200	{object} controllers.Request
@@ -406,7 +499,7 @@ func (this *AnnualAuditController) AuditCallback() {
 	var err error
 	var errinfo ErrorInfo
 	var cols []string = []string{"Status"}
-	entityempty.Status, _ = strconv.Atoi(status)
+	entityempty.Status = status
 	err = svc.UpdateEntityBytbl(OilAnnualAuditName, annualId, &entityempty, cols)
 	if err != nil {
 		errinfo.Message = "审核错误!"
@@ -425,7 +518,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 	svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
 	var jsonblob = this.Ctx.Input.RequestBody
 	var dataother ShenHeModel
-	ProfAudit:= this.GetString("ProfAudit")
+	ProfAudit := this.GetString("ProfAudit")
 	json.Unmarshal(jsonblob, &dataother)
 	var list annualaudit.OilAnnualAudit
 	where := " Id = '" + strconv.Itoa(dataother.AnnualId) + "'"
@@ -436,7 +529,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		var errinfo ErrorInfo
 		var auditset []auditsetting.Base_OilAuditSetting
 		where := "OrganizeId=" + ProfAudit + " and AuditStepCode='" + workflow.PROF_RECE + "'"
-		svc.GetEntitysByWhere(OilAuditSettingName,where, &auditset)
+		svc.GetEntitysByWhere(OilAuditSettingName, where, &auditset)
 		var users []userRole.Base_RoleList
 		if auditset != nil {
 			svc := auditsetting.GetOilAuditSettingService(utils.DBE)
@@ -449,7 +542,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		userIds = strings.Trim(userIds, ",")
 		var ActiComplete workflow.ActiCompleteVM
 		ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-		ActiComplete.BusinessKey = strconv.Itoa(dataother.AnnualId)
+		ActiComplete.BusinessKey = list.BusinessKey
 		ActiComplete.UserNames = userIds
 		ActiComplete.UserId = this.User.Id
 		ActiComplete.Result = "1"
@@ -458,7 +551,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		//提交给二级单位初审
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
-		auditmodel.Status = 1
+		auditmodel.Status = "1"
 		cols := []string{
 			"Id",
 			"Status",
@@ -470,7 +563,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -487,7 +580,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		var errinfo ErrorInfo
 		var ActiComplete workflow.ActiCompleteVM
 		ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-		ActiComplete.BusinessKey = strconv.Itoa(dataother.AnnualId)
+		ActiComplete.BusinessKey = list.BusinessKey
 		ActiComplete.UserNames = ""
 		ActiComplete.UserId = this.User.Id
 		ActiComplete.Result = "0"
@@ -495,10 +588,12 @@ func (this *AnnualAuditController) AnnualAudit() {
 		ActiComplete.CallbackUrl = ""
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
-		auditmodel.Status = 2
+		auditmodel.Status = "2"
+		auditmodel.AuditIndex = auditmodel.AuditIndex + 1
 		cols := []string{
 			"Id",
 			"Status",
+			"AuditIndex",
 		}
 		if receiveVal == "true" {
 			_, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
@@ -507,7 +602,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -519,11 +614,11 @@ func (this *AnnualAuditController) AnnualAudit() {
 			this.Data["json"] = &errinfo
 			this.ServeJSON()
 		}
-	} 	else if dataother.SuccessStatus == 3 {
+	} else if dataother.SuccessStatus == 3 {
 		var errinfo ErrorInfo
 		var ActiComplete workflow.ActiCompleteVM
 		ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-		ActiComplete.BusinessKey = strconv.Itoa(dataother.AnnualId)
+		ActiComplete.BusinessKey = list.BusinessKey
 		ActiComplete.UserNames = ProfAudit
 		ActiComplete.UserId = this.User.Id
 		ActiComplete.Result = "1"
@@ -532,7 +627,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		//提交给业务处室专业审核
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
-		auditmodel.Status = 3
+		auditmodel.Status = "3"
 		cols := []string{
 			"Id",
 			"Status",
@@ -544,7 +639,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "分配错误!" + utils.AlertProcess(err.Error())
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -560,7 +655,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		var errinfo ErrorInfo
 		var ActiComplete workflow.ActiCompleteVM
 		ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-		ActiComplete.BusinessKey = strconv.Itoa(dataother.AnnualId)
+		ActiComplete.BusinessKey = list.BusinessKey
 		ActiComplete.UserNames = ""
 		ActiComplete.UserId = this.User.Id
 		ActiComplete.Result = "1"
@@ -568,7 +663,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		ActiComplete.CallbackUrl = ""
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
-		auditmodel.Status = 4
+		auditmodel.Status = "4"
 		auditmodel.Step = 3
 		cols := []string{
 			"Id",
@@ -580,19 +675,19 @@ func (this *AnnualAuditController) AnnualAudit() {
 			paysvc := paymentinfo.GetPaymentService(utils.DBE)
 			var Amount float64
 			if list.SupplierTypeName == "01" {
-				Amount =  6000
-			}else if list.SupplierTypeName == "02"{
+				Amount = 6000
+			} else if list.SupplierTypeName == "02" {
 				Amount = 7000
-			}else if list.SupplierTypeName == "03" {
+			} else if list.SupplierTypeName == "03" {
 				Amount = 8000
 			}
-			err = paysvc.AddPaymentinfo(list.SupplierId, list.CerId, Amount,"2")
+			err = paysvc.AddPaymentinfo(list.SupplierId, list.CerId, Amount, "2")
 			if err == nil {
 				errinfo.Message = "审核通过!"
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -604,11 +699,11 @@ func (this *AnnualAuditController) AnnualAudit() {
 			this.Data["json"] = &errinfo
 			this.ServeJSON()
 		}
-	}else if dataother.SuccessStatus == 5 {
+	} else if dataother.SuccessStatus == 5 {
 		var errinfo ErrorInfo
 		var ActiComplete workflow.ActiCompleteVM
 		ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
-		ActiComplete.BusinessKey = strconv.Itoa(dataother.AnnualId)
+		ActiComplete.BusinessKey = list.BusinessKey
 		ActiComplete.UserNames = ""
 		ActiComplete.UserId = this.User.Id
 		ActiComplete.Result = "0"
@@ -616,7 +711,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 		ActiComplete.CallbackUrl = ""
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
-		auditmodel.Status = 5
+		auditmodel.Status = "5"
 		cols := []string{
 			"Id",
 			"Status",
@@ -628,7 +723,7 @@ func (this *AnnualAuditController) AnnualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -642,4 +737,3 @@ func (this *AnnualAuditController) AnnualAudit() {
 		}
 	}
 }
-

+ 25 - 24
src/dashoo.cn/backend/api/controllers/oilsupplier/qualchange.go

@@ -1,15 +1,16 @@
 package oilsupplier
 
 import (
-	"dashoo.cn/backend/api/business/oilsupplier/qualchange"
-	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
-	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
-	"dashoo.cn/business2/permission"
 	"encoding/json"
 	"strconv"
 	"strings"
 	"time"
 
+	"dashoo.cn/backend/api/business/oilsupplier/qualchange"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
+	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
+	"dashoo.cn/business2/permission"
+
 	"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/workflow"
@@ -53,7 +54,6 @@ func (this *QualChangeController) GetEntityList() {
 	SupplierName := this.GetString("SupplierName")
 	CreateOn := this.GetString("CreateOn")
 
-
 	if CommercialNo != "" {
 		where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
 	}
@@ -80,7 +80,7 @@ func (this *QualChangeController) GetEntityList() {
 		where = where + " and a.CreateUserId = '" + this.User.Id + "'"
 	} else {
 		//超级管理员和有查看所有数据权限的用户不加条件
-		svcPerm :=permission.GetPermissionService(utils.DBE)
+		svcPerm := permission.GetPermissionService(utils.DBE)
 		isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
 		if !svcPerm.IsAdmin(this.User.Id) && !isauth {
 			where = where + " and a.CreateUserId = '" + this.User.Id + "'"
@@ -89,7 +89,7 @@ func (this *QualChangeController) GetEntityList() {
 
 	svc := qualchange.GetQualChangeService(utils.DBE)
 	var list []qualchange.OilSupplierQual
-	total, list:= svc.GetQualPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilSupplierFileName, OilQualChangeMainName, orderby, where, page.CurrentPage, page.Size)
+	total, list := svc.GetQualPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilSupplierFileName, OilQualChangeMainName, orderby, where, page.CurrentPage, page.Size)
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
@@ -192,7 +192,7 @@ func (this *QualChangeController) FileList() {
 	if SupplierTypeCode != "" {
 		where = where + " and a.SupplierTypeCode in ( '000', '" + SupplierTypeCode + "')"
 	}
-	total := svc.GetQualPagingEntities(OilSupplierFileName,OilQualChangeDetailName, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	total := svc.GetQualPagingEntities(OilSupplierFileName, OilQualChangeDetailName, page.CurrentPage, page.Size, orderby, asc, &list, where)
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
@@ -228,13 +228,14 @@ func (this *QualChangeController) AuditFileList() {
 		where = where + " and a.SupplierTypeCode in ( '000', '" + SupplierTypeCode + "')"
 	}
 	where = where + " and b.FileUrl != ''"
-	total := svc.GetQualPagingEntities(OilSupplierFileName,OilQualChangeDetailName, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	total := svc.GetQualPagingEntities(OilSupplierFileName, OilQualChangeDetailName, page.CurrentPage, page.Size, orderby, asc, &list, where)
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }
+
 // @Title 获取年审企业名称
 // @Description 获取实体
 // @Success 200 {object} annualaudit.OilAnnualAudit
@@ -323,7 +324,7 @@ func (this *QualChangeController) AddEntity() {
 	suppliermodel = list[0]
 	model.RecUnitId = suppliermodel.RecUnitId
 	model.CerId, _ = strconv.Atoi(suppliermodel.CertId)
-	model.Status = 0
+	model.Status = "0"
 	model.BackReason = suppliermodel.BackReason
 	//svc.GetEntitysByWhere(""+OilSupplierName, supwhere, &supplierlist)
 	model.CreateOn = time.Now()
@@ -333,7 +334,7 @@ func (this *QualChangeController) AddEntity() {
 	_, err := svc.InsertEntityBytbl(""+OilAnnualAuditName, &model)
 	annualId := model.Id
 	//工作流开始
-	processInstanceId,_ := svc.SubmitOrgAudit("", model.WorkflowId, utils.ToStr(model.CerId), utils.ToStr(model.Id), workflow.OIL_AUDIT_APPLY, workflow.FIRST_TRIAL, this.User.Id, "1", "提交给二级单位初审", OilSupplierCertSubName, OilClassOrgSettingName)
+	processInstanceId, _ := svc.SubmitOrgAudit("", model.WorkflowId, utils.ToStr(model.CerId), utils.ToStr(model.Id), workflow.OIL_AUDIT_APPLY, workflow.FIRST_TRIAL, this.User.Id, "1", "提交给二级单位初审", OilSupplierCertSubName, OilClassOrgSettingName)
 	var auditmodel annualaudit.OilAnnualAudit
 	auditmodel.WorkflowId = processInstanceId
 	cols := []string{
@@ -464,9 +465,9 @@ func (this *QualChangeController) EditQualChange() {
 		mainentirt.SupplierId = model.SupplierId
 		mainentirt.Status = "0"
 		mainentirt.Step = 1
-		svc.InsertEntityBytbl(OilQualChangeMainName,&mainentirt)
+		svc.InsertEntityBytbl(OilQualChangeMainName, &mainentirt)
 		qualmainId = mainentirt.Id
-	}else {
+	} else {
 		qualmainId = qualmain[0].Id
 	}
 	entity = model
@@ -477,7 +478,7 @@ func (this *QualChangeController) EditQualChange() {
 	entity.CreateOn = time.Now()
 	entity.CreateBy = this.User.Realname
 	entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-	_,err := svc.InsertEntityBytbl(OilQualChangeDetailName,&entity)
+	_, err := svc.InsertEntityBytbl(OilQualChangeDetailName, &entity)
 	if err == nil {
 		errinfo.Message = "操作成功!"
 		errinfo.Code = 0
@@ -503,7 +504,7 @@ func (this *QualChangeController) AuditEntity() {
 	svc := qualchange.GetQualChangeService(utils.DBE)
 	var suppentity supplier.OilSupplier
 	//供方信息
-	svc.GetEntityById(suppId,&suppentity)
+	svc.GetEntityById(suppId, &suppentity)
 	var qualmain qualchange.OilQualChangeMain
 	where := " SupplierId = " + suppId
 	svc.GetEntity(&qualmain, where)
@@ -560,13 +561,13 @@ func (this *QualChangeController) AuditEntity() {
 			"SupplierName",
 			"CommercialNo",
 		}
-		_,err := svc.UpdateEntityByIdCols(qualmain.Id, qualmainmodel, cols)
+		_, err := svc.UpdateEntityByIdCols(qualmain.Id, qualmainmodel, cols)
 		if err == nil {
 			errinfo.Message = "提交成功!"
 			errinfo.Code = 0
 			this.Data["json"] = &errinfo
 			this.ServeJSON()
-		}else {
+		} else {
 			errinfo.Message = "提交失败!"
 			errinfo.Code = -1
 			this.Data["json"] = &errinfo
@@ -595,8 +596,8 @@ func (this *QualChangeController) QualAudit() {
 	var qualmodel qualchange.OilQualChangeMain
 	svc.GetEntityById(utils.ToStr(dataother.QualId), &qualmodel)
 	var qualdetail []qualchange.OilQualChangeDetail
-	where := "ParentId = "+ utils.ToStr(qualid)
-	svc.GetEntities(&qualdetail,where)
+	where := "ParentId = " + utils.ToStr(qualid)
+	svc.GetEntities(&qualdetail, where)
 	var qualchanentity qualchange.OilQualChangeMain
 	var errinfo ErrorDataInfo
 	defer func() { //finally处理失败的异常
@@ -638,11 +639,11 @@ func (this *QualChangeController) QualAudit() {
 				"Step",
 			}
 			_, err := svc.UpdateEntityByIdCols(qualid, qualchanentity, cols)
-			if err == nil{
+			if err == nil {
 				//原信息表更新
 				if qualmodel.Status == "2" {
 					if len(qualdetail) > 0 {
-						for i:= 0; i<len(qualdetail); i++ {
+						for i := 0; i < len(qualdetail); i++ {
 							var supfilemodel supplierfile.OilSupplierFile
 							supfilemodel.FileName = qualdetail[i].FileName
 							supfilemodel.FileUrl = qualdetail[i].FileUrl
@@ -655,7 +656,7 @@ func (this *QualChangeController) QualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "提交失败!"
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -690,7 +691,7 @@ func (this *QualChangeController) QualAudit() {
 				errinfo.Code = 0
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-			}else {
+			} else {
 				errinfo.Message = "提交失败!"
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
@@ -704,4 +705,4 @@ func (this *QualChangeController) QualAudit() {
 			return
 		}
 	}
-}
+}

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/annualaudit.js

@@ -51,6 +51,13 @@ export default {
       data: formData
     })
   },
+  commitauditEntity (formData, FirstAudit, myAxios) {
+    return myAxios({
+      url: '/annualaudit/addauditcomm?firstAudit=' + FirstAudit,
+      method: 'post',
+      data: formData
+    })
+  },
   updateEntity (entityId, formData, myAxios) {
     return myAxios({
       url: '/annualaudit/update/' + entityId,

+ 11 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/auditoperation.vue

@@ -288,6 +288,7 @@
         dictData: null,
         applyLoading: false,
         majorDept: [],
+        auditbusList: [], // 待审核业务
         secauditerOptions: [], //专业审批人
         secorgtreelist: [], //专业审核人部门
         orgtreelist: [], //专业审核部门
@@ -413,7 +414,6 @@
           business: '',
           instance: '',
           AnnualStatus:''
-
         },
       }
     },
@@ -422,7 +422,9 @@
       if (this.$route.query.certid) {
         this.certId = this.$route.query.certid + ''
       }
+      
       this.AnnualStatus = this.$route.query.AnnualStatus
+      this.entrydetail.AnnualStatus = this.AnnualStatus
       this.WorkflowId = this.$route.query.WorkflowId + ''
       this.annualId = this.$route.query.annualId
       this.getDictOptions()
@@ -496,7 +498,7 @@
         this.formData.CompanyUrl = fdata.CompanyUrl
         this.formData.HseTraining = fdata.HseTraining
         this.formData.SpecTypeCode = fdata.SpecTypeCode
-
+        console.log("---this.formData.Step---",this.formData.Step)
         this.$refs["TechInfo"].CityAry = []
         this.$refs["TechInfo"].CityAry.push(this.formData.Province)
         this.$refs["TechInfo"].CityAry.push(this.formData.City)
@@ -598,6 +600,12 @@
           })
           .then(res => {
             _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'Parentid', 'Id,Fullname')
+            if (_this.authUser.Profile.IsCompanyUser === 0) {
+              this.secOrganize = _this.authUser.Profile.Superior.split(',').map((val) => {
+                return parseInt(val)
+              })
+              this.auditOrgChang(this.secOrganize)
+            }
           })
           .catch(err => {
             console.error(err)
@@ -683,6 +691,7 @@
               this.dialogMakeSure = false
               this.dialogProfAudit = false
               this.AnnualStatus = -1
+              this.entrydetail.AnnualStatus = this.AnnualStatus
             } else {
               this.$message({
                 type: 'warning',

+ 39 - 30
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/operation.vue

@@ -201,30 +201,27 @@
         </el-tab-pane>
       </el-tabs>
     </el-card>
-    <el-dialog title="提交申请" :visible.sync="addshow" width="360px">
+    <el-dialog title="提交申请" :visible.sync="addshow" width="520px">
       <el-form label-width="90px" :model="entityForm" :rules="rules" ref="EntityFormref">
         <el-row>
           <el-col :span="24">
-            <el-form-item label="审批单位" prop="FirstAudit" required>
-              <el-cascader :options="orgtreelist" :props="orgtreeprops" change-on-select :show-all-levels="false"
-                filterable @change="auditOrgChang" style="width: 100%" v-model="entityForm.FirstAudit"
-                placeholder="请选择组织"></el-cascader>
-              <!-- <el-select ref="selectauditOrg" v-model="entityForm.FirstAudit" placeholder="请选择" style="width: 100%"
-                @change="auditOrgChang" filterable allow-create default-first-option>
-                <el-option v-for="item in organizeOption" :key="item.id" :label="item.name" :value="item.id">
-                </el-option>
-              </el-select> -->
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="审批人" prop="auditer" required>
+            <!-- <el-form-item label="审批人" prop="auditer" required>
               <el-select ref="selectAuditer" v-model="entityForm.auditer" placeholder="请选择" style="width: 100%"
                 filterable allow-create default-first-option>
                 <el-option v-for="item in auditerOption" :key="item.id" :label="item.realname" :value="item.id">
                 </el-option>
               </el-select>
+            </el-form-item> -->
+             <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-form-item>
+          </el-col>
+           <el-col :span="24">
+            <el-form-item label="说明">
+              <el-input v-model="entityForm.Remark" type="textarea" placeholder="请输入说明内容">
+              </el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -235,6 +232,8 @@
       </span>
       <br>
     </el-dialog>
+    <choose-auditor ref="chooseAuditor" @close="setAuditer" @hideChooseAuditer="chooseAuditorVisible=false"
+      :visible="chooseAuditorVisible"></choose-auditor>
   </div>
 </template>
 
@@ -256,6 +255,7 @@
   import BusinessList from '@/components/oilsupplier/businesslist'
   import TechInfo from '@/components/oilsupplier/techinfo'
   import AuditbusList from '@/components/oilsupplier/auditbuslist'
+  import ChooseAuditor from '@/components/oilsupplier/chooseauditor'
 
 
   export default {
@@ -276,12 +276,14 @@
       BusinessList, //选择准入范围
       AuditbusList, // 待审核业务
       TechInfo,
+      ChooseAuditor
     },
     name: 'oiltechnologyserviceEdit',
 
     data() {
       return {
-        activeName: '1',
+        chooseAuditorVisible: false,
+        activeName: '0',
         orgtreelist: [],
         orgtreeprops: {
           value: 'id',
@@ -289,6 +291,7 @@
           children: 'children'
         },
         Step: '',
+        auditbusList: [], // 待审核业务
         organizeOption: [], // 审批部门
         auditerOption: [],
         addshow: false,
@@ -303,15 +306,14 @@
         businessList: [], //准入业务
         serviceId: '',
         certId: '',
+        auditer: '',
+        auditerName: '',
         classId: '',
         WorkflowId: '',
         entityForm: {
-          Id: '',
-          SupplierName: '',
           SupplierId: '',
           SupplierTypeName: '',
-          FirstAudit: '',
-          auditer: '',
+          Remark: ''
         },
         formData: {
           Id: '',
@@ -416,11 +418,6 @@
         },
         Status: '',
         rules: {
-          FirstAudit: [{
-            required: true,
-            message: '请选择初审单位',
-            trigger: 'blur'
-          }],
           auditer: [{
             required: true,
             message: '请选择审批人',
@@ -435,13 +432,13 @@
         this.certId = this.$route.query.certid + ''
       }
       this.Status = this.$route.query.Status + ''
-      this.Step = this.$route.query.Step
+      this.Step = parseInt(this.$route.query.Step)
       this.WorkflowId = this.$route.query.WorkflowId + ''
       this.getDictOptions();
       this.getorgtreelist()
       this.formData.Id = this.serviceId
       this.initDatas();
-      console.log("---this.formData---", this.formData)
+      console.log("---this.Status---", this.Status)
       // console.log(this.serviceId);
       // if(this.serviceId != 'add' && this.serviceId>0) {
       //   this.formData.Id = this.serviceId;
@@ -544,6 +541,16 @@
           console.error(err)
         })
       },
+      setAuditer(val, name) {
+        console.log("------",val,name)
+        this.auditer = val
+        this.auditerName = name
+        this.chooseAuditorVisible = false
+      },
+      chooseAuditorShow() {
+        this.$refs['chooseAuditor'].getorgtreelist(this.formData.SupplierTypeCode)
+        this.chooseAuditorVisible = true
+      },
       equipmentdialog() {
         this.$refs["equipmentList"].showDialog()
       },
@@ -649,8 +656,10 @@
       addAnnualAudit() {
         this.$refs['EntityFormref'].validate((valid) => {
           if (valid) {
-            console.log("----this.entityForm.auditer--", this.entityForm.auditer)
-            annualapi.addEntity(this.entityForm, this.entityForm.auditer, this.$axios).then(res => {
+            this.entityForm.SupplierId = parseInt(this.certId)
+            this.entityForm.SupplierTypeName = this.formData.SupplierTypeCode
+            console.log("----this.entityForm--", this.entityForm)
+            annualapi.commitauditEntity(this.entityForm, this.auditer, this.$axios).then(res => {
               if (res.data.code === 0) {
                 console.log("--------res.data----", res.data)
                 //保存成功后,初始化数据,变成修改

+ 52 - 40
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/index.vue

@@ -48,7 +48,7 @@
                 更多<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
               <el-dropdown-menu slot="dropdown">
-                <el-dropdown-item :command="GetCommand('History', scope.row)">审批历史</el-dropdown-item>
+                <el-dropdown-item :command="GetCommand('History', scope.row)">审批流程</el-dropdown-item>
                 <el-dropdown-item :command="GetCommand('Delete', scope.row)" :disabled="scope.row.Status != 0" divided>
                   删除数据</el-dropdown-item>
               </el-dropdown-menu>
@@ -172,30 +172,16 @@
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="初审单位" prop="FirstAudit" required>
-              <el-cascader :options="orgtreelist" :props="orgtreeprops" change-on-select :show-all-levels="false"
-                filterable @change="auditOrgChang" style="width: 100%" v-model="entityForm.FirstAudit"
-                placeholder="请选择组织"></el-cascader>
-              <!-- <el-select ref="selectauditOrg" v-model="entityForm.FirstAudit" placeholder="请选择" style="width: 100%"
-                @change="auditOrgChang" filterable allow-create default-first-option>
-                <el-option v-for="item in organizeOption" :key="item.id" :label="item.name" :value="item.id">
-                </el-option>
-              </el-select> -->
+            <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-form-item>
           </el-col>
-        </el-row>
-        <el-row>
           <el-col :span="24">
-            <el-form-item label="审批人" required>
-              <el-select ref="selectAuditer" v-model="entityForm.auditer" placeholder="请选择"
-                         style="width: 100%" filterable allow-create default-first-option>
-                <el-option
-                  v-for="item in auditerOption"
-                  :key="item.id"
-                  :label="item.realname"
-                  :value="item.id">
-                </el-option>
-              </el-select>
+            <el-form-item label="说明">
+              <el-input v-model="entityForm.Remark" type="textarea" placeholder="请输入说明内容">
+              </el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -209,6 +195,8 @@
     <el-dialog title="审核历史查看" :visible.sync="historyVisible" width="900px">
       <wf-history ref="WfHistory" :entryinfo="entrydetail"></wf-history>
     </el-dialog>
+    <choose-auditor ref="chooseAuditor" @close="setAuditer" @hideChooseAuditer="chooseAuditorVisible=false"
+      :visible="chooseAuditorVisible"></choose-auditor>
   </div>
 </template>
 <script>
@@ -216,12 +204,14 @@
     mapGetters
   } from 'vuex';
   import WfHistory from '@/components/workflow/wfhistory.vue'
-  import supplierapi from '@/api/oilsupplier/supplier';
-  import api from '@/api/oilsupplier/annualaudit';
+  import supplierapi from '@/api/oilsupplier/supplier'
+  import api from '@/api/oilsupplier/annualaudit'
+  import ChooseAuditor from '@/components/oilsupplier/chooseauditor'
 
   export default {
     components: {
       WfHistory,
+      ChooseAuditor
     },
     computed: {
       ...mapGetters({
@@ -232,6 +222,7 @@
 
     data() {
       return {
+        chooseAuditorVisible: false,
         orgtreelist: [],
         orgtreeprops: {
           value: 'id',
@@ -245,6 +236,7 @@
         organizeOption: [], // 审批部门
         auditerOption: [],
         auditer: '',
+        auditerName: '',
         //列表数据
         selectsupplierlist: [],
         entityList: [],
@@ -275,6 +267,7 @@
           FirstAudit: '',
           auditer: '',
           Step: 0,
+          Remark: ''
         },
         searchForm: {
           Id: '',
@@ -370,6 +363,38 @@
           console.error(err)
         })
       },
+      getorgtreelist() {
+        let _this = this
+        let params = {
+          IsInnerOrganize: 1
+        }
+        _this.$axios.get('organizes/orgalllist', {
+            params
+          })
+          .then(res => {
+            _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'Parentid', 'Id,Fullname')
+            if (_this.authUser.Profile.IsCompanyUser === 0) {
+              this.secOrganize = _this.authUser.Profile.Superior.split(',').map((val) => {
+                return parseInt(val)
+              })
+              this.auditOrgChang(this.secOrganize)
+            }
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+      setAuditer(val, name) {
+        console.log("------", val, name)
+        this.auditer = val
+        this.auditerName = name
+        this.chooseAuditorVisible = false
+      },
+      chooseAuditorShow() {
+        console.log("---this.entityForm---",this.entityForm)
+        this.$refs['chooseAuditor'].getorgtreelist(this.entityForm.SupplierTypeName)
+        this.chooseAuditorVisible = true
+      },
       supplierchange(value) {
         let obj = {};
         obj = this.selectsupplierlist.find((item) => {
@@ -380,6 +405,7 @@
       addAnnualAudit() {
         this.$refs['EntityFormref'].validate((valid) => {
           if (valid) {
+            this.entityForm.auditer = this.auditer
             console.log("----this.entityForm.auditer--", this.entityForm.auditer)
             api.addEntity(this.entityForm, this.entityForm.auditer, this.$axios).then(res => {
               if (res.data.code === 0) {
@@ -424,28 +450,14 @@
         })
       },
 
-      auditOrgChang(val) {
-        let deptid = val[val.length - 1]
-        console.log(deptid)
-        this.auditerOption = []
-        this.auditer = ''
-        let auditstepcode = 'FIRST_TRIAL'
-        supplierapi.getAuditerByDept(deptid, auditstepcode, this.$axios).then(res => {
-          this.auditerOption = res.data.item
-          console.log("----this.auditerOption--",this.auditerOption )
-        }).catch(err => {
-          console.error(err)
-        })
-      },
-
       getorgtreelist() {
         let _this = this
         let params = {
           IsInnerOrganize: 1
         }
         _this.$axios.get('organizes/orgalllist', {
-          params
-        })
+            params
+          })
           .then(res => {
             _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'Parentid', 'Id,Fullname')
           })