浏览代码

前后:对外接口;合同状态判断;合同创建的企业名称

dubch 4 年之前
父节点
当前提交
dd8254c058

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

@@ -68,6 +68,7 @@ func (s *OilContractService) GetSum1(entitiesPtr interface{}, where string) {
 	sql += ` where ` + where
 	sql += ` where ` + where
 
 
 	s.DBE.SQL(sql).Get(entitiesPtr)
 	s.DBE.SQL(sql).Get(entitiesPtr)
+	return
 }
 }
 
 
 func (s *OilContractService) GetList(entitiesPtr interface{}, where string) {
 func (s *OilContractService) GetList(entitiesPtr interface{}, where string) {
@@ -76,4 +77,14 @@ func (s *OilContractService) GetList(entitiesPtr interface{}, where string) {
 	sql += ` where ` + where
 	sql += ` where ` + where
 
 
 	s.DBE.SQL(sql).Find(entitiesPtr)
 	s.DBE.SQL(sql).Find(entitiesPtr)
+	return
+}
+
+func (s *OilContractService) GetJoinBySelect1(where string, entityPtr interface{}) {
+	sql := "select a.Id from OilSupplier a left join OilSupplierCert  b ON a.Id = b.SupplierId "
+	if where != "" {
+		sql = sql + " Where " + where
+	}
+	s.DBE.SQL(sql).Get(entityPtr)
+	return
 }
 }

+ 11 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -291,6 +291,17 @@ type OilSupplierView struct {
 	Remark1           string    `xorm:"VARCHAR(255)"`
 	Remark1           string    `xorm:"VARCHAR(255)"`
 }
 }
 
 
+type CompanyList struct {
+	SupplierName        string    `xorm:"comment('企业名称') VARCHAR(255)"`
+	SupplierTypeCode  string
+	SupplierTypeName  string
+	InFlag            string    `xorm:"default '0' comment('准入标识') VARCHAR(10)"`
+	InStyle           string    `xorm:"default '1' comment('准入方式') VARCHAR(10)"`
+	SupplierStatus    string    `xorm:"comment('供应商状态(null:正常,1中止,2终止)') VARCHAR(255)"`
+	Type              string    `xorm:"comment('供应商类型') VARCHAR(255)"`
+	ApplyTime         time.Time `xorm:"comment('年审日期') DATETIME"`
+}
+
 type OilSupplierView1 struct {
 type OilSupplierView1 struct {
 	OilSupplier1      `xorm:"extends"`
 	OilSupplier1      `xorm:"extends"`
 	CertId            string
 	CertId            string

+ 35 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -65,6 +65,41 @@ func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName
 
 
 	return total
 	return total
 }
 }
+func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl4(supplierTableName, supplierCertTableName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(*) from ` + supplierTableName + ` a `
+	sqlCount += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
+	sqlCount += ` where ` + where
+
+	var sql string
+	sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.InFlag, b.ApplyTime,b.InStyle`
+	sql += ` from ` + supplierTableName + ` a `
+	sql += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
+	sql += ` where ` + where
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if pageIndex != 0 && itemsPerPage != 0 {
+		sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
+	}
+	s.DBE.SQL(sql).Find(entitiesPtr)
+
+	resultsSlice, _ = s.DBE.Query(sqlCount)
+
+	if len(resultsSlice) > 0 {
+		results := resultsSlice[0]
+		for _, value := range results {
+			total, _ = strconv.ParseInt(string(value), 10, 64)
+			break
+		}
+	}
+
+	return total
+}
 func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl2(supplierTableName, supplierCertTableName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string, code string, Ids string) (total int64) {
 func (s *OilSupplierService) GetMyPagingEntitiesWithOrderBytbl2(supplierTableName, supplierCertTableName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string, code string, Ids string) (total int64) {
 	var resultsSlice []map[string][]byte
 	var resultsSlice []map[string][]byte
 
 

+ 29 - 1
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -1126,7 +1126,7 @@ func (this *OilContractController) ImportExcel() {
 			con.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
 			con.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
 			var supp supplier.OilSupplier
 			var supp supplier.OilSupplier
 			//svc.GetEntityByWhere(OilSupplierName, "SupplierName = '"+con.ImportSupplierName+"'", &supp)
 			//svc.GetEntityByWhere(OilSupplierName, "SupplierName = '"+con.ImportSupplierName+"'", &supp)
-			svc.GetJoinBySelect("b.SupplierTypeCode='" + con.ContractClass + "' AND a.SupplierName = '"+con.ImportSupplierName+"'", &supp)
+			svc.GetJoinBySelect1("b.SupplierTypeCode='" + con.ContractClass + "' AND a.SupplierName = '"+con.ImportSupplierName+"'", &supp)
 			if supp.Id > 0 {
 			if supp.Id > 0 {
 				con.SupplierId = supp.Id
 				con.SupplierId = supp.Id
 			}
 			}
@@ -1463,6 +1463,13 @@ func (this *OilContractController) AddEntity() {
 		model.SecondUnitName = org.Fullname
 		model.SecondUnitName = org.Fullname
 	}
 	}
 
 
+	var supp supplier.OilSupplier
+	model.SupplierName = model.ImportSupplierName
+	svc.GetJoinBySelect1("b.SupplierTypeCode='" + model.ContractClass + "' AND a.SupplierName = '"+model.ImportSupplierName+"'", &supp)
+	if supp.Id > 0 {
+		model.SupplierId = supp.Id
+	}
+
 	var model1 contract.OilContractMoney
 	var model1 contract.OilContractMoney
 	var contract contract.OilContract
 	var contract contract.OilContract
 	tempCount, _ := svc.GetCount(&contract, "ContractNo='"+model.ContractNo+"' ")
 	tempCount, _ := svc.GetCount(&contract, "ContractNo='"+model.ContractNo+"' ")
@@ -1671,6 +1678,8 @@ func (this *OilContractController) UpdateEntity() {
 		"IsYear",
 		"IsYear",
 
 
 		"ClassName",
 		"ClassName",
+
+		"ImportSupplierName",
 	}
 	}
 
 
 	var contract contract.OilContract
 	var contract contract.OilContract
@@ -1688,6 +1697,25 @@ func (this *OilContractController) UpdateEntity() {
 		model.YearDate = model.EndDate.AddDate(1, 0, 0)
 		model.YearDate = model.EndDate.AddDate(1, 0, 0)
 	}
 	}
 
 
+	var supp supplier.OilSupplier
+	if model.ImportStatus == 2 {
+		model.SupplierName = model.ImportSupplierName
+		svc.GetJoinBySelect1("b.SupplierTypeCode='" + model.ContractClass + "' AND a.SupplierName = '"+model.ImportSupplierName+"'", &supp)
+		model.SupplierId = supp.Id
+	}
+
+	if model.Status == 3 {
+		var review contractReview.OilContractReview
+		svc.GetEntityByWhere(OilContractReviewName, "Status = 8 and ContractId = '" + strconv.Itoa(model.Id) + "'", &review)
+		if review.Id == 0 {
+			errinfo.Message = "没有已完成评价不能选履行完毕!"
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
+	}
+
 	err := svc.UpdateEntityBytbl(OilContractName, id, &model, cols)
 	err := svc.UpdateEntityBytbl(OilContractName, id, &model, cols)
 	if err == nil {
 	if err == nil {
 		if model.IsYear == 1 && model.IsYearMoney != "" {
 		if model.IsYear == 1 && model.IsYearMoney != "" {

+ 50 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -2882,3 +2882,53 @@ func (this *OilSupplierController) CheckSupplierFileNew() {
 	this.Data["json"] = &errinfo
 	this.Data["json"] = &errinfo
 	this.ServeJSON()
 	this.ServeJSON()
 }
 }
+
+// @Title 对外
+// @Description
+// @Success 200 {object}
+// @router /getCompanyList [post]
+func (this *OilSupplierController) GetCompanyList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " b.InFlag = 1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	SupplierName := this.GetString("SupplierName")
+	SupplierTypeName := this.GetString("SupplierTypeName")
+	SupplierTypeCode := this.GetString("SupplierTypeCode")
+	if SupplierName != "" {
+		where = where + " and a.SupplierName like '%" + SupplierName + "%'"
+	}
+	if SupplierTypeName != "" {
+		where = where + " and b.SupplierTypeName like '%" + SupplierTypeName + "%'"
+	}
+	if SupplierTypeCode != "" {
+		where = where + " and b.SupplierTypeCode ='" + SupplierTypeCode + "'"
+	}
+
+	svc := supplier.GetOilSupplierService(utils.DBE)
+
+	var total int64
+	var list []supplier.CompanyList
+	if this.User.Username == "ceshi2" {
+		total = svc.GetMyPagingEntitiesWithOrderBytbl4(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	}
+
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}

+ 0 - 9
src/dashoo.cn/backend/api/mydb/myServiceBase.go

@@ -822,12 +822,3 @@ func (s *MyServiceBase) DeleteTableBySelect(tableName, tableName2, where string,
 	s.DBE.SQL(sql).Find(entityPtr)
 	s.DBE.SQL(sql).Find(entityPtr)
 	return
 	return
 }
 }
-
-func (s *MyServiceBase) GetJoinBySelect(where string, entityPtr interface{}) {
-	sql := "select a.Id from OilSupplier a left join OilSupplierCert  b ON a.Id = b.SupplierId "
-	if where != "" {
-		sql = sql + " Where " + where
-	}
-	s.DBE.SQL(sql).Find(entityPtr)
-	return
-}

+ 11 - 15
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/_opera/operation.vue

@@ -36,21 +36,17 @@
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="8" v-if="formData.ImportStatus != 2">
           <el-col :span="8" v-if="formData.ImportStatus != 2">
-            <el-form-item label="导入企业名称" prop="SupplierName">
+            <el-form-item label="导入企业名称" prop="ImportSupplierName">
               <el-input v-model="formData.ImportSupplierName" placeholder="请输入" style="width: 100%"></el-input>
               <el-input v-model="formData.ImportSupplierName" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
-          <el-col :span="8" v-if="formData.ImportStatus != 2">
-            <el-form-item label="确认企业名称">
-              <el-select :disabled="ContractClassDisabled" filterable ref="SupplierSelect" v-model="formData.SupplierId"
-                         placeholder="请选择" style="width: 100%" @change="supplierChangeHandler">
-                <el-option :label="item.SupplierName" :value="item.Id" v-for="(item,index) of SupplierSelectList"
-                           :key="index"></el-option>
-              </el-select>
+          <el-col :span="8" v-else>
+            <el-form-item label="企业名称" prop="ImportSupplierName">
+              <el-input v-model="formData.ImportSupplierName" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
-          <el-col :span="8" v-else>
-            <el-form-item label="确认企业名称" prop="SupplierId">
+          <el-col :span="8" v-if="formData.ImportStatus != 2">
+            <el-form-item label="确认企业名称">
               <el-select :disabled="ContractClassDisabled" filterable ref="SupplierSelect" v-model="formData.SupplierId"
               <el-select :disabled="ContractClassDisabled" filterable ref="SupplierSelect" v-model="formData.SupplierId"
                          placeholder="请选择" style="width: 100%" @change="supplierChangeHandler">
                          placeholder="请选择" style="width: 100%" @change="supplierChangeHandler">
                 <el-option :label="item.SupplierName" :value="item.Id" v-for="(item,index) of SupplierSelectList"
                 <el-option :label="item.SupplierName" :value="item.Id" v-for="(item,index) of SupplierSelectList"
@@ -126,7 +122,7 @@
               <el-select v-model="formData.Status" placeholder="请选择" style="width: 100%">
               <el-select v-model="formData.Status" placeholder="请选择" style="width: 100%">
                 <el-option label="未履行" :value="1" key="01"></el-option>
                 <el-option label="未履行" :value="1" key="01"></el-option>
                 <el-option label="履行中" :value="2" key="02"></el-option>
                 <el-option label="履行中" :value="2" key="02"></el-option>
-                <el-option label="已完结" :value="3" key="03"></el-option>
+                <el-option label="履行完毕" :value="3" key="03"></el-option>
               </el-select>
               </el-select>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -456,7 +452,7 @@
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="8">
           <el-col :span="8">
-            <el-form-item label="跨年时间" prop="Year">
+            <el-form-item label="年份" prop="Year">
               <el-date-picker
               <el-date-picker
                 v-model="formData.Year"
                 v-model="formData.Year"
                 type="year"
                 type="year"
@@ -629,7 +625,7 @@ export default {
         SupplierId: [
         SupplierId: [
           {required: true, message: '请选择企业名称', trigger: 'change'}
           {required: true, message: '请选择企业名称', trigger: 'change'}
         ],
         ],
-        SupplierName: [
+        ImportSupplierName: [
           {required: true, message: '请输入企业名称', trigger: 'blur'}
           {required: true, message: '请输入企业名称', trigger: 'blur'}
         ],
         ],
         ProjectName: [
         ProjectName: [
@@ -883,7 +879,7 @@ export default {
       this.initDatas()
       this.initDatas()
       this.successBoolean = true
       this.successBoolean = true
     } else {
     } else {
-      this.formData.Year = myDate.getFullYear() + ''
+      this.formData.Year = (myDate.getFullYear() - 1) + ''
       this.formData.Id = 0
       this.formData.Id = 0
     }
     }
     this.statusFun()
     this.statusFun()
@@ -1018,7 +1014,7 @@ export default {
           console.log('返给我的数据', res.data)
           console.log('返给我的数据', res.data)
           this.formData = res.data
           this.formData = res.data
           let myDate = new Date()
           let myDate = new Date()
-          this.formData.Year = myDate.getFullYear() + ''
+          this.formData.Year = (myDate.getFullYear() - 1) + ''
           if (this.formData.SupplierId == 0) {
           if (this.formData.SupplierId == 0) {
             this.formData.SupplierId = ''
             this.formData.SupplierId = ''
           }
           }

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

@@ -29,7 +29,7 @@
               <el-option label="全部" value="" key="01"></el-option>
               <el-option label="全部" value="" key="01"></el-option>
               <el-option label="未履行" :value="1" key="02"></el-option>
               <el-option label="未履行" :value="1" key="02"></el-option>
               <el-option label="履行中" :value="2" key="03"></el-option>
               <el-option label="履行中" :value="2" key="03"></el-option>
-              <el-option label="已完结" :value="3" key="04"></el-option>
+              <el-option label="履行完毕" :value="3" key="04"></el-option>
             </el-select>
             </el-select>
           </el-form-item>
           </el-form-item>
 <!--          <el-form-item label="结算状态" style="width: 180px">-->
 <!--          <el-form-item label="结算状态" style="width: 180px">-->
@@ -87,7 +87,7 @@
               </div>
               </div>
               <el-button slot="reference" type="text" :disabled="!deleteBoolean" style="margin-left:3px" icon="el-icon-delete" size="small" >删除</el-button>
               <el-button slot="reference" type="text" :disabled="!deleteBoolean" style="margin-left:3px" icon="el-icon-delete" size="small" >删除</el-button>
             </el-popover>
             </el-popover>
-            <el-button type="text" size="small" :disabled="!evaluateBoolean || scope.row.Status === 3" style="margin-left:3px"  icon="el-icon-edit-outline  " @click="onNavigateEvaluate(scope.row)">创建评价</el-button>
+            <el-button type="text" size="small" :disabled="!evaluateBoolean || scope.row.Status === 1" style="margin-left:3px"  icon="el-icon-edit-outline  " @click="onNavigateEvaluate(scope.row)">创建评价</el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         <el-table-column v-for="column in tableColumns" :key="column.Id"
         <el-table-column v-for="column in tableColumns" :key="column.Id"
@@ -157,7 +157,7 @@
                 <el-option label="全部" value="" key="01"></el-option>
                 <el-option label="全部" value="" key="01"></el-option>
                 <el-option label="未履行" :value="1" key="02"></el-option>
                 <el-option label="未履行" :value="1" key="02"></el-option>
                 <el-option label="履行中" :value="2" key="03"></el-option>
                 <el-option label="履行中" :value="2" key="03"></el-option>
-                <el-option label="已完结" :value="3" key="04"></el-option>
+                <el-option label="履行完毕" :value="3" key="04"></el-option>
               </el-select>
               </el-select>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -336,7 +336,7 @@
                   <el-select size="mini" v-model="searchForm.Status" placeholder="请选择履行状态" style="width: 100%" clearable>
                   <el-select size="mini" v-model="searchForm.Status" placeholder="请选择履行状态" style="width: 100%" clearable>
                     <el-option label="未履行" :value="1" key="02"></el-option>
                     <el-option label="未履行" :value="1" key="02"></el-option>
                     <el-option label="履行中" :value="2" key="03"></el-option>
                     <el-option label="履行中" :value="2" key="03"></el-option>
-                    <el-option label="已完结" :value="3" key="04"></el-option>
+                    <el-option label="履行完毕" :value="3" key="04"></el-option>
                   </el-select>
                   </el-select>
                 </el-form-item>
                 </el-form-item>
         <!--        <el-form-item label="结算状态" style="width: 180px">-->
         <!--        <el-form-item label="结算状态" style="width: 180px">-->
@@ -458,7 +458,7 @@
                 <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-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="1" key="01"></el-option>
                   <el-option label="履行中" :value="2" key="02"></el-option>
                   <el-option label="履行中" :value="2" key="02"></el-option>
-                  <el-option label="已完结" :value="3" key="03"></el-option>
+                  <el-option label="履行完毕" :value="3" key="03"></el-option>
                 </el-select>
                 </el-select>
               </el-form-item>
               </el-form-item>
             </template>
             </template>
@@ -576,7 +576,7 @@
                 return '履行中'
                 return '履行中'
                 break
                 break
               case 3:
               case 3:
-                return '已完结'
+                return '履行完毕'
                 break
                 break
               default:
               default:
                 return '--'
                 return '--'