Explorar el Código

不良记录

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing hace 6 años
padre
commit
00b76c52bc

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

@@ -15,6 +15,7 @@ type OilSupplierCertSub struct {
 	AppendStatus         string    `xorm:"not null default '' comment('增项审核状态') VARCHAR(10)"`
 	Type                 string    `xorm:"not null default '' comment('类型') VARCHAR(10)"`
 	Name                 string    `xorm:"not null default '' comment('分类名称') VARCHAR(50)"`
+	CertSubStatus        string    `xorm:"null default '1' comment('1:正常2:不良记录暂停') VARCHAR(10)"`
 	Remark               string    `xorm:"comment('备注') VARCHAR(500)"`
 	IsDelete             int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
 	CreateOn             time.Time `xorm:"DATETIME created"`

+ 255 - 51
src/dashoo.cn/backend/api/controllers/oilsupplier/badrecord.go

@@ -2,6 +2,7 @@ package oilsupplier
 
 import (
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	"encoding/json"
 	"fmt"
 	"strconv"
@@ -102,11 +103,16 @@ func (this *BadRecordController) AddBadRecord() {
 	svc := BadRecord.GetBadRecordService(utils.DBE)
 	json.Unmarshal(jsonBlob, &model)
 
+	isFlag:=this.GetString("_isFlag")
+	goodsString:=this.GetString("_goodsString")
+	basisString:=this.GetString("_basisString")
+	tcString:=this.GetString("_tcString")
+
 	//判断名称是否已拥有
 	var companyCode = model.Companycode
 	//var categoryCode = model.Categorycode
 
-	where := "1=1 and CompanyCode='" + companyCode + "'"
+	where := "1=1 and CompanyCode='" + companyCode + "' and Bak1='0'"
 	total := svc.GetName(BaseBadRecord, where)
 	if total != 0 {
 		errinfo.Message = "已有重复数据"
@@ -114,46 +120,72 @@ func (this *BadRecordController) AddBadRecord() {
 		this.Data["json"] = &errinfo
 		this.ServeJSON()
 	} else {
-		//var Categorycode = model.Categorycode
-		//
-		//if Categorycode == "01" {
-		//	model.Categoryname = "物资类"
-		//} else if Categorycode == "02" {
-		//	model.Categoryname = "基建类"
-		//} else {
-		//	model.Categoryname = "技术服务类"
-		//}
 		var result []map[string]string
 		sql := "select SupplierName from " + OilSupplierName + " where id =" + model.Companycode + ""
 		result, _ = svc.DBE.QueryString(sql)
 
-		fmt.Println(result[0]["SupplierName"])
-		//model.Bak4 = "——"
 		model.Companyname = result[0]["SupplierName"]
 		model.Createon = time.Now()
 		model.Createby = this.User.Realname
 		model.Createuserid, _ = utils.StrTo(this.User.Id).Int()
-
-		_, err := svc.InsertEntityBytbl(BaseBadRecord, &model)
-
-		//更新准入表状态
-
-		var supplierCert suppliercert.OilSupplierCert
-		supplierCert.InFlag=model.Bak3
-		cols := []string{ "InFlag"}
-		svc.UpdateEntityBywheretbl(OilSupplierCertName,&supplierCert, cols,"SupplierId='"+model.Companycode+"'")
-
-		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()
+		if isFlag=="0"{
+			model.Bak1 = "0"
+			_, err := svc.InsertEntityBytbl(BaseBadRecord, &model)
+
+			//更新准入表状态
+			var supplierCert suppliercert.OilSupplierCert
+			supplierCert.InFlag=model.Bak3
+			cols := []string{ "InFlag"}
+			svc.UpdateEntityBywheretbl(OilSupplierCertName,&supplierCert, cols,"SupplierId='"+model.Companycode+"'")
+
+			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()
+			}
+		}else {
+			model.Bak1 = "1"
+			_, err := svc.InsertEntityBytbl(BaseBadRecord, &model)
+			//更新准入范围的表状态
+			if goodsString!=""{
+				var supplierCertSub suppliercertsub.OilSupplierCertSub
+				supplierCertSub.CertSubStatus=model.Bak3
+				cols := []string{ "CertSubStatus"}
+				svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='01' and Id in ("+goodsString+")")
+			}
+
+			if basisString!=""{
+				var supplierCertSub suppliercertsub.OilSupplierCertSub
+				supplierCertSub.CertSubStatus=model.Bak3
+				cols := []string{ "CertSubStatus"}
+				svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='02' and Id in ("+basisString+")")
+			}
+
+			if tcString!=""{
+				var supplierCertSub suppliercertsub.OilSupplierCertSub
+				supplierCertSub.CertSubStatus=model.Bak3
+				cols := []string{ "CertSubStatus"}
+				svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='03' and Id in ("+tcString+")")
+			}
+			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()
+			}
 		}
 	}
 
@@ -210,39 +242,88 @@ func (this *BadRecordController) UpdateBadRecordById() {
 		this.ServeJSON()
 		return
 	}
-
 	svc := BadRecord.GetBadRecordService(utils.DBE) //获得数据库引擎
-
 	var model BadRecord.Badrecord
 	var jsonBlob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonBlob, &model)
 
+	goodsString:=this.GetString("_goodsString")
+	basisString:=this.GetString("_basisString")
+	tcString:=this.GetString("_tcString")
+	Bak1:=this.GetString("_Bak1")
+
 	model.Modifiedon = time.Now()
 	model.Modifiedby = this.User.Realname
 	model.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
 
-	cols = []string{"Record", "Bak2", "Bak3", "Modifiedon", "Modifieduserid", "Modifiedby"}
+	if Bak1=="0"{
+		cols = []string{"Record", "Bak2", "Bak3", "Modifiedon", "Modifieduserid", "Modifiedby"}
+		err := svc.UpdateEntityBytbl(BaseBadRecord, id, &model, cols)
 
-	err := svc.UpdateEntityBytbl(BaseBadRecord, id, &model, cols)
+		var supplierCert suppliercert.OilSupplierCert
+		supplierCert.InFlag=model.Bak3
+		cols1:= []string{ "InFlag"}
+		svc.UpdateEntityBywheretbl(OilSupplierCertName,&supplierCert, cols1,"SupplierId='"+model.Companycode+"'")
+
+		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()
+		}
+	}else{
+		if goodsString!=""{
+			var supplierCertSub suppliercertsub.OilSupplierCertSub
+			supplierCertSub.CertSubStatus=model.Bak3
+			cols := []string{ "CertSubStatus"}
+			svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='01' and Id in ("+goodsString+")")
+		}
 
+		if basisString!=""{
+			var supplierCertSub suppliercertsub.OilSupplierCertSub
+			supplierCertSub.CertSubStatus=model.Bak3
+			cols := []string{ "CertSubStatus"}
+			svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='02' and Id in ("+basisString+")")
+		}
 
-	var supplierCert suppliercert.OilSupplierCert
-	supplierCert.InFlag=model.Bak3
-	cols1:= []string{ "InFlag"}
-	svc.UpdateEntityBywheretbl(OilSupplierCertName,&supplierCert, cols1,"SupplierId='"+model.Companycode+"'")
+		if tcString!=""{
+			var supplierCertSub suppliercertsub.OilSupplierCertSub
+			supplierCertSub.CertSubStatus=model.Bak3
+			cols := []string{ "CertSubStatus"}
+			svc.UpdateEntityBywheretbl(OilSupplierCertSubName,&supplierCertSub, cols,"SupplierId='"+model.Companycode+"' and SupplierTypeCode='03' and Id in ("+tcString+")")
+		}
 
-	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()
+		var tempEntity suppliercertsub.OilSupplierCertSub
+		//判断是否还有不良记录的准入项暂停
+		total,_:=svc.GetCount(tempEntity,"SupplierId='"+model.Companycode+"' and CertSubStatus='2'")
+		if total!=0{
+			model.Bak3="2"
+		}
+
+		cols = []string{"Record", "Bak2", "Bak3", "Modifiedon", "Modifieduserid", "Modifiedby"}
+		err := svc.UpdateEntityBytbl(BaseBadRecord, id, &model, cols)
+
+		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()
+		}
 	}
 
+
+
+
 }
 
 
@@ -287,4 +368,127 @@ func (this *BadRecordController) BackBadRecordById() {
 		this.ServeJSON()
 	}
 
+}
+
+
+// @Title 获取某个公司的准入范围
+// @Description
+// @Success 200 {object}
+// @router /serachgoodscertbycompany [get]
+func (this *BadRecordController) SerachGoodsCertByCompany() {
+	companyId := this.GetString("_companyId")
+	currentPage := this.GetString("_currentPage")
+	size := this.GetString("_size")
+	certName := this.GetString("_certName")
+	Bak1 := this.GetString("_Bak1")
+
+	sqlAdd:=""
+	if certName!=""{
+		sqlAdd=sqlAdd+"and Name like '%"+certName+"%'"
+	}
+	if Bak1!=""{
+		sqlAdd=sqlAdd+"and CertSubStatus = '2'"
+	}else{
+		sqlAdd=sqlAdd+"and CertSubStatus = '1'"
+	}
+	sizeIntPage,_:=strconv.Atoi(size)
+	currentIntPage,_:=strconv.Atoi(currentPage)
+	ye:=strconv.Itoa((currentIntPage-1)*sizeIntPage)
+
+	svc := BadRecord.GetBadRecordService(utils.DBE) //获得数据库引擎
+	var tempEntity suppliercertsub.OilSupplierCertSub
+
+	var goodslist []map[string]string
+	sql := "select * from " + OilSupplierCertSubName + " where SupplierId='"+companyId+"' and SupplierTypeCode='01' "+ sqlAdd +" order by Id asc limit "+ye+","+size+""
+	goodslist, _ = svc.DBE.QueryString(sql)
+
+	goodsTotal,_:=svc.GetCount(tempEntity,"SupplierId='"+companyId+"' and SupplierTypeCode='01' "+ sqlAdd +"")
+
+	var datainfo DataInfo
+	datainfo.Items = goodslist
+	datainfo.CurrentItemCount = goodsTotal
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}
+
+// @Title 获取某个公司的准入范围
+// @Description
+// @Success 200 {object}
+// @router /serachbasiscertbycompany [get]
+func (this *BadRecordController) SerachBasisCertByCompany() {
+	companyId := this.GetString("_companyId")
+	currentPage := this.GetString("_currentPage")
+	size := this.GetString("_size")
+	certName := this.GetString("_certName")
+	Bak1 := this.GetString("_Bak1")
+	sqlAdd:=""
+	if certName!=""{
+		sqlAdd="and Name like '%"+certName+"%'"
+	}
+
+	if Bak1!=""{
+		sqlAdd=sqlAdd+"and CertSubStatus = '2'"
+	}else{
+		sqlAdd=sqlAdd+"and CertSubStatus = '1'"
+	}
+	sizeIntPage,_:=strconv.Atoi(size)
+	currentIntPage,_:=strconv.Atoi(currentPage)
+	ye:=strconv.Itoa((currentIntPage-1)*sizeIntPage)
+
+	svc := BadRecord.GetBadRecordService(utils.DBE) //获得数据库引擎
+	var tempEntity suppliercertsub.OilSupplierCertSub
+
+	var basislist []map[string]string
+	sql := "select * from " + OilSupplierCertSubName + " where SupplierId='"+companyId+"' and SupplierTypeCode='02' "+ sqlAdd +" order by Id asc limit "+ye+","+size+""
+	basislist, _ = svc.DBE.QueryString(sql)
+
+	basisTotal,_:=svc.GetCount(tempEntity,"SupplierId='"+companyId+"' and SupplierTypeCode='02' "+ sqlAdd +"")
+	var datainfo DataInfo
+	datainfo.Items = basislist
+	datainfo.CurrentItemCount = basisTotal
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}
+
+// @Title 获取某个公司的准入范围
+// @Description
+// @Success 200 {object}
+// @router /serachtccertbycompany [get]
+func (this *BadRecordController) SerachTCCertByCompany() {
+	companyId := this.GetString("_companyId")
+	currentPage := this.GetString("_currentPage")
+	size := this.GetString("_size")
+	certName := this.GetString("_certName")
+	Bak1 := this.GetString("_Bak1")
+	sqlAdd:=""
+	if certName!=""{
+		sqlAdd="and Name like '%"+certName+"%'"
+	}
+
+	if Bak1!=""{
+		sqlAdd=sqlAdd+"and CertSubStatus = '2'"
+	}else{
+		sqlAdd=sqlAdd+"and CertSubStatus = '1'"
+	}
+	sizeIntPage,_:=strconv.Atoi(size)
+	currentIntPage,_:=strconv.Atoi(currentPage)
+	ye:=strconv.Itoa((currentIntPage-1)*sizeIntPage)
+
+	svc := BadRecord.GetBadRecordService(utils.DBE) //获得数据库引擎
+	var tempEntity suppliercertsub.OilSupplierCertSub
+
+	var tclist []map[string]string
+	sql := "select * from " + OilSupplierCertSubName + " where SupplierId='"+companyId+"' and SupplierTypeCode='03' "+ sqlAdd +" order by Id asc limit "+ye+","+size+""
+	tclist, _ = svc.DBE.QueryString(sql)
+
+	tcTotal,_:=svc.GetCount(tempEntity,"SupplierId='"+companyId+"' and SupplierTypeCode='03' "+ sqlAdd +"")
+
+	var datainfo DataInfo
+	datainfo.Items = tclist
+	datainfo.CurrentItemCount = tcTotal
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
 }

+ 27 - 4
src/dashoo.cn/frontend_web/src/api/oilsupplier/oilclassorgset.js

@@ -80,11 +80,12 @@ export default {
       params: params
     })
   },
-  addBadRecord (formData, myAxios) {
+  addBadRecord (formData, params, myAxios) {
     return myAxios({
       url: '/badrecord/add',
       method: 'post',
-      data: formData
+      data: formData,
+      params: params
     })
   },
   deletebadrecordbyid (id, myAxios) {
@@ -93,11 +94,12 @@ export default {
       method: 'get'
     })
   },
-  updatebadrecordbyid (id, formData, myAxios) {
+  updatebadrecordbyid (id, formData, params, myAxios) {
     return myAxios({
       url: '/badrecord/updatebadrecordbyid/' + id,
       method: 'post',
-      data: formData
+      data: formData,
+      params: params
     })
   },
   backbadrecordbyid (id, myAxios) {
@@ -105,5 +107,26 @@ export default {
       url: '/badrecord/backbadrecordbyid?id=' + id,
       method: 'get'
     })
+  },
+  serachGoodsCertByCompany (params, myAxios) {
+    return myAxios({
+      url: '/badrecord/serachgoodscertbycompany',
+      method: 'get',
+      params: params
+    })
+  },
+  serachBasisCertByCompany (params, myAxios) {
+    return myAxios({
+      url: '/badrecord/serachbasiscertbycompany',
+      method: 'get',
+      params: params
+    })
+  },
+  serachTCCertByCompany (params, myAxios) {
+    return myAxios({
+      url: '/badrecord/serachtccertbycompany',
+      method: 'get',
+      params: params
+    })
   }
 }

+ 490 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/badrecord/index.vue

@@ -90,6 +90,15 @@
             {{ jstimehandle(scope.row.Createon+'') }}
           </template>
         </el-table-column>
+        <el-table-column label="类别"
+                         align="center"
+                         width="100px">
+          <template slot-scope="scope">
+            <span v-if="scope.row.Bak1=='0'">企业暂停</span>
+            <span v-else-if="scope.row.Bak1=='1'">准入范围暂停</span>
+            <span v-else>——</span>
+          </template>
+        </el-table-column>
         <el-table-column label="状态"
                          align="center"
                          width="100px">
@@ -164,6 +173,22 @@
             </el-form-item>
           </el-col>
         </el-row>
+
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="准入范围">
+              <el-input placeholder="请选择准入范围"
+                        v-model="certNames"
+                        readonly
+                        style="width:100%">
+                <el-button type="primary"
+                           style="width:30%"
+                           @click="certDialog = true"
+                           slot="append">选择</el-button>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <!-- 第二行 -->
         <!-- <el-row>
           <el-col :span="24">
@@ -194,7 +219,8 @@
                             type="daterange"
                             range-separator="至"
                             start-placeholder="开始日期"
-                            end-placeholder="结束日期">
+                            end-placeholder="结束日期"
+                            style="width:100%">
             </el-date-picker>
           </el-form-item>
         </el-row>
@@ -248,7 +274,21 @@
             </el-form-item>
           </el-col>
         </el-row>
-
+        <el-row v-if="editForm.Bak1==='1'">
+          <el-col :span="24">
+            <el-form-item label="准入范围">
+              <el-input placeholder="请选择准入范围"
+                        v-model="certNames"
+                        readonly
+                        style="width:100%">
+                <el-button type="primary"
+                           style="width:30%"
+                           @click="certDialog = true"
+                           slot="append">选择</el-button>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <!-- 第二行 -->
         <!-- <el-row>
           <el-col :span="24">
@@ -338,6 +378,7 @@
       </el-form>
       <el-table size="mini"
                 :data="dataList"
+                height="400px"
                 border>
         <el-table-column label="操作"
                          width="100px"
@@ -367,6 +408,133 @@
                      layout="total, sizes, prev, pager, next, jumper"
                      :total="currentItemCount1"></el-pagination>
     </el-dialog>
+
+    <el-dialog :title="certTitle"
+               :visible.sync="certDialog"
+               top="5vh"
+               style="z-index:99;">
+      <span style="float: right;">
+        <el-button type="primary"
+                   size="mini"
+                   style="margin-left:10px; margin-top: -4px;"
+                   @click="initCert($event)">查询</el-button>
+        <el-button type="primary"
+                   size="mini"
+                   style="margin-left:10px; margin-top: -4px;"
+                   @click="certDialog = false">取消</el-button>
+      </span>
+      <el-form ref="form"
+               :inline="true"
+               style="float: right; margin-top: -10px">
+        <el-form-item label="准入范围名称">
+          <el-input size="mini"
+                    style="width: 165px;"
+                    v-model="certChooseName"
+                    placeholder="请输入准入范围名称"></el-input>
+        </el-form-item>
+      </el-form>
+      <el-tabs type="border-card"
+               style="margin-top: 50px"
+               @tab-click="handleClick"
+               v-model="activeName">
+        <el-tab-pane label="物资类"
+                     name="first">
+          <el-table size="mini"
+                    :data="goodsList"
+                    border
+                    height="300px"
+                    @selection-change="handleGoodsSelectionChange">
+            <el-table-column type="selection"
+                             width="55">
+            </el-table-column>
+
+            <el-table-column prop="Code"
+                             label="编码"
+                             width="120px"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+            <el-table-column prop="Name"
+                             label="名称"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+          </el-table>
+          <el-pagination @size-change="handleGoodsSizeChange"
+                         @current-change="handleGoodsCurrentChange"
+                         :current-page="currentGoodsPage"
+                         :page-sizes="[10, 15, 20, 25]"
+                         :page-size="goodsSize"
+                         layout="total, sizes, prev, pager, next, jumper"
+                         :total="currentGoodsItemCount"></el-pagination>
+        </el-tab-pane>
+        <el-tab-pane label="基建类"
+                     name="second">
+          <el-table size="mini"
+                    :data="basisList"
+                    border
+                    height="300px"
+                    @selection-change="handleBasisSelectionChange">
+            <el-table-column type="selection"
+                             width="55">
+            </el-table-column>
+
+            <el-table-column prop="Code"
+                             label="编码"
+                             width="120px"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+            <el-table-column prop="Name"
+                             label="名称"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+          </el-table>
+          <el-pagination @size-change="handleBasisSizeChange"
+                         @current-change="handleBasisCurrentChange"
+                         :current-page="currentBasisPage"
+                         :page-sizes="[10, 15, 20, 25]"
+                         :page-size="basisSize"
+                         layout="total, sizes, prev, pager, next, jumper"
+                         :total="currentBasisItemCount"></el-pagination>
+        </el-tab-pane>
+        <el-tab-pane label="技术服务类"
+                     name="third">
+          <el-table size="mini"
+                    :data="tcList"
+                    border
+                    height="300px"
+                    @selection-change="handleTCSelectionChange">
+            <el-table-column type="selection"
+                             width="55">
+            </el-table-column>
+
+            <el-table-column prop="Code"
+                             label="编码"
+                             width="120px"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+            <el-table-column prop="Name"
+                             label="名称"
+                             align="center"
+                             show-overflow-tooltip></el-table-column>
+          </el-table>
+          <el-pagination @size-change="handleTCSizeChange"
+                         @current-change="handleTCCurrentChange"
+                         :current-page="currentTCPage"
+                         :page-sizes="[10, 15, 20, 25]"
+                         :page-size="tcSize"
+                         layout="total, sizes, prev, pager, next, jumper"
+                         :total="currentTCItemCount"></el-pagination>
+        </el-tab-pane>
+      </el-tabs>
+      <el-input style="width:100%;margin-top:10px"
+                type="textarea"
+                readonly
+                v-model="yChooseCert"></el-input>
+      <div style="width:100%;text-align:right;margin-top:10px">
+        <el-button type="primary"
+                   size="mini"
+                   @click="savedata()">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -384,6 +552,20 @@ export default {
   },
   data () {
     return {
+      certTitle: '准入范围列表',
+      isFlag: '0',
+      goodsTemp: '',
+      basisTemp: '',
+      tcTemp: '',
+      yChooseCert: '',
+      activeName: 'first',
+      goodsSelection: [],
+      basisSelection: [],
+      tcSelection: [],
+      goodsList: [],
+      basisList: [],
+      tcList: [],
+      certNames: '',
       options: [{
         value: '1',
         label: '准入',
@@ -394,7 +576,9 @@ export default {
         style: 'color:#E6A23C'
       }],
       companyChooseName: '',
+      certChooseName: '',
       companyDialog: false,
+      certDialog: false,
       dataList: [],
       addshow: false,
       editshow: false,
@@ -402,12 +586,22 @@ export default {
       // 定义列表数据
       entityList: [],
       // 分页参数
+      companyId: 0,
       size: 10,
       size1: 10,
+      goodsSize: 10,
+      basisSize: 10,
+      tcSize: 10,
       currentPage: 1,
       currentPage1: 1,
+      currentGoodsPage: 1,
+      currentBasisPage: 1,
+      currentTCPage: 1,
       currentItemCount: 0,
       currentItemCount1: 0,
+      currentGoodsItemCount: 0,
+      currentBasisItemCount: 0,
+      currentTCItemCount: 0,
       Bak2: [],
       Bak22: [],
       entityForm: {
@@ -423,6 +617,7 @@ export default {
         Companycode: '',
         // Categorycode: '',
         Record: '',
+        Bak1: '',
         Bak2: '',
         Bak3: ''
       },
@@ -464,6 +659,57 @@ export default {
   },
 
   methods: {
+    savedata () {
+      if (this.goodsSelection.length === 0 && this.basisSelection.length === 0 && this.tcSelection.length === 0) {
+        this.$message({
+          type: 'warning',
+          message: '请选择准入范围'
+        })
+      } else {
+        this.certDialog = false
+        this.certNames = this.yChooseCert
+      }
+    },
+    initCert (event) {
+      console.log(this.activeName)
+      if (this.activeName === 'first') {
+        this.serachGoodsCertByCompany(event)
+      } else if (this.activeName === 'second') {
+        this.serachBasisCertByCompany(event)
+      } else {
+        this.serachTCCertByCompany(event)
+      }
+    },
+    handleClick (tab) {
+      this.activeName = tab.name
+    },
+    handleGoodsSelectionChange (val) {
+      console.log(val)
+      this.goodsSelection = val
+      this.goodsTemp = ''
+      for (var i = 0; i < val.length; i++) {
+        this.goodsTemp = this.goodsTemp + (val[i].Code + ' ' + val[i].Name + ',')
+      }
+      this.yChooseCert = this.goodsTemp + this.basisTemp + this.tcTemp
+    },
+    handleBasisSelectionChange (val) {
+      console.log(val)
+      this.basisSelection = val
+      this.basisTemp = ''
+      for (var i = 0; i < val.length; i++) {
+        this.basisTemp = this.basisTemp + (val[i].Code + ' ' + val[i].Name + ',')
+      }
+      this.yChooseCert = this.goodsTemp + this.basisTemp + this.tcTemp
+    },
+    handleTCSelectionChange (val) {
+      console.log(val)
+      this.tcSelection = val
+      this.tcTemp = ''
+      for (var i = 0; i < val.length; i++) {
+        this.tcTemp = this.tcTemp + (val[i].Code + ' ' + val[i].Name + ',')
+      }
+      this.yChooseCert = this.goodsTemp + this.basisTemp + this.tcTemp
+    },
     // back (row) {
     //   var id = row.Id
     //   console.log(id)
@@ -504,10 +750,97 @@ export default {
       }
     },
     getChooseCode (val) {
+      this.yChooseCert = ''
       this.entityForm.CompanyCode = val.Id
       this.entityForm.CompanyName = val.SupplierName
+      // 搜索该公司所具有的准入范围
+      this.serachCertByCompany(val.Id)
       this.companyDialog = false
     },
+    serachCertByCompany (companyId) {
+      this.companyId = companyId
+      this.serachGoodsCertByCompany()
+      this.serachBasisCertByCompany()
+      this.serachTCCertByCompany()
+    },
+
+    serachGoodsCertByCompany (event) {
+      if (event != null) {
+        this.currentGoodsPage = 1
+      }
+
+      let params = {
+        _size: this.goodsSize,
+        _currentPage: this.currentGoodsPage,
+        _companyId: this.companyId,
+        _certName: this.certChooseName,
+        _Bak1: this.editForm.Bak1
+      }
+      setapi
+        .serachGoodsCertByCompany(params, this.$axios)
+        .then(res => {
+          this.goodsList = res.data.items
+          if (res.data.currentItemCount) {
+            this.currentGoodsItemCount = res.data.currentItemCount
+          } else {
+            this.currentGoodsItemCount = 0
+          }
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    serachBasisCertByCompany (event) {
+      if (event != null) {
+        this.currentBasisPage = 1
+      }
+
+      let params = {
+        _size: this.basisSize,
+        _currentPage: this.currentBasisPage,
+        _companyId: this.companyId,
+        _certName: this.certChooseName,
+        _Bak1: this.editForm.Bak1
+      }
+      setapi
+        .serachBasisCertByCompany(params, this.$axios)
+        .then(res => {
+          this.basisList = res.data.items
+          if (res.data.currentItemCount) {
+            this.currentBasisItemCount = res.data.currentItemCount
+          } else {
+            this.currentBasisItemCount = 0
+          }
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    serachTCCertByCompany (event) {
+      if (event != null) {
+        this.currentTCPage = 1
+      }
+      let params = {
+        _size: this.tcSize,
+        _currentPage: this.currentTCPage,
+        _companyId: this.companyId,
+        _certName: this.certChooseName,
+        _Bak1: this.editForm.Bak1
+      }
+      setapi
+        .serachTCCertByCompany(params, this.$axios)
+        .then(res => {
+          this.tcList = res.data.items
+          if (res.data.currentItemCount) {
+            this.currentTCItemCount = res.data.currentItemCount
+          } else {
+            this.currentTCItemCount = 0
+          }
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
     EditSubmit () {
       if (this.Bak22 && this.Bak22.length !== 0) {
         if (typeof (this.Bak22[0]) === 'string' || typeof (this.Bak22[1]) === 'string') {
@@ -518,10 +851,42 @@ export default {
           this.editForm.Bak2 = startDate + ' 至 ' + endDate
         }
       }
+
+      var goodsString = ''
+      if (this.goodsSelection.length !== 0) {
+        for (var i = 0; i < this.goodsSelection.length; i++) {
+          goodsString = goodsString + this.goodsSelection[i].Id + ','
+        }
+        goodsString = goodsString.substring(0, goodsString.length - 1)
+      }
+
+      var basisString = ''
+      if (this.basisSelection.length !== 0) {
+        for (var j = 0; j < this.basisSelection.length; j++) {
+          basisString = basisString + this.basisSelection[j].Id + ','
+        }
+        basisString = basisString.substring(0, basisString.length - 1)
+      }
+
+      var tcString = ''
+      if (this.tcSelection.length !== 0) {
+        for (var k = 0; k < this.tcSelection.length; k++) {
+          tcString = tcString + this.tcSelection[k].Id + ','
+        }
+        tcString = tcString.substring(0, tcString.length - 1)
+      }
+
+      let params = {
+        _goodsString: goodsString,
+        _basisString: basisString,
+        _tcString: tcString,
+        _Bak1: this.editForm.Bak1
+
+      }
       this.$refs['EditFormref'].validate(valid => {
         if (valid) {
           setapi
-            .updatebadrecordbyid(this.editId, this.editForm, this.$axios)
+            .updatebadrecordbyid(this.editId, this.editForm, params, this.$axios)
             .then(res => {
               if (res.data.code === 0) {
                 this.initDatas()
@@ -531,6 +896,15 @@ export default {
                   message: res.data.message
                 })
                 this.$refs['EditFormref'].resetFields()
+                this.certNames = ''
+                this.goodsSelection = []
+                this.basisSelection = []
+                this.tcSelection = []
+                this.goodsList = []
+                this.basisList = []
+                this.tcList = []
+                this.yChooseCert = ''
+                this.activeName = 'first'
               } else {
                 this.$message({
                   type: 'warning',
@@ -554,12 +928,36 @@ export default {
       this.editForm.Companycode = row.Companycode // 返现类别名称根据value值
       this.editForm.Record = row.Record // 返现类别名称根据value值
       this.editForm.Bak3 = row.Bak3 // 返现类别名称根据value值
+      this.editForm.Bak1 = row.Bak1
       if (row.Bak2.indexOf(' 至 ') !== -1) {
         var arr = row.Bak2.split(' 至 ')
         this.Bak22 = arr
       } else {
         this.Bak22 = []
       }
+      if (row.Bak1 === '1') {
+        this.goodsList = []
+        this.basisList = []
+        this.tcList = []
+        this.certNames = ''
+        this.goodsSize = 10
+        this.basisSize = 10
+        this.tcSize = 10
+
+        this.currentGoodsPage = 1
+        this.currentBasisPage = 1
+        this.currentTCPage = 1
+
+        this.currentGoodsItemCount = 0
+        this.currentBasisItemCount = 0
+        this.currentTCItemCount = 0
+        this.activeName = 'first'
+        // 执行方法整这个企业的准入项
+
+        this.serachCertByCompany(row.Companycode)
+        this.certTitle = '已暂停准入范围列表'
+        this.certDialog = true
+      }
     },
 
     deleterow (row) {
@@ -601,10 +999,46 @@ export default {
         var endDate = this.formatDateTime(this.Bak2[1])
         this.entityForm.Bak2 = startDate + ' 至 ' + endDate
       }
+      // 判断是什么暂停
+      if (this.certNames !== '') {
+        this.isFlag = '1'
+      } else {
+        this.isFlag = '0'
+      }
+      // 处理选中的数组
+      var goodsString = ''
+      if (this.goodsSelection.length !== 0) {
+        for (var i = 0; i < this.goodsSelection.length; i++) {
+          goodsString = goodsString + this.goodsSelection[i].Id + ','
+        }
+        goodsString = goodsString.substring(0, goodsString.length - 1)
+      }
+
+      var basisString = ''
+      if (this.basisSelection.length !== 0) {
+        for (var j = 0; j < this.basisSelection.length; j++) {
+          basisString = basisString + this.basisSelection[j].Id + ','
+        }
+        basisString = basisString.substring(0, basisString.length - 1)
+      }
+
+      var tcString = ''
+      if (this.tcSelection.length !== 0) {
+        for (var k = 0; k < this.tcSelection.length; k++) {
+          tcString = tcString + this.tcSelection[k].Id + ','
+        }
+        tcString = tcString.substring(0, tcString.length - 1)
+      }
+      let params = {
+        _isFlag: this.isFlag,
+        _goodsString: goodsString,
+        _basisString: basisString,
+        _tcString: tcString
+      }
       this.$refs['EntityFormref'].validate(valid => {
         if (valid) {
           setapi
-            .addBadRecord(this.entityForm, this.$axios)
+            .addBadRecord(this.entityForm, params, this.$axios)
             .then(res => {
               if (res.data.code === 0) {
                 // 刷新列表
@@ -618,6 +1052,12 @@ export default {
                 this.$refs['EntityFormref'].resetFields()
                 this.Bak2 = []
                 this.entityForm.Bak2 = ''
+                this.certNames = ''
+                this.goodsSelection = []
+                this.basisSelection = []
+                this.tcSelection = []
+                this.yChooseCert = ''
+                this.activeName = 'first'
               } else {
                 this.$message({
                   type: 'warning',
@@ -674,6 +1114,25 @@ export default {
         })
     },
     addaudit () {
+      this.certTitle = '准入范围列表'
+      this.goodsList = []
+      this.basisList = []
+      this.tcList = []
+      this.certNames = ''
+      this.goodsSize = 10
+      this.basisSize = 10
+      this.tcSize = 10
+
+      this.entityForm.CompanyName = ''
+      this.currentGoodsPage = 1
+      this.currentBasisPage = 1
+      this.currentTCPage = 1
+
+      this.currentGoodsItemCount = 0
+      this.currentBasisItemCount = 0
+      this.currentTCItemCount = 0
+      this.activeName = 'first'
+      this.editForm.Bak1 = ''
       this.addshow = true
     },
 
@@ -686,6 +1145,18 @@ export default {
       this.currentPage1 = value
       this.initCompany()
     },
+    handleGoodsCurrentChange (value) {
+      this.currentGoodsPage = value
+      this.serachGoodsCertByCompany()
+    },
+    handleBasisCurrentChange (value) {
+      this.currentBasisPage = value
+      this.serachBasisCertByCompany()
+    },
+    handleTCCurrentChange (value) {
+      this.currentTCPage = value
+      this.serachTCCertByCompany()
+    },
     handleSizeChange (value) {
       this.size = value
       this.currentPage = 1
@@ -696,6 +1167,21 @@ export default {
       this.currentPage1 = 1
       this.initCompany()
     },
+    handleGoodsSizeChange (value) {
+      this.goodsSize = value
+      this.currentGoodsPage = 1
+      this.serachGoodsCertByCompany()
+    },
+    handleBasisSizeChange (value) {
+      this.basisSize = value
+      this.currentBasisPage = 1
+      this.serachBasisCertByCompany()
+    },
+    handleTCSizeChange (value) {
+      this.tcSize = value
+      this.currentTCPage = 1
+      this.serachTCCertByCompany()
+    },
     searchCommand (command) {
       if (command === 'clear') {
         this.clearSearch()