caipin 4 lat temu
rodzic
commit
17441fbe2f

+ 1 - 0
models/cm_tree_contracts.go

@@ -10,6 +10,7 @@ type CmTreeContracts struct {
 	ParentId     int       `xorm:"not null comment('父级ID') INT(11)"`
 	Name         string    `xorm:"not null comment('名称') VARCHAR(64)"`
 	Code         string    `xorm:"comment('项目节编号') VARCHAR(32)"`
+	Code2        string    `xorm:"comment('项目节编号2') VARCHAR(512)"`
 	Depth        int       `xorm:"not null comment('深度') TINYINT(4)"`
 	Serial       int       `xorm:"not null comment('序号') INT(11)"`
 	Attribution  string    `xorm:"comment('归属') VARCHAR(32)"`

+ 2 - 1
services/contract_section_tree_service.go

@@ -234,9 +234,10 @@ func (s *contractService) SectionSave(sectionData *viewmodels.TreeSectionContrac
 	// 2.保存
 	sectionCM := &models.CmTreeContracts{}
 	sectionCM.Name = sectionData.Name
+	sectionCM.Code2 = sectionData.Code2
 	sectionCM.Id = section.Id
 
-	err = s.treeContractDao.Save(sectionCM, []string{"Name"})
+	err = s.treeContractDao.Save(sectionCM, []string{"Name", "Code2"})
 	if err != nil {
 		return errors.New("保存失败")
 	}

+ 8 - 3
services/contract_service.go

@@ -10,9 +10,12 @@ import (
 	"errors"
 	"html"
 	"log"
+	"strconv"
 	"time"
 
 	"github.com/kataras/iris/v12"
+	"go.mod/comm"
+	"go.mod/conf"
 	"go.mod/dao"
 	"go.mod/datasource"
 	"go.mod/models"
@@ -42,7 +45,7 @@ type ContractService interface {
 	MoveSerial(sectionData *viewmodels.TreeSectionContract) error
 	UpdateContractId(id int, contractId int) error
 
-	SaveUpload(Location string, Filename string, ext string) (int, error)
+	SaveUpload(Location string, Filename string, ext string) (string, error)
 }
 
 //返回service操作类
@@ -268,7 +271,7 @@ func (s *contractService) Add(contractData *viewmodels.Contracts, treeId int) er
 }
 
 // 保存上传文件
-func (s *contractService) SaveUpload(Location string, Filename string, ext string) (int, error) {
+func (s *contractService) SaveUpload(Location string, Filename string, ext string) (string, error) {
 	// 文件保存
 	uploadCm := &models.CmUpload{}
 
@@ -281,5 +284,7 @@ func (s *contractService) SaveUpload(Location string, Filename string, ext strin
 		return 0, err
 	}
 
-	return uploadCm.Id, nil
+	id, _ := comm.AesEncrypt(strconv.Itoa(uploadCm.Id), conf.SignSecret)
+
+	return id, nil
 }

+ 1 - 0
web/api/contract_section_tree_api.go

@@ -284,6 +284,7 @@ func (c *ContractApi) PostSectionAdd() {
 // @Security ApiKeyAuth
 // @Param   id     body    string     true        "项目节ID"
 // @Param   name     body    string     true        "项目节名称"
+// @Param   code2     body    string     true        "编号名称"
 // @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/contract/section/save [post]
 func (c *ContractApi) PostSectionSave() {

+ 1 - 1
web/api/upload_api.go

@@ -30,7 +30,7 @@ type UploadApi struct {
 // Upload : 处理文件上传
 func (c *UploadApi) Post() {
 	errCode := 0
-	id := 0
+	id := "0"
 	defer func() {
 		if errCode < 0 {
 			c.Ctx.JSON(iris.Map{"code": -1, "msg": "上传失败"})

+ 1 - 0
web/viewmodels/tree_section_contract.go

@@ -23,6 +23,7 @@ type TreeSectionContract struct {
 	Serial      int    `form:"serial" json:"serial"`
 	Attribution string `form:"attribution" json:"attribution"`
 	Code        string `form:"code" json:"code"`
+	Code2       string `form:"code2" json:"code2"`
 	// ProjectId    string `form:"projectId" json:"projectId"`
 	// BidsectionId string `form:"bidsectionId" json:"bidsectionId"`
 	ContractId string `form:"contractId" json:"contractId"`