Browse Source

前后:合同导入相关

dubch 5 years ago
parent
commit
32e5b67780

+ 6 - 0
src/dashoo.cn/backend/api/business/oilcontract/contract/contract.go

@@ -56,6 +56,7 @@ type OilContract struct {
 	ContractMark         string    `json:"ContractMark" xorm:"comment('合同标的') VARCHAR(500) 'ContractMark'"`
 	Currency             string    `json:"Currency" xorm:"comment('币种') VARCHAR(500) 'Currency'"`
 	BudgetAmount         string    `json:"BudgetAmount" xorm:"comment('预算金额') VARCHAR(255) 'BudgetAmount'"`
+	IsYearMoney          string    `json:"IsYearMoney" xorm:"comment('当年结算金额') VARCHAR(255) 'IsYearMoney'"`
 	PerformAmount        string    `json:"PerformAmount" xorm:"comment('履行金额') VARCHAR(255) 'PerformAmount'"`
 	IsInternal           int       `json:"IsInternal" xorm:"default 0 comment('是否内部合同') INT(11) 'IsInternal'"`
 	IsForeign            int       `json:"IsForeign" xorm:"default 0 comment('是否涉外合同') INT(11) 'IsForeign'"`
@@ -70,6 +71,11 @@ type OilContract struct {
 	SubmitDate           time.Time `json:"SubmitDate" xorm:"comment('提交日期') DATETIME 'SubmitDate'"`
 	SealName             string    `json:"SealName" xorm:"comment('用章名称') VARCHAR(500) 'SealName'"`
 	PoNumber             string    `json:"PoNumber" xorm:"comment('po编码') VARCHAR(500) 'PoNumber'"`
+	ImportStatus         int       `json:"ImportStatus" xorm:"comment('0导入未确认,1已确认,2手动录入') int(2) 'ImportStatus'"`
+	ImportSupplierName   string    `json:"ImportSupplierName" xorm:"comment('导入公司名') VARCHAR(255) 'ImportSupplierName'"`
+	IsYear               int       `json:"IsYear" xorm:"comment('0未跨年,1跨年') int(2) 'IsYear'"`
+	ImportSecondUnit     string    `json:"ImportSecondUnit" xorm:"comment('导入二级单位') VARCHAR(255) 'ImportSecondUnit'"`
+	Class     			 string    `json:"Class" xorm:"comment('类别') VARCHAR(255) 'Class'"`
 }
 type OilContractItems struct {
 	Items []OilContract

+ 0 - 48
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -285,51 +285,3 @@ func (s *OilContractSumScoreService) GetSum(entitiesPtr interface{}, where strin
 
 	s.DBE.SQL(sql).Get(entitiesPtr)
 }
-
-func (s *OilContractSumScoreService) GetMinValue(entitiesPtr interface{}, where string) {
-	// 优秀、合格分数值从配置中取
-	var paramEntityList []baseparameter.Base_Parameter
-	paramsSvc := baseparameter.GetBaseparameterService(utils.DBE)
-	paramEntityList = paramsSvc.GetBaseparameterbyid("GFGL_CONTRACT", "paramset")
-	good := "80"
-	pass := "60"
-	for _, i := range paramEntityList {
-		if i.Parametercode == "yearEvaGood" {
-			good = i.Parametercontent
-		}
-		if i.Parametercode == "yearEvaPass" {
-			pass = i.Parametercontent
-		}
-	}
-
-	var sql string
-	sql = `select YEAR(NOW()) as Year,contract.ContractClass,contract.SupplierId,contract.SupplierName,count(review.id) as count, `
-
-	sql += ` sum(case when items.SequenceNo in  ('1') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B1, `
-	sql += ` sum(case when items.SequenceNo in  ('2') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B2, `
-	sql += ` sum(case when items.SequenceNo in  ('3') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B3, `
-	sql += ` sum(case when items.SequenceNo in  ('4') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B4, `
-	sql += ` sum(case when items.SequenceNo in  ('5') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B5, `
-	sql += ` sum(case when items.SequenceNo in  ('6') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B6, `
-	sql += ` sum(case when items.SequenceNo in  ('7') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B7, `
-	sql += ` sum(case when items.SequenceNo in  ('8') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B8, `
-
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('1') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score1,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('2') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score2,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('3') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score3,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('4') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score4,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('5') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score5,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('6') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score6,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('7') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score7,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('8') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score8,  `
-	sql += ` ROUND(sum(case when items.SequenceNo in  ('9') AND items.Type =1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type =1 then 1 else 0 end),2) Score9,  `
-	sql += ` ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type = 1 then 1 else 0 end),2) Score,  `
-	sql += ` case when ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type = 1 then 1 else 0 end),2) < ` + pass + ` then 3 when ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type = 1 then 1 else 0 end),2) < ` + good + ` then 2 else 1 end as Evaluate `
-	sql += ` from ` + controllers.OilContractReviewName + ` review `
-	sql += ` left join ` + controllers.OilContractName + ` contract on review.ContractId=contract.id `
-	sql += ` left join ` + controllers.OilContractEvaluationItemsName + ` items on items.ContentReviewId=review.id and items.LevelCode=1 `
-	sql += ` where ` + where
-	sql += ` group by contract.SupplierId,contract.SupplierName `
-
-	s.DBE.SQL(sql).Get(entitiesPtr)
-}

+ 431 - 178
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -3,6 +3,7 @@ package oilcontract
 import (
 	"dashoo.cn/backend/api/business/auditsetting"
 	"dashoo.cn/backend/api/business/oilcontract/contractReview"
+	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/workflow"
 	"encoding/json"
@@ -107,6 +108,7 @@ func (this *OilContractController) GetEntityList() {
 	SealName := this.GetString("SealName")
 	PoNumber := this.GetString("PoNumber")
 	SubPackage := this.GetString("SubPackage")
+	ImportStatus := this.GetString("ImportStatus")
 
 	if Id != "" {
 		where = where + " and Id like '%" + Id + "%'"
@@ -361,6 +363,12 @@ func (this *OilContractController) GetEntityList() {
 		where = where + " and PoNumber like '%" + SignedDate + "%'"
 	}
 
+	if ImportStatus != "" {
+		where = where + " and ImportStatus = " + ImportStatus
+	} else {
+		where = where + " and ImportStatus != 0"
+	}
+
 	// 企管法规处可看所有合同, 获取企管法规处人员
 	var setting auditsetting.Base_OilAuditSetting
 	orgSvc := organize.GetOrganizeService(utils.DBE)
@@ -462,110 +470,161 @@ func (this *OilContractController) GetEntity() {
 }
 
 // @Title get 导入excel
-// @Description 数据存入word
+// @Description 导入excel
 // @Success 200 {object} controllers.Request
 // @router /importexcel [get]
 func (this *OilContractController) ImportExcel() {
-	url := this.GetString("ExcelUrl")
-	var errorinfo ErrorDataInfo
-	if url == "" {
-		errorinfo.Code = -2
-		errorinfo.Message = "导入失败!"
-		this.Data["json"] = &errorinfo
-		this.ServeJSON()
-	}
-	session := utils.DBE.NewSession()
-	err := session.Begin()
-	//svc := contract.GetOilContractSession(session)
-	if err != nil {
-		session.Rollback()
-		errorinfo.Code = -2
-		errorinfo.Message = "导入失败!"
-		this.Data["json"] = &errorinfo
-		this.ServeJSON()
-	}
+	go func() {
+		url := this.GetString("ExcelUrl")
+		//var errLineNum string
 
-	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
-	filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
-	utils.DownloadFile(url, filename, _dir)
-	t := time.Now()
-	filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + filename
-	xlFile, err := xlsx.OpenFile(filePath)
-	var errLineNum string
-	//excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
-	if err != nil {
-		fmt.Printf("open failed: %s\n", err)
-	}
-	var sheet = xlFile.Sheets[0]
-	// 插入字段
-	//Fstrs := "ContractNo,ContractName,Amount,ContractType,ContractSonClass,SmallClass,SignedDate,Number,ChooseWay,ContractMark,Currency,BudgetAmount,PerformAmount,IsInternal,IsForeign,IsDeal,MoneyFlows,MoneyChannel,MoneyChannelSon,MoneyChannelSmall,SingUnit,Place,StartDate,EndDate,DisputeResolution,Remark,ProjectOwner,SubmitDate,SealName,PoNumber"
-	//columnArr := strings.Split(Fstrs, ",")
-	defer func() {
-		session.Close()
-	}()
+		if url == "" {
+			fmt.Println("文件不能为空!")
+		}
 
-	//timeTemplate1 := "2006/01/02 15:04:05" //常规类型
-
-	codemap := make(map[int](map[string]string))
-	for i := 1; i < len(sheet.Rows); i++ {
-		lineNo := strconv.Itoa(i + 1)
-		fmt.Println(lineNo)
-		tmp := make(map[string]string)
-		tmp["ContractNo"] = sheet.Rows[i].Cells[0].String()
-		tmp["ContractName"] = sheet.Rows[i].Cells[1].String()
-		tmp["Amount"] = sheet.Rows[i].Cells[2].String()
-		tmp["SourceContractClass"] = sheet.Rows[i].Cells[3].String()
-
-		tmp["ContractSonClass"] = sheet.Rows[i].Cells[4].String()
-		tmp["SmallClass"] = sheet.Rows[i].Cells[5].String()
-		tmp["SignedDate"] = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
-		tmp["SourceSupplierName"] = sheet.Rows[i].Cells[7].String()
-
-		tmp["People"] = sheet.Rows[i].Cells[8].String()
-		tmp["Number"] = sheet.Rows[i].Cells[9].String()
-		tmp["ChooseWay"] = sheet.Rows[i].Cells[10].String()
-		tmp["ContractMark"] = sheet.Rows[i].Cells[11].String()
-		tmp["Currency"] = sheet.Rows[i].Cells[12].String()
-		tmp["BudgetAmount"] = sheet.Rows[i].Cells[13].String()
-		tmp["PerformAmount"] = sheet.Rows[i].Cells[14].String()
-		tmp["IsInternal"] = sheet.Rows[i].Cells[15].String()
-		tmp["IsForeign"] = sheet.Rows[i].Cells[16].String()
-		tmp["IsDeal"] = sheet.Rows[i].Cells[17].String()
-		tmp["MoneyFlows"] = sheet.Rows[i].Cells[18].String()
-		tmp["MoneyChannel"] = sheet.Rows[i].Cells[19].String()
-		tmp["MoneyChannelSon"] = sheet.Rows[i].Cells[20].String()
-		tmp["MoneyChannelSmall"] = sheet.Rows[i].Cells[21].String()
-		tmp["SingUnit"] = sheet.Rows[i].Cells[22].String()
-		tmp["Place"] = sheet.Rows[i].Cells[23].String()
-
-		tmp["StartDate"] = convertToFormatDay(sheet.Rows[i].Cells[24].Value)
-		tmp["EndDate"] = convertToFormatDay(sheet.Rows[i].Cells[25].Value)
-		tmp["DisputeResolution"] = sheet.Rows[i].Cells[26].String()
-		tmp["Remark"] = sheet.Rows[i].Cells[27].String()
-		tmp["ProjectOwner"] = sheet.Rows[i].Cells[28].String()
-		tmp["SubmitDate"] = convertToFormatDay(sheet.Rows[i].Cells[29].Value)
-		tmp["SealName"] = sheet.Rows[i].Cells[30].String()
-		tmp["PoNumber"] = sheet.Rows[i].Cells[31].String()
-		codemap[i-1] = tmp
-		//this.OperationCell(svc, lineNo, columnArr, sheet.Rows[i].Cells, &errLineNum)
-	}
-	os.Remove(filePath)
-	if errLineNum != "" {
-		session.Rollback()
-		errorinfo.Code = -1
-		errorinfo.Message = "导入失败!错误行号:" + errLineNum
-		this.Data["json"] = &errorinfo
-		this.ServeJSON()
-	} else {
-		session.Commit()
+		_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
+		filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
+		utils.DownloadFile(url, filename, _dir)
+		t := time.Now()
+		filePath := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx/" + filename
+		xlFile, err := xlsx.OpenFile(filePath)
+		//excelFileName := "F:/物资类项目与资质对照表-2017.xlsx"
+		if err != nil {
+			fmt.Printf("open failed: %s\n", err)
+		}
+		var sheet = xlFile.Sheets[0]
+		// 插入字段
+		//Fstrs := "ContractNo,ContractName,Amount,ContractType,ContractSonClass,SmallClass,SignedDate,Number,ChooseWay,ContractMark,Currency,BudgetAmount,PerformAmount,IsInternal,IsForeign,IsDeal,MoneyFlows,MoneyChannel,MoneyChannelSon,MoneyChannelSmall,SingUnit,Place,StartDate,EndDate,DisputeResolution,Remark,ProjectOwner,SubmitDate,SealName,PoNumber"
+		//columnArr := strings.Split(Fstrs, ",")
+
+		//timeTemplate1 := "2006/01/02 15:04:05" //常规类型
+		svc := contract.GetOilContractService(utils.DBE)
+		for i := 1; i < len(sheet.Rows); i++ {
+			var con contract.OilContract
+			var con1 contract.OilContract
+			lineNo := strconv.Itoa(i + 1)
+			fmt.Println(lineNo)
+			svc.GetEntityByWhere(OilContractName, "ContractNo = '" + sheet.Rows[i].Cells[0].String() + "'", &con1)
+			if con1.Id > 0 {
+				con1.ContractName = sheet.Rows[i].Cells[1].String()
+				con1.Amount = sheet.Rows[i].Cells[2].String()
+				con1.Class = sheet.Rows[i].Cells[3].String()
+				con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
+				con1.SmallClass = sheet.Rows[i].Cells[5].String()
+				con1.SignedDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
+				con1.Number = sheet.Rows[i].Cells[9].String()
+				con1.ChooseWay = sheet.Rows[i].Cells[10].String()
+				con1.ContractMark = sheet.Rows[i].Cells[11].String()
+				con1.Currency = sheet.Rows[i].Cells[12].String()
+				con1.BudgetAmount = sheet.Rows[i].Cells[13].String()
+				con1.PerformAmount = sheet.Rows[i].Cells[14].String()
+				con1.IsYearMoney = con1.PerformAmount
+				con1.IsInternal = 0
+				if sheet.Rows[i].Cells[15].String() == "是" {
+					con1.IsInternal = 1
+				}
+				con1.IsForeign = 0
+				if sheet.Rows[i].Cells[16].String() == "是" {
+					con1.IsForeign = 1
+				}
+				con1.IsDeal = 0
+				if sheet.Rows[i].Cells[17].String() == "是" {
+					con1.IsDeal = 1
+				}
+				con1.MoneyFlows = sheet.Rows[i].Cells[18].String()
+				con1.MoneyChannel = sheet.Rows[i].Cells[19].String()
+				con1.MoneyChannelSon = sheet.Rows[i].Cells[20].String()
+				con1.MoneyChannelSmall = sheet.Rows[i].Cells[21].String()
+				con1.SingUnit = sheet.Rows[i].Cells[22].String()
+				con1.Place = sheet.Rows[i].Cells[23].String()
+
+				con1.StartDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
+				con1.EndDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
+				con1.DisputeResolution = sheet.Rows[i].Cells[26].String()
+				con1.Remark = sheet.Rows[i].Cells[27].String()
+				if con1.ProjectOwner != sheet.Rows[i].Cells[28].String() {
+					con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[28].String()
+				}
+				con1.SubmitDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
+				con1.SealName = sheet.Rows[i].Cells[30].String()
+				con1.PoNumber = sheet.Rows[i].Cells[31].String()
+				con1.ImportStatus = 0
+				svc.UpdateEntityById(con1.Id, &con1)
+				continue
+			}
+			con.ContractNo = sheet.Rows[i].Cells[0].String()
+			con.ContractName = sheet.Rows[i].Cells[1].String()
+			con.Amount = sheet.Rows[i].Cells[2].String()
+			con.Class = sheet.Rows[i].Cells[3].String()
+
+			con.ContractSonClass = sheet.Rows[i].Cells[4].String()
+			con.SmallClass = sheet.Rows[i].Cells[5].String()
+			//con.SignedDate = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
+			con.SignedDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
+			con.ImportSecondUnit = sheet.Rows[i].Cells[7].String()
+
+			con.ImportSupplierName = sheet.Rows[i].Cells[8].String()
+			var supp supplier.OilSupplier
+			svc.GetEntityByWhere(OilSupplierName, "SupplierName = '" + con.ImportSupplierName + "'", &supp)
+			if supp.Id > 0 {
+				con.SupplierId = supp.Id
+			}
+			var org organize.Base_Organize
+			svc.GetEntityByWhere("Base_Organize", "FullName = '" + sheet.Rows[i].Cells[7].String() + "'", &org)
+			if org.Id > 0 {
+				con.SecondUnit = org.Id
+			}
+			con.Number = sheet.Rows[i].Cells[9].String()
+			con.ChooseWay = sheet.Rows[i].Cells[10].String()
+			con.ContractMark = sheet.Rows[i].Cells[11].String()
+			con.Currency = sheet.Rows[i].Cells[12].String()
+			con.BudgetAmount = sheet.Rows[i].Cells[13].String()
+			con.PerformAmount = sheet.Rows[i].Cells[14].String()
+			con.IsYearMoney = con.PerformAmount
+			con.IsInternal = 0
+			if sheet.Rows[i].Cells[15].String() == "是" {
+				con.IsInternal = 1
+			}
+			con.IsForeign = 0
+			if sheet.Rows[i].Cells[16].String() == "是" {
+				con.IsForeign = 1
+			}
+			con.IsDeal = 0
+			if sheet.Rows[i].Cells[17].String() == "是" {
+				con.IsDeal = 1
+			}
+			con.MoneyFlows = sheet.Rows[i].Cells[18].String()
+			con.MoneyChannel = sheet.Rows[i].Cells[19].String()
+			con.MoneyChannelSon = sheet.Rows[i].Cells[20].String()
+			con.MoneyChannelSmall = sheet.Rows[i].Cells[21].String()
+			con.SingUnit = sheet.Rows[i].Cells[22].String()
+			con.Place = sheet.Rows[i].Cells[23].String()
+
+			con.StartDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
+			con.EndDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
+			con.DisputeResolution = sheet.Rows[i].Cells[26].String()
+			con.Remark = sheet.Rows[i].Cells[27].String()
+			con.ProjectOwner = sheet.Rows[i].Cells[28].String()
+			con.SubmitDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
+			con.SealName = sheet.Rows[i].Cells[30].String()
+			con.PoNumber = sheet.Rows[i].Cells[31].String()
+			con.ImportStatus = 0
+			con.Status = 1
+			con.SettleStatus = "1"
+			_, err = svc.InsertEntityBytbl(OilContractName, &con)
+			if err != nil {
+				fmt.Println(err)
+			}
+		}
+		os.Remove(filePath)
 		elapsed := time.Since(t)
 		log.Println(elapsed)
-		errorinfo.Code = 0
-		errorinfo.Message = "导入成功!"
-		errorinfo.Item = codemap
-		this.Data["json"] = &errorinfo
-		this.ServeJSON()
-	}
+	}()
+	var errorinfo ErrorDataInfo
+	errorinfo.Code = 0
+	errorinfo.Message = "导入中,请稍后!"
+	this.Data["json"] = &errorinfo
+	this.ServeJSON()
 }
 
 // @Title 从数据录入数据导出到word文档
@@ -605,101 +664,288 @@ func (this *OilContractController) DocExport() {
 // @Success 200 {object} controllers.Request
 // @router /importbatchsave [post]
 func (this *OilContractController) ImportBatchSave() {
-	var model contract.OilContractItems
-	var jsonBlob = this.Ctx.Input.RequestBody
-	json.Unmarshal(jsonBlob, &model)
+
+	sql := "update OilContract set ImportStatus = 1 where SupplierId != 0 and ContractClass != '' and SecondUnit != 0"
+	_, err := utils.DBE.Query(sql)
 	var errinfo ErrorInfo
-	svc := contract.GetOilContractService(utils.DBE)
+	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()
+	}
+
+
 	// 新增配置项
-	for i, v := range model.Items {
-		fmt.Print(i)
-		if v.SupplierName == "" || v.SupplierId == 0 {
-			errinfo.Message = "操作失败!未选择供应商名称,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
-		if v.ContractClass == "" {
-			errinfo.Message = "操作失败!未选择合同分类,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
-		if v.ContractNo == "" {
-			errinfo.Message = "操作失败!合同编号不能为空,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
-		if v.ContractName == "" {
-			errinfo.Message = "操作失败!合同名称不能为空,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
+	//for i, v := range model.Items {
+	//	fmt.Print(i)
+	//	if v.SupplierName == "" || v.SupplierId == 0 {
+	//		errinfo.Message = "操作失败!未选择供应商名称,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//	if v.ContractClass == "" {
+	//		errinfo.Message = "操作失败!未选择合同分类,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//	if v.ContractNo == "" {
+	//		errinfo.Message = "操作失败!合同编号不能为空,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//	if v.ContractName == "" {
+	//		errinfo.Message = "操作失败!合同名称不能为空,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//
+	//	var noCount = 0
+	//	var nameCount = 0
+	//	for ii, vv := range model.Items {
+	//		fmt.Print(ii)
+	//		if vv.ContractNo == v.ContractNo {
+	//			noCount++
+	//		}
+	//		if vv.ContractName == v.ContractName {
+	//			nameCount++
+	//		}
+	//	}
+	//	if nameCount >= 2 {
+	//		errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//
+	//	var contract contract.OilContract
+	//
+	//	tempCount2, _ := svc.GetCount(&contract, "ContractName='"+v.ContractName+"'")
+	//	if tempCount2 > 0 {
+	//		errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
+	//		errinfo.Code = -2
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//
+	//	model.Items[i].CreateUserId, _ = strconv.Atoi(this.User.Id)
+	//	model.Items[i].CreateOn = time.Now()
+	//	model.Items[i].CreateBy = this.User.Realname
+	//	svc.GetEntity(&contract, "ContractNo='"+v.ContractNo+"'")
+	//	if contract.Id > 0 {
+	//		cols := []string{
+	//
+	//			"Id",
+	//
+	//			"SupplierId",
+	//
+	//			"SupplierName",
+	//
+	//			"Status",
+	//
+	//			"SettleStatus",
+	//
+	//			"ProjectName",
+	//
+	//			"ContractNo",
+	//
+	//			"ProjectPlace",
+	//
+	//			"ProjectOwner",
+	//
+	//			"Telephone",
+	//
+	//			"ProjectType",
+	//
+	//			"ContractMode",
+	//
+	//			"Amount",
+	//
+	//			"ContractPeriod",
+	//
+	//			"OpenDate",
+	//
+	//			"PlanFinishDate",
+	//
+	//			"ConstructionUnit",
+	//
+	//			"ConstructionOwner",
+	//
+	//			"ConstructionTelphone",
+	//
+	//			"BuildUnit",
+	//
+	//			"BuildOwner",
+	//
+	//			"BuildTelphone",
+	//
+	//			"SuperviseUnit",
+	//
+	//			"SuperviseOwner",
+	//
+	//			"SuperviseTelphone",
+	//
+	//			"QualityUnit",
+	//
+	//			"QualityOwner",
+	//
+	//			"QualityTelphone",
+	//
+	//			"Remark",
+	//
+	//			"IsDelete",
+	//
+	//			"CreateOn",
+	//
+	//			"CreateUserId",
+	//
+	//			"CreateBy",
+	//
+	//			"ModifiedOn",
+	//
+	//			"ModifiedUserId",
+	//
+	//			"ModifiedBy",
+	//
+	//			"SubPackage",
+	//
+	//			"ContractName",
+	//
+	//			"ContractSonClass",
+	//
+	//			"SmallClass",
+	//
+	//			"SignedDate",
+	//
+	//			"People",
+	//
+	//			"Number",
+	//
+	//			"ChooseWay",
+	//
+	//			"ContractMark",
+	//
+	//			"Currency",
+	//
+	//			"BudgetAmount",
+	//
+	//			"PerformAmount",
+	//
+	//			"IsInternal",
+	//
+	//			"IsForeign",
+	//
+	//			"IsDeal",
+	//
+	//			"MoneyFlows",
+	//
+	//			"MoneyChannelSon",
+	//
+	//			"MoneyChannelSmall",
+	//
+	//			"SingUnit",
+	//
+	//			"Place",
+	//
+	//			"DisputeResolution",
+	//
+	//			"SubmitDate",
+	//
+	//			"SealName",
+	//
+	//			"PoNumber",
+	//		}
+	//		contract.SupplierName = v.SupplierName
+	//		contract.ProjectName = v.ProjectName
+	//		contract.ProjectPlace = v.ProjectPlace
+	//		contract.ProjectOwner = contract.ProjectOwner + "," + v.ProjectOwner
+	//		contract.Amount = v.Amount
+	//		err = svc.UpdateEntityBytbl(OilContractName, contract.Id, &contract, cols)
+	//	} else {
+	//		_, err = svc.InsertEntityBytbl(OilContractName, &model.Items[i])
+	//	}
+	//}
 
-		var noCount = 0
-		var nameCount = 0
-		for ii, vv := range model.Items {
-			fmt.Print(ii)
-			if vv.ContractNo == v.ContractNo {
-				noCount++
-			}
-			if vv.ContractName == v.ContractName {
-				nameCount++
-			}
-		}
-		if noCount >= 2 {
-			errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
-		if nameCount >= 2 {
-			errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
 
-		var contract contract.OilContract
-		tempCount, _ := svc.GetCount(&contract, "ContractNo='"+v.ContractNo+"'")
-		if tempCount > 0 {
-			errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
+}
 
-		tempCount2, _ := svc.GetCount(&contract, "ContractName='"+v.ContractName+"'")
-		if tempCount2 > 0 {
-			errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
-			errinfo.Code = -2
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
+// @Title get 批量修改字段
+// @Description 批量修改字段
+// @Success 200 {object} controllers.Request
+// @router /importUpdate [get]
+func (this *OilContractController) ImportUpdate() {
+	Class := this.GetString("Class")
+	Value := this.GetString("Value")
+	Column := this.GetString("Column")
+	Id := this.GetString("Id")
+	var err error
+	where := "1=1"
+	if Column == "ContractClass" {
+		if Id != "" {
+			where += " and Id = " + Id + " and ImportStatus = 0 and Class = '" + Class + "'"
+		} else {
+			where += " and ImportStatus = 0 and Class = '" + Class + "' and " + Column + " = ''"
 		}
+		sql := "update OilContract set " + Column + " = '" + Value + "' where " + where
+		_, err = utils.DBE.Query(sql)
+	}
+	if Column == "SupplierId" {
+		var supp supplier.OilSupplier
+		svc := supplier.GetOilSupplierService(utils.DBE)
+		svc.GetEntityById(Value, &supp)
+		if Id != "" {
+			where += " and Id = " + Id + " and ImportStatus = 0 and ImportSupplierName = '" + Class + "'"
+		} else {
+			where += " and ImportStatus = 0 and ImportSupplierName = '" + Class + "' and " + Column + " = 0"
+		}
+		sql := "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
+		_, err = utils.DBE.Query(sql)
+	}
 
-		model.Items[i].CreateUserId, _ = strconv.Atoi(this.User.Id)
-		model.Items[i].CreateOn = time.Now()
-		model.Items[i].CreateBy = this.User.Realname
+	if Column == "SecondUnit" {
+		if Id != "" {
+			where += " and Id = " + Id + " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "'"
+		} else {
+			where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "' and " + Column + " = 0"
+		}
+		sql := "update OilContract set " + Column + " = " + Value + " where " + where
+		_, err = utils.DBE.Query(sql)
+	}
 
+	if Column == "Status" {
+		where += " and Id = " + Id + " and ImportStatus = 0"
+		sql := "update OilContract set " + Column + " = " + Value + " where " + where
+		_, err = utils.DBE.Query(sql)
 	}
-	_, err := svc.DBE.Insert(model.Items)
+	if Column == "SettleStatus" {
+		where += " and Id = " + Id + " and ImportStatus = 0"
+		sql := "update OilContract set " + Column + " = '" + Value + "' where " + where
+		_, err = utils.DBE.Query(sql)
+	}
+
+	var errinfo ErrorInfo
 	if err == nil {
-		errinfo.Message = "导入成功!"
+		errinfo.Message = "修改成功!"
 		errinfo.Code = 0
 		this.Data["json"] = &errinfo
 		this.ServeJSON()
 	} else {
-		errinfo.Message = "导入失败!" + utils.AlertProcess(err.Error())
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
 		errinfo.Code = -1
 		this.Data["json"] = &errinfo
 		this.ServeJSON()
@@ -836,6 +1082,9 @@ func (this *OilContractController) UpdateEntity() {
 
 	var jsonBlob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonBlob, &model)
+	if model.IsYearMoney == "" {
+		model.IsYearMoney = model.PerformAmount
+	}
 	model.ModifiedOn = time.Now()
 	model.ModifiedBy = this.User.Realname
 	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -961,6 +1210,10 @@ func (this *OilContractController) UpdateEntity() {
 		"SealName",
 
 		"PoNumber",
+
+		"IsYearMoney",
+
+		"IsYear",
 	}
 
 	var contract contract.OilContract

+ 9 - 3
src/dashoo.cn/frontend_web/src/api/oilcontract/contract.js

@@ -192,12 +192,18 @@ export default {
       params: params
     })
   },
+  importUpdate (params, myAxios) {
+    return myAxios({
+      url: '/contract/importUpdate',
+      method: 'get',
+      params: params
+    })
+  },
   // 保存导入合同
-  saveImportExcel (formData, myAxios) {
+  saveImportExcel (myAxios) {
     return myAxios({
       url: '/contract/importbatchsave',
-      method: 'post',
-      data: formData
+      method: 'post'
     })
   },
   // 导出合同

+ 61 - 38
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/_opera/operation.vue

@@ -13,7 +13,7 @@
         </span>
         <span style="float: right;">
           <!--  v-if="issueVisibleButton" -->
-          <el-button type="primary" size="mini" v-if="issueVisibleButton" @click="issueVisible=true">下发</el-button>
+<!--          <el-button type="primary" size="mini" v-if="issueVisibleButton" @click="issueVisible=true">下发</el-button>-->
           <el-button type="primary" size="mini" v-if="succseButton && formData.Id!=0 && ![1, 2, 3].includes(formData.Status)" @click="onFinish">完结</el-button>
           <el-button type="primary" size="mini" v-if="successBoolean" @click="exportExcel">导出</el-button>
           <el-button type="primary" size="mini" :loading="addloading" @click="saveEntity">保存</el-button>
@@ -45,7 +45,7 @@
           </el-col>
 
           <el-col :span="8">
-            <el-form-item label="项目名称" prop="ProjectName">
+            <el-form-item label="项目名称">
               <el-input v-model="formData.ProjectName" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
@@ -78,14 +78,23 @@
         </el-row>
         <el-row>
           <el-col :span="8">
-            <el-form-item label="工程地点" prop="ProjectPlace">
-              <el-input v-model="formData.ProjectPlace" placeholder="请输入" style="width: 100%"></el-input>
+            <el-form-item label="项目负责人" prop="ProjectOwner">
+              <el-input v-model="formData.ProjectOwner" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
-
           <el-col :span="8">
-            <el-form-item label="项目负责人" prop="ProjectOwner">
-              <el-input v-model="formData.ProjectOwner" placeholder="请输入" style="width: 100%"></el-input>
+            <el-form-item label="是否跨年" prop="SettleStatus">
+              <el-select v-model="formData.IsYear" placeholder="请选择" style="width: 100%">
+                <el-option label="否" :value=0 key="0"></el-option>
+                <el-option label="是" :value=1 key="1"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="当年结算金额">
+              <el-input v-model="formData.IsYearMoney" placeholder="请输入" style="width: 100%">
+                <template slot="append">(元)</template>
+              </el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -172,7 +181,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="相应小类" prop="SmallClass">
+            <el-form-item label="相应小类">
               <el-input v-model="formData.SmallClass" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
@@ -187,9 +196,14 @@
           </el-col>
         </el-row>
         <el-row>
+<!--          <el-col :span="8">-->
+<!--            <el-form-item label="相对人" prop="People">-->
+<!--              <el-input v-model="formData.People" placeholder="请输入" style="width: 100%"></el-input>-->
+<!--            </el-form-item>-->
+<!--          </el-col>-->
           <el-col :span="8">
-            <el-form-item label="相对人" prop="People">
-              <el-input v-model="formData.People" placeholder="请输入" style="width: 100%"></el-input>
+            <el-form-item label="工程地点" prop="ProjectPlace">
+              <el-input v-model="formData.ProjectPlace" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -282,7 +296,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="资金渠道小类" prop="MoneyChannelSmall">
+            <el-form-item label="资金渠道小类">
               <el-input v-model="formData.MoneyChannelSmall" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
@@ -294,7 +308,7 @@
         </el-row>
         <el-row>
           <el-col :span="8">
-            <el-form-item label="履行地点" prop="Place">
+            <el-form-item label="履行地点">
               <el-input v-model="formData.Place" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
@@ -320,7 +334,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="PO编码" prop="PoNumber">
+            <el-form-item label="PO编码">
               <el-input v-model="formData.PoNumber" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
@@ -418,29 +432,29 @@
     </el-card>
 
 
-    <el-dialog
-      title="下发工单"
-      :visible.sync="issueVisible"
-      width="50%">
-      <div style="width: 100%;display: flex;justify-content: center;height: ;">
-        <el-form :inline="true" ref="issueFrom" :model="issueFrom" class="demo-form-inline " :rules="issueRules">
+<!--    <el-dialog-->
+<!--      title="下发工单"-->
+<!--      :visible.sync="issueVisible"-->
+<!--      width="50%">-->
+<!--      <div style="width: 100%;display: flex;justify-content: center;">-->
+<!--        <el-form :inline="true" ref="issueFrom" :model="issueFrom" class="demo-form-inline " :rules="issueRules">-->
 
-          <el-form-item label="选择部门" prop="region">
-            <!-- @change="orgChange" -->
-            <el-select filterable ref="issueFromSelect" v-model="issueFrom.region" class="select_form"
-                       placeholder="请选择下发单位" style="width: 100%;">
-              <el-option v-for="item in orgOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"
-                         style="width: 100%;"></el-option>
-            </el-select>
-          </el-form-item>
-        </el-form>
-      </div>
+<!--          <el-form-item label="选择部门" prop="region">-->
+<!--            &lt;!&ndash; @change="orgChange" &ndash;&gt;-->
+<!--            <el-select filterable ref="issueFromSelect" v-model="issueFrom.region" class="select_form"-->
+<!--                       placeholder="请选择下发单位" style="width: 100%;">-->
+<!--              <el-option v-for="item in orgOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"-->
+<!--                         style="width: 100%;"></el-option>-->
+<!--            </el-select>-->
+<!--          </el-form-item>-->
+<!--        </el-form>-->
+<!--      </div>-->
 
-      <span slot="footer" class="dialog-footer">
-          <el-button @click="issueVisible = false" size="small">取 消</el-button>
-          <el-button type="primary" @click="onIssueFromSubmit" size="small">确 定</el-button>
-        </span>
-    </el-dialog>
+<!--      <span slot="footer" class="dialog-footer">-->
+<!--          <el-button @click="issueVisible = false" size="small">取 消</el-button>-->
+<!--          <el-button type="primary" @click="onIssueFromSubmit" size="small">确 定</el-button>-->
+<!--        </span>-->
+<!--    </el-dialog>-->
 
 
   </div>
@@ -690,6 +704,8 @@ export default {
         QualityOwner: '',
         QualityTelphone: '',
         Remark: '',
+        IsYear: 0,
+        IsYearMoney: '',
         // IsDelete: '',
         // CreateOn: '',
         // CreateUserId: '',
@@ -896,11 +912,18 @@ export default {
       this.$refs['EntityForm'].validate((valid) => {
         if (valid) {
           //this.formData.WellNo = this.$refs.selectWellNo.selectedLabel + '';
-
-          if (!this.formData.Id) {
-            this.addEntity();
+          if (this.formData.IsYear === 1 && (this.formData.IsYearMoney === '' || this.formData.IsYearMoney === undefined)) {
+            this.$message({
+              type: 'warning',
+              message: "请填写当年结算金额"
+            })
+            return false
           } else {
-            this.updateEntity();
+            if (!this.formData.Id) {
+              this.addEntity();
+            } else {
+              this.updateEntity();
+            }
           }
 
         } else {

+ 237 - 100
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -16,6 +16,7 @@
             <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;">添加</el-button>
           </router-link>
           <el-button type="primary" size="mini" @click="importExcel" style="margin-left:10px; margin-top: -4px;">导入</el-button>
+          <el-button type="primary" size="mini" @click="importExcelSelect" style="margin-left:10px; margin-top: -4px;">待确认列表</el-button>
           <!-- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;">分发给二级单位评价</el-button> -->
         </span>
         <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
@@ -282,36 +283,36 @@
             :border="true"
             height="500"
             size="small"
-            style="width: 100%" v-loading="dialogLoading">
+            style="width: 100%" v-loading="tableSelectLoading">
            <el-table-column type="index"  min-width="70" label="序号" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="SourceSupplierName"  min-width="110" label="企业名称" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="SupplierName"  width="250" label="确认企业名称" align="center" show-overflow-tooltip >
+          <el-table-column  prop="Class"  min-width="110" label="合同类别" align="center" show-overflow-tooltip></el-table-column>
+          <el-table-column  prop="ContractClass"  min-width="140" label="选择类别" align="center" show-overflow-tooltip >
+            <template slot-scope="scope">
+              <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.ContractClass'" :rules="rules.ContractClass">
+                <el-select size="mini" v-model="scope.row.ContractClass" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.ContractClass,scope.row.Class,'ContractClass',scope.row.Id)">
+                  <el-option label="供应商" value="01" key="01"></el-option>
+                  <el-option label="承包商" value="02" key="02"></el-option>
+                  <el-option label="服务商" value="03" key="03"></el-option>
+                </el-select>
+              </el-form-item>
+              <el-button size="mini" type="primary" @click="allUpdate(scope.row.ContractClass,scope.row.Class,'ContractClass')">全部修改</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column  prop="ImportSupplierName"  min-width="250" label="企业名称" align="center" show-overflow-tooltip></el-table-column>
+          <el-table-column  prop="SupplierName"  width="220" label="确认企业名称" align="center" show-overflow-tooltip >
              <template slot-scope="scope">
                <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SupplierId'" :rules="rules.name">
-                 <el-select size="small" v-model="scope.row.SupplierId" filterable :ref="'supplierIdSelect'+scope.$index" placeholder="请选择" @change="onSelectContractClass(scope.$index)">
-                    <el-option v-for="(item,index) of (SupplierNameDataFun(scope.row.SourceSupplierName,scope.$index))" :key="index" :label="item.SupplierName" :value="item.Id"></el-option>
+                 <el-select size="mini" v-model="scope.row.SupplierId" filterable :ref="'supplierIdSelect'+scope.$index" placeholder="请选择" :disabled="nameDisabled(scope.row.ContractClass)" @change="allUpdate(scope.row.SupplierId,scope.row.ImportSupplierName,'SupplierId',scope.row.Id)">
+                    <el-option v-for="(item,index) of (SupplierNameDataFun(scope.row.ImportSupplierName,scope.$index, scope.row.ContractClass))" :key="index" :label="item.SupplierName" :value="item.Id"></el-option>
                  </el-select>
                </el-form-item>
-             </template>
-           </el-table-column>
-           <el-table-column  prop="SourceContractClass"  min-width="110" label="合同类别" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="ContractClass"  min-width="120" label="选择合同类别" align="center" show-overflow-tooltip >
-             <template slot="header" slot-scope="scope">选择合同类别&nbsp;&nbsp;<i @click="batchSetConClass" class="el-icon-arrow-down" style="cursor: pointer;"></i> </template>
-             <template slot-scope="scope">
-                <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.ContractClass'" :rules="rules.ContractClass">
-                  <el-select size="small" v-model="scope.row.ContractClass" placeholder="请选择" style="width: 100%" >
-                    <el-option label="供应商" value="01" key="01"></el-option>
-                    <el-option label="承包商" value="02" key="02"></el-option>
-                    <el-option label="服务商" value="03" key="03"></el-option>
-                  </el-select>
-                </el-form-item>
+               <el-button size="mini" type="primary" @click="allUpdate(scope.row.SupplierId,scope.row.ImportSupplierName,'SupplierId')">全部修改</el-button>
              </template>
            </el-table-column>
           <el-table-column  prop="Status"  min-width="120" label="选择合同状态" align="center" show-overflow-tooltip >
-            <template slot="header" slot-scope="scope">选择合同状态&nbsp;&nbsp;<i @click="batchSetStatus" class="el-icon-arrow-down" style="cursor: pointer;"></i> </template>
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.Status'" :rules="rules.Status">
-                <el-select size="small" v-model="scope.row.Status" placeholder="请选择" style="width: 100%" >
+                <el-select size="mini" v-model="scope.row.Status" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.Status,'','Status',scope.row.Id)">
                   <el-option label="未履行" :value="1" key="01"></el-option>
                   <el-option label="履行中" :value="2" key="02"></el-option>
                   <el-option label="已完结" :value="3" key="03"></el-option>
@@ -320,34 +321,38 @@
             </template>
           </el-table-column>
           <el-table-column  prop="SettleStatus"  min-width="110" label="结算状态" align="center" show-overflow-tooltip >
-            <template slot="header" slot-scope="scope">结算状态&nbsp;&nbsp;<i @click="batchSetSettleStatus" class="el-icon-arrow-down" style="cursor: pointer;"></i> </template>
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SettleStatus'" :rules="rules.SettleStatus">
-                <el-select size="small" v-model="scope.row.SettleStatus" placeholder="请选择" style="width: 100%" >
+                <el-select size="mini" v-model="scope.row.SettleStatus" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.SettleStatus,'','SettleStatus',scope.row.Id)">
                   <el-option label="未结算" value="1" key="01"></el-option>
                   <el-option label="阶段性结算" value="2" key="02"></el-option>
                 </el-select>
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column  prop="SecondUnit"  min-width="110" label="二级单位" align="center" show-overflow-tooltip>
-            <template slot="header" slot-scope="scope">二级单位&nbsp;&nbsp;<i @click="batchSetSecUnit" class="el-icon-arrow-down" style="cursor: pointer;"></i> </template>
+          <el-table-column  prop="ImportSecondUnit"  min-width="150" label="二级单位" align="center" show-overflow-tooltip></el-table-column>
+          <el-table-column  prop="SecondUnit"  min-width="150" label="二级单位" align="center" show-overflow-tooltip>
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SecondUnit'" :rules="rules.SecondUnit">
-                <el-select filterable size="small" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%">
+                <el-select filterable size="mini" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%">
                   <el-option v-for="item in secondUnitOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"
                              style="width: 100%">
                   </el-option>
                 </el-select>
               </el-form-item>
+              <el-button size="mini" type="primary" @click="allUpdate(scope.row.SecondUnit,scope.row.ImportSecondUnit,'SecondUnit')">全部修改</el-button>
             </template>
           </el-table-column>
            <el-table-column  prop="ContractNo"  min-width="110" label="合同编号" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractName"  min-width="110" label="合同名称" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractSonClass"  min-width="110" label="合同子类" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="SmallClass"  min-width="110" label="相应小类" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="SignedDate"  min-width="110" label="签订日期" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="People"  min-width="110" label="相对人" align="center" show-overflow-tooltip></el-table-column>
+           <el-table-column  prop="SignedDate"  min-width="110" label="签订日期" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               {{ jstimehandle(scope.row.SignedDate+'') }}
+             </template>
+           </el-table-column>
+<!--           <el-table-column  prop="People"  min-width="110" label="相对人" align="center" show-overflow-tooltip></el-table-column>-->
            <el-table-column  prop="Number"  min-width="110" label="报审序号" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ChooseWay"  min-width="110" label="选商方式" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="Amount"  min-width="110" label="标的金额" align="center" show-overflow-tooltip></el-table-column>
@@ -355,10 +360,35 @@
            <el-table-column  prop="ContractMark"  min-width="110" label="合同标的" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="Currency"  min-width="110" label="币种" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="DisputeResolution"  min-width="110" label="纠纷解决方式" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="EndDate"  min-width="110" label="截止时间(履行期限)" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="IsDeal"  min-width="110" label="是否关联交易" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="IsForeign"  min-width="110" label="是否涉外合同" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="IsInternal"  min-width="110" label="是否内部合同" align="center" show-overflow-tooltip></el-table-column>
+           <el-table-column  prop="EndDate"  min-width="110" label="截止时间(履行期限)" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               {{ jstimehandle(scope.row.EndDate+'') }}
+             </template>
+           </el-table-column>
+           <el-table-column  prop="IsDeal"  min-width="110" label="是否关联交易" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               <el-select placeholder="请选择" v-model="scope.row.IsDeal" style="width: 100%" size="mini">
+                 <el-option :key="1" label="是" :value="1"></el-option>
+                 <el-option :key="0" label="否" :value="0"></el-option>
+               </el-select>
+             </template>
+           </el-table-column>
+           <el-table-column  prop="IsForeign"  min-width="110" label="是否涉外合同" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               <el-select placeholder="请选择" v-model="scope.row.IsForeign" style="width: 100%" size="mini">
+                 <el-option :key="1" label="是" :value="1"></el-option>
+                 <el-option :key="0" label="否" :value="0"></el-option>
+               </el-select>
+             </template>
+           </el-table-column>
+           <el-table-column  prop="IsInternal"  min-width="110" label="是否内部合同" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               <el-select placeholder="请选择" v-model="scope.row.IsInternal" style="width: 100%" size="mini">
+                 <el-option :key="1" label="是" :value="1"></el-option>
+                 <el-option :key="0" label="否" :value="0"></el-option>
+               </el-select>
+             </template>
+           </el-table-column>
            <el-table-column  prop="MoneyChannel"  min-width="110" label="资金渠道" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="MoneyChannelSmall"  min-width="110" label="资金渠道小类" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="MoneyChannelSon"  min-width="110" label="资金渠道子类" align="center" show-overflow-tooltip></el-table-column>
@@ -370,14 +400,25 @@
            <el-table-column  prop="Remark"  min-width="110" label="备注" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="SealName"  min-width="110" label="用章名称" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="SingUnit"  min-width="110" label="签约单位" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="StartDate"  min-width="110" label="开始时间" align="center" show-overflow-tooltip></el-table-column>
-           <el-table-column  prop="SubmitDate"  min-width="110" label="提交日期" align="center" show-overflow-tooltip></el-table-column>
+           <el-table-column  prop="StartDate"  min-width="110" label="开始时间" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               {{ jstimehandle(scope.row.StartDate+'') }}
+             </template>
+           </el-table-column>
+           <el-table-column  prop="SubmitDate"  min-width="110" label="提交日期" align="center" show-overflow-tooltip>
+             <template slot-scope="scope">
+               {{ jstimehandle(scope.row.SubmitDate+'') }}
+             </template>
+           </el-table-column>
 
           </el-table>
+        <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1" :current-page="currentPage1"
+                       :page-sizes="[10, 20, 50, 100, 200, 500]" :page-size="size1" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount1">
+        </el-pagination>
         </el-form>
 
       <div style="display: flex;justify-content: flex-end;margin-top: 16px;">
-        <el-button type="primary" :loading="uploadTrueClickLoading" size="small" @click="uploadTrueClick">确 认</el-button>
+        <el-button type="primary" :loading="uploadTrueClickLoading" size="mini" @click="uploadTrueClick">确 认</el-button>
       </div>
     </el-dialog>
 
@@ -388,7 +429,7 @@
           <el-col :span="24">
             <el-upload :limit="1" style="margin-top: 10px;" action="" ref="refuploadattach"
                        :http-request="uploadrequest" :before-remove="beforeRemove" :before-upload="beforeAvatarUpload">
-              <el-button size="small" type="primary">点击上传</el-button>
+              <el-button size="mini" type="primary">点击上传</el-button>
             </el-upload>
           </el-col>
           <el-col :span="24">
@@ -469,18 +510,48 @@
         }
       },
       SupplierNameDataFun: function () {
-        return function (name, k) {
-          var list = this.SupplierNameData.filter(function (x, index) {
-            return x.SupplierName.indexOf(name) != -1
-          })
-          if (list.length == 1) {
-            this.tableDataList.tableData[k].SupplierName = list[0].SupplierName
-            this.tableDataList.tableData[k].SupplierId = list[0].Id
+        return function (name, k, ContractClass) {
+          if (ContractClass === '01') {
+            var list = this.SupplierNameData1.filter(function (x, index) {
+              return x.SupplierName.indexOf(name) != -1
+            })
+            if (list.length == 1) {
+              this.tableDataList.tableData[k].SupplierName = list[0].SupplierName
+              this.tableDataList.tableData[k].SupplierId = list[0].Id
+            }
+            if (list.length == 0) {
+              return this.SupplierNameData1
+            } else {
+              return list
+            }
           }
-          if (list.length == 0) {
-            return this.SupplierNameData
-          } else {
-            return list
+          if (ContractClass === '02') {
+            var list = this.SupplierNameData2.filter(function (x, index) {
+              return x.SupplierName.indexOf(name) != -1
+            })
+            if (list.length == 1) {
+              this.tableDataList.tableData[k].SupplierName = list[0].SupplierName
+              this.tableDataList.tableData[k].SupplierId = list[0].Id
+            }
+            if (list.length == 0) {
+              return this.SupplierNameData2
+            } else {
+              return list
+            }
+          }
+          if (ContractClass === '03') {
+            var list = this.SupplierNameData3.filter(function (x, index) {
+              return x.SupplierName.indexOf(name) != -1
+            })
+            if (list.length == 1) {
+              this.tableDataList.tableData[k].SupplierName = list[0].SupplierName
+              this.tableDataList.tableData[k].SupplierId = list[0].Id
+            }
+            if (list.length == 0) {
+              return this.SupplierNameData3
+            } else {
+              return list
+            }
           }
         }
       }
@@ -505,8 +576,11 @@
         ContractSelectName: '',
         options: [],
         secondUnitOptions: [],
-        SupplierNameData: [],
+        SupplierNameData1: [],
+        SupplierNameData2: [],
+        SupplierNameData3: [],
         dialogVisibleContract: false,
+        tableSelectLoading: false,
         uploadshow: false,
         Excelurl: '',
         importDialogVisible: false,
@@ -524,6 +598,9 @@
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
+        size1: 10,
+        currentPage1: 1,
+        currentItemCount1: 0,
         // 列表排序
         Column: {
           Order: '',
@@ -848,7 +925,9 @@
       // 状态判断
       this.statusFun()
 
-      this.contractSelete()
+      this.contractSelete('01')
+      this.contractSelete('02')
+      this.contractSelete('03')
       this.GetSecondUnitOptions()
     },
     methods: {
@@ -867,52 +946,65 @@
         }, 200)
         console.log(that.tableDataList.tableData)
       },
-      contractSelete () {
-        oilsupplierApi.getSupListCode(this.$axios).then(res => {
+      nameDisabled (value) {
+        if (value != '') {
+          return false
+        } else {
+          return true
+        }
+      },
+      contractSelete (value) {
+        oilsupplierApi.getSupList(value, this.$axios).then(res => {
           console.log('企业名称数据', res)
-          this.SupplierNameData = res.data.items
+          if (value === '01') {
+            this.SupplierNameData1 = res.data.items
+          }
+          if (value === '02') {
+            this.SupplierNameData2 = res.data.items
+          }
+          if (value === '03') {
+            this.SupplierNameData3 = res.data.items
+          }
         }).catch(err => {
           console.error(err)
         })
       },
       uploadTrueClick () {
-        this.$refs['ruleForm'].validate((valid) => {
-          if (valid) {
-            this.uploadTrueClickLoading = true
-            this.tableDataList.tableData.map((item, index) => {
-              this.tableDataList.tableData[index].IsDeal = this.tableDataList.tableData[index].IsDeal === '是' ? 1 : 0
-              this.tableDataList.tableData[index].IsForeign = this.tableDataList.tableData[index].IsForeign === '是' ? 1 : 0
-              this.tableDataList.tableData[index].IsInternal = this.tableDataList.tableData[index].IsInternal === '是' ? 1 : 0
-              this.tableDataList.tableData[index].EndDate = this.tableDataList.tableData[index].EndDate != '' && this.tableDataList.tableData[index].EndDate != undefined ? new Date(this.tableDataList.tableData[index].EndDate) : ''
-              this.tableDataList.tableData[index].SignedDate = this.tableDataList.tableData[index].SignedDate != '' && this.tableDataList.tableData[index].SignedDate != undefined ? new Date(this.tableDataList.tableData[index].SignedDate) : ''
-              this.tableDataList.tableData[index].SubmitDate = this.tableDataList.tableData[index].SubmitDate != '' && this.tableDataList.tableData[index].SubmitDate != undefined ? new Date(this.tableDataList.tableData[index].SubmitDate) : ''
-              this.tableDataList.tableData[index].StartDate = this.tableDataList.tableData[index].StartDate != '' && this.tableDataList.tableData[index].StartDate != undefined ? new Date(this.tableDataList.tableData[index].StartDate) : ''
-            })
-            var data = {
-              Items: this.tableDataList.tableData
-            }
-            data = JSON.parse(JSON.stringify(data))
-            api.saveImportExcel(data, this.$axios).then(res => {
-              if (res.data.code == 0) {
-                this.dialogVisibleContract = false
-                this.$message({type: 'success', message: String(res.data.message)})
-                this.clearSearch()
-              } else {
-                this.$message({type: 'error', message: String(res.data.message)})
-              }
-              this.uploadTrueClickLoading = false
-            }).catch(err => {
-              console.log(err)
-              this.uploadTrueClickLoading = false
-              this.$message({type: 'warning', message: '导入失败'})
-            })
+        api.saveImportExcel(this.$axios).then(res => {
+          if (res.data.code == 0) {
+            this.dialogVisibleContract = false
+            this.$message({type: 'success', message: String(res.data.message)})
+            this.clearSearch()
           } else {
-            this.$message({type: 'warning', message: '请填写完整才能导入'})
+            this.$message({type: 'error', message: String(res.data.message)})
           }
+          this.uploadTrueClickLoading = false
+        }).catch(err => {
+          console.log(err)
+          this.uploadTrueClickLoading = false
+          this.$message({type: 'warning', message: '导入失败'})
         })
 
         // this.dialogVisibleContract = false
       },
+      allUpdate (value, whereValue, column, id) {
+        let params = {
+          Class: whereValue,
+          Value: value,
+          Column: column,
+          Id: id
+        }
+        if (column === 'ContractClass') {
+          this.contractSelete(value)
+        }
+        api.importUpdate(params, this.$axios).then(res => {
+          this.$message({
+            type: 'success',
+            message: res.data.message
+          })
+          this.initDatas1()
+        })
+      },
       // 导入
       uploadExcel () {
         this.tableDataList.tableData = []
@@ -924,23 +1016,24 @@
         }
         api.importExcel(params, this.$axios).then(res => {
           this.importloading = false
-          if (res.data.code === 0) {
-            this.dialogVisibleContract = true
-            for (var key in res.data.item) {
-              console.log(key, res.data.item[key])
-              res.data.item[key].ContractClass = res.data.item[key].SourceContractClass == '承揽合同' ? '02' : res.data.item[key].ContractClass
-              res.data.item[key].SupplierId = res.data.item[key].SupplierId == '' ? '' : res.data.item[key].SupplierId
-              this.tableDataList.tableData.push(res.data.item[key])
-            }
-          } else if (res.data.code === -1) {
-            this.errorDialogVisible = true
-            this.textarea = res.data.message
-          } else if (res.data.code === -2) {
-            this.$message({
-              type: 'warning',
-              message: res.data.message
-            })
-          }
+          // if (res.data.code === 0) {
+          //   this.dialogVisibleContract = true
+          //   for (var key in res.data.item) {
+          //     // console.log(key, res.data.item[key])
+          //     res.data.item[key].ContractClass = res.data.item[key].SourceContractClass == '承揽合同' ? '02' : res.data.item[key].ContractClass
+          //     res.data.item[key].SupplierId = res.data.item[key].SupplierId == '' ? '' : res.data.item[key].SupplierId
+          //     this.tableDataList.tableData.push(res.data.item[key])
+          //   }
+          // } else if (res.data.code === -1) {
+          //   this.errorDialogVisible = true
+          //   this.textarea = res.data.message
+          // } else if (res.data.code === -2) {
+          //
+          // }
+          this.$message({
+            type: 'success',
+            message: res.data.message
+          })
         })
       },
       batchSetConClass () {
@@ -1075,7 +1168,38 @@
           console.error(err)
         })
       },
-
+      initDatas1 () {
+        this.tableSelectLoading = true// 表格loading
+        // 分页及列表条件
+        let params = {
+          _currentPage: this.currentPage1,
+          _size: this.size1,
+          Order: 'asc',
+          Prop: 'Id',
+          ImportStatus: 0
+        }
+        let myCreateOn = []
+        // 解析时间
+        if (this.CreateOn.length == 2) {
+          this.CreateOn[1].setHours(23)
+          this.CreateOn[1].setMinutes(59)
+          this.CreateOn[1].setSeconds(59)
+          myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
+          myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
+        }
+        // 查询条件
+        Object.assign(params, this.searchForm)
+        // 访问接口
+        api.getList(myCreateOn.join(','), params, this.$axios).then(res => {
+          this.tableSelectLoading = false// 表格loading
+          console.log('列表数据', res.data)
+          this.tableDataList.tableData = res.data.items
+          this.currentItemCount1 = res.data.currentItemCount
+        }).catch(err => {
+          this.tableLoading = false// 表格loading
+          console.error(err)
+        })
+      },
       getDictOptions () {
         api.getDictList(this.$axios).then(res => {
           // this.dictOptions.customerList = res.data.items['customerList']
@@ -1123,6 +1247,15 @@
         this.currentPage = 1
         this.initDatas()
       },
+      handleCurrentChange1 (value) {
+        this.currentPage1 = value
+        this.initDatas1()
+      },
+      handleSizeChange1 (value) {
+        this.size1 = value
+        this.currentPage1 = 1
+        this.initDatas1()
+      },
       deleteEntity (row, index) {
         this.$refs['popover-' + `${index}`].doClose()
         api.deleteEntity(row.Id, this.$axios).then(res => {
@@ -1171,6 +1304,10 @@
       importExcel () {
         this.uploadshow = true
       },
+      importExcelSelect () {
+        this.dialogVisibleContract = true
+        this.initDatas1()
+      },
       beforeRemove () {
         this.Excelurl = ''
         return true