Browse Source

供应商类型选择-准入范围的供应商类型

lining 6 years ago
parent
commit
204f236c13

+ 198 - 25
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -389,7 +389,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 
 			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
-			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id,"2")
+			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, "2")
 			if supplierCertModel.InStyle == "4" {
 				var needFile supplierfile.FileList
 				//战略合作协议扫描件
@@ -727,7 +727,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 
 	//
 	var CertSublList []suppliercertsub.OilSupplierCertSub
-	where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode// 没有删除的准入范围
+	where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode // 没有删除的准入范围
 	svc.GetEntities(&CertSublList, where)
 	SubClassIds := ""
 	for _, CertSub := range CertSublList {
@@ -741,7 +741,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 			//SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds, IsManufacturer)
 		} else if SupplierTypeCode == "02" {
 			SurplusList = filesvc.GetBasicNeedFileList(SubClassIds)
-		} else if SupplierTypeCode== "03" {
+		} else if SupplierTypeCode == "03" {
 			SurplusList = filesvc.GetTechNeedFileList(SubClassIds)
 		}
 	}
@@ -755,7 +755,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 		if SubClassIds != "" {
 			if SupplierTypeCode == "01" {
 				var CertSublList2 []suppliercertsub.OilSupplierCertSub
-				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode+" and IsManufacturer ="+IsManufacturer// 没有删除的准入范围
+				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
 				svc.GetEntities(&CertSublList2, wheregood)
 				SubClassIds2 := ""
 				for _, CertSub := range CertSublList2 {
@@ -789,7 +789,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 		//根据SubClassId查出此准入范围所拥有的资质名称
 		var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
 		if datamain.SupplierTypeCode == "01" {
-			needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
+			needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
 		} else if datamain.SupplierTypeCode == "02" {
 			needList = filesvc.GetBasicNeedFileList(strconv.Itoa(subClassId))
 		} else {
@@ -810,10 +810,10 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 			}
 			if datamain.SupplierTypeCode == "01" {
 				where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
-			}else {
+			} else {
 				where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
 			}
-			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                            //删除第j条资质数据
+			err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
 			if err == nil {
 				errinfo.Message = "删除成功"
 				errinfo.Code = 0
@@ -826,7 +826,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 				this.ServeJSON()
 			}
 		}
-		where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SupplierTypeCode ="+ SupplierTypeCode +" and SubClassId=" + strconv.Itoa(subClassId)
+		where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SupplierTypeCode =" + SupplierTypeCode + " and SubClassId=" + strconv.Itoa(subClassId)
 		err1 := svc.DeleteEntityBytbl(OilSupplierCert2FileName, where)
 		if err1 == nil {
 			errinfo.Message = "删除成功"
@@ -839,7 +839,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 			this.Data["json"] = &errinfo
 			this.ServeJSON()
 		}
-		where = " Id= " + Ids[i]+" and SupplierTypeCode ="+ SupplierTypeCode
+		where = " Id= " + Ids[i] + " and SupplierTypeCode =" + SupplierTypeCode
 		err2 := svc.DeleteEntityBytbl(OilSupplierCertSubName, where) //删除OilSupplierCertSub单条准入范围
 		if err2 == nil {
 			errinfo.Message = "删除成功"
@@ -977,7 +977,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 
 	svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
 	var CertSublList []suppliercertsub.OilSupplierCertSub
-	where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ='"+ SupplierTypeCode+"'"// 没有删除的准入范围
+	where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ='" + SupplierTypeCode + "'" // 没有删除的准入范围
 	svc.GetEntities(&CertSublList, where)
 	var SupplierCertId int
 	for _, CertSub := range CertSublList {
@@ -1000,7 +1000,6 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 		paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 
-
 		SubClassIds := ""
 		for _, CertSub := range CertSublList {
 			SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
@@ -1010,7 +1009,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		if SubClassIds != "" {
 			if SupplierTypeCode == "01" {
 				var CertSublList2 []suppliercertsub.OilSupplierCertSub
-				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode+" and IsManufacturer ="+IsManufacturer// 没有删除的准入范围
+				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
 				svc.GetEntities(&CertSublList2, wheregood)
 				SubClassIds2 := ""
 				for _, CertSub := range CertSublList2 {
@@ -1041,8 +1040,8 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		}
 		subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
 		//根据SubClassId查出此准入范围所拥有的资质名称
-		var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
-		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
+		var needList []supplierfile.FileList                                              //定义存储所拥有资质名称的数组
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
 
 		var mustField string
 		mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
@@ -1056,8 +1055,8 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 			if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
 				continue
 			}
-			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode ="+ SupplierTypeCode +" and IsManuf='"+IsManufacturer+ "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
-			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                            //删除第j条资质数据
+			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                                                                                                                //删除第j条资质数据
 			if err == nil {
 				errinfo.Message = "删除成功"
 				errinfo.Code = 0
@@ -1070,7 +1069,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 				this.ServeJSON()
 			}
 		}
-		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),"1")
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), "1")
 		if supplierCertModel.InStyle == "4" {
 			var needFile supplierfile.FileList
 			//战略合作协议扫描件
@@ -1122,13 +1121,12 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 			svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 		}
 		_, error = svc.DBE.Exec("update " + OilSupplierCertSubName + " set IsManufacturer =1 where Id=" + Id + "")
-	} else if IsManufacturer == "1"{
+	} else if IsManufacturer == "1" {
 		var errinfo ErrorInfo
 		//根据Id查出OilSupplierCertSub的SubClassId
 		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 		paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 
-
 		SubClassIds := ""
 		for _, CertSub := range CertSublList {
 			SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
@@ -1138,7 +1136,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		if SubClassIds != "" {
 			if SupplierTypeCode == "01" {
 				var CertSublList2 []suppliercertsub.OilSupplierCertSub
-				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ="+ SupplierTypeCode+" and IsManufacturer ="+IsManufacturer// 没有删除的准入范围
+				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
 				svc.GetEntities(&CertSublList2, wheregood)
 				SubClassIds2 := ""
 				for _, CertSub := range CertSublList2 {
@@ -1169,8 +1167,8 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 		}
 		subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
 		//根据SubClassId查出此准入范围所拥有的资质名称
-		var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
-		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
+		var needList []supplierfile.FileList                                              //定义存储所拥有资质名称的数组
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
 
 		var mustField string
 		mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
@@ -1184,8 +1182,8 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 			if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
 				continue
 			}
-			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode ="+ SupplierTypeCode +" and IsManuf='"+IsManufacturer+ "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
-			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                            //删除第j条资质数据
+			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                                                                                                                //删除第j条资质数据
 			if err == nil {
 				errinfo.Message = "删除成功"
 				errinfo.Code = 0
@@ -1198,7 +1196,7 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 				this.ServeJSON()
 			}
 		}
-		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),"2")
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), "2")
 		if supplierCertModel.InStyle == "4" {
 			var needFile supplierfile.FileList
 			//战略合作协议扫描件
@@ -1266,6 +1264,181 @@ func (this *OilSupplierCertSubController) UpdateManufacturer() {
 	}
 }
 
+// @Title 修改是否为供应商
+// @Description
+// @router /updatemanufacturers/:SupplierId/:IsManufacturer [get]
+func (this *OilSupplierCertSubController) UpdateManufacturers() {
+	//Id := this.Ctx.Input.Param(":Id")
+	IsManufacturer := this.Ctx.Input.Param(":IsManufacturer")
+	SupplierId := this.Ctx.Input.Param(":SupplierId")
+	SupplierTypeCode := "01"
+
+	svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
+	var CertSublListAll []suppliercertsub.OilSupplierCertSub
+	wherea := "SupplierId=" + SupplierId + " and SupplierTypeCode='" + SupplierTypeCode + "' and IsManufacturer='1'"
+	svc.GetEntities(&CertSublListAll, wherea)
+
+	var error error
+	for _, item := range CertSublListAll {
+		Id := strconv.Itoa(item.Id)
+		var CertSublList []suppliercertsub.OilSupplierCertSub
+		where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode ='" + SupplierTypeCode + "'" // 没有删除的准入范围
+		svc.GetEntities(&CertSublList, where)
+		var SupplierCertId int
+		for _, CertSub := range CertSublList {
+			SupplierCertId = CertSub.SupplierCertId
+		}
+
+		var supplierCertModel suppliercert.OilSupplierCert
+		svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
+		svcCert.GetEntityById(SupplierCertId, &supplierCertModel)
+
+		var supplierModel supplier.OilSupplier
+		svcSupplier := supplier.GetOilSupplierService(utils.DBE)
+		svcSupplier.GetEntityById(SupplierId, &supplierModel)
+
+		var errinfo ErrorInfo
+		//根据Id查出OilSupplierCertSub的SubClassId
+		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
+		paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
+
+		SubClassIds := ""
+		for _, CertSub := range CertSublList {
+			SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
+		}
+		var SurplusList []supplierfile.FileList
+		SubClassIds = strings.Trim(SubClassIds, ",")
+		if SubClassIds != "" {
+			if SupplierTypeCode == "01" {
+				var CertSublList2 []suppliercertsub.OilSupplierCertSub
+				wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
+				svc.GetEntities(&CertSublList2, wheregood)
+				SubClassIds2 := ""
+				for _, CertSub := range CertSublList2 {
+					SubClassIds2 += strconv.Itoa(CertSub.SubClassId) + ","
+				}
+				SubClassIds2 = strings.Trim(SubClassIds2, ",")
+				SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds2, IsManufacturer)
+			}
+		}
+		fileNames := ""
+		for _, CertSub := range SurplusList {
+			fileNames += CertSub.FileName + ","
+		}
+		var datamain suppliercertsub.OilSupplierCertSub    //创建OilSupplierCertSub结构体(映射用)
+		var datamain2 []suppliercertsub.OilSupplierCertSub //空的查询用
+
+		where = " Id= " + Id
+		svc.GetEntity(&datamain, where) //根据Id查找,映射结构体
+
+		//再根据企业id查找这个企业有几个准入范围(如果只有一个准入范围了,基本资质也删除)
+
+		supplierId := datamain.SupplierId
+		where = "SupplierId=" + strconv.Itoa(supplierId)
+		svc.GetEntities(&datamain2, where)
+		flag := 0
+		if len(datamain2) == 1 {
+			flag = 1
+		}
+		subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
+		//根据SubClassId查出此准入范围所拥有的资质名称
+		var needList []supplierfile.FileList                                              //定义存储所拥有资质名称的数组
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
+
+		var mustField string
+		mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
+
+		//根据企业ID(SupplierId)和此准入范围所拥有的资质名称删除OilSupplierFile表中对应的资质
+		for j := 0; j < len(needList); j++ { //循环遍历资质名称数组,逐条删除
+
+			if flag == 0 && strings.Contains(mustField, needList[j].FileName+",") {
+				continue
+			}
+			if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
+				continue
+			}
+			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                                                                                                                //删除第j条资质数据
+			if err == nil {
+				errinfo.Message = "删除成功"
+				errinfo.Code = 0
+				this.Data["json"] = &errinfo
+				this.ServeJSON()
+			} else {
+				errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
+				errinfo.Code = -1
+				this.Data["json"] = &errinfo
+				this.ServeJSON()
+			}
+		}
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), "2")
+		if supplierCertModel.InStyle == "4" {
+			var needFile supplierfile.FileList
+			//战略合作协议扫描件
+			needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
+			needList = append(needList, needFile)
+		}
+
+		var list []supplierfile.OilSupplierFile
+		where1 := "SupplierTypeCode in (01,000) and IsManuf in ('0','2') and SupplierId =" + strconv.Itoa(supplierId)
+		svc.GetEntitysByWhere(OilSupplierFileName, where1, &list)
+
+		//三证合一或五证合一不需要的字段
+		mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
+		//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
+		mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
+
+		for i := 0; i < len(needList); i++ {
+			var entity supplierfile.OilSupplierFile
+			entity.SupplierId = supplierId
+
+			if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
+				continue
+			}
+			//加入对应表OilSupplierCertFile
+			if strings.Contains(mustField, needList[i].FileName+",") {
+				entity.SupplierTypeCode = "000"
+				entity.IsManuf = "0"
+			} else {
+				entity.SupplierTypeCode = "01"
+				entity.IsManuf = "2"
+			}
+			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()
+			entity.SupType = 1
+
+			isRepeat := false
+			for j := 0; j < len(list); j++ {
+				if list[j].NeedFileType == needList[i].FileName {
+					isRepeat = true
+					break
+				}
+			}
+			if isRepeat == true {
+				continue
+			}
+			svc.InsertEntityBytbl(OilSupplierFileName, &entity)
+		}
+		_, error = svc.DBE.Exec("update " + OilSupplierCertSubName + " set IsManufacturer=2 where Id=" + Id + "")
+	}
+
+	var errinfo ErrorDataInfo
+	if error == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
 type OilSupplierCert2File struct {
 	Id            int    `json:"not null pk autoincr INT(10)"`
 	certSubId     int    `json:"not null default 0 comment('供方基本信息表主键') INT(10)"`

+ 7 - 7
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodslist.vue

@@ -42,8 +42,8 @@
         </el-table-column>
         <el-table-column label="是否为制造商" width="100">
           <template slot-scope="scope">
-            <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 2" @click="type_change(scope,canadd,newcanadd)" :disabled="isDisabledBtn()">非制造商</el-button>
-            <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 1" @click="type_change(scope,canadd,newcanadd)" :disabled="isDisabledBtn()">制造商</el-button>
+            <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 2" @click="type_change(scope.row,canadd,newcanadd)" :disabled="isDisabledBtn()">非制造商</el-button>
+            <el-button type="primary" plain size="mini" v-if="scope.row.IsManufacturer == 1" @click="type_change(scope.row,canadd,newcanadd)" :disabled="isDisabledBtn()">制造商</el-button>
           </template>
         </el-table-column>
         <el-table-column prop="CertSubStatus"
@@ -76,7 +76,7 @@
           </template>
         </el-table-column>
       </el-table>
-      <el-pagination @size-change="handleSizeChange"
+        <el-pagination @size-change="handleSizeChange"
                      @current-change="handleCurrentChange"
                      :current-page="currentPage"
                      :page-sizes="[10, 50, 100, 200, 400]"
@@ -362,10 +362,10 @@ export default {
     },
     type_change(val,canadd,newcanadd){
       if (canadd == true || newcanadd == true) {
-        if (val.row.IsManufacturer == 2){
+        if (val.IsManufacturer == 2){
           this.tableloading = true
           let IsManufacturer = 2
-          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
+          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) +'/'+parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
@@ -378,10 +378,10 @@ export default {
             .catch(err => {
               console.error(err)
             })
-        }else if (val.row.IsManufacturer == 1){//---------------转换供应商与非供应商
+        }else if (val.IsManufacturer == 1){//---------------转换供应商与非供应商
           this.tableloading = true
           let IsManufacturer = 1
-          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
+          this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.Id) +'/'+parseInt(val.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',

+ 30 - 1
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/goodsedit.vue

@@ -82,7 +82,7 @@
                v-model="activeName"
                style="margin-top: -10px">
         <el-tab-pane label="企业信息">
-          <el-card class="box-card">
+          <el-card class="box-card" v-loading="goodsloading">
             <div slot="header"
                  class="clearfix">
               <span>供方基本信息表</span>
@@ -581,6 +581,8 @@ export default {
       }
     }
     return {
+      goodsloading: false,
+      operType: '',
       allowpre: true,
       totalTab: 3,
       chooseAuditorVisible: false,
@@ -1422,6 +1424,7 @@ export default {
 
     // 保存信息
     saveEntity () {
+      this.goodsloading = true
       let valid1 = false
       let valid2 = false
       this.$refs['GoodsInfo'].$refs['EntityForm'].validate((valid) => {
@@ -1497,6 +1500,7 @@ export default {
       api
         .addEntity(this.formData, this.$axios)
         .then(res => {
+          this.goodsloading = false
           if (res.data.code === 0) {
             // 保存成功后,初始化数据,变成修改
             this.formData.Id = res.data.item.split('_')[0]
@@ -1514,6 +1518,7 @@ export default {
           }
         })
         .catch(err => {
+          this.goodsloading = false
           console.error(err)
         })
     },
@@ -1530,6 +1535,7 @@ export default {
               type: 'success',
               message: res.data.message
             })
+            this.updatemanufacturers()
           } else {
             this.$message({
               type: 'warning',
@@ -1538,9 +1544,32 @@ export default {
           }
         })
         .catch(err => {
+          this.goodsloading = false
           console.error(err)
         })
     },
+    updatemanufacturers () {
+      let _this = this
+      if (_this.formData.OperType !== '制造商') {
+        let IsManufacturer = 1
+        this.$axios.get('suppliercertsub/updatemanufacturers/'+ _this.formData.Id + '/' + IsManufacturer + '', {}).then(res => {
+          _this.goodsloading = false
+          if (res.data.code === 0) {
+            _this.$message({
+              type: 'success',
+              message: '更改成功'
+            })
+          }
+          _this.$refs['goodsList'].initData()
+        })
+          .catch(err => {
+            _this.goodsloading = false
+            console.error(err)
+          })
+      } else {
+        _this.goodsloading = false
+      }
+    },
 
     CheckCompanyBase () {
       if (!this.formData.Id) {