Browse Source

资质分为制造商和贸易商

Liuqi 6 years ago
parent
commit
be5071efa0

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

@@ -136,6 +136,7 @@ type OilSupplierCert2File struct {
 	SupplierId       int       `xorm:"not null default 0 comment('供方基本信息表主键') INT(10)"`
 	SupplierCertId   int       `xorm:"not null default 0 comment('供方准入证书信息表主键') INT(10)"`
 	SupplierTypeCode string    `xorm:"not null default '0' comment('准入类别代码(1 物资类,2 基建类,3 技术服务类)') VARCHAR(5)"`
+	IsManuf          string    `xorm:"VARCHAR(5)"`
 	SubClassId       int       `xorm:"not null default 0 comment('分类表ID') INT(10)"`
 	Code             string    `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
 	Name             string    `xorm:"not null default '' comment('分类名称') VARCHAR(50)"`

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

@@ -8,6 +8,7 @@ type OilSupplierFile struct {
 	Id                int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierId        int       `xorm:"INT(10)"`
 	SupplierTypeCode  string    `xorm:"VARCHAR(5)"`
+	IsManuf          string    `xorm:"VARCHAR(5)"`
 	SupplierCertSubId int       `xorm:"INT(10)"`
 	CertSubName       string    `xorm:"VARCHAR(50)"`
 	NeedFileType      string    `xorm:"VARCHAR(50)"`

+ 30 - 12
src/dashoo.cn/backend/api/business/oilsupplier/supplierfile/supplierfileService.go

@@ -3,10 +3,13 @@ package supplierfile
 import (
 	"dashoo.cn/backend/api/business/oilsupplier/tableheader"
 	"reflect"
+	"strconv"
+	"strings"
 
 	"dashoo.cn/backend/api/business/oilsupplier/basisbuild"
 	"dashoo.cn/backend/api/business/oilsupplier/goodsaptitude"
 	"dashoo.cn/backend/api/business/oilsupplier/technologyservice"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	. "dashoo.cn/backend/api/mydb"
 
 	//"dashoo.cn/utils"
@@ -28,19 +31,25 @@ func GetSupplierfileService(xormEngine *xorm.Engine) *SupplierfileService {
 	return s
 }
 
-func (s *SupplierfileService) GetGoodsNeedFileList(classid string) (needList []FileList) {
-	var entity goodsaptitude.OilGoodsAptitude
-	sql := "select * from OilGoodsAptitude where ClassId in (" + classid + ")"
-	s.DBE.Sql(sql).Get(&entity)
+func (s *SupplierfileService) GetGoodsNeedFileList(classid string,IsManuf string) (needList []FileList) {
+	Ids := strings.Split(classid, ",")
+	for i := 0; i < len(Ids); i++ {
+		classid = Ids[i]
+		var entity goodsaptitude.OilGoodsAptitude
+		sql := "select * from OilGoodsAptitude where ClassId in (" + classid + ")"
+		s.DBE.Sql(sql).Get(&entity)
 
-	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
-	var headerList []tableheader.BaseTableheader
-	tbHeaderSvc.ListGoodTableHeader(&headerList)
-	for _, header := range headerList {
-		curCertConfig := reflect.ValueOf(entity)
-		setValue := curCertConfig.FieldByName(header.Code).String()
-		if setValue != "" && setValue != "0" {
-			needList = append(needList, FileList{FileName: header.Name})
+		tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
+		var headerList []tableheader.BaseTableheader
+		tbHeaderSvc.ListGoodTableHeader(&headerList)
+		for _, header := range headerList {
+			curCertConfig := reflect.ValueOf(entity)
+			setValue := curCertConfig.FieldByName(header.Code).String()
+			if setValue != "" && setValue != "0" {
+				if header.IsManuf == IsManuf || header.IsManuf == "0" {
+					needList = append(needList, FileList{FileName: header.Name})
+				}
+			}
 		}
 	}
 
@@ -84,3 +93,12 @@ func (s *SupplierfileService) GetTechNeedFileList(classid string) (needList []Fi
 
 	return needList
 }
+//产看是否为制造商
+func (s *SupplierfileService) CheckIsManuf(id string) (IsManufacturer string) {
+	var entity suppliercertsub.OilSupplierCertSub
+	sql := "select * from OilSupplierCertSub where id = " + id
+	s.DBE.Sql(sql).Get(&entity)
+	IsManufacturer = strconv.Itoa(entity.IsManufacturer)
+
+	return IsManufacturer
+}

+ 306 - 2
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappendsub.go

@@ -375,6 +375,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 			datamain.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
 			datamain.Code = dataother.CheckList[n].Code
 			datamain.Name = dataother.CheckList[n].Name
+			datamain.GoodsLevel = dataother.CheckList[n].GoodsLevel
 			datamain.CertSubStatus="1"
 			datamain.Remark = dataother.Remark
 			datamain.IsDelete = 0
@@ -384,7 +385,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 
 			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
 			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
-			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id)
+			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id,"2")
 			if supplierCertModel.InStyle == "4" {
 				var needFile supplierfile.FileList
 				//战略合作协议扫描件
@@ -393,7 +394,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 			}
 
 			var list []supplierfile.OilSupplierFile
-			where := "SupplierTypeCode in (01,000) and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
+			where := "SupplierTypeCode in (01,000) and IsManuf in ('0','2') and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
 
 			//三证合一或五证合一不需要的字段
@@ -414,6 +415,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 				cert2File.SupplierCertId = dataother.SupplierCertId
 				cert2File.SupplierTypeCode = dataother.SupplierTypeCode
 				cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
+				cert2File.IsManuf = "2"
 				cert2File.Code = dataother.CheckList[n].Code
 				cert2File.Name = dataother.CheckList[n].Name
 				cert2File.NeedFileType = needList[i].FileName
@@ -421,8 +423,10 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
 
 				if strings.Contains(mustField, needList[i].FileName+",") {
 					entity.SupplierTypeCode = "000"
+					entity.IsManuf = "0"
 				} else {
 					entity.SupplierTypeCode = dataother.SupplierTypeCode
+					entity.IsManuf = "2"
 				}
 				entity.NeedFileType = needList[i].FileName
 				entity.FileType = 1
@@ -546,3 +550,303 @@ func (this *OilSupplierCertAppendSubController) DeleteEntity() {
 		this.ServeJSON()
 	}
 }
+
+// @Title 修改是否为供应商
+// @Description
+// @router /updatemanufacturerappend/:Id/:SupplierId/:IsManufacturer [get]
+func (this *OilSupplierCertAppendSubController) UpdateManufacturerAppend() {
+	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 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 error error
+
+	if IsManufacturer == "2" {
+		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),"1")
+		if supplierCertModel.InStyle == "4" {
+			var needFile supplierfile.FileList
+			//战略合作协议扫描件
+			needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
+			needList = append(needList, needFile)
+		}
+
+		var list []supplierfile.OilSupplierFile
+		where := "SupplierTypeCode in (01,000) and IsManuf in ('0','1') and SupplierId =" + strconv.Itoa(supplierId)
+		svc.GetEntitysByWhere(OilSupplierFileName, where, &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 = "1"
+			}
+			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 = 2
+			entity.SupplierCertSubId = datamain.SupplierCertAppendId
+			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 =1 where Id=" + Id + "")
+	} 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) + ","
+		}
+		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
+		where := "SupplierTypeCode in (01,000) and IsManuf in ('0','2') and SupplierId =" + strconv.Itoa(supplierId)
+		svc.GetEntitysByWhere(OilSupplierFileName, where, &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 = 2
+			entity.SupplierCertSubId = datamain.SupplierCertAppendId
+			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()
+	}
+}

+ 307 - 6
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)
+			needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id,"2")
 			if supplierCertModel.InStyle == "4" {
 				var needFile supplierfile.FileList
 				//战略合作协议扫描件
@@ -398,7 +398,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 			}
 
 			var list []supplierfile.OilSupplierFile
-			where := "SupplierTypeCode in (01,000) and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
+			where := "SupplierTypeCode in (01,000) and IsManuf in ('0','2') and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
 
 			//三证合一或五证合一不需要的字段
@@ -418,6 +418,7 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				cert2File.SupplierId = dataother.SupplierId
 				cert2File.SupplierCertId = dataother.SupplierCertId
 				cert2File.SupplierTypeCode = dataother.SupplierTypeCode
+				cert2File.IsManuf = "2"
 				cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
 				cert2File.Code = dataother.CheckList[n].Code
 				cert2File.Name = dataother.CheckList[n].Name
@@ -426,8 +427,10 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 
 				if strings.Contains(mustField, needList[i].FileName+",") {
 					entity.SupplierTypeCode = "000"
+					entity.IsManuf = "0"
 				} else {
 					entity.SupplierTypeCode = dataother.SupplierTypeCode
+					entity.IsManuf = "2"
 				}
 				entity.NeedFileType = needList[i].FileName
 				entity.FileType = 1
@@ -706,6 +709,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 	//SupplierCertId := this.GetString("SupplierCertId")
 	SupplierId := this.GetString("SupplierId")
 	SupplierTypeCode := this.GetString("SupplierTypeCode")
+	var IsManufacturer string
 	var errinfo ErrorInfo
 	if Id == "" {
 		errinfo.Message = "操作失败!请求信息不完整"
@@ -715,6 +719,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 		return
 	}
 	Ids := strings.Split(Id, ",")
+
 	//根据Id查出OilSupplierCertSub的SubClassId
 	svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE) //获得数据库引擎
 	filesvc := supplierfile.GetSupplierfileService(utils.DBE)
@@ -733,7 +738,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 	SubClassIds = strings.Trim(SubClassIds, ",")
 	if SubClassIds != "" {
 		if SupplierTypeCode == "01" {
-			SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds)
+			//SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds, IsManufacturer)
 		} else if SupplierTypeCode == "02" {
 			SurplusList = filesvc.GetBasicNeedFileList(SubClassIds)
 		} else if SupplierTypeCode== "03" {
@@ -744,7 +749,27 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 	for _, CertSub := range SurplusList {
 		fileNames += CertSub.FileName + ","
 	}
+
 	for i := 0; i < len(Ids); i++ {
+		IsManufacturer = filesvc.CheckIsManuf(Ids[i])
+		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)
+			}
+		}
+		if fileNames == "" {
+			for _, CertSub := range SurplusList {
+				fileNames += CertSub.FileName + ","
+			}
+		}
 		var datamain suppliercertsub.OilSupplierCertSub    //创建OilSupplierCertSub结构体(映射用)
 		var datamain2 []suppliercertsub.OilSupplierCertSub //空的查询用
 
@@ -764,7 +789,7 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 		//根据SubClassId查出此准入范围所拥有的资质名称
 		var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
 		if datamain.SupplierTypeCode == "01" {
-			needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId)) //通过准入范围Id获得资质名称并填充数组
+			needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId),IsManufacturer) //通过准入范围Id获得资质名称并填充数组
 		} else if datamain.SupplierTypeCode == "02" {
 			needList = filesvc.GetBasicNeedFileList(strconv.Itoa(subClassId))
 		} else {
@@ -783,7 +808,11 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 			if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
 				continue
 			}
-			where := " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode ="+ SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			if datamain.SupplierTypeCode == "01" {
+				where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			}else {
+				where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
+			}
 			err := svc.DeleteEntityBytbl(OilSupplierFileName, where)                                                            //删除第j条资质数据
 			if err == nil {
 				errinfo.Message = "删除成功"
@@ -939,15 +968,287 @@ func (this *OilSupplierCertSubController) UpdateStatus() {
 
 // @Title 修改是否为供应商
 // @Description
-// @router /updatemanufacturer/:Id/:IsManufacturer [get]
+// @router /updatemanufacturer/:Id/:SupplierId/:IsManufacturer [get]
 func (this *OilSupplierCertSubController) UpdateManufacturer() {
 	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 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 error error
+
 	if IsManufacturer == "2" {
+		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),"1")
+		if supplierCertModel.InStyle == "4" {
+			var needFile supplierfile.FileList
+			//战略合作协议扫描件
+			needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
+			needList = append(needList, needFile)
+		}
+
+		var list []supplierfile.OilSupplierFile
+		where := "SupplierTypeCode in (01,000) and IsManuf in ('0','1') and SupplierId =" + strconv.Itoa(supplierId)
+		svc.GetEntitysByWhere(OilSupplierFileName, where, &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 = "1"
+			}
+			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 =1 where Id=" + Id + "")
 	} 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) + ","
+		}
+		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
+		where := "SupplierTypeCode in (01,000) and IsManuf in ('0','2') and SupplierId =" + strconv.Itoa(supplierId)
+		svc.GetEntitysByWhere(OilSupplierFileName, where, &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 + "")
 	}
 

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

@@ -16,6 +16,8 @@
         </span>
       </div>
       <el-table :data="goodsList"
+                v-loading="tableloading"
+                element-loading-text="正在更改请稍后..."
                 border
                 size="mini"
                 height="calc(100vh - 435px)"
@@ -273,6 +275,7 @@ export default {
   data () {
     return {
       loading: false,
+      tableloading:false,
       keyword: '',
       Ids: [],
       SupplierId: 0,
@@ -335,28 +338,32 @@ export default {
     type_change(val,canadd,newcanadd){
       if (canadd == true || newcanadd == true) {
       if (val.row.IsManufacturer == 2){
+        this.tableloading = true
         let IsManufacturer = 2
-        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) + '/' + IsManufacturer + '', {}).then(res => {
+        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
                 message: '更改成功'
               })
               this.initData()
+              this.tableloading = false
             }
           })
           .catch(err => {
             console.error(err)
           })
         }else if (val.row.IsManufacturer == 1){//---------------转换供应商与非供应商
+        this.tableloading = true
         let IsManufacturer = 1
-        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) + '/' + IsManufacturer + '', {}).then(res => {
+        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
                 message: '更改成功'
               })
               this.initData()
+              this.tableloading = false
             }
           })
           .catch(err => {

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

@@ -56,6 +56,13 @@
           </template>
         </el-table-column>
         <el-table-column prop="NeedFileType" label="资质名称" show-overflow-tooltip></el-table-column>
+        <el-table-column label="贸易/制造" v-if="SupplierTypeCode == '01'" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <span v-if="scope.row.IsManuf=='1'">制造商</span>
+            <span v-else-if="scope.row.IsManuf=='2'">贸易商</span>
+            <span v-else>通用</span>
+        </template>
+        </el-table-column>
         <el-table-column prop="FileUrlList" label="资质文件" show-overflow-tooltip>
           <template slot-scope="scope">
             <div v-for="(tmpUrl, index) in scope.row.FileUrlList">

+ 38 - 6
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/_opera/goodsdataopera.vue

@@ -89,6 +89,14 @@
                 <!-- <el-table-column prop="SortFlag" label="分类标记" v-if="1==2" show-overflow-tooltip></el-table-column> -->
                 <el-table-column prop="Code" label="分类编码" show-overflow-tooltip></el-table-column>
                 <el-table-column prop="Name" label="分类名称" show-overflow-tooltip></el-table-column>
+                <el-table-column prop="GoodsLevel"
+                                label="级别" width="80px"
+                                show-overflow-tooltip>
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.GoodsLevel=='1'">一级</span>
+                    <span v-if="scope.row.GoodsLevel=='2'">二级</span>
+                  </template>
+                </el-table-column>
                 <el-table-column
                           label="是否为制造商" width="100">
                           <template slot-scope="scope">
@@ -116,7 +124,10 @@
                 <el-button style="float: right; padding: 3px 0" type="text"
                            v-if="formData.Status <= 0 && formData.Status != -5" @click="addSortData1()">添加</el-button>
               </div>
-              <el-table :data="myentityList" size="mini" border style="width: 100%;"  height="calc(100vh - 428px)" @sort-change="orderby">
+              <el-table :data="myentityList"                 
+                        v-loading="tableloading"
+                        element-loading-text="正在更改请稍后..." 
+                        size="mini" border style="width: 100%;"  height="calc(100vh - 428px)" @sort-change="orderby">
                 <el-table-column label="操作" min-width="100" align="center" fixed>
                   <template slot-scope="scope">
                     <el-button type="primary" title="删除" size="mini" plain @click="deleteData(scope.row.Id)"
@@ -125,6 +136,14 @@
                 </el-table-column>
                 <el-table-column prop="Code" label="分类编码" show-overflow-tooltip></el-table-column>
                 <el-table-column prop="Name" label="分类名称" show-overflow-tooltip></el-table-column>
+                <el-table-column prop="GoodsLevel"
+                                label="级别" width="80px"
+                                show-overflow-tooltip>
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.GoodsLevel=='1'">一级</span>
+                    <span v-if="scope.row.GoodsLevel=='2'">二级</span>
+                  </template>
+                </el-table-column>
                 <el-table-column
                           label="是否为制造商" width="100">
                           <template slot-scope="scope">
@@ -157,6 +176,13 @@
               </template>
             </el-table-column>
             <el-table-column prop="NeedFileType" label="资质名称" show-overflow-tooltip></el-table-column>
+            <el-table-column label="贸易/制造" v-if="SupplierTypeCode == '01'" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <span v-if="scope.row.IsManuf=='1'">制造商</span>
+                <span v-else-if="scope.row.IsManuf=='2'">贸易商</span>
+                <span v-else>通用</span>
+            </template>
+            </el-table-column>
             <el-table-column prop="FileUrlList" label="资质文件" show-overflow-tooltip>
               <template slot-scope="scope">
                 <div v-for="(tmpUrl, index) in scope.row.FileUrlList">
@@ -574,9 +600,7 @@
         goodsList2019: [],
         sectionCert: [],
         goodsDialog: false,
-
-
-
+        tableloading:false,
 
         UnitOrg: '',
         allowpre: true,
@@ -970,28 +994,36 @@
       type_change(val){
       if (this.formData.Status <= 0 && this.formData.Status != -5) {
       if (val.row.IsManufacturer == 2){
+        this.tableloading = true
         let IsManufacturer = 2
-        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) + '/' + IsManufacturer + '', {}).then(res => {
+        this.$axios.get('suppliercertappendsub/updatemanufacturerappend/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
                 message: '更改成功'
               })
+              this.getSortList()
               this.getMySortList()
+              this.getFileList()
+              this.tableloading = false
             }
           })
           .catch(err => {
             console.error(err)
           })
         }else if (val.row.IsManufacturer == 1){//---------------转换供应商与非供应商
+        this.tableloading = true
         let IsManufacturer = 1
-        this.$axios.get('suppliercertsub/updatemanufacturer/' + parseInt(val.row.Id) + '/' + IsManufacturer + '', {}).then(res => {
+        this.$axios.get('suppliercertappendsub/updatemanufacturerappend/' + parseInt(val.row.Id) +'/'+parseInt(val.row.SupplierId) + '/' + IsManufacturer + '', {}).then(res => {
             if (res.data.code === 0) {
               this.$message({
                 type: 'success',
                 message: '更改成功'
               })
               this.getMySortList()
+              this.getSortList()
+              this.getFileList()
+              this.tableloading = false
             }
           })
           .catch(err => {