Browse Source

部门考核改版

pull/4/head
超级管理员 3 years ago
parent
commit
bc05bb96b9
  1. 50
      README.md
  2. 986
      api/version1/departmentseting/departmentpc/qualitativekpi.go
  3. 106
      api/version1/departmentseting/departmentpc/type.go
  4. 15
      apirouter/v1/departmentseting/pc.go
  5. 9
      models/modelshr/administrative_organization.go
  6. 82
      models/modelshr/user_post_duties.go
  7. 64
      models/modelskpi/assesstarget.go
  8. 75
      models/modelskpi/qualitative_target.go
  9. 70
      models/modelskpi/son_target_father.go
  10. 23
      models/modelskpi/target_department.go
  11. 67
      models/modelskpi/target_report.go
  12. 22
      overall/publicmethod/technique.go

50
README.md

@ -102,4 +102,54 @@ CREATE TABLE `target_department` (
添加 model 文件
路径 models->modelskpi target_department.go
```
```
Time:2022-08-12
指标部门、岗位上报人对照表
CREATE TABLE `target_report` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`target_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标ID',
`target_sun_id` bigint(20) unsigned NOT NULL COMMENT '子目标',
`target_bylaws` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标细则',
`department_id` bigint(20) unsigned DEFAULT '0' COMMENT '部门ID',
`post_id` bigint(20) unsigned DEFAULT '0' COMMENT '岗位ID',
`type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型(1:公司级;2:部门级)',
`state` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1:启用;2:禁用;3:删除)',
`man_key` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '提报人ID',
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='指标、子栏目、细则部门、岗位上报人对照表';
```
```
Time:2022-08-16
创建子栏目关联指标视图 son_target_father
select `qt`.`q_id` AS `q_id`,`qt`.`q_title` AS `q_title`,`qt`.`q_parent_id` AS `q_parent_id`,`qt`.`q_state` AS `q_state`,`qt`.`q_time` AS `q_time`,`qt`.`q_depart` AS `q_depart`,`et`.`et_title` AS `et_title`,`et`.`et_type` AS `et_type`,`et`.`et_dimension` AS `et_dimension`,`et`.`et_key` AS `et_key`,`et`.`et_unit` AS `et_unit`,`et`.`et_cycle` AS `et_cycle`,`et`.`et_cycleattr` AS `et_cycleattr`,`et`.`et_scoring_method` AS `et_scoring_method` from (`qualitative_target` `qt` left join `evaluationtarget` `et` on((`qt`.`q_parent_id` = `et`.`et_id`)))
创建用户与职务、岗位关联视图 user_post_duties (HR数据库)
select `pc`.`mobilephone` AS `mobilephone`,`pc`.`gender` AS `gender`,`ps`.`name` AS `postname`,`ps`.`person_in_charge` AS `leading_cadre`,`ps`.`superior` AS `post_superior`,`ps`.`menu_permit` AS `menu_permit`,`ps`.`button_permit` AS `button_permit`,`pd`.`name` AS `duties_name`,`pa`.`id` AS `id`,`pa`.`number` AS `number`,`pa`.`name` AS `name`,`pa`.`icon` AS `icon`,`pa`.`company` AS `company`,`pa`.`maindeparment` AS `maindeparment`,`pa`.`admin_org` AS `admin_org`,`pa`.`position` AS `position`,`pa`.`job_id` AS `job_id`,`pa`.`job_leve` AS `job_leve`,`pa`.`wechat` AS `wechat`,`pa`.`work_wechat` AS `work_wechat`,`pa`.`is_admin` AS `is_admin`,`pa`.`key` AS `key`,`pa`.`role` AS `role`,`pa`.`password` AS `password`,`pa`.`sun_main_deparment` AS `sun_main_deparment`,`pa`.`teamid` AS `teamid` from (((`person_archives` `pa` join `personnel_content` `pc` on((`pa`.`key` = `pc`.`key`))) join `position` `ps` on((`pa`.`position` = `ps`.`id`))) join `duties` `pd` on((`pa`.`job_id` = `pd`.`id`)))
```
<span style="color:#FF0000; font-size:20px;">
Time:2022-08-16 <br>
埋坑(1) 待以后编写相应模块 PS:该问题解决后删除此记录
</span>
```
F:\goobject\src\key_performance_indicators\api\version1\departmentseting\departmentpc\qualitativekpi.go
函数 DelSonTarget
文件 第 1138 行
预留判断该指标是否在使用中
```

986
api/version1/departmentseting/departmentpc/qualitativekpi.go

File diff suppressed because it is too large

106
api/version1/departmentseting/departmentpc/type.go

@ -3,12 +3,16 @@ package departmentpc
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
// 协程设置
var syncSeting = sync.WaitGroup{}
// 部门考核WEB端入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
@ -42,3 +46,105 @@ type departOutcome struct {
Superior string `json:"superior"` //上级
Ispower int `json:"ispower"` //是否为主部门
}
// 转换提报人格式化
type zhuanHuanMan struct {
Id int64 `json:"id"`
Operator []string `json:"operator"`
}
// 获取相关提报人
type getAboutReportTarget struct {
TargetId string `json:"targetid"`
TargetSunId string `json:"targetsunid"`
TargetBylaws string `json:"targetbylaws"`
DepartmentId string `json:"departmentid"`
PostId string `json:"postid"`
}
// 输出上报人信息
type printReportCont struct {
Id string `json:"id"`
Name string `json:"name"`
GroupName string `json:"groupname"`
DepartmentName string `json:"departmentname"`
Icon string `json:"icon"`
Number string `json:"number"`
}
// 添加 定性考核指标关系指定
type AddQualEval struct {
Group string `json:"group"` //归属集团
AcceptDepartmentId []string `json:"parentid"` //接受考核部门
Type int `json:"type"` //1:定性考核;2:定量考核
Target string `json:"target"` //考核指标
TargetSunTitle string `json:"targetsuntitle"` //考核指标子栏目
EvaluationList []QualEvalSunList `json:"evaluationlist"` //测评详情
}
// 定性考核内容
type QualEvalSunList struct {
Title string `json:"title"` //考核内容
Content string `json:"content"` //备注说明
Unit string `json:"unit"` //单位
ReferenceScore string `json:"referencescore"` //考核标准
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
CycleAttres int `json:"cycleattr"` //辅助计数
Operator []string `json:"userlist"` //考核执行人
AddOrReduce int `json:"addorreduce"` //操作类型 1:减少;2:增加;3:用户自定义
CensorType []string `json:"censortype"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
CensorCont string `json:"censorcont"` //客观证据
CensorRate int `json:"censorrate"` //检查频次
}
// 获取定性考核指标列表查询参数
type getDepartTargetContType struct {
publicmethod.PagesTurn
TargetId string `json:"targetid"` //指标ID
DepartmentId string `json:"departmentid"` //部门ID
ReportPerson string `json:"reportperson"` //上报人
Cycle int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年
TargetSunId string `json:"targetsunid"` //考核子栏目
}
// 输出定性指标详细内容列表
type printDepartTargetCont struct {
modelskpi.DetailedTarget
Standard string `json:"standard"` //标准
CensorTypeList []string `json:"censortypelist"` //检查方式(1:现场检查;2:资料检查;3:事件触发)
}
// 根据指标栏目新增指标细则
type basisSonTargetAddDet struct {
publicmethod.PublicId
QualEvalSunList
}
// 根据指标和部门获取相关岗位
type bgdgp struct {
TargetId string `json:"targetid"` //指标
TargetSunId string `json:"targetsunid"` //子栏目
TargetBylaws string `json:"targetbylaws"` //细则
DepartmentId string `json:"departmentid"` //部门
Level int `json:"level"` //级别(1:部门级;2:岗位级)
}
// 根据指标、部门和岗位获取相关提交人
type btdgr struct {
bgdgp
PostId string `json:"postid"` //岗位
}
// 修改子栏目标题名称级考核关联部门及提报人
type editTarDepartReport struct {
TargetSunId string `json:"targetsunid"` //子栏目
Title string `json:"title"` //考核内容
AcceptDepartmentId []string `json:"acceptdepartmentid"` //接受考核部门
Operator []string `json:"userlist"` //考核执行人
}
// 输出
type outCont struct {
publicmethod.PublicId
publicmethod.PublicName
}

15
apirouter/v1/departmentseting/pc.go

@ -15,8 +15,17 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
apiRouter.POST("departmenttargetlist", methodBinding.DepartmentTargetList) //部门指标列表
apiRouter.POST("shiyan", methodBinding.Shiyan) //实验
apiRouter.POST("getdepartabouttarget", methodBinding.GetDepartAboutTarget) //获取部门定性考核部门关联列表
apiRouter.POST("gettargetreport", methodBinding.GetTargetReport) //获取部门指标相关执行人
apiRouter.POST("addsuntargetdetailed", methodBinding.AddSunTargetDetailed) //添加定性考核子栏目及细则
apiRouter.POST("getdepartmenttragetcontlist", methodBinding.GetDepartmentTragetContList) //获取定性考核指标列表内容
apiRouter.POST("basissontargetadddetailed", methodBinding.BasisSonTargetAddDetailed) //根据指标栏目新增指标细则
apiRouter.POST("basistargetdearpetmentgetpost", methodBinding.BasisTargetDearpetmentGetPost) //根据指标和部门获取相关岗位
apiRouter.POST("basistaegetdeparmentreport", methodBinding.BasisTaegetDeparmentReport) //获取部门指标岗位提交人
apiRouter.POST("editsontargetdepartmentreport", methodBinding.EditSonTargetDepartmentReport) //修改子栏目标题名称级考核关联部门及提报人
apiRouter.POST("getsontargetcont", methodBinding.GetSonTargetCont) //获取子栏目基础信息
apiRouter.POST("delsontarget", methodBinding.DelSonTarget) //删除子栏目
}
}

9
models/modelshr/administrative_organization.go

@ -51,7 +51,12 @@ func (cont *AdministrativeOrganization) CountCont(whereMap interface{}) (countId
}
// 读取全部信息
func (cont *AdministrativeOrganization) ContMap(whereMap interface{}) (countAry []AdministrativeOrganization) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Find(&countAry)
func (cont *AdministrativeOrganization) ContMap(whereMap interface{}, field ...string) (countAry []AdministrativeOrganization) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb.Where(whereMap).Find(&countAry)
return
}

82
models/modelshr/user_post_duties.go

@ -0,0 +1,82 @@
package modelshr
import (
"key_performance_indicators/overall"
"strings"
)
type UserPostDuties struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"`
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"`
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"`
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"`
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"`
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"`
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"`
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"`
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"`
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"`
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"`
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"`
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管`
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"`
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"`
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"`
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"`
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"`
PostName string `json:"postname" gorm:"column:postname;type:varchar(255) unsigned;default:'';not null;comment:职位名称"`
PersonInCharge int `json:"personincharge" gorm:"column:leading_cadre;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"`
Superior int64 `json:"superior" gorm:"column:post_superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"`
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"`
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"`
DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"`
}
func (UserPostDuties *UserPostDuties) TableName() string {
return "user_post_duties"
}
// 编辑内容
func (cont *UserPostDuties) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *UserPostDuties) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *UserPostDuties) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *UserPostDuties) ContMap(whereMap interface{}, field ...string) (countAry []UserPostDuties, err error) {
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *UserPostDuties) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}

64
models/modelskpi/assesstarget.go

@ -0,0 +1,64 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 定性考核指标关系指定
type Assesstarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"`
Departmentmap string `json:"departmentmap" gorm:"column:departmentmap;type:mediumtext unsigned;default:0;comment:部门ID"`
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"`
SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"`
Content string `json:"content" gorm:"column:content;type:longtext;comment:描述"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
}
func (Assesstarget *Assesstarget) TableName() string {
return "assesstarget"
}
// 编辑内容
func (cont *Assesstarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Assesstarget) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *Assesstarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Assesstarget) ContMap(whereMap interface{}, field ...string) (countAry []Assesstarget, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Assesstarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

75
models/modelskpi/qualitative_target.go

@ -0,0 +1,75 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
"time"
)
// 定性测评指标子栏目
type QualitativeTarget struct {
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"`
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"`
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"`
}
func (QualitativeTarget *QualitativeTarget) TableName() string {
return "qualitative_target"
}
// 编辑内容
func (cont *QualitativeTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *QualitativeTarget) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *QualitativeTarget) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *QualitativeTarget) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeTarget, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *QualitativeTarget) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
// 判断子目标是否存在
func (cont *QualitativeTarget) JudgeIsTrue(whereMap interface{}, addCont QualitativeTarget) (err error) {
err = cont.GetCont(whereMap)
if err != nil {
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error
} else {
if cont.State != 1 {
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()})
}
}
return nil
}

70
models/modelskpi/son_target_father.go

@ -0,0 +1,70 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 子栏目关联指标视图
type SonTargetFather struct {
Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"`
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"`
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"`
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"`
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"`
EtTitle string `json:"ettitle" gorm:"column:et_title;type:varchar(255);comment:指标名称"`
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"`
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"`
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"`
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"`
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"`
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"`
}
func (SonTargetFather *SonTargetFather) TableName() string {
return "son_target_father"
}
// 编辑内容
func (cont *SonTargetFather) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *SonTargetFather) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *SonTargetFather) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *SonTargetFather) ContMap(whereMap interface{}, field ...string) (countAry []SonTargetFather, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *SonTargetFather) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

23
models/modelskpi/target_department.go

@ -5,18 +5,19 @@ import (
"strings"
)
// 考核维度
// 指标、栏目、细则关联部门
type TargetDepartment struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"`
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"`
ReportPerson string `json:"reportperson" gorm:"column:report_person;type:longtext;comment:上报人"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"`
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:指标;2:子目标;3:细则)"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
Class int `json:"class" gorm:"column:type;class:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
Level int `json:"level" gorm:"column:level;type:tinyint(1) unsigned;default:1;not null;comment:级别(1:部门级;2:岗位级)"`
}
func (TargetDepartment *TargetDepartment) TableName() string {

67
models/modelskpi/target_report.go

@ -0,0 +1,67 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 指标部门、岗位上报人对照表
type TargetReport struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"`
TargetSunId int64 `json:"targetsunid" gorm:"column:target_sun_id;type:bigint(20) unsigned;default:0;not null;comment:子目标"`
TargetBylaws int64 `json:"targetbylaws" gorm:"column:target_bylaws;type:bigint(20) unsigned;default:0;not null;comment:指标细则"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位ID"`
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:公司级;2:部门级)"`
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
ReportPerson int64 `json:"reportperson" gorm:"column:man_key;type:bigint(20) unsigned;default:0;not null;comment:上报人"`
ManDepartment int64 `json:"mandepartment" gorm:"column:man_department;type:bigint(20) unsigned;default:0;not null;comment:提报人所在部门"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
Class int `json:"class" gorm:"column:type;class:tinyint(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"`
}
func (TargetReport *TargetReport) TableName() string {
return "target_report"
}
// 编辑内容
func (cont *TargetReport) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *TargetReport) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *TargetReport) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *TargetReport) ContMap(whereMap interface{}, field ...string) (countAry []TargetReport, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *TargetReport) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

22
overall/publicmethod/technique.go

@ -485,3 +485,25 @@ func PageTurningSettings(gormDb *gorm.DB, page, pageSize int) *gorm.DB {
gormDb = gormDb.Limit(pageSize).Offset(LimitPage(page, pageSize))
return gormDb
}
//浮点数保留小数
/*
@value 浮点数值
@weishu 要保留的小数位数
*/
func DecimalEs(value float64, weishu int) float64 {
switch weishu {
case 3:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.3f", value), 64)
case 4:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.4f", value), 64)
case 5:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.5f", value), 64)
case 6:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.6f", value), 64)
default:
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
}
return value
}

Loading…
Cancel
Save