xuwenhao il y a 8 mois
Parent
commit
f6ea51006e

+ 1 - 1
server/dao/borrowing.go

@@ -12,7 +12,7 @@ type Borrowing struct {
 	ApplicationTime string          `json:"applicationTime" form:"applicationTime" gorm:"comment:申请日期"`
 	Charge          int             `json:"charge" form:"charge" gorm:"comment:负责人"`
 	User            SysUser         `json:"user" form:"user" gorm:"foreignKey:Charge;references:id;"`
-	Price           decimal.Decimal `json:"price" form:"price" gorm:"comment:支借金额;type:decimal(10,2)"`
+	BorrowingPrice  decimal.Decimal `json:"borrowingPrice" form:"borrowingPrice" gorm:"comment:支借金额;type:decimal(10,2)"`
 }
 
 func (Borrowing) TableName() string {

+ 4 - 4
server/dao/collection.go

@@ -7,10 +7,10 @@ import (
 
 type Collection struct {
 	global.GVA_MODEL
-	ProjectCode    string          `json:"projectCode" from:"projectCode" gorm:"comment:项目编码"`
-	Price          decimal.Decimal `json:"price" from:"price" gorm:"type:decimal(10,2);not null;comment:收款金额"`
-	Remarks        string          `json:"remarks" from:"remarks" gorm:"comment:备注"`
-	CollectionTime string          `json:"collectionTime" from:"collectionTime" gorm:"comment:收款日期;type:datetime"`
+	ProjectCode     string          `json:"projectCode" from:"projectCode" gorm:"comment:项目编码"`
+	CollectionPrice decimal.Decimal `json:"collectionPrice" from:"collectionPrice" gorm:"type:decimal(10,2);not null;comment:收款金额"`
+	Remarks         string          `json:"remarks" from:"remarks" gorm:"comment:备注"`
+	CollectionTime  string          `json:"collectionTime" from:"collectionTime" gorm:"comment:收款日期;type:datetime"`
 }
 
 func (Collection) TableName() string {

+ 2 - 2
server/dao/constructor.go

@@ -7,8 +7,8 @@ import (
 
 type Constructor struct {
 	global.GVA_MODEL
-	Name  string          `json:"name" form:"name" gorm:"comment:施工人员姓名"`
-	Price decimal.Decimal `json:"price" form:"price" gorm:"type:decimal(10,2);not null;comment:人天单价"`
+	Name     string          `json:"name" form:"name" gorm:"comment:施工人员姓名"`
+	OnePrice decimal.Decimal `json:"onePrice" form:"onePrice" gorm:"type:decimal(10,2);not null;comment:人天单价"`
 }
 
 func (Constructor) TableName() string {

+ 1 - 1
server/dao/dailyFeeDetails.go

@@ -10,7 +10,7 @@ type DailyFeeDetails struct {
 	DailyFeeId uint            `json:"dailyFeeId" form:"dailyFeeId" gorm:"comment:日常费用id"`
 	FeeTime    string          `json:"feeTime" form:"feeTime" gorm:"comment:日常费用期"`
 	Illustrate string          `json:"illustrate" form:"illustrate" gorm:"comment:费用说明"`
-	Price      decimal.Decimal `json:"price" form:"price" gorm:"type:decimal(10,2);comment:报销金额"`
+	FeePrice   decimal.Decimal `json:"feePrice" form:"feePrice" gorm:"type:decimal(10,2);comment:报销金额"`
 }
 
 func (DailyFeeDetails) TableName() string {

+ 1 - 1
server/dao/feeDetails.go

@@ -11,7 +11,7 @@ type FeeDetails struct {
 	Genre           string          `json:"genre" form:"genre" gorm:"comment:项目类型"`
 	Subject         string          `json:"subject" form:"subject" gorm:"comment:科目"`
 	Remarks         string          `json:"remarks" form:"remarks" gorm:"comment:备注"`
-	Price           decimal.Decimal `json:"price" form:"price" gorm:"comment:报销金额;type:decimal(10,2)"`
+	FeePrice        decimal.Decimal `json:"feePrice" form:"feePrice" gorm:"comment:报销金额;type:decimal(10,2)"`
 }
 
 func (FeeDetails) TableName() string {

+ 2 - 2
server/dao/projectWorkingHours.go

@@ -53,12 +53,12 @@ func QueryWorkingHoursSum(limit, offset, people int, code, time, yearTime string
 	}
 
 	var results []Result
-	db := global.GVA_DB.Model(&ProjectWorkingHours{}).Select("people,constructor.`name`,SUM(days) as sum_day,(SUM(days) * price) as price_sum").
+	db := global.GVA_DB.Model(&ProjectWorkingHours{}).Select("people,constructor.`name`,SUM(days) as sum_day,(SUM(days) * one_price) as price_sum").
 		Joins("JOIN constructor ON project_working_hours.people = constructor.id")
 
 	// 如果有条件搜索 下方会自动创建搜索语句
 	if code != "" {
-		db = db.Where("project_code = ?", "%"+code+"%")
+		db = db.Where("project_code like ?", "%"+code+"%")
 	}
 	if people != 0 {
 		db = db.Where("people = ?", people)

+ 16 - 13
server/dao/reimbursement.go

@@ -8,15 +8,16 @@ import (
 
 type Reimbursement struct {
 	global.GVA_MODEL
-	ProjectCode     string          `json:"projectCode" form:"projectCode" gorm:"comment:项目编号"`
-	Name            string          `json:"name" form:"name" gorm:"comment:项目名称"`
-	Applicant       string          `json:"applicant" form:"applicant" gorm:"comment:报销申请人"`
-	ApplicationTime string          `json:"applicationTime" form:"applicationTime" gorm:"comment:申请日期"`
-	Approval        int             `json:"approval" form:"approval" gorm:"comment:报销审批人"`
-	User            SysUser         `json:"user" form:"user" gorm:"foreignKey:Approval;references:id;"`
-	Price           decimal.Decimal `json:"price" form:"price" gorm:"comment:项目金额;type:decimal(10,2)"`
-	Genre           string          `json:"genre" form:"genre" gorm:"comment:费用类型"`
-	FeeDetails      []FeeDetails    `json:"feeDetails" form:"feeDetails" gorm:"-"`
+	ProjectCode        string          `json:"projectCode" form:"projectCode" gorm:"comment:项目编号"`
+	Name               string          `json:"name" form:"name" gorm:"comment:项目名称"`
+	Applicant          string          `json:"applicant" form:"applicant" gorm:"comment:报销申请人"`
+	ApplicationTime    string          `json:"applicationTime" form:"applicationTime" gorm:"comment:申请日期"`
+	Approval           int             `json:"approval" form:"approval" gorm:"comment:报销审批人"`
+	User               SysUser         `json:"user" form:"user" gorm:"foreignKey:Approval;references:id;"`
+	ReimbursementPrice decimal.Decimal `json:"reimbursementPrice" form:"reimbursementPrice" gorm:"comment:项目金额;type:decimal(10,2)"`
+	Genre              int             `json:"genre" form:"genre" gorm:"comment:费用类型"`
+	ExpensesGenre      ExpensesGenre   `json:"expensesGenre" form:"expensesGenre" gorm:"foreignKey:Genre;references:id;"`
+	FeeDetails         []FeeDetails    `json:"feeDetails" form:"feeDetails" gorm:"-"`
 }
 
 func (Reimbursement) TableName() string {
@@ -31,7 +32,7 @@ func QueryReimbursementList(limit, offset int, code, name, time string) (reimbur
 	db := global.GVA_DB.Model(&Reimbursement{}).Where("project_code = ?", code)
 	// 如果有条件搜索 下方会自动创建搜索语句
 	if name != "" {
-		db = db.Where("name LIKE ?", "%"+name+"%")
+		db = db.Where("applicant LIKE ?", "%"+name+"%")
 	}
 	if time != "" {
 		db = db.Where("DATE_FORMAT(application_time, '%Y-%m') = ?", time)
@@ -40,12 +41,12 @@ func QueryReimbursementList(limit, offset int, code, name, time string) (reimbur
 	if err != nil {
 		return
 	}
-	err = db.Order("id desc").Limit(limit).Offset(offset).Preload("User").Find(&reimbursement).Error
+	err = db.Order("id desc").Limit(limit).Offset(offset).Preload("ExpensesGenre").Preload("User").Find(&reimbursement).Error
 	return reimbursement, total, err
 }
 
 func QueryReimbursement(code string) (reimbursement []Reimbursement, err error) {
-	err = global.GVA_DB.Model(&Reimbursement{}).Where("project_code = ?", code).Preload("User").Find(&reimbursement).Error
+	err = global.GVA_DB.Model(&Reimbursement{}).Where("project_code = ?", code).Preload("ExpensesGenre").Preload("User").Find(&reimbursement).Error
 	return reimbursement, err
 }
 
@@ -59,6 +60,7 @@ func (r Reimbursement) CreateReimbursement() error {
 			return txErr
 		}
 		for _, feeDetail := range r.FeeDetails {
+			feeDetail.ReimbursementId = r.ID
 			txErr := tx.Create(&feeDetail).Error
 			if txErr != nil {
 				return txErr
@@ -77,11 +79,12 @@ func (r Reimbursement) UpdateReimbursement() error {
 		if txErr != nil {
 			return txErr
 		}
-		txErr = tx.Model(&r).Updates(&r).Error
+		txErr = tx.Model(&r).Where("id = ?", r.ID).Updates(&r).Error
 		if txErr != nil {
 			return txErr
 		}
 		for _, feeDetail := range r.FeeDetails {
+			feeDetail.ReimbursementId = r.ID
 			txErr := tx.Create(&feeDetail).Error
 			if txErr != nil {
 				return txErr

+ 1 - 1
server/model/common/request/common.go

@@ -39,7 +39,7 @@ type SearchProject struct {
 
 type SearchWorkingHours struct {
 	PageInfo PageInfo `json:"pageInfo" form:"pageInfo"`
-	Code     string   `json:"name" form:"name"`
+	Code     string   `json:"code" form:"code"`
 	Time     string   `json:"time" form:"time"`
 	YearTime string   `json:"yearTime" form:"yearTime"`
 	People   int      `json:"people" form:"people"`

+ 0 - 3
server/service/admin/project.go

@@ -1,7 +1,6 @@
 package admin
 
 import (
-	"fmt"
 	"github.com/shopspring/decimal"
 	"server/dao"
 	"server/model/common/request"
@@ -55,7 +54,6 @@ func (ps *ProjectService) QueryAllProject() ([]dao.Project, error) {
 }
 
 func (ps *ProjectService) QueryProjectsInfo() (sum decimal.Decimal, totalProject, completeProject, unCompleteProject int, err error) {
-
 	projects, err := dao.QueryAllProject()
 	if err != nil {
 		return
@@ -67,7 +65,6 @@ func (ps *ProjectService) QueryProjectsInfo() (sum decimal.Decimal, totalProject
 		}
 		sum = sum.Add(project.Price)
 	}
-	fmt.Printf("%y", sum)
 	unCompleteProject = totalProject - completeProject
 	return
 }

+ 1 - 5
web/src/view/finance/borrowing/borrowing.vue

@@ -459,7 +459,7 @@
 </template>
 
 <script setup>
-import { onMounted, ref, reactive } from 'vue'
+import { onMounted, ref } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import {
   createBorrowing,
@@ -652,7 +652,6 @@ const saveDailyExpenses = async() => {
 
 // 详情
 const expensesDetailsData = (val) => {
-  console.log(val)
   dailyExpensesData.value = val
   openDailyExpenses.value = true
 }
@@ -674,7 +673,6 @@ const erasureDailyExpenses = async() => {
   )
     .then(async() => {
       await deleteDailyExpenses(dd).then(res => {
-        console.log(res)
         if (res.code === 0) {
           ElMessage.success('删除成功')
           queryData()
@@ -745,7 +743,6 @@ const saveBorrowing = async() => {
 // 删除
 const erasureBorrowing = async() => {
   const dd = borrowingData.value
-  console.log(borrowingData.value)
   ElMessageBox.confirm(
     '确定进行删除操作吗?',
     '删除',
@@ -757,7 +754,6 @@ const erasureBorrowing = async() => {
   )
     .then(async() => {
       await deleteBorrowing(dd).then(res => {
-        console.log(res)
         if (res.code === 0) {
           ElMessage.success('删除成功')
           queryData()

+ 6 - 6
web/src/view/finance/workingHours/workingHours.vue

@@ -168,7 +168,7 @@
               </el-form-item>
               <el-form-item label="人天单价">
                 <el-input
-                  v-model="constructorData.price"
+                  v-model="constructorData.onePrice"
                   style="width: 400px"
                 />
               </el-form-item>
@@ -188,7 +188,7 @@
                   label="姓名"
                 />
                 <el-table-column
-                  prop="price"
+                  prop="onePrice"
                   label="人天单价"
                 />
               </el-table>
@@ -283,7 +283,7 @@ const constructorOptions = ref()
 const constructorData = ref({
   id: null,
   name: '',
-  price: null,
+  onePrice: null,
 })
 
 const searchData = ref({
@@ -371,18 +371,18 @@ const changeConstructor = (val) => {
   for (const key in constructorOptions.value) {
     if (constructorOptions.value[key].ID === val) {
       constructorData.value.name = constructorOptions.value[key].name
-      constructorData.value.price = constructorOptions.value[key].price
+      constructorData.value.onePrice = constructorOptions.value[key].onePrice
     }
   }
 }
 
 // 保存
 const saveConstructor = async() => {
-  if (constructorData.value.name === '' || constructorData.value.price === null) {
+  if (constructorData.value.name === '' || constructorData.value.onePrice === null) {
     ElMessage.error('数据不能为空')
     return false
   }
-  if (constructorData.value.id === null) {
+  if (constructorData.value.id === null || constructorData.value.id === undefined) {
     await createConstructor(constructorData.value).then(res => {
       if (res.code === 0) {
         ElMessage.success('新增成功')