Bläddra i källkod

年审到期时间判断改变

huahaiyan 6 år sedan
förälder
incheckning
2add3f53c5

+ 1 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -27,7 +27,7 @@ func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName
 	sqlCount += ` where ` + where
 
 	var sql string
-	sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.InFlag, `
+	sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.InFlag, b.ApplyTime, `
 	sql += ` b.WorkerTotal, `
 	sql += ` b.ContractNum, `
 	sql += ` b.UniversityNum, `

+ 36 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -309,8 +309,26 @@ func (this *AnnualAuditController) AddEntity() {
 	}
 	var suppliermodel supplier.OilSupplierView
 	suppliermodel = list[0]
+	if suppliermodel.InFlag == "3" {
+		errinfo.Message = "超过两年未年审,您已无法提交!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	aplytime := suppliermodel.ApplyTime
+	subtime := this.getTimeSub(aplytime, time.Now())
+	lefttime := subtime-3
+	if subtime > 3 {
+		errinfo.Message = "还不到年审时间!请"+ utils.ToStr(lefttime) +"月后再来申请"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
 	model.RecUnitId = suppliermodel.RecUnitId
 	model.CerId, _ = strconv.Atoi(suppliermodel.CertId)
+	model.ApplyTime = suppliermodel.ApplyTime
 	model.Status = "0"
 	model.Step = 1
 	model.BackReason = suppliermodel.BackReason
@@ -367,9 +385,13 @@ func (this *AnnualAuditController) AddEntity() {
 		this.Data["json"] = &errinfo
 		this.ServeJSON()
 	}
-
 }
 
+func (this *AnnualAuditController) getTimeSub(t1, t2 time.Time) int {
+	t1 = time.Date(t1.Year(), t1.Month(), t1.Day(), 0, 0, 0, 0, time.Local)
+	t2 = time.Date(t2.Year(), t2.Month(), t2.Day(), 0, 0, 0, 0, time.Local)
+	return int(t1.Sub(t2).Hours() / 24 / 30)
+}
 // @Title 提交审批
 // @Description 提交审批
 // @Success	200	{object} controllers.Request
@@ -663,15 +685,28 @@ func (this *AnnualAuditController) AnnualAudit() {
 		ActiComplete.CallbackUrl = ""
 		receiveVal := svcActiviti.TaskComplete(ActiComplete)
 		var auditmodel annualaudit.OilAnnualAudit
+		oldaplydate := auditmodel.ApplyTime
+		aplydatechange := oldaplydate.Format("2006-01-02 15:04:05")
+		local, _ := time.LoadLocation("Local")
+		oldtimeaply, _ := time.ParseInLocation("2006-01-02 15:04:05", aplydatechange, local)
 		auditmodel.Status = "4"
 		auditmodel.Step = 3
+		auditmodel.ApplyTime = oldtimeaply.AddDate(1,0,0)
 		cols := []string{
 			"Id",
 			"Status",
 			"Step",
+			"ApplyTime",
+		}
+		var certmodel suppliercert.OilSupplierCert
+		certmodel.ApplyTime = oldtimeaply.AddDate(1,0,0)
+		certcols := []string{
+			"Id",
+			"ApplyTime",
 		}
 		if receiveVal == "true" {
 			_, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
+			_, err = svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
 			paysvc := paymentinfo.GetPaymentService(utils.DBE)
 			var Amount float64
 			if list.SupplierTypeName == "01" {

+ 16 - 13
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/_opera/auditoperation.vue

@@ -21,9 +21,9 @@
             </el-steps>
             <el-button slot="reference" plain size="mini" style="margin-left: 8px">查看进度</el-button>
           </el-popover>
-          <el-button type="primary" size="mini" @click="annualAudit()" v-if="AnnualStatus == 0 ||AnnualStatus == 3">审核
+          <el-button type="primary" style="margin-left: 8px;" size="mini" @click="annualAudit()" v-if="AnnualStatus == 0 ||AnnualStatus == 3">审核
           </el-button>
-          <el-button type="primary" size="mini" @click="profAudit()" v-if="AnnualStatus == 1">专业审核分配</el-button>
+          <el-button type="primary" style="margin-left: 8px;" size="mini" @click="profAudit()" v-if="AnnualStatus == 1">专业审核分配</el-button>
           <router-link :to="'/oilsupplier/annualaudit/annualfistaudit'">
             <el-button type="primary" size="mini" style="margin-left: 8px;">返回</el-button>
           </router-link>
@@ -614,17 +614,20 @@
         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)
-            }
+        // _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)
+        //     }
+        api.getDictListByStatus(params, this.$axios).then(res => {
+          this.dictData = res.data.items
+          this.orgtreelist = window.toolfun_gettreejson(res.data.items['ProOrgList'], 'id', 'pId', 'id,name')
           })
           .catch(err => {
             console.error(err)

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

@@ -21,7 +21,7 @@
             </el-steps>
             <el-button slot="reference" plain size="mini" style="margin-left: 8px">查看进度</el-button>
           </el-popover>
-          <el-button type="primary" size="mini" @click="addshow =true" v-if="Status == '2'">提交审核</el-button>
+          <el-button type="primary" style="margin-left: 8px;" size="mini" @click="addshow =true" v-if="Status == '2'">提交审核</el-button>
           <router-link :to="'/oilsupplier/annualaudit'">
             <el-button type="primary" size="mini" style="margin-left: 8px;">返回</el-button>
           </router-link>

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/annualaudit/annualfistaudit.vue

@@ -78,7 +78,7 @@
             </el-alert>
           </template>
         </el-table-column>
-        <el-table-column prop="ApplyTime" sortable min-width="130" label="年审日期" align="center" show-overflow-tooltip>
+        <el-table-column prop="ApplyTime" sortable min-width="130" label="年审到期日期" align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             {{ jstimehandle(scope.row.ApplyTime+'') }}
           </template>

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

@@ -92,7 +92,7 @@
             </el-alert>
           </template>
         </el-table-column>
-        <el-table-column prop="ApplyTime" sortable min-width="130" label="年审日期" align="center" show-overflow-tooltip>
+        <el-table-column prop="ApplyTime" sortable min-width="130" label="年审到期日期" align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             {{ jstimehandle(scope.row.ApplyTime+'') }}
           </template>