Selaa lähdekoodia

分类与部门间关系配置

yuedefeng 6 vuotta sitten
vanhempi
commit
ab54f2ce18

+ 0 - 23
src/dashoo.cn/backend/api/business/oilsupplier/auditsetting/oilauditsettingService.go

@@ -1,23 +0,0 @@
-package auditsetting
-
-import (
-	. "dashoo.cn/backend/api/mydb"
-	"github.com/go-xorm/xorm"
-)
-
-type OilAuditSettingService struct {
-	MyServiceBase
-}
-
-func GetOilAuditSettingService(xormEngine *xorm.Engine) *OilAuditSettingService {
-	s := new(OilAuditSettingService)
-	s.DBE = xormEngine
-	return s
-}
-
-func (s *OilAuditSettingService) GetAuditStepRoleEntity(tablename string, organizeId string, auditStepCode string, entityPtr interface{}) {
-	var where string
-	where = " 1=1 and OrganizeId = '" + organizeId + "' and AuditStepCode = '" + auditStepCode + "' "
-	s.GetEntityByWhere(tablename, where, entityPtr)
-	return
-}

+ 3 - 4
src/dashoo.cn/backend/api/business/oilsupplier/auditsetting/oilauditsetting.go → src/dashoo.cn/backend/api/business/oilsupplier/classorgsetting/oilclassorgsetting.go

@@ -1,17 +1,16 @@
-package auditsetting
+package classorgsetting
 
 import (
 	"time"
 )
 
-type OilAuditSetting struct {
+type OilClassOrgSetting struct {
 	Id             int       `xorm:"not null pk autoincr INT(10)"`
+	ClassId        int       `xorm:"not null default 0 comment('分类编码ID') INT(11)"`
 	OrganizeId     int       `xorm:"not null default 0 comment('单位ID') INT(10)"`
 	OrganizeName   string    `xorm:"comment('单位名称') VARCHAR(100)"`
 	AuditStepCode  string    `xorm:"not null default '0' comment('审批步骤编码') VARCHAR(20)"`
 	AuditStepName  string    `xorm:"comment('审批步骤名称') VARCHAR(50)"`
-	RoleId         int       `xorm:"not null default 0 comment('角色ID') INT(10)"`
-	RoleName       string    `xorm:"comment('角色名称') VARCHAR(50)"`
 	Remark         string    `xorm:"comment('备注') VARCHAR(500)"`
 	IsDelete       int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
 	CreateOn       time.Time `xorm:"DATETIME"`

+ 17 - 0
src/dashoo.cn/backend/api/business/oilsupplier/classorgsetting/oilclassorgsettingService.go

@@ -0,0 +1,17 @@
+package classorgsetting
+
+import (
+. "dashoo.cn/backend/api/mydb"
+"github.com/go-xorm/xorm"
+)
+
+type OilClassOrgSettingService struct {
+	MyServiceBase
+}
+
+func GetOilClassOrgSettingService(xormEngine *xorm.Engine) *OilClassOrgSettingService {
+	s := new(OilClassOrgSettingService)
+	s.DBE = xormEngine
+	return s
+}
+

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -240,6 +240,7 @@ var (
 	OilWinningProjectName           string = "OilWinningProject"           //近三年获得省部级及以上主要技术、管理成果、获奖项目
 	OilTechsrvDetailViewName        string = "oil_techsrv_detail_view"     //技术服务类视图
 	OilGoodsAptDetailViewName       string = "oil_goodsapt_detail_view"    //物資类视图
+	OilClassOrgSettingName       	string = "OilClassOrgSetting"    	   //分类部门审批配置表
 )
 
 //分页信息及数据

+ 320 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/classorgsetting.go

@@ -0,0 +1,320 @@
+package oilsupplier
+
+import (
+"dashoo.cn/business/userRole"
+"dashoo.cn/backend/api/business/baseUser"
+"dashoo.cn/backend/api/business/oilsupplier/classorgsetting"
+. "dashoo.cn/backend/api/controllers"
+"dashoo.cn/utils"
+"encoding/json"
+"strings"
+"time"
+)
+
+type OilClassOrgSettingController struct {
+	BaseController
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []classorgsetting.OilClassOrgSetting
+// @router /list [get]
+func (this *OilClassOrgSettingController) GetEntityList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	Id := this.GetString("Id")
+	ClassId := this.GetString("ClassId")
+	OrganizeId := this.GetString("OrganizeId")
+	OrganizeName := this.GetString("OrganizeName")
+	AuditStepCode := this.GetString("AuditStepCode")
+	AuditStepName := this.GetString("AuditStepName")
+	Remark := this.GetString("Remark")
+	IsDelete := this.GetString("IsDelete")
+	CreateOn := this.GetString("CreateOn")
+	CreateUserId := this.GetString("CreateUserId")
+	CreateBy := this.GetString("CreateBy")
+	ModifiedOn := this.GetString("ModifiedOn")
+	ModifiedUserId := this.GetString("ModifiedUserId")
+	ModifiedBy := this.GetString("ModifiedBy")
+
+	if Id != "" {
+		where = where + " and Id like '%" + Id + "%'"
+	}
+
+
+	if ClassId != "" {
+		where = where + " and ClassId like '%" + ClassId + "%'"
+	}
+
+
+	if OrganizeId != "" {
+		where = where + " and OrganizeId like '%" + OrganizeId + "%'"
+	}
+
+
+	if OrganizeName != "" {
+		where = where + " and OrganizeName like '%" + OrganizeName + "%'"
+	}
+
+
+	if AuditStepCode != "" {
+		where = where + " and AuditStepCode like '%" + AuditStepCode + "%'"
+	}
+
+
+	if AuditStepName != "" {
+		where = where + " and AuditStepName like '%" + AuditStepName + "%'"
+	}
+
+
+	if Remark != "" {
+		where = where + " and Remark like '%" + Remark + "%'"
+	}
+
+
+	if IsDelete != "" {
+		where = where + " and IsDelete like '%" + IsDelete + "%'"
+	}
+
+
+	if CreateOn != "" {
+		where = where + " and CreateOn like '%" + CreateOn + "%'"
+	}
+
+
+	if CreateUserId != "" {
+		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+	}
+
+
+	if CreateBy != "" {
+		where = where + " and CreateBy like '%" + CreateBy + "%'"
+	}
+
+
+	if ModifiedOn != "" {
+		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+	}
+
+
+	if ModifiedUserId != "" {
+		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+	}
+
+
+	if ModifiedBy != "" {
+		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+	}
+
+
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+		}
+	}
+
+	svc := classorgsetting.GetOilClassOrgSettingService(utils.DBE)
+	var list []classorgsetting.OilClassOrgSetting
+	total := svc.GetPagingEntitiesWithOrderBytbl("", 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()
+}
+
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /dictlist [get]
+func (this *OilClassOrgSettingController) GetDictList() {
+	dictList := make(map[string]interface{})
+	//dictSvc := items.GetItemsService(utils.DBE)
+	userSvc := baseUser.GetBaseUserService(utils.DBE)
+	//customerSvc := svccustomer.GetCustomerService(utils.DBE)
+	//dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", "")
+	var userEntity userRole.Base_User
+	userSvc.GetEntityById(this.User.Id, &userEntity)
+	dictList["Supervisers"] = userSvc.GetUserListByDepartmentId("", userEntity.Departmentid)
+
+	//var dictCustomer []svccustomer.Customer
+	//customerSvc.GetEntitysByWhere("" + CustomerName, "", &dictCustomer)
+	//dictList["EntrustCorp"] = &dictCustomer
+
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取实体
+// @Description 获取实体
+// @Success 200 {object} classorgsetting.OilClassOrgSetting
+// @router /get/:id [get]
+func (this *OilClassOrgSettingController) GetEntity() {
+	Id := this.Ctx.Input.Param(":id")
+
+	var model classorgsetting.OilClassOrgSetting
+	svc := classorgsetting.GetOilClassOrgSettingService(utils.DBE)
+	svc.GetEntityByIdBytbl(OilClassOrgSettingName, Id, &model)
+
+	this.Data["json"] = &model
+	this.ServeJSON()
+}
+
+// @Title 添加
+// @Description 新增
+// @Param 	body body classorgsetting.OilClassOrgSetting
+// @Success	200	{object} controllers.Request
+// @router /add [post]
+func (this *OilClassOrgSettingController) AddEntity() {
+	var model classorgsetting.OilClassOrgSetting
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := classorgsetting.GetOilClassOrgSettingService(utils.DBE)
+
+	json.Unmarshal(jsonBlob, &model)
+	model.CreateOn = time.Now()
+	model.CreateBy = this.User.Realname
+	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+	model.OrganizeId, _ = utils.StrTo(this.User.DepartmentId).Int()
+
+	_, err := svc.InsertEntityBytbl(OilClassOrgSettingName, &model)
+
+	var errinfo ErrorDataInfo
+	if err == nil {
+		//新增
+		errinfo.Message = "添加成功!"
+		errinfo.Code = 0
+		errinfo.Item = model.Id
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 修改实体
+// @Description 修改实体
+// @Param 	body body classorgsetting.OilClassOrgSetting
+// @Success	200	{object} controllers.Request
+// @router /update/:id [post]
+func (this *OilClassOrgSettingController) UpdateEntity() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	var model classorgsetting.OilClassOrgSetting
+	svc := classorgsetting.GetOilClassOrgSettingService(utils.DBE)
+
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &model)
+	model.ModifiedOn = time.Now()
+	model.ModifiedBy = this.User.Realname
+	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	cols := []string{
+
+		"Id",
+
+		"ClassId",
+
+		"OrganizeId",
+
+		"OrganizeName",
+
+		"AuditStepCode",
+
+		"AuditStepName",
+
+		"Remark",
+
+		"IsDelete",
+
+		"CreateOn",
+
+		"CreateUserId",
+
+		"CreateBy",
+
+		"ModifiedOn",
+
+		"ModifiedUserId",
+
+		"ModifiedBy",
+
+
+	}
+	err := svc.UpdateEntityBytbl(OilClassOrgSettingName, id, &model, cols)
+	if err == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 删除单条信息
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /delete/:Id [delete]
+func (this *OilClassOrgSettingController) DeleteEntity() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model classorgsetting.OilClassOrgSetting
+	var entityempty classorgsetting.OilClassOrgSetting
+	svc := classorgsetting.GetOilClassOrgSettingService(utils.DBE)
+	opdesc := "删除-" + Id
+	err := svc.DeleteOperationAndWriteLogBytbl(OilClassOrgSettingName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, "", "钻井日报")
+	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()
+	}
+}
+
+

+ 2 - 2
src/dashoo.cn/backend/api/routers/router.go

@@ -289,9 +289,9 @@ func init() {
 			),
 		),
 		//工作流
-		beego.NSNamespace("/workflow",
+		beego.NSNamespace("/classorgsetting",
 			beego.NSInclude(
-				&workflow.WorkflowController{},
+				&oilsupplier.OilClassOrgSettingController{},
 			),
 		),
 	)

+ 41 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/classorgsetting.js

@@ -0,0 +1,41 @@
+export default {
+  getList (CreateOn, params, myAxios) {
+    return myAxios({
+      url: '/classorgsetting/list?CreateOn=' + CreateOn,
+      method: 'GET',
+      params: params
+    })
+  },
+  getDictList (myAxios) {
+    return myAxios({
+      url: '/classorgsetting/dictlist/',
+      method: 'GET'
+    })
+  },
+  getEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/classorgsetting/get/' + entityId,
+      method: 'GET'
+    })
+  },
+  addEntity (formData, myAxios) {
+    return myAxios({
+      url: '/classorgsetting/add',
+      method: 'post',
+      data: formData
+    })
+  },
+  updateEntity (entityId, formData, myAxios) {
+    return myAxios({
+      url: '/classorgsetting/update/' + entityId,
+      method: 'post',
+      data: formData
+    })
+  },
+  deleteEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/classorgsetting/delete/' + entityId,
+      method: 'delete'
+    })
+  }
+}