Pārlūkot izejas kodu

需在资质中提交战略合作协议扫描件上传

yuedefeng 6 gadi atpakaļ
vecāks
revīzija
9f01b8eac8

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

@@ -101,6 +101,7 @@ type OilSupplierView struct {
 	RecUnitName       string    `xorm:"comment('推荐单位名称') VARCHAR(50)"`
 	BackReason        string    `xorm:"comment('退回原因') VARCHAR(50)"`
 	InFlag            string    `xorm:"default '0' comment('准入标识') VARCHAR(10)"`
+	InStyle           string    `xorm:"default '1' comment('准入方式') VARCHAR(10)"`
 	EffectStartTime   time.Time `xorm:"comment('有效期起') DATETIME"`
 	EffectEndTime     time.Time `xorm:"comment('有效期止') DATETIME"`
 	AuditProcessNote  string    `xorm:"comment('办理过程备注') VARCHAR(100)"`

+ 2 - 2
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierSession.go

@@ -128,7 +128,7 @@ func (s *OilSupplierSession) GetUpdateCols(oilSupplierCertTableName string, supp
 
 		"SpecTypeName",
 
-		"WorkerTotal",
+		/*"WorkerTotal",
 		"ContractNum ",
 		"UniversityNum",
 		"TechnicalNum",
@@ -137,7 +137,7 @@ func (s *OilSupplierSession) GetUpdateCols(oilSupplierCertTableName string, supp
 		"NationalRegNum",
 		"NationalCertTotal",
 		"DesignerTotal",
-		"SkillerTotal",
+		"SkillerTotal",*/
 
 		"Remark",
 

+ 1 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercert/oilsuppliercert.go

@@ -69,6 +69,7 @@ type OilSupplierVM struct {
 	AccessCardNo     string
 	SupplierTypeCode string
 	SupplierTypeName string
+	InStyle 		 string
 }
 
 const (

+ 3 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -1474,7 +1474,7 @@ func (this *OilSupplierController) GetEntityAndCert() {
 
 	var sql string
 	sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.Step, b.WorkerTotal, b.ContractNum, b.UniversityNum, b.TechnicalNum, b.AboveProfNum, 
-         b.MiddleProfNum, b.NationalRegNum, b.NationalCertTotal, b.DesignerTotal, b.SkillerTotal, b.WorkflowId, b.Status, b.ThirdAudit, b.BusinessKey, b.AuditIndex from ` + OilSupplierName + ` a `
+         b.MiddleProfNum, b.NationalRegNum, b.NationalCertTotal, b.DesignerTotal, b.SkillerTotal, b.InStyle, b.WorkflowId, b.Status, b.ThirdAudit, b.BusinessKey, b.AuditIndex from ` + OilSupplierName + ` a `
 	sql += ` left join ` + OilSupplierCertName + " b on b.SupplierId = a.Id"
 	sql += ` where b.Id ='` + Id + `'`
 	utils.DBE.SQL(sql).Get(&model)
@@ -1570,6 +1570,7 @@ func (this *OilSupplierController) AddEntity() {
 	modelCert.SupplierId = model.Id
 	modelCert.SupplierTypeCode = modelCertVM.SupplierTypeCode
 	modelCert.SupplierTypeName = modelCertVM.SupplierTypeName
+	modelCert.InStyle = modelCertVM.InStyle
 	modelCert.Step = 1 //企业信息保存完成
 	modelCert.CreateOn = time.Now()
 	modelCert.CreateBy = this.User.Realname
@@ -1677,6 +1678,7 @@ func (this *OilSupplierController) UpdateNumberEntity() {
 
 	colcerts := []string{
 		"Id",
+		"InStyle",
 		"WorkerTotal",
 		"ContractNum ",
 		"UniversityNum",

+ 85 - 73
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -309,20 +309,15 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 	var jsonblob = this.Ctx.Input.RequestBody
 	var datamain suppliercertsub.OilSupplierCertSub
 	var dataother suppliercertsub.SupplierCertSubModel
-	var supplierCertModel suppliercert.OilSupplierCert
+
 	json.Unmarshal(jsonblob, &datamain)
 	json.Unmarshal(jsonblob, &dataother)
+
+	var supplierCertModel suppliercert.OilSupplierCert
 	svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
 	svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
 
-	var errinfo ErrorDataInfo
-	for n := 0; ; n++ {
-		if n == len(dataother.CheckList) {
-			errinfo.Message = "操作成功!"
-			errinfo.Code = 0
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-		}
+	for n := 0; n < len(dataother.CheckList); n++ {
 		where_sub := "SupplierTypeCode = 01 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 		where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
 		where_sub += " and SubClassId = '" + dataother.CheckList[n].Id + "'"
@@ -380,6 +375,12 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 
 		}
 	}
+
+	var errinfo ErrorDataInfo
+	errinfo.Message = "操作成功!"
+	errinfo.Code = 0
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
 }
 
 // @Title 批量添加准入范围--技术服务类
@@ -393,14 +394,11 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 	json.Unmarshal(jsonblob, &datamain)
 	json.Unmarshal(jsonblob, &dataother)
 
-	var errinfo ErrorDataInfo
-	for n := 0; ; n++ {
-		if n == len(dataother.CheckList) {
-			errinfo.Message = "操作成功!"
-			errinfo.Code = 0
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-		}
+	var supplierCertModel suppliercert.OilSupplierCert
+	svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
+	svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
+
+	for n := 0; n < len(dataother.CheckList); n++ {
 		where_sub := "SupplierTypeCode = 03 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 		where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
 		where_sub += " and SubClassId = '" + strconv.Itoa(dataother.CheckList[n].Id) + "'"
@@ -421,42 +419,50 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 			needList := filesvc.GetTechNeedFileList(dataother.CheckList[n].Id)
 
+			if supplierCertModel.InStyle == "4" {
+				var needFile supplierfile.FileList
+				needFile.FileName = "战略合作协议扫描件"
+				needList = append(needList, needFile)
+			}
+
 			var list []supplierfile.OilSupplierFile
 			where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
-			if len(list) == 0 { //第一次添加准入项,将共有必备资质写入文件表
-				for i := 0; i < len(needList); i++ {
-					var entity supplierfile.OilSupplierFile
-					entity.SupplierId = dataother.SupplierId
-					if i < 4 {
-						entity.SupplierTypeCode = "000"
-					} else {
-						entity.SupplierTypeCode = dataother.SupplierTypeCode
-					}
-					entity.NeedFileType = needList[i].FileName
-					entity.FileType = 1
-					entity.EffectDate = time.Now()
-					entity.CreateBy = this.User.Realname
-					entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-					svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+			hasField := ""
+			for i := 0; i < len(list); i++ {
+				hasField += list[i].NeedFileType + ","
+			}
+			mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
+			for i := 0; i < len(needList); i++ {
+				var entity supplierfile.OilSupplierFile
+				entity.SupplierId = dataother.SupplierId
+
+				if strings.Contains(mustField, needList[i].FileName+",") {
+					entity.SupplierTypeCode = "000"
+				} else {
+					entity.SupplierTypeCode = dataother.SupplierTypeCode
 				}
-			} else {
-				if len(needList) > 4 {
-					for i := 4; i < len(needList); i++ {
-						var entity supplierfile.OilSupplierFile
-						entity.SupplierId = dataother.SupplierId
-						entity.SupplierTypeCode = dataother.SupplierTypeCode
-						entity.NeedFileType = needList[i].FileName
-						entity.FileType = 1
-						entity.EffectDate = time.Now()
-						entity.CreateBy = this.User.Realname
-						entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-						svc.InsertEntityBytbl(OilSupplierFileName, &entity)
-					}
+				entity.NeedFileType = needList[i].FileName
+				entity.FileType = 1
+				entity.EffectDate = time.Now()
+				entity.CreateBy = this.User.Realname
+				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+
+				if strings.Contains(hasField, needList[i].FileName+",") {
+					//已存在,不能重复添加
+					continue
 				}
+				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 			}
+
 		}
 	}
+
+	var errinfo ErrorDataInfo
+	errinfo.Message = "操作成功!"
+	errinfo.Code = 0
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
 }
 
 // @Title 新增准入范围
@@ -472,6 +478,10 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 	svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
 	_, err := svc.InsertEntityBytbl(OilSupplierCertSubName, &model)
 
+	var supplierCertModel suppliercert.OilSupplierCert
+	svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
+	svcCert.GetEntityById(model.SupplierCertId, &supplierCertModel)
+
 	filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 	var needList []supplierfile.FileList
 	if model.SupplierTypeCode == "01" {
@@ -482,42 +492,44 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 		//		needList = filesvc.GetTechNeedFileList(model.SubClassId)
 	}
 
+	if supplierCertModel.InStyle == "4" {
+		var needFile supplierfile.FileList
+		needFile.FileName = "战略合作协议扫描件"
+		needList = append(needList, needFile)
+	}
+
 	if err == nil {
 		var list []supplierfile.OilSupplierFile
 		where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
 		svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
 
-		if len(list) == 0 { //第一次添加准入项,将共有必备资质写入文件表
-			for i := 0; i < len(needList); i++ {
-				var entity supplierfile.OilSupplierFile
-				entity.SupplierId = model.SupplierId
-				if i < 4 {
-					entity.SupplierTypeCode = "000"
-				} else {
-					entity.SupplierTypeCode = model.SupplierTypeCode
-				}
-				entity.NeedFileType = needList[i].FileName
-				entity.FileType = 1
-				entity.EffectDate = time.Now()
-				entity.CreateBy = this.User.Realname
-				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+		hasField := ""
+		for i := 0; i < len(list); i++ {
+			hasField += list[i].NeedFileType + ","
+		}
+		mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
+		for i := 0; i < len(needList); i++ {
+			var entity supplierfile.OilSupplierFile
+			entity.SupplierId = model.SupplierId
+
+			if strings.Contains(mustField, needList[i].FileName+",") {
+				entity.SupplierTypeCode = "000"
+			} else {
+				entity.SupplierTypeCode = model.SupplierTypeCode
 			}
-		} else {
-			if len(needList) > 4 {
-				for i := 4; i < len(needList); i++ {
-					var entity supplierfile.OilSupplierFile
-					entity.SupplierId = model.SupplierId
-					entity.SupplierTypeCode = model.SupplierTypeCode
-					entity.NeedFileType = needList[i].FileName
-					entity.FileType = 1
-					entity.EffectDate = time.Now()
-					entity.CreateBy = this.User.Realname
-					entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
-					svc.InsertEntityBytbl(OilSupplierFileName, &entity)
-				}
+			entity.NeedFileType = needList[i].FileName
+			entity.FileType = 1
+			entity.EffectDate = time.Now()
+			entity.CreateBy = this.User.Realname
+			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+
+			if strings.Contains(hasField, needList[i].FileName+",") {
+				//已存在,不能重复添加
+				continue
 			}
+			svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 		}
+
 	}
 	var errinfo ErrorDataInfo
 	if err == nil {

+ 31 - 25
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/basisedit.vue

@@ -445,6 +445,7 @@
           DesignerTotal: 0,
           SkillerTotal: 0,
           Status: 0,
+          InStyle: '1',
           WorkflowId: ''
         },
         add_flat: true,
@@ -607,6 +608,7 @@
             this.formDataCert.SkillerTotal = this.formData.SkillerTotal
             this.formDataCert.Status = this.formData.Status
             this.formDataCert.WorkflowId = this.formData.WorkflowId
+            this.formDataCert.InStyle = this.formData.InStyle
             if (this.formData.Status > 0) {
               this.add_flat = false
             }
@@ -704,26 +706,32 @@
        }, */
 
       // 保存信息
-      saveEntity() {
+      saveEntity () {
+        let valid1 = false
+        let valid2 = false
         this.$refs['BasisInfo'].$refs['EntityForm'].validate((valid) => {
-           this.$refs['BasisInfo'].$refs['EntityFormCert'].validate((vvalid) => {
-          if (valid&&vvalid) {
-            if (!this.formData.SetupTime) {
-              this.formData.SetupTime = null
-            } else {
-              this.formData.SetupTime = new Date(this.formData.SetupTime)
-            }
-            // this.formData.WellNo = this.$refs.selectWellNo.selectedLabel + '';
-            if (!this.formData.Id || !this.certId) {
-              this.addEntity()
-            } else {
-              this.updateEntity()
-            }
-          } else {
-            return false
-          }
+          valid1 = valid
         })
+
+        this.$refs['BasisInfo'].$refs['EntityFormCert'].validate((valid) => {
+          valid2 = valid
         })
+
+        if (valid1 && valid2) {
+          if (!this.formData.SetupTime) {
+            this.formData.SetupTime = null
+          } else {
+            this.formData.SetupTime = new Date(this.formData.SetupTime)
+          }
+          // this.formData.WellNo = this.$refs.selectWellNo.selectedLabel + '';
+          if (!this.formData.Id || !this.certId) {
+            this.addEntity()
+          } else {
+            this.updateEntity()
+          }
+        } else {
+          return false
+        }
       },
 
       // 保存信息
@@ -744,6 +752,7 @@
               type: 'success',
               message: res.data.message
             })
+
           } else {
             this.$message({
               type: 'warning',
@@ -755,15 +764,11 @@
         })
       },
 
-      updateEntity() {
+      updateEntity () {
         api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
           if (res.data.code === 0) {
-            // 保存成功后,初始化数据,变成修改
-            this.initDatas()
-            this.$message({
-              type: 'success',
-              message: res.data.message
-            })
+            //更新子表
+            this.updateNumberEntity()
           } else {
             this.$message({
               type: 'warning',
@@ -793,10 +798,11 @@
         return true
       },
       // 企业人员结构情况
-      updateNumberEntity() {
+      updateNumberEntity () {
         if (!this.CheckCompanyBase()) {
           return false
         }
+        this.formDataCert.InStyle = this.formData.InStyle
         api.updateNumberEntity(this.formData.Id + '_' + this.certId, this.formDataCert, this.$axios).then(res => {
           if (res.data.code === 0) {
             // 保存成功后,初始化数据,变成修改

+ 29 - 27
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/goodsedit.vue

@@ -533,6 +533,7 @@ export default {
       },
 
       formDataCert: {
+        InStyle: '1',
         WorkerTotal: 0,
         ContractNum: 0,
         UniversityNum: 0,
@@ -718,6 +719,7 @@ export default {
             this.formDataCert.SkillerTotal = this.formData.SkillerTotal;
             this.formDataCert.Status = this.formData.Status;
             this.formDataCert.WorkflowId = this.formData.WorkflowId;
+            this.formDataCert.InStyle = this.formData.InStyle;
             if (this.formData.Status > 0) {
               this.add_flat = false;
             }
@@ -861,29 +863,32 @@ export default {
        }, */
 
     // 保存信息
-    saveEntity() {
-      console.log(this.formData);
+    saveEntity () {
+      let valid1 = false
+      let valid2 = false
+      this.$refs['GoodsInfo'].$refs['EntityForm'].validate((valid) => {
+        valid1 = valid
+      })
 
-      this.$refs["GoodsInfo"].$refs["EntityForm"].validate(valid => {
-        this.$refs["GoodsInfo"].$refs["EntityFormCert"].validate(vvalid => {
-        if (valid&&vvalid) {
-          if (!this.formData.SetupTime) {
-            this.formData.SetupTime = null;
-          } else {
-            this.formData.SetupTime = new Date(this.formData.SetupTime);
-          }
-          // this.formData.WellNo = this.$refs.selectWellNo.selectedLabel + '';
-          if (!this.formData.Id || !this.certId) {
-            this.addEntity();
-          } else {
-            this.updateEntity();
-          }
+      this.$refs['GoodsInfo'].$refs['EntityFormCert'].validate((valid) => {
+        valid2 = valid
+      })
+
+      if (valid1 && valid2) {
+        if (!this.formData.SetupTime) {
+          this.formData.SetupTime = null
         } else {
-          return false;
+          this.formData.SetupTime = new Date(this.formData.SetupTime)
         }
-        })
-
-      });
+        // this.formData.WellNo = this.$refs.selectWellNo.selectedLabel + '';
+        if (!this.formData.Id || !this.certId) {
+          this.addEntity()
+        } else {
+          this.updateEntity()
+        }
+      } else {
+        return false
+      }
     },
 
     // 保存信息
@@ -923,12 +928,8 @@ export default {
         .updateEntity(this.formData.Id, this.formData, this.$axios)
         .then(res => {
           if (res.data.code === 0) {
-            // 保存成功后,初始化数据,变成修改
-            this.initDatas();
-            this.$message({
-              type: "success",
-              message: res.data.message
-            });
+            //更新子表
+            this.updateNumberEntity()
           } else {
             this.$message({
               type: "warning",
@@ -959,10 +960,11 @@ export default {
       return true;
     },
     // 企业人员结构情况
-    updateNumberEntity() {
+    updateNumberEntity () {
       if (!this.CheckCompanyBase()) {
         return false;
       }
+      this.formDataCert.InStyle = this.formData.InStyle
       api
         .updateNumberEntity(
           this.formData.Id + "_" + this.certId,

+ 7 - 7
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/techedit.vue

@@ -434,6 +434,7 @@
         },
 
         formDataCert: {
+          InStyle: '1',
           WorkerTotal: 0,
           ContractNum: 0,
           UniversityNum: 0,
@@ -607,6 +608,8 @@
             this.formDataCert.DesignerTotal = this.formData.DesignerTotal
             this.formDataCert.SkillerTotal = this.formData.SkillerTotal
             this.formDataCert.Status = this.formData.Status
+            this.formDataCert.WorkflowId = this.formData.WorkflowId
+            this.formDataCert.InStyle = this.formData.InStyle
             if (this.formData.Status > 0) {
               this.add_flat = false
             }
@@ -757,15 +760,11 @@
         })
       },
 
-      updateEntity() {
+      updateEntity () {
         api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
           if (res.data.code === 0) {
-            // 保存成功后,初始化数据,变成修改
-            this.initDatas()
-            this.$message({
-              type: 'success',
-              message: res.data.message
-            })
+            //更新子表
+            this.updateNumberEntity()
           } else {
             this.$message({
               type: 'warning',
@@ -799,6 +798,7 @@
         if (!this.CheckCompanyBase()) {
           return false
         }
+        this.formDataCert.InStyle = this.formData.InStyle
         api.updateNumberEntity(this.formData.Id + '_' + this.certId, this.formDataCert, this.$axios).then(res => {
           if (res.data.code === 0) {
             // 保存成功后,初始化数据,变成修改