Kaynağa Gözat

增项物资类添加判断

baichengfei 5 yıl önce
ebeveyn
işleme
089fb7d537

+ 22 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -219,7 +219,6 @@ func (this *OilSupplierCertAppendController) AddAppend() {
 			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 			sAddLimitMonth, _ := strconv.Atoi(paramSvc.GetBaseparameterMessage("GFGL1", "paramset", "sAddLimitMonth"))
 			fmt.Println(modeltmp[0].AuditDate)
-
 			ApplyDate, _ := time.Parse("2006-01-02", modeltmp[0].ApplyDate.AddDate(0, sAddLimitMonth, 0).Format("2006-01-02"))
 			nowtime, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
 			fmt.Println(ApplyDate, nowtime)
@@ -232,6 +231,28 @@ func (this *OilSupplierCertAppendController) AddAppend() {
 				return
 			}
 		}
+		style, _ :=strconv.Atoi(modeltmp[0].InStyle)
+		if style != 6 {
+			id :=strconv.Itoa(modeltmp[0].SupplierId)
+			sqlCount := "select count(*) from OilSupplierCertAppend where SupplierId=" + id + " AND YEAR(CreateOn)=YEAR(NOW())"
+			var countRes, _ = svc.DBE.Query(sqlCount)
+			if len(countRes) > 0 {
+				results := countRes[0]
+				var count int64
+				for _, value := range results {
+					count, _ = strconv.ParseInt(string(value), 10, 64)
+					break
+				}
+				if count >= 2 {
+					errinfo.Message = "除招标准入外,增项申请每年只能申请2次!"
+					errinfo.Code = -1
+					errinfo.Info = model.Id
+					this.Data["json"] = &errinfo
+					this.ServeJSON()
+					return
+				}
+			}
+		}
 	}
 	svc.GetEntityByWhere(OilSupplierCertName, where, &cermodel)
 

+ 10 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/goodslist.vue

@@ -181,7 +181,7 @@
             <el-col :span="24">
               <el-form-item label="企业名称" prop="SupplierId" required>
                 <el-select ref="suppselect" :disabled="IsCompanyUser == 1" filterable v-model="appendformData.SupplierId"
-                           :rules="[{ required: true, message: '请选择供应商公司', trigger: 'blur' },]"
+                           :rules="[{ required: true, message: '请选择供应商公司', trigger: 'change' }]"
                            @change="getInfo" placeholder="请选择供应商公司" style="width: 100%">
                   <el-option v-for="item in supplierList" :key="item.SupplierId" :label="item.SupplierName"
                              :value="item.SupplierId">
@@ -363,6 +363,14 @@
             _this.addshow = false
             _this.appendformData.AppendType = '01'
             _this.appendformData.SupplierId = parseInt(_this.appendformData.SupplierId)
+            console.log(_this.appendformData, '数据')
+            if (!_this.appendformData.SupplierId) {
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+              return
+            }
             _this.$axios.post('/suppliercertappend/addappend/', _this.appendformData)
               .then(res => {
                 if (res.data.code === 0) {
@@ -377,7 +385,7 @@
                   })
                   _this.$message({
                     type: 'success',
-                    message: res.data.message,
+                    message: res.data.message
                   })
                 } else {
                   _this.$message({