Selaa lähdekoodia

资质关联
Signed-off-by: lijunqing <lijunqing@dashoo.cn>

lijunqing 6 vuotta sitten
vanhempi
commit
23e45721c9

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

@@ -99,3 +99,25 @@ type OilSupplierOpinion struct {
 	ModifiedUserId    int       `xorm:"INT(10)"`
 	ModifiedBy        string    `xorm:"VARCHAR(50)"`
 }
+
+
+
+
+type OilSupplierCert2File struct {
+	Id               int       `xorm:"not null pk autoincr INT(10)"`
+	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)"`
+	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)"`
+	NeedFileType     string    `xorm:"not null default '' comment('文件分类(资质名称)') VARCHAR(50)"`
+	Remark           string    `xorm:"comment('备注') VARCHAR(500)"`
+	IsDelete         int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
+	CreateOn         time.Time `xorm:"DATETIME"`
+	CreateUserId     int       `xorm:"INT(10)"`
+	CreateBy         string    `xorm:"VARCHAR(50)"`
+	ModifiedOn       time.Time `xorm:"DATETIME"`
+	ModifiedUserId   int       `xorm:"INT(10)"`
+	ModifiedBy       string    `xorm:"VARCHAR(50)"`
+}

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -252,6 +252,7 @@ var (
 	OilQualChangeDetailName                  string = "OilQualChangeDetail"         //资质变更表
 	BaseTableHeader                          string = "Base_TableHeader"            //资质配置字典信息表
 	BaseBadRecord                            string = "BadRecord"                   //不良记录表
+	OilSupplierCert2FileName                 string = "OilSupplierCert2File"      // 准入与资质对应关系表
 )
 
 //分页信息及数据

+ 52 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -368,6 +368,16 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
 					continue
 				}
+				//加入对应表OilSupplierCert2File
+				var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
+				cert2File.SupplierId = dataother.SupplierId
+				cert2File.SupplierCertId = dataother.SupplierCertId
+				cert2File.SupplierTypeCode = dataother.SupplierTypeCode
+				cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
+				cert2File.Code = dataother.CheckList[n].Code
+				cert2File.Name = dataother.CheckList[n].Name
+				cert2File.NeedFileType = needList[i].FileName
+				svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
 
 				if strings.Contains(mustField, needList[i].FileName+",") {
 					entity.SupplierTypeCode = "000"
@@ -467,7 +477,16 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 				if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
 					continue
 				}
-
+				//加入对应表OilSupplierCert2File
+				var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
+				cert2File.SupplierId = dataother.SupplierId
+				cert2File.SupplierCertId = dataother.SupplierCertId
+				cert2File.SupplierTypeCode = dataother.SupplierTypeCode
+				cert2File.SubClassId= dataother.CheckList[n].Id
+				cert2File.Code = dataother.CheckList[n].Code
+				cert2File.Name = dataother.CheckList[n].Name
+				cert2File.NeedFileType = needList[i].FileName
+				svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
 				if strings.Contains(mustField, needList[i].FileName+",") {
 					entity.SupplierTypeCode = "000"
 				} else {
@@ -567,7 +586,16 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 		for i := 0; i < len(needList); i++ {
 			var entity supplierfile.OilSupplierFile
 			entity.SupplierId = model.SupplierId
-
+			//加入对应表OilSupplierCert2File
+			var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
+			cert2File.SupplierId = model.SupplierId
+			cert2File.SupplierCertId = model.SupplierCertId
+			cert2File.SupplierTypeCode = model.SupplierTypeCode
+			cert2File.SubClassId= model.SubClassId
+			cert2File.Code = model.Code
+			cert2File.Name = model.Name
+			cert2File.NeedFileType = needList[i].FileName
+			svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
 			if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
 				continue
 			}
@@ -649,8 +677,15 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 	}
 	subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
 	//根据SubClassId查出此准入范围所拥有的资质名称
-	var needList []supplierfile.FileList                                               //定义存储所拥有资质名称的数组
-	needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId))                  //通过准入范围Id获得资质名称并填充数组
+	var needList []supplierfile.FileList                              //定义存储所拥有资质名称的数组
+	if datamain.SupplierTypeCode == "01" {
+		needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId)) //通过准入范围Id获得资质名称并填充数组
+	} else if datamain.SupplierTypeCode == "02" {
+		needList = filesvc.GetBasicNeedFileList(subClassId)
+	} else {
+		needList = filesvc.GetTechNeedFileList(subClassId)
+	}
+
 	var mustField string
 	mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
 
@@ -674,6 +709,19 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
 			this.ServeJSON()
 		}
 	}
+	where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SubClassId=" + strconv.Itoa(subClassId)
+	err1 := svc.DeleteEntityBytbl(OilSupplierCert2FileName, where) 
+	if err1 == nil {
+		errinfo.Message = "删除成功"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "删除失败!" + utils.AlertProcess(err1.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
 	where = " Id= " + Id
 	err2 := svc.DeleteEntityBytbl(OilSupplierCertSubName, where) //删除OilSupplierCertSub单条准入范围
 	if err2 == nil {

+ 20 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplierfile.go

@@ -1,6 +1,7 @@
 package oilsupplier
 
 import (
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	"dashoo.cn/business2/parameter"
 	"encoding/json"
 	"strconv"
@@ -127,6 +128,25 @@ func (this *SupplierfileController) FileList() {
 		where = where + " and NeedFileType != '" + needFileType + "'"
 	}
 	where = where + " and SupType != 2"
+
+	SubClassIds := this.GetString("SubClassIds")
+	if SubClassIds!=""{
+		inWhere:="("+SubClassIds+")"
+		sql:=" SupplierId="+SupplierId+" and SubClassId in "+inWhere
+		var result []suppliercertsub.OilSupplierCert2File
+		svc.GetEntities(&result,sql)
+		str:=""
+		if result!=nil{
+
+			for i:=0;i<len(result);i++{
+				str = str + "'"+result[i].NeedFileType+"',"
+			}
+
+		}
+		where=where +" and NeedFileType in ("+str[0:len(str)-1]+")"
+	}
+
+
 	total := svc.GetPagingEntitiesWithoutAccCode(page.CurrentPage, page.Size, orderby, asc, &list, where)
 	var datainfo DataInfo
 	datainfo.Items = list

+ 12 - 1
src/dashoo.cn/frontend_web/src/components/oilsupplier/subfilelist.vue

@@ -12,7 +12,8 @@
           分办
         </el-button>
       </div>
-      <el-table :data="businessList" border bordertooltip-effect="dark">
+      <el-table :data="businessList" border bordertooltip-effect="dark"  @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55"></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="Remark" label="备注" show-overflow-tooltip></el-table-column>
@@ -156,6 +157,7 @@
         yasuoname: '',
         SupplierId: 0,
         SupplierTypeCode: '',
+        SubClassIds:[],
         SupplierCertId: 0,
         InStyle: '1',
 
@@ -204,6 +206,14 @@
       this.IsCompanyUser = this.authUser.Profile.IsCompanyUser
     },
     methods: {
+      handleSelectionChange(val) {
+      this.SubClassIds=[]
+      for (var i=0;i<val.length;i++)
+      {
+        this.SubClassIds.push(val[i].SubClassId)
+      }
+      this.initData()
+      },
       initTableHeader() {
         if (this.flag == '01') {
           setapi.initGoodTableHeader(this.$axios).then(res => {
@@ -234,6 +244,7 @@
           InStyle: this.InStyle,
           SupplierId: this.SupplierId,
           SupplierTypeCode: this.SupplierTypeCode,
+          SubClassIds:this.SubClassIds.join(),
           _currentPage: 1,
           _size: 1000,
         }