2
3
Просмотр исходного кода

企业用户只可查看自己企业信息

huahaiyan 6 лет назад
Родитель
Сommit
b3ed4f573c

+ 15 - 2
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -3,6 +3,7 @@ package oilsupplier
 import (
 	"dashoo.cn/backend/api/business/audithistory"
 	"dashoo.cn/backend/api/business/baseUser"
+	"dashoo.cn/backend/api/business/oilsupplier/infochange"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
 	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/paymentinfo"
@@ -203,9 +204,21 @@ func (this *AnnualAuditController) GetMyTaskEntityList() {
 // @Success 200 {object} annualaudit.OilAnnualAudit
 // @router /supplierlist [get]
 func (this *AnnualAuditController) GetSupplierList() {
-	svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
+	svc := infochange.GetInfoChangeService(utils.DBE)
 	var supplierlist []annualaudit.Suppliername
-	supplierlist = svc.GetSupplierList(""+OilSupplierName, ""+OilAnnualAuditName)
+	where := "1=1"
+	//企业用户必须加创建人条件
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and CreateUserId = '" + this.User.Id + "'"
+	} else {
+		//超级管理员和有查看所有数据权限的用户不加条件
+		svcPerm := permission.GetPermissionService(utils.DBE)
+		isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
+		if !svcPerm.IsAdmin(this.User.Id) && !isauth {
+			where = where + " and CreateUserId = '" + this.User.Id + "'"
+		}
+	}
+	supplierlist = svc.GetSupplierList(""+OilSupplierName, where)
 	var datainfo DataInfo
 	datainfo.Items = supplierlist
 	this.Data["json"] = &datainfo

+ 4 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -275,7 +275,10 @@ func (this *SelectController) GetProcessAuditList() {
 	tabinx := this.GetString("tabinx")
 	supplierTypeCode := this.GetString("SupplierTypeCode")
 	supplierName := this.GetString("SupplierName")
-
+	//企业用户必须加创建人条件
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and b.CreateUserId = '" + this.User.Id + "'"
+	}
 	if supplierTypeCode != "" {
 		where = where + " and b.SupplierTypeCode like '%" + supplierTypeCode + "%'"
 	}

+ 4 - 2
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -147,11 +147,13 @@ func (this *OilSupplierCertAppendController) GetEntityById() {
 // @router /getsupplier/:id [get]
 func (this *OilSupplierCertAppendController) GetSupplier() {
 	Id := this.Ctx.Input.Param(":id")
+	where := " WHERE b.Id is NOT NULL AND a.SupplierTypeCode = " + Id + " and a.InFlag='1'"
+	if this.User.IsCompanyUser == 1 {
+		where = where + " and b.CreateUserId = '" + this.User.Id + "'"
+	}
 
 	svc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 	sqlStr := "SELECT b.Id AS SupplierId, a.Id AS SupplierCertId, b.SupplierName AS SupplierName FROM OilSupplierCert AS a LEFT JOIN OilSupplier AS b ON a.SupplierId = b.Id "
-	where := "WHERE b.Id is NOT NULL AND a.SupplierTypeCode = " + Id + " and a.InFlag='1'"
-
 	sqlStr = sqlStr + where
 
 	model, _ := svc.DBE.QueryString(sqlStr)

+ 0 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/infochange/index.vue

@@ -329,7 +329,6 @@
         //访问接口
         api.getSuppList(myCreateOn.join(','), params, this.$axios).then(res => {
           this.entityList = res.data.items
-          console.log("-------this.entityList-------",this.entityList)
           this.currentItemCount = res.data.currentItemCount
         }).catch(err => {
           console.error(err)
@@ -337,7 +336,6 @@
       },
       getselectsupplier() {
         api.getAddSupList(this.$axios).then(res => {
-          console.log("-------res",res.data)
           if (res.data.items.length != 0) {
             for (var i = 0; i < res.data.items.length; i++) {
               this.selectsupplierlist.push({
@@ -356,11 +354,9 @@
       addInfoChange() {
         this.$refs['EntityFormref'].validate((valid) => {
           if (valid) {
-            console.log("---this.entityForm--",this.entityForm)
             this.entityForm.SupplierId = this.entityForm.SupplierId + ""
             api.addInfoChMain(this.entityForm, this.$axios).then(res => {
               if (res.data.code === 0) {
-                console.log("--------res.data----", res.data)
                 //保存成功后,初始化数据,变成修改
                 this.entityForm.Id = res.data.item;
                 this.initDatas();