Răsfoiți Sursa

前后:合同确认

dubch 4 ani în urmă
părinte
comite
5e04e0151a

+ 12 - 210
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -679,209 +679,6 @@ func (this *OilContractController) ImportBatchSave() {
 		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
-	//	}
-	//
-	//	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])
-	//	}
-	//}
-
-
 }
 
 // @Title get 批量修改字段
@@ -893,21 +690,25 @@ func (this *OilContractController) ImportUpdate() {
 	Value := this.GetString("Value")
 	Column := this.GetString("Column")
 	Id := this.GetString("Id")
+	SupplierId := this.GetString("SupplierId")
+
+	var supp supplier.OilSupplier
+	svc := supplier.GetOilSupplierService(utils.DBE)
+	svc.GetEntityById(SupplierId, &supp)
+	sql := ""
 	var err error
 	where := "1=1"
 	if Column == "ContractClass" {
 		if Id != "" {
 			where += " and Id = " + Id + " and ImportStatus = 0 and Class = '" + Class + "'"
+			sql = "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = '" + Value + "' where " + where
 		} else {
 			where += " and ImportStatus = 0 and Class = '" + Class + "' and " + Column + " = ''"
+			sql = "update OilContract set " + Column + " = '" + Value + "' where " + where
 		}
-		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 {
@@ -920,21 +721,22 @@ func (this *OilContractController) ImportUpdate() {
 	if Column == "SecondUnit" {
 		if Id != "" {
 			where += " and Id = " + Id + " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "'"
+			sql = "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
 		} else {
 			where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "' and " + Column + " = 0"
+			sql = "update OilContract set " + Column + " = " + Value + " where " + where
 		}
-		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
+		sql := "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
 		_, err = utils.DBE.Query(sql)
 	}
 	if Column == "SettleStatus" {
 		where += " and Id = " + Id + " and ImportStatus = 0"
-		sql := "update OilContract set " + Column + " = '" + Value + "' where " + where
+		sql := "update OilContract set SupplierName = '" + supp.SupplierName + "', " + Column + " = '" + Value + "' where " + where
 		_, err = utils.DBE.Query(sql)
 	}
 

+ 12 - 11
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -289,30 +289,30 @@
           <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-select size="mini" v-model="scope.row.ContractClass" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.ContractClass,scope.row.Class,'ContractClass',scope.row.Id, scope.row.SupplierId)">
                   <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>
+              <el-button size="mini" type="primary" @click="allUpdate(scope.row.ContractClass,scope.row.Class,'ContractClass', 0, scope.row.SupplierId)">全部修改</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="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-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, scope.row.SupplierId)">
                     <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>
-               <el-button size="mini" type="primary" @click="allUpdate(scope.row.SupplierId,scope.row.ImportSupplierName,'SupplierId')">全部修改</el-button>
+               <el-button size="mini" type="primary" @click="allUpdate(scope.row.SupplierId,scope.row.ImportSupplierName,'SupplierId', scope.row.SupplierId)">全部修改</el-button>
              </template>
            </el-table-column>
           <el-table-column  prop="Status"  min-width="120" label="选择合同状态" align="center" show-overflow-tooltip >
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.Status'" :rules="rules.Status">
-                <el-select size="mini" v-model="scope.row.Status" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.Status,'','Status',scope.row.Id)">
+                <el-select size="mini" v-model="scope.row.Status" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.Status,'','Status',scope.row.Id, scope.row.SupplierId)">
                   <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>
@@ -323,7 +323,7 @@
           <el-table-column  prop="SettleStatus"  min-width="110" label="结算状态" align="center" show-overflow-tooltip >
             <template slot-scope="scope">
               <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SettleStatus'" :rules="rules.SettleStatus">
-                <el-select size="mini" v-model="scope.row.SettleStatus" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.SettleStatus,'','SettleStatus',scope.row.Id)">
+                <el-select size="mini" v-model="scope.row.SettleStatus" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.SettleStatus,'','SettleStatus',scope.row.Id, scope.row.SupplierId)">
                   <el-option label="未结算" value="1" key="01"></el-option>
                   <el-option label="阶段性结算" value="2" key="02"></el-option>
                 </el-select>
@@ -331,16 +331,16 @@
             </template>
           </el-table-column>
           <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>
+          <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="mini" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%">
+                <el-select filterable size="mini" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%" @change="allUpdate(scope.row.SecondUnit,scope.row.ImportSecondUnit,'SecondUnit', scope.row.Id, scope.row.SupplierId)">
                   <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>
+              <el-button size="mini" type="primary" @click="allUpdate(scope.row.SecondUnit,scope.row.ImportSecondUnit,'SecondUnit',0,scope.row.SupplierId)">全部修改</el-button>
             </template>
           </el-table-column>
            <el-table-column  prop="ContractNo"  min-width="110" label="合同编号" align="center" show-overflow-tooltip></el-table-column>
@@ -987,12 +987,13 @@
 
         // this.dialogVisibleContract = false
       },
-      allUpdate (value, whereValue, column, id) {
+      allUpdate (value, whereValue, column, id, supplierId) {
         let params = {
           Class: whereValue,
           Value: value,
           Column: column,
-          Id: id
+          Id: id,
+          SupplierId: supplierId
         }
         if (column === 'ContractClass') {
           this.contractSelete(value)