|
@@ -1,16 +1,25 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "ERP_project/Nats"
|
|
|
"ERP_project/Nats/NatsServer"
|
|
|
"ERP_project/conf"
|
|
|
+ "ERP_project/logs"
|
|
|
"ERP_project/models/Account"
|
|
|
"ERP_project/models/Project"
|
|
|
+ "baliance.com/gooxml/color"
|
|
|
+ "baliance.com/gooxml/document"
|
|
|
+ "baliance.com/gooxml/measurement"
|
|
|
+ "baliance.com/gooxml/schema/soo/wml"
|
|
|
"fmt"
|
|
|
+ natslibs "git.baozhida.cn/ERP_libs/Nats"
|
|
|
userlibs "git.baozhida.cn/ERP_libs/User"
|
|
|
"git.baozhida.cn/ERP_libs/lib"
|
|
|
"github.com/beego/beego/v2/adapter/orm"
|
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
|
"math"
|
|
|
+ "os"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
type ProjectController struct {
|
|
@@ -66,11 +75,13 @@ func (c *ProjectController) Project_List() {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
|
|
|
+ T_uuid := c.GetString("T_uuid")
|
|
|
+
|
|
|
userList, _ := NatsServer.Read_User_List_All()
|
|
|
Account.Read_User_All_Map(userList)
|
|
|
|
|
|
ProjectDao := Project.NewProject(orm.NewOrm())
|
|
|
- R_List, R_cnt := ProjectDao.Read_Project_List("", c.User.T_uuid, page, page_z)
|
|
|
+ R_List, R_cnt := ProjectDao.Read_Project_List(T_uuid, c.User.T_uuid, page, page_z)
|
|
|
|
|
|
var r_jsons lib.R_JSONS
|
|
|
r_jsons.Num = R_cnt
|
|
@@ -138,6 +149,729 @@ func (c *ProjectController) Project_Get() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// 导出单个项目
|
|
|
+func (c *ProjectController) Project_Word() {
|
|
|
+ os.Remove("/Users/zoie/work/bzd_project/ERP/ERP_project/ofile/simple.docx")
|
|
|
+
|
|
|
+ // 查询
|
|
|
+ T_id, _ := c.GetInt("T_id")
|
|
|
+
|
|
|
+ o := orm.NewOrm()
|
|
|
+ ProjectDao := Project.NewProject(o)
|
|
|
+ project, err := ProjectDao.Read_Project_ById(T_id)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "查询失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userList, _ := NatsServer.Read_User_List_All()
|
|
|
+ Account.Read_User_All_Map(userList)
|
|
|
+ detail := Project.ProjectToProject_Detail(project)
|
|
|
+
|
|
|
+ doc := document.New()
|
|
|
+
|
|
|
+ para := doc.AddParagraph()
|
|
|
+ run := para.AddRun()
|
|
|
+ run.Properties().SetSize(18)
|
|
|
+ run.AddText("")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetSize(18)
|
|
|
+ run.AddText("")
|
|
|
+
|
|
|
+ // Construct our header
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetBold(true)
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(18)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run.AddText("贵州宝智达网络科技有限公司")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetBold(true)
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(18)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run.AddText("研发立项申请书")
|
|
|
+
|
|
|
+ for i := 0; i < 5; i++ {
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetSize(18)
|
|
|
+ run.AddText("")
|
|
|
+ }
|
|
|
+ // --------------------项目名称
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().SetFirstLineIndent(1 * measurement.Inch)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText("项目名称:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText(detail.T_name)
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para.Properties().SetFirstLineIndent(1 * measurement.Inch)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText("项目负责人:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText(detail.T_user_name)
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para.Properties().SetFirstLineIndent(1 * measurement.Inch)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText("项目立项日期:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ date := strings.Split(detail.T_set_up_date, "-")
|
|
|
+ if len(date) == 3 {
|
|
|
+ run.AddText(fmt.Sprintf("%s年%s月%s日", date[0], date[1], date[2]))
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ }
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para.Properties().SetFirstLineIndent(1 * measurement.Inch)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ run.AddText("项目结束日期:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ date = strings.Split(detail.T_end_date, "-")
|
|
|
+ if len(date) == 3 {
|
|
|
+ run.AddText(fmt.Sprintf("%s年%s月%s日", date[0], date[1], date[2]))
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().AddSection(wml.ST_SectionMarkNextPage)
|
|
|
+
|
|
|
+ table := doc.AddTable()
|
|
|
+
|
|
|
+ table.Properties().SetLayout(wml.ST_TblLayoutTypeFixed)
|
|
|
+ table.Properties().SetWidthPercent(100)
|
|
|
+ look := table.Properties().TableLook()
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+
|
|
|
+ // width of the page
|
|
|
+ // with thick borers
|
|
|
+ borders := table.Properties().Borders()
|
|
|
+ borders.SetBottom(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetLeft(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetRight(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetTop(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetInsideHorizontal(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+ borders.SetInsideVertical(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ row := table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.4*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell := row.AddCell()
|
|
|
+ cell.Properties().SetWidth(0.4 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("序号")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("功能与指标")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("计划时间(工作日)")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("是否完成(原因)")
|
|
|
+
|
|
|
+ for i, r := range detail.T_Detail {
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(0.4 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%d", i+1))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(r.T_function)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", r.T_planned_time))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidth(1.25 * measurement.Inch)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(r.T_finish)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().AddSection(wml.ST_SectionMarkNextPage)
|
|
|
+
|
|
|
+ table = doc.AddTable()
|
|
|
+ table.Properties().SetWidthPercent(110)
|
|
|
+ table.Properties().SetAlignment(wml.ST_JcTableCenter)
|
|
|
+ table.Properties().SetLayout(wml.ST_TblLayoutTypeAutofit)
|
|
|
+ look = table.Properties().TableLook()
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+
|
|
|
+ borders = table.Properties().Borders()
|
|
|
+ borders.SetBottom(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetLeft(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetRight(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetTop(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetInsideHorizontal(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+ borders.SetInsideVertical(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ //-----------------项目名称
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("项目名称")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(75)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(detail.T_name)
|
|
|
+
|
|
|
+ //------------------项目简介
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("项目简介")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(75)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(detail.T_description)
|
|
|
+
|
|
|
+ // -----------------绩效统计
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeRestart)
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ //row.Properties().SetHeight(0.3*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("绩效统计")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(40)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("计划完成周期(工作日)")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(35)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", detail.T_planning_cycle))
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeContinue)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(40)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("实际完成周期(工作日)")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(35)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", detail.T_reality_cycle))
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeContinue)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(40)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("提前完成天数(工作日)")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(35)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", detail.T_advance_day))
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeContinue)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(23)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("奖励金额(元)")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", detail.T_bonus))
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(22)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("绩效总金额(元)")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("%g", detail.T_Perf))
|
|
|
+
|
|
|
+ // -----------------绩效统计
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeRestart)
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ //row.Properties().SetHeight(0.3*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("项目验收")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("验收时间")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("测试人"))
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText(fmt.Sprintf("验收人"))
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.5*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetVerticalMerge(wml.ST_MergeContinue)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(25)
|
|
|
+ cell.AddParagraph().AddRun().AddText("")
|
|
|
+
|
|
|
+ // 分页
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().AddSection(wml.ST_SectionMarkNextPage)
|
|
|
+
|
|
|
+ table = doc.AddTable()
|
|
|
+ table.Properties().SetWidthPercent(110)
|
|
|
+ table.Properties().SetAlignment(wml.ST_JcTableCenter)
|
|
|
+ table.Properties().SetLayout(wml.ST_TblLayoutTypeAutofit)
|
|
|
+ look = table.Properties().TableLook()
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+
|
|
|
+ borders = table.Properties().Borders()
|
|
|
+ borders.SetBottom(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetLeft(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetRight(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetTop(wml.ST_BorderSingle, color.Auto, 1.5*measurement.Point)
|
|
|
+ borders.SetInsideHorizontal(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+ borders.SetInsideVertical(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(1.8*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(30)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("部门负责人")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("审核意见")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(70)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("推荐项目经理为:")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("其他意见或建议:")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("部门负责人(签字/日期):")
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(2.5*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(30)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("技术总监")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("审核意见")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(70)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("是否同意立项:□同意 □不同意")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("是否同意推荐的项目经理:□同意 □不同意")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("其他意见或建议:")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("技术总监(签字/日期):")
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(2.5*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(30)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("总经理")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("审核意见")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(70)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("是否同意立项:□同意 □不同意")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("是否同意推荐的项目经理:□同意 □不同意")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("其他意见或建议:")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("总经理(签字/日期):")
|
|
|
+
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(2*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(100)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("最终审批意见为")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("(同意/不同意)立项,研发项目正式启动。")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(11)
|
|
|
+ run.AddText("日期:")
|
|
|
+
|
|
|
+ filename := fmt.Sprintf("研发立项书-%s-%s(%s)", detail.T_name, detail.T_user_name, lib.GetRandstring(6, "0123456789", 0))
|
|
|
+ // 保存文件
|
|
|
+ if err = doc.SaveToFile("ofile/" + filename + ".docx"); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上传 OSS
|
|
|
+ nats := natslibs.NewNats(Nats.Nats)
|
|
|
+ url, is := nats.Qiniu_UploadFile(lib.GetCurrentDirectory()+"/ofile/"+filename+".docx", "ofile/"+filename+".docx")
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "oss!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //删除目录
|
|
|
+ err = os.Remove("ofile/" + filename + ".docx")
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(lib.FuncName(), err)
|
|
|
+ }
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: url}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func createParaRun(doc *document.Document, s string) document.Run {
|
|
|
+ para := doc.AddParagraph()
|
|
|
+ run := para.AddRun()
|
|
|
+ run.AddText(s)
|
|
|
+ return run
|
|
|
+}
|
|
|
+
|
|
|
func (c *ProjectController) Project_Add() {
|
|
|
|
|
|
T_name := c.GetString("T_name")
|
|
@@ -214,7 +948,7 @@ func (c *ProjectController) Project_Add() {
|
|
|
//}
|
|
|
|
|
|
//o.Commit()
|
|
|
- NatsServer.AddNews(T_approver, fmt.Sprintf("您有一条【%s】的立项申请待审批", c.User.T_name), conf.ProjectApprovalUrl)
|
|
|
+ NatsServer.AddNews(T_approver, fmt.Sprintf("【立项申请】您有一条%s的立项申请待审批", c.User.T_name), conf.ProjectApprovalNewsUrl)
|
|
|
|
|
|
NatsServer.AddUserLogs(c.User.T_uuid, "项目", "添加", var_)
|
|
|
|
|
@@ -226,7 +960,7 @@ func (c *ProjectController) Project_Add() {
|
|
|
func (c *ProjectController) Project_Approval() {
|
|
|
|
|
|
T_id, _ := c.GetInt("T_id")
|
|
|
- T_state, _ := c.GetInt("T_state")
|
|
|
+ T_State, _ := c.GetInt("T_State")
|
|
|
|
|
|
o := orm.NewOrm()
|
|
|
ProjectDao := Project.NewProject(o)
|
|
@@ -237,22 +971,27 @@ func (c *ProjectController) Project_Approval() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+ if project.T_State == T_State {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: T_id}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
// 1 待审核 2 进行中 3 已完成 4 已发绩效
|
|
|
- project.T_State = T_state
|
|
|
+ project.T_State = T_State
|
|
|
_, err = ProjectDao.Update_Project(project, "T_State")
|
|
|
if err != nil {
|
|
|
c.Data["json"] = lib.JSONS{Code: 203, Msg: "添加失败"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- if T_state == Project.HaveInHand {
|
|
|
- NatsServer.AddNews(project.T_uid, fmt.Sprintf("您提交的项目(%s)【进行中】", project.T_name), conf.MyProjectUrl)
|
|
|
+ if T_State == Project.HaveInHand {
|
|
|
+ NatsServer.AddNews(project.T_uid, fmt.Sprintf("【项目审核】您提交的项目(%s)正在进行中", project.T_name), conf.MyProjectNewsUrl)
|
|
|
}
|
|
|
- if T_state == Project.Completed {
|
|
|
- NatsServer.AddNews(project.T_uid, fmt.Sprintf("您提交的项目(%s)【已完成】", project.T_name), conf.MyProjectUrl)
|
|
|
+ if T_State == Project.Completed {
|
|
|
+ NatsServer.AddNews(project.T_uid, fmt.Sprintf("【项目审核】您提交的项目(%s)已完成", project.T_name), conf.MyProjectNewsUrl)
|
|
|
}
|
|
|
- if T_state == Project.PayPerf {
|
|
|
- NatsServer.AddNews(project.T_uid, fmt.Sprintf("您提交的项目(%s)【已发绩效】", project.T_name), conf.MyProjectUrl)
|
|
|
+ if T_State == Project.PayPerf {
|
|
|
+ NatsServer.AddNews(project.T_uid, fmt.Sprintf("【项目审核】您提交的项目(%s)已发绩效", project.T_name), conf.MyProjectNewsUrl)
|
|
|
}
|
|
|
NatsServer.AddUserLogs(c.User.T_uuid, "项目", "审核", project)
|
|
|
|
|
@@ -268,10 +1007,12 @@ func (c *ProjectController) Project_Edit() {
|
|
|
T_description := c.GetString("T_description")
|
|
|
T_planning_cycle, _ := c.GetFloat("T_planning_cycle")
|
|
|
T_reality_cycle, _ := c.GetFloat("T_reality_cycle")
|
|
|
+ T_advance_day, _ := c.GetFloat("T_advance_day")
|
|
|
T_bonus, _ := c.GetFloat("T_bonus")
|
|
|
T_Perf, _ := c.GetFloat("T_Perf")
|
|
|
T_remark := c.GetString("T_remark")
|
|
|
T_detail := c.GetString("T_detail")
|
|
|
+ T_approver := c.GetString("T_approver")
|
|
|
|
|
|
o := orm.NewOrm()
|
|
|
//o.Begin()
|
|
@@ -316,6 +1057,10 @@ func (c *ProjectController) Project_Edit() {
|
|
|
project.T_reality_cycle = float32(T_reality_cycle)
|
|
|
clos = append(clos, "T_reality_cycle")
|
|
|
}
|
|
|
+ if T_advance_day > 0 {
|
|
|
+ project.T_advance_day = float32(T_advance_day)
|
|
|
+ clos = append(clos, "T_advance_day")
|
|
|
+ }
|
|
|
if T_bonus > 0 {
|
|
|
project.T_bonus = float32(T_bonus)
|
|
|
clos = append(clos, "T_bonus")
|
|
@@ -334,11 +1079,17 @@ func (c *ProjectController) Project_Edit() {
|
|
|
project.T_detail = T_detail
|
|
|
clos = append(clos, "T_detail")
|
|
|
}
|
|
|
+ if len(T_approver) > 0 {
|
|
|
+ project.T_approver = T_approver
|
|
|
+ clos = append(clos, "T_approver")
|
|
|
+ }
|
|
|
|
|
|
- // 1 待审核 2 进行中 3 已完成 4 已发绩效 项目状态为未通过,修改之后将状态更改待提交
|
|
|
- if project.T_State == 2 && c.User.T_uuid == project.T_uid {
|
|
|
- project.T_State = 1
|
|
|
- NatsServer.AddNews(project.T_approver, fmt.Sprintf("您有一条【%s】的立项申请待审批", c.User.T_name), conf.ProjectApprovalUrl)
|
|
|
+ // 1 待审核 2 进行中 3 已完成 4 已发绩效
|
|
|
+ // 用户自己修改 项目状态为未通过,修改之后将状态更改待提交
|
|
|
+ // 部门负责人修改 项目状态不变,修改之后将状态更改待提交
|
|
|
+ if project.T_State == 3 && c.User.T_uuid == project.T_uid {
|
|
|
+ project.T_State = 2
|
|
|
+ NatsServer.AddNews(project.T_uid, fmt.Sprintf("【项目审核】您提交的项目(%s)正在进行中", project.T_name), conf.ProjectApprovalNewsUrl)
|
|
|
}
|
|
|
|
|
|
_, err = ProjectDao.Update_Project(project, clos...)
|
|
@@ -349,42 +1100,6 @@ func (c *ProjectController) Project_Edit() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //if len(T_detail) > 0 {
|
|
|
- // err = ProjectDetailDao.Delete_ProjectDetail_ByT_project_id(project.Id)
|
|
|
- // if err != nil {
|
|
|
- // o.Rollback()
|
|
|
- // c.Data["json"] = lib.JSONS{Code: 203, Msg: "修改失败"}
|
|
|
- // c.ServeJSON()
|
|
|
- // return
|
|
|
- // }
|
|
|
- //}
|
|
|
- //
|
|
|
- //detailList := lib.SplitString(T_detail, "|")
|
|
|
- //for _, v := range detailList {
|
|
|
- // T_function := strings.Split(v, ",")[0]
|
|
|
- // T_planned_time := strings.Split(v, ",")[1]
|
|
|
- // T_finish := strings.Split(v, ",")[2]
|
|
|
- // temp, _ := strconv.ParseFloat(T_planned_time, 64)
|
|
|
- // T_planned_time64, _ := decimal.NewFromFloat(temp).Round(2).Float64()
|
|
|
- //
|
|
|
- // detail := Project.ProjectDetail{
|
|
|
- // T_project_id: project.Id,
|
|
|
- // T_function: T_function,
|
|
|
- // T_planned_time: float32(T_planned_time64),
|
|
|
- // T_finish: T_finish,
|
|
|
- // }
|
|
|
- // _, err = ProjectDetailDao.Add_ProjectDetail(detail)
|
|
|
- // if err != nil {
|
|
|
- // o.Rollback()
|
|
|
- // c.Data["json"] = lib.JSONS{Code: 203, Msg: "添加失败"}
|
|
|
- // c.ServeJSON()
|
|
|
- // return
|
|
|
- // }
|
|
|
- //
|
|
|
- //}
|
|
|
- //
|
|
|
- //o.Commit()
|
|
|
-
|
|
|
NatsServer.AddUserLogs(c.User.T_uuid, "项目", "修改", project)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: project.Id}
|
|
@@ -439,3 +1154,47 @@ func (c *ProjectController) Project_Del() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+func (c *ProjectController) User_List() {
|
|
|
+ var r_jsons lib.R_JSONS
|
|
|
+ T_Finance, _ := c.GetInt("T_Finance")
|
|
|
+ // 分页参数 初始化
|
|
|
+ page, _ := c.GetInt("page")
|
|
|
+ if page < 1 {
|
|
|
+ page = 1
|
|
|
+ }
|
|
|
+ page_z, _ := c.GetInt("page_z")
|
|
|
+ if page_z < 1 {
|
|
|
+ page_z = conf.Page_size
|
|
|
+ }
|
|
|
+
|
|
|
+ T_name := c.GetString("T_name")
|
|
|
+
|
|
|
+ ProjectDao := Project.NewProject(orm.NewOrm())
|
|
|
+ t_uuid := c.User.T_uuid
|
|
|
+ if T_Finance == 1 {
|
|
|
+ t_uuid = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ uuidList := ProjectDao.Read_T_uuid_List(t_uuid)
|
|
|
+ if len(uuidList) == 0 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ R_List, R_cnt, err := NatsServer.Read_User_List_T_uuid(T_name, uuidList, page, page_z)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "查询失败"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ r_jsons.Num = R_cnt
|
|
|
+ r_jsons.Data = R_List
|
|
|
+ r_jsons.Page = page
|
|
|
+ r_jsons.Page_size = int(math.Ceil(float64(R_cnt) / float64(page_z)))
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|